Skip to contentSkip to conversation

selftests: net: dsa: add a test for ports matching on notifiers

RFC PATCH In review Vladimir Oltean 1 participant 2 messages Feb 22, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 selftests: net: dsa: add a test for ports matching on notifiers

From: Vladimir Oltean <[email protected]>

DSA supports cross-chip setups, and this means that when an operation is performed on a port, the other switches in the fabric are also notified, to get a chance to implement something similar which might be needed when sending/receiving a packet to/from that port.

However we find that the DSA notifier match functions are written up pretty much randomly, so let's add a test that is easy to run even without cross-chip hardware, in order to better visualize the ports on which the notifier will match.

[.../selftests/net/dsa] $ make
gcc test_dsa_notifier_match.c -o test_dsa_notifier_match
[.../selftests/net/dsa] $ ./test_dsa_notifier_match Heat map for test notifier emitted on sw2p1:

   sw0p0     sw0p1     sw0p2     sw0p3     sw0p4
[  cpu  ] [  user ] [  user ] [  user ] [  dsa  ]

[ x ] [ ] [ ] [ ] [ x ]

   sw1p0     sw1p1     sw1p2     sw1p3     sw1p4
[  user ] [  user ] [  user ] [  user ] [  dsa  ]

[ ] [ ] [ ] [ ] [ x ]

   sw2p0     sw2p1     sw2p2     sw2p3     sw2p4
[  user ] [  user ] [  user ] [  user ] [  dsa  ]

[ ] [ x ] [ ] [ ] [ ]

Heat map for test notifier emitted on sw0p0:

   sw0p0     sw0p1     sw0p2     sw0p3     sw0p4
[  cpu  ] [  user ] [  user ] [  user ] [  dsa  ]

[ x ] [ ] [ ] [ ] [ ]

   sw1p0     sw1p1     sw1p2     sw1p3     sw1p4
[  user ] [  user ] [  user ] [  user ] [  dsa  ]

[ ] [ ] [ ] [ ] [ x ]

   sw2p0     sw2p1     sw2p2     sw2p3     sw2p4
[  user ] [  user ] [  user ] [  user ] [  dsa  ]

[ ] [ ] [ ] [ ] [ x ]

---
 MAINTAINERS                                   |   1 +
 tools/testing/selftests/net/dsa/Makefile      |   6 +
 .../net/dsa/test_dsa_notifier_match.c         | 446 ++++++++++++++++++
 3 files changed, 453 insertions(+)
 create mode 100644 tools/testing/selftests/net/dsa/Makefile
 create mode 100644 tools/testing/selftests/net/dsa/test_dsa_notifier_match.c
MAINTAINERS +1 -0
index 986a8eef8633..0b501750065a 100644
@@ -12397,6 +12397,7 @@ F:	include/linux/dsa/
 F:	include/linux/platform_data/dsa.h
 F:	include/net/dsa.h
 F:	net/dsa/
+F:	tools/testing/selftests/net/dsa/
 
 NETWORKING [GENERAL]
 M:	"David S. Miller" <[email protected]>
tools/testing/selftests/net/dsa/Makefile new file +6 -0
new file mode 100644
index 000000000000..650d99bd6dab
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0
+
+TEST_PROGS := test_dsa_notifier_match
+TEST_GEN_FILES := test_dsa_notifier_match
+
+include ../../lib.mk
tools/testing/selftests/net/dsa/test_dsa_notifier_match.c new file +446 -0

446 lines not on this page · raw message

Signature · 1 line
2.25.1
#1 lore raw
Quoted 8 lines · Vladimir Oltean

+/* CPU
+ * |
+ * sw0p0 sw0p1 sw0p2 sw0p3 sw0p4
+ * | DSA link
+ * sw1p0 sw1p1 sw1p2 sw1p3 sw1p4
+ * | DSA link
+ * sw2p0 sw2p1 sw2p2 sw2p3 sw2p4
+ */

Ha, that's one idealistic view of reality, where sw1p4 is connected to two switches at the same time...

I'm still working on this, I'm using it to review and improve the notifiers that we have today. I just posted it to get some comments regarding the best way in which we should present this development tool. Should we add all notifiers from net/dsa/switch.c or should we leave just this "test" one, and the developer is responsible for copy-pasting the code they want to test into this C program?