Netdev List
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@mellanox.com>
To: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Cc: "davem@davemloft.net" <davem@davemloft.net>,
	Jiri Pirko <jiri@mellanox.com>, mlxsw <mlxsw@mellanox.com>,
	Ido Schimmel <idosch@mellanox.com>
Subject: [PATCH net-next 14/14] selftests: mlxsw: spectrum-2: Add simple delta rehash test
Date: Thu, 7 Feb 2019 11:22:57 +0000	[thread overview]
Message-ID: <20190207112211.10375-15-idosch@mellanox.com> (raw)
In-Reply-To: <20190207112211.10375-1-idosch@mellanox.com>

From: Jiri Pirko <jiri@mellanox.com>

Track the basic codepaths of delta rehash handling,
using mlxsw tracepoints.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
---
 .../drivers/net/mlxsw/spectrum-2/tc_flower.sh | 77 ++++++++++++++++++-
 1 file changed, 74 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/drivers/net/mlxsw/spectrum-2/tc_flower.sh b/tools/testing/selftests/drivers/net/mlxsw/spectrum-2/tc_flower.sh
index f1922bf597b0..4d5b880b1d96 100755
--- a/tools/testing/selftests/drivers/net/mlxsw/spectrum-2/tc_flower.sh
+++ b/tools/testing/selftests/drivers/net/mlxsw/spectrum-2/tc_flower.sh
@@ -9,11 +9,11 @@ lib_dir=$(dirname $0)/../../../../net/forwarding
 
 ALL_TESTS="single_mask_test identical_filters_test two_masks_test \
 	multiple_masks_test ctcam_edge_cases_test delta_simple_test \
-	delta_two_masks_one_key_test bloom_simple_test \
-	bloom_complex_test bloom_delta_test"
+	delta_two_masks_one_key_test delta_simple_rehash_test \
+	bloom_simple_test bloom_complex_test bloom_delta_test"
 NUM_NETIFS=2
 source $lib_dir/tc_common.sh
-source $lib_dir/lib.sh
+source $lib_dir/devlink_lib.sh
 
 tcflags="skip_hw"
 
@@ -494,6 +494,77 @@ delta_two_masks_one_key_test()
 	log_test "delta two masks one key test ($tcflags)"
 }
 
