Commit ff3edc9b authored by Arnd Bergmann's avatar Arnd Bergmann Committed by David S. Miller

hns_enet: use cpumask_var_t for on-stack mask

On large SMP builds, we can run into a build warning:

drivers/net/ethernet/hisilicon/hns/hns_enet.c: In function 'hns_set_irq_affinity.isra.27':
drivers/net/ethernet/hisilicon/hns/hns_enet.c:1242:1: warning: the frame size of 1032 bytes is larger than 1024 bytes [-Wframe-larger-than=]

The solution here is to use cpumask_var_t, which can use dynamic
allocation when CONFIG_CPUMASK_OFFSTACK is enabled.
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ceef438d
...@@ -1202,43 +1202,48 @@ static void hns_set_irq_affinity(struct hns_nic_priv *priv) ...@@ -1202,43 +1202,48 @@ static void hns_set_irq_affinity(struct hns_nic_priv *priv)
struct hns_nic_ring_data *rd; struct hns_nic_ring_data *rd;
int i; int i;
int cpu; int cpu;
cpumask_t mask; cpumask_var_t mask;
if (!alloc_cpumask_var(&mask, GFP_KERNEL))
return;
/*diffrent irq banlance for 16core and 32core*/ /*diffrent irq banlance for 16core and 32core*/
if (h->q_num == num_possible_cpus()) { if (h->q_num == num_possible_cpus()) {
for (i = 0; i < h->q_num * 2; i++) { for (i = 0; i < h->q_num * 2; i++) {
rd = &priv->ring_data[i]; rd = &priv->ring_data[i];
if (cpu_online(rd->queue_index)) { if (cpu_online(rd->queue_index)) {
cpumask_clear(&mask); cpumask_clear(mask);
cpu = rd->queue_index; cpu = rd->queue_index;
cpumask_set_cpu(cpu, &mask); cpumask_set_cpu(cpu, mask);
(void)irq_set_affinity_hint(rd->ring->irq, (void)irq_set_affinity_hint(rd->ring->irq,
&mask); mask);
} }
} }
} else { } else {
for (i = 0; i < h->q_num; i++) { for (i = 0; i < h->q_num; i++) {
rd = &priv->ring_data[i]; rd = &priv->ring_data[i];
if (cpu_online(rd->queue_index * 2)) { if (cpu_online(rd->queue_index * 2)) {
cpumask_clear(&mask); cpumask_clear(mask);
cpu = rd->queue_index * 2; cpu = rd->queue_index * 2;
cpumask_set_cpu(cpu, &mask); cpumask_set_cpu(cpu, mask);
(void)irq_set_affinity_hint(rd->ring->irq, (void)irq_set_affinity_hint(rd->ring->irq,
&mask); mask);
} }
} }
for (i = h->q_num; i < h->q_num * 2; i++) { for (i = h->q_num; i < h->q_num * 2; i++) {
rd = &priv->ring_data[i]; rd = &priv->ring_data[i];
if (cpu_online(rd->queue_index * 2 + 1)) { if (cpu_online(rd->queue_index * 2 + 1)) {
cpumask_clear(&mask); cpumask_clear(mask);
cpu = rd->queue_index * 2 + 1; cpu = rd->queue_index * 2 + 1;
cpumask_set_cpu(cpu, &mask); cpumask_set_cpu(cpu, mask);
(void)irq_set_affinity_hint(rd->ring->irq, (void)irq_set_affinity_hint(rd->ring->irq,
&mask); mask);
} }
} }
} }
free_cpumask_var(mask);
} }
static int hns_nic_init_irq(struct hns_nic_priv *priv) static int hns_nic_init_irq(struct hns_nic_priv *priv)
......
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