Commit 7aae703f authored by Madalin Bucur's avatar Madalin Bucur Committed by David S. Miller

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: default avatarMadalin Bucur <madalin.bucur@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d484e06e
...@@ -780,7 +780,7 @@ static void dpaa_eth_add_channel(u16 channel) ...@@ -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, ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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;
......
...@@ -569,7 +569,7 @@ static int dpaa_set_coalesce(struct net_device *dev, ...@@ -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, ...@@ -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);
......
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