[RFC net-next 3/3] net: dsa: tag_qca: set offload_fwd_mark

From: DENG Qingfang
Date: Sat Aug 07 2021 - 08:08:12 EST


As we offload flooding and forwarding, set offload_fwd_mark according to
Atheros header's type.

Signed-off-by: DENG Qingfang <dqfext@xxxxxxxxx>
---
net/dsa/tag_qca.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/net/dsa/tag_qca.c b/net/dsa/tag_qca.c
index 6e3136990491..ee5c1fdfef47 100644
--- a/net/dsa/tag_qca.c
+++ b/net/dsa/tag_qca.c
@@ -50,7 +50,7 @@ static struct sk_buff *qca_tag_xmit(struct sk_buff *skb, struct net_device *dev)

static struct sk_buff *qca_tag_rcv(struct sk_buff *skb, struct net_device *dev)
{
- u8 ver;
+ u8 ver, type;
u16 hdr;
int port;
__be16 *phdr;
@@ -82,6 +82,15 @@ static struct sk_buff *qca_tag_rcv(struct sk_buff *skb, struct net_device *dev)
if (!skb->dev)
return NULL;

+ type = (hdr & QCA_HDR_RECV_TYPE_MASK) >> QCA_HDR_RECV_TYPE_S;
+ switch (type) {
+ case 0x00: /* Normal packet */
+ case 0x19: /* Flooding to CPU */
+ case 0x1a: /* Forwarding to CPU */
+ dsa_default_offload_fwd_mark(skb);
+ break;
+ }
+
return skb;
}

--
2.25.1