]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
net: mvpp2: support XPS by mapping TX queues to CPUs
authorMaxime Chevallier <maxime.chevallier@bootlin.com>
Mon, 24 Sep 2018 09:11:05 +0000 (11:11 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 24 Sep 2018 17:01:10 +0000 (10:01 -0700)
Since the PPv2 controller has multiple TX queues, we can spread traffic
by assining TX queues to CPUs, allowing to use XPS to balance egress
traffic between CPUs.

Suggested-by : Yan Markman <ymarkman@marvell.com>
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c

index d30ccc515bb75524a2422782b8da8b15659ba770..bdacb957721630855b70d76d6df70711c7bfefa5 100644 (file)
@@ -2423,13 +2423,17 @@ err_cleanup:
 static int mvpp2_setup_txqs(struct mvpp2_port *port)
 {
        struct mvpp2_tx_queue *txq;
-       int queue, err;
+       int queue, err, cpu;
 
        for (queue = 0; queue < port->ntxqs; queue++) {
                txq = port->txqs[queue];
                err = mvpp2_txq_init(port, txq);
                if (err)
                        goto err_cleanup;
+
+               /* Assign this queue to a CPU */
+               cpu = queue % num_present_cpus();
+               netif_set_xps_queue(port->dev, cpumask_of(cpu), queue);
        }
 
        if (port->has_tx_irqs) {