From patchwork Fri Apr 27 23:01:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10369991 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 8271B601BE for ; Fri, 27 Apr 2018 23:02:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A589294E4 for ; Fri, 27 Apr 2018 23:02:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C1952952E; Fri, 27 Apr 2018 23:02:21 +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 855B8294E4 for ; Fri, 27 Apr 2018 23:02:20 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40XqFk6dfszF25c for ; Sat, 28 Apr 2018 09:02:18 +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="BYC4zCIG"; 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=40.107.4.51; helo=eur03-db5-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="BYC4zCIG"; dkim-atps=neutral Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40051.outbound.protection.outlook.com [40.107.4.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40XqFd1s7nzF24m for ; Sat, 28 Apr 2018 09:02:12 +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=L2ZkdZ0+7ofx7lhJLMlHRXND+NRYYFcKS0dtMCZoOKg=; b=BYC4zCIGnM4uGEbTF6hPgJI7FQZeuJQf+LIRpUqAyR0VXAzjd8QcORYzwLWzMmJdvUvHTqb7b/FLMIsjbwDNL8mdf+u6jtFskOEVkabl4EQpnIF7ORfRiJODxbgTQCSAOI0pl0oL465/5iulYsw0SJQqPR421y4S9eyzuXbSF3M= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (89.176.83.59) by VI1PR05MB4191.eurprd05.prod.outlook.com (2603:10a6:803:4e::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.696.15; Fri, 27 Apr 2018 23:02:05 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v3 6/6] mlxsw: spectrum_span: Allow bridge for gretap mirror In-Reply-To: References: Message-Id: Date: Sat, 28 Apr 2018 01:01:27 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 X-Originating-IP: [89.176.83.59] X-ClientProxiedBy: VI1P189CA0031.EURP189.PROD.OUTLOOK.COM (2603:10a6:802:2a::44) To VI1PR05MB4191.eurprd05.prod.outlook.com (2603:10a6:803:4e::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(2017052603328)(7153060)(7193020); SRVR:VI1PR05MB4191; X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4191; 3:QNW97NGLseo0vUvldjHau/os0MCRgJh37cet+OkLfmudxV1XIl4RbwuyevYXAIiakm503kHfOkV1EQiKrjP6xHOWWANprZYhnJZYj2DFOSAe6fvoNJvwU0rPPlrEirUnCQ0oyyAP8y3M2T+h8ax1p1xoV0jKJd9HkOEsNF6VZgjgVFq3cSseTXogOWTESJIfrPplmn+LtNjtqkhDlwuToLoTsELb80jv1bq4PGU1K6+5vrFR2HYUTLQ73ApRIA+J; 25:4T4PxP4bH7ULqI/XNMQi1MWo4eOXE6jhxJl/1Np4KDGSKv9YjQWFjQBCz0DR3M8/Gf7BiFHBFXadU3UgXNS+0YoLUwrvAGMbza8Kk9Xf1OPPrpYw00SaYVV7bcRIUxa/LgqTtOEOJcR+F2ntgbU0WwB5ub/FqnLCVZ826HxkiJMkrwcpYLPtLihSgoS/F+Cp4PJpAN4ZuQQMwXxIn7NORSCYU8dvfdV/mT4If045D9MXYzbNvotgaGURdSXS8jnu4eacqB4r/llMox51SDaSHSbD8urRPWTRwqVBiG4HYbm0c42agnRjPzIBHCJEIOjvw2W4crXg8QPaLUe7tzBsvQ==; 31:TlplUzxnaohXYDcsTfzS2gkXte1Xlio4cvTr+osHmDKNNupAnUHhUjGGmylCEymRziPhJA9mCqkGvAtQdlDuhd0XUYybCvGiiu5Qj1S64liXRWDKJZwjshjam307XQQoewc0NAyq2+NlPf92lRAW97bf67+V52H38o73Dd4Ufd1Y8l3T8xtu3OSGht2gniV+9AyjAcSd8MCB1izgz4B3lMRe1ZPuDyEWtw3fmFYSPPo= X-MS-TrafficTypeDiagnostic: VI1PR05MB4191: X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4191; 20:PkhC1qg5/9unjExotx39lnkpCecN+74ss7MBOHGLyneYkuUBE5MhFyJFltadB1FkgAIBGo0FyA15SvOh5OTCAl8bpU8hw98tJh5O9HNoF0k6VLFxWgJv8jQmDdkxLgyKOm4X3Pz1l/IgJABVZfImddkW+SJJo/1GjGonwHmADZj/R9H+dabHksCnMWRSTNVGMnM4XVZTr3V+JUp8JayKIlJ7h7rAZofcrA1AfWVMY4zJzLpJ8dFGwrj4BKHeD2R42oF+qYwzSWxONKRN/COxSwfWEyE4Rb2S4M0jwwfTlFiH4aQLseLPyzIAU0CHgkIV45EMlKKZWaGnHyvoSF0vDwcrMKdRoJyQmM8si8oiSPqLNnJY0LNYr+chYU4oSIpe8D1yI+YrkMmeK9AF6Nea3xd0jjn5ZaPWmR2rzrftwSrjjXxZuYcPgwgkz0jAmP/V7k2DV8zs4lX8BVNWXyoyV6OLjtIGXesIVFQ1Kpy4v7ygiY6sja3mxtFWHIOiM8T8; 4:KMdCMTmUGkmMoQ9oPzvJcfJQEQj3JNigRkdGQtF4H9TAxm5w6wmdR/n5t8zSChqUDjB67JTEOUgllB74VhMiyQQARsVK64m5xPPkLTbpPKtwnYdol2z24qze1d36PlhjUjNt+JvMSpt/sovAFpn03OTqaxmUY/gzBvQby38AM2MQ5FZQeG2aSnX+LNrh8Os/CglyP5SZds6X8F97YNlRke786B7105pws5BsD2p/FlBxO0vJWiTezHhAsuQwcvtwrTjYHpOwUTI9x44QdDoEFw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3231243)(944501410)(52105095)(3002001)(6055026)(6041310)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(6072148)(201708071742011); SRVR:VI1PR05MB4191; BCL:0; PCL:0; RULEID:; SRVR:VI1PR05MB4191; X-Forefront-PRVS: 0655F9F006 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(39860400002)(39380400002)(396003)(346002)(366004)(189003)(199004)(476003)(2616005)(5660300001)(6486002)(53936002)(66066001)(486006)(86362001)(97736004)(6916009)(305945005)(26005)(48376002)(105586002)(107886003)(6666003)(50466002)(106356001)(956004)(11346002)(6496006)(446003)(16586007)(2351001)(478600001)(2906002)(4326008)(6116002)(25786009)(51416003)(8936002)(81156014)(36756003)(68736007)(8676002)(118296001)(58126008)(81166006)(386003)(316002)(52116002)(47776003)(7736002)(76176011)(3846002)(16526019)(309714004); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB4191; H:t540p; 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-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR05MB4191; 23:gh+TZ+XazM3favm0HPJ+b6qpH6uZsVEIm2iz5D1ai?= =?us-ascii?Q?sMijj1OCWkV7O8+5ncA8MzZa6YAIeHSCVRdnXWJf7QSNjJUp+tBUbY1VUzwP?= =?us-ascii?Q?LHb1V20bmmtRK0mjm+5U3vYCXpyASmHXKJjRlu+y2Ie1LWbI3Iuj6hUZmAQe?= =?us-ascii?Q?KiDp3MVeSzz9CO/39eIjS5wnB+rpzo8PUry3O09Y76ZlXIb+jXKm7tfW6WOt?= =?us-ascii?Q?qSJWYY2fN51DILSMOmav4vKrrUsE7pkmS7f6Ij7JPzJRGsawJujTuoAw348A?= =?us-ascii?Q?GeCerIDPHE9EotbJ9f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N9eO0DK1t3BdMNQZlLCbJOlI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4191; 7:9mjQi2TkV16PVx7hP4Mi9UySNCuRDLvrzgueXHZkZKT1sRUAHjJPa4P9FMmgjhGJSGxB4B5Ey8YkJuy91Gah+YJ5t3mpW9zAWv4h8xY3czAtmVBJmDkQQuCvnb37enTXNHjn/HyI9Vz4fYSTilKXoT+zgxTsvdf8LaoAbHqx2qAEnO85Q3QHRT+iCLRUvgy6nKzI4ltiyRMNOAvFi34066JjgYSeFXC4zgS0lNPA3e5NW8QfgWzM9vjulDEoMPR1 X-MS-Office365-Filtering-Correlation-Id: cfabc6f0-f9c6-4080-cf69-08d5ac92e58f X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Apr 2018 23:02:05.8465 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cfabc6f0-f9c6-4080-cf69-08d5ac92e58f X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4191 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 Sender: "Linux-mlxsw" X-Virus-Scanned: ClamAV using ClamSMTP When handling mirroring to a gretap or ip6gretap netdevice in mlxsw, the underlay address (i.e. the remote address of the tunnel) may be routed to a bridge. In that case, look up the resolved neighbor Ethernet address in that bridge's FDB. Then configure the offload to direct the mirrored traffic to that port, possibly with tagging. Signed-off-by: Petr Machata --- .../net/ethernet/mellanox/mlxsw/spectrum_span.c | 95 ++++++++++++++++++++-- .../net/ethernet/mellanox/mlxsw/spectrum_span.h | 1 + 2 files changed, 90 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c index 65a7770..cd9071e 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c @@ -32,6 +32,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#include #include #include #include @@ -39,8 +40,9 @@ #include #include "spectrum.h" -#include "spectrum_span.h" #include "spectrum_ipip.h" +#include "spectrum_span.h" +#include "spectrum_switchdev.h" int mlxsw_sp_span_init(struct mlxsw_sp *mlxsw_sp) { @@ -167,6 +169,72 @@ mlxsw_sp_span_entry_unoffloadable(struct mlxsw_sp_span_parms *sparmsp) return 0; } +static struct net_device * +mlxsw_sp_span_entry_bridge_8021q(const struct net_device *br_dev, + unsigned char *dmac, + u16 *p_vid) +{ + struct bridge_vlan_info vinfo; + struct net_device *edev; + u16 pvid; + + if (WARN_ON(br_vlan_get_pvid(br_dev, &pvid))) + return NULL; + if (!pvid) + return NULL; + + edev = br_fdb_find_port(br_dev, dmac, pvid); + if (!edev) + return NULL; + + if (br_vlan_get_info(edev, pvid, &vinfo)) + return NULL; + if (!(vinfo.flags & BRIDGE_VLAN_INFO_UNTAGGED)) + *p_vid = pvid; + return edev; +} + +static struct net_device * +mlxsw_sp_span_entry_bridge_8021d(const struct net_device *br_dev, + unsigned char *dmac) +{ + return br_fdb_find_port(br_dev, dmac, 0); +} + +static struct net_device * +mlxsw_sp_span_entry_bridge(const struct net_device *br_dev, + unsigned char dmac[ETH_ALEN], + u16 *p_vid) +{ + struct mlxsw_sp_bridge_port *bridge_port; + enum mlxsw_reg_spms_state spms_state; + 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 + dev = mlxsw_sp_span_entry_bridge_8021d(br_dev, dmac); + if (!dev) + return NULL; + + port = mlxsw_sp_port_dev_lower_find(dev); + if (!port) + return NULL; + + bridge_port = mlxsw_sp_bridge_port_find(port->mlxsw_sp->bridge, dev); + if (!bridge_port) + return NULL; + + stp_state = mlxsw_sp_bridge_port_stp_state(bridge_port); + spms_state = mlxsw_sp_stp_spms_state(stp_state); + if (spms_state != MLXSW_REG_SPMS_STATE_FORWARDING) + return NULL; + + return dev; +} + static __maybe_unused int mlxsw_sp_span_entry_tunnel_parms_common(struct net_device *l3edev, union mlxsw_sp_l3addr saddr, @@ -177,13 +245,22 @@ mlxsw_sp_span_entry_tunnel_parms_common(struct net_device *l3edev, struct mlxsw_sp_span_parms *sparmsp) { unsigned char dmac[ETH_ALEN]; + u16 vid = 0; if (mlxsw_sp_l3addr_is_zero(gw)) gw = daddr; - if (!l3edev || !mlxsw_sp_port_dev_check(l3edev) || - mlxsw_sp_span_dmac(tbl, &gw, l3edev, dmac)) - return mlxsw_sp_span_entry_unoffloadable(sparmsp); + if (!l3edev || mlxsw_sp_span_dmac(tbl, &gw, l3edev, dmac)) + goto unoffloadable; + + if (netif_is_bridge_master(l3edev)) { + l3edev = mlxsw_sp_span_entry_bridge(l3edev, dmac, &vid); + if (!l3edev) + goto unoffloadable; + } + + if (!mlxsw_sp_port_dev_check(l3edev)) + goto unoffloadable; sparmsp->dest_port = netdev_priv(l3edev); sparmsp->ttl = ttl; @@ -191,7 +268,11 @@ mlxsw_sp_span_entry_tunnel_parms_common(struct net_device *l3edev, memcpy(sparmsp->smac, l3edev->dev_addr, ETH_ALEN); sparmsp->saddr = saddr; sparmsp->daddr = daddr; + sparmsp->vid = vid; return 0; + +unoffloadable: + return mlxsw_sp_span_entry_unoffloadable(sparmsp); } #if IS_ENABLED(CONFIG_NET_IPGRE) @@ -268,9 +349,10 @@ mlxsw_sp_span_entry_gretap4_configure(struct mlxsw_sp_span_entry *span_entry, /* Create a new port analayzer entry for local_port. */ mlxsw_reg_mpat_pack(mpat_pl, pa_id, local_port, true, MLXSW_REG_MPAT_SPAN_TYPE_REMOTE_ETH_L3); + mlxsw_reg_mpat_eth_rspan_pack(mpat_pl, sparms.vid); mlxsw_reg_mpat_eth_rspan_l2_pack(mpat_pl, MLXSW_REG_MPAT_ETH_RSPAN_VERSION_NO_HEADER, - sparms.dmac, false); + sparms.dmac, !!sparms.vid); mlxsw_reg_mpat_eth_rspan_l3_ipv4_pack(mpat_pl, sparms.ttl, sparms.smac, be32_to_cpu(sparms.saddr.addr4), @@ -368,9 +450,10 @@ mlxsw_sp_span_entry_gretap6_configure(struct mlxsw_sp_span_entry *span_entry, /* Create a new port analayzer entry for local_port. */ mlxsw_reg_mpat_pack(mpat_pl, pa_id, local_port, true, MLXSW_REG_MPAT_SPAN_TYPE_REMOTE_ETH_L3); + mlxsw_reg_mpat_eth_rspan_pack(mpat_pl, sparms.vid); mlxsw_reg_mpat_eth_rspan_l2_pack(mpat_pl, MLXSW_REG_MPAT_ETH_RSPAN_VERSION_NO_HEADER, - sparms.dmac, false); + sparms.dmac, !!sparms.vid); mlxsw_reg_mpat_eth_rspan_l3_ipv6_pack(mpat_pl, sparms.ttl, sparms.smac, sparms.saddr.addr6, sparms.daddr.addr6); diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.h index 4b87ec2..14a6de9 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.h +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.h @@ -63,6 +63,7 @@ struct mlxsw_sp_span_parms { unsigned char smac[ETH_ALEN]; union mlxsw_sp_l3addr daddr; union mlxsw_sp_l3addr saddr; + u16 vid; }; struct mlxsw_sp_span_entry_ops;