Skip to content

Commit

Permalink
net: mvpp2: handle cases where more CPUs are available than s/w threads
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Antoine Tenart authored and David S. Miller committed Sep 20, 2018
1 parent 074c74d commit e531f76
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 54 deletions.
14 changes: 11 additions & 3 deletions drivers/net/ethernet/marvell/mvpp2/mvpp2.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand All @@ -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;

Expand Down
Loading

0 comments on commit e531f76

Please sign in to comment.