mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
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 <[email protected]> [fix all other drivers] Signed-off-by: Johannes Berg <[email protected]>
This commit is contained in:
parent
017b45bb5c
commit
b176e62940
10 changed files with 86 additions and 69 deletions
|
|
@ -317,9 +317,8 @@ void cfg80211_mlme_unregister_socket(struct wireless_dev *wdev, u32 nlpid);
|
|||
void cfg80211_mlme_purge_registrations(struct wireless_dev *wdev);
|
||||
int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev,
|
||||
struct wireless_dev *wdev,
|
||||
struct ieee80211_channel *chan, bool offchan,
|
||||
unsigned int wait, const u8 *buf, size_t len,
|
||||
bool no_cck, bool dont_wait_for_ack, u64 *cookie);
|
||||
struct cfg80211_mgmt_tx_params *params,
|
||||
u64 *cookie);
|
||||
void cfg80211_oper_and_ht_capa(struct ieee80211_ht_cap *ht_capa,
|
||||
const struct ieee80211_ht_cap *ht_capa_mask);
|
||||
void cfg80211_oper_and_vht_capa(struct ieee80211_vht_cap *vht_capa,
|
||||
|
|
|
|||
|
|
@ -520,9 +520,7 @@ void cfg80211_mlme_purge_registrations(struct wireless_dev *wdev)
|
|||
|
||||
int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev,
|
||||
struct wireless_dev *wdev,
|
||||
struct ieee80211_channel *chan, bool offchan,
|
||||
unsigned int wait, const u8 *buf, size_t len,
|
||||
bool no_cck, bool dont_wait_for_ack, u64 *cookie)
|
||||
struct cfg80211_mgmt_tx_params *params, u64 *cookie)
|
||||
{
|
||||
const struct ieee80211_mgmt *mgmt;
|
||||
u16 stype;
|
||||
|
|
@ -533,10 +531,10 @@ int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev,
|
|||
if (!rdev->ops->mgmt_tx)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
if (len < 24 + 1)
|
||||
if (params->len < 24 + 1)
|
||||
return -EINVAL;
|
||||
|
||||
mgmt = (const struct ieee80211_mgmt *) buf;
|
||||
mgmt = (const struct ieee80211_mgmt *)params->buf;
|
||||
|
||||
if (!ieee80211_is_mgmt(mgmt->frame_control))
|
||||
return -EINVAL;
|
||||
|
|
@ -615,9 +613,7 @@ int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev,
|
|||
return -EINVAL;
|
||||
|
||||
/* Transmit the Action frame as requested by user space */
|
||||
return rdev_mgmt_tx(rdev, wdev, chan, offchan,
|
||||
wait, buf, len, no_cck, dont_wait_for_ack,
|
||||
cookie);
|
||||
return rdev_mgmt_tx(rdev, wdev, params, cookie);
|
||||
}
|
||||
|
||||
bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_mbm,
|
||||
|
|
|
|||
|
|
@ -7428,10 +7428,10 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info)
|
|||
void *hdr = NULL;
|
||||
u64 cookie;
|
||||
struct sk_buff *msg = NULL;
|
||||
unsigned int wait = 0;
|
||||
bool offchan, no_cck, dont_wait_for_ack;
|
||||
|
||||
dont_wait_for_ack = info->attrs[NL80211_ATTR_DONT_WAIT_FOR_ACK];
|
||||
struct cfg80211_mgmt_tx_params params = {
|
||||
.dont_wait_for_ack =
|
||||
info->attrs[NL80211_ATTR_DONT_WAIT_FOR_ACK],
|
||||
};
|
||||
|
||||
if (!info->attrs[NL80211_ATTR_FRAME])
|
||||
return -EINVAL;
|
||||
|
|
@ -7458,24 +7458,24 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info)
|
|||
if (info->attrs[NL80211_ATTR_DURATION]) {
|
||||
if (!(rdev->wiphy.flags & WIPHY_FLAG_OFFCHAN_TX))
|
||||
return -EINVAL;
|
||||
wait = nla_get_u32(info->attrs[NL80211_ATTR_DURATION]);
|
||||
params.wait = nla_get_u32(info->attrs[NL80211_ATTR_DURATION]);
|
||||
|
||||
/*
|
||||
* We should wait on the channel for at least a minimum amount
|
||||
* of time (10ms) but no longer than the driver supports.
|
||||
*/
|
||||
if (wait < NL80211_MIN_REMAIN_ON_CHANNEL_TIME ||
|
||||
wait > rdev->wiphy.max_remain_on_channel_duration)
|
||||
if (params.wait < NL80211_MIN_REMAIN_ON_CHANNEL_TIME ||
|
||||
params.wait > rdev->wiphy.max_remain_on_channel_duration)
|
||||
return -EINVAL;
|
||||
|
||||
}
|
||||
|
||||
offchan = info->attrs[NL80211_ATTR_OFFCHANNEL_TX_OK];
|
||||
params.offchan = info->attrs[NL80211_ATTR_OFFCHANNEL_TX_OK];
|
||||
|
||||
if (offchan && !(rdev->wiphy.flags & WIPHY_FLAG_OFFCHAN_TX))
|
||||
if (params.offchan && !(rdev->wiphy.flags & WIPHY_FLAG_OFFCHAN_TX))
|
||||
return -EINVAL;
|
||||
|
||||
no_cck = nla_get_flag(info->attrs[NL80211_ATTR_TX_NO_CCK_RATE]);
|
||||
params.no_cck = nla_get_flag(info->attrs[NL80211_ATTR_TX_NO_CCK_RATE]);
|
||||
|
||||
/* get the channel if any has been specified, otherwise pass NULL to
|
||||
* the driver. The latter will use the current one
|
||||
|
|
@ -7487,10 +7487,10 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info)
|
|||
return err;
|
||||
}
|
||||
|
||||
if (!chandef.chan && offchan)
|
||||
if (!chandef.chan && params.offchan)
|
||||
return -EINVAL;
|
||||
|
||||
if (!dont_wait_for_ack) {
|
||||
if (!params.dont_wait_for_ack) {
|
||||
msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
|
||||
if (!msg)
|
||||
return -ENOMEM;
|
||||
|
|
@ -7503,10 +7503,10 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info)
|
|||
}
|
||||
}
|
||||
|
||||
err = cfg80211_mlme_mgmt_tx(rdev, wdev, chandef.chan, offchan, wait,
|
||||
nla_data(info->attrs[NL80211_ATTR_FRAME]),
|
||||
nla_len(info->attrs[NL80211_ATTR_FRAME]),
|
||||
no_cck, dont_wait_for_ack, &cookie);
|
||||
params.buf = nla_data(info->attrs[NL80211_ATTR_FRAME]);
|
||||
params.len = nla_len(info->attrs[NL80211_ATTR_FRAME]);
|
||||
params.chan = chandef.chan;
|
||||
err = cfg80211_mlme_mgmt_tx(rdev, wdev, ¶ms, &cookie);
|
||||
if (err)
|
||||
goto free_msg;
|
||||
|
||||
|
|
|
|||
|
|
@ -624,16 +624,12 @@ rdev_cancel_remain_on_channel(struct cfg80211_registered_device *rdev,
|
|||
|
||||
static inline int rdev_mgmt_tx(struct cfg80211_registered_device *rdev,
|
||||
struct wireless_dev *wdev,
|
||||
struct ieee80211_channel *chan, bool offchan,
|
||||
unsigned int wait, const u8 *buf, size_t len,
|
||||
bool no_cck, bool dont_wait_for_ack, u64 *cookie)
|
||||
struct cfg80211_mgmt_tx_params *params,
|
||||
u64 *cookie)
|
||||
{
|
||||
int ret;
|
||||
trace_rdev_mgmt_tx(&rdev->wiphy, wdev, chan, offchan,
|
||||
wait, no_cck, dont_wait_for_ack);
|
||||
ret = rdev->ops->mgmt_tx(&rdev->wiphy, wdev, chan, offchan,
|
||||
wait, buf, len, no_cck,
|
||||
dont_wait_for_ack, cookie);
|
||||
trace_rdev_mgmt_tx(&rdev->wiphy, wdev, params);
|
||||
ret = rdev->ops->mgmt_tx(&rdev->wiphy, wdev, params, cookie);
|
||||
trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1653,9 +1653,8 @@ TRACE_EVENT(rdev_cancel_remain_on_channel,
|
|||
|
||||
TRACE_EVENT(rdev_mgmt_tx,
|
||||
TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev,
|
||||
struct ieee80211_channel *chan, bool offchan,
|
||||
unsigned int wait, bool no_cck, bool dont_wait_for_ack),
|
||||
TP_ARGS(wiphy, wdev, chan, offchan, wait, no_cck, dont_wait_for_ack),
|
||||
struct cfg80211_mgmt_tx_params *params),
|
||||
TP_ARGS(wiphy, wdev, params),
|
||||
TP_STRUCT__entry(
|
||||
WIPHY_ENTRY
|
||||
WDEV_ENTRY
|
||||
|
|
@ -1668,11 +1667,11 @@ TRACE_EVENT(rdev_mgmt_tx,
|
|||
TP_fast_assign(
|
||||
WIPHY_ASSIGN;
|
||||
WDEV_ASSIGN;
|
||||
CHAN_ASSIGN(chan);
|
||||
__entry->offchan = offchan;
|
||||
__entry->wait = wait;
|
||||
__entry->no_cck = no_cck;
|
||||
__entry->dont_wait_for_ack = dont_wait_for_ack;
|
||||
CHAN_ASSIGN(params->chan);
|
||||
__entry->offchan = params->offchan;
|
||||
__entry->wait = params->wait;
|
||||
__entry->no_cck = params->no_cck;
|
||||
__entry->dont_wait_for_ack = params->dont_wait_for_ack;
|
||||
),
|
||||
TP_printk(WIPHY_PR_FMT ", " WDEV_PR_FMT ", " CHAN_PR_FMT ", offchan: %s,"
|
||||
" wait: %u, no cck: %s, dont wait for ack: %s",
|
||||
|
|
|
|||
Loading…
Reference in a new issue