mac80211: comment allocation of mesh frames
PATCH v2 1/2 mac80211: comment allocation of mesh frames
Remove most references to magic numbers, save a few bytes and hopefully improve readability.
--- net/mac80211/mesh_hwmp.c | 36 ++++++++++++++++++------------------ net/mac80211/mesh_plink.c | 28 +++++++++++++++++----------- net/mac80211/tx.c | 19 +++++++++++++------ 3 files changed, 48 insertions(+), 35 deletions(-)
net/mac80211/mesh_hwmp.c +18 -18
@@ -113,20 +113,20 @@ static int mesh_path_sel_frame_tx(enum mpath_frame_type action, u8 flags, struct ieee80211_sub_if_data *sdata) {struct ieee80211_local *local = sdata->local; -struct sk_buff *skb =dev_alloc_skb (local->hw.extra_tx_headroom +400 ); +struct sk_buff *skb;struct ieee80211_mgmt *mgmt; -u8 *pos; -int ie_len; +u8 *pos, ie_len; + int hdr_len = offsetof(struct ieee80211_mgmt, u.action.u.mesh_action) + +sizeof (mgmt->u.action.u.mesh_action); + skb =dev_alloc_skb (local->hw.extra_tx_headroom + + hdr_len + +2 +37 );/* max HWMP IE */ if (!skb)return -1 ;skb_reserve (skb, local->hw.extra_tx_headroom); -/* 25 is the size of the common mgmt part (24) plus the size of the -* common action part (1) -*/ - mgmt = (struct ieee80211_mgmt *) -skb_put (skb,25 +sizeof (mgmt->u.action.u.mesh_action)); -memset (mgmt,0 ,25 +sizeof (mgmt->u.action.u.mesh_action)); + mgmt = (struct ieee80211_mgmt *)skb_put (skb, hdr_len); +memset (mgmt,0 , hdr_len); mgmt->frame_control =cpu_to_le16 (IEEE80211_FTYPE_MGMT |IEEE80211_STYPE_ACTION );
@@ -240,20 +240,20 @@ int mesh_path_error_tx(u8 ttl, u8 *target, __le32 target_sn, struct ieee80211_sub_if_data *sdata) {struct ieee80211_local *local = sdata->local; -struct sk_buff *skb =dev_alloc_skb (local->hw.extra_tx_headroom +400 ); +struct sk_buff *skb;struct ieee80211_mgmt *mgmt; -u8 *pos; -int ie_len; +u8 *pos, ie_len; + int hdr_len = offsetof(struct ieee80211_mgmt, u.action.u.mesh_action) + +sizeof (mgmt->u.action.u.mesh_action); + skb =dev_alloc_skb (local->hw.extra_tx_headroom + + hdr_len + +2 +15 /* PERR IE */ );if (!skb)return -1 ;skb_reserve (skb, local->tx_headroom + local->hw.extra_tx_headroom); -/* 25 is the size of the common mgmt part (24) plus the size of the -* common action part (1) -*/ - mgmt = (struct ieee80211_mgmt *) -skb_put (skb,25 +sizeof (mgmt->u.action.u.mesh_action)); -memset (mgmt,0 ,25 +sizeof (mgmt->u.action.u.mesh_action)); + mgmt = (struct ieee80211_mgmt *)skb_put (skb, hdr_len); +memset (mgmt,0 , hdr_len); mgmt->frame_control =cpu_to_le16 (IEEE80211_FTYPE_MGMT |IEEE80211_STYPE_ACTION );
net/mac80211/mesh_plink.c +17 -11
@@ -153,23 +153,29 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata,enum ieee80211_self_protected_actioncode action, u8 *da, __le16 llid, __le16 plid, __le16 reason) { struct ieee80211_local *local = sdata->local; -struct sk_buff *skb =dev_alloc_skb (local->hw.extra_tx_headroom +400 + - sdata->u.mesh.ie_len); +struct sk_buff *skb;struct ieee80211_mgmt *mgmt;bool include_plid = false; -int ie_len =4 ;u16 peering_proto =0 ; -u8 *pos; - +u8 *pos, ie_len =4 ; + int hdr_len = offsetof(struct ieee80211_mgmt, u.action.u.self_prot) + +sizeof (mgmt->u.action.u.self_prot); + + skb =dev_alloc_skb (local->hw.extra_tx_headroom + + hdr_len + +2 +/* capability info */ +2 +/* AID */ +2 +8 +/* supported rates */ +2 + (IEEE80211_MAX_SUPP_RATES -8 ) + +2 + sdata->u.mesh.mesh_id_len + +2 +sizeof (struct ieee80211_meshconf_ie ) + +2 +8 +/* peering IE */ + sdata->u.mesh.ie_len);if (!skb)return -1 ;skb_reserve (skb, local->hw.extra_tx_headroom); -/* 25 is the size of the common mgmt part (24) plus the size of the -* common action part (1) -*/ - mgmt = (struct ieee80211_mgmt *) -skb_put (skb,25 +sizeof (mgmt->u.action.u.self_prot)); -memset (mgmt,0 ,25 +sizeof (mgmt->u.action.u.self_prot)); + mgmt = (struct ieee80211_mgmt *)skb_put (skb, hdr_len); +memset (mgmt,0 , hdr_len); mgmt->frame_control =cpu_to_le16 (IEEE80211_FTYPE_MGMT |IEEE80211_STYPE_ACTION );memcpy (mgmt->da, da,ETH_ALEN );
net/mac80211/tx.c +13 -6
@@ -2278,22 +2278,29 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw, }else if (ieee80211_vif_is_mesh (&sdata->vif)) {struct ieee80211_mgmt *mgmt;u8 *pos; + int hdr_len = offsetof(struct ieee80211_mgmt, u.beacon) + +sizeof (mgmt->u.beacon);#ifdef CONFIG_MAC80211_MESH if (!sdata->u.mesh.mesh_id_len) goto out;#endif -/* headroom, head length, tail length and maximum TIM length */ - skb =dev_alloc_skb (local->tx_headroom +400 + - sdata->u.mesh.ie_len); + skb =dev_alloc_skb (local->tx_headroom + + hdr_len + +2 +/* NULL SSID */ +2 +8 +/* supported rates */ +2 +3 +/* DS params */ +2 + (IEEE80211_MAX_SUPP_RATES -8 ) + +2 + sdata->u.mesh.mesh_id_len + +2 +sizeof (struct ieee80211_meshconf_ie ) + + sdata->u.mesh.ie_len);if (!skb) goto out;skb_reserve (skb, local->hw.extra_tx_headroom); - mgmt = (struct ieee80211_mgmt *) -skb_put (skb,24 +sizeof (mgmt->u.beacon)); -memset (mgmt,0 ,24 +sizeof (mgmt->u.beacon)); + mgmt = (struct ieee80211_mgmt *)skb_put (skb, hdr_len); +memset (mgmt,0 , hdr_len); mgmt->frame_control =cpu_to_le16 (IEEE80211_FTYPE_MGMT |IEEE80211_STYPE_BEACON );memset (mgmt->da,0xff ,ETH_ALEN );
Signature · 1 line
1.7.5.4
PATCH v2 2/2 mac80211: select queue for fwded mesh frames
Set proper queue mapping and timestamp for forwarded mesh frames.
Thanks to Luis Rodriguez for investigating and fixing this.
---
v2:
We were already doing this for mcast frames, so don't duplicate the code.
net/mac80211/rx.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-)
net/mac80211/rx.c +5 -3
@@ -1952,13 +1952,15 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) info =IEEE80211_SKB_CB (fwd_skb);memset (info,0 ,sizeof (*info)); info->flags |=IEEE80211_TX_INTFL_NEED_TXPROCESSING ; + info->control.jiffies = jiffies; info->control.vif = &rx->sdata->vif; +skb_set_queue_mapping (fwd_skb, +ieee80211_select_queue (sdata, fwd_skb)); +ieee80211_set_qos_hdr (sdata, fwd_skb); +if (is_multicast_ether_addr (fwd_hdr->addr1)) {IEEE80211_IFSTA_MESH_CTR_INC (&sdata->u.mesh, fwded_mcast); -skb_set_queue_mapping (fwd_skb, -ieee80211_select_queue (sdata, fwd_skb)); -ieee80211_set_qos_hdr (sdata, fwd_skb); }else {int err;/*
Signature · 1 line
1.7.5.4
Re: [PATCH v2 2/2] mac80211: select queue for fwded mesh frames
Quoted 38 lines · Thomas Pedersen
Set proper queue mapping and timestamp for forwarded mesh frames.
Thanks to Luis Rodriguez for investigating and fixing this.
Signed-off-by Thomas Pedersen <[email protected]>---
v2:
We were already doing this for mcast frames, so don't duplicate the code.net/mac80211/rx.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)net/mac80211/rx.c +5
-4@@ -1952,13 +1952,15 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) info = IEEE80211_SKB_CB(fwd_skb); memset(info, 0, sizeof(*info)); info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING; + info->control.jiffies = jiffies; info->control.vif = &rx->sdata->vif; + skb_set_queue_mapping(fwd_skb, + ieee80211_select_queue(sdata, fwd_skb)); + ieee80211_set_qos_hdr(sdata, fwd_skb); + if (is_multicast_ether_addr(fwd_hdr->addr1)) { IEEE80211_IFSTA_MESH_CTR_INC(&sdata->u.mesh, fwded_mcast); - skb_set_queue_mapping(fwd_skb, - ieee80211_select_queue(sdata, fwd_skb)); - ieee80211_set_qos_hdr(sdata, fwd_skb); } else { int err; /* --
Quoted 3 lines
1.7.5.4
John,
It seems this patch reverts part of 4777be41638cfab56c78b2a764a5f83beb6cfdd2 "mac80211: Start implementing QoS support for mesh interfaces", and is probably the cause for some breakage we're seeing here. Please hold off on this patch until I can figure out what the right thing to do is.
Thanks,
Thomas