Commit cd47c0f5 authored by Johannes Berg's avatar Johannes Berg

wifi: cfg80211: put cfg80211_rx_assoc_resp() arguments into a struct

For MLO we'll need a lot more arguments, including all the
BSS pointers and link addresses, so move the data to a struct
to be able to extend it more easily later.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent e69dac88
...@@ -6877,16 +6877,29 @@ void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len); ...@@ -6877,16 +6877,29 @@ void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr); void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);
/** /**
* cfg80211_rx_assoc_resp - notification of processed association response * struct cfg80211_rx_assoc_resp - association response data
* @dev: network device
* @bss: the BSS that association was requested with, ownership of the pointer * @bss: the BSS that association was requested with, ownership of the pointer
* moves to cfg80211 in this call * moves to cfg80211 in the call to cfg80211_rx_assoc_resp()
* @buf: (Re)Association Response frame (header + body) * @buf: (Re)Association Response frame (header + body)
* @len: length of the frame data * @len: length of the frame data
* @uapsd_queues: bitmap of queues configured for uapsd. Same format * @uapsd_queues: bitmap of queues configured for uapsd. Same format
* as the AC bitmap in the QoS info field * as the AC bitmap in the QoS info field
* @req_ies: information elements from the (Re)Association Request frame * @req_ies: information elements from the (Re)Association Request frame
* @req_ies_len: length of req_ies data * @req_ies_len: length of req_ies data
*/
struct cfg80211_rx_assoc_resp {
struct cfg80211_bss *bss;
const u8 *buf;
size_t len;
const u8 *req_ies;
size_t req_ies_len;
int uapsd_queues;
};
/**
* cfg80211_rx_assoc_resp - notification of processed association response
* @dev: network device
* @data: association response data, &struct cfg80211_rx_assoc_resp
* *
* After being asked to associate via cfg80211_ops::assoc() the driver must * After being asked to associate via cfg80211_ops::assoc() the driver must
* call either this function or cfg80211_auth_timeout(). * call either this function or cfg80211_auth_timeout().
...@@ -6894,10 +6907,7 @@ void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr); ...@@ -6894,10 +6907,7 @@ void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);
* This function may sleep. The caller must hold the corresponding wdev's mutex. * This function may sleep. The caller must hold the corresponding wdev's mutex.
*/ */
void cfg80211_rx_assoc_resp(struct net_device *dev, void cfg80211_rx_assoc_resp(struct net_device *dev,
struct cfg80211_bss *bss, struct cfg80211_rx_assoc_resp *data);
const u8 *buf, size_t len,
int uapsd_queues,
const u8 *req_ies, size_t req_ies_len);
/** /**
* struct cfg80211_assoc_failure - association failure data * struct cfg80211_assoc_failure - association failure data
......
...@@ -3878,7 +3878,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, ...@@ -3878,7 +3878,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
struct ieee80211_mgd_assoc_data *assoc_data = ifmgd->assoc_data; struct ieee80211_mgd_assoc_data *assoc_data = ifmgd->assoc_data;
u16 capab_info, status_code, aid; u16 capab_info, status_code, aid;
struct ieee802_11_elems *elems; struct ieee802_11_elems *elems;
int ac, uapsd_queues = -1; int ac;
u8 *pos; u8 *pos;
bool reassoc; bool reassoc;
struct cfg80211_bss *cbss; struct cfg80211_bss *cbss;
...@@ -3887,6 +3887,9 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, ...@@ -3887,6 +3887,9 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
.u.mlme.data = ASSOC_EVENT, .u.mlme.data = ASSOC_EVENT,
}; };
struct ieee80211_prep_tx_info info = {}; struct ieee80211_prep_tx_info info = {};
struct cfg80211_rx_assoc_resp resp = {
.uapsd_queues = -1,
};
sdata_assert_lock(sdata); sdata_assert_lock(sdata);
...@@ -3984,16 +3987,20 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, ...@@ -3984,16 +3987,20 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
ieee80211_destroy_assoc_data(sdata, ASSOC_SUCCESS); ieee80211_destroy_assoc_data(sdata, ASSOC_SUCCESS);
/* get uapsd queues configuration */ /* get uapsd queues configuration */
uapsd_queues = 0; resp.uapsd_queues = 0;
for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) for (ac = 0; ac < IEEE80211_NUM_ACS; ac++)
if (sdata->deflink.tx_conf[ac].uapsd) if (sdata->deflink.tx_conf[ac].uapsd)
uapsd_queues |= ieee80211_ac_to_qos_mask[ac]; resp.uapsd_queues |= ieee80211_ac_to_qos_mask[ac];
info.success = 1; info.success = 1;
} }
cfg80211_rx_assoc_resp(sdata->dev, cbss, (u8 *)mgmt, len, uapsd_queues, resp.bss = cbss;
ifmgd->assoc_req_ies, ifmgd->assoc_req_ies_len); resp.buf = (u8 *)mgmt;
resp.len = len;
resp.req_ies = ifmgd->assoc_req_ies;
resp.req_ies_len = ifmgd->assoc_req_ies_len;
cfg80211_rx_assoc_resp(sdata->dev, &resp);
notify_driver: notify_driver:
drv_mgd_complete_tx(sdata->local, sdata, &info); drv_mgd_complete_tx(sdata->local, sdata, &info);
kfree(elems); kfree(elems);
......
...@@ -21,36 +21,35 @@ ...@@ -21,36 +21,35 @@
#include "rdev-ops.h" #include "rdev-ops.h"
void cfg80211_rx_assoc_resp(struct net_device *dev, struct cfg80211_bss *bss, void cfg80211_rx_assoc_resp(struct net_device *dev,
const u8 *buf, size_t len, int uapsd_queues, struct cfg80211_rx_assoc_resp *data)
const u8 *req_ies, size_t req_ies_len)
{ {
struct wireless_dev *wdev = dev->ieee80211_ptr; struct wireless_dev *wdev = dev->ieee80211_ptr;
struct wiphy *wiphy = wdev->wiphy; struct wiphy *wiphy = wdev->wiphy;
struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)buf; struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)data->buf;
struct cfg80211_connect_resp_params cr; struct cfg80211_connect_resp_params cr;
const u8 *resp_ie = mgmt->u.assoc_resp.variable; const u8 *resp_ie = mgmt->u.assoc_resp.variable;
size_t resp_ie_len = len - offsetof(struct ieee80211_mgmt, size_t resp_ie_len = data->len - offsetof(struct ieee80211_mgmt,
u.assoc_resp.variable); u.assoc_resp.variable);
if (bss->channel->band == NL80211_BAND_S1GHZ) { if (data->bss->channel->band == NL80211_BAND_S1GHZ) {
resp_ie = (u8 *)&mgmt->u.s1g_assoc_resp.variable; resp_ie = (u8 *)&mgmt->u.s1g_assoc_resp.variable;
resp_ie_len = len - offsetof(struct ieee80211_mgmt, resp_ie_len = data->len - offsetof(struct ieee80211_mgmt,
u.s1g_assoc_resp.variable); u.s1g_assoc_resp.variable);
} }
memset(&cr, 0, sizeof(cr)); memset(&cr, 0, sizeof(cr));
cr.status = (int)le16_to_cpu(mgmt->u.assoc_resp.status_code); cr.status = (int)le16_to_cpu(mgmt->u.assoc_resp.status_code);
cr.links[0].bssid = mgmt->bssid; cr.links[0].bssid = mgmt->bssid;
cr.links[0].bss = bss; cr.links[0].bss = data->bss;
cr.req_ie = req_ies; cr.req_ie = data->req_ies;
cr.req_ie_len = req_ies_len; cr.req_ie_len = data->req_ies_len;
cr.resp_ie = resp_ie; cr.resp_ie = resp_ie;
cr.resp_ie_len = resp_ie_len; cr.resp_ie_len = resp_ie_len;
cr.timeout_reason = NL80211_TIMEOUT_UNSPECIFIED; cr.timeout_reason = NL80211_TIMEOUT_UNSPECIFIED;
trace_cfg80211_send_rx_assoc(dev, bss); trace_cfg80211_send_rx_assoc(dev, data->bss);
/* /*
* This is a bit of a hack, we don't notify userspace of * This is a bit of a hack, we don't notify userspace of
...@@ -59,13 +58,12 @@ void cfg80211_rx_assoc_resp(struct net_device *dev, struct cfg80211_bss *bss, ...@@ -59,13 +58,12 @@ void cfg80211_rx_assoc_resp(struct net_device *dev, struct cfg80211_bss *bss,
* frame instead of reassoc. * frame instead of reassoc.
*/ */
if (cfg80211_sme_rx_assoc_resp(wdev, cr.status)) { if (cfg80211_sme_rx_assoc_resp(wdev, cr.status)) {
cfg80211_unhold_bss(bss_from_pub(bss)); cfg80211_unhold_bss(bss_from_pub(data->bss));
cfg80211_put_bss(wiphy, bss); cfg80211_put_bss(wiphy, data->bss);
return; return;
} }
nl80211_send_rx_assoc(rdev, dev, buf, len, GFP_KERNEL, uapsd_queues, nl80211_send_rx_assoc(rdev, dev, data);
req_ies, req_ies_len);
/* update current_bss etc., consumes the bss reference */ /* update current_bss etc., consumes the bss reference */
__cfg80211_connect_result(dev, &cr, cr.status == WLAN_STATUS_SUCCESS); __cfg80211_connect_result(dev, &cr, cr.status == WLAN_STATUS_SUCCESS);
} }
......
...@@ -17432,13 +17432,13 @@ void nl80211_send_rx_auth(struct cfg80211_registered_device *rdev, ...@@ -17432,13 +17432,13 @@ void nl80211_send_rx_auth(struct cfg80211_registered_device *rdev,
} }
void nl80211_send_rx_assoc(struct cfg80211_registered_device *rdev, void nl80211_send_rx_assoc(struct cfg80211_registered_device *rdev,
struct net_device *netdev, const u8 *buf, struct net_device *netdev,
size_t len, gfp_t gfp, int uapsd_queues, struct cfg80211_rx_assoc_resp *data)
const u8 *req_ies, size_t req_ies_len)
{ {
nl80211_send_mlme_event(rdev, netdev, buf, len, nl80211_send_mlme_event(rdev, netdev, data->buf, data->len,
NL80211_CMD_ASSOCIATE, gfp, uapsd_queues, NL80211_CMD_ASSOCIATE, GFP_KERNEL,
req_ies, req_ies_len, false); data->uapsd_queues,
data->req_ies, data->req_ies_len, false);
} }
void nl80211_send_deauth(struct cfg80211_registered_device *rdev, void nl80211_send_deauth(struct cfg80211_registered_device *rdev,
......
...@@ -60,9 +60,7 @@ void nl80211_send_rx_auth(struct cfg80211_registered_device *rdev, ...@@ -60,9 +60,7 @@ void nl80211_send_rx_auth(struct cfg80211_registered_device *rdev,
const u8 *buf, size_t len, gfp_t gfp); const u8 *buf, size_t len, gfp_t gfp);
void nl80211_send_rx_assoc(struct cfg80211_registered_device *rdev, void nl80211_send_rx_assoc(struct cfg80211_registered_device *rdev,
struct net_device *netdev, struct net_device *netdev,
const u8 *buf, size_t len, gfp_t gfp, struct cfg80211_rx_assoc_resp *data);
int uapsd_queues,
const u8 *req_ies, size_t req_ies_len);
void nl80211_send_deauth(struct cfg80211_registered_device *rdev, void nl80211_send_deauth(struct cfg80211_registered_device *rdev,
struct net_device *netdev, struct net_device *netdev,
const u8 *buf, size_t len, const u8 *buf, size_t len,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment