wifi: rtw89: add chip_info::txwd_info size to generalize TX WD submit
authorPing-Ke Shih <pkshih@realtek.com>
Mon, 11 Sep 2023 08:20:47 +0000 (16:20 +0800)
committerKalle Valo <kvalo@kernel.org>
Mon, 18 Sep 2023 14:29:27 +0000 (17:29 +0300)
For existing chips, size of TX WD info is 6 words, but upcoming WiFi 7
chips become 8 words, so add a chip_info to reuse the code.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230911082049.33541-5-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/core.h
drivers/net/wireless/realtek/rtw89/pci.c
drivers/net/wireless/realtek/rtw89/rtw8851b.c
drivers/net/wireless/realtek/rtw89/rtw8852a.c
drivers/net/wireless/realtek/rtw89/rtw8852b.c
drivers/net/wireless/realtek/rtw89/rtw8852c.c

index 00defa3..9165d36 100644 (file)
@@ -3577,6 +3577,7 @@ struct rtw89_chip_info {
        u32 hci_func_en_addr;
        u32 h2c_desc_size;
        u32 txwd_body_size;
+       u32 txwd_info_size;
        u32 h2c_ctrl_reg;
        const u32 *h2c_regs;
        struct rtw89_reg_def h2c_counter_reg;
index 3a4bfc4..14ddb0d 100644 (file)
@@ -1196,7 +1196,6 @@ static int rtw89_pci_txwd_submit(struct rtw89_dev *rtwdev,
        struct rtw89_pci *rtwpci = (struct rtw89_pci *)rtwdev->priv;
        const struct rtw89_chip_info *chip = rtwdev->chip;
        struct rtw89_tx_desc_info *desc_info = &tx_req->desc_info;
-       struct rtw89_txwd_info *txwd_info;
        struct rtw89_pci_tx_wp_info *txwp_info;
        void *txaddr_info_addr;
        struct pci_dev *pdev = rtwpci->pdev;
@@ -1222,7 +1221,7 @@ static int rtw89_pci_txwd_submit(struct rtw89_dev *rtwdev,
 
        txwp_len = sizeof(*txwp_info);
        txwd_len = chip->txwd_body_size;
-       txwd_len += en_wd_info ? sizeof(*txwd_info) : 0;
+       txwd_len += en_wd_info ? chip->txwd_info_size : 0;
 
        txwp_info = txwd->vaddr + txwd_len;
        txwp_info->seq0 = cpu_to_le16(txwd->seq | RTW89_PCI_TXWP_VALID);
index 7c14638..f4ef2a7 100644 (file)
@@ -2421,6 +2421,7 @@ const struct rtw89_chip_info rtw8851b_chip_info = {
        .hci_func_en_addr       = R_AX_HCI_FUNC_EN,
        .h2c_desc_size          = sizeof(struct rtw89_txwd_body),
        .txwd_body_size         = sizeof(struct rtw89_txwd_body),
+       .txwd_info_size         = sizeof(struct rtw89_txwd_info),
        .h2c_ctrl_reg           = R_AX_H2CREG_CTRL,
        .h2c_counter_reg        = {R_AX_UDM1 + 1, B_AX_UDM1_HALMAC_H2C_DEQ_CNT_MASK >> 8},
        .h2c_regs               = rtw8851b_h2c_regs,
index fa5ed7b..db2eb93 100644 (file)
@@ -2159,6 +2159,7 @@ const struct rtw89_chip_info rtw8852a_chip_info = {
        .hci_func_en_addr       = R_AX_HCI_FUNC_EN,
        .h2c_desc_size          = sizeof(struct rtw89_txwd_body),
        .txwd_body_size         = sizeof(struct rtw89_txwd_body),
+       .txwd_info_size         = sizeof(struct rtw89_txwd_info),
        .h2c_ctrl_reg           = R_AX_H2CREG_CTRL,
        .h2c_counter_reg        = {R_AX_UDM1 + 1, B_AX_UDM1_HALMAC_H2C_DEQ_CNT_MASK >> 8},
        .h2c_regs               = rtw8852a_h2c_regs,
index b2bd843..f6222e9 100644 (file)
@@ -2592,6 +2592,7 @@ const struct rtw89_chip_info rtw8852b_chip_info = {
        .hci_func_en_addr       = R_AX_HCI_FUNC_EN,
        .h2c_desc_size          = sizeof(struct rtw89_txwd_body),
        .txwd_body_size         = sizeof(struct rtw89_txwd_body),
+       .txwd_info_size         = sizeof(struct rtw89_txwd_info),
        .h2c_ctrl_reg           = R_AX_H2CREG_CTRL,
        .h2c_counter_reg        = {R_AX_UDM1 + 1, B_AX_UDM1_HALMAC_H2C_DEQ_CNT_MASK >> 8},
        .h2c_regs               = rtw8852b_h2c_regs,
index e344b76..9c38612 100644 (file)
@@ -2903,6 +2903,7 @@ const struct rtw89_chip_info rtw8852c_chip_info = {
        .hci_func_en_addr       = R_AX_HCI_FUNC_EN_V1,
        .h2c_desc_size          = sizeof(struct rtw89_rxdesc_short),
        .txwd_body_size         = sizeof(struct rtw89_txwd_body_v1),
+       .txwd_info_size         = sizeof(struct rtw89_txwd_info),
        .h2c_ctrl_reg           = R_AX_H2CREG_CTRL_V1,
        .h2c_counter_reg        = {R_AX_UDM1 + 1, B_AX_UDM1_HALMAC_H2C_DEQ_CNT_MASK >> 8},
        .h2c_regs               = rtw8852c_h2c_regs,