realtek: fix RTL839X receive tag decoding
authorBirger Koblitz <git@birger-koblitz.de>
Sat, 1 Jan 2022 13:12:21 +0000 (14:12 +0100)
committerDaniel Golle <daniel@makrotopia.org>
Thu, 17 Feb 2022 15:21:47 +0000 (15:21 +0000)
Correct offset in RX tag structure. Correct offload decision flagging.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
target/linux/realtek/files-5.10/drivers/net/ethernet/rtl838x_eth.c

index 3d845519404a1fbace357f5cd2f45294db240433..9e5dfe9640e1ee5fe63d04eb66cafa81b0618534 100644 (file)
@@ -280,16 +280,17 @@ bool rtl838x_decode_tag(struct p_hdr *h, struct dsa_tag *t)
 
 bool rtl839x_decode_tag(struct p_hdr *h, struct dsa_tag *t)
 {
-       t->reason = h->cpu_tag[4] & 0x1f;
+       t->reason = h->cpu_tag[5] & 0x1f;
        t->queue = (h->cpu_tag[3] & 0xe000) >> 13;
        t->port = h->cpu_tag[1] & 0x3f;
        t->crc_error = h->cpu_tag[3] & BIT(2);
 
        pr_debug("Reason: %d\n", t->reason);
-       if ((t->reason != 7) && (t->reason != 8)) // NIC_RX_REASON_RMA_USR
-               t->l2_offloaded = 1;
-       else
+       if ((t->reason >= 7 && t->reason <= 13) || // NIC_RX_REASON_RMA
+           (t->reason >= 23 && t->reason <= 25))  // NIC_RX_REASON_SPECIAL_TRAP
                t->l2_offloaded = 0;
+       else
+               t->l2_offloaded = 1;
 
        return t->l2_offloaded;
 }