Selaa lähdekoodia

mac80211: document sleep requirements for channel context ops

Channel context driver operations can sleep, so add might_sleep()
and document this.

Signed-off-by: Chaitanya T K <chaitanya.mgit@gmail.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Chaitanya T K 9 vuotta sitten
vanhempi
commit
dcae9e0203
3 muutettua tiedostoa jossa 18 lisäystä ja 0 poistoa
  1. 6 0
      include/net/mac80211.h
  2. 2 0
      net/mac80211/driver-ops.c
  3. 10 0
      net/mac80211/driver-ops.h

+ 6 - 0
include/net/mac80211.h

@@ -3172,18 +3172,24 @@ enum ieee80211_reconfig_type {
  *	The callback is optional and can sleep.
  *	The callback is optional and can sleep.
  *
  *
  * @add_chanctx: Notifies device driver about new channel context creation.
  * @add_chanctx: Notifies device driver about new channel context creation.
+ *	This callback may sleep.
  * @remove_chanctx: Notifies device driver about channel context destruction.
  * @remove_chanctx: Notifies device driver about channel context destruction.
+ *	This callback may sleep.
  * @change_chanctx: Notifies device driver about channel context changes that
  * @change_chanctx: Notifies device driver about channel context changes that
  *	may happen when combining different virtual interfaces on the same
  *	may happen when combining different virtual interfaces on the same
  *	channel context with different settings
  *	channel context with different settings
+ *	This callback may sleep.
  * @assign_vif_chanctx: Notifies device driver about channel context being bound
  * @assign_vif_chanctx: Notifies device driver about channel context being bound
  *	to vif. Possible use is for hw queue remapping.
  *	to vif. Possible use is for hw queue remapping.
+ *	This callback may sleep.
  * @unassign_vif_chanctx: Notifies device driver about channel context being
  * @unassign_vif_chanctx: Notifies device driver about channel context being
  *	unbound from vif.
  *	unbound from vif.
+ *	This callback may sleep.
  * @switch_vif_chanctx: switch a number of vifs from one chanctx to
  * @switch_vif_chanctx: switch a number of vifs from one chanctx to
  *	another, as specified in the list of
  *	another, as specified in the list of
  *	@ieee80211_vif_chanctx_switch passed to the driver, according
  *	@ieee80211_vif_chanctx_switch passed to the driver, according
  *	to the mode defined in &ieee80211_chanctx_switch_mode.
  *	to the mode defined in &ieee80211_chanctx_switch_mode.
+ *	This callback may sleep.
  *
  *
  * @start_ap: Start operation on the AP interface, this is called after all the
  * @start_ap: Start operation on the AP interface, this is called after all the
  *	information in bss_conf is set and beacon can be retrieved. A channel
  *	information in bss_conf is set and beacon can be retrieved. A channel

+ 2 - 0
net/mac80211/driver-ops.c

@@ -236,6 +236,8 @@ int drv_switch_vif_chanctx(struct ieee80211_local *local,
 	int ret = 0;
 	int ret = 0;
 	int i;
 	int i;
 
 
+	might_sleep();
+
 	if (!local->ops->switch_vif_chanctx)
 	if (!local->ops->switch_vif_chanctx)
 		return -EOPNOTSUPP;
 		return -EOPNOTSUPP;
 
 

+ 10 - 0
net/mac80211/driver-ops.h

@@ -843,6 +843,8 @@ static inline int drv_add_chanctx(struct ieee80211_local *local,
 {
 {
 	int ret = -EOPNOTSUPP;
 	int ret = -EOPNOTSUPP;
 
 
+	might_sleep();
+
 	trace_drv_add_chanctx(local, ctx);
 	trace_drv_add_chanctx(local, ctx);
 	if (local->ops->add_chanctx)
 	if (local->ops->add_chanctx)
 		ret = local->ops->add_chanctx(&local->hw, &ctx->conf);
 		ret = local->ops->add_chanctx(&local->hw, &ctx->conf);
@@ -856,6 +858,8 @@ static inline int drv_add_chanctx(struct ieee80211_local *local,
 static inline void drv_remove_chanctx(struct ieee80211_local *local,
 static inline void drv_remove_chanctx(struct ieee80211_local *local,
 				      struct ieee80211_chanctx *ctx)
 				      struct ieee80211_chanctx *ctx)
 {
 {
+	might_sleep();
+
 	if (WARN_ON(!ctx->driver_present))
 	if (WARN_ON(!ctx->driver_present))
 		return;
 		return;
 
 
@@ -870,6 +874,8 @@ static inline void drv_change_chanctx(struct ieee80211_local *local,
 				      struct ieee80211_chanctx *ctx,
 				      struct ieee80211_chanctx *ctx,
 				      u32 changed)
 				      u32 changed)
 {
 {
+	might_sleep();
+
 	trace_drv_change_chanctx(local, ctx, changed);
 	trace_drv_change_chanctx(local, ctx, changed);
 	if (local->ops->change_chanctx) {
 	if (local->ops->change_chanctx) {
 		WARN_ON_ONCE(!ctx->driver_present);
 		WARN_ON_ONCE(!ctx->driver_present);
@@ -903,6 +909,8 @@ static inline void drv_unassign_vif_chanctx(struct ieee80211_local *local,
 					    struct ieee80211_sub_if_data *sdata,
 					    struct ieee80211_sub_if_data *sdata,
 					    struct ieee80211_chanctx *ctx)
 					    struct ieee80211_chanctx *ctx)
 {
 {
+	might_sleep();
+
 	if (!check_sdata_in_driver(sdata))
 	if (!check_sdata_in_driver(sdata))
 		return;
 		return;
 
 
@@ -925,6 +933,8 @@ static inline int drv_start_ap(struct ieee80211_local *local,
 {
 {
 	int ret = 0;
 	int ret = 0;
 
 
+	might_sleep();
+
 	if (!check_sdata_in_driver(sdata))
 	if (!check_sdata_in_driver(sdata))
 		return -EIO;
 		return -EIO;