linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4/4] b43legacy: use frame control helpers
@ 2008-06-15  6:33 Harvey Harrison
  2008-06-15  8:30 ` Johannes Berg
  2008-06-15 10:39 ` Michael Buesch
  0 siblings, 2 replies; 3+ messages in thread
From: Harvey Harrison @ 2008-06-15  6:33 UTC (permalink / raw)
  To: John Linville; +Cc: Michael Buesch, linux-wireless

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
 drivers/net/wireless/b43legacy/xmit.c |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/b43legacy/xmit.c b/drivers/net/wireless/b43legacy/xmit.c
index 82dc04d..a354078 100644
--- a/drivers/net/wireless/b43legacy/xmit.c
+++ b/drivers/net/wireless/b43legacy/xmit.c
@@ -442,7 +442,7 @@ void b43legacy_rx(struct b43legacy_wldev *dev,
 	struct b43legacy_plcp_hdr6 *plcp;
 	struct ieee80211_hdr *wlhdr;
 	const struct b43legacy_rxhdr_fw3 *rxhdr = _rxhdr;
-	u16 fctl;
+	__le16 fctl;
 	u16 phystat0;
 	u16 phystat3;
 	u16 chanstat;
@@ -480,7 +480,7 @@ void b43legacy_rx(struct b43legacy_wldev *dev,
 		goto drop;
 	}
 	wlhdr = (struct ieee80211_hdr *)(skb->data);
-	fctl = le16_to_cpu(wlhdr->frame_control);
+	fctl = wlhdr->frame_control;
 
 	if ((macstat & B43legacy_RX_MAC_DEC) &&
 	    !(macstat & B43legacy_RX_MAC_DECERR)) {
@@ -499,11 +499,11 @@ void b43legacy_rx(struct b43legacy_wldev *dev,
 
 		if (dev->key[keyidx].algorithm != B43legacy_SEC_ALGO_NONE) {
 			/* Remove PROTECTED flag to mark it as decrypted. */
-			B43legacy_WARN_ON(!(fctl & IEEE80211_FCTL_PROTECTED));
-			fctl &= ~IEEE80211_FCTL_PROTECTED;
-			wlhdr->frame_control = cpu_to_le16(fctl);
+			B43legacy_WARN_ON(!ieee80211_has_protected(fctl));
+			fctl &= ~cpu_to_le16(IEEE80211_FCTL_PROTECTED);
+			wlhdr->frame_control = fctl;
 
-			wlhdr_len = ieee80211_get_hdrlen(fctl);
+			wlhdr_len = ieee80211_hdrlen(fctl);
 			if (unlikely(skb->len < (wlhdr_len + 3))) {
 				b43legacydbg(dev->wl, "RX: Packet size"
 					     " underrun3\n");
@@ -556,9 +556,7 @@ void b43legacy_rx(struct b43legacy_wldev *dev,
 	 * of timestamp, i.e. about 65 milliseconds after the PHY received
 	 * the first symbol.
 	 */
-	if (((fctl & (IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE))
-	    == (IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON)) ||
-	    dev->wl->radiotap_enabled) {
+	if (ieee80211_is_beacon(fctl) || dev->wl->radiotap_enabled) {
 		u16 low_mactime_now;
 
 		b43legacy_tsf_read(dev, &status.mactime);
-- 
1.5.6.rc3.283.g198e


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 4/4] b43legacy: use frame control helpers
  2008-06-15  6:33 [PATCH 4/4] b43legacy: use frame control helpers Harvey Harrison
@ 2008-06-15  8:30 ` Johannes Berg
  2008-06-15 10:39 ` Michael Buesch
  1 sibling, 0 replies; 3+ messages in thread
From: Johannes Berg @ 2008-06-15  8:30 UTC (permalink / raw)
  To: Harvey Harrison; +Cc: John Linville, Michael Buesch, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 828 bytes --]


> @@ -499,11 +499,11 @@ void b43legacy_rx(struct b43legacy_wldev *dev,
>  
>  		if (dev->key[keyidx].algorithm != B43legacy_SEC_ALGO_NONE) {
>  			/* Remove PROTECTED flag to mark it as decrypted. */
> -			B43legacy_WARN_ON(!(fctl & IEEE80211_FCTL_PROTECTED));
> -			fctl &= ~IEEE80211_FCTL_PROTECTED;
> -			wlhdr->frame_control = cpu_to_le16(fctl);
> +			B43legacy_WARN_ON(!ieee80211_has_protected(fctl));
> +			fctl &= ~cpu_to_le16(IEEE80211_FCTL_PROTECTED);
> +			wlhdr->frame_control = fctl;
>  
> -			wlhdr_len = ieee80211_get_hdrlen(fctl);
> +			wlhdr_len = ieee80211_hdrlen(fctl);
>  			if (unlikely(skb->len < (wlhdr_len + 3))) {
>  				b43legacydbg(dev->wl, "RX: Packet size"
>  					     " underrun3\n");

All this crypto code in b43legacy is totally bogus anyway, just kick it
out :)

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 4/4] b43legacy: use frame control helpers
  2008-06-15  6:33 [PATCH 4/4] b43legacy: use frame control helpers Harvey Harrison
  2008-06-15  8:30 ` Johannes Berg
@ 2008-06-15 10:39 ` Michael Buesch
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Buesch @ 2008-06-15 10:39 UTC (permalink / raw)
  To: Harvey Harrison; +Cc: John Linville, linux-wireless

On Sunday 15 June 2008 08:33:40 Harvey Harrison wrote:
> Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>

ACK.

> ---
>  drivers/net/wireless/b43legacy/xmit.c |   16 +++++++---------
>  1 files changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/net/wireless/b43legacy/xmit.c b/drivers/net/wireless/b43legacy/xmit.c
> index 82dc04d..a354078 100644
> --- a/drivers/net/wireless/b43legacy/xmit.c
> +++ b/drivers/net/wireless/b43legacy/xmit.c
> @@ -442,7 +442,7 @@ void b43legacy_rx(struct b43legacy_wldev *dev,
>  	struct b43legacy_plcp_hdr6 *plcp;
>  	struct ieee80211_hdr *wlhdr;
>  	const struct b43legacy_rxhdr_fw3 *rxhdr = _rxhdr;
> -	u16 fctl;
> +	__le16 fctl;
>  	u16 phystat0;
>  	u16 phystat3;
>  	u16 chanstat;
> @@ -480,7 +480,7 @@ void b43legacy_rx(struct b43legacy_wldev *dev,
>  		goto drop;
>  	}
>  	wlhdr = (struct ieee80211_hdr *)(skb->data);
> -	fctl = le16_to_cpu(wlhdr->frame_control);
> +	fctl = wlhdr->frame_control;
>  
>  	if ((macstat & B43legacy_RX_MAC_DEC) &&
>  	    !(macstat & B43legacy_RX_MAC_DECERR)) {
> @@ -499,11 +499,11 @@ void b43legacy_rx(struct b43legacy_wldev *dev,
>  
>  		if (dev->key[keyidx].algorithm != B43legacy_SEC_ALGO_NONE) {
>  			/* Remove PROTECTED flag to mark it as decrypted. */
> -			B43legacy_WARN_ON(!(fctl & IEEE80211_FCTL_PROTECTED));
> -			fctl &= ~IEEE80211_FCTL_PROTECTED;
> -			wlhdr->frame_control = cpu_to_le16(fctl);
> +			B43legacy_WARN_ON(!ieee80211_has_protected(fctl));
> +			fctl &= ~cpu_to_le16(IEEE80211_FCTL_PROTECTED);
> +			wlhdr->frame_control = fctl;
>  
> -			wlhdr_len = ieee80211_get_hdrlen(fctl);
> +			wlhdr_len = ieee80211_hdrlen(fctl);
>  			if (unlikely(skb->len < (wlhdr_len + 3))) {
>  				b43legacydbg(dev->wl, "RX: Packet size"
>  					     " underrun3\n");
> @@ -556,9 +556,7 @@ void b43legacy_rx(struct b43legacy_wldev *dev,
>  	 * of timestamp, i.e. about 65 milliseconds after the PHY received
>  	 * the first symbol.
>  	 */
> -	if (((fctl & (IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE))
> -	    == (IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON)) ||
> -	    dev->wl->radiotap_enabled) {
> +	if (ieee80211_is_beacon(fctl) || dev->wl->radiotap_enabled) {
>  		u16 low_mactime_now;
>  
>  		b43legacy_tsf_read(dev, &status.mactime);



-- 
Greetings Michael.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-06-15 10:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-15  6:33 [PATCH 4/4] b43legacy: use frame control helpers Harvey Harrison
2008-06-15  8:30 ` Johannes Berg
2008-06-15 10:39 ` Michael Buesch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).