Skip to content

Commit

Permalink
net: ethernet: ti: am65-cpsw-ethtool: configured critical setting onl…
Browse files Browse the repository at this point in the history
…y when no running netdevs

Ensure that critical setting can only be configured when there are no
running netdevs - all ports are down.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Grygorii Strashko authored and David S. Miller committed Jun 30, 2020
1 parent 7d58d3e commit 3d0fda9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/net/ethernet/ti/am65-cpsw-ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ static int am65_cpsw_set_channels(struct net_device *ndev,
/* Check if interface is up. Can change the num queues when
* the interface is down.
*/
if (netif_running(ndev))
if (common->usage_count)
return -EBUSY;

am65_cpsw_nuss_remove_tx_chns(common);
Expand Down Expand Up @@ -734,6 +734,9 @@ static int am65_cpsw_set_ethtool_priv_flags(struct net_device *ndev, u32 flags)

rrobin = !!(flags & AM65_CPSW_PRIV_P0_RX_PTYPE_RROBIN);

if (common->usage_count)
return -EBUSY;

if (common->est_enabled && rrobin) {
netdev_err(ndev,
"p0-rx-ptype-rrobin flag conflicts with QOS\n");
Expand Down

0 comments on commit 3d0fda9

Please sign in to comment.