[PATCH] realtek: fix RTL839x receive tag decoding

Bjørn Mork bjorn at mork.no
Thu Sep 8 23:28:13 PDT 2022


The previous fixup was incomplete, and the offsets for the
queue and crc_error cpu_tag bitfields were still wrong on
RTL839x.

Fixes: 545c6113c93b ("realtek: fix RTL838x receive tag decoding")
Suggested-by: Jan Hoffmann <jan at 3e8.eu>
Signed-off-by: Bjørn Mork <bjorn at mork.no>
---
Jan pointed put that I missed two fields on the RTL839x. Sloppy. Fix
those as well.

This time even without complaints from checkpatch :-)

But build tested only.  I don't have any 839x and I don't know how
to verify these features anyway.


Bjørn

 .../realtek/files-5.10/drivers/net/ethernet/rtl838x_eth.c     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/linux/realtek/files-5.10/drivers/net/ethernet/rtl838x_eth.c b/target/linux/realtek/files-5.10/drivers/net/ethernet/rtl838x_eth.c
index d9ade6552698..e96c5a7216f8 100644
--- a/target/linux/realtek/files-5.10/drivers/net/ethernet/rtl838x_eth.c
+++ b/target/linux/realtek/files-5.10/drivers/net/ethernet/rtl838x_eth.c
@@ -282,9 +282,9 @@ bool rtl839x_decode_tag(struct p_hdr *h, struct dsa_tag *t)
 {
 	/* cpu_tag[0] is reserved. Fields are off-by-one */
 	t->reason = h->cpu_tag[5] & 0x1f;
-	t->queue = (h->cpu_tag[3] & 0xe000) >> 13;
+	t->queue = (h->cpu_tag[4] & 0xe000) >> 13;
 	t->port = h->cpu_tag[1] & 0x3f;
-	t->crc_error = h->cpu_tag[3] & BIT(2);
+	t->crc_error = h->cpu_tag[4] & BIT(6);
 
 	pr_debug("Reason: %d\n", t->reason);
 	if ((t->reason >= 7 && t->reason <= 13) || // NIC_RX_REASON_RMA
-- 
2.30.2




More information about the openwrt-devel mailing list