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. ====================
Unified · Split
| @@ -331,6 +331,7 @@ · 330 unmodified lines | |||
| 331 | #define MVPP2_TXP_SCHED_ENQ_MASK 0xff | 331 | #define MVPP2_TXP_SCHED_ENQ_MASK 0xff |
| 332 | #define MVPP2_TXP_SCHED_DISQ_OFFSET 8 | 332 | #define MVPP2_TXP_SCHED_DISQ_OFFSET 8 |
| 333 | #define MVPP2_TXP_SCHED_CMD_1_REG 0x8010 | 333 | #define MVPP2_TXP_SCHED_CMD_1_REG 0x8010 |
| 334 | #define MVPP2_TXP_SCHED_FIXED_PRIO_REG 0x8014 | ||
| 334 | #define MVPP2_TXP_SCHED_PERIOD_REG 0x8018 | 335 | #define MVPP2_TXP_SCHED_PERIOD_REG 0x8018 |
| 335 | #define MVPP2_TXP_SCHED_MTU_REG 0x801c | 336 | #define MVPP2_TXP_SCHED_MTU_REG 0x801c |
| 336 | #define MVPP2_TXP_MTU_MAX 0x7FFFF | 337 | #define MVPP2_TXP_MTU_MAX 0x7FFFF |
| @@ -1448,6 +1448,9 @@ static void mvpp2_defaults_set(struct mvpp2_port *port) · 1447 unmodified lines | |||
| 1448 | tx_port_num); | 1448 | tx_port_num); |
| 1449 | mvpp2_write(port->priv, MVPP2_TXP_SCHED_CMD_1_REG, 0); | 1449 | mvpp2_write(port->priv, MVPP2_TXP_SCHED_CMD_1_REG, 0); |
| 1450 | 1450 | ||
| 1451 | /* Set TXQ scheduling to Round-Robin */ | ||
| 1452 | mvpp2_write(port->priv, MVPP2_TXP_SCHED_FIXED_PRIO_REG, 0); | ||
| 1453 | |||
| 1451 | /* Close bandwidth for all queues */ | 1454 | /* Close bandwidth for all queues */ |
| 1452 | for (queue = 0; queue < MVPP2_MAX_TXQ; queue++) { | 1455 | for (queue = 0; queue < MVPP2_MAX_TXQ; queue++) { |
| 1453 | ptxq = mvpp2_txq_phys(port->id, queue); | 1456 | ptxq = mvpp2_txq_phys(port->id, queue); |
| @@ -2423,13 +2426,17 @@ err_cleanup: · 969 unmodified lines | |||
| 2423 | static int mvpp2_setup_txqs(struct mvpp2_port *port) | 2426 | static int mvpp2_setup_txqs(struct mvpp2_port *port) |
| 2424 | { | 2427 | { |
| 2425 | struct mvpp2_tx_queue *txq; | 2428 | struct mvpp2_tx_queue *txq; |
| 2426 | int queue, err; | 2429 | int queue, err, cpu; |
| 2427 | 2430 | ||
| 2428 | for (queue = 0; queue < port->ntxqs; queue++) { | 2431 | for (queue = 0; queue < port->ntxqs; queue++) { |
| 2429 | txq = port->txqs[queue]; | 2432 | txq = port->txqs[queue]; |
| 2430 | err = mvpp2_txq_init(port, txq); | 2433 | err = mvpp2_txq_init(port, txq); |
| 2431 | if (err) | 2434 | if (err) |
| 2432 | goto err_cleanup; | 2435 | 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); | ||
| 2433 | } | 2440 | } |
| 2434 | 2441 | ||
| 2435 | if (port->has_tx_irqs) { | 2442 | if (port->has_tx_irqs) { |