From patchwork Fri May 11 15:49:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10394643 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 CE4D960236 for ; Fri, 11 May 2018 15:50:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F2A7F28F47 for ; Fri, 11 May 2018 15:50:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E6F3128F4D; Fri, 11 May 2018 15:50:10 +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 BD0C328F44 for ; Fri, 11 May 2018 15:50:08 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40jF0Y71lGzF2dk for ; Sat, 12 May 2018 01:50:05 +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="QbMHXtzF"; 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.87; 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="QbMHXtzF"; dkim-atps=neutral Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0087.outbound.protection.outlook.com [104.47.0.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40jF0T0c9QzF2dk for ; Sat, 12 May 2018 01:50:00 +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=u3RxQRI/J3rKPmDsGBnDNh1/LBPP0xLZbOs0SYlR68A=; b=QbMHXtzFHrdLaUFuYIEtxVb0YNZ5GTV+8cVmdh8/pSElYt2IGs/GIXyi3C2yQALgi/z+C0+iSD3ssWfihVqxg+5hy1tKY6BQm+4nn+GbxuIIsTDpLHqYmF78FCZjBdmz9U1/LshO4d41hMJfwbOAW/Lz18ftT6IUEC53xJOclcM= 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.755.16; Fri, 11 May 2018 15:49:51 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw] mlxsw: spectrum_span: Support LAG under mirror-to-gretap Date: Fri, 11 May 2018 17:49:26 +0200 Message-Id: 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: CWLP265CA0003.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:10::15) 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:Q2Y3f4+ToNgz2a2jFF3W2L/9Ql6GuHIegbLNnCszVzSFASOnXJg8pwBHHZUUZksbTXTnf1blRYuWa+NCH4dFqN/vgJ4I1c2ORIXQNZKzj0X4bq2+ARWX1xNKI/a5NrFoLvPOmzFXbsu3Lunft5Dp496pCfAlXw6ENqJx788bcVer9JUp/mOsxhsdfl8CqOQRTPtyvSDOWiUtYznxqQyfaa8ZXPHPDexYztKXqwrtti49oqEEruyqUi+UeyM+Dwof; 25:8pIelbS6wnsJleUgW4mEe5v4BOByrUTvzLNHQ5fkY64m0JFuJqJhXIrZmZa3U/gpI78YbDuPDlmQtZgVmPsjWVS0L1iH2tLySlxpZFP4xBSw+Gte6BdXM4btdbBh6iQ51ZmnBIwZtFZkJZJgpb/9PZUy2+NXHufwsaB+Z3Ft8ZMQfe9NF5ZE2NFjhEkQWUb0KicIEy18tm5R5TJyvq8/BeQ8f6Z0X+Yx31uNsG9kafZPUfaqo5Z+7Cvg0eB+NwHXn3njaEuVf7JESlTyX/pnZYaO2OY2LQHGWD4tvPatrs+hIPU5WDE3ptEwgucfE0YRT8KMnMhSPJaqKT8Q4po6Pw==; 31:eeq4tSl1MxqcpNPffj30SCNQeH88cAbD2MiVpajfrJUg50WTI29sDwFSpJweVijUzUBVbi403FWu9Ml4nJ3j1Xo7MBZdT7QWxeqOToqpiQMJp9WSAMN5fnxpXiD6LHvHBd80XSQFIbpCE0C4iSbDxVcJ/o8aImqxDVZACL2PailxnDCzO4Dvk2uToRlUhiSHA9U+X1vXGubwv4TgvWU0+c0Us31fjXofFGB9At2WDWg= X-MS-TrafficTypeDiagnostic: DB7PR05MB4185: X-Microsoft-Exchange-Diagnostics: 1; DB7PR05MB4185; 20:IsS0RbSz1m21Ql+eb/anLxX5GNoZVkhUshDQffBpOYCcfc+SuHdEuhMJzHEHPxiOIsbCJ0LKLugRtqkjKBjyZMJPSQf3j+wDxGq4kzita30vslOyU0reR5tIbLt+aZRw50inOVwoW2viAIYLKCy5atkh6uWExSmvvgAy349RV0U8R/jEn1YCQt7dnOptEqTkj/8jTusm4EXkNRTbqkrS0i7Y8u2cj2bxCmmhRGyeK0PRPI6bWvFKGrZ2v6075Q3PFz3HVgn41KkaTe2LnYKex823hU4ng4Dr6iMfwOQ9FYMwUuRw7g8c1r2m6yiZ4TDrYu7oqneyZpBrB43bhySKWb+35t+jnwWuLNANg5d6rM8/BpFUfu7uDpqn9F2IVqFVqgxozrj42reUVMljrRP3cuY9SaCAbXtQUF8Zusk7Ld05H8e1gwWoQBRInRiI4OJPKdawGVYSEhotbwP8gd632Ju8GpqS4gTxN2cB1BdugnvPvAtoUZp7U6pJxzBNkAUv; 4:4KtRvn2C9CKHrOTRNetqfNsJ2wYrYTPEdHiurOkD+YcsHLL0d7WqVnOs6zae/9U+nYD7bK53CcWjrk1O9C1UkrBWkg20SijTnTVxVHaiRTSiQlifoAiTr582/U6u2t84RdnCylxkZT8IKcL/dGmLXlIUiT5gFoXu61/QrRVBR4EKcR7UTM2/SQ9vXf35wfrtuRH2lFEU6ul0J4I5emQs13235PxwK+DQ8UXWPG12AXsyOSs2lf7rSg5b+R6RTTyhaMACs8mfDgsNcrpC/z0vQw== 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)(3231254)(944501410)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(149027)(150027)(6041310)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DB7PR05MB4185; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB4185; X-Forefront-PRVS: 06691A4183 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(366004)(39860400002)(39380400002)(346002)(396003)(189003)(199004)(118296001)(4326008)(305945005)(386003)(478600001)(7736002)(316002)(36756003)(58126008)(51416003)(5660300001)(52116002)(6496006)(6916009)(105586002)(16586007)(6486002)(107886003)(2351001)(47776003)(106356001)(53936002)(8936002)(3846002)(2616005)(956004)(486006)(2906002)(25786009)(50466002)(66066001)(16526019)(81166006)(81156014)(86362001)(8676002)(26005)(476003)(48376002)(68736007)(6116002)(97736004)(6666003); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB4185; 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; DB7PR05MB4185; 23:VyP6K+r7vDFawwrqIUtnNVFl1rLZUCEtjZn8L8MwQ?= =?us-ascii?Q?DchQSf3pYoQBwAYSiV0tMbiKFxvgjW0cyJoiv50lyCkRbRcd2LGsExkC9Ui8?= =?us-ascii?Q?BebKGE+wDf063j9pvBH/7Jofi0JAgzSmyobN3xWL/iADaziPrO2iUztgZGjq?= =?us-ascii?Q?wtcQ2M5WtuGD00N4IYESRPnK+ywZD0RCr2POKsEmtctZnRZKinbe9zh55ghS?= =?us-ascii?Q?DP3U1ZcjdbFLCmI+aIkTSOqK01GF8BU0cptH3HXWIOVJX2xCDd947RK5IBbH?= =?us-ascii?Q?BuhVHmFhjy+VH9+UvrP5WkDXuQdTttd0CJBhhoke7g4ZDONHPiCECLxkptnO?= =?us-ascii?Q?m8uWwaUIEMEZDcI0xIaNd3C/16gpbCHhJOD0xxmSt0kCNvzgjL+MkEOX8naF?= =?us-ascii?Q?KfNTiynZXYgji9+9vAnOvkdb8soDeMLsoCYcenCXHuZwVZ8BetEZD8ByXVBK?= =?us-ascii?Q?/DOnDIAKGpfeutfgJMgRDemfIS/vTQQrGWiTe8FbarjO1Fv3IoH3yYNOSYK0?= =?us-ascii?Q?PlgnpAf2Yix3nzeZDDA9WTWxj706MzpVmeWBj1sKE8M05q0hgGXm4fc8uh3x?= =?us-ascii?Q?ezG082EcEGpv0TAunjZx6poTUXhmgUd9YOzyTmRNumsN+MmG4iQyj8WFgFBj?= =?us-ascii?Q?jzPs7R281aQm2P1hZBRI5EJGzCEM0f71k/dDy+adlIgv9kjuR1G1yjXsF02r?= =?us-ascii?Q?ro15z/4+cq0ziHD/ORx1aI5fduYTQY+2YcYkQmgtE9LrGb7lr0NZxn2VoqRj?= =?us-ascii?Q?jaMBRpIORpFQJLlewHB5lGKPckHG1WptzuxNRU5Ou5tnOtC/SeND9W6R+rxj?= =?us-ascii?Q?Gqyqpyc3BB0oqUCBMdt6Vc/gytsthhS+GeamCesG/fRmmfX9vLuNm0U+1byR?= =?us-ascii?Q?5rKUNjFlU95a5r4cYcemFLzL3TfEeckGs0WfFzgfmaHtoh3gcOhroangp++Y?= =?us-ascii?Q?xMHXadDa5jLYxx95I8zPyMWNO8GPG4t7hHmUXCPNIOHAb7pRZO06NvpaJTrs?= =?us-ascii?Q?F5ee+XOHQ1WoojstkjtKVF/w4a35u2GmojFKQ2+c36kMnY5Ml19AazuMtrAA?= =?us-ascii?Q?WBrg6vV1CcCDhDP4kgFHfDCe2PqUeHYRI1URVMPLaiwjUn4pp4NuO6Mwd4zQ?= =?us-ascii?Q?TmGG1D8mzfVZn6tSv90E1hEH/rqSo13?= X-Microsoft-Antispam-Message-Info: MloN12ZRKmF5yzNpjmO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5XG3jDWbaobhq7lRgn81s5iWkrmmmAY/aCpWKco+LuqgYBnvVKBlWEG83Gwn7dhSKdto70ME+WTI86Rz/KIweHdosMRebm0U0XYjEF2HvY7wDGRABOesVJ5D877oguDBq1m6dI1cKzs0J9CPU0PUh/Zhx8WP/tckSj8t5R0gRT1XLDiGpWKMwyQ2H1+mBr8LYjw2hv9uWY8chmZToAv5FZFZzs/FGAPGQEkrn8NTqu X-MS-Office365-Filtering-Correlation-Id: 07debc92-c2c6-444a-0e33-08d5b756d59e X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2018 15:49:51.9425 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 07debc92-c2c6-444a-0e33-08d5b756d59e 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 X-Virus-Scanned: ClamAV using ClamSMTP When resolving a path that the packet will take after being encapsulated in mirror-to-gretap scenarios, one of the devices en route could be a LAG. In that case, mirror to first up slave that corresponds to a front panel port. Signed-off-by: Petr Machata --- Notes: Unlike VLANs, we don't support LAG in SPAN and RSPAN situations, only ERSPAN ones. mlxsw can't actually support LAG well--since it needs to resolve the mirroring to a particular front panel port, there's no way to express the load balancing that the LAG is supposed to do. In SPAN and RSPAN scenarios, the decision to set up a certain mirror is purely an administrative one, and a given administrator can always resolve a particular front panel port themselves. For ERSPAN however, while the decision to mirror is administrative, routing of underlay packets is a matter of routing protocols that might just happen to put the remote tunnel end behind a LAG port. For these cases rather than dropping the mirroring altogether, and reinstating it again only when routes change, have mlxsw choose an arbitrary LAG member. drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c index e5f4f76..da3f7f5 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c @@ -245,6 +245,19 @@ mlxsw_sp_span_entry_vlan(const struct net_device *vlan_dev, return vlan_dev_real_dev(vlan_dev); } +static struct net_device * +mlxsw_sp_span_entry_lag(struct net_device *lag_dev) +{ + struct net_device *dev; + struct list_head *iter; + + netdev_for_each_lower_dev(lag_dev, dev, iter) + if ((dev->flags & IFF_UP) && mlxsw_sp_port_dev_check(dev)) + return dev; + + return NULL; +} + static __maybe_unused int mlxsw_sp_span_entry_tunnel_parms_common(struct net_device *edev, union mlxsw_sp_l3addr saddr, @@ -278,6 +291,14 @@ mlxsw_sp_span_entry_tunnel_parms_common(struct net_device *edev, edev = mlxsw_sp_span_entry_vlan(edev, &vid); } + if (netif_is_lag_master(edev)) { + if (!(edev->flags & IFF_UP)) + goto unoffloadable; + edev = mlxsw_sp_span_entry_lag(edev); + if (!edev) + goto unoffloadable; + } + if (!mlxsw_sp_port_dev_check(edev)) goto unoffloadable;