]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
ath10k: Remove msdu from idr when management pkt send fails
authorRakesh Pillai <pillair@codeaurora.org>
Fri, 8 May 2020 02:55:18 +0000 (05:55 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 22 Jun 2020 07:32:42 +0000 (09:32 +0200)
[ Upstream commit c730c477176ad4af86d9aae4d360a7ad840b073a ]

Currently when the sending of any management pkt
via wmi command fails, the packet is being unmapped
freed in the error handling. But the idr entry added,
which is used to track these packet is not getting removed.

Hence, during unload, in wmi cleanup, all the entries
in IDR are removed and the corresponding buffer is
attempted to be freed. This can cause a situation where
one packet is attempted to be freed twice.

Fix this error by rmeoving the msdu from the idr
list when the sending of a management packet over
wmi fails.

Tested HW: WCN3990
Tested FW: WLAN.HL.3.1-01040-QCAHLSWMTPLZ-1

Fixes: 1807da49733e ("ath10k: wmi: add management tx by reference support over wmi")
Signed-off-by: Rakesh Pillai <pillair@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/1588667015-25490-1-git-send-email-pillair@codeaurora.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/ath/ath10k/mac.c
drivers/net/wireless/ath/ath10k/wmi-ops.h
drivers/net/wireless/ath/ath10k/wmi-tlv.c

index 70331ca9e50eb4b9db6aaeb3cc7b0e1460689cf5..7b60d8d6bfa9fbc42560858114502a76a5a39276 100644 (file)
@@ -3921,6 +3921,9 @@ void ath10k_mgmt_over_wmi_tx_work(struct work_struct *work)
                        if (ret) {
                                ath10k_warn(ar, "failed to transmit management frame by ref via WMI: %d\n",
                                            ret);
+                               /* remove this msdu from idr tracking */
+                               ath10k_wmi_cleanup_mgmt_tx_send(ar, skb);
+
                                dma_unmap_single(ar->dev, paddr, skb->len,
                                                 DMA_TO_DEVICE);
                                ieee80211_free_txskb(ar->hw, skb);
index 1491c25518bb756a9a470ece2e07d1d2e0b6075b..edccabc667e86e72234a2e115db330659f49c4a2 100644 (file)
@@ -133,6 +133,7 @@ struct wmi_ops {
        struct sk_buff *(*gen_mgmt_tx_send)(struct ath10k *ar,
                                            struct sk_buff *skb,
                                            dma_addr_t paddr);
+       int (*cleanup_mgmt_tx_send)(struct ath10k *ar, struct sk_buff *msdu);
        struct sk_buff *(*gen_dbglog_cfg)(struct ath10k *ar, u64 module_enable,
                                          u32 log_level);
        struct sk_buff *(*gen_pktlog_enable)(struct ath10k *ar, u32 filter);
@@ -441,6 +442,15 @@ ath10k_wmi_get_txbf_conf_scheme(struct ath10k *ar)
        return ar->wmi.ops->get_txbf_conf_scheme(ar);
 }
 
+static inline int
+ath10k_wmi_cleanup_mgmt_tx_send(struct ath10k *ar, struct sk_buff *msdu)
+{
+       if (!ar->wmi.ops->cleanup_mgmt_tx_send)
+               return -EOPNOTSUPP;
+
+       return ar->wmi.ops->cleanup_mgmt_tx_send(ar, msdu);
+}
+
 static inline int
 ath10k_wmi_mgmt_tx_send(struct ath10k *ar, struct sk_buff *msdu,
                        dma_addr_t paddr)
index 4e68debda9bfc57e7f3e5682d9d51d74b048537d..4a3e169965ae2ae587549f8acef89d3a72c631d5 100644 (file)
@@ -2897,6 +2897,18 @@ ath10k_wmi_tlv_op_gen_request_stats(struct ath10k *ar, u32 stats_mask)
        return skb;
 }
 
+static int
+ath10k_wmi_tlv_op_cleanup_mgmt_tx_send(struct ath10k *ar,
+                                      struct sk_buff *msdu)
+{
+       struct ath10k_skb_cb *cb = ATH10K_SKB_CB(msdu);
+       struct ath10k_wmi *wmi = &ar->wmi;
+
+       idr_remove(&wmi->mgmt_pending_tx, cb->msdu_id);
+
+       return 0;
+}
+
 static int
 ath10k_wmi_mgmt_tx_alloc_msdu_id(struct ath10k *ar, struct sk_buff *skb,
                                 dma_addr_t paddr)
@@ -2971,6 +2983,8 @@ ath10k_wmi_tlv_op_gen_mgmt_tx_send(struct ath10k *ar, struct sk_buff *msdu,
        if (desc_id < 0)
                goto err_free_skb;
 
+       cb->msdu_id = desc_id;
+
        ptr = (void *)skb->data;
        tlv = ptr;
        tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_MGMT_TX_CMD);
@@ -4419,6 +4433,7 @@ static const struct wmi_ops wmi_tlv_ops = {
        .gen_force_fw_hang = ath10k_wmi_tlv_op_gen_force_fw_hang,
        /* .gen_mgmt_tx = not implemented; HTT is used */
        .gen_mgmt_tx_send = ath10k_wmi_tlv_op_gen_mgmt_tx_send,
+       .cleanup_mgmt_tx_send = ath10k_wmi_tlv_op_cleanup_mgmt_tx_send,
        .gen_dbglog_cfg = ath10k_wmi_tlv_op_gen_dbglog_cfg,
        .gen_pktlog_enable = ath10k_wmi_tlv_op_gen_pktlog_enable,
        .gen_pktlog_disable = ath10k_wmi_tlv_op_gen_pktlog_disable,