+delta_simple_rehash_test()
+{
+	RET=0
+
+	if [[ "$tcflags" != "skip_sw" ]]; then
+		return 0;
+	fi
+
+	devlink dev param set $DEVLINK_DEV \
+		name acl_region_rehash_interval cmode runtime value 0
+	check_err $? "Failed to set ACL region rehash interval"
+
+	tp_record_all mlxsw:mlxsw_sp_acl_tcam_vregion_rehash 7
+	tp_check_hits_any mlxsw:mlxsw_sp_acl_tcam_vregion_rehash
+	check_fail $? "Rehash trace was hit even when rehash should be disabled"
+
+	devlink dev param set $DEVLINK_DEV \
+		name acl_region_rehash_interval cmode runtime value 3000
+	check_err $? "Failed to set ACL region rehash interval"
+
+	sleep 1
+
+	tc filter add dev $h2 ingress protocol ip pref 1 handle 101 flower \
+		$tcflags dst_ip 192.0.1.0/25 action drop
+	tc filter add dev $h2 ingress protocol ip pref 2 handle 102 flower \
+		$tcflags dst_ip 192.0.2.2 action drop
+	tc filter add dev $h2 ingress protocol ip pref 3 handle 103 flower \
+		$tcflags dst_ip 192.0.3.0/24 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
+
+	tc_check_packets "dev $h2 ingress" 101 1
+	check_fail $? "Matched a wrong filter"
+
+	tc_check_packets "dev $h2 ingress" 103 1
+	check_fail $? "Matched a wrong filter"
+
+	tc_check_packets "dev $h2 ingress" 102 1
+	check_err $? "Did not match on correct filter"
+
+	tp_record_all mlxsw:* 3
+	tp_check_hits_any mlxsw:mlxsw_sp_acl_tcam_vregion_rehash
+	check_err $? "Rehash trace was not hit"
+	tp_check_hits_any mlxsw:mlxsw_sp_acl_tcam_vregion_migrate
+	check_err $? "Migrate trace was not hit"
+	tp_record_all mlxsw:* 3
+	tp_check_hits_any mlxsw:mlxsw_sp_acl_tcam_vregion_rehash
+	check_err $? "Rehash trace was not hit"
+	tp_check_hits_any mlxsw:mlxsw_sp_acl_tcam_vregion_migrate
+	check_fail $? "Migrate trace was hit when no migration should happen"
+
+	$MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 192.0.2.1 -B 192.0.2.2 \
+		-t ip -q
+
+	tc_check_packets "dev $h2 ingress" 101 1
+	check_fail $? "Matched a wrong filter after rehash"
+
+	tc_check_packets "dev $h2 ingress" 103 1
+	check_fail $? "Matched a wrong filter after rehash"
+
+	tc_check_packets "dev $h2 ingress" 102 2
+	check_err $? "Did not match on correct filter after rehash"
+
+	tc filter del dev $h2 ingress protocol ip pref 3 handle 103 flower
+	tc filter del dev $h2 ingress protocol ip pref 2 handle 102 flower
+	tc filter del dev $h2 ingress protocol ip pref 1 handle 101 flower
+
+	log_test "delta simple rehash test ($tcflags)"
+}
+
 bloom_simple_test()
 {
 	# Bloom filter requires that the eRP table is used. This test
-- 
2.20.1


  parent reply	other threads:[~2019-02-07 11:23 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-07 11:22 [PATCH net-next 00/14] mlxsw: Implement periodic ERP rehash Ido Schimmel
2019-02-07 11:22 ` [PATCH net-next 01/14] devlink: publish params only after driver init is done Ido Schimmel
2019-02-07 11:22 ` [PATCH net-next 03/14] lib: objagg: fix typo in objagg_stats_put() docstring Ido Schimmel
2019-02-07 11:22 ` [PATCH net-next 02/14] lib: objagg: implement optimization hints assembly and use hints for object creation Ido Schimmel
2019-02-07 11:22 ` [PATCH net-next 04/14] lib: objagg: add root count to stats Ido Schimmel
2019-02-07 11:22 ` [PATCH net-next 05/14] mlxsw: spectrum_acl: Split region struct into region and vregion Ido Schimmel
2019-02-07 11:22 ` [PATCH net-next 06/14] mlxsw: spectrum_acl: Split chunk struct into chunk and vchunk Ido Schimmel
2019-02-07 11:22 ` [PATCH net-next 07/14] mlxsw: spectrum_acl: Split entry struct into entry and ventry Ido Schimmel
2019-02-07 11:22 ` [PATCH net-next 08/14] mlxsw: spectrum_acl: Implement basic ERP rehash hits creation Ido Schimmel
2019-02-07 11:22 ` [PATCH net-next 09/14] mlxsw: spectrum_acl: Pass hints priv all the way to ERP code Ido Schimmel
2019-02-07 11:22 ` [PATCH net-next 10/14] mlxsw: reg: Add multi field to PAGT register Ido Schimmel
2019-02-07 11:22 ` [PATCH net-next 11/14] mlxsw: spectrum_acl: Implement region migration according to hints Ido Schimmel
2019-02-07 11:22 ` [PATCH net-next 13/14] mlxsw: spectrum_acl: Add couple of vregion rehash tracepoints Ido Schimmel
2019-02-07 11:22 ` [PATCH net-next 12/14] mlxsw: spectrum: add "acl_region_rehash_interval" devlink param Ido Schimmel
2019-02-07 11:22 ` Ido Schimmel [this message]
2019-02-08 23:03 ` [PATCH net-next 00/14] mlxsw: Implement periodic ERP rehash David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190207112211.10375-15-idosch@mellanox.com \
    --to=idosch@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=jiri@mellanox.com \
    --cc=mlxsw@mellanox.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox