netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] net: mvpp2: Add txq to CPU mapping
@ 2018-09-24  9:11 Maxime Chevallier
  2018-09-24  9:11 ` [PATCH net-next 1/2] net: mvpp2: support XPS by mapping TX queues to CPUs Maxime Chevallier
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Maxime Chevallier @ 2018-09-24  9:11 UTC (permalink / raw)
  To: davem
  Cc: Maxime Chevallier, netdev, linux-kernel, Antoine Tenart,
	thomas.petazzoni, gregory.clement, miquel.raynal, nadavh, stefanc,
	ymarkman, mw

Hi everyone,

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.

Maxime Chevallier (2):
  net: mvpp2: support XPS by mapping TX queues to CPUs
  net: mvpp2: use round-robin scheduling for TX queues on the same CPU

 drivers/net/ethernet/marvell/mvpp2/mvpp2.h      | 1 +
 drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 9 ++++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

-- 
2.11.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net-next 1/2] net: mvpp2: support XPS by mapping TX queues to CPUs
  2018-09-24  9:11 [PATCH net-next 0/2] net: mvpp2: Add txq to CPU mapping Maxime Chevallier
@ 2018-09-24  9:11 ` Maxime Chevallier
  2018-09-24  9:11 ` [PATCH net-next 2/2] net: mvpp2: use round-robin scheduling for TX queues on the same CPU Maxime Chevallier
  2018-09-24 17:01 ` [PATCH net-next 0/2] net: mvpp2: Add txq to CPU mapping David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Maxime Chevallier @ 2018-09-24  9:11 UTC (permalink / raw)
  To: davem
  Cc: Maxime Chevallier, netdev, linux-kernel, Antoine Tenart,
	thomas.petazzoni, gregory.clement, miquel.raynal, nadavh, stefanc,
	ymarkman, mw

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>
---
 drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index d30ccc515bb7..bdacb9577216 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -2423,13 +2423,17 @@ static int mvpp2_setup_rxqs(struct mvpp2_port *port)
 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) {
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net-next 2/2] net: mvpp2: use round-robin scheduling for TX queues on the same CPU
  2018-09-24  9:11 [PATCH net-next 0/2] net: mvpp2: Add txq to CPU mapping Maxime Chevallier
  2018-09-24  9:11 ` [PATCH net-next 1/2] net: mvpp2: support XPS by mapping TX queues to CPUs Maxime Chevallier
@ 2018-09-24  9:11 ` Maxime Chevallier
  2018-09-24 17:01 ` [PATCH net-next 0/2] net: mvpp2: Add txq to CPU mapping David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Maxime Chevallier @ 2018-09-24  9:11 UTC (permalink / raw)
  To: davem
  Cc: Maxime Chevallier, netdev, linux-kernel, Antoine Tenart,
	thomas.petazzoni, gregory.clement, miquel.raynal, nadavh, stefanc,
	ymarkman, mw

This commit allows each TXQ to be picked in a round-robin fashion by
the PPv2 transmit scheduling mechanism. This is opposed to the default
behaviour that prioritizes the highest numbered queues.

Suggested-by: Yan Markman <ymarkman@marvell.com>
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
---
 drivers/net/ethernet/marvell/mvpp2/mvpp2.h      | 1 +
 drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h
index f5dceef60b0e..176c6b56fdcc 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h
@@ -331,6 +331,7 @@
 #define     MVPP2_TXP_SCHED_ENQ_MASK		0xff
 #define     MVPP2_TXP_SCHED_DISQ_OFFSET		8
 #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_MTU_REG			0x801c
 #define     MVPP2_TXP_MTU_MAX			0x7FFFF
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index bdacb9577216..c2ed71788e4f 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -1448,6 +1448,9 @@ static void mvpp2_defaults_set(struct mvpp2_port *port)
 		    tx_port_num);
 	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 */
 	for (queue = 0; queue < MVPP2_MAX_TXQ; queue++) {
 		ptxq = mvpp2_txq_phys(port->id, queue);
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next 0/2] net: mvpp2: Add txq to CPU mapping
  2018-09-24  9:11 [PATCH net-next 0/2] net: mvpp2: Add txq to CPU mapping Maxime Chevallier
  2018-09-24  9:11 ` [PATCH net-next 1/2] net: mvpp2: support XPS by mapping TX queues to CPUs Maxime Chevallier
  2018-09-24  9:11 ` [PATCH net-next 2/2] net: mvpp2: use round-robin scheduling for TX queues on the same CPU Maxime Chevallier
@ 2018-09-24 17:01 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2018-09-24 17:01 UTC (permalink / raw)
  To: maxime.chevallier
  Cc: netdev, linux-kernel, antoine.tenart, thomas.petazzoni,
	gregory.clement, miquel.raynal, nadavh, stefanc, ymarkman, mw

From: Maxime Chevallier <maxime.chevallier@bootlin.com>
Date: Mon, 24 Sep 2018 11:11:04 +0200

> 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.

Series applied, thanks Maxime.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-09-24 17:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-24  9:11 [PATCH net-next 0/2] net: mvpp2: Add txq to CPU mapping Maxime Chevallier
2018-09-24  9:11 ` [PATCH net-next 1/2] net: mvpp2: support XPS by mapping TX queues to CPUs Maxime Chevallier
2018-09-24  9:11 ` [PATCH net-next 2/2] net: mvpp2: use round-robin scheduling for TX queues on the same CPU Maxime Chevallier
2018-09-24 17:01 ` [PATCH net-next 0/2] net: mvpp2: Add txq to CPU mapping David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).