From patchwork Thu Jun 14 16:30:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10464873 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9288860348 for ; Thu, 14 Jun 2018 16:41:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8026D28C29 for ; Thu, 14 Jun 2018 16:41:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E70228C45; Thu, 14 Jun 2018 16:41:18 +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=-2.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, LOTS_OF_MONEY, MAILING_LIST_MULTI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 07ED928C42 for ; Thu, 14 Jun 2018 16:40:23 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4168Hd6v96zF0dY for ; Fri, 15 Jun 2018 02:30:37 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="rBOFU0u5"; dkim-atps=neutral X-Original-To: linux-mlxsw@lists.ozlabs.org Delivered-To: linux-mlxsw@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=mellanox.com (client-ip=104.47.0.80; helo=eur01-he1-obe.outbound.protection.outlook.com; envelope-from=petrm@mellanox.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="rBOFU0u5"; dkim-atps=neutral Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0080.outbound.protection.outlook.com [104.47.0.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4168HV1fHLzDrnp for ; Fri, 15 Jun 2018 02:30:30 +1000 (AEST) 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=pYe8O1MhALsDmsBJUBxkQu5k9Dv6ValMqRRZHC4+xQs=; b=rBOFU0u5VsLrE6XG6Q2XfPuoS2KzGJ4HhToIVbMAYNImvFcwzRMbkqsrmz0xEI/EWyRoU2IUZs3pkmo73CCdkb/AfweFDlaQ99JKQOk7/V2RqIZNQLxTgdn+919ALRzOCpYsTE3X11k/BJnEda+rbYM0IgAPzresJOGkYWKKYG8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (78.45.160.211) by VI1PR05MB4190.eurprd05.prod.outlook.com (2603:10a6:803:4e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.863.16; Thu, 14 Jun 2018 16:30:23 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v2 5/5] selftests: forwarding: Test mirror-to-gretap w/ UL team In-Reply-To: References: Message-Id: Date: Thu, 14 Jun 2018 18:30:18 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 X-Originating-IP: [78.45.160.211] X-ClientProxiedBy: LO2P265CA0159.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:9::27) To VI1PR05MB4190.eurprd05.prod.outlook.com (2603:10a6:803:4e::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d092bba3-2cde-4a38-6f04-08d5d214211f X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:VI1PR05MB4190; X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4190; 3:LuyHbzkKlsIYrplaEvtjwI+QLuEyNo/vm7TQj66ogcK5UYqxVOjIqvO09MyiVMTjf/bfdKwtR3whSs7CnFKZ3U5zdSyEKecBRM/v9J/VMcKWNDJm8bDWQkvyrtMHPFYqfwIqBb1u/HjxU6B97Zca68HY69l+VblR6KBQH6MhSll9X92tYWaSXkyiSziXdUDppwEDZD6ob0Szq8CwjMuM1v5wyr/ldp1O+b2hSkhSDYzST8l5kxoADhDVf87wOJaU; 25:R6ijP3prr45xR+g/+Wla5jcNgZkZxkg8CRunT0NkMIDLlpDkuUdUC7oLUYBk7OAIOolITZQTRIAbfqoAaHOXDffypJg17sTUFus6wN4iMrzF1fl2m8YSElQb5Votgii5UnbuVfCKnOodOwi8wMGTqP8czY3+L4GfDobmmeQEPKjqg8qUvaCckrPPLrJqpd6oKDY33IlFin64XYUWAUvMQOB4sI1cq7ulazXuz64z7OKus2zNbtB5s+tVBMBGAT3lKMJE6cZ+GVrky8k2W4veYQNAiQOVAOZ1KSc8CrDA3gcYVXfZUtIOxGceQDi68JR+3NOUdu33k/6PF2gKQZ6Law==; 31:lmYjlIY0ZWTcaoYRg6gClvjF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oft-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)(5005006)(8121501046)(3231254)(944501410)(52105095)(3002001)(10201501046)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(20161123564045)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:VI1PR05MB4190; BCL:0; PCL:0; RULEID:; SRVR:VI1PR05MB4190; X-Forefront-PRVS: 0703B549E4 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(39860400002)(376002)(39380400002)(396003)(346002)(199004)(189003)(118296001)(51416003)(86362001)(52116002)(68736007)(6666003)(5660300001)(37006003)(58126008)(48376002)(486006)(7736002)(305945005)(50466002)(446003)(11346002)(25786009)(956004)(2616005)(476003)(53936002)(16526019)(386003)(26005)(106356001)(186003)(105586002)(59450400001)(6636002)(36756003)(6116002)(3846002)(6486002)(316002)(81166006)(8676002)(6862004)(66066001)(97736004)(16586007)(2906002)(76176011)(2351001)(47776003)(478600001)(81156014)(8936002)(6496006); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB4190; H:t540p; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR05MB4190; 23:c6Q7QMxhtZesilAzn2IfqXEcVGr6ZL8D9rhfiB62f?= =?us-ascii?Q?Qb2u0XpiSX+d23vFglB4UeiXOO+peVwoIBFIaSTuF4PpE7NjPOoUQOCTeG0t?= =?us-ascii?Q?mm7shJYihfsEl8ZosG2lD3M6MBr6flHmlJlUkHRYCUw9l+NDx7P9jIjEhXoR?= =?us-ascii?Q?6KMZjh39146hvNKTZ70LP04bjQBg4rx8BOfeN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tpKcZIiBePtNn0mKTjZe9U4bKFbdICskPnNhH4LXeP0z8dHBp3jNmJEwj4Ed9izsn2QK3lymJOPRwNlC0=; 24:CLTf3ivAuoS1JUtRuemIRkRI5iVU7QbDVZGkEpu/UprfvFwxbsjywV7+3J1uF96u31VlY77IvIrgDJfHp6+u84ZYuWZ32qvQSqTfmaiHgZE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4190; 7:VN4947fHjzxEL54VfVz66ziRX1IMEz4RrBgEgZrtGphyFTOCcRNRyZAPjYxzTAI2iMaCkS9UVCql1k4Qzv2vvNZJZcTHFJB4QkXMlv6UO+gLNGw6T2DjvKCxzosAYNMTQO5VW6QI8vGkPhK0eWHjQF+FHeVlFrXEWDnCS977lMFExTGT0X8/r4IXCiaectcD3SdQi5R4WjKMj1ZJqvEGuQO/oitFz+YITEgUQZoX7BvEpWp+pcMqgrDt6r/ei+2J X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2018 16:30:23.6838 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d092bba3-2cde-4a38-6f04-08d5d214211f X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4190 X-BeenThere: linux-mlxsw@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: mlxsw driver development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-mlxsw-bounces+patchwork-linux-mlxsw=patchwork.kernel.org@lists.ozlabs.org X-Virus-Scanned: ClamAV using ClamSMTP Test for "tc action mirred egress mirror" that mirrors to gretap when the underlay route points at a VLAN-aware bridge (802.1q), and the traffic egresses the bridge through a LAG device. Test upping and downing individual team device slaves and verify the traffic flows as expected. Signed-off-by: Petr Machata --- Notes: Changes from v1 to v2: - Refer to arping as $ARPING, which require_command. .../net/forwarding/mirror_gre_bridge_1q_lag.sh | 248 +++++++++++++++++++++ 1 file changed, 248 insertions(+) create mode 100755 tools/testing/selftests/net/forwarding/mirror_gre_bridge_1q_lag.sh diff --git a/tools/testing/selftests/net/forwarding/mirror_gre_bridge_1q_lag.sh b/tools/testing/selftests/net/forwarding/mirror_gre_bridge_1q_lag.sh new file mode 100755 index 000000000000..3251fb694c47 --- /dev/null +++ b/tools/testing/selftests/net/forwarding/mirror_gre_bridge_1q_lag.sh @@ -0,0 +1,248 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +# This test uses standard topology for testing gretap. See +# mirror_gre_topo_lib.sh for more details. +# +# Test for "tc action mirred egress mirror" when the underlay route points at a +# bridge device with vlan filtering (802.1q), and the egress device is a LAG +# (bond or team) device. + +ALL_TESTS=" + test_mirror_gretap_first + test_mirror_gretap_second +" + +NUM_NETIFS=6 +source lib.sh +source mirror_lib.sh +source mirror_gre_lib.sh +source mirror_gre_topo_lib.sh + +require_command $ARPING + +vlan_host_create() +{ + local if_name=$1; shift + local vid=$1; shift + local vrf_name=$1; shift + local ips=("${@}") + + vrf_create $vrf_name + ip link set dev $vrf_name up + vlan_create $if_name $vid $vrf_name "${ips[@]}" +} + +vlan_host_destroy() +{ + local if_name=$1; shift + local vid=$1; shift + local vrf_name=$1; shift + + vlan_destroy $if_name $vid + ip link set dev $vrf_name down + vrf_destroy $vrf_name +} + +h1_create() +{ + vlan_host_create $h1 333 vrf-h1 192.0.2.1/28 + ip -4 route add 192.0.2.16/28 vrf vrf-h1 nexthop via 192.0.2.2 +} + +h1_destroy() +{ + ip -4 route del 192.0.2.16/28 vrf vrf-h1 + vlan_host_destroy $h1 333 vrf-h1 +} + +h2_create() +{ + vlan_host_create $h1 555 vrf-h2 192.0.2.18/28 + ip -4 route add 192.0.2.0/28 vrf vrf-h2 nexthop via 192.0.2.17 +} + +h2_destroy() +{ + ip -4 route del 192.0.2.0/28 vrf vrf-h2 + vlan_host_destroy $h1 555 vrf-h2 +} + +h3_create() +{ + simple_if_init $h3 192.0.2.130/28 + tc qdisc add dev $h3 clsact +} + +h3_destroy() +{ + tc qdisc del dev $h3 clsact + simple_if_fini $h3 192.0.2.130/28 +} + +h4_create() +{ + simple_if_init $h4 192.0.2.130/28 + tc qdisc add dev $h4 clsact +} + +h4_destroy() +{ + tc qdisc del dev $h4 clsact + simple_if_fini $h4 192.0.2.130/28 +} + +switch_create() +{ + ip link set dev $swp1 up + tc qdisc add dev $swp1 clsact + vlan_create $swp1 333 "" 192.0.2.2/28 + vlan_create $swp1 555 "" 192.0.2.17/28 + + tunnel_create gt4 gretap 192.0.2.129 192.0.2.130 \ + ttl 100 tos inherit + + ip link set dev $swp3 up + ip link set dev $swp4 up + + ip link add name br1 type bridge vlan_filtering 1 + ip link set dev br1 up + __addr_add_del br1 add 192.0.2.129/32 + ip -4 route add 192.0.2.130/32 dev br1 + + team_create lag loadbalance $swp3 $swp4 + ip link set dev lag master br1 +} + +switch_destroy() +{ + ip link set dev lag nomaster + team_destroy lag + + ip -4 route del 192.0.2.130/32 dev br1 + __addr_add_del br1 del 192.0.2.129/32 + ip link set dev br1 down + ip link del dev br1 + + ip link set dev $swp4 down + ip link set dev $swp3 down + + tunnel_destroy gt4 + + vlan_destroy $swp1 555 + vlan_destroy $swp1 333 + tc qdisc del dev $swp1 clsact + ip link set dev $swp1 down +} + +setup_prepare() +{ + h1=${NETIFS[p1]} + swp1=${NETIFS[p2]} + + swp3=${NETIFS[p3]} + h3=${NETIFS[p4]} + + swp4=${NETIFS[p5]} + h4=${NETIFS[p6]} + + vrf_prepare + + ip link set dev $h1 up + h1_create + h2_create + h3_create + h4_create + switch_create + + trap_install $h3 ingress + trap_install $h4 ingress +} + +cleanup() +{ + pre_cleanup + + trap_uninstall $h4 ingress + trap_uninstall $h3 ingress + + switch_destroy + h4_destroy + h3_destroy + h2_destroy + h1_destroy + ip link set dev $h1 down + + vrf_cleanup +} + +test_lag_slave() +{ + local host_dev=$1; shift + local up_dev=$1; shift + local down_dev=$1; shift + local what=$1; shift + + RET=0 + + mirror_install $swp1 ingress gt4 \ + "proto 802.1q flower vlan_id 333 $tcflags" + + # Test connectivity through $up_dev when $down_dev is set down. + ip link set dev $down_dev down + setup_wait_dev $up_dev + setup_wait_dev $host_dev + $ARPING -I br1 192.0.2.130 -qfc 1 + sleep 2 + mirror_test vrf-h1 192.0.2.1 192.0.2.18 $host_dev 1 10 + + # Test lack of connectivity when both slaves are down. + ip link set dev $up_dev down + sleep 2 + mirror_test vrf-h1 192.0.2.1 192.0.2.18 $h3 1 0 + mirror_test vrf-h1 192.0.2.1 192.0.2.18 $h4 1 0 + + ip link set dev $up_dev up + ip link set dev $down_dev up + mirror_uninstall $swp1 ingress + + log_test "$what ($tcflags)" +} + +test_mirror_gretap_first() +{ + test_lag_slave $h3 $swp3 $swp4 "mirror to gretap: LAG first slave" +} + +test_mirror_gretap_second() +{ + test_lag_slave $h4 $swp4 $swp3 "mirror to gretap: LAG second slave" +} + +test_all() +{ + slow_path_trap_install $swp1 ingress + slow_path_trap_install $swp1 egress + + tests_run + + slow_path_trap_uninstall $swp1 egress + slow_path_trap_uninstall $swp1 ingress +} + +trap cleanup EXIT + +setup_prepare +setup_wait + +tcflags="skip_hw" +test_all + +if ! tc_offload_check; then + echo "WARN: Could not test offloaded functionality" +else + tcflags="skip_sw" + test_all +fi + +exit $EXIT_STATUS