net: enetc: simplify enetc_num_stack_tx_queues()
authorVladimir Oltean <vladimir.oltean@nxp.com>
Fri, 3 Feb 2023 00:11:13 +0000 (02:11 +0200)
committerJakub Kicinski <kuba@kernel.org>
Sat, 4 Feb 2023 04:05:57 +0000 (20:05 -0800)
We keep a pointer to the xdp_prog in the private netdev structure as
well; what's replicated per RX ring is done so just for more convenient
access from the NAPI poll procedure.

Simplify enetc_num_stack_tx_queues() by looking at priv->xdp_prog rather
than iterating through the information replicated per RX ring.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/freescale/enetc/enetc.c

index 159ae740ba3ccdb291af7ebd5958b49faa49d7d9..3a80f259b17e94618af0a6159e23650e8423d6ac 100644 (file)
@@ -28,11 +28,9 @@ EXPORT_SYMBOL_GPL(enetc_port_mac_wr);
 static int enetc_num_stack_tx_queues(struct enetc_ndev_priv *priv)
 {
        int num_tx_rings = priv->num_tx_rings;
-       int i;
 
-       for (i = 0; i < priv->num_rx_rings; i++)
-               if (priv->rx_ring[i]->xdp.prog)
-                       return num_tx_rings - num_possible_cpus();
+       if (priv->xdp_prog)
+               return num_tx_rings - num_possible_cpus();
 
        return num_tx_rings;
 }