]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: rtw89: pci: treat first receiving part as first segment for 8922AE
authorPing-Ke Shih <pkshih@realtek.com>
Fri, 3 Jan 2025 02:51:26 +0000 (10:51 +0800)
committerPing-Ke Shih <pkshih@realtek.com>
Sun, 12 Jan 2025 01:24:21 +0000 (09:24 +0800)
For early chips, the RX BD info contains FS/LS bits for first/last segments
of a receiving packet. For 8922AE, the FS bit should be ignored, or it
may throw warning:

  rtw89_8922ae 0000:1a:00.0: skb should not be ready before first segment start

To have compatible logic, FS determined by what pending skb is existing
(!new) or not.

Since we expect every single receiving packet in single one segment,
enlarge 4 bytes for RX BD info, and add a debug message to note if
RX buffer is possibly smaller than expected size.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250103025126.15378-1-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/pci.c
drivers/net/wireless/realtek/rtw89/pci.h
drivers/net/wireless/realtek/rtw89/rtw8851be.c
drivers/net/wireless/realtek/rtw89/rtw8852ae.c
drivers/net/wireless/realtek/rtw89/rtw8852be.c
drivers/net/wireless/realtek/rtw89/rtw8852bte.c
drivers/net/wireless/realtek/rtw89/rtw8852ce.c
drivers/net/wireless/realtek/rtw89/rtw8922ae.c

