]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ethernet: intel: fix building with large NR_CPUS
authorArnd Bergmann <arnd@arndb.de>
Fri, 20 Jun 2025 17:31:24 +0000 (19:31 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Aug 2025 14:22:31 +0000 (16:22 +0200)
[ Upstream commit 24171a5a4a952c26568ff0d2a0bc8c4708a95e1d ]

With large values of CONFIG_NR_CPUS, three Intel ethernet drivers fail to
compile like:

In function ‘i40e_free_q_vector’,
    inlined from ‘i40e_vsi_alloc_q_vectors’ at drivers/net/ethernet/intel/i40e/i40e_main.c:12112:3:
  571 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
include/linux/rcupdate.h:1084:17: note: in expansion of macro ‘BUILD_BUG_ON’
 1084 |                 BUILD_BUG_ON(offsetof(typeof(*(ptr)), rhf) >= 4096);    \
drivers/net/ethernet/intel/i40e/i40e_main.c:5113:9: note: in expansion of macro ‘kfree_rcu’
 5113 |         kfree_rcu(q_vector, rcu);
      |         ^~~~~~~~~

The problem is that the 'rcu' member in 'q_vector' is too far from the start
of the structure. Move this member before the CPU mask instead, in all three
drivers.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: David S. Miller <davem@davemloft.net>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Tested-by: Sunitha Mekala <sunithax.d.mekala@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/intel/fm10k/fm10k.h
drivers/net/ethernet/intel/i40e/i40e.h
drivers/net/ethernet/intel/ixgbe/ixgbe.h

index 6119a410883815ff3d1ff74302a7f2d85e6a7b24..65a2816142d9624dcf35e765a7387adc541aa7f1 100644 (file)
@@ -189,13 +189,14 @@ struct fm10k_q_vector {
        struct fm10k_ring_container rx, tx;
 
        struct napi_struct napi;
+       struct rcu_head rcu;    /* to avoid race with update stats on free */
+
        cpumask_t affinity_mask;
        char name[IFNAMSIZ + 9];
 
 #ifdef CONFIG_DEBUG_FS
        struct dentry *dbg_q_vector;
 #endif /* CONFIG_DEBUG_FS */
-       struct rcu_head rcu;    /* to avoid race with update stats on free */
 
        /* for dynamic allocation of rings associated with this q_vector */
        struct fm10k_ring ring[] ____cacheline_internodealigned_in_smp;
index dd630b6bc74bd41cf698ae6c75990386a18c218e..add9a3107d9a0ca2d28a8aad5d92bf4a139cb9c2 100644 (file)
@@ -863,6 +863,7 @@ struct i40e_q_vector {
        u16 reg_idx;            /* register index of the interrupt */
 
        struct napi_struct napi;
+       struct rcu_head rcu;    /* to avoid race with update stats on free */
 
        struct i40e_ring_container rx;
        struct i40e_ring_container tx;
@@ -873,7 +874,6 @@ struct i40e_q_vector {
        cpumask_t affinity_mask;
        struct irq_affinity_notify affinity_notify;
 
-       struct rcu_head rcu;    /* to avoid race with update stats on free */
        char name[I40E_INT_NAME_STR_LEN];
        bool arm_wb_state;
 } ____cacheline_internodealigned_in_smp;
index 18251edbfabfb145ed981e3a3562b4ac1eedcc58..3ea7095fc04f5f803854983373ca81bfcb2dfed7 100644 (file)
@@ -457,9 +457,10 @@ struct ixgbe_q_vector {
        struct ixgbe_ring_container rx, tx;
 
        struct napi_struct napi;
+       struct rcu_head rcu;    /* to avoid race with update stats on free */
+
        cpumask_t affinity_mask;
        int numa_node;
-       struct rcu_head rcu;    /* to avoid race with update stats on free */
        char name[IFNAMSIZ + 9];
 
        /* for dynamic allocation of rings associated with this q_vector */