dpaa_eth: use only online CPU portals

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 <madalin.bucur@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Madalin Bucur 2019-05-27 15:24:05 +03:00 committed by David S. Miller
parent d484e06e25
commit 7aae703f80
2 changed files with 6 additions and 7 deletions

View File

@ -780,7 +780,7 @@ static void dpaa_eth_add_channel(u16 channel)
struct qman_portal *portal; struct qman_portal *portal;
int cpu; int cpu;
for_each_cpu(cpu, cpus) { for_each_cpu_and(cpu, cpus, cpu_online_mask) {
portal = qman_get_affine_portal(cpu); portal = qman_get_affine_portal(cpu);
qman_p_static_dequeue_add(portal, pool); qman_p_static_dequeue_add(portal, pool);
} }
@ -896,7 +896,7 @@ static void dpaa_fq_setup(struct dpaa_priv *priv,
u16 channels[NR_CPUS]; u16 channels[NR_CPUS];
struct dpaa_fq *fq; 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); channels[num_portals++] = qman_affine_channel(cpu);
if (num_portals == 0) if (num_portals == 0)
@ -2174,7 +2174,6 @@ static int dpaa_eth_poll(struct napi_struct *napi, int budget)
if (cleaned < budget) { if (cleaned < budget) {
napi_complete_done(napi, cleaned); napi_complete_done(napi, cleaned);
qman_p_irqsource_add(np->p, QM_PIRQ_DQRI); qman_p_irqsource_add(np->p, QM_PIRQ_DQRI);
} else if (np->down) { } else if (np->down) {
qman_p_irqsource_add(np->p, QM_PIRQ_DQRI); 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; struct dpaa_percpu_priv *percpu_priv;
int i; int i;
for_each_possible_cpu(i) { for_each_online_cpu(i) {
percpu_priv = per_cpu_ptr(priv->percpu_priv, i); percpu_priv = per_cpu_ptr(priv->percpu_priv, i);
percpu_priv->np.down = 0; 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; struct dpaa_percpu_priv *percpu_priv;
int i; int i;
for_each_possible_cpu(i) { for_each_online_cpu(i) {
percpu_priv = per_cpu_ptr(priv->percpu_priv, i); percpu_priv = per_cpu_ptr(priv->percpu_priv, i);
percpu_priv->np.down = 1; percpu_priv->np.down = 1;

View File

@ -569,7 +569,7 @@ static int dpaa_set_coalesce(struct net_device *dev,
qman_dqrr_get_ithresh(portal, &prev_thresh); qman_dqrr_get_ithresh(portal, &prev_thresh);
/* set new values */ /* set new values */
for_each_cpu(cpu, cpus) { for_each_cpu_and(cpu, cpus, cpu_online_mask) {
portal = qman_get_affine_portal(cpu); portal = qman_get_affine_portal(cpu);
res = qman_portal_set_iperiod(portal, period); res = qman_portal_set_iperiod(portal, period);
if (res) if (res)
@ -586,7 +586,7 @@ static int dpaa_set_coalesce(struct net_device *dev,
revert_values: revert_values:
/* restore previous values */ /* restore previous values */
for_each_cpu(cpu, cpus) { for_each_cpu_and(cpu, cpus, cpu_online_mask) {
if (!needs_revert[cpu]) if (!needs_revert[cpu])
continue; continue;
portal = qman_get_affine_portal(cpu); portal = qman_get_affine_portal(cpu);