From patchwork Wed May 23 01:41:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10420019 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 C4607600CC for ; Wed, 23 May 2018 01:42:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B38FD28DA6 for ; Wed, 23 May 2018 01:42:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A893028DA9; Wed, 23 May 2018 01:42: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 D349D28DA6 for ; Wed, 23 May 2018 01:42:35 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40rFd619lrzDrbk for ; Wed, 23 May 2018 11:42:34 +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="ZOyt2arX"; 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.2.81; helo=eur01-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="ZOyt2arX"; dkim-atps=neutral Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0081.outbound.protection.outlook.com [104.47.2.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40rFcz73fkzDrTs for ; Wed, 23 May 2018 11:42:27 +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=xSMCu4jcGT7zgp33C1n06OEbbaSa4oJadG0tJ3euVPE=; b=ZOyt2arXSXSotfhygXvJFdd6kGRCpKaen+s9XHd4R586w/eXlwPZoqp+kf/tAKzNW3q9/S9JXyEYIFEkAtnS3NJLHhLaVlsr3cH0ivRJwbfioIpj6jTGSNVpupfUC0UzsqaUZwBi2pVH2qQ7KLqZqzhvn4mR+9IsxWGD9vZ+JCM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (89.176.83.59) by AM6PR05MB4183.eurprd05.prod.outlook.com (2603:10a6:209:40::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.797.11; Wed, 23 May 2018 01:42:20 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw 6/7] net: bridge: Notify about bridge VLANs In-Reply-To: References: Message-Id: <1f6eb4bafa350baf6c8547452b2124a93e113337.1527039181.git.petrm@mellanox.com> Date: Wed, 23 May 2018 03:41:32 +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: LO2P265CA0083.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:8::23) To AM6PR05MB4183.eurprd05.prod.outlook.com (2603:10a6:209:40::28) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:AM6PR05MB4183; X-Microsoft-Exchange-Diagnostics: 1; AM6PR05MB4183; 3:yM7gApIop0lWjOgVeer8wHui3A9+jOCcqD3yPqrwVuuK68wZvzPsFVi3RC/06e37iHYUSuB4y8avCA9eh4BBqG9xrI483XUA8CqvkNSQpCY8RG+T+adYq6GKSigLyrJQ2Au4oyOcJ56IKy0u0v9Ke1Ow3QPMOUx6CQUQCZdQoRJ1kf2E6/60Gy6JceeuDOv7UyltZEX1ayrkq0E/9sOaE4ZNWYG8JG/E0fCqMGYIKumKgyfppewhPQnab4/OC1rZ; 25:7U80d1y+NQ8h8zdGRcU+rQUJvW3pMhi7c6fAd6RcsRw+1+pKnVx5Q3SA+9aE4XjP/nWcnyeINqqiPK93tAMSnve9ZL2ccWLu99pmce81U/fI824KR+0eDuFNeGKxvz6PdilshZXATGV/tBiP0czYylexZ64Lg2mr0aissBq/rbzJQYSd0rlY7x8ns56ZfAaz1ah80NNWoLJeJTuAyG7uM17JNKiNjW0EUyBvCVhPKx8o7SfoZTIt9U5aHKGlTC7UvR0Qm9Q7lb7q97pY5r1iW5A42iDto1zpjSoEpvt4QL8NzF1T2dJLKFebMz+RfC/34G/0af9iSFGSZMmviowi6w==; 31:Lp+wVLEqW79jKK3YibuHk9Gfj1+Jczuf7/la+tn758SLh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: 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)(93006095)(93001095)(3231254)(944501410)(52105095)(10201501046)(3002001)(6055026)(149027)(150027)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123564045)(6072148)(201708071742011)(7699016); SRVR:AM6PR05MB4183; BCL:0; PCL:0; RULEID:; SRVR:AM6PR05MB4183; X-Forefront-PRVS: 06818431B9 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(39380400002)(39860400002)(376002)(346002)(396003)(199004)(189003)(52116002)(186003)(53936002)(76176011)(51416003)(6486002)(6862004)(2351001)(86362001)(26005)(58126008)(37006003)(59450400001)(316002)(386003)(16586007)(478600001)(6116002)(3846002)(5660300001)(97736004)(118296001)(81166006)(81156014)(8676002)(7736002)(305945005)(68736007)(8936002)(66066001)(6636002)(6666003)(6496006)(36756003)(47776003)(105586002)(106356001)(2906002)(476003)(48376002)(956004)(2616005)(486006)(11346002)(50466002)(25786009)(446003)(16526019); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR05MB4183; 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; AM6PR05MB4183; 23:MjIfYIEUYWkFu2uJx9SLrWgB82Yu5bLqkg4EZ/A2u?= =?us-ascii?Q?FYd2DxG7CdqR2Yvw8/RucHDJ7W/J2hTu9oQi5Q6baDK3kCiIt1WTU/qkl55G?= =?us-ascii?Q?ldqDLApcNmGGWJUhSyf+w6zpxcRAkmgACYz2dyaOE6uOsNfBmvLR+Mez8Pke?= =?us-ascii?Q?AJyuVs1EefPHXSeU86VXKACFVFtRM2WKMPqYTavnB6gEP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VRKLI1Wm32ao/JLXzbMShn7xZ2Bgi6Z4PCxx9dHfgHs1KsZCUkHd2b3pUdwHUU=; 24:/6O6ygV3+K/aBVlvj5XdGuOJn8E4jKBJq3wBQbhxbf+qDZT09RRnNtVKkINV3RrQ4oE3gx/8HJOxXtEf84q8PTcaCt87JAccbq2dPp706ic= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM6PR05MB4183; 7:cDKEDyY4FakB+EUyPzDR0X2Z9yoE159DCbsF3hoVXgqt3DwqlwqcwgQQA37nr1nTZzPV/4/sqBmHv9RWHdZ1HpGUmNDyggKhZ9YUNVzlYPcEErBUYaAuzl2pJIwjuJnjnvuJuB6wEs3xcMq8B61csFIpGb0LILHMLetFhFVId3p+bINYKy+7OLpqHIdK/kNhshevDvE0FfJpi527gab7UYEcgYGbBshfDh+e8UnolVWlee9upwGnk1mwTUeUiXn5 X-MS-Office365-Filtering-Correlation-Id: c451c17b-632a-4f0a-ff39-08d5c04e6d0a X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2018 01:42:20.9712 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c451c17b-632a-4f0a-ff39-08d5c04e6d0a X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB4183 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 A driver might need to react to changes in settings of brentry VLANs. Therefore send switchdev port notifications for these as well. Reuse SWITCHDEV_OBJ_ID_PORT_VLAN for this purpose. Listeners should use netif_is_bridge_master() on orig_dev to determine whether the notification is about a bridge port or a bridge. Signed-off-by: Petr Machata --- net/bridge/br_vlan.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c index a75fe930..14c1b6c 100644 --- a/net/bridge/br_vlan.c +++ b/net/bridge/br_vlan.c @@ -268,6 +268,10 @@ static int __vlan_add(struct net_bridge_vlan *v, u16 flags) goto out_filt; v->brvlan = masterv; v->stats = masterv->stats; + } else { + err = br_switchdev_port_obj_add(dev, v->vid, flags); + if (err && err != -EOPNOTSUPP) + goto out; } /* Add the dev mac and count the vlan only if it's usable */ @@ -303,6 +307,8 @@ static int __vlan_add(struct net_bridge_vlan *v, u16 flags) br_vlan_put_master(masterv); v->brvlan = NULL; } + } else { + br_switchdev_port_obj_del(dev, v->vid); } goto out; @@ -328,6 +334,11 @@ static int __vlan_del(struct net_bridge_vlan *v) err = __vlan_vid_del(p->dev, p->br, v->vid); if (err) goto out; + } else { + err = br_switchdev_port_obj_del(v->br->dev, v->vid); + if (err && err != -EOPNOTSUPP) + goto out; + err = 0; } if (br_vlan_should_use(v)) { @@ -605,6 +616,9 @@ int br_vlan_add(struct net_bridge *br, u16 vid, u16 flags, bool *changed) vg->num_vlans++; *changed = true; } + ret = br_switchdev_port_obj_add(br->dev, vid, flags); + if (ret && ret != -EOPNOTSUPP) + return ret; if (__vlan_add_flags(vlan, flags)) *changed = true;