Commit b2d4f385 authored by Madalin Bucur's avatar Madalin Bucur Committed by Greg Kroah-Hartman

dpaa_eth: use only online CPU portals

[ Upstream commit 7aae703f ]

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: default avatarMadalin Bucur <madalin.bucur@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 71af3fad
......@@ -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;
......
......@@ -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);
......
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