From patchwork Mon Nov 19 16:11:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 10688871 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6A4D317FE for ; Mon, 19 Nov 2018 16:11:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5A9A32A0DC for ; Mon, 19 Nov 2018 16:11:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4EDAE2A0FD; Mon, 19 Nov 2018 16:11:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E49842A0DC for ; Mon, 19 Nov 2018 16:11:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730027AbeKTCfd (ORCPT ); Mon, 19 Nov 2018 21:35:33 -0500 Received: from mail-eopbgr10049.outbound.protection.outlook.com ([40.107.1.49]:48096 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729935AbeKTCfd (ORCPT ); Mon, 19 Nov 2018 21:35:33 -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=IPttjY4PdebepguXzFyCPcYM13u2a1/dxWYHe/3BxMU=; b=D6Rth7p/MthAYZQJoPL+ijKC94ZZxzkIUr7coXPndv8tuRx1jO3yk9cu9x6/kyx7yvmQExc94O+EHFDgJQZi6BTafGYzT31H+Dypk/6sxaR8YqwVcA1bAHc0ZJvRmTvgoUPhT8sMnRexMSIQG9Ejh5p47/5357iuYoglzZ7VFns= Received: from AM0PR05MB4978.eurprd05.prod.outlook.com (20.177.42.95) by AM0PR05MB6225.eurprd05.prod.outlook.com (20.178.115.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.30; Mon, 19 Nov 2018 16:11:18 +0000 Received: from AM0PR05MB4978.eurprd05.prod.outlook.com ([fe80::f953:cde4:ff8d:501a]) by AM0PR05MB4978.eurprd05.prod.outlook.com ([fe80::f953:cde4:ff8d:501a%4]) with mapi id 15.20.1339.026; Mon, 19 Nov 2018 16:11:18 +0000 From: Ido Schimmel To: "netdev@vger.kernel.org" , "linux-kselftest@vger.kernel.org" CC: "davem@davemloft.net" , "shuah@kernel.org" , Jiri Pirko , Petr Machata , "roopa@cumulusnetworks.com" , mlxsw , Ido Schimmel Subject: [PATCH net-next 10/18] selftests: forwarding: vxlan_bridge_1d: Add unicast test Thread-Topic: [PATCH net-next 10/18] selftests: forwarding: vxlan_bridge_1d: Add unicast test Thread-Index: AQHUgCKBRgCDoSLOfUOocNumqm8NAw== Date: Mon, 19 Nov 2018 16:11:18 +0000 Message-ID: <20181119161006.5405-11-idosch@mellanox.com> References: <20181119161006.5405-1-idosch@mellanox.com> In-Reply-To: <20181119161006.5405-1-idosch@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM5PR0601CA0031.eurprd06.prod.outlook.com (2603:10a6:203:68::17) To AM0PR05MB4978.eurprd05.prod.outlook.com (2603:10a6:208:d0::31) authentication-results: spf=none (sender IP is ) smtp.mailfrom=idosch@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;AM0PR05MB6225;6:UrozxzAwEPyue3V3QZ6btpz5szVCVNneSB9qSJY/Lwq7bxmRwAT3hQ0brtK4K0Ecun1+0e6GtF7a6AuqkvAKWe6dIB3reNZ4g+8trn9uAnKVcXKQspjb58LwVQYCNu6M1hi+ucRZS1hvAx2s1wcuSJPVkWsexelgl7nzgmZYeZokl5TgMGVrUKerpVTtcXENw9yzBYUYhAy53PJnT8vM0Vb5rOL+5+w8Un3bqcek0a3CRdw77KC3iyocNL0WbMgkZeCUkgMhqUrC37hCGI6DbgyCiOLQmPpIxa2+XPI7g6zp+v2nZePQaSr+VZgusyZz3pwoThzHfFsTjIaimNanre52MKPWL7Rihilh4Y388VlgY1HwR+G03PFSWibyfAOHhnSWmm75JaZ5oTLr4JyDgDCtDdl4kB+laBmnuvY4OvZ54wasGFfOg7/N8PVXOI7fQWT1Wq8+AzZAjfZA4BgAIA==;5:VtCzL+3aroKqFbqtJodZjb9tINWwprluvv6k/17snlWEAJ/0PPww7KdftH90+H+8Izhm+yNxhBs5I+aCr7/OK6BsqyXSW17UsCzQ+JykUcjSObO24Gs8uuuvwkeHZAmeTjEfdPPGW+hMbMF5n8h0RVPMBVAB8JZhewQcj0ywz8s=;7:Se3u+RWW9KmyItTbhy+5y0DkReQXSCHI4eNHObAmS3psMq4UgHS9YTV1lrd7t7fQXINiKkqsXWU8yzEjcBy9z5WqFbPvTFL8fOTVWRE+71W2BL021JTJII/F9qwzzGNyKPOvS/VddCQTWEdy7YGUaw== x-ms-office365-filtering-correlation-id: a3976fb2-2900-490d-22f2-08d64e39a355 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:AM0PR05MB6225; x-ms-traffictypediagnostic: AM0PR05MB6225: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3002001)(3231415)(944501410)(52105112)(6055026)(148016)(149066)(150057)(6041310)(20161123564045)(20161123562045)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095);SRVR:AM0PR05MB6225;BCL:0;PCL:0;RULEID:;SRVR:AM0PR05MB6225; x-forefront-prvs: 08617F610C x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(346002)(136003)(39860400002)(366004)(376002)(396003)(189003)(199004)(71200400001)(71190400001)(478600001)(110136005)(54906003)(316002)(386003)(102836004)(14454004)(2906002)(2501003)(107886003)(26005)(97736004)(25786009)(256004)(4326008)(53936002)(6512007)(105586002)(68736007)(106356001)(1076002)(8676002)(186003)(3846002)(2900100001)(446003)(6116002)(6486002)(7736002)(6436002)(486006)(305945005)(76176011)(52116002)(2616005)(6506007)(36756003)(99286004)(66066001)(81156014)(81166006)(11346002)(86362001)(8936002)(5660300001)(476003);DIR:OUT;SFP:1101;SCL:1;SRVR:AM0PR05MB6225;H:AM0PR05MB4978.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-microsoft-antispam-message-info: H5W4qf242pWTeXTrWnVllua6bywuUu3GB6mrnlBC55Ei16xIVR3u/YpCtkm4gaXQ1jayEag4qk10R28Ed/GgpbTiH1Y45bZwLde67KACtvfwTdYLENl7ajcMcDkX7tG1e2aP5dxjWP9tDRHPSQPEYZ3MFq5IdipqG0r+Mk+rVyJiFvJu1eIPr0yAn3B7QZ8EprImfvCPt7iBFJ1iWbHn7dOzKJlmvDa0aUkUshK054tqlyVVePDQ7r95FLajyQhdxpHNa3DZwwbubem5VCqOEN7Skg5fIcc0VWl07dAy4QAg9n24PUHAzw4CYm1yfLufWpaHkpDM1atRKidPXypEaq4Lm42IUnyb8+NPXGfyTx4= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: a3976fb2-2900-490d-22f2-08d64e39a355 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Nov 2018 16:11:18.3234 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB6225 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Petr Machata Test that when sending traffic to a learned MAC address, the traffic is forwarded accurately only to the right endpoint. Signed-off-by: Petr Machata Signed-off-by: Ido Schimmel --- .../net/forwarding/vxlan_bridge_1d.sh | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/tools/testing/selftests/net/forwarding/vxlan_bridge_1d.sh b/tools/testing/selftests/net/forwarding/vxlan_bridge_1d.sh index 1edd5189c41c..1a3486ec1d21 100755 --- a/tools/testing/selftests/net/forwarding/vxlan_bridge_1d.sh +++ b/tools/testing/selftests/net/forwarding/vxlan_bridge_1d.sh @@ -67,6 +67,7 @@ export VXPORT : ${ALL_TESTS:=" ping_ipv4 test_flood + test_unicast "} NUM_NETIFS=6 @@ -263,6 +264,10 @@ setup_prepare() vrp2_create ns1_create ns2_create + + r1_mac=$(in_ns ns1 mac_get w2) + r2_mac=$(in_ns ns2 mac_get w2) + h2_mac=$(mac_get $h2) } cleanup() @@ -394,6 +399,55 @@ test_flood() __test_flood de:ad:be:ef:13:37 192.0.2.100 "flood" } +vxlan_fdb_add_del() +{ + local add_del=$1; shift + local mac=$1; shift + local dev=$1; shift + local dst=$1; shift + + bridge fdb $add_del dev $dev $mac self static permanent \ + ${dst:+dst} $dst 2>/dev/null + bridge fdb $add_del dev $dev $mac master static 2>/dev/null +} + +__test_unicast() +{ + local mac=$1; shift + local dst=$1; shift + local hit_idx=$1; shift + local what=$1; shift + + RET=0 + + local -a expects=(0 0 0) + expects[$hit_idx]=10 + + vxlan_flood_test $mac $dst "${expects[@]}" + + log_test "VXLAN: $what" +} + +test_unicast() +{ + local -a targets=("$h2_mac $h2" + "$r1_mac vx1 192.0.2.34" + "$r2_mac vx1 192.0.2.50") + local target + + for target in "${targets[@]}"; do + vxlan_fdb_add_del add $target + done + + __test_unicast $h2_mac 192.0.2.2 0 "local MAC unicast" + __test_unicast $r1_mac 192.0.2.3 1 "remote MAC 1 unicast" + __test_unicast $r2_mac 192.0.2.4 2 "remote MAC 2 unicast" + + for target in "${targets[@]}"; do + vxlan_fdb_add_del del $target + done +} + test_all() { echo "Running tests with UDP port $VXPORT"