From patchwork Mon Sep 7 18:29:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 261392 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=-12.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, 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 2C164C43461 for ; Mon, 7 Sep 2020 18:29:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D225F2137B for ; Mon, 7 Sep 2020 18:29:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AbSmBqlg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729843AbgIGS34 (ORCPT ); Mon, 7 Sep 2020 14:29:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729988AbgIGS31 (ORCPT ); Mon, 7 Sep 2020 14:29:27 -0400 Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DFFCC061756 for ; Mon, 7 Sep 2020 11:29:27 -0700 (PDT) Received: by mail-ed1-x543.google.com with SMTP id ay8so13577779edb.8 for ; Mon, 07 Sep 2020 11:29:27 -0700 (PDT) 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=dWhxqZfcp5IwqdYuDqo2Ku5a3gYbdWodl/y599LW0+s=; b=AbSmBqlgGOmK475cRBeOwQfEQ0ZqmQ8YQc3/S4I8VqSLabG5KeFeGUODvuC9uFi9/b mZVdeIe0x1T97CKPlJaiq1ybVyKfDos/hONXh6doP1WqUXKsO8wUU44RjYBS3k8UbBQ0 dAnE818kIseaHlBwaMmVFKBZEO9ImNB3HTyJUKcUzWuVj5w+N6S6ZtMtB5nrsSpCVKiR p1JXyR9gYpFMn8/S+SS7sF8VDv+HAw//r1oq13znAya/AapCe0LqLM0PbXS/XpL6unqZ CXI2BYjxBghNCF3TVXcxe7wFyJ2TXjeFYLsKPcvhWkoCYuvSP975Kw/+2AYg1w7ZivPI 8lPw== 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=dWhxqZfcp5IwqdYuDqo2Ku5a3gYbdWodl/y599LW0+s=; b=Ux1Mgx6CctEaDj6yokDGcfWGqBQs1JwIMgr7Tb1NhcBMzlsQ3U6MwmdptckoBEGcV+ q63FxAfH1ig+8y++E5R7O8zC+ShycZs2sDQ9ZWZdkN/D5w6xbK9c/Xz9N12Z8dVZHz0C vV+zSemo1gPwGVpx5Rr1Mf71gdjPhb/R7traecoadxJTLX2DcEfahanM3jLpIemoH4W5 NKrcNvo235YcGEv1PLgfHkz9Tzrmp7Ovr/7nr8JH4p+39VWjTpraXZcDDQNVy9nkGRJs 3AsyRq8nzp/ucr+PhV7NhKwEcqh4j9mIwB03b8yQ2cJ4rpMCQhjxk2HKMKEbmUzjfaW+ qcpw== X-Gm-Message-State: AOAM5310OeE6l+cq6WpDt8BVtXG4NI3CBw4Uc7QPitn5Q3UFkh8xBcWf qkOi0x5UJJXOWEK17wPT0bQ= X-Google-Smtp-Source: ABdhPJw2fbjrzoZ1GsGy6w+Wnbe42VkN0fTEZ3eZYYxC9aKOby2mE0wNMl9HCAreOttG3tlh/ts1wg== X-Received: by 2002:aa7:dcc1:: with SMTP id w1mr22247345edu.360.1599503365931; Mon, 07 Sep 2020 11:29:25 -0700 (PDT) Received: from localhost.localdomain ([188.25.217.212]) by smtp.gmail.com with ESMTPSA id g24sm11746816edy.51.2020.09.07.11.29.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Sep 2020 11:29:25 -0700 (PDT) From: Vladimir Oltean To: davem@davemloft.net Cc: f.fainelli@gmail.com, vivien.didelot@gmail.com, andrew@lunn.ch, netdev@vger.kernel.org Subject: [PATCH net-next 3/4] Revert "net: dsa: Add more convenient functions for installing port VLANs" Date: Mon, 7 Sep 2020 21:29:09 +0300 Message-Id: <20200907182910.1285496-4-olteanv@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200907182910.1285496-1-olteanv@gmail.com> References: <20200907182910.1285496-1-olteanv@gmail.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Vladimir Oltean This reverts commit 314f76d7a68bab0516aa52877944e6aacfa0fc3f. Citing that commit message, the call graph was: dsa_slave_vlan_rx_add_vid dsa_port_setup_8021q_tagging | | | | | +-------------+ | | v v dsa_port_vid_add dsa_slave_port_obj_add | | +-------+ +-------+ | | v v dsa_port_vlan_add Now that tag_8021q has its own ops structure, it no longer relies on dsa_port_vid_add, and therefore on the dsa_switch_ops to install its VLANs. So dsa_port_vid_add now only has one single caller. So we can simplify the call graph to what it was before, aka: dsa_slave_vlan_rx_add_vid dsa_slave_port_obj_add | | +-------+ +-------+ | | v v dsa_port_vlan_add Signed-off-by: Vladimir Oltean --- net/dsa/dsa_priv.h | 2 -- net/dsa/port.c | 33 --------------------------------- net/dsa/slave.c | 34 +++++++++++++++++++++++++++++++--- 3 files changed, 31 insertions(+), 38 deletions(-) diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h index 1653e3377cb3..2da656d984ef 100644 --- a/net/dsa/dsa_priv.h +++ b/net/dsa/dsa_priv.h @@ -164,8 +164,6 @@ int dsa_port_vlan_add(struct dsa_port *dp, struct switchdev_trans *trans); int dsa_port_vlan_del(struct dsa_port *dp, const struct switchdev_obj_port_vlan *vlan); -int dsa_port_vid_add(struct dsa_port *dp, u16 vid, u16 flags); -int dsa_port_vid_del(struct dsa_port *dp, u16 vid); int dsa_port_link_register_of(struct dsa_port *dp); void dsa_port_link_unregister_of(struct dsa_port *dp); extern const struct phylink_mac_ops dsa_port_phylink_mac_ops; diff --git a/net/dsa/port.c b/net/dsa/port.c index e23ece229c7e..46c9bf709683 100644 --- a/net/dsa/port.c +++ b/net/dsa/port.c @@ -433,39 +433,6 @@ int dsa_port_vlan_del(struct dsa_port *dp, return dsa_port_notify(dp, DSA_NOTIFIER_VLAN_DEL, &info); } -int dsa_port_vid_add(struct dsa_port *dp, u16 vid, u16 flags) -{ - struct switchdev_obj_port_vlan vlan = { - .obj.id = SWITCHDEV_OBJ_ID_PORT_VLAN, - .flags = flags, - .vid_begin = vid, - .vid_end = vid, - }; - struct switchdev_trans trans; - int err; - - trans.ph_prepare = true; - err = dsa_port_vlan_add(dp, &vlan, &trans); - if (err) - return err; - - trans.ph_prepare = false; - return dsa_port_vlan_add(dp, &vlan, &trans); -} -EXPORT_SYMBOL(dsa_port_vid_add); - -int dsa_port_vid_del(struct dsa_port *dp, u16 vid) -{ - struct switchdev_obj_port_vlan vlan = { - .obj.id = SWITCHDEV_OBJ_ID_PORT_VLAN, - .vid_begin = vid, - .vid_end = vid, - }; - - return dsa_port_vlan_del(dp, &vlan); -} -EXPORT_SYMBOL(dsa_port_vid_del); - static struct phy_device *dsa_port_get_phy_device(struct dsa_port *dp) { struct device_node *phy_dn; diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 9af1a2d0cec4..e429c71df854 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -1233,7 +1233,15 @@ static int dsa_slave_vlan_rx_add_vid(struct net_device *dev, __be16 proto, u16 vid) { struct dsa_port *dp = dsa_slave_to_port(dev); + struct switchdev_obj_port_vlan vlan = { + .obj.id = SWITCHDEV_OBJ_ID_PORT_VLAN, + .vid_begin = vid, + .vid_end = vid, + /* This API only allows programming tagged, non-PVID VIDs */ + .flags = 0, + }; struct bridge_vlan_info info; + struct switchdev_trans trans; int ret; /* Check for a possible bridge VLAN entry now since there is no @@ -1252,11 +1260,25 @@ static int dsa_slave_vlan_rx_add_vid(struct net_device *dev, __be16 proto, return -EBUSY; } - ret = dsa_port_vid_add(dp, vid, 0); + /* User port... */ + trans.ph_prepare = true; + ret = dsa_port_vlan_add(dp, &vlan, &trans); + if (ret) + return ret; + + trans.ph_prepare = false; + ret = dsa_port_vlan_add(dp, &vlan, &trans); if (ret) return ret; - ret = dsa_port_vid_add(dp->cpu_dp, vid, 0); + /* And CPU port... */ + trans.ph_prepare = true; + ret = dsa_port_vlan_add(dp->cpu_dp, &vlan, &trans); + if (ret) + return ret; + + trans.ph_prepare = false; + ret = dsa_port_vlan_add(dp->cpu_dp, &vlan, &trans); if (ret) return ret; @@ -1267,6 +1289,12 @@ static int dsa_slave_vlan_rx_kill_vid(struct net_device *dev, __be16 proto, u16 vid) { struct dsa_port *dp = dsa_slave_to_port(dev); + struct switchdev_obj_port_vlan vlan = { + .vid_begin = vid, + .vid_end = vid, + /* This API only allows programming tagged, non-PVID VIDs */ + .flags = 0, + }; struct bridge_vlan_info info; int ret; @@ -1289,7 +1317,7 @@ static int dsa_slave_vlan_rx_kill_vid(struct net_device *dev, __be16 proto, /* Do not deprogram the CPU port as it may be shared with other user * ports which can be members of this VLAN as well. */ - return dsa_port_vid_del(dp, vid); + return dsa_port_vlan_del(dp, &vlan); } struct dsa_hw_port { From patchwork Mon Sep 7 18:29:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 261391 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=-12.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, 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 6A739C433E2 for ; Mon, 7 Sep 2020 18:30:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 26B4520738 for ; Mon, 7 Sep 2020 18:30:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HWd6jYc0" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730180AbgIGSaD (ORCPT ); Mon, 7 Sep 2020 14:30:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729989AbgIGS3a (ORCPT ); Mon, 7 Sep 2020 14:29:30 -0400 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74F3AC061757 for ; Mon, 7 Sep 2020 11:29:28 -0700 (PDT) Received: by mail-ej1-x643.google.com with SMTP id z22so19257595ejl.7 for ; Mon, 07 Sep 2020 11:29:28 -0700 (PDT) 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=1Ps3PxhHjd/PVa0haOcvBJPLEGvt7wuhy6VTU6LLRHk=; b=HWd6jYc0dzWajnQV597aEZze4Yg/otuvkwYhoSIB27PBKN5+/vGpCpzC6skr/R2xFq 0El3pxD59afXFNGPl3AjFIe6Wd46aKqfnTZKoQH+iKCBPT36TneW3nJsV8138AUolRZE 864phscTckC2mEtiyj9JJ8uaVqalhHzZgVv2pqz/FcUlr5/PKzf76Zu+ur6HvLtCZkE/ HPoVmrffsnNzkMT2Y5D1OshecoJZlw0saXecq4MUlN4aViGnNKppVd5ZaI+Ud55fglWD 5H4+RPneLH+8pKDxPuxYJ5V/sIce6ZviqujpC2WBeQMiEybGstMPRmQAQzbwwCmZOre1 pSMA== 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=1Ps3PxhHjd/PVa0haOcvBJPLEGvt7wuhy6VTU6LLRHk=; b=llo+Zbno7jhknow4d5G5Oa8Q0NiuRro25lxeSdyZhNCgNGfram3wEZPXDsBGqKdlKI djye9vkFu8W0m08Y8viiS/iFSjAbljJEDdczgoFKIZ34IurZtfazIZP0PBx5GoGYpINt BYQAvBdX22hEasJoqI5E9J9ACsm4H10yz0IY0LnzAd9tLPHIF2SNuDNI9z5F9m5D07Qh ZZitkURZOUMroe+V0Etsl2UhzhjoAodG7Ssij4KB4AM7OJTb7B9Ri04H8hIm/hjcV6wy /g1Xq3unQ3m5Hwea/srRXXP4HH1r70EDR34I20LGpmdQCYFEdbY2nRAVFKWUj+Afgn5B 1MsQ== X-Gm-Message-State: AOAM531eM42z7LizerEt4Cwzqhl32Ndx6pFU7tu+wKkcdFYab0HstX53 2iC16/6pj152EIqU6/7GgTU= X-Google-Smtp-Source: ABdhPJz6bh8GlvEVoe0rOQzkwBnpI4x//xHPx4cmZ5+q4VtPUkRJ9LQbvKn9ZR+CTaNYCdetflaB2A== X-Received: by 2002:a17:906:2b97:: with SMTP id m23mr22718897ejg.61.1599503367061; Mon, 07 Sep 2020 11:29:27 -0700 (PDT) Received: from localhost.localdomain ([188.25.217.212]) by smtp.gmail.com with ESMTPSA id g24sm11746816edy.51.2020.09.07.11.29.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Sep 2020 11:29:26 -0700 (PDT) From: Vladimir Oltean To: davem@davemloft.net Cc: f.fainelli@gmail.com, vivien.didelot@gmail.com, andrew@lunn.ch, netdev@vger.kernel.org Subject: [PATCH net-next 4/4] net: dsa: set configure_vlan_while_not_filtering to true by default Date: Mon, 7 Sep 2020 21:29:10 +0300 Message-Id: <20200907182910.1285496-5-olteanv@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200907182910.1285496-1-olteanv@gmail.com> References: <20200907182910.1285496-1-olteanv@gmail.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Vladimir Oltean As explained in commit 54a0ed0df496 ("net: dsa: provide an option for drivers to always receive bridge VLANs"), DSA has historically been skipping VLAN switchdev operations when the bridge wasn't in vlan_filtering mode, but the reason why it was doing that has never been clear. So the configure_vlan_while_not_filtering option is there merely to preserve functionality for existing drivers. It isn't some behavior that drivers should opt into. Ideally, when all drivers leave this flag set, we can delete the dsa_port_skip_vlan_configuration() function. New drivers always seem to omit setting this flag, for some reason. So let's reverse the logic: the DSA core sets it by default to true before the .setup() callback, and legacy drivers can turn it off. This way, new drivers get the new behavior by default, unless they explicitly set the flag to false, which is more obvious during review. Remove the assignment from drivers which were setting it to true, and add the assignment to false for the drivers that didn't previously have it. This way, it should be easier to see how many we have left. The following drivers: lan9303, mv88e6060 were skipped from setting this flag to false, because they didn't have any VLAN offload ops in the first place. Also, print a message to the console every time a VLAN has been skipped. This is mildly annoying on purpose, so that (a) it is at least clear that VLANs are being skipped - the legacy behavior in itself is confusing - and (b) people have one more incentive to convert to the new behavior. No behavior change except for the added prints is intended at this time. Signed-off-by: Vladimir Oltean --- drivers/net/dsa/b53/b53_common.c | 1 + drivers/net/dsa/bcm_sf2.c | 1 + drivers/net/dsa/dsa_loop.c | 1 - drivers/net/dsa/lantiq_gswip.c | 3 +++ drivers/net/dsa/microchip/ksz8795.c | 2 ++ drivers/net/dsa/microchip/ksz9477.c | 2 ++ drivers/net/dsa/mt7530.c | 1 - drivers/net/dsa/mv88e6xxx/chip.c | 1 + drivers/net/dsa/ocelot/felix.c | 1 - drivers/net/dsa/qca/ar9331.c | 2 ++ drivers/net/dsa/qca8k.c | 1 - drivers/net/dsa/rtl8366rb.c | 2 ++ drivers/net/dsa/sja1105/sja1105_main.c | 2 -- net/dsa/dsa2.c | 2 ++ net/dsa/slave.c | 29 +++++++++++++++++++------- 15 files changed, 38 insertions(+), 13 deletions(-) diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c index 26fcff85d881..d127cdda16e8 100644 --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c @@ -1011,6 +1011,7 @@ static int b53_setup(struct dsa_switch *ds) * devices. (not hardware supported) */ ds->vlan_filtering_is_global = true; + ds->configure_vlan_while_not_filtering = false; return ret; } diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c index 3263e8a0ae67..f9587a73fe54 100644 --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c @@ -1242,6 +1242,7 @@ static int bcm_sf2_sw_probe(struct platform_device *pdev) /* Advertise the 8 egress queues */ ds->num_tx_queues = SF2_NUM_EGRESS_QUEUES; + ds->configure_vlan_while_not_filtering = false; dev_set_drvdata(&pdev->dev, priv); diff --git a/drivers/net/dsa/dsa_loop.c b/drivers/net/dsa/dsa_loop.c index b588614d1e5e..65b5c1a50282 100644 --- a/drivers/net/dsa/dsa_loop.c +++ b/drivers/net/dsa/dsa_loop.c @@ -343,7 +343,6 @@ static int dsa_loop_drv_probe(struct mdio_device *mdiodev) ds->dev = &mdiodev->dev; ds->ops = &dsa_loop_driver; ds->priv = ps; - ds->configure_vlan_while_not_filtering = true; ps->bus = mdiodev->bus; dev_set_drvdata(&mdiodev->dev, ds); diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c index 521ebc072903..8622d836cbd3 100644 --- a/drivers/net/dsa/lantiq_gswip.c +++ b/drivers/net/dsa/lantiq_gswip.c @@ -837,6 +837,9 @@ static int gswip_setup(struct dsa_switch *ds) } gswip_port_enable(ds, cpu_port, NULL); + + ds->configure_vlan_while_not_filtering = false; + return 0; } diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c index 8f1d15ea15d9..03d65dc5a304 100644 --- a/drivers/net/dsa/microchip/ksz8795.c +++ b/drivers/net/dsa/microchip/ksz8795.c @@ -1087,6 +1087,8 @@ static int ksz8795_setup(struct dsa_switch *ds) ksz_init_mib_timer(dev); + ds->configure_vlan_while_not_filtering = false; + return 0; } diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c index 3cb22d149813..fea265ca6f82 100644 --- a/drivers/net/dsa/microchip/ksz9477.c +++ b/drivers/net/dsa/microchip/ksz9477.c @@ -1357,6 +1357,8 @@ static int ksz9477_setup(struct dsa_switch *ds) ksz_init_mib_timer(dev); + ds->configure_vlan_while_not_filtering = false; + return 0; } diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 1aaf47a0da2b..4698e740f8fc 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -1220,7 +1220,6 @@ mt7530_setup(struct dsa_switch *ds) * as two netdev instances. */ dn = dsa_to_port(ds, MT7530_CPU_PORT)->master->dev.of_node->parent; - ds->configure_vlan_while_not_filtering = true; if (priv->id == ID_MT7530) { regulator_set_voltage(priv->core_pwr, 1000000, 1000000); diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index 15b97a4f8d93..6948c6980092 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -3090,6 +3090,7 @@ static int mv88e6xxx_setup(struct dsa_switch *ds) chip->ds = ds; ds->slave_mii_bus = mv88e6xxx_default_mdio_bus(chip); + ds->configure_vlan_while_not_filtering = false; mv88e6xxx_reg_lock(chip); diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index a1e1d3824110..2032c046a056 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -612,7 +612,6 @@ static int felix_setup(struct dsa_switch *ds) ANA_FLOODING, tc); ds->mtu_enforcement_ingress = true; - ds->configure_vlan_while_not_filtering = true; return 0; } diff --git a/drivers/net/dsa/qca/ar9331.c b/drivers/net/dsa/qca/ar9331.c index e24a99031b80..20ac64219df2 100644 --- a/drivers/net/dsa/qca/ar9331.c +++ b/drivers/net/dsa/qca/ar9331.c @@ -328,6 +328,8 @@ static int ar9331_sw_setup(struct dsa_switch *ds) if (ret) goto error; + ds->configure_vlan_while_not_filtering = false; + return 0; error: dev_err_ratelimited(priv->dev, "%s: %i\n", __func__, ret); diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c index f1e484477e35..e05b9cc39231 100644 --- a/drivers/net/dsa/qca8k.c +++ b/drivers/net/dsa/qca8k.c @@ -1442,7 +1442,6 @@ qca8k_sw_probe(struct mdio_device *mdiodev) priv->ds->dev = &mdiodev->dev; priv->ds->num_ports = QCA8K_NUM_PORTS; - priv->ds->configure_vlan_while_not_filtering = true; priv->ds->priv = priv; priv->ops = qca8k_switch_ops; priv->ds->ops = &priv->ops; diff --git a/drivers/net/dsa/rtl8366rb.c b/drivers/net/dsa/rtl8366rb.c index f763f93f600f..c518ab49b968 100644 --- a/drivers/net/dsa/rtl8366rb.c +++ b/drivers/net/dsa/rtl8366rb.c @@ -958,6 +958,8 @@ static int rtl8366rb_setup(struct dsa_switch *ds) return -ENODEV; } + ds->configure_vlan_while_not_filtering = false; + return 0; } diff --git a/drivers/net/dsa/sja1105/sja1105_main.c b/drivers/net/dsa/sja1105/sja1105_main.c index 045077252799..e2cee36f578f 100644 --- a/drivers/net/dsa/sja1105/sja1105_main.c +++ b/drivers/net/dsa/sja1105/sja1105_main.c @@ -3047,8 +3047,6 @@ static int sja1105_setup(struct dsa_switch *ds) ds->mtu_enforcement_ingress = true; - ds->configure_vlan_while_not_filtering = true; - rc = sja1105_setup_devlink_params(ds); if (rc < 0) return rc; diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c index c0ffc7a2b65f..4a5e2832009b 100644 --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c @@ -414,6 +414,8 @@ static int dsa_switch_setup(struct dsa_switch *ds) if (err) goto unregister_devlink; + ds->configure_vlan_while_not_filtering = true; + err = ds->ops->setup(ds); if (err < 0) goto unregister_notifier; diff --git a/net/dsa/slave.c b/net/dsa/slave.c index e429c71df854..e0c86e97bb78 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -314,11 +314,14 @@ static int dsa_slave_vlan_add(struct net_device *dev, if (obj->orig_dev != dev) return -EOPNOTSUPP; - if (dsa_port_skip_vlan_configuration(dp)) - return 0; - vlan = *SWITCHDEV_OBJ_PORT_VLAN(obj); + if (dsa_port_skip_vlan_configuration(dp)) { + netdev_warn(dev, "skipping configuration of VLAN %d-%d\n", + vlan.vid_begin, vlan.vid_end); + return 0; + } + err = dsa_port_vlan_add(dp, &vlan, trans); if (err) return err; @@ -377,17 +380,23 @@ static int dsa_slave_vlan_del(struct net_device *dev, const struct switchdev_obj *obj) { struct dsa_port *dp = dsa_slave_to_port(dev); + struct switchdev_obj_port_vlan *vlan; if (obj->orig_dev != dev) return -EOPNOTSUPP; - if (dsa_port_skip_vlan_configuration(dp)) + vlan = SWITCHDEV_OBJ_PORT_VLAN(obj); + + if (dsa_port_skip_vlan_configuration(dp)) { + netdev_warn(dev, "skipping deletion of VLAN %d-%d\n", + vlan->vid_begin, vlan->vid_end); return 0; + } /* Do not deprogram the CPU port as it may be shared with other user * ports which can be members of this VLAN as well. */ - return dsa_port_vlan_del(dp, SWITCHDEV_OBJ_PORT_VLAN(obj)); + return dsa_port_vlan_del(dp, vlan); } static int dsa_slave_port_obj_del(struct net_device *dev, @@ -1248,8 +1257,11 @@ static int dsa_slave_vlan_rx_add_vid(struct net_device *dev, __be16 proto, * need to emulate the switchdev prepare + commit phase. */ if (dp->bridge_dev) { - if (dsa_port_skip_vlan_configuration(dp)) + if (dsa_port_skip_vlan_configuration(dp)) { + netdev_warn(dev, "skipping configuration of VLAN %d\n", + vid); return 0; + } /* br_vlan_get_info() returns -EINVAL or -ENOENT if the * device, respectively the VID is not found, returning @@ -1302,8 +1314,11 @@ static int dsa_slave_vlan_rx_kill_vid(struct net_device *dev, __be16 proto, * need to emulate the switchdev prepare + commit phase. */ if (dp->bridge_dev) { - if (dsa_port_skip_vlan_configuration(dp)) + if (dsa_port_skip_vlan_configuration(dp)) { + netdev_warn(dev, "skipping deletion of VLAN %d\n", + vid); return 0; + } /* br_vlan_get_info() returns -EINVAL or -ENOENT if the * device, respectively the VID is not found, returning