index 516160147191c3f6d50992d54c2f71adc3af92f7..3b3b12fe4136de4c79acfa766e4b315e93de31f8 100644 (file)
@@ -321,10 +321,11 @@ static u32 rtw89_pci_get_rx_skb_idx(struct rtw89_dev *rtwdev,
 static u32 rtw89_pci_rxbd_deliver_skbs(struct rtw89_dev *rtwdev,
                                       struct rtw89_pci_rx_ring *rx_ring)
 {
-       struct rtw89_pci_dma_ring *bd_ring = &rx_ring->bd_ring;
-       struct rtw89_pci_rx_info *rx_info;
        struct rtw89_rx_desc_info *desc_info = &rx_ring->diliver_desc;
+       struct rtw89_pci_dma_ring *bd_ring = &rx_ring->bd_ring;
+       const struct rtw89_pci_info *info = rtwdev->pci_info;
        struct sk_buff *new = rx_ring->diliver_skb;
+       struct rtw89_pci_rx_info *rx_info;
        struct sk_buff *skb;
        u32 rxinfo_size = sizeof(struct rtw89_pci_rxbd_info);
        u32 skb_idx;
@@ -344,9 +345,14 @@ static u32 rtw89_pci_rxbd_deliver_skbs(struct rtw89_dev *rtwdev,
        }
 
        rx_info = RTW89_PCI_RX_SKB_CB(skb);
-       fs = rx_info->fs;
+       fs = info->no_rxbd_fs ? !new : rx_info->fs;
        ls = rx_info->ls;
 
+       if (unlikely(!fs || !ls))
+               rtw89_debug(rtwdev, RTW89_DBG_UNEXP,
+                           "unexpected fs/ls=%d/%d tag=%u len=%u new->len=%u\n",
+                           fs, ls, rx_info->tag, rx_info->len, new ? new->len : 0);
+
        if (fs) {
                if (new) {
                        rtw89_debug(rtwdev, RTW89_DBG_UNEXP,
index d52db4ca1b9979ec49550dd6274f8ec0f672d80c..4d11c3dd60a5d6738d93a9b5464fa12606160ec6 100644 (file)
 #define RTW89_PCI_TXWD_NUM_MAX         512
 #define RTW89_PCI_TXWD_PAGE_SIZE       128
 #define RTW89_PCI_ADDRINFO_MAX         4
-#define RTW89_PCI_RX_BUF_SIZE          (11454 + 40) /* +40 for rtw89_rxdesc_long_v2 */
+/* +40 for rtw89_rxdesc_long_v2; +4 for rtw89_pci_rxbd_info */
+#define RTW89_PCI_RX_BUF_SIZE          (11454 + 40 + 4)
 
 #define RTW89_PCI_POLL_BDRAM_RST_CNT   100
 #define RTW89_PCI_MULTITAG             8
@@ -1324,6 +1325,7 @@ struct rtw89_pci_info {
        enum mac_ax_io_rcy_tmr io_rcy_tmr;
        bool rx_ring_eq_is_full;
        bool check_rx_tag;
+       bool no_rxbd_fs;
 
        u32 init_cfg_reg;
        u32 txhci_en_bit;
index 651cbce1dd7e2006ffdb2b7c5198b6db0fdb2968..cfe744cc7f30eea0fc713cc9d1071737a7efc869 100644 (file)
@@ -27,6 +27,7 @@ static const struct rtw89_pci_info rtw8851b_pci_info = {
        .io_rcy_tmr             = MAC_AX_IO_RCY_ANA_TMR_6MS,
        .rx_ring_eq_is_full     = false,
        .check_rx_tag           = false,
+       .no_rxbd_fs             = false,
 
        .init_cfg_reg           = R_AX_PCIE_INIT_CFG1,
        .txhci_en_bit           = B_AX_TXHCI_EN,
index 701187d69e14c6b951bb95dd16e8c3c9538d1414..08e39f0572bc37a4012ce71b2eab1deb63c032f2 100644 (file)
@@ -27,6 +27,7 @@ static const struct rtw89_pci_info rtw8852a_pci_info = {
        .io_rcy_tmr             = MAC_AX_IO_RCY_ANA_TMR_6MS,
        .rx_ring_eq_is_full     = false,
        .check_rx_tag           = false,
+       .no_rxbd_fs             = false,
 
        .init_cfg_reg           = R_AX_PCIE_INIT_CFG1,
        .txhci_en_bit           = B_AX_TXHCI_EN,
index a13ea1cce4a70a7181a0e67929ddc5350cfbe442..42004ac52aee83410a8d7081df1c3cf0b371785c 100644 (file)
@@ -27,6 +27,7 @@ static const struct rtw89_pci_info rtw8852b_pci_info = {
        .io_rcy_tmr             = MAC_AX_IO_RCY_ANA_TMR_6MS,
        .rx_ring_eq_is_full     = false,
        .check_rx_tag           = false,
+       .no_rxbd_fs             = false,
 
        .init_cfg_reg           = R_AX_PCIE_INIT_CFG1,
        .txhci_en_bit           = B_AX_TXHCI_EN,
index d1eebecfcd732d3bf0fa03b4c4318d95fc174b5b..e482c9893e11e4e8b54092ad0d2a585a9f30a511 100644 (file)
@@ -33,6 +33,7 @@ static const struct rtw89_pci_info rtw8852bt_pci_info = {
        .io_rcy_tmr             = MAC_AX_IO_RCY_ANA_TMR_6MS,
        .rx_ring_eq_is_full     = false,
        .check_rx_tag           = false,
+       .no_rxbd_fs             = false,
 
        .init_cfg_reg           = R_AX_PCIE_INIT_CFG1,
        .txhci_en_bit           = B_AX_TXHCI_EN,
index 1a46878be96b2c47a20f20f4ee37736bc5acf1df..6b565acc4cdf9ccf1b83ce795822239cd28e65f1 100644 (file)
@@ -36,6 +36,7 @@ static const struct rtw89_pci_info rtw8852c_pci_info = {
        .io_rcy_tmr             = MAC_AX_IO_RCY_ANA_TMR_6MS,
        .rx_ring_eq_is_full     = false,
        .check_rx_tag           = false,
+       .no_rxbd_fs             = false,
 
        .init_cfg_reg           = R_AX_HAXI_INIT_CFG1,
        .txhci_en_bit           = B_AX_TXHCI_EN_V1,
index edfb1f220af024685846280a884781ae8527dce9..568d5bd134f9f9d616bb76ac2c3885e39eeeea28 100644 (file)
@@ -33,6 +33,7 @@ static const struct rtw89_pci_info rtw8922a_pci_info = {
        .io_rcy_tmr             = MAC_AX_IO_RCY_ANA_TMR_DEF,
        .rx_ring_eq_is_full     = true,
        .check_rx_tag           = true,
+       .no_rxbd_fs             = true,
 
        .init_cfg_reg           = R_BE_HAXI_INIT_CFG1,
        .txhci_en_bit           = B_BE_TXDMA_EN,