net: dsa: generalize overhead for taggers that use both headers and trailers
authorVladimir Oltean <vladimir.oltean@nxp.com>
Fri, 11 Jun 2021 19:01:24 +0000 (22:01 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 11 Jun 2021 19:45:38 +0000 (12:45 -0700)
commit4e50025129efabb07714c1f27a80526897da374b
treebef1017e42111f0e3ffc5d6119ea58a677b6aa35
parent6c0de59b3d735f4c8c704dae30db540204b496ec
net: dsa: generalize overhead for taggers that use both headers and trailers

Some really really weird switches just couldn't decide whether to use a
normal or a tail tagger, so they just did both.

This creates problems for DSA, because we only have the concept of an
'overhead' which can be applied to the headroom or to the tailroom of
the skb (like for example during the central TX reallocation procedure),
depending on the value of bool tail_tag, but not to both.

We need to generalize DSA to cater for these odd switches by
transforming the 'overhead / tail_tag' pair into 'needed_headroom /
needed_tailroom'.

The DSA master's MTU is increased to account for both.

The flow dissector code is modified such that it only calls the DSA
adjustment callback if the tagger has a non-zero header length.

Taggers are trivially modified to declare either needed_headroom or
needed_tailroom, based on the tail_tag value that they currently
declare.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
21 files changed:
Documentation/networking/dsa/dsa.rst
include/net/dsa.h
net/core/flow_dissector.c
net/dsa/dsa_priv.h
net/dsa/master.c
net/dsa/slave.c
net/dsa/tag_ar9331.c
net/dsa/tag_brcm.c
net/dsa/tag_dsa.c
net/dsa/tag_gswip.c
net/dsa/tag_hellcreek.c
net/dsa/tag_ksz.c
net/dsa/tag_lan9303.c
net/dsa/tag_mtk.c
net/dsa/tag_ocelot.c
net/dsa/tag_ocelot_8021q.c
net/dsa/tag_qca.c
net/dsa/tag_rtl4_a.c
net/dsa/tag_sja1105.c
net/dsa/tag_trailer.c
net/dsa/tag_xrs700x.c