Skip to content

Commit 57fd967

Browse files
Rundong Gedavem330
authored andcommitted
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. 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>
1 parent 6e07902 commit 57fd967

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

net/dsa/tag_dsa.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,17 @@ static struct sk_buff *dsa_rcv(struct sk_buff *skb, struct net_device *dev,
146146
return skb;
147147
}
148148

149+
static int dsa_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto,
150+
int *offset)
151+
{
152+
*offset = 4;
153+
*proto = ((__be16 *)skb->data)[1];
154+
return 0;
155+
}
156+
149157
const struct dsa_device_ops dsa_netdev_ops = {
150158
.xmit = dsa_xmit,
151159
.rcv = dsa_rcv,
160+
.flow_dissect = dsa_tag_flow_dissect,
152161
.overhead = DSA_HLEN,
153162
};

net/dsa/tag_edsa.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,17 @@ static struct sk_buff *edsa_rcv(struct sk_buff *skb, struct net_device *dev,
165165
return skb;
166166
}
167167

168+
static int edsa_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto,
169+
int *offset)
170+
{
171+
*offset = 8;
172+
*proto = ((__be16 *)skb->data)[3];
173+
return 0;
174+
}
175+
168176
const struct dsa_device_ops edsa_netdev_ops = {
169177
.xmit = edsa_xmit,
170178
.rcv = edsa_rcv,
179+
.flow_dissect = edsa_tag_flow_dissect,
171180
.overhead = EDSA_HLEN,
172181
};

0 commit comments

Comments
 (0)