]> git.dujemihanovic.xyz Git - linux.git/commitdiff
gve: Make gve_turn(up|down) ignore stopped queues
authorShailend Chand <shailend@google.com>
Wed, 1 May 2024 23:25:43 +0000 (23:25 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 5 May 2024 13:35:34 +0000 (14:35 +0100)
Currently the queues are either all live or all dead, toggling from one
state to the other via the ndo open and stop hooks. The future addition
of single-queue ndo hooks changes this, and thus gve_turnup and
gve_turndown should evolve to account for a state where some queues are
live and some aren't.

Tested-by: Mina Almasry <almasrymina@google.com>
Reviewed-by: Praveen Kaligineedi <pkaligineedi@google.com>
Reviewed-by: Harshitha Ramamurthy <hramamurthy@google.com>
Signed-off-by: Shailend Chand <shailend@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/google/gve/gve_main.c

index 61039e3dd2bbafd47a9cdb8c94bfa0e4abc1bbab..469a914c71d678c000e11dd0098ade4351ddfc8e 100644 (file)
@@ -1937,12 +1937,16 @@ static void gve_turndown(struct gve_priv *priv)
                int ntfy_idx = gve_tx_idx_to_ntfy(priv, idx);
                struct gve_notify_block *block = &priv->ntfy_blocks[ntfy_idx];
 
+               if (!gve_tx_was_added_to_block(priv, idx))
+                       continue;
                napi_disable(&block->napi);
        }
        for (idx = 0; idx < priv->rx_cfg.num_queues; idx++) {
                int ntfy_idx = gve_rx_idx_to_ntfy(priv, idx);
                struct gve_notify_block *block = &priv->ntfy_blocks[ntfy_idx];
 
+               if (!gve_rx_was_added_to_block(priv, idx))
+                       continue;
                napi_disable(&block->napi);
        }
 
@@ -1965,6 +1969,9 @@ static void gve_turnup(struct gve_priv *priv)
                int ntfy_idx = gve_tx_idx_to_ntfy(priv, idx);
                struct gve_notify_block *block = &priv->ntfy_blocks[ntfy_idx];
 
+               if (!gve_tx_was_added_to_block(priv, idx))
+                       continue;
+
                napi_enable(&block->napi);
                if (gve_is_gqi(priv)) {
                        iowrite32be(0, gve_irq_doorbell(priv, block));
@@ -1977,6 +1984,9 @@ static void gve_turnup(struct gve_priv *priv)
                int ntfy_idx = gve_rx_idx_to_ntfy(priv, idx);
                struct gve_notify_block *block = &priv->ntfy_blocks[ntfy_idx];
 
+               if (!gve_rx_was_added_to_block(priv, idx))
+                       continue;
+
                napi_enable(&block->napi);
                if (gve_is_gqi(priv)) {
                        iowrite32be(0, gve_irq_doorbell(priv, block));