Skip to content

Traffic support for SJA1105 DSA driver

Vladimir Oltean netdev 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest10 patches 7 repliesIn review
  2. v29 patches 5 repliesSuperseded
  3. v19 patches 9 repliesSuperseded

Changes in v3 from the cover letter

* Exported the dsa_port_vid_add and dsa_port_vid_del symbols to fix an error reported by the kbuild test robot

* Fixed the following checkpatch warnings in 05/10:
Macro argument reuse 'skb' - possible side-effects? Macro argument reuse 'clone' - possible side-effects?

* Added a commit description to the documentation patch (10/10)

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10net: dsa: Call driver's setup callback after setting up its switchdev notifiernet/dsa/dsa2.c+4 -40 replies
2/10net: dsa: Export symbols for dsa_port_vid_{add,del}net/dsa/port.c+2 -01 reply
3/10net: dsa: Optional VLAN-based port separation for switches without tagginginclude/linux/dsa/8021q.h include/net/dsa.h net/dsa/Kconfig +2 more+312 -00 replies
4/10net: dsa: Allow drivers to filter packets they can decode source port frominclude/net/dsa.h net/dsa/dsa2.c net/ethernet/eth.c+21 -12 replies
5/10net: dsa: Keep private info in the skb->cbinclude/net/dsa.h+31 -00 replies
6/10net: dsa: Add support for deferred xmitinclude/net/dsa.h net/dsa/dsa_priv.h net/dsa/slave.c+66 -121 reply
7/10net: dsa: Add a private structure pointer to dsa_portinclude/net/dsa.h+6 -00 replies
8/10net: dsa: sja1105: Add support for traffic through standalone portsdrivers/net/dsa/sja1105/Kconfig drivers/net/dsa/sja1105/sja1105.h drivers/net/dsa/sja1105/sja1105_main.c +5 more+308 -150 replies
9/10net: dsa: sja1105: Add support for Spanning Tree Protocoldrivers/net/dsa/sja1105/sja1105_main.c+99 -90 replies
10/10Documentation: net: dsa: sja1105: Add info about supported traffic modesDocumentation/networking/dsa/sja1105.rst+54 -02 replies

Reviews trailers per patch

All 10 patches have a Reviewed-by or Acked-by.

PatchFlorian FainelliAndrew LunnVivien Didelot
1/10R-b R-b R-b
2/10R-b
3/10R-b R-b
4/10R-b
5/10R-b
6/10R-b
7/10R-b R-b
8/10R-b
9/10R-b R-b
10/10R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v3 thread

Cover letter [PATCH net-next v3 00/10] Traffic support for SJA1105 DSA driver

This patch set is a continuation of the "NXP SJA1105 DSA driver" v3 series, which was split in multiple pieces for easier review.

Supporting a fully-featured (traffic-capable) driver for this switch requires some rework in DSA and also leaves behind a more generic infrastructure for other dumb switches that rely on 802.1Q pseudo-switch tagging for port separation. Among the DSA changes required are:

* Generic xmit and rcv functions for pushing/popping 802.1Q tags on skb's. These are modeled as a tagging protocol of its own but which must be customized by drivers to fit their own hardware possibilities.

* Permitting the .setup callback to invoke switchdev operations that will loop back into the driver through the switchdev notifier chain.

The SJA1105 driver then proceeds to extend this 8021q switch tagging protocol while adding its own (tag_sja1105). This is done because the driver actually implements a "dual tagger":

* For normal traffic it uses 802.1Q tags

* For management (multicast DMAC) frames the switch has native support for recognizing and annotating these with source port and switch id information.

Because this is a "dual tagger", decoding of management frames should still function when regular traffic can't (under a bridge with VLAN filtering).
There was intervention in the DSA receive hotpath, where a new filtering function called from eth_type_trans() is needed. This is useful in the general sense for switches that might actually have some limited means of source port decoding, such as only for management traffic, but not for everything.
In order for the 802.1Q tagging protocol (which cannot be enabled under all conditions, unlike the management traffic decoding) to not be an all-or-nothing choice, the filtering function matches everything that can be decoded, and everything else is left to pass to the master netdevice.

Lastly, DSA core support was added for drivers to request skb deferral. SJA1105 needs this for SPI intervention during transmission of link-local traffic. This is not done from within the tagger.

Some patches were carried over unchanged from the previous patchset (01/09). Others were slightly reworked while adapting to the recent changes in "Make DSA tag drivers kernel modules" (02/09).

The introduction of some structures (DSA_SKB_CB, dp->priv) may seem a little premature at this point and the new structures under-utilized. The reason is that traffic support has been rewritten with PTP timestamping in mind, and then I removed the timestamping code from the current submission (1. it is a different topic, 2. it does not work very well yet). On demand I can provide the timestamping patchset as a RFC though.

"NXP SJA1105 DSA driver" v3 patchset can be found at:
https://lkml.org/lkml/2019/4/12/978

v1 patchset can be found at:
https://lkml.org/lkml/2019/5/3/877

Changes in v2:

* Made the deferred xmit workqueue also be drained on the netdev suspend callback, not just on ndo_stop.

* Added clarification about how other netdevices may be bridged with the switch ports.

v2 patchset can be found at:
https://www.spinics.net/lists/netdev/msg568818.html

Changes in v3:

* Exported the dsa_port_vid_add and dsa_port_vid_del symbols to fix an error reported by the kbuild test robot

* Fixed the following checkpatch warnings in 05/10:
Macro argument reuse 'skb' - possible side-effects? Macro argument reuse 'clone' - possible side-effects?

* Added a commit description to the documentation patch (10/10)

Vladimir Oltean (10):
net: dsa: Call driver's setup callback after setting up its switchdev
notifier
net: dsa: Export symbols for dsa_port_vid_{add,del}
net: dsa: Optional VLAN-based port separation for switches without
tagging
net: dsa: Allow drivers to filter packets they can decode source port
from
net: dsa: Keep private info in the skb->cb
net: dsa: Add support for deferred xmit
net: dsa: Add a private structure pointer to dsa_port
net: dsa: sja1105: Add support for traffic through standalone ports
net: dsa: sja1105: Add support for Spanning Tree Protocol
Documentation: net: dsa: sja1105: Add info about supported traffic
modes

 Documentation/networking/dsa/sja1105.rst |  54 +++++
 drivers/net/dsa/sja1105/Kconfig          |   1 +
 drivers/net/dsa/sja1105/sja1105.h        |   6 +
 drivers/net/dsa/sja1105/sja1105_main.c   | 246 +++++++++++++++++++++--
 include/linux/dsa/8021q.h                |  76 +++++++
 include/linux/dsa/sja1105.h              |  35 +++-
 include/net/dsa.h                        |  68 +++++++
 net/dsa/Kconfig                          |  20 ++
 net/dsa/Makefile                         |   2 +
 net/dsa/dsa2.c                           |   9 +-
 net/dsa/dsa_priv.h                       |   2 +
 net/dsa/port.c                           |   2 +
 net/dsa/slave.c                          |  64 ++++--
 net/dsa/tag_8021q.c                      | 222 ++++++++++++++++++++
 net/dsa/tag_sja1105.c                    | 131 ++++++++++++
 net/ethernet/eth.c                       |   6 +-
 16 files changed, 903 insertions(+), 41 deletions(-)
 create mode 100644 include/linux/dsa/8021q.h
 create mode 100644 net/dsa/tag_8021q.c
 create mode 100644 net/dsa/tag_sja1105.c
Signature · 1 line
2.17.1