From patchwork Sat Jan 9 00:01:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 12007801 X-Patchwork-Delegate: kuba@kernel.org 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,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 11A0BC433E6 for ; Sat, 9 Jan 2021 00:03:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D9A6B23AA3 for ; Sat, 9 Jan 2021 00:03:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726504AbhAIADl (ORCPT ); Fri, 8 Jan 2021 19:03:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726447AbhAIADf (ORCPT ); Fri, 8 Jan 2021 19:03:35 -0500 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3D62C061796 for ; Fri, 8 Jan 2021 16:02:28 -0800 (PST) Received: by mail-ed1-x52f.google.com with SMTP id cw27so12910188edb.5 for ; Fri, 08 Jan 2021 16:02:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4pl23qWTQMk1sgFRFZr571y1Duw+kqz8+FdVMa1bVZc=; b=OfN6QuMjsSx+rwpRWA7IAHM8ZdU7IiKDJrX18r31CaSjsZ6xZcTwpIdzlMDbwJTLts HHgXDQfbmxypuOreEtL5S2WSw175l0Wh29XuJwi3vHc9HyDVQPwS4Kg34fWZ0qg+wMr/ 0+gErBQn9jStE0MOd51qVlmF4CzJX42c3xsnptr1aiFK87N/bmQEHeVkYqoRkYiNehHo AnxexlA6XBTR8gPd9Ce9FY27KlKbvTh4v1nPvus+fjdDX76MawKKDdCEkAYYObyA2RK7 VFjso9gzXiHAxibqqn3ssGp5wqIoIfgaXsZIOppZEVsFYZtm0+LpI7D2UOGoQhYOcopR 4vOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4pl23qWTQMk1sgFRFZr571y1Duw+kqz8+FdVMa1bVZc=; b=DJ8Gar6vyZWUqkdIJ6O8qBWZYBm8DPbUEn2jLfVNcXpuIqQWaXZDihJDjpR/dkTbQc ui0mbm7/ynsA4ZidgdFpUCrVzQkyOZ9pS58wSUpA/u3S9Kv2ivVLPUFifJ0rLGe4zSvP JTLPONBKd4feoOpEBxWnA+AVTh3aUewH5z5icun0TO940Guh5QDSuLpI4WVmXuW9pNaX lgdWnSikHy2pQu5gfNY/l0ZUbWGeczhmlUVbrmXMSDQ4NZB4VJ8n3nkFAg1XIZt6rkxh xPWmpAMSAh1W3nf0fMUXsCqRE9ULP9OyekJ9dL9TBD+2Wy3HADHSo2iT+hKvKW8wK4oL 5vkA== X-Gm-Message-State: AOAM533LGa8IvMGhEKDha2UqnlYc3c/3QVXhaDG0xKn9jD/WzK5pUgvi oQqQ5TmVRrBrwA+Jm+G0Ivw= X-Google-Smtp-Source: ABdhPJy6x2fRv57aeBSeYzRIE6noQM5OQK7JKpeGYA16sbACaYOTZUN4U0+32yHhOM2aBvyy6ndJ4A== X-Received: by 2002:aa7:dc4b:: with SMTP id g11mr7143105edu.379.1610150547664; Fri, 08 Jan 2021 16:02:27 -0800 (PST) Received: from localhost.localdomain (5-12-227-87.residential.rdsnet.ro. [5.12.227.87]) by smtp.gmail.com with ESMTPSA id dx7sm4045346ejb.120.2021.01.08.16.02.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 16:02:27 -0800 (PST) From: Vladimir Oltean To: "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org Cc: Florian Fainelli , Andrew Lunn , Vivien Didelot , Vladimir Oltean , Kurt Kanzenbach , Hauke Mehrtens , Woojung Huh , Microchip Linux Driver Support , Sean Wang , Landen Chao , Claudiu Manoil , Alexandre Belloni , Linus Walleij , Vadym Kochan , Taras Chornyi , Jiri Pirko , Ido Schimmel , Grygorii Strashko , Ioana Ciornei , Ivan Vecera , Petr Machata Subject: [PATCH v4 net-next 10/11] mlxsw: spectrum_switchdev: remove transactional logic for VLAN objects Date: Sat, 9 Jan 2021 02:01:55 +0200 Message-Id: <20210109000156.1246735-11-olteanv@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210109000156.1246735-1-olteanv@gmail.com> References: <20210109000156.1246735-1-olteanv@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Vladimir Oltean As of commit 457e20d65924 ("mlxsw: spectrum_switchdev: Avoid returning errors in commit phase"), the mlxsw driver performs the VLAN object offloading during the prepare phase. So conversion just seems to be a matter of removing the code that was running in the commit phase. Ido Schimmel explains that the reason why mlxsw_sp_span_respin is called unconditionally is because the bridge driver will ignore -EOPNOTSUPP and actually add the VLAN on the bridge device - see commit 9c86ce2c1ae3 ("net: bridge: Notify about bridge VLANs") and commit ea4721751977 ("mlxsw: spectrum_switchdev: Ignore bridge VLAN events"). Since the VLAN was successfully added on the bridge device, mlxsw_sp_span_respin_work() should be able to resolve the egress port for a packet that is mirrored to a gre tap and passes through the bridge device. Therefore keep the logic as it is. Signed-off-by: Vladimir Oltean Acked-by: Linus Walleij Acked-by: Jiri Pirko Reviewed-by: Ido Schimmel Reviewed-by: Florian Fainelli --- Changes in v4: Added one more paragraph to the commit message. Changes in v3: Restored the comment to its original state. Changes in v2: Rebased on top of VLAN ranges removal. .../mellanox/mlxsw/spectrum_switchdev.c | 37 ++----------------- 1 file changed, 4 insertions(+), 33 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c index 409c206f813f..20c4f3c2cf23 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c @@ -1196,7 +1196,6 @@ mlxsw_sp_br_ban_rif_pvid_change(struct mlxsw_sp *mlxsw_sp, static int mlxsw_sp_port_vlans_add(struct mlxsw_sp_port *mlxsw_sp_port, const struct switchdev_obj_port_vlan *vlan, - struct switchdev_trans *trans, struct netlink_ext_ack *extack) { bool flag_untagged = vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED; @@ -1209,8 +1208,7 @@ static int mlxsw_sp_port_vlans_add(struct mlxsw_sp_port *mlxsw_sp_port, int err = 0; if ((vlan->flags & BRIDGE_VLAN_INFO_BRENTRY) && - br_vlan_enabled(orig_dev) && - switchdev_trans_ph_prepare(trans)) + br_vlan_enabled(orig_dev)) err = mlxsw_sp_br_ban_rif_pvid_change(mlxsw_sp, orig_dev, vlan); if (!err) @@ -1218,9 +1216,6 @@ static int mlxsw_sp_port_vlans_add(struct mlxsw_sp_port *mlxsw_sp_port, return err; } - if (switchdev_trans_ph_commit(trans)) - return 0; - bridge_port = mlxsw_sp_bridge_port_find(mlxsw_sp->bridge, orig_dev); if (WARN_ON(!bridge_port)) return -EINVAL; @@ -1764,16 +1759,13 @@ static int mlxsw_sp_port_obj_add(struct net_device *dev, { struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev); const struct switchdev_obj_port_vlan *vlan; - struct switchdev_trans trans; int err = 0; switch (obj->id) { case SWITCHDEV_OBJ_ID_PORT_VLAN: vlan = SWITCHDEV_OBJ_PORT_VLAN(obj); - trans.ph_prepare = true; - err = mlxsw_sp_port_vlans_add(mlxsw_sp_port, vlan, &trans, - extack); + err = mlxsw_sp_port_vlans_add(mlxsw_sp_port, vlan, extack); /* The event is emitted before the changes are actually * applied to the bridge. Therefore schedule the respin @@ -1781,13 +1773,6 @@ static int mlxsw_sp_port_obj_add(struct net_device *dev, * updated bridge state. */ mlxsw_sp_span_respin(mlxsw_sp_port->mlxsw_sp); - - if (err) - break; - - trans.ph_prepare = false; - err = mlxsw_sp_port_vlans_add(mlxsw_sp_port, vlan, &trans, - extack); break; case SWITCHDEV_OBJ_ID_PORT_MDB: err = mlxsw_sp_port_mdb_add(mlxsw_sp_port, @@ -3351,8 +3336,7 @@ mlxsw_sp_switchdev_vxlan_vlan_del(struct mlxsw_sp *mlxsw_sp, static int mlxsw_sp_switchdev_vxlan_vlans_add(struct net_device *vxlan_dev, struct switchdev_notifier_port_obj_info * - port_obj_info, - struct switchdev_trans *trans) + port_obj_info) { struct switchdev_obj_port_vlan *vlan = SWITCHDEV_OBJ_PORT_VLAN(port_obj_info->obj); @@ -3374,9 +3358,6 @@ mlxsw_sp_switchdev_vxlan_vlans_add(struct net_device *vxlan_dev, port_obj_info->handled = true; - if (switchdev_trans_ph_commit(trans)) - return 0; - bridge_device = mlxsw_sp_bridge_device_find(mlxsw_sp->bridge, br_dev); if (!bridge_device) return -EINVAL; @@ -3427,22 +3408,12 @@ mlxsw_sp_switchdev_handle_vxlan_obj_add(struct net_device *vxlan_dev, struct switchdev_notifier_port_obj_info * port_obj_info) { - struct switchdev_trans trans; int err = 0; switch (port_obj_info->obj->id) { case SWITCHDEV_OBJ_ID_PORT_VLAN: - trans.ph_prepare = true; - err = mlxsw_sp_switchdev_vxlan_vlans_add(vxlan_dev, - port_obj_info, - &trans); - if (err) - break; - - trans.ph_prepare = false; err = mlxsw_sp_switchdev_vxlan_vlans_add(vxlan_dev, - port_obj_info, - &trans); + port_obj_info); break; default: break;