From patchwork Mon May 7 14:29:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10384249 X-Patchwork-Delegate: idosch@idosch.org 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 648D56037F for ; Mon, 7 May 2018 14:32:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5048C28C76 for ; Mon, 7 May 2018 14:32:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4DAD428C04; Mon, 7 May 2018 14:32:51 +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, 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 6AB2028CEF for ; Mon, 7 May 2018 14:31:18 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40flRS4370zF1gK for ; Tue, 8 May 2018 00:31:16 +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="srtwEGVG"; 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.65; 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="srtwEGVG"; dkim-atps=neutral Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0065.outbound.protection.outlook.com [104.47.0.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40flPr1q64zF1RC for ; Tue, 8 May 2018 00:29:51 +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; bh=4vFiHTUJr3ZuD7hRX3kt8xmPXUaAC7HfC0IJGcS0p0w=; b=srtwEGVGnTWlnYjTGCShoLBK6brKFU2gtL0MtGzVK7DYUQxohAjjorofEuSrl//MRBM8S9G0yvf2aUNnXHBPSCkOq4I5PVbkrzwX9C1UDB+7vhnYOvq/AEiEUCSjLwT2HeCcFukAcrjyvpyoob2QOqqYVauT1nx00ImF9SAld+Y= Received: from t540p (78.45.160.211) by AM0PR05MB4177.eurprd05.prod.outlook.com (2603:10a6:208:57::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.735.17; Mon, 7 May 2018 14:29:44 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw 3/3] mlxsw: spectrum_span: Support VLAN under mirror-to-gretap In-Reply-To: References: Message-Id: Date: Mon, 07 May 2018 16:29:39 +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: LNXP265CA0040.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:5c::28) To AM0PR05MB4177.eurprd05.prod.outlook.com (2603:10a6:208:57::26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(48565401081)(2017052603328)(7153060)(7193020); SRVR:AM0PR05MB4177; X-Microsoft-Exchange-Diagnostics: 1; AM0PR05MB4177; 3:HgMqeYvQ0W7uaLdqDRqnGrREOf3OG3dhQXQKYkaawEGWRQQB+1q5EOHhdVtZ6uWPbdd2FWq/qcH3IKob5c0lo6OzKsi9GiwSBaRr9wOoAfuDPK2VAS/Wpm0SNoblYHmKjmw++kuzqYSEol9b1ihYfp8jJPqyXgfFAKVtRipj1hFs6KXqxWmgpb/IyAriWsaOEdAJp8UBREu9VesXxcKLnuvT3EbrhU5dllcyVU3sO+taxvzWfE+6hilkijO9DtQH; 25:BvXIFpXS5C8VDB6pRmabSaUZ2fwy0N/OSTCuM1P2OhLS03wQz8jF0eRWBDtl5SNq15WFXMyh6OHoeLlGGZzEDQEmklULbkFx1Jh4DItxvvYjL3tfihPWmThp0AeWJfo/l0RfCSI9Mdn9mJSrDpngj3MsPOmJMbGi2GkEWQsVhczAuAyoVW4M4/GmrbaIf7Tp9UZBMBXIhhzKPmiRvw7piNvDbTIeYbUnpNG7FpSSNNB7WOLJ7w+jdNXJKPbepAJ5nhePLz0fR7EmHZCJyZPZ6urWPpsopwRLE/9tK3d2J8LQ2SrQAI9YeuBTPWaiCIOt8ITW8JgoK2y8BWu9ZTNoNg==; 31:uoGsnGHilGDQfX/ty8ffl7FE6n2PUsUD2mm8NASy0l7Wyp4lnY7jy44IQXqcGUmGbPBiBr6vE5rZkVO9UEyAMNcWxZa+1CVZcBWVTvAI2Iur/RwiuyEhVkm49qVd0DCCXHXRd8RXJVMud638j3VMPheYE7kSC0NOUay87X0AwNbm+dyS+tzhwWnUDeAPqafSl7zYl39xMAbb9EEqQ0xJ8c22CVjO8gBMrFCsk6pGilQ= X-MS-TrafficTypeDiagnostic: AM0PR05MB4177: X-Microsoft-Exchange-Diagnostics: 1; AM0PR05MB4177; 20:if/NkcoWTGiThICGT6e6t8JdJuQD2dwcV/2SMh1A3TNlFln1B/0PZZK471RxrONkACphnhj6mUr7gqOLHVG5ooX0/vENU6HKheVgE0ZEBWXjNWyjQDKkoQcokVY/b5WKQWsChO8Zad0agDD8ZhpG7x9GfcCk8M+vZ84FResk25DqHBJumYebguRbME1R/1ilajfxlq1oWi1P435pIU/n+TdmpxNDZ6UEXLmbFrVhi8RUEximEiTa7X5hozpV0IHXXtlu3mxelBf1Ctj2siMqSJC0LMx6FT6XyhYqO9HtZRuMvGCD4axm8fumxi9gdWdjC47XrDqMQH9OX8Z9oiHvY2DwnGTsFgtaMqdb0jWC8ULQnCenFoYFdx6OHflw7zZkDd565E6DtbX4U7Lj4DxrDeZGnR7/hJfsVvBcfVyzXTSsb03elYDLmH2O9xcq19b43Ze7g5MCwBS/B8LU9tXzQ/gJUWR3kfBt8jYyyP6ij8DNnhnGd8wqo46QAOD838F6; 4:xQ5BdkSY0qv8vHIMH1kU52nOlej44ITl9Ov1UYT/hqwiGOnRz1I6F6p7+m8N+JQSX7cXKvcWGM7loOy04Tp/1nsqoxCQqiw8Ms6pvdVGoI2GwA/RRgZ66R349hNPvRbxuR0yRn4gAufmPVXf7q6IPPjg/SURMCcvsBaL157HTYKkurfgjUvNfiAaaPfc3p0uUR2NyP2636NYutjHCo7THUYR/4msEeAnLAtoWtyMwoOaY0xpjFmXsLya67mVWrXaZCHgpRXS16pCFqErJA6D7w== 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)(5005006)(8121501046)(3231254)(944501410)(52105095)(3002001)(10201501046)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(6072148)(201708071742011); SRVR:AM0PR05MB4177; BCL:0; PCL:0; RULEID:; SRVR:AM0PR05MB4177; X-Forefront-PRVS: 066517B35B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(376002)(346002)(366004)(396003)(39380400002)(199004)(189003)(47776003)(478600001)(53936002)(5660300001)(86362001)(107886003)(97736004)(6346003)(16586007)(6116002)(105586002)(3846002)(106356001)(4326008)(26005)(51416003)(52116002)(76176011)(6496006)(2906002)(25786009)(386003)(58126008)(16526019)(66066001)(316002)(2616005)(50466002)(7736002)(6666003)(305945005)(6486002)(8676002)(81166006)(8936002)(36756003)(81156014)(476003)(956004)(486006)(118296001)(446003)(11346002)(2351001)(6916009)(68736007)(48376002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR05MB4177; 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) Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM0PR05MB4177; 23:jx8/+6cwHxzxguHR/gFKpS8/7hG58eg40RHcr9X7h?= =?us-ascii?Q?2sRbz7C7Cn0axGUDSEfXz4RTfFgaIoFUcQSBari3zH3/yVz0J3uYMHxGtEMI?= =?us-ascii?Q?K1Azad8ktw2kzZxTGidTnidIAfzlmzCkZBYcfyYl5jvJKBMf5TFFXgI0GK/D?= =?us-ascii?Q?sIGoHw0JnYYh0MOKXy1KYkahWmSMIhjGAX9LMkmgUTf3u4bATIg+0EPn05Up?= =?us-ascii?Q?HQS6wpwoNPkVD4v/eUx1GIkOvqllizELuYd/cC6RcJqdIBD3y1asQXGH7ZqT?= =?us-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INxCCpaM+yHCAyLQjUBsqPVfsVO04fpcJb3QCDV9rITLiCdgYzWJI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM0PR05MB4177; 7:tIPjqVwQOHlA+71C1+deLRlDusdNqaTMgUgY0rLlTpTHUdXwFpM9Kb6f+mcJjlzwABcCwb85WhxZbZI7vNHivIzVZhWk3S7RI8hqJBWTkzfzcGv1WvwueNglC+pB7bCgRaVdAqRKvqCbvEgikUN6uanokYCT9gFmtHonbdZ6nAA7LEfocElyLG4mYQKsccUhlS+lKXO/vanO1bcRIpp5CYZvAl+LLCy7opJLzODyf6L6Dyb8vaMRuP765FOkAgrq X-MS-Office365-Filtering-Correlation-Id: ebb2e321-63fc-42c8-0c60-08d5b426faa9 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2018 14:29:44.7745 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ebb2e321-63fc-42c8-0c60-08d5b426faa9 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB4177 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: , Cc: linux-internal@mellanox.com Errors-To: linux-mlxsw-bounces+patchwork-linux-mlxsw=patchwork.kernel.org@lists.ozlabs.org X-Virus-Scanned: ClamAV using ClamSMTP When mirroring to a gretap or ip6gretap device, allow the underlay packet path to include VLAN devices. The following configurations are supported in underlay: - vlan over phys - vlan-unaware bridge where the egress device is vlan over phys - vlan over vlan-aware bridge where the egress device is phys Signed-off-by: Petr Machata --- drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c index f6b3ca9..ac70a71 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c @@ -176,9 +176,9 @@ mlxsw_sp_span_entry_bridge_8021q(const struct net_device *br_dev, { struct bridge_vlan_info vinfo; struct net_device *edev; - u16 pvid; + u16 pvid = *p_vid; - if (WARN_ON(br_vlan_get_pvid(br_dev, &pvid))) + if (!pvid && WARN_ON(br_vlan_get_pvid(br_dev, &pvid))) return NULL; if (!pvid) return NULL; @@ -208,13 +208,13 @@ mlxsw_sp_span_entry_bridge(const struct net_device *br_dev, { struct mlxsw_sp_bridge_port *bridge_port; enum mlxsw_reg_spms_state spms_state; + struct net_device *dev = NULL; struct mlxsw_sp_port *port; - struct net_device *dev; u8 stp_state; if (br_vlan_enabled(br_dev)) dev = mlxsw_sp_span_entry_bridge_8021q(br_dev, dmac, p_vid); - else + else if (!*p_vid) dev = mlxsw_sp_span_entry_bridge_8021d(br_dev, dmac); if (!dev) return NULL; @@ -261,12 +261,21 @@ mlxsw_sp_span_entry_tunnel_parms_common(struct net_device *l3edev, if (!l3edev || mlxsw_sp_span_dmac(tbl, &gw, l3edev, dmac)) goto unoffloadable; + if (is_vlan_dev(l3edev)) + l3edev = mlxsw_sp_span_entry_vlan(l3edev, &vid); + if (netif_is_bridge_master(l3edev)) { l3edev = mlxsw_sp_span_entry_bridge(l3edev, dmac, &vid); if (!l3edev) goto unoffloadable; } + if (is_vlan_dev(l3edev)) { + if (vid || !(l3edev->flags & IFF_UP)) + goto unoffloadable; + l3edev = mlxsw_sp_span_entry_vlan(l3edev, &vid); + } + if (!mlxsw_sp_port_dev_check(l3edev)) goto unoffloadable;