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