diff options
author | Ioana Ciornei <ioana.ciornei@nxp.com> | 2020-07-14 16:34:28 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-07-15 16:22:36 +0200 |
commit | b53bb527d88ae963bdf9bd71f222cf459fc59d2b (patch) | |
tree | 65586b32963b8f3b72e0c0c52d1739ade9a9aef5 /drivers/staging/fsl-dpaa2 | |
parent | 2cde6410c13d63cc306f395d9fa4b72605468061 (diff) | |
download | linux-b53bb527d88ae963bdf9bd71f222cf459fc59d2b.tar.bz2 |
staging: dpaa2-ethsw: use netif_running when checking for port up
There are some cases where the switch interface needs to be disabled so
that changes in the configuration can be made. In such cases, we should
check for a running interface (bit __LINK_STATE_START of the netdev)
instead of netif_carrier_ok(). This is because on open() we enable the
switch interface even though the link up has not come out yet.
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Link: https://lore.kernel.org/r/20200714133431.17532-4-ioana.ciornei@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/fsl-dpaa2')
-rw-r--r-- | drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c index b57bc705c2ee..a1917842536e 100644 --- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c +++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c @@ -48,7 +48,7 @@ static int ethsw_port_set_pvid(struct ethsw_port_priv *port_priv, u16 pvid) struct ethsw_core *ethsw = port_priv->ethsw_data; struct net_device *netdev = port_priv->netdev; struct dpsw_tci_cfg tci_cfg = { 0 }; - bool is_oper; + bool up; int err, ret; err = dpsw_if_get_tci(ethsw->mc_io, 0, ethsw->dpsw_handle, @@ -61,8 +61,8 @@ static int ethsw_port_set_pvid(struct ethsw_port_priv *port_priv, u16 pvid) tci_cfg.vlan_id = pvid; /* Interface needs to be down to change PVID */ - is_oper = netif_oper_up(netdev); - if (is_oper) { + up = netif_running(netdev); + if (up) { err = dpsw_if_disable(ethsw->mc_io, 0, ethsw->dpsw_handle, port_priv->idx); @@ -85,7 +85,7 @@ static int ethsw_port_set_pvid(struct ethsw_port_priv *port_priv, u16 pvid) port_priv->pvid = pvid; set_tci_error: - if (is_oper) { + if (up) { ret = dpsw_if_enable(ethsw->mc_io, 0, ethsw->dpsw_handle, port_priv->idx); @@ -188,7 +188,7 @@ static int ethsw_port_set_stp_state(struct ethsw_port_priv *port_priv, u8 state) }; int err; - if (!netif_oper_up(port_priv->netdev) || state == port_priv->stp_state) + if (!netif_running(port_priv->netdev) || state == port_priv->stp_state) return 0; /* Nothing to do */ err = dpsw_if_set_stp(port_priv->ethsw_data->mc_io, 0, |