History

net: dsa: sja1105: Don't store frame type in skb->cb

Due to a confusion I thought that eth_type_trans() was called by the network stack whereas it can actually be called by network drivers to figure out the skb protocol and next packet_type handlers. In light of the above, it is not safe to store the frame type from the DSA tagger's .filter callback (first entry point on RX path), since GRO is yet to be invoked on the received traffic. Hence it is very likely that the skb->cb will actually get overwritten between eth_type_trans() and the actual DSA packet_type handler. Of course, what this patch fixes is the actual overwriting of the SJA1105_SKB_CB(skb)->type field from the GRO layer, which made all frames be seen as SJA1105_FRAME_TYPE_NORMAL (0).

Vladimir Oltean committed 7 years ago

Commit e8d67fa1 parent 036e3432 files · +3 −19Browse files

Unified · Split

2 files
  1. include/linux/dsa/sja1105.h +0 −12
  2. net/dsa/tag_sja1105.c +3 −7
include/linux/dsa/sja1105.h+0−12
@@ -20,18 +20,6 @@ · 19 unmodified lines
2020 #define SJA1105_LINKLOCAL_FILTER_B 0x011B19000000ull
2121 #define SJA1105_LINKLOCAL_FILTER_B_MASK 0xFFFFFF000000ull
2222
23−enum sja1105_frame_type {
24− SJA1105_FRAME_TYPE_NORMAL = 0,
25− SJA1105_FRAME_TYPE_LINK_LOCAL,
26−};
27−
28−struct sja1105_skb_cb {
29− enum sja1105_frame_type type;
30−};
31−
32−#define SJA1105_SKB_CB(skb) \
33− ((struct sja1105_skb_cb *)DSA_SKB_CB_PRIV(skb))
34−
3523 struct sja1105_port {
3624 struct dsa_port *dp;
3725 int mgmt_slot;
net/dsa/tag_sja1105.c+3−7
@@ -28,14 +28,10 @@ static inline bool sja1105_is_link_local(const struct sk_buff *skb) · 27 unmodified lines
2828 */
2929 static bool sja1105_filter(const struct sk_buff *skb, struct net_device *dev)
3030 {
31− if (sja1105_is_link_local(skb)) {
32− SJA1105_SKB_CB(skb)->type = SJA1105_FRAME_TYPE_LINK_LOCAL;
31+ if (sja1105_is_link_local(skb))
3332 return true;
34− }
35− if (!dsa_port_is_vlan_filtering(dev->dsa_ptr)) {
36− SJA1105_SKB_CB(skb)->type = SJA1105_FRAME_TYPE_NORMAL;
33+ if (!dsa_port_is_vlan_filtering(dev->dsa_ptr))
3734 return true;
38− }
3935 return false;
4036 }
4137
@@ -84,7 +80,7 @@ static struct sk_buff *sja1105_rcv(struct sk_buff *skb, · 42 unmodified lines
8480
8581 skb->offload_fwd_mark = 1;
8682
87− if (SJA1105_SKB_CB(skb)->type == SJA1105_FRAME_TYPE_LINK_LOCAL) {
83+ if (sja1105_is_link_local(skb)) {
8884 /* Management traffic path. Switch embeds the switch ID and
8985 * port ID into bytes of the destination MAC, courtesy of
9086 * the incl_srcpt options.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t