All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/3] Add DSA support for tc_actions selftest
@ 2022-05-03 12:08 Vladimir Oltean
  2022-05-03 12:08 ` [PATCH net-next 1/3] net: mscc: ocelot: offload tc action "ok" using an empty action vector Vladimir Oltean
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Vladimir Oltean @ 2022-05-03 12:08 UTC (permalink / raw)
  To: netdev
  Cc: Jakub Kicinski, David S. Miller, Paolo Abeni, Eric Dumazet,
	Florian Fainelli, Vivien Didelot, Andrew Lunn, Vladimir Oltean,
	Claudiu Manoil, Alexandre Belloni, UNGLinuxDriver,
	Xiaoliang Yang, Colin Foster

This change set makes the tc_actions.sh selftest run successfully on at
least NXP LS1028A, which includes the felix/ocelot DSA driver.

Vladimir Oltean (3):
  net: mscc: ocelot: offload tc action "ok" using an empty action vector
  selftests: forwarding: tc_actions: allow mirred egress test to run on
    non-offloaded h2
  selftests: net: dsa: symlink the tc_actions.sh test

 drivers/net/ethernet/mscc/ocelot_flower.c        | 16 ++++++++++++++++
 .../selftests/drivers/net/dsa/tc_actions.sh      |  1 +
 .../selftests/net/forwarding/tc_actions.sh       |  2 +-
 3 files changed, 18 insertions(+), 1 deletion(-)
 create mode 120000 tools/testing/selftests/drivers/net/dsa/tc_actions.sh

-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net-next 1/3] net: mscc: ocelot: offload tc action "ok" using an empty action vector
  2022-05-03 12:08 [PATCH net-next 0/3] Add DSA support for tc_actions selftest Vladimir Oltean
@ 2022-05-03 12:08 ` Vladimir Oltean
  2022-05-03 12:08 ` [PATCH net-next 2/3] selftests: forwarding: tc_actions: allow mirred egress test to run on non-offloaded h2 Vladimir Oltean
  2022-05-03 12:08 ` [PATCH net-next 3/3] selftests: net: dsa: symlink the tc_actions.sh test Vladimir Oltean
  2 siblings, 0 replies; 4+ messages in thread
From: Vladimir Oltean @ 2022-05-03 12:08 UTC (permalink / raw)
  To: netdev
  Cc: Jakub Kicinski, David S. Miller, Paolo Abeni, Eric Dumazet,
	Florian Fainelli, Vivien Didelot, Andrew Lunn, Vladimir Oltean,
	Claudiu Manoil, Alexandre Belloni, UNGLinuxDriver,
	Xiaoliang Yang, Colin Foster

The "ok" tc action is useful when placed in front of a more generic
filter to exclude some more specific rules from matching it.

The ocelot switches can offload this tc action by creating an empty
action vector (no _ENA fields set to 1). This makes sense for all of
VCAP IS1, IS2 and ES0 (but not for PSFP).

