linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH 4/3] b43: support new RX header, noticed to be used in 598.314+ fw
  2011-08-11 14:20 [PATCH 4/3] b43: support new RX header, noticed to be used in 598.314+ fw Rafał Miłecki
@ 2011-08-11 13:43 ` Rafał Miłecki
  2011-08-11 14:55 ` Michael Büsch
  1 sibling, 0 replies; 5+ messages in thread
From: Rafał Miłecki @ 2011-08-11 13:43 UTC (permalink / raw)
  To: linux-wireless, John W. Linville; +Cc: b43-dev, Rafał Miłecki

W dniu 11 sierpnia 2011 16:20 użytkownik Rafał Miłecki
<zajec5@gmail.com> napisał:
>
> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
> ---
>  drivers/net/wireless/b43/pio.c  |   10 +++++++++-
>  drivers/net/wireless/b43/xmit.c |   21 ++++++++++++++++-----
>  drivers/net/wireless/b43/xmit.h |   19 ++++++++++++++++---
>  3 files changed, 41 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/net/wireless/b43/pio.c b/drivers/net/wireless/b43/pio.c
> index 6e4228c..ce8a4bd 100644
> --- a/drivers/net/wireless/b43/pio.c
> +++ b/drivers/net/wireless/b43/pio.c
> @@ -676,7 +676,15 @@ data_ready:
>                goto rx_error;
>        }
>
> -       macstat = le32_to_cpu(rxhdr->mac_status);
> +       switch (dev->fw.hdr_format) {
> +       case B43_FW_HDR_598:
> +               macstat = le32_to_cpu(rxhdr->format_598.mac_status);
> +               break;
> +       case B43_FW_HDR_410:
> +       case B43_FW_HDR_351:
> +               macstat = le32_to_cpu(rxhdr->format_351.mac_status);
> +               break;
> +       }
>        if (macstat & B43_RX_MAC_FCSERR) {
>                if (!(q->dev->wl->filter_flags & FIF_FCSFAIL)) {
>                        /* Drop frames with failed FCS. */
> diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
> index b02170d..5b82409 100644
> --- a/drivers/net/wireless/b43/xmit.c
> +++ b/drivers/net/wireless/b43/xmit.c
> @@ -653,8 +653,9 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
>        struct ieee80211_hdr *wlhdr;
>        const struct b43_rxhdr_fw4 *rxhdr = _rxhdr;
>        __le16 fctl;
> -       u16 phystat0, phystat3, chanstat, mactime;
> -       u32 macstat;
> +       u16 phystat0, phystat3;
> +       u16 uninitialized_var(chanstat), uninitialized_var(mactime);
> +       u32 uninitialized_var(macstat);
>        u16 chanid;
>        u16 phytype;
>        int padding;
> @@ -664,9 +665,19 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
>        /* Get metadata about the frame from the header. */
>        phystat0 = le16_to_cpu(rxhdr->phy_status0);
>        phystat3 = le16_to_cpu(rxhdr->phy_status3);
> -       macstat = le32_to_cpu(rxhdr->mac_status);
> -       mactime = le16_to_cpu(rxhdr->mac_time);
> -       chanstat = le16_to_cpu(rxhdr->channel);
> +       switch (dev->fw.hdr_format) {
> +       case B43_FW_HDR_598:
> +               macstat = le32_to_cpu(rxhdr->format_598.mac_status);
> +               mactime = le16_to_cpu(rxhdr->format_598.mac_time);
> +               chanstat = le16_to_cpu(rxhdr->format_598.channel);
> +               break;
> +       case B43_FW_HDR_410:
> +       case B43_FW_HDR_351:
> +               macstat = le32_to_cpu(rxhdr->format_351.mac_status);
> +               mactime = le16_to_cpu(rxhdr->format_351.mac_time);
> +               chanstat = le16_to_cpu(rxhdr->format_351.channel);
> +               break;
> +       }
>        phytype = chanstat & B43_RX_CHAN_PHYTYPE;
>
>        if (unlikely(macstat & B43_RX_MAC_FCSERR)) {
> diff --git a/drivers/net/wireless/b43/xmit.h b/drivers/net/wireless/b43/xmit.h
> index dccf7c1..dc37297 100644
> --- a/drivers/net/wireless/b43/xmit.h
> +++ b/drivers/net/wireless/b43/xmit.h
> @@ -250,9 +250,22 @@ struct b43_rxhdr_fw4 {
>        } __packed;
>        __le16 phy_status2;     /* PHY RX Status 2 */
>        __le16 phy_status3;     /* PHY RX Status 3 */
> -       __le32 mac_status;      /* MAC RX status */
> -       __le16 mac_time;
> -       __le16 channel;
> +       union {
> +               /* Tested with 598.314, 644.1001 and 666.2 */
> +               struct {
> +                       PAD_BYTES(1);
> +                       __le32 mac_status;      /* MAC RX status */
> +                       __le16 mac_time;
> +                       __le16 channel;
> +               } format_598 __packed;
> +
> +               /* Tested with 351.126, 410.2160, 478.104 and 508.* */
> +               struct {
> +                       __le32 mac_status;      /* MAC RX status */
> +                       __le16 mac_time;
> +                       __le16 channel;
> +               } format_351 __packed;
> +       } __packed;
>  } __packed;
>
>  /* PHY RX Status 0 */

Sorry, ignore this one for now, sent too early.

-- 
Rafał

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

* [PATCH 4/3] b43: support new RX header, noticed to be used in 598.314+ fw
@ 2011-08-11 14:20 Rafał Miłecki
  2011-08-11 13:43 ` Rafał Miłecki
  2011-08-11 14:55 ` Michael Büsch
  0 siblings, 2 replies; 5+ messages in thread
From: Rafał Miłecki @ 2011-08-11 14:20 UTC (permalink / raw)
  To: linux-wireless, John W. Linville; +Cc: b43-dev, Rafał Miłecki


Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
 drivers/net/wireless/b43/pio.c  |   10 +++++++++-
 drivers/net/wireless/b43/xmit.c |   21 ++++++++++++++++-----
 drivers/net/wireless/b43/xmit.h |   19 ++++++++++++++++---
 3 files changed, 41 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/b43/pio.c b/drivers/net/wireless/b43/pio.c
index 6e4228c..ce8a4bd 100644
--- a/drivers/net/wireless/b43/pio.c
+++ b/drivers/net/wireless/b43/pio.c
@@ -676,7 +676,15 @@ data_ready:
 		goto rx_error;
 	}
 
-	macstat = le32_to_cpu(rxhdr->mac_status);
+	switch (dev->fw.hdr_format) {
+	case B43_FW_HDR_598:
+		macstat = le32_to_cpu(rxhdr->format_598.mac_status);
+		break;
+	case B43_FW_HDR_410:
+	case B43_FW_HDR_351:
+		macstat = le32_to_cpu(rxhdr->format_351.mac_status);
+		break;
+	}
 	if (macstat & B43_RX_MAC_FCSERR) {
 		if (!(q->dev->wl->filter_flags & FIF_FCSFAIL)) {
 			/* Drop frames with failed FCS. */
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
index b02170d..5b82409 100644
--- a/drivers/net/wireless/b43/xmit.c
+++ b/drivers/net/wireless/b43/xmit.c
@@ -653,8 +653,9 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
 	struct ieee80211_hdr *wlhdr;
 	const struct b43_rxhdr_fw4 *rxhdr = _rxhdr;
 	__le16 fctl;
-	u16 phystat0, phystat3, chanstat, mactime;
-	u32 macstat;
+	u16 phystat0, phystat3;
+	u16 uninitialized_var(chanstat), uninitialized_var(mactime);
+	u32 uninitialized_var(macstat);
 	u16 chanid;
 	u16 phytype;
 	int padding;
@@ -664,9 +665,19 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
 	/* Get metadata about the frame from the header. */
 	phystat0 = le16_to_cpu(rxhdr->phy_status0);
 	phystat3 = le16_to_cpu(rxhdr->phy_status3);
-	macstat = le32_to_cpu(rxhdr->mac_status);
-	mactime = le16_to_cpu(rxhdr->mac_time);
-	chanstat = le16_to_cpu(rxhdr->channel);
+	switch (dev->fw.hdr_format) {
+	case B43_FW_HDR_598:
+		macstat = le32_to_cpu(rxhdr->format_598.mac_status);
+		mactime = le16_to_cpu(rxhdr->format_598.mac_time);
+		chanstat = le16_to_cpu(rxhdr->format_598.channel);
+		break;
+	case B43_FW_HDR_410:
+	case B43_FW_HDR_351:
+		macstat = le32_to_cpu(rxhdr->format_351.mac_status);
+		mactime = le16_to_cpu(rxhdr->format_351.mac_time);
+		chanstat = le16_to_cpu(rxhdr->format_351.channel);
+		break;
+	}
 	phytype = chanstat & B43_RX_CHAN_PHYTYPE;
 
 	if (unlikely(macstat & B43_RX_MAC_FCSERR)) {
diff --git a/drivers/net/wireless/b43/xmit.h b/drivers/net/wireless/b43/xmit.h
index dccf7c1..dc37297 100644
--- a/drivers/net/wireless/b43/xmit.h
+++ b/drivers/net/wireless/b43/xmit.h
@@ -250,9 +250,22 @@ struct b43_rxhdr_fw4 {
 	} __packed;
 	__le16 phy_status2;	/* PHY RX Status 2 */
 	__le16 phy_status3;	/* PHY RX Status 3 */
-	__le32 mac_status;	/* MAC RX status */
-	__le16 mac_time;
-	__le16 channel;
+	union {
+		/* Tested with 598.314, 644.1001 and 666.2 */
+		struct {
+			PAD_BYTES(1);
+			__le32 mac_status;	/* MAC RX status */
+			__le16 mac_time;
+			__le16 channel;
+		} format_598 __packed;
+
+		/* Tested with 351.126, 410.2160, 478.104 and 508.* */
+		struct {
+			__le32 mac_status;	/* MAC RX status */
+			__le16 mac_time;
+			__le16 channel;
+		} format_351 __packed;
+	} __packed;
 } __packed;
 
 /* PHY RX Status 0 */
-- 
1.7.3.4


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

* Re: [PATCH 4/3] b43: support new RX header, noticed to be used in 598.314+ fw
  2011-08-11 14:20 [PATCH 4/3] b43: support new RX header, noticed to be used in 598.314+ fw Rafał Miłecki
  2011-08-11 13:43 ` Rafał Miłecki
@ 2011-08-11 14:55 ` Michael Büsch
  2011-08-11 15:05   ` Rafał Miłecki
  1 sibling, 1 reply; 5+ messages in thread
From: Michael Büsch @ 2011-08-11 14:55 UTC (permalink / raw)
  To: Rafał Miłecki; +Cc: linux-wireless, John W. Linville, b43-dev

On Thu, 11 Aug 2011 16:20:23 +0200
Rafał Miłecki <zajec5@gmail.com> wrote:

> 
> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
> ---
>  drivers/net/wireless/b43/pio.c  |   10 +++++++++-
>  drivers/net/wireless/b43/xmit.c |   21 ++++++++++++++++-----
>  drivers/net/wireless/b43/xmit.h |   19 ++++++++++++++++---
>  3 files changed, 41 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/net/wireless/b43/pio.c b/drivers/net/wireless/b43/pio.c
> index 6e4228c..ce8a4bd 100644
> --- a/drivers/net/wireless/b43/pio.c
> +++ b/drivers/net/wireless/b43/pio.c
> @@ -676,7 +676,15 @@ data_ready:
>  		goto rx_error;
>  	}
>  
> -	macstat = le32_to_cpu(rxhdr->mac_status);
> +	switch (dev->fw.hdr_format) {
> +	case B43_FW_HDR_598:
> +		macstat = le32_to_cpu(rxhdr->format_598.mac_status);
> +		break;
> +	case B43_FW_HDR_410:
> +	case B43_FW_HDR_351:
> +		macstat = le32_to_cpu(rxhdr->format_351.mac_status);
> +		break;
> +	}
>  	if (macstat & B43_RX_MAC_FCSERR) {
>  		if (!(q->dev->wl->filter_flags & FIF_FCSFAIL)) {
>  			/* Drop frames with failed FCS. */
> diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
> index b02170d..5b82409 100644
> --- a/drivers/net/wireless/b43/xmit.c
> +++ b/drivers/net/wireless/b43/xmit.c
> @@ -653,8 +653,9 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
>  	struct ieee80211_hdr *wlhdr;
>  	const struct b43_rxhdr_fw4 *rxhdr = _rxhdr;
>  	__le16 fctl;
> -	u16 phystat0, phystat3, chanstat, mactime;
> -	u32 macstat;
> +	u16 phystat0, phystat3;
> +	u16 uninitialized_var(chanstat), uninitialized_var(mactime);
> +	u32 uninitialized_var(macstat);
>  	u16 chanid;
>  	u16 phytype;
>  	int padding;
> @@ -664,9 +665,19 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
>  	/* Get metadata about the frame from the header. */
>  	phystat0 = le16_to_cpu(rxhdr->phy_status0);
>  	phystat3 = le16_to_cpu(rxhdr->phy_status3);
> -	macstat = le32_to_cpu(rxhdr->mac_status);
> -	mactime = le16_to_cpu(rxhdr->mac_time);
> -	chanstat = le16_to_cpu(rxhdr->channel);
> +	switch (dev->fw.hdr_format) {
> +	case B43_FW_HDR_598:
> +		macstat = le32_to_cpu(rxhdr->format_598.mac_status);
> +		mactime = le16_to_cpu(rxhdr->format_598.mac_time);
> +		chanstat = le16_to_cpu(rxhdr->format_598.channel);
> +		break;
> +	case B43_FW_HDR_410:
> +	case B43_FW_HDR_351:
> +		macstat = le32_to_cpu(rxhdr->format_351.mac_status);
> +		mactime = le16_to_cpu(rxhdr->format_351.mac_time);
> +		chanstat = le16_to_cpu(rxhdr->format_351.channel);
> +		break;
> +	}
>  	phytype = chanstat & B43_RX_CHAN_PHYTYPE;
>  
>  	if (unlikely(macstat & B43_RX_MAC_FCSERR)) {
> diff --git a/drivers/net/wireless/b43/xmit.h b/drivers/net/wireless/b43/xmit.h
> index dccf7c1..dc37297 100644
> --- a/drivers/net/wireless/b43/xmit.h
> +++ b/drivers/net/wireless/b43/xmit.h
> @@ -250,9 +250,22 @@ struct b43_rxhdr_fw4 {
>  	} __packed;
>  	__le16 phy_status2;	/* PHY RX Status 2 */
>  	__le16 phy_status3;	/* PHY RX Status 3 */
> -	__le32 mac_status;	/* MAC RX status */
> -	__le16 mac_time;
> -	__le16 channel;
> +	union {
> +		/* Tested with 598.314, 644.1001 and 666.2 */
> +		struct {
> +			PAD_BYTES(1);
> +			__le32 mac_status;	/* MAC RX status */
> +			__le16 mac_time;
> +			__le16 channel;
> +		} format_598 __packed;

Is this really a 1 byte padding here? This misalignes all fields from mac_status on.
Doesn't matter much, as the struct is packed, but it looks weird and worth
to re-check this.

-- 
Greetings, Michael.

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

* Re: [PATCH 4/3] b43: support new RX header, noticed to be used in 598.314+ fw
  2011-08-11 14:55 ` Michael Büsch
@ 2011-08-11 15:05   ` Rafał Miłecki
  2011-08-11 15:29     ` Michael Büsch
  0 siblings, 1 reply; 5+ messages in thread
From: Rafał Miłecki @ 2011-08-11 15:05 UTC (permalink / raw)
  To: Michael Büsch; +Cc: linux-wireless, John W. Linville, b43-dev

W dniu 11 sierpnia 2011 16:55 użytkownik Michael Büsch <m@bues.ch> napisał:
> On Thu, 11 Aug 2011 16:20:23 +0200
> Rafał Miłecki <zajec5@gmail.com> wrote:
>
>>
>> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
>> ---
>>  drivers/net/wireless/b43/pio.c  |   10 +++++++++-
>>  drivers/net/wireless/b43/xmit.c |   21 ++++++++++++++++-----
>>  drivers/net/wireless/b43/xmit.h |   19 ++++++++++++++++---
>>  3 files changed, 41 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/net/wireless/b43/pio.c b/drivers/net/wireless/b43/pio.c
>> index 6e4228c..ce8a4bd 100644
>> --- a/drivers/net/wireless/b43/pio.c
>> +++ b/drivers/net/wireless/b43/pio.c
>> @@ -676,7 +676,15 @@ data_ready:
>>               goto rx_error;
>>       }
>>
>> -     macstat = le32_to_cpu(rxhdr->mac_status);
>> +     switch (dev->fw.hdr_format) {
>> +     case B43_FW_HDR_598:
>> +             macstat = le32_to_cpu(rxhdr->format_598.mac_status);
>> +             break;
>> +     case B43_FW_HDR_410:
>> +     case B43_FW_HDR_351:
>> +             macstat = le32_to_cpu(rxhdr->format_351.mac_status);
>> +             break;
>> +     }
>>       if (macstat & B43_RX_MAC_FCSERR) {
>>               if (!(q->dev->wl->filter_flags & FIF_FCSFAIL)) {
>>                       /* Drop frames with failed FCS. */
>> diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
>> index b02170d..5b82409 100644
>> --- a/drivers/net/wireless/b43/xmit.c
>> +++ b/drivers/net/wireless/b43/xmit.c
>> @@ -653,8 +653,9 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
>>       struct ieee80211_hdr *wlhdr;
>>       const struct b43_rxhdr_fw4 *rxhdr = _rxhdr;
>>       __le16 fctl;
>> -     u16 phystat0, phystat3, chanstat, mactime;
>> -     u32 macstat;
>> +     u16 phystat0, phystat3;
>> +     u16 uninitialized_var(chanstat), uninitialized_var(mactime);
>> +     u32 uninitialized_var(macstat);
>>       u16 chanid;
>>       u16 phytype;
>>       int padding;
>> @@ -664,9 +665,19 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
>>       /* Get metadata about the frame from the header. */
>>       phystat0 = le16_to_cpu(rxhdr->phy_status0);
>>       phystat3 = le16_to_cpu(rxhdr->phy_status3);
>> -     macstat = le32_to_cpu(rxhdr->mac_status);
>> -     mactime = le16_to_cpu(rxhdr->mac_time);
>> -     chanstat = le16_to_cpu(rxhdr->channel);
>> +     switch (dev->fw.hdr_format) {
>> +     case B43_FW_HDR_598:
>> +             macstat = le32_to_cpu(rxhdr->format_598.mac_status);
>> +             mactime = le16_to_cpu(rxhdr->format_598.mac_time);
>> +             chanstat = le16_to_cpu(rxhdr->format_598.channel);
>> +             break;
>> +     case B43_FW_HDR_410:
>> +     case B43_FW_HDR_351:
>> +             macstat = le32_to_cpu(rxhdr->format_351.mac_status);
>> +             mactime = le16_to_cpu(rxhdr->format_351.mac_time);
>> +             chanstat = le16_to_cpu(rxhdr->format_351.channel);
>> +             break;
>> +     }
>>       phytype = chanstat & B43_RX_CHAN_PHYTYPE;
>>
>>       if (unlikely(macstat & B43_RX_MAC_FCSERR)) {
>> diff --git a/drivers/net/wireless/b43/xmit.h b/drivers/net/wireless/b43/xmit.h
>> index dccf7c1..dc37297 100644
>> --- a/drivers/net/wireless/b43/xmit.h
>> +++ b/drivers/net/wireless/b43/xmit.h
>> @@ -250,9 +250,22 @@ struct b43_rxhdr_fw4 {
>>       } __packed;
>>       __le16 phy_status2;     /* PHY RX Status 2 */
>>       __le16 phy_status3;     /* PHY RX Status 3 */
>> -     __le32 mac_status;      /* MAC RX status */
>> -     __le16 mac_time;
>> -     __le16 channel;
>> +     union {
>> +             /* Tested with 598.314, 644.1001 and 666.2 */
>> +             struct {
>> +                     PAD_BYTES(1);
>> +                     __le32 mac_status;      /* MAC RX status */
>> +                     __le16 mac_time;
>> +                     __le16 channel;
>> +             } format_598 __packed;
>
> Is this really a 1 byte padding here? This misalignes all fields from mac_status on.
> Doesn't matter much, as the struct is packed, but it looks weird and worth
> to re-check this.

Please, review V2 of this patch :)

-- 
Rafał

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

* Re: [PATCH 4/3] b43: support new RX header, noticed to be used in 598.314+ fw
  2011-08-11 15:05   ` Rafał Miłecki
@ 2011-08-11 15:29     ` Michael Büsch
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Büsch @ 2011-08-11 15:29 UTC (permalink / raw)
  To: Rafał Miłecki; +Cc: linux-wireless, John W. Linville, b43-dev

On Thu, 11 Aug 2011 17:05:31 +0200
Rafał Miłecki <zajec5@gmail.com> wrote:
> Please, review V2 of this patch :)

Ok, nevermind. Looks great :)


-- 
Greetings, Michael.

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

end of thread, other threads:[~2011-08-11 15:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-11 14:20 [PATCH 4/3] b43: support new RX header, noticed to be used in 598.314+ fw Rafał Miłecki
2011-08-11 13:43 ` Rafał Miłecki
2011-08-11 14:55 ` Michael Büsch
2011-08-11 15:05   ` Rafał Miłecki
2011-08-11 15:29     ` Michael Büsch

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).