]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ath11k: fix FCS_ERR flag in radio tap header
authorP Praneesh <quic_ppranees@quicinc.com>
Mon, 25 Oct 2021 12:14:20 +0000 (17:44 +0530)
committerKalle Valo <kvalo@codeaurora.org>
Mon, 15 Nov 2021 09:24:51 +0000 (11:24 +0200)
In radio tap header, BAD FCS flag is not updated properly because
driver failed to update FCS_ERR flag in monitor mode.

In rx_desc, FCS_ERR information is available in rx_attention
structure and presence of this field indicates corresponding frame
failed FCS check.

Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-01695-QCAHKSWPL_SILICONZ-1

Signed-off-by: P Praneesh <quic_ppranees@quicinc.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/1635164060-18423-1-git-send-email-quic_ppranees@quicinc.com
drivers/net/wireless/ath/ath11k/dp_rx.c

index 3223d6d22628fa07de425a4732fb65682faa1cd0..fcd7a6d27d121700cbe3bdd68c0b83a20846ada6 100644 (file)
@@ -4826,7 +4826,7 @@ static struct sk_buff *
 ath11k_dp_rx_mon_merg_msdus(struct ath11k *ar,
                            u32 mac_id, struct sk_buff *head_msdu,
                            struct sk_buff *last_msdu,
-                           struct ieee80211_rx_status *rxs)
+                           struct ieee80211_rx_status *rxs, bool *fcs_err)
 {
        struct ath11k_base *ab = ar->ab;
        struct sk_buff *msdu, *prev_buf;
@@ -4836,12 +4836,17 @@ ath11k_dp_rx_mon_merg_msdus(struct ath11k *ar,
        u8 *dest, decap_format;
        struct ieee80211_hdr_3addr *wh;
        struct rx_attention *rx_attention;
+       u32 err_bitmap;
 
        if (!head_msdu)
                goto err_merge_fail;
 
        rx_desc = (struct hal_rx_desc *)head_msdu->data;
        rx_attention = ath11k_dp_rx_get_attention(ab, rx_desc);
+       err_bitmap = ath11k_dp_rx_h_attn_mpdu_err(rx_attention);
+
+       if (err_bitmap & DP_RX_MPDU_ERR_FCS)
+               *fcs_err = true;
 
        if (ath11k_dp_rxdesc_get_mpdulen_err(rx_attention))
                return NULL;
@@ -4930,9 +4935,10 @@ static int ath11k_dp_rx_mon_deliver(struct ath11k *ar, u32 mac_id,
        struct ath11k_pdev_dp *dp = &ar->dp;
        struct sk_buff *mon_skb, *skb_next, *header;
        struct ieee80211_rx_status *rxs = &dp->rx_status;
+       bool fcs_err = false;
 
        mon_skb = ath11k_dp_rx_mon_merg_msdus(ar, mac_id, head_msdu,
-                                             tail_msdu, rxs);
+                                             tail_msdu, rxs, &fcs_err);
 
        if (!mon_skb)
                goto mon_deliver_fail;
@@ -4940,6 +4946,10 @@ static int ath11k_dp_rx_mon_deliver(struct ath11k *ar, u32 mac_id,
        header = mon_skb;
 
        rxs->flag = 0;
+
+       if (fcs_err)
+               rxs->flag = RX_FLAG_FAILED_FCS_CRC;
+
        do {
                skb_next = mon_skb->next;
                if (!skb_next)