From: Florian Fainelli <f.fainelli@gmail.com>
To: Vivien Didelot <vivien.didelot@gmail.com>, netdev@vger.kernel.org
Cc: marek.behun@nic.cz, davem@davemloft.net, andrew@lunn.ch
Subject: Re: [PATCH net-next 2/6] net: dsa: do not enable or disable non user ports
Date: Mon, 19 Aug 2019 10:16:22 -0700 [thread overview]
Message-ID: <14cac8d6-c134-733b-ac27-079061acfb0c@gmail.com> (raw)
In-Reply-To: <20190818173548.19631-3-vivien.didelot@gmail.com>
On 8/18/19 10:35 AM, Vivien Didelot wrote:
> The .port_enable and .port_disable operations are currently only
> called for user ports, hence assuming they have a slave device. In
> preparation for using these operations for other port types as well,
> simply guard all implementations against non user ports and return
> directly in such case.
>
> Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com>
> ---
[snip]
>
diff --git a/drivers/net/dsa/b53/b53_common.c
b/drivers/net/dsa/b53/b53_common.c
> index 907af62846ba..1639ea7b7dab 100644
> --- a/drivers/net/dsa/b53/b53_common.c
> +++ b/drivers/net/dsa/b53/b53_common.c
> @@ -510,10 +510,15 @@ EXPORT_SYMBOL(b53_imp_vlan_setup);
> int b53_enable_port(struct dsa_switch *ds, int port, struct phy_device *phy)
> {
> struct b53_device *dev = ds->priv;
> - unsigned int cpu_port = ds->ports[port].cpu_dp->index;
> + unsigned int cpu_port;
> int ret = 0;
> u16 pvlan;
>
> + if (!dsa_is_user_port(ds, port))
> + return 0;
> +
> + cpu_port = ds->ports[port].cpu_dp->index;
> +
> if (dev->ops->irq_enable)
> ret = dev->ops->irq_enable(dev, port);
> if (ret)
> @@ -547,6 +552,9 @@ void b53_disable_port(struct dsa_switch *ds, int port)
> struct b53_device *dev = ds->priv;
> u8 reg;
>
> + if (!dsa_is_user_port(ds, port))
> + return;
> +
> /* Disable Tx/Rx for the port */
> b53_read8(dev, B53_CTRL_PAGE, B53_PORT_CTRL(port), ®);
> reg |= PORT_CTRL_RX_DISABLE | PORT_CTRL_TX_DISABLE;
For b53, the changes are correct, for bcm_sf2, see comments below:
> diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
> index 49f99436018a..3d06262817bd 100644
> --- a/drivers/net/dsa/bcm_sf2.c
> +++ b/drivers/net/dsa/bcm_sf2.c
> @@ -157,6 +157,9 @@ static int bcm_sf2_port_setup(struct dsa_switch *ds, int port,
> unsigned int i;
> u32 reg;
>
> + if (!dsa_is_user_port(ds, port))
> + return 0;
> +
> /* Clear the memory power down */
> reg = core_readl(priv, CORE_MEM_PSM_VDD_CTRL);
> reg &= ~P_TXQ_PSM_VDD(port);
> @@ -222,6 +225,9 @@ static void bcm_sf2_port_disable(struct dsa_switch *ds, int port)
> struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
> u32 reg;
>
> + if (!dsa_is_user_port(ds, port))
> + return;
in bcm_sf2_sw_suspend(), we do call bcm_sf2_port_disable() against the
user and CPU port.
--
Florian
next prev parent reply other threads:[~2019-08-19 17:16 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-18 17:35 [PATCH net-next 0/6] net: dsa: enable and disable all ports Vivien Didelot
2019-08-18 17:35 ` [PATCH net-next 1/6] net: dsa: use a single switch statement for port setup Vivien Didelot
2019-08-19 17:14 ` Florian Fainelli
2019-08-19 17:20 ` Vivien Didelot
2019-08-18 17:35 ` [PATCH net-next 2/6] net: dsa: do not enable or disable non user ports Vivien Didelot
2019-08-19 17:16 ` Florian Fainelli [this message]
2019-08-18 17:35 ` [PATCH net-next 3/6] net: dsa: enable and disable all ports Vivien Didelot
2019-08-19 17:17 ` Florian Fainelli
2019-08-19 17:32 ` Marek Behun
2019-08-19 18:03 ` Vivien Didelot
2019-08-18 17:35 ` [PATCH net-next 4/6] net: dsa: mv88e6xxx: do not change STP state on port disabling Vivien Didelot
2019-08-19 13:40 ` Andrew Lunn
2019-08-19 15:27 ` Vivien Didelot
2019-08-19 16:10 ` Andrew Lunn
2019-08-19 16:27 ` Vivien Didelot
2019-08-19 16:44 ` Andrew Lunn
2019-08-18 17:35 ` [PATCH net-next 5/6] net: dsa: mv88e6xxx: enable SERDES after setup Vivien Didelot
2019-08-18 17:35 ` [PATCH net-next 6/6] net: dsa: mv88e6xxx: wrap SERDES IRQ in power function Vivien Didelot
2019-08-19 20:11 ` [PATCH net-next 0/6] net: dsa: enable and disable all ports David Miller
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=14cac8d6-c134-733b-ac27-079061acfb0c@gmail.com \
--to=f.fainelli@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=marek.behun@nic.cz \
--cc=netdev@vger.kernel.org \
--cc=vivien.didelot@gmail.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;
as well as URLs for NNTP newsgroup(s).