mirror of
https://github.com/torvalds/linux.git
synced 2024-11-21 19:46:16 +00:00
wifi: mac80211: refactor block ack management code
Introduce 'ieee80211_mgmt_ba()' to avoid code duplication between 'ieee80211_send_addba_resp()', 'ieee80211_send_addba_request()', and 'ieee80211_send_delba()', ensure that all related addresses are '__aligned(2)', and prefer convenient 'ether_addr_copy()' over generic 'memcpy()'. No functional changes expected. Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru> Link: https://patch.msgid.link/20240725090925.6022-1-dmantipov@yandex.ru Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
7c24c5bdf4
commit
ea63fb7199
@ -2487,7 +2487,7 @@ struct ieee80211_link_sta {
|
||||
* @spp_amsdu: indicates whether the STA uses SPP A-MSDU or not.
|
||||
*/
|
||||
struct ieee80211_sta {
|
||||
u8 addr[ETH_ALEN];
|
||||
u8 addr[ETH_ALEN] __aligned(2);
|
||||
u16 aid;
|
||||
u16 max_rx_aggregation_subframes;
|
||||
bool wme;
|
||||
|
@ -207,20 +207,7 @@ static void ieee80211_send_addba_resp(struct sta_info *sta, u8 *da, u16 tid,
|
||||
return;
|
||||
|
||||
skb_reserve(skb, local->hw.extra_tx_headroom);
|
||||
mgmt = skb_put_zero(skb, 24);
|
||||
memcpy(mgmt->da, da, ETH_ALEN);
|
||||
memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN);
|
||||
if (sdata->vif.type == NL80211_IFTYPE_AP ||
|
||||
sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
|
||||
sdata->vif.type == NL80211_IFTYPE_MESH_POINT)
|
||||
memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN);
|
||||
else if (sdata->vif.type == NL80211_IFTYPE_STATION)
|
||||
memcpy(mgmt->bssid, sdata->vif.cfg.ap_addr, ETH_ALEN);
|
||||
else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
|
||||
memcpy(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN);
|
||||
|
||||
mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
|
||||
IEEE80211_STYPE_ACTION);
|
||||
mgmt = ieee80211_mgmt_ba(skb, da, sdata);
|
||||
|
||||
skb_put(skb, 1 + sizeof(mgmt->u.action.u.addba_resp));
|
||||
mgmt->u.action.category = WLAN_CATEGORY_BACK;
|
||||
|
@ -74,20 +74,7 @@ static void ieee80211_send_addba_request(struct ieee80211_sub_if_data *sdata,
|
||||
return;
|
||||
|
||||
skb_reserve(skb, local->hw.extra_tx_headroom);
|
||||
mgmt = skb_put_zero(skb, 24);
|
||||
memcpy(mgmt->da, da, ETH_ALEN);
|
||||
memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN);
|
||||
if (sdata->vif.type == NL80211_IFTYPE_AP ||
|
||||
sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
|
||||
sdata->vif.type == NL80211_IFTYPE_MESH_POINT)
|
||||
memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN);
|
||||
else if (sdata->vif.type == NL80211_IFTYPE_STATION)
|
||||
memcpy(mgmt->bssid, sdata->vif.cfg.ap_addr, ETH_ALEN);
|
||||
else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
|
||||
memcpy(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN);
|
||||
|
||||
mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
|
||||
IEEE80211_STYPE_ACTION);
|
||||
mgmt = ieee80211_mgmt_ba(skb, da, sdata);
|
||||
|
||||
skb_put(skb, 1 + sizeof(mgmt->u.action.u.addba_req));
|
||||
|
||||
|
@ -467,20 +467,7 @@ void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata,
|
||||
return;
|
||||
|
||||
skb_reserve(skb, local->hw.extra_tx_headroom);
|
||||
mgmt = skb_put_zero(skb, 24);
|
||||
memcpy(mgmt->da, da, ETH_ALEN);
|
||||
memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN);
|
||||
if (sdata->vif.type == NL80211_IFTYPE_AP ||
|
||||
sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
|
||||
sdata->vif.type == NL80211_IFTYPE_MESH_POINT)
|
||||
memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN);
|
||||
else if (sdata->vif.type == NL80211_IFTYPE_STATION)
|
||||
memcpy(mgmt->bssid, sdata->vif.cfg.ap_addr, ETH_ALEN);
|
||||
else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
|
||||
memcpy(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN);
|
||||
|
||||
mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
|
||||
IEEE80211_STYPE_ACTION);
|
||||
mgmt = ieee80211_mgmt_ba(skb, da, sdata);
|
||||
|
||||
skb_put(skb, 1 + sizeof(mgmt->u.action.u.delba));
|
||||
|
||||
|
@ -2136,6 +2136,29 @@ void ieee80211_process_addba_request(struct ieee80211_local *local,
|
||||
struct ieee80211_mgmt *mgmt,
|
||||
size_t len);
|
||||
|
||||
static inline struct ieee80211_mgmt *
|
||||
ieee80211_mgmt_ba(struct sk_buff *skb, const u8 *da,
|
||||
struct ieee80211_sub_if_data *sdata)
|
||||
{
|
||||
struct ieee80211_mgmt *mgmt = skb_put_zero(skb, 24);
|
||||
|
||||
ether_addr_copy(mgmt->da, da);
|
||||
ether_addr_copy(mgmt->sa, sdata->vif.addr);
|
||||
|
||||
if (sdata->vif.type == NL80211_IFTYPE_AP ||
|
||||
sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
|
||||
sdata->vif.type == NL80211_IFTYPE_MESH_POINT)
|
||||
ether_addr_copy(mgmt->bssid, sdata->vif.addr);
|
||||
else if (sdata->vif.type == NL80211_IFTYPE_STATION)
|
||||
ether_addr_copy(mgmt->bssid, sdata->vif.cfg.ap_addr);
|
||||
else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
|
||||
ether_addr_copy(mgmt->bssid, sdata->u.ibss.bssid);
|
||||
|
||||
mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
|
||||
IEEE80211_STYPE_ACTION);
|
||||
return mgmt;
|
||||
}
|
||||
|
||||
int __ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
|
||||
enum ieee80211_agg_stop_reason reason);
|
||||
void ieee80211_start_tx_ba_cb(struct sta_info *sta, int tid,
|
||||
|
Loading…
Reference in New Issue
Block a user