From patchwork Tue Mar 23 08:33:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Horatiu Vultur X-Patchwork-Id: 407418 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B8BDC433E3 for ; Tue, 23 Mar 2021 08:36:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5DB6B619C6 for ; Tue, 23 Mar 2021 08:36:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229992AbhCWIfn (ORCPT ); Tue, 23 Mar 2021 04:35:43 -0400 Received: from esa.microchip.iphmx.com ([68.232.153.233]:62062 "EHLO esa.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229716AbhCWIfi (ORCPT ); Tue, 23 Mar 2021 04:35:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1616488538; x=1648024538; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9lxgTCKRb/dXejM+dtq7XdfnshCfyP/EiqkevaxcJeg=; b=la+h9dmkbJRiJYttmM9x2qiqRZqOKWfolWah80JYH8s/3MJz5wPD06Iy i6oC0KKJbDL9aPJcfR7seU540GB3gAP0R5ZvT85pAAghKZehS+BwyAqut bU1PNPuwLLOX6KBa2W8MKQN/B5vLguAyd6P1G70wML3qEsLBqWvsy3bNV oJwkECr1YB5VOFNuGlisnZxwaVU7dvwvT4Js5Mx3/YqRclNszIUQTkolw dn3pSGRT/CScV7X9XwYK3hS+SZETL9PCbNrHWDBUYd9D/MlTdacQeqpq8 jw3uZw+6lV3ZV3lVA9eAE0tMTIj2V7iuKYqJ5LOeeI7tPKujRUybXAW3C w==; IronPort-SDR: 8dyTKFYqqY3KjC9tnK/tpkWhd6yRDjFuKIF+fU34EY1QNDJfhc27pPJpNpK5jhol+KlyVmK3Tr N659v615CFxBCEzcxupmwEcyg8pWF76Obfcke9lvKkbEfqwbQ02ZtPmiqB0qenDGNA4RXorOT8 QrYaeSndgU/n6HTEPM7z8yzxiTKjGN2+CcOry52+NueIE9VWvDZ2dkCp8XGOwJB29e335p6+E4 SS+PEGWCHS5/4iwByLjQLxHvWVZIOeMhZiF1dPSGhypNbR9s2rz9LvAZMYqTLXK7b9pgIrbZG/ PxA= X-IronPort-AV: E=Sophos;i="5.81,271,1610434800"; d="scan'208";a="120052714" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 23 Mar 2021 01:35:37 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 23 Mar 2021 01:35:37 -0700 Received: from soft-dev3-1.microsemi.net (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Tue, 23 Mar 2021 01:35:35 -0700 From: Horatiu Vultur To: , , , , , , CC: , , , , "Horatiu Vultur" Subject: [PATCH net-next 1/2] bridge: mrp: Disable roles before deleting the MRP instance Date: Tue, 23 Mar 2021 09:33:46 +0100 Message-ID: <20210323083347.1474883-2-horatiu.vultur@microchip.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210323083347.1474883-1-horatiu.vultur@microchip.com> References: <20210323083347.1474883-1-horatiu.vultur@microchip.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org When an MRP instance was created, the driver was notified that the instance is created and then in a different callback about role of the instance. But when the instance was deleted the driver was notified only that the MRP instance is deleted and not also that the role is disabled. This patch make sure that the driver is notified that the role is changed to disabled before the MRP instance is deleted to have similar callbacks with the creating of the instance. In this way it would simplify the logic in the drivers. Signed-off-by: Horatiu Vultur --- net/bridge/br_mrp.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/net/bridge/br_mrp.c b/net/bridge/br_mrp.c index 12487f6fe9b4..cd2b1e424e54 100644 --- a/net/bridge/br_mrp.c +++ b/net/bridge/br_mrp.c @@ -411,6 +411,13 @@ static void br_mrp_del_impl(struct net_bridge *br, struct br_mrp *mrp) cancel_delayed_work_sync(&mrp->in_test_work); br_mrp_switchdev_send_in_test(br, mrp, 0, 0, 0); + /* Disable the roles */ + br_mrp_switchdev_set_ring_role(br, mrp, BR_MRP_RING_ROLE_DISABLED); + p = rtnl_dereference(mrp->i_port); + if (p) + br_mrp_switchdev_set_in_role(br, mrp, mrp->in_id, mrp->ring_id, + BR_MRP_IN_ROLE_DISABLED); + br_mrp_switchdev_del(br, mrp); /* Reset the ports */ From patchwork Tue Mar 23 08:33:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Horatiu Vultur X-Patchwork-Id: 407417 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB800C433C1 for ; Tue, 23 Mar 2021 08:36:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7C9FA619B1 for ; Tue, 23 Mar 2021 08:36:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230063AbhCWIgP (ORCPT ); Tue, 23 Mar 2021 04:36:15 -0400 Received: from esa.microchip.iphmx.com ([68.232.153.233]:62071 "EHLO esa.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229500AbhCWIfl (ORCPT ); Tue, 23 Mar 2021 04:35:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1616488541; x=1648024541; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=eP8Cr4YL2a0w4yi+/hKrPPiwiCM67cN8kXpAO4EXfHk=; b=QnV544ynisfdBu1mZsQ3ws27VkyJj7Xmeo/foOawyjLpqcAoXkqTpQ8q UNeyXuTZQInTinNDhOvNnaasXP3O9wu5OxTS4yCFih+CfwwhVEDLDB8BP 1b8VURN4jGXWD6mfUoMi8HpCWdVYov2UXESpE5p3LnXz30/Qbwd6DZ+YP a+RNRfYKWOM89RXcqKIsUAR2wmSkUODU1JvS74Wq1JJBQXe1zQSNVb+wj svWJIwKqr1IAk/QHkJ2VYnVSrjpLeNi3hcpjIEkstsHrwfrSpvTi3KpIc a3BDvPhJNiIWgL1tNWYuLy2t2FmCE7oQicY1P8CVGGgEk9MjfYRRgqA0J w==; IronPort-SDR: JManP+JtJBQ0goaqSvSS9fR0qYHupoIfOzEivi6ZKW2BCW4C7frnFzR/KLmie3225VqH5edhc9 7lgeZe7L2JD8KPs7q+3FE/29OnJLgPhKnZ3AwiShoo8yakkAD39SegLjWtlylBCXFWvYg5k/TC dSfhf1ekEddoND05nfT+InAoFxgoAGZS23luzcdrLhFA3xvT9ujCjqBVwhc8HrkBF+HuUAVOdp w76p2d4EcaBYNCmknp0XyQ2WtKvxa0UjjAklsH+/yJFBHMltU5ua8XMYMsJ8TkL4x8FBcOP6s3 ET8= X-IronPort-AV: E=Sophos;i="5.81,271,1610434800"; d="scan'208";a="120052736" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 23 Mar 2021 01:35:40 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 23 Mar 2021 01:35:40 -0700 Received: from soft-dev3-1.microsemi.net (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Tue, 23 Mar 2021 01:35:37 -0700 From: Horatiu Vultur To: , , , , , , CC: , , , , "Horatiu Vultur" Subject: [PATCH net-next 2/2] net: ocelot: Simplify MRP deletion Date: Tue, 23 Mar 2021 09:33:47 +0100 Message-ID: <20210323083347.1474883-3-horatiu.vultur@microchip.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210323083347.1474883-1-horatiu.vultur@microchip.com> References: <20210323083347.1474883-1-horatiu.vultur@microchip.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Now that the driver will always be notified that the role is deleted before the ring is deleted, then we don't need to duplicate the logic of cleaning the resources also in the delete function. Signed-off-by: Horatiu Vultur --- drivers/net/ethernet/mscc/ocelot_mrp.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot_mrp.c b/drivers/net/ethernet/mscc/ocelot_mrp.c index c3cbcaf64bb2..08b481a93460 100644 --- a/drivers/net/ethernet/mscc/ocelot_mrp.c +++ b/drivers/net/ethernet/mscc/ocelot_mrp.c @@ -154,7 +154,6 @@ int ocelot_mrp_del(struct ocelot *ocelot, int port, const struct switchdev_obj_mrp *mrp) { struct ocelot_port *ocelot_port = ocelot->ports[port]; - int i; if (!ocelot_port) return -EOPNOTSUPP; @@ -162,23 +161,8 @@ int ocelot_mrp_del(struct ocelot *ocelot, int port, if (ocelot_port->mrp_ring_id != mrp->ring_id) return 0; - ocelot_mrp_del_vcap(ocelot, port); - ocelot_mrp_del_vcap(ocelot, port + ocelot->num_phys_ports); - ocelot_port->mrp_ring_id = 0; - for (i = 0; i < ocelot->num_phys_ports; ++i) { - ocelot_port = ocelot->ports[i]; - - if (!ocelot_port) - continue; - - if (ocelot_port->mrp_ring_id != 0) - goto out; - } - - ocelot_mrp_del_mac(ocelot, ocelot->ports[port]); -out: return 0; } EXPORT_SYMBOL(ocelot_mrp_del);