d80211: use FCS_LEN instead of hardcoded number.
Subsystems (3)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/3 d80211: use FCS_LEN instead of hardcoded number.
net/d80211/ieee80211.c +2 -2
@@ -451,7 +451,7 @@ ieee80211_tx_h_fragment(struct ieee80211 hdrlen =ieee80211_get_hdrlen (tx->fc); payload_len = first->len - hdrlen; - per_fragm = frag_threshold - hdrlen -4 /* FCS */ ; + per_fragm = frag_threshold - hdrlen -FCS_LEN ; num_fragm = (payload_len + per_fragm -1 ) / per_fragm; frags =kzalloc (num_fragm *sizeof (struct sk_buff *),GFP_ATOMIC );
@@ -1103,7 +1103,7 @@ __ieee80211_tx_prepare(struct ieee80211_ control->no_ack =is_multicast_ether_addr (hdr->addr1); tx->fragmented = local->fragmentation_threshold <IEEE80211_MAX_FRAG_THRESHOLD && tx->u.tx.unicast && - skb->len +4 /* FCS */ > local->fragmentation_threshold && + skb->len +FCS_LEN > local->fragmentation_threshold && (!local->hw->set_frag_threshold);if (!tx->sta) control->clear_dst_mask =1 ;
--
PATCH 2/3 d80211: remove poorly documented ieee80211_hw extra_hdr_room flag
In reply to a message not in the archiveThis flag is unused by all in tree drivers. Furthermore, the way that it is documented is not consistent with the way it is actually used by ieee80211.c. The original attempt appears to be something to do with adding extra header room for low-level drivers which need to pad the IEEE 802.11 header (example: Atheros).
include/net/d80211.h +0 -4
@@ -476,10 +476,6 @@ struct ieee80211_hw {/* Force software encryption for TKIP packets if WMM is enabled. */ unsigned int no_tkip_wmm_hwaccel:1; -/* set if the payload needs to be padded at even boundaries after the -* header */ - unsigned int extra_hdr_room:1; -/* Some devices handle Michael MIC internally and do not include MIC in * the received packets passed up. device_strips_mic must be set * for such devices. The 'encryption' frame control bit is expected to
net/d80211/ieee80211.c +1 -1
@@ -1551,7 +1551,7 @@ static int ieee80211_subif_start_xmit(st* build in headroom in __dev_alloc_skb() (linux/skbuff.h) and * alloc_skb() (net/core/skbuff.c) */ - head_need = hdrlen + encaps_len + (local->hw->extra_hdr_room ?2 :0 ); + head_need = hdrlen + encaps_len; head_need -=skb_headroom (skb);/* We are going to modify skb data, so make a copy of it if happens to
drivers/net/wireless/d80211/adm8211/adm8211.c +0 -1
@@ -2018,7 +2018,6 @@ static int __devinit adm8211_probe(struc hw->wep_include_iv =1 ; hw->data_nullfunc_ack =0 ; hw->no_tkip_wmm_hwaccel =1 ; - hw->extra_hdr_room =0 ; hw->device_strips_mic =0 ; hw->monitor_during_oper =0 ; hw->fraglist =0 ;
drivers/net/wireless/d80211/rt2x00/rt2400pci.c +0 -1
@@ -2578,7 +2578,6 @@ static int rt2400pci_init_hw(struct rt2x hw->wep_include_iv =1 ; hw->data_nullfunc_ack =1 ; hw->no_tkip_wmm_hwaccel =1 ; - hw->extra_hdr_room =0 ; hw->device_strips_mic =0 ; hw->monitor_during_oper =1 ; hw->fraglist =0 ;
drivers/net/wireless/d80211/rt2x00/rt2500pci.c +0 -1
@@ -2732,7 +2732,6 @@ static int rt2500pci_init_hw(struct rt2x hw->wep_include_iv =1 ; hw->data_nullfunc_ack =1 ; hw->no_tkip_wmm_hwaccel =1 ; - hw->extra_hdr_room =0 ; hw->device_strips_mic =0 ; hw->monitor_during_oper =1 ; hw->fraglist =0 ;
drivers/net/wireless/d80211/rt2x00/rt2500usb.c +0 -1
@@ -2419,7 +2419,6 @@ static int rt2500usb_init_hw(struct rt2x hw->wep_include_iv =1 ; hw->data_nullfunc_ack =1 ; hw->no_tkip_wmm_hwaccel =1 ; - hw->extra_hdr_room =0 ; hw->device_strips_mic =0 ; hw->monitor_during_oper =1 ; hw->fraglist =0 ;
drivers/net/wireless/d80211/rt2x00/rt61pci.c +0 -1
@@ -3252,7 +3252,6 @@ static int rt61pci_init_hw(struct rt2x00 hw->wep_include_iv =1 ; hw->data_nullfunc_ack =1 ; hw->no_tkip_wmm_hwaccel =1 ; - hw->extra_hdr_room =0 ; hw->device_strips_mic =0 ; hw->monitor_during_oper =1 ; hw->fraglist =0 ;
drivers/net/wireless/d80211/rt2x00/rt73usb.c +0 -1
@@ -2792,7 +2792,6 @@ static int rt73usb_init_hw(struct rt2x00 hw->wep_include_iv =1 ; hw->data_nullfunc_ack =1 ; hw->no_tkip_wmm_hwaccel =1 ; - hw->extra_hdr_room =0 ; hw->device_strips_mic =0 ; hw->monitor_during_oper =1 ; hw->fraglist =0 ;
--
Re: [patch 2/3] d80211: remove poorly documented ieee80211_hw extra_hdr_room flag
Quoted 5 lines · David Kimdon
This flag is unused by all in tree drivers. Furthermore, the way that it is documented is not consistent with the way it is actually used by
ieee80211.c. The original attempt appears to be something to do with adding extra header room for low-level drivers which need to pad the IEEE 802.11 header (example: Atheros).
What about not removing it, but extending it.
In the current form it's rather useless. But we could make extra_hdr_room a value instead of a flag. Bcm43xx needs somewhere around 30bytes extra header room. So every driver which does not need header room, sets this to 0. Every other driver to the specific value.
We currently workaround the problem by using an extra DMA descriptor just for the header. That's not really a problem, though. But it means a little bit of additional overhead in the TX path. Well.
Quoted 109 lines
Signed-off-by David Kimdon <[email protected]>Index:
wireless-dev/include/net/d80211.h
===================================================================include/net/d80211.h +0
-4@@ -476,10 +476,6 @@ struct ieee80211_hw {/* Force software encryption for TKIP packets if WMM is enabled. */ unsigned int no_tkip_wmm_hwaccel:1; -/* set if the payload needs to be padded at even boundaries after the -* header */ - unsigned int extra_hdr_room:1; -/* Some devices handle Michael MIC internally and do not include MIC in * the received packets passed up. device_strips_mic must be set * for such devices. The 'encryption' frame control bit is expected to Index:
wireless-dev/net/d80211/ieee80211.c
===================================================================net/d80211/ieee80211.c +1
-1@@ -1551,7 +1551,7 @@ static int ieee80211_subif_start_xmit(st* build in headroom in __dev_alloc_skb() (linux/skbuff.h) and * alloc_skb() (net/core/skbuff.c) */ - head_need = hdrlen + encaps_len + (local->hw->extra_hdr_room ?2 :0 ); + head_need = hdrlen + encaps_len; head_need -=skb_headroom (skb);/* We are going to modify skb data, so make a copy of it if happens to Index:
wireless-dev/drivers/net/wireless/d80211/adm8211/adm8211.c
===================================================================drivers/net/wireless/d80211/adm8211/adm8211.c +0
-1@@ -2018,7 +2018,6 @@ static int __devinit adm8211_probe(struc hw->wep_include_iv =1 ; hw->data_nullfunc_ack =0 ; hw->no_tkip_wmm_hwaccel =1 ; - hw->extra_hdr_room =0 ; hw->device_strips_mic =0 ; hw->monitor_during_oper =0 ; hw->fraglist =0 ;Index:
wireless-dev/drivers/net/wireless/d80211/rt2x00/rt2400pci.c
===================================================================drivers/net/wireless/d80211/rt2x00/rt2400pci.c +0
-1@@ -2578,7 +2578,6 @@ static int rt2400pci_init_hw(struct rt2x hw->wep_include_iv =1 ; hw->data_nullfunc_ack =1 ; hw->no_tkip_wmm_hwaccel =1 ; - hw->extra_hdr_room =0 ; hw->device_strips_mic =0 ; hw->monitor_during_oper =1 ; hw->fraglist =0 ;Index:
wireless-dev/drivers/net/wireless/d80211/rt2x00/rt2500pci.c
===================================================================drivers/net/wireless/d80211/rt2x00/rt2500pci.c +0
-1@@ -2732,7 +2732,6 @@ static int rt2500pci_init_hw(struct rt2x hw->wep_include_iv =1 ; hw->data_nullfunc_ack =1 ; hw->no_tkip_wmm_hwaccel =1 ; - hw->extra_hdr_room =0 ; hw->device_strips_mic =0 ; hw->monitor_during_oper =1 ; hw->fraglist =0 ;Index:
wireless-dev/drivers/net/wireless/d80211/rt2x00/rt2500usb.c
===================================================================drivers/net/wireless/d80211/rt2x00/rt2500usb.c +0
-1@@ -2419,7 +2419,6 @@ static int rt2500usb_init_hw(struct rt2x hw->wep_include_iv =1 ; hw->data_nullfunc_ack =1 ; hw->no_tkip_wmm_hwaccel =1 ; - hw->extra_hdr_room =0 ; hw->device_strips_mic =0 ; hw->monitor_during_oper =1 ; hw->fraglist =0 ;Index:
wireless-dev/drivers/net/wireless/d80211/rt2x00/rt61pci.c
===================================================================drivers/net/wireless/d80211/rt2x00/rt61pci.c +0
-1@@ -3252,7 +3252,6 @@ static int rt61pci_init_hw(struct rt2x00 hw->wep_include_iv =1 ; hw->data_nullfunc_ack =1 ; hw->no_tkip_wmm_hwaccel =1 ; - hw->extra_hdr_room =0 ; hw->device_strips_mic =0 ; hw->monitor_during_oper =1 ; hw->fraglist =0 ;Index:
wireless-dev/drivers/net/wireless/d80211/rt2x00/rt73usb.c
===================================================================drivers/net/wireless/d80211/rt2x00/rt73usb.c +0
-3@@ -2792,7 +2792,6 @@ static int rt73usb_init_hw(struct rt2x00 hw->wep_include_iv =1 ; hw->data_nullfunc_ack =1 ; hw->no_tkip_wmm_hwaccel =1 ; - hw->extra_hdr_room =0 ; hw->device_strips_mic =0 ; hw->monitor_during_oper =1 ; hw->fraglist =0 ; -- -To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 1 line
Greetings Michael.
Re: [patch 2/3] d80211: remove poorly documented ieee80211_hw extra_hdr_room flag
Quoted 8 lines · Michael Buesch
Quoted 5 lines · David Kimdon
This flag is unused by all in tree drivers. Furthermore, the way that it is documented is not consistent with the way it is actually used by
ieee80211.c. The original attempt appears to be something to do with adding extra header room for low-level drivers which need to pad the IEEE 802.11 header (example: Atheros).What about not removing it, but extending it.
Sure, I would be happy with that. For Atheros it will be '2' to ensure that we can properly align the packet in the tx path without needing to realloc.
Quoted 121 lines
In the current form it's rather useless. But we could make
extra_hdr_rooma value instead of a flag. Bcm43xx needs somewhere around 30bytes extra header room. So every driver which does not need header room, sets this to 0. Every other driver to the specific value.We currently workaround the problem by using an extra DMA descriptor just for the header. That's not really a problem, though. But it means a little bit of additional overhead in the TX path. Well.
Quoted 109 lines
Signed-off-by David Kimdon <[email protected]>Index:
wireless-dev/include/net/d80211.h
===================================================================include/net/d80211.h +0
-4@@ -476,10 +476,6 @@ struct ieee80211_hw {/* Force software encryption for TKIP packets if WMM is enabled. */ unsigned int no_tkip_wmm_hwaccel:1; -/* set if the payload needs to be padded at even boundaries after the -* header */ - unsigned int extra_hdr_room:1; -/* Some devices handle Michael MIC internally and do not include MIC in * the received packets passed up. device_strips_mic must be set * for such devices. The 'encryption' frame control bit is expected to Index:
wireless-dev/net/d80211/ieee80211.c
===================================================================net/d80211/ieee80211.c +1
-1@@ -1551,7 +1551,7 @@ static int ieee80211_subif_start_xmit(st* build in headroom in __dev_alloc_skb() (linux/skbuff.h) and * alloc_skb() (net/core/skbuff.c) */ - head_need = hdrlen + encaps_len + (local->hw->extra_hdr_room ?2 :0 ); + head_need = hdrlen + encaps_len; head_need -=skb_headroom (skb);/* We are going to modify skb data, so make a copy of it if happens to Index:
wireless-dev/drivers/net/wireless/d80211/adm8211/adm8211.c
===================================================================drivers/net/wireless/d80211/adm8211/adm8211.c +0
-1@@ -2018,7 +2018,6 @@ static int __devinit adm8211_probe(struc hw->wep_include_iv =1 ; hw->data_nullfunc_ack =0 ; hw->no_tkip_wmm_hwaccel =1 ; - hw->extra_hdr_room =0 ; hw->device_strips_mic =0 ; hw->monitor_during_oper =0 ; hw->fraglist =0 ;Index:
wireless-dev/drivers/net/wireless/d80211/rt2x00/rt2400pci.c
===================================================================drivers/net/wireless/d80211/rt2x00/rt2400pci.c +0
-1@@ -2578,7 +2578,6 @@ static int rt2400pci_init_hw(struct rt2x hw->wep_include_iv =1 ; hw->data_nullfunc_ack =1 ; hw->no_tkip_wmm_hwaccel =1 ; - hw->extra_hdr_room =0 ; hw->device_strips_mic =0 ; hw->monitor_during_oper =1 ; hw->fraglist =0 ;Index:
wireless-dev/drivers/net/wireless/d80211/rt2x00/rt2500pci.c
===================================================================drivers/net/wireless/d80211/rt2x00/rt2500pci.c +0
-1@@ -2732,7 +2732,6 @@ static int rt2500pci_init_hw(struct rt2x hw->wep_include_iv =1 ; hw->data_nullfunc_ack =1 ; hw->no_tkip_wmm_hwaccel =1 ; - hw->extra_hdr_room =0 ; hw->device_strips_mic =0 ; hw->monitor_during_oper =1 ; hw->fraglist =0 ;Index:
wireless-dev/drivers/net/wireless/d80211/rt2x00/rt2500usb.c
===================================================================drivers/net/wireless/d80211/rt2x00/rt2500usb.c +0
-1@@ -2419,7 +2419,6 @@ static int rt2500usb_init_hw(struct rt2x hw->wep_include_iv =1 ; hw->data_nullfunc_ack =1 ; hw->no_tkip_wmm_hwaccel =1 ; - hw->extra_hdr_room =0 ; hw->device_strips_mic =0 ; hw->monitor_during_oper =1 ; hw->fraglist =0 ;Index:
wireless-dev/drivers/net/wireless/d80211/rt2x00/rt61pci.c
===================================================================drivers/net/wireless/d80211/rt2x00/rt61pci.c +0
-1@@ -3252,7 +3252,6 @@ static int rt61pci_init_hw(struct rt2x00 hw->wep_include_iv =1 ; hw->data_nullfunc_ack =1 ; hw->no_tkip_wmm_hwaccel =1 ; - hw->extra_hdr_room =0 ; hw->device_strips_mic =0 ; hw->monitor_during_oper =1 ; hw->fraglist =0 ;Index:
wireless-dev/drivers/net/wireless/d80211/rt2x00/rt73usb.c
===================================================================drivers/net/wireless/d80211/rt2x00/rt73usb.c +0
-3@@ -2792,7 +2792,6 @@ static int rt73usb_init_hw(struct rt2x00 hw->wep_include_iv =1 ; hw->data_nullfunc_ack =1 ; hw->no_tkip_wmm_hwaccel =1 ; - hw->extra_hdr_room =0 ; hw->device_strips_mic =0 ; hw->monitor_during_oper =1 ; hw->fraglist =0 ; -- -To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.htmlSignature · 1 line
Greetings Michael.
Re: [patch 2/3] d80211: remove poorly documented ieee80211_hw extra_hdr_room flag
Quoted 8 lines · David Kimdon
Quoted 7 lines · Michael Buesch
Quoted 5 lines · David Kimdon
This flag is unused by all in tree drivers. Furthermore, the way that it is documented is not consistent with the way it is actually used by
ieee80211.c. The original attempt appears to be something to do with adding extra header room for low-level drivers which need to pad the IEEE 802.11 header (example: Atheros).
Quoted 6 lines
Quoted 1 line
What about not removing it, but extending it.
Sure, I would be happy with that. For Atheros it will be '2' to ensure that we can properly align the packet in the tx path without needing to realloc.
adm8211 needs this too to avoid realloc and possibly failing and dropping the packet. (except adm8211 needs closer to about 30 bytes of extra room to fit its hardware tx header)
Thanks,
-Michael Wu
Re: [patch 2/3] d80211: remove poorly documented ieee80211_hw extra_hdr_room flag
In reply to David KimdonQuoted 8 lines · David Kimdon
Quoted 7 lines · Michael Buesch
Quoted 5 lines · David Kimdon
This flag is unused by all in tree drivers. Furthermore, the way that it is documented is not consistent with the way it is actually used by
ieee80211.c. The original attempt appears to be something to do with adding extra header room for low-level drivers which need to pad the IEEE 802.11 header (example: Atheros).
Quoted 5 lines
Quoted 1 line
What about not removing it, but extending it.
Sure, I would be happy with that. For Atheros it will be '2' to ensure that we can properly align the packet in the tx path without needing to realloc.
Ok, nice. Do you want to do a patch or should I do?
Signature · 1 line
Greetings Michael.
Re: [patch 2/3] d80211: remove poorly documented ieee80211_hw extra_hdr_room flag
Quoted 9 lines · Michael Buesch
Quoted 8 lines · David Kimdon
Quoted 7 lines · Michael Buesch
Quoted 5 lines · David Kimdon
This flag is unused by all in tree drivers. Furthermore, the way that it is documented is not consistent with the way it is actually used by
ieee80211.c. The original attempt appears to be something to do with adding extra header room for low-level drivers which need to pad the IEEE 802.11 header (example: Atheros).
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
What about not removing it, but extending it.
Sure, I would be happy with that. For Atheros it will be '2' to ensure that we can properly align the packet in the tx path without needing to realloc.
Ok, nice. Do you want to do a patch or should I do?
Go ahead, thanks.
-David
PATCH 3/3 d80211: silence sparse warning: bad constant expression
In reply to a message not in the archiveSparse does not figure out that algs[] isn't really a variable length array. The message is:
net/d80211/ieee80211_sta.c:934:12: error: bad constant expression
This switches algs[] to be obviously a constant array, and derives the value of num_algs algs[]. The code is correct and equivalent with or without this change.
net/d80211/ieee80211_sta.c +2 -2
@@ -930,8 +930,8 @@ static void ieee80211_rx_mgmt_auth(strucprintk (KERN_DEBUG "%s: AP denied authentication (auth_alg=%d " "code=%d)\n" , dev->name, ifsta->auth_alg, status_code);if (status_code ==WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG ) { -const int num_algs =3 ; -u8 algs[num_algs]; +u8 algs[3 ]; +const int num_algs =sizeof (algs) /sizeof (algs[0 ]);int i, pos; algs[0 ] = algs[1 ] = algs[2 ] =0xff ;if (ifsta->auth_algs &IEEE80211_AUTH_ALG_OPEN )
--
Re: [patch 3/3] d80211: silence sparse warning: bad constant expression
Update to use ARRAY_SIZE, based on comment from Joe Perches.
d80211: silence sparse warning: 'bad constant expression'
Sparse does not figure out that algs[] isn't really a variable length array. The message is:
net/d80211/ieee80211_sta.c:934:12: error: bad constant expression
This switches algs[] to be obviously a constant array, and derives the value of num_algs algs[]. The code is correct and equivalent with or without this change.
net/d80211/ieee80211_sta.c +2 -2
@@ -930,8 +930,8 @@ static void ieee80211_rx_mgmt_auth(strucprintk (KERN_DEBUG "%s: AP denied authentication (auth_alg=%d " "code=%d)\n" , dev->name, ifsta->auth_alg, status_code);if (status_code ==WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG ) { -const int num_algs =3 ; -u8 algs[num_algs]; +u8 algs[3 ]; +const int num_algs =ARRAY_SIZE (algs);int i, pos; algs[0 ] = algs[1 ] = algs[2 ] =0xff ;if (ifsta->auth_algs &IEEE80211_AUTH_ALG_OPEN )
Re: [patch 3/3] d80211: silence sparse warning: bad constant expression
net/d80211/ieee80211_sta.c static void ieee80211_rx_mgmt_auth(struc · line 934
Quoted 10 lines · David Kimdon
net/d80211/ieee80211_sta.c +2
-2@@ -930,8 +930,8 @@ static void ieee80211_rx_mgmt_auth(strucprintk (KERN_DEBUG "%s: AP denied authentication (auth_alg=%d " "code=%d)\n" , dev->name, ifsta->auth_alg, status_code);if (status_code ==WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG ) { -const int num_algs =3 ; -u8 algs[num_algs]; +u8 algs[3 ]; +const int num_algs =ARRAY_SIZE (algs);
Wouldn't it be better just to use ARRAY_SIZE(algs) and get rid of num_algs completely?
Thanks,
Jiri
Signature · 2 lines
Jiri Benc SUSE Labs
Re: [patch 3/3] d80211: silence sparse warning: bad constant expression
Quoted 14 lines · Jiri Benc
net/d80211/ieee80211_sta.c static void ieee80211_rx_mgmt_auth(struc · line 934
Quoted 10 lines · David Kimdon
net/d80211/ieee80211_sta.c +2
-2@@ -930,8 +930,8 @@ static void ieee80211_rx_mgmt_auth(strucprintk (KERN_DEBUG "%s: AP denied authentication (auth_alg=%d " "code=%d)\n" , dev->name, ifsta->auth_alg, status_code);if (status_code ==WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG ) { -const int num_algs =3 ; -u8 algs[num_algs]; +u8 algs[3 ]; +const int num_algs =ARRAY_SIZE (algs);Wouldn't it be better just to use
ARRAY_SIZE(algs)and get rid ofnum_algscompletely?
I actually think the code reads slightly cleaner using num_algs, but don't have a strong preference. I'd be happy to make the change if removing num_algs is preferred.
-David
Re: [patch 3/3] d80211: silence sparse warning: bad constant expression
Quoted 3 lines · David Kimdon
I actually think the code reads slightly cleaner using
num_algs, but don't have a strong preference. I'd be happy to make the change if removingnum_algsis preferred.
Don't know. But nobody except me objected for more than a week so I've applied the patch to my tree.
I've also applied the following patches from you:
d80211: use FCS_LEN instead of hardcoded number.
d80211: remove unused Super AG definitions, purge comment (the second version of the patch)
Thanks for the patches,
Jiri
Signature · 2 lines
Jiri Benc SUSE Labs