From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Cc: "Florian Fainelli" <f.fainelli@gmail.com>,
"Andrew Lunn" <andrew@lunn.ch>,
"Vivien Didelot" <vivien.didelot@gmail.com>,
"Tobias Waldekranz" <tobias@waldekranz.com>,
"DENG Qingfang" <dqfext@gmail.com>,
"Alvin Šipraga" <alsi@bang-olufsen.dk>,
"Kurt Kanzenbach" <kurt@linutronix.de>,
"Hauke Mehrtens" <hauke@hauke-m.de>,
"Woojung Huh" <woojung.huh@microchip.com>,
"UNGLinuxDriver@microchip.com" <UNGLinuxDriver@microchip.com>,
"Sean Wang" <sean.wang@mediatek.com>,
"Landen Chao" <Landen.Chao@mediatek.com>,
"Matthias Brugger" <matthias.bgg@gmail.com>,
"Claudiu Manoil" <claudiu.manoil@nxp.com>,
"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
"Linus Walleij" <linus.walleij@linaro.org>,
"George McCollister" <george.mccollister@gmail.com>
Subject: Re: [PATCH v2 net-next 3/7] net: dsa: hide dp->bridge_dev and dp->bridge_num behind helpers
Date: Sat, 4 Dec 2021 23:27:56 +0000 [thread overview]
Message-ID: <20211204232755.bgxo3x2jk6bf3voh@skbuf> (raw)
In-Reply-To: <20211204201146.4088103-4-vladimir.oltean@nxp.com>
On Sat, Dec 04, 2021 at 10:11:42PM +0200, Vladimir Oltean wrote:
> diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
> index a818df35b239..c583ece83b24 100644
> --- a/drivers/net/dsa/mv88e6xxx/chip.c
> +++ b/drivers/net/dsa/mv88e6xxx/chip.c
> @@ -1647,8 +1645,10 @@ static int mv88e6xxx_atu_new(struct mv88e6xxx_chip *chip, u16 *fid)
> static int mv88e6xxx_port_check_hw_vlan(struct dsa_switch *ds, int port,
> u16 vid)
> {
> + struct dsa_port *dp = dsa_to_port(ds, port), *other_dp;
> struct mv88e6xxx_chip *chip = ds->priv;
> struct mv88e6xxx_vtu_entry vlan;
> + struct net_device *other_br;
> int i, err;
>
> /* DSA and CPU ports have to be members of multiple vlans */
> @@ -1662,27 +1662,30 @@ static int mv88e6xxx_port_check_hw_vlan(struct dsa_switch *ds, int port,
> if (!vlan.valid)
> return 0;
>
> - for (i = 0; i < mv88e6xxx_num_ports(chip); ++i) {
> - if (dsa_is_dsa_port(ds, i) || dsa_is_cpu_port(ds, i))
> + list_for_each_entry(other_dp, &ds->dst->ports, list) {
> + if (other_dp->ds != ds)
> continue;
>
> - if (!dsa_to_port(ds, i)->slave)
> + if (dsa_port_is_dsa(other_dp) || dsa_port_is_cpu(other_dp))
> + continue;
> +
> + if (!other_dp->slave)
> continue;
>
> if (vlan.member[i] ==
Some badly rebased changes from some other patches snuck in and made a
mess out of this. I removed the port iteration using "int i" but did not
remove that variable, and it is also still used.. uninitialized. Will
split the mv88e6xxx conversion to iterate using dp to a separate patch.
> MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_NON_MEMBER)
> continue;
>
> - if (dsa_to_port(ds, i)->bridge_dev ==
> - dsa_to_port(ds, port)->bridge_dev)
> + other_br = dsa_port_bridge_dev_get(other_dp);
> +
> + if (dsa_port_bridge_same(dp, other_dp))
> break; /* same bridge, check next VLAN */
>
> - if (!dsa_to_port(ds, i)->bridge_dev)
> + if (!other_br)
> continue;
>
> dev_err(ds->dev, "p%d: hw VLAN %d already used by port %d in %s\n",
> - port, vlan.vid, i,
> - netdev_name(dsa_to_port(ds, i)->bridge_dev));
> + port, vlan.vid, i, netdev_name(other_br));
> return -EOPNOTSUPP;
> }
next prev parent reply other threads:[~2021-12-04 23:28 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-04 20:11 [PATCH v2 net-next 0/7] Rework DSA bridge TX forwarding offload API Vladimir Oltean
2021-12-04 20:11 ` [PATCH v2 net-next 1/7] net: dsa: make dp->bridge_num one-based Vladimir Oltean
2021-12-04 20:11 ` [PATCH v2 net-next 2/7] net: dsa: assign a bridge number even without TX forwarding offload Vladimir Oltean
2021-12-04 20:11 ` [PATCH v2 net-next 3/7] net: dsa: hide dp->bridge_dev and dp->bridge_num behind helpers Vladimir Oltean
2021-12-04 23:27 ` Vladimir Oltean [this message]
2021-12-04 20:11 ` [PATCH v2 net-next 4/7] net: dsa: rename dsa_port_offloads_bridge to dsa_port_offloads_bridge_dev Vladimir Oltean
2021-12-04 20:11 ` [PATCH v2 net-next 5/7] net: dsa: keep the bridge_dev and bridge_num as part of the same structure Vladimir Oltean
2021-12-04 23:18 ` Vladimir Oltean
2021-12-04 20:11 ` [PATCH v2 net-next 6/7] net: dsa: add a "tx_fwd_offload" argument to ->port_bridge_join Vladimir Oltean
2021-12-06 11:01 ` Alvin Šipraga
2021-12-04 20:11 ` [PATCH v2 net-next 7/7] net: dsa: eliminate dsa_switch_ops :: port_bridge_tx_fwd_{,un}offload Vladimir Oltean
2021-12-06 11:01 ` Alvin Šipraga
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211204232755.bgxo3x2jk6bf3voh@skbuf \
--to=vladimir.oltean@nxp.com \
--cc=Landen.Chao@mediatek.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=alsi@bang-olufsen.dk \
--cc=andrew@lunn.ch \
--cc=claudiu.manoil@nxp.com \
--cc=dqfext@gmail.com \
--cc=f.fainelli@gmail.com \
--cc=george.mccollister@gmail.com \
--cc=hauke@hauke-m.de \
--cc=kurt@linutronix.de \
--cc=linus.walleij@linaro.org \
--cc=matthias.bgg@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=sean.wang@mediatek.com \
--cc=tobias@waldekranz.com \
--cc=vivien.didelot@gmail.com \
--cc=woojung.huh@microchip.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox