From patchwork Thu Jun 28 23:22:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10495357 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 2B83B601BE for ; Thu, 28 Jun 2018 23:23:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A6E229965 for ; Thu, 28 Jun 2018 23:23:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0E69729989; Thu, 28 Jun 2018 23:23:23 +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 B145A29972 for ; Thu, 28 Jun 2018 23:23:21 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41GwnN0DmxzF1RK for ; Fri, 29 Jun 2018 09:23:20 +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="sXLIyDkq"; 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.0.48; helo=eur02-am5-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="sXLIyDkq"; dkim-atps=neutral Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00048.outbound.protection.outlook.com [40.107.0.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41GwnG5ZFvzF1QL for ; Fri, 29 Jun 2018 09:23:14 +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=5OSKdKBNNk564ywcColbM9o46ZdaC+SAmGQB54N0mtk=; b=sXLIyDkqmy+Arc9Qe/HQupAnBcwX1af8l+4/RUWL6ScYnGpc9ccF+XCh7NF2p2gPGj5CgD4FKzMrybzGT6I8tbLHXFobhqp80yVSWAmOneWEhk/oE6XmAX/0f7enFl+96SWe/lHJqNornuq1UCzoRhYsXl1jMp6RMw6OSY9bvy0= 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_GCM_SHA384) id 15.20.884.23; Thu, 28 Jun 2018 23:23:07 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v2 3/3] mlxsw: spectrum_span: Change LAG lower selection In-Reply-To: References: Message-Id: <99788ec02755455a5317f2d82ea6b1a2407fe30e.1530227929.git.petrm@mellanox.com> Date: Fri, 29 Jun 2018 01:22:05 +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: VI1PR0501CA0042.eurprd05.prod.outlook.com (2603:10a6:800:60::28) To VI1PR05MB4191.eurprd05.prod.outlook.com (2603:10a6:803:4e::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3dbd42bc-a073-4922-f0b7-08d5dd4e1b3f X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600026)(711020)(48565401081)(2017052603328)(7153060)(7193020); SRVR:VI1PR05MB4191; X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4191; 3:wpwOWp0Tz3Avwg1gZALZ4hDbEgAZAB8XD5R5V40rB8C+svKJ6H2QBO5i+HFmp+oqUZCrm9YwEgH2u7chB1r/tgYAxigOvrWQWUr5ETwkOebn1wcnHnRPc8ps8SjtaSoJhbk2y6NpcPUHH2AF5W/N+7WLkuCywndFrnjC8/MGEmhgdr0Iv3ykFHqb57vjv/7fNiPKeuDbDsmLOBAIxpZiTiUyIll47NptPhOiE48dgd1/ydThsaTMBD1FLs65wC9b; 25:fuIg3jXCr2w7DmUVhg4+qz5N9nPsoB+Gecc77eX1UYoia6D/hNI5+xRHVarVq59FXlZ/3PiTrj88vUQiOoU4Crb7qB7tgo1Fjplnj+zBLFZfT0A5xLTIMVxlN0xF4a3vD2dvnGollcJFT9zfxOr4mhr+l1tOq8qSVJRKU393rUN7WEF/V7jFZx6w5RZ0c8sswzIjZyHwCS6yJUhrJl/xkVYdke0QN5/0HpicGg3folXqxzUy6zcrO+cTF8K+Zjq+3x8lNNa/SeRggIQNjHJbUQvE4zAsN4ZVE+S5uL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c/pZg8E/tr1hLnAUFh0la4uH3Fv/VdL3LOWtAXkBbeuEiCzKuyjlnRZGrx1c46ig== 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)(10201501046)(93006095)(93001095)(3002001)(3231254)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(6072148)(201708071742011)(7699016); SRVR:VI1PR05MB4191; BCL:0; PCL:0; RULEID:; SRVR:VI1PR05MB4191; X-Forefront-PRVS: 0717E25089 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(136003)(39860400002)(396003)(376002)(366004)(346002)(189003)(199004)(186003)(11346002)(26005)(5660300001)(97736004)(36756003)(16526019)(446003)(48376002)(486006)(86362001)(76176011)(50466002)(386003)(14444005)(956004)(476003)(6636002)(2616005)(6486002)(16586007)(6496006)(6116002)(3846002)(316002)(52116002)(47776003)(118296001)(81166006)(66066001)(51416003)(2351001)(2906002)(81156014)(305945005)(8936002)(53936002)(7736002)(6862004)(106356001)(105586002)(8676002)(25786009)(478600001)(68736007)(58126008)(37006003); 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:q9x7AoEpC/3a6NWnl69PdGg49KuXjjmKwM3hEgAPV?= =?us-ascii?Q?TtJlTmXstSbvERvEPdL5K1vk9X2tLMZMLZrsi0aTNkHj43bFp6S2M7keumiH?= =?us-ascii?Q?rqwsTXMn0XvUUNu+BGB0FLrPe1mi+cr93c2PcAueIClA89r26TBL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cWIjaeGYU1WopWdmOFIpg8Qa2U1HyNf+g3PHp1j9fwv28AbhDQHWKWY8V3gGt90cQ==; 5:rMi73WoMUHqWHa1gH7cbwYqbs92ZUaqfdhWwlWOlgFvf94Zhlr1IIoX/THw1P2vPt5V2sfN9WghYjz5J66N7o4j/3nJEVfU1F/zrpwBNwXk5PWO16DL1FkfjofR9rJp47/zg6C7+Pu0YXKx/vbPCM3it61edfjMBQHur4d7sq8U=; 24:x5+d4g+93BgbrvvjL7ZWrRT9x7vyAyglWWImUQ34x75KFk/Thjmm+PQ7vYBsuwx4HMO9TkFqV/mqc1FpLCyst2c2dm3chIboX86+HwV+CYg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4191; 7:3Bz2amE+BLXH6K7GenY1v3TQIhVI1xZu873RcpNotHkn6DchbubKU1qiIkT6TpdJJqBDrFjFFFq0f0+kPMAi3JRvf4+1y226aG9ifZpTGclOgamvxGLBUze4z+L74waqL2ds21LY3ST15di2shtjUjm/9M4INf6saA4kTTgH1lthAVwYO/ggua6K/NMe+egsbpfDQSMyZdp9WuoPabYqw6kDj5HXlAWRvSed0ZNDDw0mlOISNmFZaNvyTLgY79ix X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2018 23:23:07.6062 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3dbd42bc-a073-4922-f0b7-08d5dd4e1b3f 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: , Errors-To: linux-mlxsw-bounces+patchwork-linux-mlxsw=patchwork.kernel.org@lists.ozlabs.org X-Virus-Scanned: ClamAV using ClamSMTP When offloading mirror-to-gretap, mlxsw needs to preroute the path that the encapsulated packet will take. That path may include a LAG device above a front panel port. So far, mlxsw resolved the path to the first up front panel slave of the LAG interface, but that only reflects administrative state of the port. It neglects to consider whether the port actually has a carrier, and what the LACP state is. So instead of checking upness of the device, check carrier state and txability. Signed-off-by: Petr Machata Reviewed-by: Jiri Pirko Signed-off-by: Ido Schimmel --- drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c index 3d187d88cc7c..e42d640cddab 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -254,7 +255,9 @@ mlxsw_sp_span_entry_lag(struct net_device *lag_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)) + if (netif_carrier_ok(dev) && + net_lag_port_dev_txable(dev) && + mlxsw_sp_port_dev_check(dev)) return dev; return NULL;