Skip to content

Commit 43e6652

Browse files
blogicdavem330
authored andcommitted
net-next: dsa: fix flow dissection
RPS and probably other kernel features are currently broken on some if not all DSA devices. The root cause of this is that skb_hash will call the flow_dissector. At this point the skb still contains the magic switch header and the skb->protocol field is not set up to the correct 802.3 value yet. By the time the tag specific code is called, removing the header and properly setting the protocol an invalid hash is already set. In the case of the mt7530 this will result in all flows always having the same hash. Signed-off-by: Muciri Gatimu <[email protected]> Signed-off-by: Shashidhar Lakkavalli <[email protected]> Signed-off-by: John Crispin <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 2dd592b commit 43e6652

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

net/core/flow_dissector.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <linux/ip.h>
55
#include <linux/ipv6.h>
66
#include <linux/if_vlan.h>
7+
#include <net/dsa.h>
78
#include <net/ip.h>
89
#include <net/ipv6.h>
910
#include <net/gre.h>
@@ -440,6 +441,17 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
440441
skb->vlan_proto : skb->protocol;
441442
nhoff = skb_network_offset(skb);
442443
hlen = skb_headlen(skb);
444+
if (unlikely(netdev_uses_dsa(skb->dev))) {
445+
const struct dsa_device_ops *ops;
446+
int offset;
447+
448+
ops = skb->dev->dsa_ptr->tag_ops;
449+
if (ops->flow_dissect &&
450+
!ops->flow_dissect(skb, &proto, &offset)) {
451+
hlen -= offset;
452+
nhoff += offset;
453+
}
454+
}
443455
}
444456

445457
/* It is ensured by skb_flow_dissector_init() that control key will

0 commit comments

Comments
 (0)