From patchwork Tue Jun 5 13:37:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10448315 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 5AA9C6024A for ; Tue, 5 Jun 2018 13:38:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4A82F28CEF for ; Tue, 5 Jun 2018 13:38:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3F31C293A1; Tue, 5 Jun 2018 13:38:07 +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 941B828CEF for ; Tue, 5 Jun 2018 13:38:06 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 410Xth6xhNzF1wt for ; Tue, 5 Jun 2018 23:38:04 +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="nZSyjQPf"; 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="nZSyjQPf"; 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 410XtV1TpnzF1qt for ; Tue, 5 Jun 2018 23:37:54 +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=yISLNJOC1XSz9NXY1Eo8wav0i5wwZxsU5coK1V8c2V8=; b=nZSyjQPfHEGBhFvyq3PJhoP6T8hLs+tonJxNQ/Zc7SFauePE8x5a3n9hySKLbMjLuGV9LAki5t05+33D7oHsJNgURzxxLWjsmyHwFul4CZle3/PVioh4rtjL3tEbAyjwEGqPM1UKfm6KhSc5vONxQmkqsUMxPLPXZe0J/ifZ1BQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (78.45.160.211) 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.820.13; Tue, 5 Jun 2018 13:37:48 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw 2/6] mlxsw: spectrum_router: Allocate FID according to PVID In-Reply-To: References: Message-Id: Date: Tue, 05 Jun 2018 15:37:44 +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: CWLP265CA0041.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:11::29) 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)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:VI1PR05MB4191; X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4191; 3:5i9zcaDydJ4vQQ/4a1GFfnnmndcXn2JuKUab74ngQvQ58SOP0pyGNqaDM5/u66Zl3U2roNxM5q/aUynmxF2JzRjuCHxYKdcJjuwIAoYF7AO0DjbmIdKJc+N0Z5KUtOD42VcAOGPVV8tlEwx+rxmR4GmdEMiNNpdLTsMyGKzVNRa0UnJbUM04THwMrtLQ+gJ4hh1lz/EKJTXwitDpfsT5Jkr9SFMj4z9/CDMdQyJrZE+F5KsA2hVlzWGCz7HcGdUR; 25:29uLl36I3mWkBEtWxlgz7frkK14g2x4pA3dUgCA8NHHt1KAnZ855xbS0tFF3Tk1DkQgc3oop+BA/nxtk8dFDMXFCP3Zj4fbjgSBkxut+G5Ie9DUMgiO27vtRETbhVLZz1mvLIkhd7uMcIIIQR4TZXBwlcxjRt9eiV1why8yyM15G7D99XgrRcbIBjZXDNodtPnVJhYG1sbi5iv0VZKq3RLdQaMmHMMffjRM2/NXq0mylrXe0JaN1UlBJ3Jt6tMhNu6+5ezk6SByxM9fZBgY75Ql7Oo79dz7sN8n8/bRDoJDWcfUVrlNfsWCv1LPRG4N4ITpNjXKOhQ0dGQOVLp9itQ==; 31:eWzzTAjCK9mm/MYqEel6tiZoXMdp3j7p+W6MOBx17hCS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soft-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)(10201501046)(3231254)(944501410)(52105095)(3002001)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:VI1PR05MB4191; BCL:0; PCL:0; RULEID:; SRVR:VI1PR05MB4191; X-Forefront-PRVS: 0694C54398 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(376002)(39380400002)(39860400002)(346002)(366004)(199004)(189003)(486006)(68736007)(6496006)(118296001)(956004)(2616005)(305945005)(476003)(446003)(86362001)(11346002)(7736002)(16586007)(316002)(58126008)(50466002)(48376002)(2351001)(36756003)(97736004)(53936002)(3846002)(6116002)(37006003)(2906002)(105586002)(106356001)(8676002)(81156014)(478600001)(5660300001)(81166006)(6862004)(26005)(16526019)(25786009)(8936002)(6666003)(6636002)(66066001)(51416003)(47776003)(386003)(76176011)(6486002)(59450400001)(52116002)(186003); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB4191; 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; VI1PR05MB4191; 23:s+J7+gRxhm9hG0u7PFvmLkskkkKNNDyQS/PvXF5BS?= =?us-ascii?Q?40oH/zMDPLcmkZVPHQudPQtPfOXtst1C+9VFRS7OyGZIH7X7s4Dgy4EpfI54?= =?us-ascii?Q?OhfygdPRexmJ/xXx4M8BX6v1RgB69dMNjrnTwiN3AAgIprUb0hX52fXNXI3k?= =?us-ascii?Q?4lYUej4fhqLhBCYYPfNlWCHS1XR2XkFKQ5H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ud+bFzLqs9/L7W0ObGElhC9OaBRqo2x6FmErOCa0+XD+jn/KY+QXlAKg4FqQSCI=; 24:+88/cvsAWAdH+LRmKNL5gyquBu6tBZmMQ5Zl9HZZjqelfL3TtvNn3IBch3CWXxxwCac9Cw924Br5VQ3KBwLmydVkrggxYbNM2Qbf3pb3PDc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4191; 7:9Zza/zX6GyYy31aqYpkRp9MwO15PSxYqmD445ZqMjITKsYcK68S7JI8OuCLT9oUWyfveoK/uONzILq2hn0Tgg2gKCYGx2EnZHDMRRmkzKtyqf/wtNvZIWQDgowrI3To5EsONddJGmV6k27yXWlnK9Si9mPHzo/lEbvVKJNm6pirLIOk7znQeU1rOncjlJSsvORC2M1FRxLAiM9Srb/IGN9Ijld75Eqh4LAErVoGXAt+3I3QCU7ed5Alc/nxMwFIR X-MS-Office365-Filtering-Correlation-Id: 7a795af9-c131-4299-6133-08d5cae98756 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jun 2018 13:37:48.6556 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7a795af9-c131-4299-6133-08d5cae98756 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 For bridge netdevices, instead of assuming that the router traffic is on VLAN 1, look at the bridge PVID. This patch assumes that the PVID doesn't change after the router interface is created (i.e. after the IP address is assigned). Signed-off-by: Petr Machata --- drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c index 54692c8..f9a8fe2 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c @@ -6870,7 +6870,20 @@ static struct mlxsw_sp_fid * mlxsw_sp_rif_vlan_fid_get(struct mlxsw_sp_rif *rif, struct netlink_ext_ack *extack) { - u16 vid = is_vlan_dev(rif->dev) ? vlan_dev_vlan_id(rif->dev) : 1; + u16 vid; + int err; + + if (is_vlan_dev(rif->dev)) { + vid = vlan_dev_vlan_id(rif->dev); + } else { + err = br_vlan_get_pvid(rif->dev, &vid); + if (!vid) + err = -EINVAL; + if (err) { + NL_SET_ERR_MSG_MOD(extack, "Couldn't determine bridge PVID"); + return ERR_PTR(err); + } + } return mlxsw_sp_fid_8021q_get(rif->mlxsw_sp, vid); }