diff options
author | Antoine Tenart <antoine.tenart@bootlin.com> | 2018-09-19 12:27:10 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-09-20 07:09:54 +0300 |
commit | e531f76757eb9f3314957cee24e6e9a0fa4aa98c (patch) | |
tree | 2dbf5244b523c17a2df682a898dab3e5c6973060 /drivers/net/ethernet/marvell/mvpp2/mvpp2.h | |
parent | 074c74dfcb33757d893598181914ef7bc703fa9d (diff) | |
download | linux-e531f76757eb9f3314957cee24e6e9a0fa4aa98c.tar.xz |
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: Antoine Tenart <antoine.tenart@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/marvell/mvpp2/mvpp2.h')
-rw-r--r-- | drivers/net/ethernet/marvell/mvpp2/mvpp2.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h index 0280856ff6ec..f5dceef60b0e 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h @@ -736,6 +736,11 @@ struct mvpp2 { int port_count; 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 */ struct mvpp2_tx_queue *aggr_txqs; @@ -814,9 +819,6 @@ struct mvpp2_port { void __iomem *base; void __iomem *stats_base; - /* Number of threads used on the port */ - unsigned int nthreads; - struct mvpp2_rx_queue **rxqs; unsigned int nrxqs; struct mvpp2_tx_queue **txqs; @@ -828,6 +830,12 @@ struct mvpp2_port { /* Per-CPU port control */ 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 */ unsigned long flags; |