7e5dc6573068360aa7922725a86f2f4b644a5183
[openwrt/openwrt.git] /
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
5
6 Add struct to correctly parse a mib Ethernet packet.
7
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>
11 ---
12 include/linux/dsa/tag_qca.h | 10 ++++++++++
13 net/dsa/tag_qca.c | 4 ++++
14 2 files changed, 14 insertions(+)
15
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 */
20 } __packed;
21
22 +enum mdio_cmd {
23 + MDIO_WRITE = 0x0,
24 + MDIO_READ
25 +};
26 +
27 +struct mib_ethhdr {
28 + u32 data[3]; /* first 3 mib counter */
29 + __be16 hdr; /* qca hdr */
30 +} __packed;
31 +
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)
37 return NULL;
38
39 + /* Ethernet MIB counter packet */
40 + if (pk_type == QCA_HDR_RECV_TYPE_MIB)
41 + return NULL;
42 +
43 /* Remove QCA tag and recalculate checksum */
44 skb_pull_rcsum(skb, QCA_HDR_LEN);
45 dsa_strip_etype_header(skb, QCA_HDR_LEN);