[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201128192410.GG2191767@lunn.ch>
Date: Sat, 28 Nov 2020 20:24:10 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Steen Hegelund <steen.hegelund@...rochip.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Masahiro Yamada <masahiroy@...nel.org>,
Lars Povlsen <lars.povlsen@...rochip.com>,
Bjarni Jonasson <bjarni.jonasson@...rochip.com>,
Microchip Linux Driver Support <UNGLinuxDriver@...rochip.com>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Microsemi List <microsemi@...ts.bootlin.com>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 2/3] net: sparx5: Add Sparx5 switchdev driver
> +static void sparx5_attr_stp_state_set(struct sparx5_port *port,
> + struct switchdev_trans *trans,
> + u8 state)
> +{
> + struct sparx5 *sparx5 = port->sparx5;
> +
> + if (!test_bit(port->portno, sparx5->bridge_mask)) {
> + netdev_err(port->ndev,
> + "Controlling non-bridged port %d?\n", port->portno);
> + return;
> + }
> +
> + switch (state) {
> + case BR_STATE_FORWARDING:
> + set_bit(port->portno, sparx5->bridge_fwd_mask);
> + break;
> + default:
> + clear_bit(port->portno, sparx5->bridge_fwd_mask);
> + break;
> + }
That is pretty odd. What about listening, learning, blocking?
> +static int sparx5_port_bridge_join(struct sparx5_port *port,
> + struct net_device *bridge)
> +{
> + struct sparx5 *sparx5 = port->sparx5;
> +
> + if (bitmap_empty(sparx5->bridge_mask, SPX5_PORTS))
> + /* First bridged port */
> + sparx5->hw_bridge_dev = bridge;
> + else
> + if (sparx5->hw_bridge_dev != bridge)
> + /* This is adding the port to a second bridge, this is
> + * unsupported
> + */
> + return -ENODEV;
> +
> + set_bit(port->portno, sparx5->bridge_mask);
> +
> + /* Port enters in bridge mode therefor don't need to copy to CPU
> + * frames for multicast in case the bridge is not requesting them
> + */
> + __dev_mc_unsync(port->ndev, sparx5_mc_unsync);
> +
> + return 0;
> +}
This looks suspiciously empty? Don't you need to tell the hardware
which ports this port is bridges to? Normally you see some code which
walks all the ports and finds those in the same bridge, and sets a bit
which allows these ports to talk to each other. Is that code somewhere
else?
Andrew
Powered by blists - more mailing lists