Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

b43: support new RX header, noticed to be used in 598.314+ fw

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by

Rafał Miłecki and committed by
John W. Linville
17030f48 5d852905

+58 -13
+11 -2
drivers/net/wireless/b43/dma.c
··· 858 858 ring->current_slot = -1; 859 859 } else { 860 860 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 + } 863 872 } else 864 873 B43_WARN_ON(1); 865 874 }
+5 -2
drivers/net/wireless/b43/dma.h
··· 162 162 163 163 /* Misc DMA constants */ 164 164 #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 166 168 167 169 /* DMA engine tuning knobs */ 168 170 #define B43_TXRING_SLOTS 256 169 171 #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) 171 174 172 175 /* Pointer poison */ 173 176 #define B43_DMA_PTR_POISON ((void *)ERR_PTR(-ENOMEM))
+9 -1
drivers/net/wireless/b43/pio.c
··· 676 676 goto rx_error; 677 677 } 678 678 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 + } 680 688 if (macstat & B43_RX_MAC_FCSERR) { 681 689 if (!(q->dev->wl->filter_flags & FIF_FCSFAIL)) { 682 690 /* Drop frames with failed FCS. */
+16 -5
drivers/net/wireless/b43/xmit.c
··· 653 653 struct ieee80211_hdr *wlhdr; 654 654 const struct b43_rxhdr_fw4 *rxhdr = _rxhdr; 655 655 __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); 658 659 u16 chanid; 659 660 u16 phytype; 660 661 int padding; ··· 665 664 /* Get metadata about the frame from the header. */ 666 665 phystat0 = le16_to_cpu(rxhdr->phy_status0); 667 666 phystat3 = le16_to_cpu(rxhdr->phy_status3); 668 - macstat = le32_to_cpu(rxhdr->mac_status); 669 - mactime = le16_to_cpu(rxhdr->mac_time); 670 - chanstat = le16_to_cpu(rxhdr->channel); 667 + switch (dev->fw.hdr_format) { 668 + case B43_FW_HDR_598: 669 + macstat = le32_to_cpu(rxhdr->format_598.mac_status); 670 + mactime = le16_to_cpu(rxhdr->format_598.mac_time); 671 + chanstat = le16_to_cpu(rxhdr->format_598.channel); 672 + break; 673 + case B43_FW_HDR_410: 674 + case B43_FW_HDR_351: 675 + macstat = le32_to_cpu(rxhdr->format_351.mac_status); 676 + mactime = le16_to_cpu(rxhdr->format_351.mac_time); 677 + chanstat = le16_to_cpu(rxhdr->format_351.channel); 678 + break; 679 + } 671 680 phytype = chanstat & B43_RX_CHAN_PHYTYPE; 672 681 673 682 if (unlikely(macstat & B43_RX_MAC_FCSERR)) {
+17 -3
drivers/net/wireless/b43/xmit.h
··· 250 250 } __packed; 251 251 __le16 phy_status2; /* PHY RX Status 2 */ 252 252 __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; 256 270 } __packed; 257 271 258 272 /* PHY RX Status 0 */