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 00defa387d0f34b1531485f23158489ce9cb2045..9165d36a0934eac1605c1596108bcd53a6fae9b3 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 3a4bfc44142b69966234d45d6ecb7553363ac786..14ddb0d39e6374034e5833ec1dd56e3b676da035 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 7c14638b6474ccf9ff6913c312a0535c26057139..f4ef2a7e4b1a85ff83cc4ccf8400275b85fe7938 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 fa5ed7b42af64a4d52a6417a6de662add6c46192..db2eb93ef87ffb5c8cd33f01f697b453fe50de87 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 b2bd843451a29e3bdf6e60c4b1b968c1b626b9bf..f6222e9c7eda574a12cc21b7ea2947ebe1f3e61b 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 e344b76c602539c7bd5c32c61f6a9c8114236778..9c38612eb0687d56667c11effd4a4bcd8cf1bbf1 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,