From patchwork Sat Mar 6 00:24:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Waldekranz X-Patchwork-Id: 12119647 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=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 81335C433E0 for ; Sat, 6 Mar 2021 00:27:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 49B8D65009 for ; Sat, 6 Mar 2021 00:27:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229929AbhCFA1Z (ORCPT ); Fri, 5 Mar 2021 19:27:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229592AbhCFA0w (ORCPT ); Fri, 5 Mar 2021 19:26:52 -0500 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F18B5C061760 for ; Fri, 5 Mar 2021 16:26:51 -0800 (PST) Received: by mail-lj1-x229.google.com with SMTP id 2so5286338ljr.5 for ; Fri, 05 Mar 2021 16:26:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=waldekranz-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:organization:content-transfer-encoding; bh=dmHRm/whosWCJYEELWBVZq2d/imABHUEc3ev6dE2DgU=; b=F9suN9VHL3OAp/rkWWAY5Vcey2Sb8j72zocD/G83gum3023mL4boUm29mQFj7DCism Cu26o4c7zxLR3g6qXdd99uTDHUT3f02qAPPogt+0WCh+136YdDPaw8bgS3DxuMixoeYO jyfU84xPpnD6LMGOOroi6QJswnOK/AHuVw58H47y8gepBwcJCy1dhE5fVnz9DduNPpmR XeS9odNWSarBZqj2R1wgarsCKHyPDzQNWtseocYl63PNz9X0Kkg8oju6IDLLrIH26SVC 12B57EUwQwbDa+KyzPY86UXTfLZEEkTTYzclZlUeGJ5IMcutinBWawkJFYP8+T7BjgkU RQhg== 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:organization:content-transfer-encoding; bh=dmHRm/whosWCJYEELWBVZq2d/imABHUEc3ev6dE2DgU=; b=B/fBRDgIPcMD70IW2/u1WX71mulhmB5If3C802Nm8c94YQZRJwuJDn7cNZvPDOq8a8 CWiDZannkKsRnWOvTkGdD8CGQS5R7OF40Nzpp75MDBkmY5jY5Ik5HaAhnJlRulogczrp sTDsK/aOrxJ9rxYNvhELELIvR3QyCMPAeE6ytfNVbHQCO7Rl7i0Ah001t8bNz4RxWBvb wK8u2EJQ3fpiFrqMPiKgljBxioL6cq5Bhtc4izsEnEqJ6HtapRB5en2BbmcLxPnmf/rh YtM6BBv/0ejMcre0WqihYecNDAQXSEfd9FWzkEsHBlXXtVJk4buIMxb2MOBjyUcjj7Xx VKQQ== X-Gm-Message-State: AOAM5322pUNMqrHY1S4e8DetIgavznEwvbYjFmqlBPYDvB+/rgmMdgHh a+a7AFahqgVfwfjmA8gvmaVTww== X-Google-Smtp-Source: ABdhPJx/kgrH132E41iDPbVSFK0cZ/VRa0Lex3BcmeU3dLszvfQ748eVdMZh+s4v53vdDOIrOtXTww== X-Received: by 2002:a2e:b55a:: with SMTP id a26mr4810780ljn.297.1614990410535; Fri, 05 Mar 2021 16:26:50 -0800 (PST) Received: from veiron.westermo.com (static-193-12-47-89.cust.tele2.se. [193.12.47.89]) by smtp.gmail.com with ESMTPSA id r5sm488678lfc.235.2021.03.05.16.26.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Mar 2021 16:26:50 -0800 (PST) From: Tobias Waldekranz To: davem@davemloft.net, kuba@kernel.org Cc: andrew@lunn.ch, vivien.didelot@gmail.com, f.fainelli@gmail.com, olteanv@gmail.com, netdev@vger.kernel.org Subject: [PATCH net 1/2] Revert "net: dsa: fix SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING getting ignored" Date: Sat, 6 Mar 2021 01:24:54 +0100 Message-Id: <20210306002455.1582593-2-tobias@waldekranz.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210306002455.1582593-1-tobias@waldekranz.com> References: <20210306002455.1582593-1-tobias@waldekranz.com> MIME-Version: 1.0 Organization: Westermo Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This reverts commit 99b8202b179fc3dbbca69e8af6da660224c9d676. DSA should indeed react to certain switchdev attributes where orig_dev is the bridge master. But the fix was too broad, causing the driver to misinterpret VLAN objects added to the bridge master as objects added to the ports. Signed-off-by: Tobias Waldekranz --- net/dsa/dsa_priv.h | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h index 2eeaa42f2e08..d40dfede494c 100644 --- a/net/dsa/dsa_priv.h +++ b/net/dsa/dsa_priv.h @@ -236,15 +236,7 @@ static inline bool dsa_port_offloads_netdev(struct dsa_port *dp, /* Switchdev offloading can be configured on: */ if (dev == dp->slave) - /* DSA ports directly connected to a bridge, and event - * was emitted for the ports themselves. - */ - return true; - - if (dp->bridge_dev == dev) - /* DSA ports connected to a bridge, and event was emitted - * for the bridge. - */ + /* DSA ports directly connected to a bridge. */ return true; if (dp->lag_dev == dev) From patchwork Sat Mar 6 00:24:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Waldekranz X-Patchwork-Id: 12119651 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=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 955F1C433E6 for ; Sat, 6 Mar 2021 00:27:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 65F3D65081 for ; Sat, 6 Mar 2021 00:27:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229950AbhCFA10 (ORCPT ); Fri, 5 Mar 2021 19:27:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229651AbhCFA0x (ORCPT ); Fri, 5 Mar 2021 19:26:53 -0500 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C052CC061760 for ; Fri, 5 Mar 2021 16:26:52 -0800 (PST) Received: by mail-lj1-x22b.google.com with SMTP id q14so5298037ljp.4 for ; Fri, 05 Mar 2021 16:26:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=waldekranz-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:organization:content-transfer-encoding; bh=oDoIk1yzAHwQSxAa8k8D9ltRoRL6h7whx75BifLj1Bw=; b=u00hw+kTzS/AHe1pmVGZTQ+ul8jF9q1N9DxAnRdkvoY85iiExN/IMuLA41QFAyGylm 94gUZUsn7CRA8hS/KqW/QpIkQmKGsJwyXLhb7eg0AzqPYoOGWyDeE43w4pVs9InBKGN+ 9rn5KeYVYhtiAV8QpgPaokufsm+DEPKhn1dV3lXWeUch2ESrHzjX8vVnlNAL2w6D+z8R GP1U+N0FB7GqcFB1bJU+wFqOWTU6Gdb1uao5lQ+Er8DAZsdm32G8sAw4Yxu78wrOGGNW xI32EkX71xcWQ3IialtBEUdQNMfIYyVdZW7Luc9x4Rd5Fx/Tyu7vqAIheTNQ7kdTQwrP 0tDg== 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:organization:content-transfer-encoding; bh=oDoIk1yzAHwQSxAa8k8D9ltRoRL6h7whx75BifLj1Bw=; b=Re/pD0eXmlAful1gnP1pBHxvy99OQGtNHlHQixGg3rQx2cTP2d/5yuo2doQgPGBLa8 Qk3KDcdznF+bkHLD3pvvo1BQcjqKOPbPo9eKMK9memwNPWSV5/1ggeaOPucwRBb40N/O JoHOPSEpKSLtXNdYXVf+wMg9Ezc281p/coQ9NV75yMsPI3y7uY7tHjXkYO9bswrkAS3m yJVeY5YA77NrrnFwaRHwy8kDWiJDKlrb5OHkEoO94vDnQtqwRbT9WdO2R18HtFL1xFFe Hm/LBJbM8GV/hOapjqruiK/9qn/++KgKjHetdvUK0pcRrXbHYRYsOdm3HB1u10nEu1s7 jxkg== X-Gm-Message-State: AOAM530nemBRE88ESbhJGpBfzFw2aqgkqMpIgL2Yvu8qEKKnFG51qgUp tEtoCnkWbZg5sWktsmp9CZYzcA== X-Google-Smtp-Source: ABdhPJyxVMJ2oGfNTIJVz8xUSqcl/sXUx7+Dw68qHGxrZNjI5sf+pP4rQ0Fam89pQbCqgFQOA/MWCw== X-Received: by 2002:a2e:320c:: with SMTP id y12mr6944754ljy.360.1614990411336; Fri, 05 Mar 2021 16:26:51 -0800 (PST) Received: from veiron.westermo.com (static-193-12-47-89.cust.tele2.se. [193.12.47.89]) by smtp.gmail.com with ESMTPSA id r5sm488678lfc.235.2021.03.05.16.26.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Mar 2021 16:26:50 -0800 (PST) From: Tobias Waldekranz To: davem@davemloft.net, kuba@kernel.org Cc: andrew@lunn.ch, vivien.didelot@gmail.com, f.fainelli@gmail.com, olteanv@gmail.com, netdev@vger.kernel.org Subject: [PATCH net 2/2] net: dsa: Always react to global bridge attribute changes Date: Sat, 6 Mar 2021 01:24:55 +0100 Message-Id: <20210306002455.1582593-3-tobias@waldekranz.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210306002455.1582593-1-tobias@waldekranz.com> References: <20210306002455.1582593-1-tobias@waldekranz.com> MIME-Version: 1.0 Organization: Westermo Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This is the second attempt to provide a fix for the issue described in 99b8202b179f, which was reverted in the previous commit. When a change is made to some global bridge attribute, such as VLAN filtering, accept events where orig_dev is the bridge master netdev. Separate the validation of orig_dev based on whether the attribute in question is global or per-port. Fixes: 5696c8aedfcc ("net: dsa: Don't offload port attributes on standalone ports") Signed-off-by: Tobias Waldekranz Reported-by: Tobias Waldekranz Signed-off-by: Vladimir Oltean Reported-by: Tobias Waldekranz Signed-off-by: Vladimir Oltean --- net/dsa/slave.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 491e3761b5f4..63ee2cae4d8e 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -278,8 +278,21 @@ static int dsa_slave_port_attr_set(struct net_device *dev, struct dsa_port *dp = dsa_slave_to_port(dev); int ret; - if (!dsa_port_offloads_netdev(dp, attr->orig_dev)) - return -EOPNOTSUPP; + switch (attr->id) { + case SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING: + case SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME: + case SWITCHDEV_ATTR_ID_BRIDGE_MROUTER: + /* For global bridge settings, the originating device + * may be the bridge itself. + */ + if (netif_is_bridge_master(attr->orig_dev)) + break; + + fallthrough; + default: + if (!dsa_port_offloads_netdev(dp, attr->orig_dev)) + return -EOPNOTSUPP; + } switch (attr->id) { case SWITCHDEV_ATTR_ID_PORT_STP_STATE: