From patchwork Wed Jan 30 08:58:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 1033346 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="YuMmZUVM"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 43qHNW0VT8z9sBZ for ; Wed, 30 Jan 2019 19:59:07 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730462AbfA3I7F (ORCPT ); Wed, 30 Jan 2019 03:59:05 -0500 Received: from mail-eopbgr130089.outbound.protection.outlook.com ([40.107.13.89]:52448 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725850AbfA3I66 (ORCPT ); Wed, 30 Jan 2019 03:58:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PG+mslxrFl1SaCF/Qqy6mrdptE96XnpZ5I4yzUEIjNA=; b=YuMmZUVMCxoJ9zhcuonnvoGiwQ5n334MbwqxOPORzJVgBIDDB+QOFoPTueHmNM2gPo7Bsyth+Wx+k6k7xGJXtaBd75JfKFbKDs92dVWqT0nynbSyfA3PPzEN44i+w10zqGqvx0d4FY0mFfBe8kUe+twUo1WjlMl2y6SBEWOBkNM= Received: from DB7PR05MB4940.eurprd05.prod.outlook.com (20.176.235.152) by DB7PR05MB5211.eurprd05.prod.outlook.com (20.178.41.223) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1558.19; Wed, 30 Jan 2019 08:58:37 +0000 Received: from DB7PR05MB4940.eurprd05.prod.outlook.com ([fe80::6161:97fd:d315:7b07]) by DB7PR05MB4940.eurprd05.prod.outlook.com ([fe80::6161:97fd:d315:7b07%6]) with mapi id 15.20.1558.023; Wed, 30 Jan 2019 08:58:37 +0000 From: Ido Schimmel To: "netdev@vger.kernel.org" CC: "davem@davemloft.net" , Jiri Pirko , mlxsw , Ido Schimmel Subject: [PATCH net-next 5/5] selftests: spectrum-2: Add delta two masks one key test Thread-Topic: [PATCH net-next 5/5] selftests: spectrum-2: Add delta two masks one key test Thread-Index: AQHUuHn8WFLpiuSneEOw7RWzIYYRoQ== Date: Wed, 30 Jan 2019 08:58:37 +0000 Message-ID: <20190130085813.32161-6-idosch@mellanox.com> References: <20190130085813.32161-1-idosch@mellanox.com> In-Reply-To: <20190130085813.32161-1-idosch@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM6P193CA0024.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:3e::37) To DB7PR05MB4940.eurprd05.prod.outlook.com (2603:10a6:10:1e::24) authentication-results: spf=none (sender IP is ) smtp.mailfrom=idosch@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB7PR05MB5211; 6:PEHZaxOkZSyBCo7+uJvdrZwgd38JG0VxzaKr5s3rgy3TekSlzWV1bEmEE2ys50lJZNwpHrGAG+enWB0BTgsu4rm+QLqks8MsbJUPJISKZ7UfAN4IpXmZg5cfdFticH7roY6FbWB+sAr5JLp0/s6ytpJTjZxaR2KJ3+hahhPCkNiZFSZVaZe7rqkbZZsnxQSc/6ohvIsI+JWWfPINaCnPXP5hZUDKhrQv42cJoD4yWfgaNR0QaOMm14b+EARekdUoAB2mORDyfIZj2hAtxAr8V3cJ6bUp1k9SPYRWoG30BXR/BVyBNy/rYbXDxeXSB7GEfFhyVEDoU5rre2Fafu720oMfoIOc8/YhpsaE/bchG1owSMSfwc1KgyCEg4SpkDytavpfMHTfRHTajNCr+tzF0Ptx/C5ZWXDfMyCXw5WsmBd5n/pywF3Eonep7EMlNqML1f3qZIrB1JNBM/sEL/1w3A==; 5:BnsWweAFUsHZ7294t+RUZDrtiXH9KDZyFZqdjvgvx1czM7sDMyKM5seQpgGv4N5RwKeZs5vCJkSWdLJGcwn5YjdtmkctNrUYn3t9oSLNeTIOvXOvHk+VV5Y8YWJeLNFAcn/MjCEw6Ynn0t+zRFJ+oc2rcX2UrbdiSXfZRPgXLu7FDtj6B3ldEzh1wiGzHgMsrTIOYQ1HqTGld40N6URkkA==; 7:GaQ7biU4xX6oQid0Os6AKrixaDY0zEMT3d5vYZH4lqcDiCcK/iaZSbLbVRYB5/xuuXcRUOdopMDWfK/JCeEQa2pmcBnitj7JCzN2hqSaFcn6SP8UncCG7j5ayFwVvcZgHbjqyyjb5/kvIfc0hthEcA== x-ms-office365-filtering-correlation-id: b47346cf-4b80-4deb-8694-08d686911f1c x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB7PR05MB5211; x-ms-traffictypediagnostic: DB7PR05MB5211: x-microsoft-antispam-prvs: x-forefront-prvs: 0933E9FD8D x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(396003)(346002)(366004)(39860400002)(376002)(189003)(199004)(66066001)(4326008)(68736007)(8936002)(2351001)(478600001)(386003)(6506007)(2906002)(102836004)(8676002)(36756003)(186003)(1730700003)(81156014)(6512007)(81166006)(5640700003)(107886003)(6916009)(106356001)(25786009)(6486002)(105586002)(50226002)(26005)(52116002)(6436002)(486006)(76176011)(53936002)(3846002)(6116002)(99286004)(2501003)(11346002)(316002)(446003)(54906003)(305945005)(14454004)(14444005)(256004)(1076003)(7736002)(476003)(2616005)(71190400001)(71200400001)(86362001)(97736004)(473944003); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB5211; H:DB7PR05MB4940.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: suaIFyOkbZxXZHFFVfjde/C7KCKoHvyaRpkH/OuiMAGVS7ghtbgxXvh2jiXcEeAaTyWMdQQeAGusBXgYmOr9/baBuVjTZftLF3i1vC6qvhzWGW4XLtaGsz/qy+LIitd/Zm/0jqyxvEsNTYmrx5hmJKSR91/8ZBAAIB0o043uJhy+/PDK3IeMtDed7QaW+hdmgOxNSbLJg1xFP8s8p4fe4uh3K/CMLmSy6HBiGkGiULRluKDZgpSnj2SNLPMdrX0hGrMXUBU2J2Wal0ZspBP8YOL/wIYRYuYk6aTagNuz7sE796RHwBKn7KJ29xdJ6PwyLeWT7xCugLjxTyIQyiaGrxNhsvmfKj42cciUgAkNdwIPXW6LXDDTixH3TLpfinO84j6AQopi9by0zVOkU8TzfRqjzGZKc29dJ56yLahNnKY= MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: b47346cf-4b80-4deb-8694-08d686911f1c X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Jan 2019 08:58:36.4262 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB5211 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jiri Pirko Ensure that the bug is fixed and we no longer have C-TCAM spill for two keys that differ only in delta. Signed-off-by: Jiri Pirko Signed-off-by: Ido Schimmel --- .../drivers/net/mlxsw/spectrum-2/tc_flower.sh | 46 ++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) 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 73a35ca827ac..f1922bf597b0 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,7 +9,8 @@ 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 \ - bloom_simple_test bloom_complex_test bloom_delta_test" + delta_two_masks_one_key_test bloom_simple_test \ + bloom_complex_test bloom_delta_test" NUM_NETIFS=2 source $lib_dir/tc_common.sh source $lib_dir/lib.sh @@ -450,6 +451,49 @@ delta_simple_test() log_test "delta simple test ($tcflags)" } +delta_two_masks_one_key_test() +{ + # If 2 keys are the same and only differ in mask in a way that + # they belong under the same ERP (second is delta of the first), + # there should be no C-TCAM spill. + + RET=0 + + if [[ "$tcflags" != "skip_sw" ]]; then + return 0; + fi + + tp_record "mlxsw:*" "tc filter add dev $h2 ingress protocol ip \ + pref 1 handle 101 flower $tcflags dst_ip 192.0.2.0/24 \ + action drop" + tp_check_hits "mlxsw:mlxsw_sp_acl_atcam_entry_add_ctcam_spill" 0 + check_err $? "incorrect C-TCAM spill while inserting the first rule" + + tp_record "mlxsw:*" "tc filter add dev $h2 ingress protocol ip \ + pref 2 handle 102 flower $tcflags dst_ip 192.0.2.2 \ + action drop" + tp_check_hits "mlxsw:mlxsw_sp_acl_atcam_entry_add_ctcam_spill" 0 + check_err $? "incorrect C-TCAM spill while inserting the second rule" + + $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_err $? "Did not match on correct filter" + + tc filter del dev $h2 ingress protocol ip pref 1 handle 101 flower + + $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" 102 1 + check_err $? "Did not match on correct filter" + + tc filter del dev $h2 ingress protocol ip pref 2 handle 102 flower + + log_test "delta two masks one key test ($tcflags)" +} + bloom_simple_test() { # Bloom filter requires that the eRP table is used. This test