diff options
author | Andrei Otcheretianski <andrei.otcheretianski@intel.com> | 2013-11-18 12:06:49 -0500 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-12-02 05:51:52 -0500 |
commit | b176e629402f41f2b984d3aa842ddae23ed5562e (patch) | |
tree | d7bf11ae06d568756a3394ec3127f65e4f973eac /net/mac80211 | |
parent | 017b45bb5c5b40d9da1ea671aa8bc2eaec73675f (diff) |
cfg80211: aggregate mgmt_tx parameters into a struct
Change cfg80211 and mac80211 to use cfg80211_mgmt_tx_params
struct to aggregate parameters for mgmt_tx functions.
This makes the functions' signatures less clumsy and allows
less painful parameters extension.
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
[fix all other drivers]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r-- | net/mac80211/cfg.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index c7b3e57aec04..267d3aca9947 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -3167,26 +3167,25 @@ static int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, | |||
3167 | } | 3167 | } |
3168 | 3168 | ||
3169 | static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, | 3169 | static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, |
3170 | struct ieee80211_channel *chan, bool offchan, | 3170 | struct cfg80211_mgmt_tx_params *params, |
3171 | unsigned int wait, const u8 *buf, size_t len, | 3171 | u64 *cookie) |
3172 | bool no_cck, bool dont_wait_for_ack, u64 *cookie) | ||
3173 | { | 3172 | { |
3174 | struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev); | 3173 | struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev); |
3175 | struct ieee80211_local *local = sdata->local; | 3174 | struct ieee80211_local *local = sdata->local; |
3176 | struct sk_buff *skb; | 3175 | struct sk_buff *skb; |
3177 | struct sta_info *sta; | 3176 | struct sta_info *sta; |
3178 | const struct ieee80211_mgmt *mgmt = (void *)buf; | 3177 | const struct ieee80211_mgmt *mgmt = (void *)params->buf; |
3179 | bool need_offchan = false; | 3178 | bool need_offchan = false; |
3180 | u32 flags; | 3179 | u32 flags; |
3181 | int ret; | 3180 | int ret; |
3182 | 3181 | ||
3183 | if (dont_wait_for_ack) | 3182 | if (params->dont_wait_for_ack) |
3184 | flags = IEEE80211_TX_CTL_NO_ACK; | 3183 | flags = IEEE80211_TX_CTL_NO_ACK; |
3185 | else | 3184 | else |
3186 | flags = IEEE80211_TX_INTFL_NL80211_FRAME_TX | | 3185 | flags = IEEE80211_TX_INTFL_NL80211_FRAME_TX | |
3187 | IEEE80211_TX_CTL_REQ_TX_STATUS; | 3186 | IEEE80211_TX_CTL_REQ_TX_STATUS; |
3188 | 3187 | ||
3189 | if (no_cck) | 3188 | if (params->no_cck) |
3190 | flags |= IEEE80211_TX_CTL_NO_CCK_RATE; | 3189 | flags |= IEEE80211_TX_CTL_NO_CCK_RATE; |
3191 | 3190 | ||
3192 | switch (sdata->vif.type) { | 3191 | switch (sdata->vif.type) { |
@@ -3234,7 +3233,7 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, | |||
3234 | /* configurations requiring offchan cannot work if no channel has been | 3233 | /* configurations requiring offchan cannot work if no channel has been |
3235 | * specified | 3234 | * specified |
3236 | */ | 3235 | */ |
3237 | if (need_offchan && !chan) | 3236 | if (need_offchan && !params->chan) |
3238 | return -EINVAL; | 3237 | return -EINVAL; |
3239 | 3238 | ||
3240 | mutex_lock(&local->mtx); | 3239 | mutex_lock(&local->mtx); |
@@ -3247,8 +3246,10 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, | |||
3247 | chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); | 3246 | chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); |
3248 | 3247 | ||
3249 | if (chanctx_conf) { | 3248 | if (chanctx_conf) { |
3250 | need_offchan = chan && (chan != chanctx_conf->def.chan); | 3249 | need_offchan = params->chan && |
3251 | } else if (!chan) { | 3250 | (params->chan != |
3251 | chanctx_conf->def.chan); | ||
3252 | } else if (!params->chan) { | ||
3252 | ret = -EINVAL; | 3253 | ret = -EINVAL; |
3253 | rcu_read_unlock(); | 3254 | rcu_read_unlock(); |
3254 | goto out_unlock; | 3255 | goto out_unlock; |
@@ -3258,19 +3259,19 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, | |||
3258 | rcu_read_unlock(); | 3259 | rcu_read_unlock(); |
3259 | } | 3260 | } |
3260 | 3261 | ||
3261 | if (need_offchan && !offchan) { | 3262 | if (need_offchan && !params->offchan) { |
3262 | ret = -EBUSY; | 3263 | ret = -EBUSY; |
3263 | goto out_unlock; | 3264 | goto out_unlock; |
3264 | } | 3265 | } |
3265 | 3266 | ||
3266 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + len); | 3267 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + params->len); |
3267 | if (!skb) { | 3268 | if (!skb) { |
3268 | ret = -ENOMEM; | 3269 | ret = -ENOMEM; |
3269 | goto out_unlock; | 3270 | goto out_unlock; |
3270 | } | 3271 | } |
3271 | skb_reserve(skb, local->hw.extra_tx_headroom); | 3272 | skb_reserve(skb, local->hw.extra_tx_headroom); |
3272 | 3273 | ||
3273 | memcpy(skb_put(skb, len), buf, len); | 3274 | memcpy(skb_put(skb, params->len), params->buf, params->len); |
3274 | 3275 | ||
3275 | IEEE80211_SKB_CB(skb)->flags = flags; | 3276 | IEEE80211_SKB_CB(skb)->flags = flags; |
3276 | 3277 | ||
@@ -3290,8 +3291,8 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, | |||
3290 | local->hw.offchannel_tx_hw_queue; | 3291 | local->hw.offchannel_tx_hw_queue; |
3291 | 3292 | ||
3292 | /* This will handle all kinds of coalescing and immediate TX */ | 3293 | /* This will handle all kinds of coalescing and immediate TX */ |
3293 | ret = ieee80211_start_roc_work(local, sdata, chan, | 3294 | ret = ieee80211_start_roc_work(local, sdata, params->chan, |
3294 | wait, cookie, skb, | 3295 | params->wait, cookie, skb, |
3295 | IEEE80211_ROC_TYPE_MGMT_TX); | 3296 | IEEE80211_ROC_TYPE_MGMT_TX); |
3296 | if (ret) | 3297 | if (ret) |
3297 | kfree_skb(skb); | 3298 | kfree_skb(skb); |