Skip to content

Commit

Permalink
net: mana: Allow setting the number of queues while the NIC is down
Browse files Browse the repository at this point in the history
The existing code doesn't allow setting the number of queues while the
NIC is down.

Update the ethtool handler functions to support setting the number of
queues while the NIC is at down state.

Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Haiyang Zhang authored and David S. Miller committed Oct 26, 2021
1 parent eafaa88 commit a137c06
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
19 changes: 9 additions & 10 deletions drivers/net/ethernet/microsoft/mana/mana_en.c
Original file line number Diff line number Diff line change
Expand Up @@ -1667,24 +1667,23 @@ int mana_attach(struct net_device *ndev)
if (err)
return err;

err = mana_alloc_queues(ndev);
if (err) {
kfree(apc->rxqs);
apc->rxqs = NULL;
return err;
if (apc->port_st_save) {
err = mana_alloc_queues(ndev);
if (err) {
mana_cleanup_port_context(apc);
return err;
}
}

netif_device_attach(ndev);

apc->port_is_up = apc->port_st_save;

/* Ensure port state updated before txq state */
smp_wmb();

if (apc->port_is_up) {
if (apc->port_is_up)
netif_carrier_on(ndev);
netif_tx_wake_all_queues(ndev);
}

netif_device_attach(ndev);

return 0;
}
Expand Down
3 changes: 0 additions & 3 deletions drivers/net/ethernet/microsoft/mana/mana_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,6 @@ static int mana_set_channels(struct net_device *ndev,
unsigned int old_count = apc->num_queues;
int err, err2;

if (!apc->port_is_up)
return -EOPNOTSUPP;

err = mana_detach(ndev, false);
if (err) {
netdev_err(ndev, "mana_detach failed: %d\n", err);
Expand Down

0 comments on commit a137c06

Please sign in to comment.