From patchwork Thu Apr 26 16:32:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10366381 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 3736C60225 for ; Thu, 26 Apr 2018 16:33:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 284E8286F6 for ; Thu, 26 Apr 2018 16:33:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1D1752872C; Thu, 26 Apr 2018 16:33:36 +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 138C828FE5 for ; Thu, 26 Apr 2018 16:33:19 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40X2gK3ls8zF255 for ; Fri, 27 Apr 2018 02:33:17 +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="Y+cJ1Ay2"; 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.54; 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="Y+cJ1Ay2"; dkim-atps=neutral Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0054.outbound.protection.outlook.com [104.47.0.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40X2gF4X8szF259 for ; Fri, 27 Apr 2018 02:33:13 +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=cWKn+g1/GXbBW6dutYFvhhOcOiKAzG1Rjr975Ns8QV8=; b=Y+cJ1Ay2NPkeP1ysWWEm/CminWRa7mpSUvuztsUcv0/4fdLQJqu2AP8m0e+rTfb38VqCBbH2hMJxfUdySIeME8VcIKn2eK4DQHXbcixKo2i+G6qLBaHH7DJ4AquMJzYB8ARyhYg9gAkfaFfsu+P30tg16rjB2Xg/HyBCNXypbAI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (78.45.160.211) by DB7PR05MB4185.eurprd05.prod.outlook.com (2603:10a6:5:18::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.715.18; Thu, 26 Apr 2018 16:33:05 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v2 6/6] mlxsw: spectrum_span: Allow bridge for gretap mirror In-Reply-To: References: Message-Id: <3c50926c24fade0ce8b24a543c65ed5583299ce9.1524759641.git.petrm@mellanox.com> Date: Thu, 26 Apr 2018 18:32:59 +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: HE1PR05CA0381.eurprd05.prod.outlook.com (2603:10a6:7:94::40) To DB7PR05MB4185.eurprd05.prod.outlook.com (2603:10a6:5:18::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:DB7PR05MB4185; X-Microsoft-Exchange-Diagnostics: 1; DB7PR05MB4185; 3:b6ghpWWUldOMnCK1osazLpTstqiCE5145bOWl1fb2wU91oMjep/cDAGSEx+N6OFXGbhciZXJ9snQZiMob4jAr9P4rOvJk+ztYa6wA9ewV5WJJhVujhsncfA4FUn3UIRgTUEOBCEXvfkUKqNoshSf94ZCY/fk/Jax0lXlw53UaEaosXv/4GhSib1gLvsG+zq4dx/6dgMcNw/xoa8qS++wzQF47eZTZTmmD0eotN7BfJIECNu8oQGfFNeuT6qjaGuN; 25:p5ckuIhKLCeiN1ntb3s9+5Qz5/r5ZJuLYUSxOpfsmy1d4guBxZ9LMxGvVG7VBNluWs0JqPuPthgeca4g9tjY76RcnBOxs7GELMxOsrtKR07yecF3sJJx1n7mcc0yplQ8i86+R/3uiuNIDpJC1BNCFUPU2lNDZ7/EBZrbsuzzvKA2szoAE/CGdWcXVvtshMyKS6NcApNMXM7xOyrJl2PfyejF6oo+oNUiRmHBtm1FVpXQeVUK/cTsorLyHpiKSx1Dui7ioIBrz7BscxUgFqm29URGRVqYLT0ipLPMqbq8qSF8ltagzycTbQyYpqSU18C5bXtOCZLOION9loglSiIVTg==; 31:N2GSRZwrfcm1RfwyuhaRAYYTIvNpV8UuVDNliNji/aknXw8zeG1j202TfxJ2aFwQLs9+kIXL7jrdyqq2FyyAzV0+uxNUc3BRmk1+JLLGekIrHSLvtKE5O4NZdcHRN8hU3647dQynJaIbayV0jD3v6FlNqIhXimAZNtTG9ueT0giMsFT95LwptqC7zSjCjZF2J09xMZovzk0fZ2sYZCd7mOSpJHg09wsSmoXMev+raOc= X-MS-TrafficTypeDiagnostic: DB7PR05MB4185: X-Microsoft-Exchange-Diagnostics: 1; DB7PR05MB4185; 20:megIy+EysJdAAIGCDvjbIeL2CYEU80hKEhbp6YQEe/v9XhwcfXkt/pW4ExZam39ox7+GJTUY3bj9sTLlENkQ9/4vN1hVB83mCXt63zgt0y4G0PcjK44Ji9KAmQ8JfViBqYfJbwvDomcRDbpZUAw2iPudxAFJS96CvNgjHGCHynpFkVPT2zt0W4/jpax69JZ7C/yPMFkgu478OErPp19nrt8Fb2Z7ZQMiG6leWSfkUAgCbEoFHxXeqaRH1jJtGNuIu4pH4jjIccESGPKBADk8PHcwVUMBfbT94DerObG9Zg9MpoH3+Igy+5HmqeQQnygphCQqAryzPXl/3b0Qx1dfWgHka3GtO7sh7pYF7SBbIO1Q9QXQu6OmUIFEWOAOhi4mYsDioPQQUXy+Uv6bcJzw7MCT5JjkIjKwh4Ir+PL4vtqiUFr+PxbRvnTnRus37azh93UzMqfJYUXaHi1w61Xntz6qS74Yz98g/gQMtitzQKTURF8/RfeOeaEqZEMW41oH; 4:nv1pN1G0d0Smn/Yy4leHxU1G42oYSvWXOFZ5mfukmsugOkNtUdTR3quOOfhIyMNalyAVGB6GeWueJw4fljf9rI6+aOxe7gicwy0FdupJ+j3cCbDz+2ikfKu4EeQvfN1PWKiFaya0qp5qHTEtPSeg5Tx11v2LH6m16QHxLCcEIyVL+AhN9srBTq0JPcXRFFn96rNAUnV2Yh9rua8W+oSWzz/dl8n5kXyiWecEQOr7JUPoz17rxO6Q2h26hJIQrMXMdlOtZv9Art6FS2xFkVzVxw== 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)(10201501046)(3231232)(944501410)(52105095)(3002001)(93006095)(93001095)(6055026)(6041310)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011); SRVR:DB7PR05MB4185; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB4185; X-Forefront-PRVS: 0654257CF5 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(39380400002)(366004)(396003)(376002)(39860400002)(199004)(189003)(8936002)(86362001)(6496006)(6666003)(106356001)(68736007)(81156014)(118296001)(81166006)(25786009)(107886003)(53936002)(52116002)(956004)(51416003)(6486002)(6116002)(446003)(476003)(2616005)(4326008)(11346002)(3846002)(8676002)(105586002)(76176011)(36756003)(66066001)(97736004)(386003)(6916009)(486006)(26005)(50466002)(5660300001)(58126008)(16586007)(47776003)(7736002)(305945005)(316002)(48376002)(478600001)(16526019)(2906002)(2351001)(309714004); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB4185; 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; DB7PR05MB4185; 23:Q6z7MK8riuw20TlFY7ufbE2yeNuuTA9gMODcG2ysF?= =?us-ascii?Q?jFs9IzthKvraXiWbomsSHPZLwF1P28m6oGBfwwhsY4Cg79VdYbtk5QsTt6BE?= =?us-ascii?Q?THSJcPPGvTQAPpIx/YZ6W6qjN737id3XvnPLIoP7Go4iQuXMRde5GbwA9YDw?= =?us-ascii?Q?kIlKtCCKW0Gy4uk+bMaf/hCcG5bfuIFw5MZtuaiHcPUADRCV4TBk9ZxdyTcy?= =?us-ascii?Q?38iW4yAdpoCFOeHmb2I/y4VntNFrxPigU1/Nmth9fTo9502F+M13ZUNZmmUM?= =?us-ascii?Q?lOwWo/2/68dUKf1D8CCiGXMX322c7HCpS6yKjITXGp0TJcf+S2wZbZFeG4Ru?= =?us-ascii?Q?hkuUc5d19GC4rGTqtV/WD6oRNltfeeNd4+CrDRR25KbVre2cEv5BmFXUcu/f?= =?us-ascii?Q?Xnb+clmt8ZDC1IqNDmsdUmjF3o2OlApYnaphmIxfEJjpNLCiAzGhwC4KW/PQ?= =?us-ascii?Q?DVA+IumGUknN2LN1Fql8eUAHByocOKizpnpf6FDpNuby6JxV4cZur8vgCKcM?= =?us-ascii?Q?w2Fm0fJ9VBwp0rpDj9N9gTiWfoxnVU10ImaZ5OqwcKdc877kJVCq8NHmITD+?= =?us-ascii?Q?2oRJcbO0hjYlMLEtMGjkitImPyuUUgKejdrfdvODOvmA6Sq/LpK8EaPlzNnS?= =?us-ascii?Q?PbiYPJdiiwzqV/o1pNHTBJz48rXnBZZp3qklt+1+KD6U6fQ1kM1rx0CC86Oo?= =?us-ascii?Q?Pgjgn0GCqE+0AzlxOJgNbfH6luEZ2e90Rf7dgWHNmaAD/9kkHTNX9mL8Ai77?= =?us-ascii?Q?NuLg6G5wcGEXnESKRUJUGLUEOgVM2qpNpORsRUMynwB/8jE2d/AHlIVIiziq?= =?us-ascii?Q?Tp6nOM8yLuxT7Q5al/YPSKzyKcNNru2BETCRQBciz+CdG+fxKUTo9R4/pvZp?= =?us-ascii?Q?Bda3YjtY45SoMl+Hj8kEcXhrsJrmwPc71eg1d/JT9n6YTK3KyrDtrPE7v+MT?= =?us-ascii?Q?dtw7t0G433o22spUHPi2yZV3I5YMPZhs13bcml5LnmBjF58op9pbYRPqUzCR?= =?us-ascii?Q?jxHRdMHi4TU2vmAlLQfWWvPvzyjwduIwyi2lXsmm24EgD5oLfPbPXkN8/gD1?= =?us-ascii?Q?P0xFp9sXvH5OVTOk/PQj16juH1IogsIV+1RHtAhw7v3H1EO8Xh29zSqYvRRa?= =?us-ascii?Q?Cb1+IStxqV+4lrv3kYUjReilbWsdyziBbHmA+Y4d+fouSQUmt4zucZF68Rdn?= =?us-ascii?Q?PomfiYE0etlnwxWVTGIuwvJUxP2DengdGR9d8wPb1GkhgiS5Uresm20ag=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Antispam-Message-Info: Eqqr76JEIZRGjVDKconZ5NGwIw/LHQ62ACz8b2Qnu0Rz+o08hI3OtCIh93DhX53543ydaki1WVy7nToud18gvuqz4ef7RVbkpvFqEs79I4mUFEn0XEMS3SiQXqrXldvA5ehL2pLpUyLo1aQb7fQJJW+zMVoH0Oqhra1bK878yvL5Luz9as0OXy/NAVtCbSMk X-Microsoft-Exchange-Diagnostics: 1; DB7PR05MB4185; 6:49iWEGgvx5Ek9QCkdCT5T789Ugmg+GJYIHJifrH85MFcXVcBkYSJZ4sf6M26M4mpP4krGaBlSMOi1JGtbRLkrU8s8CJF4Ls1pR0xO4eca2apQ0vqCuh/Xpp3HUJc/qE9d+OISeBeNTURt242Eh5veffFGx6k5+6847POwFj4af6D/8hdLVlQrvmiRZGOH5GEXRbCGnsMBChMu2Mll2G1kCRFjh14d2LLptsfG54eDnOFsnipD05sT8WrAx5HqJoDFA7XTzfK23Mr2U7WSc0dsUprkq4g+YJktbwEdts7SnoF2PCMIHG8NVUuVi9tww+8TwBu3GHq7H8TgMOe18F2MlERSVrRQ6/FHbTrJwQMDyXel255urDgJFCxm1JIWP3mQaOCX6Aewaz3gbUP6u25V3LAOydtH87rxAEztoX8R3wi1a6lAqG+V2CMEXCe1Tb/eXLa+b7ns1IB+bWyx4I6+g==; 5:oHYBq2gTS3luaLzU+gPhVqNHlRlq8opgohk09rUVEQb4hjR3zKXNORBjbNCGX2Wr+pD7R1vyQsoMFVCq8hx9iEKQngJC9SCw9z4bH76FmJ17MRYp2OKa4X+wOQq5IdI77/KmkSW7/638DRZLQ9j3mEOuLkR1TArWO30Qa/x6Qh0=; 24:aOF63qPdtbymh+OK/XbS1i5UoOysdp4JfAl7JRbnenCZ3QoD4CSKOtqB9MHb+pxCopqr4R0dYh0d5IiTPO/ORbSCk1KpJrlKiPehRSQTA8A= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB7PR05MB4185; 7:UKSwNN3m6ZL62d4hOHD+L56wyvhuzkz5hleh0xQvC7lqisyrfr9PNuaC/EkAnmZsPMiiO9UfxoGgcbZlCnEjkd0TBzas5H+oa/nMssqMKS0h/Byewvnbg8HtaUAudJQW8dzKAw4lKA7ellTH4Pk5cf7PNYSOBnCGY7SLqd4x71F9ZIu70MxqONQkDsWDFkPE/DpvjnlhUNYpog4+e4Nl69hr31uq5ochbVDgPCJIs4Xdb1JGgm+JWy+d6CVD6Kyv X-MS-Office365-Filtering-Correlation-Id: 5f664091-fc28-4728-6488-08d5ab9363b5 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Apr 2018 16:33:05.6823 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5f664091-fc28-4728-6488-08d5ab9363b5 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB4185 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..adac430 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_pvid_rtnl(br_dev, &pvid))) + return NULL; + if (!pvid) + return NULL; + + edev = br_fdb_find_port_rtnl(br_dev, dmac, pvid); + if (!edev) + return NULL; + + if (br_vlan_info_rtnl(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_rtnl(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;