Skip to content

Commit 7ff2ea0

Browse files
committed
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: David S. Miller <davem@davemloft.net>
2 parents 12ba7e1 + 4251ea5 commit 7ff2ea0

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

‎drivers/net/ethernet/marvell/mvpp2/mvpp2.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@
331331
#define MVPP2_TXP_SCHED_ENQ_MASK 0xff
332332
#define MVPP2_TXP_SCHED_DISQ_OFFSET 8
333333
#define MVPP2_TXP_SCHED_CMD_1_REG 0x8010
334+
#define MVPP2_TXP_SCHED_FIXED_PRIO_REG 0x8014
334335
#define MVPP2_TXP_SCHED_PERIOD_REG 0x8018
335336
#define MVPP2_TXP_SCHED_MTU_REG 0x801c
336337
#define MVPP2_TXP_MTU_MAX 0x7FFFF

‎drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1448,6 +1448,9 @@ static void mvpp2_defaults_set(struct mvpp2_port *port)
14481448
tx_port_num);
14491449
mvpp2_write(port->priv, MVPP2_TXP_SCHED_CMD_1_REG, 0);
14501450

1451+
/* Set TXQ scheduling to Round-Robin */
1452+
mvpp2_write(port->priv, MVPP2_TXP_SCHED_FIXED_PRIO_REG, 0);
1453+
14511454
/* Close bandwidth for all queues */
14521455
for (queue = 0; queue < MVPP2_MAX_TXQ; queue++) {
14531456
ptxq = mvpp2_txq_phys(port->id, queue);
@@ -2423,13 +2426,17 @@ static int mvpp2_setup_rxqs(struct mvpp2_port *port)
24232426
static int mvpp2_setup_txqs(struct mvpp2_port *port)
24242427
{
24252428
struct mvpp2_tx_queue *txq;
2426-
int queue, err;
2429+
int queue, err, cpu;
24272430

24282431
for (queue = 0; queue < port->ntxqs; queue++) {
24292432
txq = port->txqs[queue];
24302433
err = mvpp2_txq_init(port, txq);
24312434
if (err)
24322435
goto err_cleanup;
2436+
2437+
/* Assign this queue to a CPU */
2438+
cpu = queue % num_present_cpus();
2439+
netif_set_xps_queue(port->dev, cpumask_of(cpu), queue);
24332440
}
24342441

24352442
if (port->has_tx_irqs) {

0 commit comments

Comments
 (0)