Add support for this action. Note that this makes the
gact_drop_and_ok_test() selftest pass, where "action ok" is used in
front of an "action drop" rule, both offloaded to VCAP IS2.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 drivers/net/ethernet/mscc/ocelot_flower.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/net/ethernet/mscc/ocelot_flower.c b/drivers/net/ethernet/mscc/ocelot_flower.c
index e598308ef09d..293860ba59db 100644
--- a/drivers/net/ethernet/mscc/ocelot_flower.c
+++ b/drivers/net/ethernet/mscc/ocelot_flower.c
@@ -279,6 +279,22 @@ static int ocelot_flower_parse_action(struct ocelot *ocelot, int port,
 			filter->action.pol_ix = OCELOT_POLICER_DISCARD;
 			filter->type = OCELOT_VCAP_FILTER_OFFLOAD;
 			break;
+		case FLOW_ACTION_ACCEPT:
+			if (filter->block_id != VCAP_ES0 &&
+			    filter->block_id != VCAP_IS1 &&
+			    filter->block_id != VCAP_IS2) {
+				NL_SET_ERR_MSG_MOD(extack,
+						   "Accept action can only be offloaded to VCAP chains");
+				return -EOPNOTSUPP;
+			}
+			if (filter->block_id != VCAP_ES0 &&
+			    filter->goto_target != -1) {
+				NL_SET_ERR_MSG_MOD(extack,
+						   "Last action must be GOTO");
+				return -EOPNOTSUPP;
+			}
+			filter->type = OCELOT_VCAP_FILTER_OFFLOAD;
+			break;
 		case FLOW_ACTION_TRAP:
 			if (filter->block_id != VCAP_IS2 ||
 			    filter->lookup != 0) {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net-next 2/3] selftests: forwarding: tc_actions: allow mirred egress test to run on non-offloaded h2
  2022-05-03 12:08 [PATCH net-next 0/3] Add DSA support for tc_actions selftest Vladimir Oltean
  2022-05-03 12:08 ` [PATCH net-next 1/3] net: mscc: ocelot: offload tc action "ok" using an empty action vector Vladimir Oltean
@ 2022-05-03 12:08 ` Vladimir Oltean
  2022-05-03 12:08 ` [PATCH net-next 3/3] selftests: net: dsa: symlink the tc_actions.sh test Vladimir Oltean
  2 siblings, 0 replies; 4+ messages in thread
From: Vladimir Oltean @ 2022-05-03 12:08 UTC (permalink / raw)
  To: netdev
  Cc: Jakub Kicinski, David S. Miller, Paolo Abeni, Eric Dumazet,
	Florian Fainelli, Vivien Didelot, Andrew Lunn, Vladimir Oltean,
	Claudiu Manoil, Alexandre Belloni, UNGLinuxDriver,
	Xiaoliang Yang, Colin Foster

The host interfaces $h1 and $h2 don't have to be switchdev interfaces,
but due to the fact that we pass $tcflags which may have the value of
"skip_sw", we force $h2 to offload a drop rule for dst_ip, something
which it may not be able to do.

The selftest only wants to verify the hit count of this rule as a means
of figuring out whether the packet was received, so remove the $tcflags
for it and let it be done in software.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 tools/testing/selftests/net/forwarding/tc_actions.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/forwarding/tc_actions.sh b/tools/testing/selftests/net/forwarding/tc_actions.sh
index de19eb6c38f0..1e0a62f638fe 100755
--- a/tools/testing/selftests/net/forwarding/tc_actions.sh
+++ b/tools/testing/selftests/net/forwarding/tc_actions.sh
@@ -60,7 +60,7 @@ mirred_egress_test()
 	RET=0
 
 	tc filter add dev $h2 ingress protocol ip pref 1 handle 101 flower \
-		$tcflags dst_ip 192.0.2.2 action drop
+		dst_ip 192.0.2.2 action drop
 
 	$MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 192.0.2.1 -B 192.0.2.2 \
 		-t ip -q
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net-next 3/3] selftests: net: dsa: symlink the tc_actions.sh test
  2022-05-03 12:08 [PATCH net-next 0/3] Add DSA support for tc_actions selftest Vladimir Oltean
  2022-05-03 12:08 ` [PATCH net-next 1/3] net: mscc: ocelot: offload tc action "ok" using an empty action vector Vladimir Oltean
  2022-05-03 12:08 ` [PATCH net-next 2/3] selftests: forwarding: tc_actions: allow mirred egress test to run on non-offloaded h2 Vladimir Oltean
@ 2022-05-03 12:08 ` Vladimir Oltean
  2 siblings, 0 replies; 4+ messages in thread
From: Vladimir Oltean @ 2022-05-03 12:08 UTC (permalink / raw)
  To: netdev
  Cc: Jakub Kicinski, David S. Miller, Paolo Abeni, Eric Dumazet,
	Florian Fainelli, Vivien Didelot, Andrew Lunn, Vladimir Oltean,
	Claudiu Manoil, Alexandre Belloni, UNGLinuxDriver,
	Xiaoliang Yang, Colin Foster

This has been validated on the Ocelot/Felix switch family (NXP LS1028A)
and should be relevant to any switch driver that offloads the tc-flower
and/or tc-matchall actions trap, drop, accept, mirred, for which DSA has
operations.

TEST: gact drop and ok (skip_hw)                                    [ OK ]
TEST: mirred egress flower redirect (skip_hw)                       [ OK ]
TEST: mirred egress flower mirror (skip_hw)                         [ OK ]
TEST: mirred egress matchall mirror (skip_hw)                       [ OK ]
TEST: mirred_egress_to_ingress (skip_hw)                            [ OK ]
TEST: gact drop and ok (skip_sw)                                    [ OK ]
TEST: mirred egress flower redirect (skip_sw)                       [ OK ]
TEST: mirred egress flower mirror (skip_sw)                         [ OK ]
TEST: mirred egress matchall mirror (skip_sw)                       [ OK ]
TEST: trap (skip_sw)                                                [ OK ]
TEST: mirred_egress_to_ingress (skip_sw)                            [ OK ]

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 tools/testing/selftests/drivers/net/dsa/tc_actions.sh | 1 +
 1 file changed, 1 insertion(+)
 create mode 120000 tools/testing/selftests/drivers/net/dsa/tc_actions.sh

diff --git a/tools/testing/selftests/drivers/net/dsa/tc_actions.sh b/tools/testing/selftests/drivers/net/dsa/tc_actions.sh
new file mode 120000
index 000000000000..306213d9430e
--- /dev/null
+++ b/tools/testing/selftests/drivers/net/dsa/tc_actions.sh
@@ -0,0 +1 @@
+../../../net/forwarding/tc_actions.sh
\ No newline at end of file
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-05-03 12:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-03 12:08 [PATCH net-next 0/3] Add DSA support for tc_actions selftest Vladimir Oltean
2022-05-03 12:08 ` [PATCH net-next 1/3] net: mscc: ocelot: offload tc action "ok" using an empty action vector Vladimir Oltean
2022-05-03 12:08 ` [PATCH net-next 2/3] selftests: forwarding: tc_actions: allow mirred egress test to run on non-offloaded h2 Vladimir Oltean
2022-05-03 12:08 ` [PATCH net-next 3/3] selftests: net: dsa: symlink the tc_actions.sh test Vladimir Oltean

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.