Skip to content

Commit

Permalink
net: dsa: tag_qca: add define for handling MIB packet
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ansuel Smith authored and David S. Miller committed Feb 2, 2022
1 parent c2ee818 commit 18be654
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions include/linux/dsa/tag_qca.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
4 changes: 4 additions & 0 deletions net/dsa/tag_qca.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ static struct sk_buff *qca_tag_rcv(struct sk_buff *skb, struct net_device *dev)
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);
Expand Down

0 comments on commit 18be654

Please sign in to comment.