]> git.baikalelectronics.ru Git - kernel.git/commitdiff
gve: Correct available tx qpl check
authorCatherine Sullivan <csully@google.com>
Wed, 6 Oct 2021 02:42:19 +0000 (19:42 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 6 Oct 2021 14:04:26 +0000 (15:04 +0100)
The qpl_map_size is rounded up to a multiple of sizeof(long), but the
number of qpls doesn't have to be.

Fixes: a4381dfb8043d ("gve: Add transmit and receive support")
Signed-off-by: Catherine Sullivan <csully@google.com>
Signed-off-by: Jeroen de Borst <jeroendb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/google/gve/gve.h

index 1d3188e8e3b3c01caa84c3edbf332cd0c1fa5dd2..92dc18a4bcc41c233e97e693a85359d86f4b95cb 100644 (file)
@@ -780,7 +780,7 @@ struct gve_queue_page_list *gve_assign_rx_qpl(struct gve_priv *priv)
                                    gve_num_tx_qpls(priv));
 
        /* we are out of rx qpls */
-       if (id == priv->qpl_cfg.qpl_map_size)
+       if (id == gve_num_tx_qpls(priv) + gve_num_rx_qpls(priv))
                return NULL;
 
        set_bit(id, priv->qpl_cfg.qpl_id_map);