ImmortalWrt/target/linux/generic/backport-5.15/766-v5.18-07-net-dsa-tag_qca-add-define-for-handling-MIB-packet.patch
Christian Marangi ddcebda08b
generic: 5.15: qca8k: add kernel version tag on backport patch
Add kernel tag that introduced the patch on backport patch.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2022-09-19 15:19:53 +02:00

46 lines
1.3 KiB
Diff

From 18be654a4345f7d937b4bfbad74bea8093e3a93c Mon Sep 17 00:00:00 2001
From: Ansuel Smith <ansuelsmth@gmail.com>
Date: Wed, 2 Feb 2022 01:03:26 +0100
Subject: [PATCH 07/16] net: dsa: tag_qca: add define for handling MIB packet
Add struct to correctly parse a mib Ethernet packet.
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
include/linux/dsa/tag_qca.h | 10 ++++++++++
net/dsa/tag_qca.c | 4 ++++
2 files changed, 14 insertions(+)
--- a/include/linux/dsa/tag_qca.h
+++ b/include/linux/dsa/tag_qca.h
@@ -62,4 +62,14 @@ struct qca_mgmt_ethhdr {
__be16 hdr; /* qca hdr */
} __packed;
+enum mdio_cmd {
+ MDIO_WRITE = 0x0,
+ MDIO_READ
+};
+
+struct mib_ethhdr {
+ u32 data[3]; /* first 3 mib counter */
+ __be16 hdr; /* qca hdr */
+} __packed;
+
#endif /* __TAG_QCA_H */
--- a/net/dsa/tag_qca.c
+++ b/net/dsa/tag_qca.c
@@ -57,6 +57,10 @@ static struct sk_buff *qca_tag_rcv(struc
if (pk_type == QCA_HDR_RECV_TYPE_RW_REG_ACK)
return NULL;
+ /* Ethernet MIB counter packet */
+ if (pk_type == QCA_HDR_RECV_TYPE_MIB)
+ return NULL;
+
/* Remove QCA tag and recalculate checksum */
skb_pull_rcsum(skb, QCA_HDR_LEN);
dsa_strip_etype_header(skb, QCA_HDR_LEN);