linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: davem@davemloft.net
Cc: Maxime Chevallier <maxime.chevallier@bootlin.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Antoine Tenart <antoine.tenart@bootlin.com>,
	thomas.petazzoni@bootlin.com, gregory.clement@bootlin.com,
	miquel.raynal@bootlin.com, nadavh@marvell.com,
	stefanc@marvell.com, ymarkman@marvell.com, mw@semihalf.com
Subject: [PATCH net-next 13/18] net: mvpp2: make sure we don't spread load on disabled CPUs
Date: Thu, 12 Jul 2018 13:54:22 +0200	[thread overview]
Message-ID: <20180712115427.27375-14-maxime.chevallier@bootlin.com> (raw)
In-Reply-To: <20180712115427.27375-1-maxime.chevallier@bootlin.com>

When filling the RSS table, we have to make sure that the rx queue is
attached to an online CPU.

This patch is not a full support for cpu_hotplug, but rather a way to
make sure that we don't break network on system booted with the maxcpus
parameter.

Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
---
 drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c
index 7dafc8c425b8..f2bcfa8f1dfd 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c
@@ -109,11 +109,17 @@ void mvpp2_cls_oversize_rxq_set(struct mvpp2_port *port)
 
 static inline u32 mvpp22_rxfh_indir(struct mvpp2_port *port, u32 rxq)
 {
-	int nrxqs, cpus = num_possible_cpus();
+	int nrxqs, cpu, cpus = num_possible_cpus();
 
 	/* Number of RXQs per CPU */
 	nrxqs = port->nrxqs / cpus;
 
+	/* CPU that will handle this rx queue */
+	cpu = rxq / nrxqs;
+
+	if (!cpu_online(cpu))
+		return port->first_rxq;
+
 	/* Indirection to better distribute the paquets on the CPUs when
 	 * configuring the RSS queues.
 	 */
-- 
2.11.0


  parent reply	other threads:[~2018-07-12 11:55 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-12 11:54 [PATCH net-next 00/18] net: mvpp2: add RSS support Maxime Chevallier
2018-07-12 11:54 ` [PATCH net-next 01/18] net: mvpp2: fix include guards in mvpp2_prs.h Maxime Chevallier
2018-07-12 11:54 ` [PATCH net-next 02/18] net: mvpp2: define the number of RSS entries per table in mvpp2.h Maxime Chevallier
2018-07-12 11:54 ` [PATCH net-next 03/18] net: mvpp2: make sure we use single queue mode on PPv2.1 Maxime Chevallier
2018-07-12 14:10   ` Sergei Shtylyov
2018-07-12 11:54 ` [PATCH net-next 04/18] net: mvpp2: make multi queue mode the default mode Maxime Chevallier
2018-07-12 11:54 ` [PATCH net-next 05/18] net: mvpp2: use RSS only when using multi-queue mode Maxime Chevallier
2018-07-12 11:54 ` [PATCH net-next 06/18] net: mvpp2: fix hardcoded number of rx queues Maxime Chevallier
2018-07-12 11:54 ` [PATCH net-next 07/18] net: mvpp2: use only one rx queue per port per CPU Maxime Chevallier
2018-07-12 11:54 ` [PATCH net-next 08/18] net: mvpp2: fix a typo in the RSS code Maxime Chevallier
2018-07-12 11:54 ` [PATCH net-next 09/18] net: mvpp2: fix RSS register definitions Maxime Chevallier
2018-07-12 11:54 ` [PATCH net-next 10/18] net: mvpp2: use one RSS table per port Maxime Chevallier
2018-07-12 11:54 ` [PATCH net-next 11/18] net: mvpp2: RSS indirection table support Maxime Chevallier
2018-07-12 11:54 ` [PATCH net-next 12/18] net: mvpp2: improve the distribution of packets on CPUs when using RSS Maxime Chevallier
2018-07-12 11:54 ` Maxime Chevallier [this message]
2018-07-12 11:54 ` [PATCH net-next 14/18] net: mvpp2: rename per-port RSS init function Maxime Chevallier
2018-07-12 11:54 ` [PATCH net-next 15/18] net: mvpp2: use classifier to assign default rx queue Maxime Chevallier
2018-07-12 11:54 ` [PATCH net-next 16/18] net: mvpp2: split ingress traffic into multiple flows Maxime Chevallier
2018-07-12 11:54 ` [PATCH net-next 17/18] net: mvpp2: add an RSS classification step for each flow Maxime Chevallier
2018-07-12 11:54 ` [PATCH net-next 18/18] net: mvpp2: allow setting RSS flow hash parameters with ethtool Maxime Chevallier
2018-07-13  0:31 ` [PATCH net-next 00/18] net: mvpp2: add RSS support David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180712115427.27375-14-maxime.chevallier@bootlin.com \
    --to=maxime.chevallier@bootlin.com \
    --cc=antoine.tenart@bootlin.com \
    --cc=davem@davemloft.net \
    --cc=gregory.clement@bootlin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=mw@semihalf.com \
    --cc=nadavh@marvell.com \
    --cc=netdev@vger.kernel.org \
    --cc=stefanc@marvell.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=ymarkman@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).