Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2235074ybi; Thu, 20 Jun 2019 11:20:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqwd4tFbY9lvBJl99sy3kfMoY5oIafv2wTGkd7z7PWMrpX9KRvdqZkT5j3/0f53LXJQfJ8wz X-Received: by 2002:a17:902:2a6b:: with SMTP id i98mr39468525plb.75.1561054822505; Thu, 20 Jun 2019 11:20:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561054822; cv=none; d=google.com; s=arc-20160816; b=B4XtBODoLGBXc3mUEOj11U1woO0U6vUcMpODXm2EiERuF6bZhd0K0xpEecMPREiOQR /T2A2pArzZ/gxh2fF3avsopH928+X5Y4SG/RF+g5jjPRlWlejriUdRosI02Z9AFJjvDU tU64otO9cDkBBWaGVnnfroXFJbxNnJU9sOk0rnYSOO8yRLvXnEQxXzvGttNJfi+HfKqm z0cVRkO9L9/EL3u1Utv/382ekeOPk02LFHQu3WY5DpH1CxfxtKxrFgBh4KkxO2/8AgvE kCtT4XL/zdBXiZCitn5AcGUA9WrHLvf+iqCMv+4pawVmAwXqhk9kKJb5gL5lfNb96m+i bDTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AI6NlnNRgIocfknIKqU4H4EU0R9gzJN2PGqZIIZA/j4=; b=PdCKPNC+C+zVxs1euAbFPq5n47sNo1xmtxW+Tvx1J5YD+w/xb1vG0sgRI3p/2GGZZB Aj2RDS296GR128tmJkKNDeqSQmWuwC+h016cFj36u8BzppXd6thD9k/nCTeynG7fcL6r x42Nn6pYlLtKtzcvYYJ0jjaINh9Lm0aeJVmjDSLBvtLIBmuCHXbE6fh10fBdTZfPWLk/ YTQ60bpjpPlhE8SzGk+NQPgrf6fi/JwG2EBvRrd+kmF2qFCQDsJjaNh7+e/BytNVlfGU Oe3KZ+Y+BU5HjZ/RifZdW1fovvlex7P7W4pQK+sIAYOAnHMg/cDRerH7Z5DYSvGFRsG4 jT7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hzty2LQP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f17si433666pjq.14.2019.06.20.11.20.07; Thu, 20 Jun 2019 11:20:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hzty2LQP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729720AbfFTSQF (ORCPT + 99 others); Thu, 20 Jun 2019 14:16:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:45124 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729711AbfFTSQE (ORCPT ); Thu, 20 Jun 2019 14:16:04 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 26F47208CA; Thu, 20 Jun 2019 18:16:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561054562; bh=A0ZMX69gc3yuNN1AmuTtB2l1SGUCCmEgsDeBG7r0wa8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hzty2LQPaNRx6e3yYKHi1GbhxVCMb3KF4r9hJ7ec08lVsW/cyyvUE+1Bka27AmH4S kaSwtHgcjWH65riUkM3VYFL41SLmeujqrNbPUEBdrpdfYtb/EhfoLr37U2y5oYtD0d 2lQA20IFfjjOZnp/zkzVyGtpE/sOu5Y9IXJl8yik= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Madalin Bucur , "David S. Miller" , Sasha Levin Subject: [PATCH 5.1 71/98] dpaa_eth: use only online CPU portals Date: Thu, 20 Jun 2019 19:57:38 +0200 Message-Id: <20190620174352.739435973@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190620174349.443386789@linuxfoundation.org> References: <20190620174349.443386789@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 7aae703f8096d21e34ce5f34f16715587bc30902 ] Make sure only the portals for the online CPUs are used. Without this change, there are issues when someone boots with maxcpus=n, with n < actual number of cores available as frames either received or corresponding to the transmit confirmation path would be offered for dequeue to the offline CPU portals, getting lost. Signed-off-by: Madalin Bucur Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 9 ++++----- drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index d3f2408dc9e8..f38c3fa7d705 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -780,7 +780,7 @@ static void dpaa_eth_add_channel(u16 channel) struct qman_portal *portal; int cpu; - for_each_cpu(cpu, cpus) { + for_each_cpu_and(cpu, cpus, cpu_online_mask) { portal = qman_get_affine_portal(cpu); qman_p_static_dequeue_add(portal, pool); } @@ -896,7 +896,7 @@ static void dpaa_fq_setup(struct dpaa_priv *priv, u16 channels[NR_CPUS]; struct dpaa_fq *fq; - for_each_cpu(cpu, affine_cpus) + for_each_cpu_and(cpu, affine_cpus, cpu_online_mask) channels[num_portals++] = qman_affine_channel(cpu); if (num_portals == 0) @@ -2174,7 +2174,6 @@ static int dpaa_eth_poll(struct napi_struct *napi, int budget) if (cleaned < budget) { napi_complete_done(napi, cleaned); qman_p_irqsource_add(np->p, QM_PIRQ_DQRI); - } else if (np->down) { qman_p_irqsource_add(np->p, QM_PIRQ_DQRI); } @@ -2448,7 +2447,7 @@ static void dpaa_eth_napi_enable(struct dpaa_priv *priv) struct dpaa_percpu_priv *percpu_priv; int i; - for_each_possible_cpu(i) { + for_each_online_cpu(i) { percpu_priv = per_cpu_ptr(priv->percpu_priv, i); percpu_priv->np.down = 0; @@ -2461,7 +2460,7 @@ static void dpaa_eth_napi_disable(struct dpaa_priv *priv) struct dpaa_percpu_priv *percpu_priv; int i; - for_each_possible_cpu(i) { + for_each_online_cpu(i) { percpu_priv = per_cpu_ptr(priv->percpu_priv, i); percpu_priv->np.down = 1; diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c b/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c index bdee441bc3b7..7ce2e99b594d 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c @@ -569,7 +569,7 @@ static int dpaa_set_coalesce(struct net_device *dev, qman_dqrr_get_ithresh(portal, &prev_thresh); /* set new values */ - for_each_cpu(cpu, cpus) { + for_each_cpu_and(cpu, cpus, cpu_online_mask) { portal = qman_get_affine_portal(cpu); res = qman_portal_set_iperiod(portal, period); if (res) @@ -586,7 +586,7 @@ static int dpaa_set_coalesce(struct net_device *dev, revert_values: /* restore previous values */ - for_each_cpu(cpu, cpus) { + for_each_cpu_and(cpu, cpus, cpu_online_mask) { if (!needs_revert[cpu]) continue; portal = qman_get_affine_portal(cpu); -- 2.20.1