]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wil6210: fix RX checksum report to network stack
authorMaya Erez <merez@codeaurora.org>
Tue, 24 Jul 2018 07:44:26 +0000 (10:44 +0300)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 31 Jul 2018 08:00:07 +0000 (11:00 +0300)
Currently the driver sets CHECKSUM_UNNECESSARY only in case the HW
doesn't report checksum error.
As ip_summed value is not initialized it is not clear what
the driver will report to the network stack in case of HW checksum
error or in case HW doesn't calculate checksum.
Initialize ip_summed to CHECKSUM_NONE to guarantee checksum
calculation by the network stack in the above cases.

Signed-off-by: Gidon Studinski <gidons@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/ath/wil6210/debugfs.c
drivers/net/wireless/ath/wil6210/txrx.c
drivers/net/wireless/ath/wil6210/txrx_edma.c
drivers/net/wireless/ath/wil6210/wil6210.h

index 4356b3268c69be14069cec3ff203f009c44cd252..f2eab39376eec7b94a52cbfa2142568ef7caf822 100644 (file)
@@ -1736,10 +1736,11 @@ __acquires(&p->tid_rx_lock) __releases(&p->tid_rx_lock)
                                   p->stats.rx_large_frame,
                                   p->stats.rx_replay);
                        seq_printf(s,
-                                  "mic error %lu, key error %lu, amsdu error %lu\n",
+                                  "mic error %lu, key error %lu, amsdu error %lu, csum error %lu\n",
                                   p->stats.rx_mic_error,
                                   p->stats.rx_key_error,
-                                  p->stats.rx_amsdu_error);
+                                  p->stats.rx_amsdu_error,
+                                  p->stats.rx_csum_err);
 
                        seq_puts(s, "Rx/MCS:");
                        for (mcs = 0; mcs < ARRAY_SIZE(p->stats.rx_per_mcs);
index 6707af60a24de4ba17e3c060faef5ca7ba027706..6a7943e487fb11ba0fc62966da01d5de66826d0a 100644 (file)
@@ -281,6 +281,12 @@ static int wil_vring_alloc_skb(struct wil6210_priv *wil, struct wil_ring *vring,
        skb_reserve(skb, headroom);
        skb_put(skb, sz);
 
+       /**
+        * Make sure that the network stack calculates checksum for packets
+        * which failed the HW checksum calculation
+        */
+       skb->ip_summed = CHECKSUM_NONE;
+
        pa = dma_map_single(dev, skb->data, skb->len, DMA_FROM_DEVICE);
        if (unlikely(dma_mapping_error(dev, pa))) {
                kfree_skb(skb);
@@ -569,6 +575,8 @@ again:
                 * mis-calculates TCP checksum - if it should be 0x0,
                 * it writes 0xffff in violation of RFC 1624
                 */
+               else
+                       stats->rx_csum_err++;
        }
 
        if (snaplen) {
index 2ea9767b01d15bb8606fe3b7fe9f797d0e7311bd..9ef2b66f7561831179dfad3e31b38d0a1e51045d 100644 (file)
@@ -182,6 +182,12 @@ static int wil_ring_alloc_skb_edma(struct wil6210_priv *wil,
 
        skb_put(skb, sz);
 
+       /**
+        * Make sure that the network stack calculates checksum for packets
+        * which failed the HW checksum calculation
+        */
+       skb->ip_summed = CHECKSUM_NONE;
+
        pa = dma_map_single(dev, skb->data, skb->len, DMA_FROM_DEVICE);
        if (unlikely(dma_mapping_error(dev, pa))) {
                kfree_skb(skb);
@@ -847,6 +853,8 @@ static int wil_rx_error_check_edma(struct wil6210_priv *wil,
         * mis-calculates TCP checksum - if it should be 0x0,
         * it writes 0xffff in violation of RFC 1624
         */
+       else
+               stats->rx_csum_err++;
 
        return 0;
 }
index 1a7a1ad1534f0a25cf6cd2d91aa98e3124b774e2..b06cba528a1b0aa37e4937207b092d6202f9a007 100644 (file)
@@ -565,6 +565,7 @@ struct wil_net_stats {
        unsigned long   rx_mic_error;
        unsigned long   rx_key_error; /* eDMA specific */
        unsigned long   rx_amsdu_error; /* eDMA specific */
+       unsigned long   rx_csum_err;
        u16 last_mcs_rx;
        u64 rx_per_mcs[WIL_MCS_MAX + 1];
 };