Skip to content

Commit 17030f4

Browse files
rmileckilinvjw
authored andcommitted
b43: support new RX header, noticed to be used in 598.314+ fw
Signed-off-by: Rafał Miłecki <[email protected]> Signed-off-by: John W. Linville <[email protected]>
1 parent 5d85290 commit 17030f4

File tree

5 files changed

+58
-13
lines changed

5 files changed

+58
-13
lines changed

drivers/net/wireless/b43/dma.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -858,8 +858,17 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev,
858858
ring->current_slot = -1;
859859
} else {
860860
if (ring->index == 0) {
861-
ring->rx_buffersize = B43_DMA0_RX_BUFFERSIZE;
862-
ring->frameoffset = B43_DMA0_RX_FRAMEOFFSET;
861+
switch (dev->fw.hdr_format) {
862+
case B43_FW_HDR_598:
863+
ring->rx_buffersize = B43_DMA0_RX_FW598_BUFSIZE;
864+
ring->frameoffset = B43_DMA0_RX_FW598_FO;
865+
break;
866+
case B43_FW_HDR_410:
867+
case B43_FW_HDR_351:
868+
ring->rx_buffersize = B43_DMA0_RX_FW351_BUFSIZE;
869+
ring->frameoffset = B43_DMA0_RX_FW351_FO;
870+
break;
871+
}
863872
} else
864873
B43_WARN_ON(1);
865874
}

drivers/net/wireless/b43/dma.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,15 @@ struct b43_dmadesc_generic {
162162

163163
/* Misc DMA constants */
164164
#define B43_DMA_RINGMEMSIZE PAGE_SIZE
165-
#define B43_DMA0_RX_FRAMEOFFSET 30
165+
/* Offset of frame with actual data */
166+
#define B43_DMA0_RX_FW598_FO 38
167+
#define B43_DMA0_RX_FW351_FO 30
166168

167169
/* DMA engine tuning knobs */
168170
#define B43_TXRING_SLOTS 256
169171
#define B43_RXRING_SLOTS 64
170-
#define B43_DMA0_RX_BUFFERSIZE (B43_DMA0_RX_FRAMEOFFSET + IEEE80211_MAX_FRAME_LEN)
172+
#define B43_DMA0_RX_FW598_BUFSIZE (B43_DMA0_RX_FW598_FO + IEEE80211_MAX_FRAME_LEN)
173+
#define B43_DMA0_RX_FW351_BUFSIZE (B43_DMA0_RX_FW351_FO + IEEE80211_MAX_FRAME_LEN)
171174

172175
/* Pointer poison */
173176
#define B43_DMA_PTR_POISON ((void *)ERR_PTR(-ENOMEM))

drivers/net/wireless/b43/pio.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,15 @@ static bool pio_rx_frame(struct b43_pio_rxqueue *q)
676676
goto rx_error;
677677
}
678678

679-
macstat = le32_to_cpu(rxhdr->mac_status);
679+
switch (dev->fw.hdr_format) {
680+
case B43_FW_HDR_598:
681+
macstat = le32_to_cpu(rxhdr->format_598.mac_status);
682+
break;
683+
case B43_FW_HDR_410:
684+
case B43_FW_HDR_351:
685+
macstat = le32_to_cpu(rxhdr->format_351.mac_status);
686+
break;
687+
}
680688
if (macstat & B43_RX_MAC_FCSERR) {
681689
if (!(q->dev->wl->filter_flags & FIF_FCSFAIL)) {
682690
/* Drop frames with failed FCS. */

drivers/net/wireless/b43/xmit.c

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -653,8 +653,9 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
653653
struct ieee80211_hdr *wlhdr;
654654
const struct b43_rxhdr_fw4 *rxhdr = _rxhdr;
655655
__le16 fctl;
656-
u16 phystat0, phystat3, chanstat, mactime;
657-
u32 macstat;
656+
u16 phystat0, phystat3;
657+
u16 uninitialized_var(chanstat), uninitialized_var(mactime);
658+
u32 uninitialized_var(macstat);
658659
u16 chanid;
659660
u16 phytype;
660661
int padding;
@@ -664,9 +665,19 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
664665
/* Get metadata about the frame from the header. */
665666
phystat0 = le16_to_cpu(rxhdr->phy_status0);
666667
phystat3 = le16_to_cpu(rxhdr->phy_status3);
667-
macstat = le32_to_cpu(rxhdr->mac_status);
668-
mactime = le16_to_cpu(rxhdr->mac_time);
669-
chanstat = le16_to_cpu(rxhdr->channel);
668+
switch (dev->fw.hdr_format) {
669+
case B43_FW_HDR_598:
670+
macstat = le32_to_cpu(rxhdr->format_598.mac_status);
671+
mactime = le16_to_cpu(rxhdr->format_598.mac_time);
672+
chanstat = le16_to_cpu(rxhdr->format_598.channel);
673+
break;
674+
case B43_FW_HDR_410:
675+
case B43_FW_HDR_351:
676+
macstat = le32_to_cpu(rxhdr->format_351.mac_status);
677+
mactime = le16_to_cpu(rxhdr->format_351.mac_time);
678+
chanstat = le16_to_cpu(rxhdr->format_351.channel);
679+
break;
680+
}
670681
phytype = chanstat & B43_RX_CHAN_PHYTYPE;
671682

672683
if (unlikely(macstat & B43_RX_MAC_FCSERR)) {

drivers/net/wireless/b43/xmit.h

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,23 @@ struct b43_rxhdr_fw4 {
250250
} __packed;
251251
__le16 phy_status2; /* PHY RX Status 2 */
252252
__le16 phy_status3; /* PHY RX Status 3 */
253-
__le32 mac_status; /* MAC RX status */
254-
__le16 mac_time;
255-
__le16 channel;
253+
union {
254+
/* Tested with 598.314, 644.1001 and 666.2 */
255+
struct {
256+
__le16 phy_status4; /* PHY RX Status 4 */
257+
__le16 phy_status5; /* PHY RX Status 5 */
258+
__le32 mac_status; /* MAC RX status */
259+
__le16 mac_time;
260+
__le16 channel;
261+
} format_598 __packed;
262+
263+
/* Tested with 351.126, 410.2160, 478.104 and 508.* */
264+
struct {
265+
__le32 mac_status; /* MAC RX status */
266+
__le16 mac_time;
267+
__le16 channel;
268+
} format_351 __packed;
269+
} __packed;
256270
} __packed;
257271

258272
/* PHY RX Status 0 */

0 commit comments

Comments
 (0)