]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
net: dsa: Implement flow_dissect callback for tag_dsa.
authorRundong Ge <rdong.ge@gmail.com>
Sat, 16 Feb 2019 08:35:24 +0000 (08:35 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 19 Feb 2019 00:35:41 +0000 (16:35 -0800)
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. Tag_dsa and tag_edsa  also need to implement
the callback.

Signed-off-by: Rundong Ge <rdong.ge@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dsa/tag_dsa.c
net/dsa/tag_edsa.c

index 8b2f92e3f3a2085a1e5f5a3ce0314dd3d7196872..67ff3fae18d8cf05de24578a79df22c7becaac0a 100644 (file)
@@ -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,
 };
index f5b87ee5c94e9068839c6fe53303010b5cc81be4..234585ec116ef2bed26bb0126f83c26b3abc5e47 100644 (file)
@@ -165,8 +165,17 @@ static struct sk_buff *edsa_rcv(struct sk_buff *skb, struct net_device *dev,
        return skb;
 }
 
+static int edsa_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto,
+                                int *offset)
+{
+       *offset = 8;
+       *proto = ((__be16 *)skb->data)[3];
+       return 0;
+}
+
 const struct dsa_device_ops edsa_netdev_ops = {
        .xmit   = edsa_xmit,
        .rcv    = edsa_rcv,
+       .flow_dissect   = edsa_tag_flow_dissect,
        .overhead = EDSA_HLEN,
 };