Skip to content

Commit

Permalink
net: dsa: tag_sja1105: use a custom flow dissector procedure
Browse files Browse the repository at this point in the history
The sja1105 is a bit of a special snowflake, in that not all frames are
transmitted/received in the same way. L2 link-local frames are received
with the source port/switch ID information put in the destination MAC
address. For the rest, a tag_8021q header is used. So only the latter
frames displace the rest of the headers and need to use the generic flow
dissector procedure.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Vladimir Oltean authored and David S. Miller committed Sep 26, 2020
1 parent 6b04f17 commit e665297
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions net/dsa/tag_sja1105.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,13 +346,24 @@ static struct sk_buff *sja1105_rcv(struct sk_buff *skb,
is_meta);
}

static void sja1105_flow_dissect(const struct sk_buff *skb, __be16 *proto,
int *offset)
{
/* No tag added for management frames, all ok */
if (unlikely(sja1105_is_link_local(skb)))
return;

dsa_tag_generic_flow_dissect(skb, proto, offset);
}

static const struct dsa_device_ops sja1105_netdev_ops = {
.name = "sja1105",
.proto = DSA_TAG_PROTO_SJA1105,
.xmit = sja1105_xmit,
.rcv = sja1105_rcv,
.filter = sja1105_filter,
.overhead = VLAN_HLEN,
.flow_dissect = sja1105_flow_dissect,
.promisc_on_master = true,
};

Expand Down

0 comments on commit e665297

Please sign in to comment.