aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/mesh_plink.c
diff options
context:
space:
mode:
authorThomas Pedersen <thomas@cozybit.com>2011-10-26 17:47:25 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-11-08 15:54:31 -0500
commit3b69a9c5f264d62a0cf46ea61ed3da732c1f88c2 (patch)
treed40bbdbe62b517696711344e6f56278ac420cdd1 /net/mac80211/mesh_plink.c
parentc63749d347afcb5c4790d1cbe27d9b66e585b9ff (diff)
mac80211: comment allocation of mesh frames
Remove most references to magic numbers, save a few bytes and hopefully improve readability. Signed-off-by: Thomas Pedersen <thomas@cozybit.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/mesh_plink.c')
-rw-r--r--net/mac80211/mesh_plink.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c
index 7e57f5d07f66..351e48c9710c 100644
--- a/net/mac80211/mesh_plink.c
+++ b/net/mac80211/mesh_plink.c
@@ -153,23 +153,29 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata,
153 enum ieee80211_self_protected_actioncode action, 153 enum ieee80211_self_protected_actioncode action,
154 u8 *da, __le16 llid, __le16 plid, __le16 reason) { 154 u8 *da, __le16 llid, __le16 plid, __le16 reason) {
155 struct ieee80211_local *local = sdata->local; 155 struct ieee80211_local *local = sdata->local;
156 struct sk_buff *skb = dev_alloc_skb(local->hw.extra_tx_headroom + 400 + 156 struct sk_buff *skb;
157 sdata->u.mesh.ie_len);
158 struct ieee80211_mgmt *mgmt; 157 struct ieee80211_mgmt *mgmt;
159 bool include_plid = false; 158 bool include_plid = false;
160 int ie_len = 4;
161 u16 peering_proto = 0; 159 u16 peering_proto = 0;
162 u8 *pos; 160 u8 *pos, ie_len = 4;
163 161 int hdr_len = offsetof(struct ieee80211_mgmt, u.action.u.self_prot) +
162 sizeof(mgmt->u.action.u.self_prot);
163
164 skb = dev_alloc_skb(local->hw.extra_tx_headroom +
165 hdr_len +
166 2 + /* capability info */
167 2 + /* AID */
168 2 + 8 + /* supported rates */
169 2 + (IEEE80211_MAX_SUPP_RATES - 8) +
170 2 + sdata->u.mesh.mesh_id_len +
171 2 + sizeof(struct ieee80211_meshconf_ie) +
172 2 + 8 + /* peering IE */
173 sdata->u.mesh.ie_len);
164 if (!skb) 174 if (!skb)
165 return -1; 175 return -1;
166 skb_reserve(skb, local->hw.extra_tx_headroom); 176 skb_reserve(skb, local->hw.extra_tx_headroom);
167 /* 25 is the size of the common mgmt part (24) plus the size of the 177 mgmt = (struct ieee80211_mgmt *) skb_put(skb, hdr_len);
168 * common action part (1) 178 memset(mgmt, 0, hdr_len);
169 */
170 mgmt = (struct ieee80211_mgmt *)
171 skb_put(skb, 25 + sizeof(mgmt->u.action.u.self_prot));
172 memset(mgmt, 0, 25 + sizeof(mgmt->u.action.u.self_prot));
173 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | 179 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
174 IEEE80211_STYPE_ACTION); 180 IEEE80211_STYPE_ACTION);
175 memcpy(mgmt->da, da, ETH_ALEN); 181 memcpy(mgmt->da, da, ETH_ALEN);