Commit 7ff2ea0b authored by David S. Miller's avatar David S. Miller

Merge branch 'mvpp2-Add-txq-to-CPU-mapping'

Maxime Chevallier says:

====================
net: mvpp2: Add txq to CPU mapping

This short series adds XPS support to the mvpp2 driver, by mapping
txqs and CPUs. This comes with a patch using round-robin scheduling
for the HW to pick the next txq to transmit from, instead of the default
fixed-priority scheduling.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 12ba7e10 4251ea5b
...@@ -331,6 +331,7 @@ ...@@ -331,6 +331,7 @@
#define MVPP2_TXP_SCHED_ENQ_MASK 0xff #define MVPP2_TXP_SCHED_ENQ_MASK 0xff
#define MVPP2_TXP_SCHED_DISQ_OFFSET 8 #define MVPP2_TXP_SCHED_DISQ_OFFSET 8
#define MVPP2_TXP_SCHED_CMD_1_REG 0x8010 #define MVPP2_TXP_SCHED_CMD_1_REG 0x8010
#define MVPP2_TXP_SCHED_FIXED_PRIO_REG 0x8014
#define MVPP2_TXP_SCHED_PERIOD_REG 0x8018 #define MVPP2_TXP_SCHED_PERIOD_REG 0x8018
#define MVPP2_TXP_SCHED_MTU_REG 0x801c #define MVPP2_TXP_SCHED_MTU_REG 0x801c
#define MVPP2_TXP_MTU_MAX 0x7FFFF #define MVPP2_TXP_MTU_MAX 0x7FFFF
......
...@@ -1448,6 +1448,9 @@ static void mvpp2_defaults_set(struct mvpp2_port *port) ...@@ -1448,6 +1448,9 @@ static void mvpp2_defaults_set(struct mvpp2_port *port)
tx_port_num); tx_port_num);
mvpp2_write(port->priv, MVPP2_TXP_SCHED_CMD_1_REG, 0); mvpp2_write(port->priv, MVPP2_TXP_SCHED_CMD_1_REG, 0);
/* Set TXQ scheduling to Round-Robin */
mvpp2_write(port->priv, MVPP2_TXP_SCHED_FIXED_PRIO_REG, 0);
/* Close bandwidth for all queues */ /* Close bandwidth for all queues */
for (queue = 0; queue < MVPP2_MAX_TXQ; queue++) { for (queue = 0; queue < MVPP2_MAX_TXQ; queue++) {
ptxq = mvpp2_txq_phys(port->id, queue); ptxq = mvpp2_txq_phys(port->id, queue);
...@@ -2423,13 +2426,17 @@ static int mvpp2_setup_rxqs(struct mvpp2_port *port) ...@@ -2423,13 +2426,17 @@ static int mvpp2_setup_rxqs(struct mvpp2_port *port)
static int mvpp2_setup_txqs(struct mvpp2_port *port) static int mvpp2_setup_txqs(struct mvpp2_port *port)
{ {
struct mvpp2_tx_queue *txq; struct mvpp2_tx_queue *txq;
int queue, err; int queue, err, cpu;
for (queue = 0; queue < port->ntxqs; queue++) { for (queue = 0; queue < port->ntxqs; queue++) {
txq = port->txqs[queue]; txq = port->txqs[queue];
err = mvpp2_txq_init(port, txq); err = mvpp2_txq_init(port, txq);
if (err) if (err)
goto err_cleanup; 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) { if (port->has_tx_irqs) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment