Commit e531f767 authored by Antoine Tenart's avatar Antoine Tenart Committed by David S. Miller

net: mvpp2: handle cases where more CPUs are available than s/w threads

The Marvell PPv2 network controller has 9 internal threads. The driver
works fine when there are less CPUs available than threads. This isn't
true if more CPUs are available. As this is a valid use case, handle
this particular case.
Signed-off-by: default avatarAntoine Tenart <antoine.tenart@bootlin.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 074c74df
...@@ -736,6 +736,11 @@ struct mvpp2 { ...@@ -736,6 +736,11 @@ struct mvpp2 {
int port_count; int port_count;
struct mvpp2_port *port_list[MVPP2_MAX_PORTS]; struct mvpp2_port *port_list[MVPP2_MAX_PORTS];
/* Number of Tx threads used */
unsigned int nthreads;
/* Map of threads needing locking */
unsigned long lock_map;
/* Aggregated TXQs */ /* Aggregated TXQs */
struct mvpp2_tx_queue *aggr_txqs; struct mvpp2_tx_queue *aggr_txqs;
...@@ -814,9 +819,6 @@ struct mvpp2_port { ...@@ -814,9 +819,6 @@ struct mvpp2_port {
void __iomem *base; void __iomem *base;
void __iomem *stats_base; void __iomem *stats_base;
/* Number of threads used on the port */
unsigned int nthreads;
struct mvpp2_rx_queue **rxqs; struct mvpp2_rx_queue **rxqs;
unsigned int nrxqs; unsigned int nrxqs;
struct mvpp2_tx_queue **txqs; struct mvpp2_tx_queue **txqs;
...@@ -828,6 +830,12 @@ struct mvpp2_port { ...@@ -828,6 +830,12 @@ struct mvpp2_port {
/* Per-CPU port control */ /* Per-CPU port control */
struct mvpp2_port_pcpu __percpu *pcpu; struct mvpp2_port_pcpu __percpu *pcpu;
/* Protect the BM refills and the Tx paths when a thread is used on more
* than a single CPU.
*/
spinlock_t bm_lock[MVPP2_MAX_THREADS];
spinlock_t tx_lock[MVPP2_MAX_THREADS];
/* Flags */ /* Flags */
unsigned long flags; unsigned long flags;
......
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