Skip to contentSkip to conversation

net: dsa: Implement flow_dissect callback for tag_dsa.

PATCH Superseded Rundong Ge 2 participants 2 messages Feb 15, 2019

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Rundong Ge

author
#0 lore raw

PATCH 1/1 net: dsa: Implement flow_dissect callback for tag_dsa.

RPS not work for DSA devices since the 'skb_get_hash' will always get the invalid hash for dsa tagged packets.

"[PATCH] tag_mtk: add flow_dissect callback to the ops struct" introduced the flow_dissect callback to get the right hash for MTK tagged packet. And tag_dsa also needs to implement the callback.

---
 net/dsa/tag_dsa.c | 9 +++++++++
 1 file changed, 9 insertions(+)
net/dsa/tag_dsa.c +9 -0
index 8b2f92e..67ff3fa 100644
@@ -146,8 +146,17 @@ static struct sk_buff *dsa_rcv(struct sk_buff *skb, struct net_device *dev,
 	return skb;
 }
 
+static int dsa_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto,
+				int *offset)
+{
+	*offset = 4;
+	*proto = ((__be16 *)skb->data)[1];
+	return 0;
+}
+
 const struct dsa_device_ops dsa_netdev_ops = {
 	.xmit	= dsa_xmit,
 	.rcv	= dsa_rcv,
+	.flow_dissect   = dsa_tag_flow_dissect,
 	.overhead = DSA_HLEN,
 };
Signature · 1 line
1.8.3.1
maintainer
#1 lore raw
Quoted 7 lines · Rundong Ge

RPS not work for DSA devices since the 'skb_get_hash' will always get the invalid hash for dsa tagged packets.

"[PATCH] tag_mtk: add flow_dissect callback to the ops struct" introduced the flow_dissect callback to get the right hash for MTK tagged packet. And tag_dsa also needs to implement the callback.

Hi Rundong

This looks good. Do you have any sort of numbers to show the performance improvements?

Could you make a similar change to tag_edsa.c? It uses an 8 byte header.

Thanks
Andrew