Commit b176e629402f41f2b984d3aa842ddae23ed5562e
Committed by
Johannes Berg
1 parent
017b45bb5c
Exists in
smarc-imx_3.14.28_1.0.0_ga
and in
1 other branch
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>
Showing 10 changed files with 86 additions and 69 deletions Side-by-side Diff
drivers/net/wireless/ath/ath6kl/cfg80211.c
... | ... | @@ -3169,12 +3169,15 @@ |
3169 | 3169 | } |
3170 | 3170 | |
3171 | 3171 | static int ath6kl_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, |
3172 | - struct ieee80211_channel *chan, bool offchan, | |
3173 | - unsigned int wait, const u8 *buf, size_t len, | |
3174 | - bool no_cck, bool dont_wait_for_ack, u64 *cookie) | |
3172 | + struct cfg80211_mgmt_tx_params *params, u64 *cookie) | |
3175 | 3173 | { |
3176 | 3174 | struct ath6kl_vif *vif = ath6kl_vif_from_wdev(wdev); |
3177 | 3175 | struct ath6kl *ar = ath6kl_priv(vif->ndev); |
3176 | + struct ieee80211_channel *chan = params->chan; | |
3177 | + const u8 *buf = params->buf; | |
3178 | + size_t len = params->len; | |
3179 | + unsigned int wait = params->wait; | |
3180 | + bool no_cck = params->no_cck; | |
3178 | 3181 | u32 id, freq; |
3179 | 3182 | const struct ieee80211_mgmt *mgmt; |
3180 | 3183 | bool more_data, queued; |
drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
... | ... | @@ -3973,11 +3973,12 @@ |
3973 | 3973 | |
3974 | 3974 | static int |
3975 | 3975 | brcmf_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, |
3976 | - struct ieee80211_channel *chan, bool offchan, | |
3977 | - unsigned int wait, const u8 *buf, size_t len, | |
3978 | - bool no_cck, bool dont_wait_for_ack, u64 *cookie) | |
3976 | + struct cfg80211_mgmt_tx_params *params, u64 *cookie) | |
3979 | 3977 | { |
3980 | 3978 | struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); |
3979 | + struct ieee80211_channel *chan = params->chan; | |
3980 | + const u8 *buf = params->buf; | |
3981 | + size_t len = params->len; | |
3981 | 3982 | const struct ieee80211_mgmt *mgmt; |
3982 | 3983 | struct brcmf_cfg80211_vif *vif; |
3983 | 3984 | s32 err = 0; |
drivers/net/wireless/mwifiex/cfg80211.c
... | ... | @@ -184,10 +184,10 @@ |
184 | 184 | */ |
185 | 185 | static int |
186 | 186 | mwifiex_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, |
187 | - struct ieee80211_channel *chan, bool offchan, | |
188 | - unsigned int wait, const u8 *buf, size_t len, | |
189 | - bool no_cck, bool dont_wait_for_ack, u64 *cookie) | |
187 | + struct cfg80211_mgmt_tx_params *params, u64 *cookie) | |
190 | 188 | { |
189 | + const u8 *buf = params->buf; | |
190 | + size_t len = params->len; | |
191 | 191 | struct sk_buff *skb; |
192 | 192 | u16 pkt_len; |
193 | 193 | const struct ieee80211_mgmt *mgmt; |
include/net/cfg80211.h
... | ... | @@ -1944,6 +1944,29 @@ |
1944 | 1944 | }; |
1945 | 1945 | |
1946 | 1946 | /** |
1947 | + * struct cfg80211_mgmt_tx_params - mgmt tx parameters | |
1948 | + * | |
1949 | + * This structure provides information needed to transmit a mgmt frame | |
1950 | + * | |
1951 | + * @chan: channel to use | |
1952 | + * @offchan: indicates wether off channel operation is required | |
1953 | + * @wait: duration for ROC | |
1954 | + * @buf: buffer to transmit | |
1955 | + * @len: buffer length | |
1956 | + * @no_cck: don't use cck rates for this frame | |
1957 | + * @dont_wait_for_ack: tells the low level not to wait for an ack | |
1958 | + */ | |
1959 | +struct cfg80211_mgmt_tx_params { | |
1960 | + struct ieee80211_channel *chan; | |
1961 | + bool offchan; | |
1962 | + unsigned int wait; | |
1963 | + const u8 *buf; | |
1964 | + size_t len; | |
1965 | + bool no_cck; | |
1966 | + bool dont_wait_for_ack; | |
1967 | +}; | |
1968 | + | |
1969 | +/** | |
1947 | 1970 | * struct cfg80211_ops - backend description for wireless configuration |
1948 | 1971 | * |
1949 | 1972 | * This struct is registered by fullmac card drivers and/or wireless stacks |
... | ... | @@ -2341,9 +2364,8 @@ |
2341 | 2364 | u64 cookie); |
2342 | 2365 | |
2343 | 2366 | int (*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev, |
2344 | - struct ieee80211_channel *chan, bool offchan, | |
2345 | - unsigned int wait, const u8 *buf, size_t len, | |
2346 | - bool no_cck, bool dont_wait_for_ack, u64 *cookie); | |
2367 | + struct cfg80211_mgmt_tx_params *params, | |
2368 | + u64 *cookie); | |
2347 | 2369 | int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy, |
2348 | 2370 | struct wireless_dev *wdev, |
2349 | 2371 | u64 cookie); |
net/mac80211/cfg.c
... | ... | @@ -3167,26 +3167,25 @@ |
3167 | 3167 | } |
3168 | 3168 | |
3169 | 3169 | static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, |
3170 | - struct ieee80211_channel *chan, bool offchan, | |
3171 | - unsigned int wait, const u8 *buf, size_t len, | |
3172 | - bool no_cck, bool dont_wait_for_ack, u64 *cookie) | |
3170 | + struct cfg80211_mgmt_tx_params *params, | |
3171 | + u64 *cookie) | |
3173 | 3172 | { |
3174 | 3173 | struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev); |
3175 | 3174 | struct ieee80211_local *local = sdata->local; |
3176 | 3175 | struct sk_buff *skb; |
3177 | 3176 | struct sta_info *sta; |
3178 | - const struct ieee80211_mgmt *mgmt = (void *)buf; | |
3177 | + const struct ieee80211_mgmt *mgmt = (void *)params->buf; | |
3179 | 3178 | bool need_offchan = false; |
3180 | 3179 | u32 flags; |
3181 | 3180 | int ret; |
3182 | 3181 | |
3183 | - if (dont_wait_for_ack) | |
3182 | + if (params->dont_wait_for_ack) | |
3184 | 3183 | flags = IEEE80211_TX_CTL_NO_ACK; |
3185 | 3184 | else |
3186 | 3185 | flags = IEEE80211_TX_INTFL_NL80211_FRAME_TX | |
3187 | 3186 | IEEE80211_TX_CTL_REQ_TX_STATUS; |
3188 | 3187 | |
3189 | - if (no_cck) | |
3188 | + if (params->no_cck) | |
3190 | 3189 | flags |= IEEE80211_TX_CTL_NO_CCK_RATE; |
3191 | 3190 | |
3192 | 3191 | switch (sdata->vif.type) { |
... | ... | @@ -3234,7 +3233,7 @@ |
3234 | 3233 | /* configurations requiring offchan cannot work if no channel has been |
3235 | 3234 | * specified |
3236 | 3235 | */ |
3237 | - if (need_offchan && !chan) | |
3236 | + if (need_offchan && !params->chan) | |
3238 | 3237 | return -EINVAL; |
3239 | 3238 | |
3240 | 3239 | mutex_lock(&local->mtx); |
... | ... | @@ -3247,8 +3246,10 @@ |
3247 | 3246 | chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); |
3248 | 3247 | |
3249 | 3248 | if (chanctx_conf) { |
3250 | - need_offchan = chan && (chan != chanctx_conf->def.chan); | |
3251 | - } else if (!chan) { | |
3249 | + need_offchan = params->chan && | |
3250 | + (params->chan != | |
3251 | + chanctx_conf->def.chan); | |
3252 | + } else if (!params->chan) { | |
3252 | 3253 | ret = -EINVAL; |
3253 | 3254 | rcu_read_unlock(); |
3254 | 3255 | goto out_unlock; |
3255 | 3256 | |
3256 | 3257 | |
... | ... | @@ -3258,19 +3259,19 @@ |
3258 | 3259 | rcu_read_unlock(); |
3259 | 3260 | } |
3260 | 3261 | |
3261 | - if (need_offchan && !offchan) { | |
3262 | + if (need_offchan && !params->offchan) { | |
3262 | 3263 | ret = -EBUSY; |
3263 | 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 | 3268 | if (!skb) { |
3268 | 3269 | ret = -ENOMEM; |
3269 | 3270 | goto out_unlock; |
3270 | 3271 | } |
3271 | 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 | 3276 | IEEE80211_SKB_CB(skb)->flags = flags; |
3276 | 3277 | |
... | ... | @@ -3290,8 +3291,8 @@ |
3290 | 3291 | local->hw.offchannel_tx_hw_queue; |
3291 | 3292 | |
3292 | 3293 | /* This will handle all kinds of coalescing and immediate TX */ |
3293 | - ret = ieee80211_start_roc_work(local, sdata, chan, | |
3294 | - wait, cookie, skb, | |
3294 | + ret = ieee80211_start_roc_work(local, sdata, params->chan, | |
3295 | + params->wait, cookie, skb, | |
3295 | 3296 | IEEE80211_ROC_TYPE_MGMT_TX); |
3296 | 3297 | if (ret) |
3297 | 3298 | kfree_skb(skb); |
net/wireless/core.h
... | ... | @@ -317,9 +317,8 @@ |
317 | 317 | void cfg80211_mlme_purge_registrations(struct wireless_dev *wdev); |
318 | 318 | int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev, |
319 | 319 | struct wireless_dev *wdev, |
320 | - struct ieee80211_channel *chan, bool offchan, | |
321 | - unsigned int wait, const u8 *buf, size_t len, | |
322 | - bool no_cck, bool dont_wait_for_ack, u64 *cookie); | |
320 | + struct cfg80211_mgmt_tx_params *params, | |
321 | + u64 *cookie); | |
323 | 322 | void cfg80211_oper_and_ht_capa(struct ieee80211_ht_cap *ht_capa, |
324 | 323 | const struct ieee80211_ht_cap *ht_capa_mask); |
325 | 324 | void cfg80211_oper_and_vht_capa(struct ieee80211_vht_cap *vht_capa, |
net/wireless/mlme.c
... | ... | @@ -520,9 +520,7 @@ |
520 | 520 | |
521 | 521 | int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev, |
522 | 522 | struct wireless_dev *wdev, |
523 | - struct ieee80211_channel *chan, bool offchan, | |
524 | - unsigned int wait, const u8 *buf, size_t len, | |
525 | - bool no_cck, bool dont_wait_for_ack, u64 *cookie) | |
523 | + struct cfg80211_mgmt_tx_params *params, u64 *cookie) | |
526 | 524 | { |
527 | 525 | const struct ieee80211_mgmt *mgmt; |
528 | 526 | u16 stype; |
529 | 527 | |
... | ... | @@ -533,10 +531,10 @@ |
533 | 531 | if (!rdev->ops->mgmt_tx) |
534 | 532 | return -EOPNOTSUPP; |
535 | 533 | |
536 | - if (len < 24 + 1) | |
534 | + if (params->len < 24 + 1) | |
537 | 535 | return -EINVAL; |
538 | 536 | |
539 | - mgmt = (const struct ieee80211_mgmt *) buf; | |
537 | + mgmt = (const struct ieee80211_mgmt *)params->buf; | |
540 | 538 | |
541 | 539 | if (!ieee80211_is_mgmt(mgmt->frame_control)) |
542 | 540 | return -EINVAL; |
... | ... | @@ -615,9 +613,7 @@ |
615 | 613 | return -EINVAL; |
616 | 614 | |
617 | 615 | /* Transmit the Action frame as requested by user space */ |
618 | - return rdev_mgmt_tx(rdev, wdev, chan, offchan, | |
619 | - wait, buf, len, no_cck, dont_wait_for_ack, | |
620 | - cookie); | |
616 | + return rdev_mgmt_tx(rdev, wdev, params, cookie); | |
621 | 617 | } |
622 | 618 | |
623 | 619 | bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_mbm, |
net/wireless/nl80211.c
... | ... | @@ -7428,11 +7428,11 @@ |
7428 | 7428 | void *hdr = NULL; |
7429 | 7429 | u64 cookie; |
7430 | 7430 | struct sk_buff *msg = NULL; |
7431 | - unsigned int wait = 0; | |
7432 | - bool offchan, no_cck, dont_wait_for_ack; | |
7431 | + struct cfg80211_mgmt_tx_params params = { | |
7432 | + .dont_wait_for_ack = | |
7433 | + info->attrs[NL80211_ATTR_DONT_WAIT_FOR_ACK], | |
7434 | + }; | |
7433 | 7435 | |
7434 | - dont_wait_for_ack = info->attrs[NL80211_ATTR_DONT_WAIT_FOR_ACK]; | |
7435 | - | |
7436 | 7436 | if (!info->attrs[NL80211_ATTR_FRAME]) |
7437 | 7437 | return -EINVAL; |
7438 | 7438 | |
7439 | 7439 | |
7440 | 7440 | |
7441 | 7441 | |
7442 | 7442 | |
... | ... | @@ -7458,24 +7458,24 @@ |
7458 | 7458 | if (info->attrs[NL80211_ATTR_DURATION]) { |
7459 | 7459 | if (!(rdev->wiphy.flags & WIPHY_FLAG_OFFCHAN_TX)) |
7460 | 7460 | return -EINVAL; |
7461 | - wait = nla_get_u32(info->attrs[NL80211_ATTR_DURATION]); | |
7461 | + params.wait = nla_get_u32(info->attrs[NL80211_ATTR_DURATION]); | |
7462 | 7462 | |
7463 | 7463 | /* |
7464 | 7464 | * We should wait on the channel for at least a minimum amount |
7465 | 7465 | * of time (10ms) but no longer than the driver supports. |
7466 | 7466 | */ |
7467 | - if (wait < NL80211_MIN_REMAIN_ON_CHANNEL_TIME || | |
7468 | - wait > rdev->wiphy.max_remain_on_channel_duration) | |
7467 | + if (params.wait < NL80211_MIN_REMAIN_ON_CHANNEL_TIME || | |
7468 | + params.wait > rdev->wiphy.max_remain_on_channel_duration) | |
7469 | 7469 | return -EINVAL; |
7470 | 7470 | |
7471 | 7471 | } |
7472 | 7472 | |
7473 | - offchan = info->attrs[NL80211_ATTR_OFFCHANNEL_TX_OK]; | |
7473 | + params.offchan = info->attrs[NL80211_ATTR_OFFCHANNEL_TX_OK]; | |
7474 | 7474 | |
7475 | - if (offchan && !(rdev->wiphy.flags & WIPHY_FLAG_OFFCHAN_TX)) | |
7475 | + if (params.offchan && !(rdev->wiphy.flags & WIPHY_FLAG_OFFCHAN_TX)) | |
7476 | 7476 | return -EINVAL; |
7477 | 7477 | |
7478 | - no_cck = nla_get_flag(info->attrs[NL80211_ATTR_TX_NO_CCK_RATE]); | |
7478 | + params.no_cck = nla_get_flag(info->attrs[NL80211_ATTR_TX_NO_CCK_RATE]); | |
7479 | 7479 | |
7480 | 7480 | /* get the channel if any has been specified, otherwise pass NULL to |
7481 | 7481 | * the driver. The latter will use the current one |
7482 | 7482 | |
... | ... | @@ -7487,10 +7487,10 @@ |
7487 | 7487 | return err; |
7488 | 7488 | } |
7489 | 7489 | |
7490 | - if (!chandef.chan && offchan) | |
7490 | + if (!chandef.chan && params.offchan) | |
7491 | 7491 | return -EINVAL; |
7492 | 7492 | |
7493 | - if (!dont_wait_for_ack) { | |
7493 | + if (!params.dont_wait_for_ack) { | |
7494 | 7494 | msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); |
7495 | 7495 | if (!msg) |
7496 | 7496 | return -ENOMEM; |
... | ... | @@ -7503,10 +7503,10 @@ |
7503 | 7503 | } |
7504 | 7504 | } |
7505 | 7505 | |
7506 | - err = cfg80211_mlme_mgmt_tx(rdev, wdev, chandef.chan, offchan, wait, | |
7507 | - nla_data(info->attrs[NL80211_ATTR_FRAME]), | |
7508 | - nla_len(info->attrs[NL80211_ATTR_FRAME]), | |
7509 | - no_cck, dont_wait_for_ack, &cookie); | |
7506 | + params.buf = nla_data(info->attrs[NL80211_ATTR_FRAME]); | |
7507 | + params.len = nla_len(info->attrs[NL80211_ATTR_FRAME]); | |
7508 | + params.chan = chandef.chan; | |
7509 | + err = cfg80211_mlme_mgmt_tx(rdev, wdev, ¶ms, &cookie); | |
7510 | 7510 | if (err) |
7511 | 7511 | goto free_msg; |
7512 | 7512 |
net/wireless/rdev-ops.h
... | ... | @@ -624,16 +624,12 @@ |
624 | 624 | |
625 | 625 | static inline int rdev_mgmt_tx(struct cfg80211_registered_device *rdev, |
626 | 626 | struct wireless_dev *wdev, |
627 | - struct ieee80211_channel *chan, bool offchan, | |
628 | - unsigned int wait, const u8 *buf, size_t len, | |
629 | - bool no_cck, bool dont_wait_for_ack, u64 *cookie) | |
627 | + struct cfg80211_mgmt_tx_params *params, | |
628 | + u64 *cookie) | |
630 | 629 | { |
631 | 630 | int ret; |
632 | - trace_rdev_mgmt_tx(&rdev->wiphy, wdev, chan, offchan, | |
633 | - wait, no_cck, dont_wait_for_ack); | |
634 | - ret = rdev->ops->mgmt_tx(&rdev->wiphy, wdev, chan, offchan, | |
635 | - wait, buf, len, no_cck, | |
636 | - dont_wait_for_ack, cookie); | |
631 | + trace_rdev_mgmt_tx(&rdev->wiphy, wdev, params); | |
632 | + ret = rdev->ops->mgmt_tx(&rdev->wiphy, wdev, params, cookie); | |
637 | 633 | trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie); |
638 | 634 | return ret; |
639 | 635 | } |
net/wireless/trace.h
... | ... | @@ -1653,9 +1653,8 @@ |
1653 | 1653 | |
1654 | 1654 | TRACE_EVENT(rdev_mgmt_tx, |
1655 | 1655 | TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev, |
1656 | - struct ieee80211_channel *chan, bool offchan, | |
1657 | - unsigned int wait, bool no_cck, bool dont_wait_for_ack), | |
1658 | - TP_ARGS(wiphy, wdev, chan, offchan, wait, no_cck, dont_wait_for_ack), | |
1656 | + struct cfg80211_mgmt_tx_params *params), | |
1657 | + TP_ARGS(wiphy, wdev, params), | |
1659 | 1658 | TP_STRUCT__entry( |
1660 | 1659 | WIPHY_ENTRY |
1661 | 1660 | WDEV_ENTRY |
... | ... | @@ -1668,11 +1667,11 @@ |
1668 | 1667 | TP_fast_assign( |
1669 | 1668 | WIPHY_ASSIGN; |
1670 | 1669 | WDEV_ASSIGN; |
1671 | - CHAN_ASSIGN(chan); | |
1672 | - __entry->offchan = offchan; | |
1673 | - __entry->wait = wait; | |
1674 | - __entry->no_cck = no_cck; | |
1675 | - __entry->dont_wait_for_ack = dont_wait_for_ack; | |
1670 | + CHAN_ASSIGN(params->chan); | |
1671 | + __entry->offchan = params->offchan; | |
1672 | + __entry->wait = params->wait; | |
1673 | + __entry->no_cck = params->no_cck; | |
1674 | + __entry->dont_wait_for_ack = params->dont_wait_for_ack; | |
1676 | 1675 | ), |
1677 | 1676 | TP_printk(WIPHY_PR_FMT ", " WDEV_PR_FMT ", " CHAN_PR_FMT ", offchan: %s," |
1678 | 1677 | " wait: %u, no cck: %s, dont wait for ack: %s", |