Skip to contentSkip to conversation

idpf: Don't hard code napi_struct size

PATCH In review Joe Damato 5 participants 5 messages Oct 4, 2024 – Apr 18, 2025

Subsystems (3)
lore
Share & tools
lore

Joe Damato

author
#0 lore raw

PATCH v3 1/1 idpf: Don't hard code napi_struct size

The sizeof(struct napi_struct) can change. Don't hardcode the size to 400 bytes and instead use "sizeof(struct napi_struct)".

---
 drivers/net/ethernet/intel/idpf/idpf_txrx.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/idpf/idpf_txrx.h +2 -1
index f0537826f840..9c1fe84108ed 100644
@@ -438,7 +438,8 @@ struct idpf_q_vector {
 	__cacheline_group_end_aligned(cold);
 };
 libeth_cacheline_set_assert(struct idpf_q_vector, 112,
-			    424 + 2 * sizeof(struct dim),
+			    24 + sizeof(struct napi_struct) +
+			    2 * sizeof(struct dim),
 			    8 + sizeof(cpumask_var_t));
 
 struct idpf_rx_queue_stats {
Signature · 1 line
2.34.1
Acked-by on v3 1/1
#1 lore raw

From: Joe Damato <[email protected]>
Date: Fri, 4 Oct 2024 10:54:07 +0000

Quoted 5 lines

The sizeof(struct napi_struct) can change. Don't hardcode the size to 400 bytes and instead use "sizeof(struct napi_struct)".

I'm sorry that I complicated things a bit with those assertions =\

Quoted 9 lines
---
 drivers/net/ethernet/intel/idpf/idpf_txrx.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/idpf/idpf_txrx.h +0 -0
index f0537826f840..9c1fe84108ed 100644

drivers/net/ethernet/intel/idpf/idpf_txrx.h struct idpf_q_vector { · line 445

Quoted 9 lines
drivers/net/ethernet/intel/idpf/idpf_txrx.h +2 -1
@@ -438,7 +438,8 @@ struct idpf_q_vector {
 	__cacheline_group_end_aligned(cold);
 };
 libeth_cacheline_set_assert(struct idpf_q_vector, 112,
-			    424 + 2 * sizeof(struct dim),
+			    24 + sizeof(struct napi_struct) +
+			    2 * sizeof(struct dim),
 			    8 + sizeof(cpumask_var_t));
 
 struct idpf_rx_queue_stats {

Thanks,
Olek

maintainer
#2 lore raw
In reply to Joe Damato
Quoted 14 lines · Joe Damato

The sizeof(struct napi_struct) can change. Don't hardcode the size to 400 bytes and instead use "sizeof(struct napi_struct)".

---
  drivers/net/ethernet/intel/idpf/idpf_txrx.h | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/idpf/idpf_txrx.h +0 -0
index f0537826f840..9c1fe84108ed 100644

drivers/net/ethernet/intel/idpf/idpf_txrx.h struct idpf_q_vector { · line 445

Quoted 9 lines
drivers/net/ethernet/intel/idpf/idpf_txrx.h +2 -1
@@ -438,7 +438,8 @@ struct idpf_q_vector {
  	__cacheline_group_end_aligned(cold);
  };
  libeth_cacheline_set_assert(struct idpf_q_vector, 112,
-			    424 + 2 * sizeof(struct dim),
+			    24 + sizeof(struct napi_struct) +
+			    2 * sizeof(struct dim),
  			    8 + sizeof(cpumask_var_t));
 
  struct idpf_rx_queue_stats {

@Tony: I'm assuming you want this one to go via your tree first, please LMK otherwise.

Thanks,

Paolo

maintainer Reviewed-by
#3 lore raw
Quoted 10 lines · Paolo Abeni
Quoted 9 lines · Joe Damato

The sizeof(struct napi_struct) can change. Don't hardcode the size to 400 bytes and instead use "sizeof(struct napi_struct)".

---
  drivers/net/ethernet/intel/idpf/idpf_txrx.h | 3 ++-

  1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 16 lines

drivers/net/ethernet/intel/idpf/idpf_txrx.h struct idpf_q_vector { · line 444

Quoted 13 lines
drivers/net/ethernet/intel/idpf/idpf_txrx.h +2 -1
index f0537826f840..9c1fe84108ed 100644
@@ -438,7 +438,8 @@ struct idpf_q_vector {
       __cacheline_group_end_aligned(cold);
   };
   libeth_cacheline_set_assert(struct idpf_q_vector, 112,
-                424 + 2 * sizeof(struct dim),
+                24 + sizeof(struct napi_struct) +
+                2 * sizeof(struct dim),
                   8 + sizeof(cpumask_var_t));
   struct idpf_rx_queue_stats {

@Tony: I'm assuming you want this one to go via your tree first, please LMK otherwise.

Hi Paolo,

This seems straightforward and we'd see the issues compile-time so I think it's ok for you to take directly.

Thanks,
Tony

Reviewed-by on v3 1/1
#4 lore raw
In reply to Joe Damato
Quoted 14 lines · Joe Damato

The sizeof(struct napi_struct) can change. Don't hardcode the size to 400 bytes and instead use "sizeof(struct napi_struct)".

---
 drivers/net/ethernet/intel/idpf/idpf_txrx.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/idpf/idpf_txrx.h +0 -0
index f0537826f840..9c1fe84108ed 100644

drivers/net/ethernet/intel/idpf/idpf_txrx.h struct idpf_q_vector { · line 445

Quoted 9 lines
drivers/net/ethernet/intel/idpf/idpf_txrx.h +2 -1
@@ -438,7 +438,8 @@ struct idpf_q_vector {
 	__cacheline_group_end_aligned(cold);
 };
 libeth_cacheline_set_assert(struct idpf_q_vector, 112,
-			    424 + 2 * sizeof(struct dim),
+			    24 + sizeof(struct napi_struct) +
+			    2 * sizeof(struct dim),
 			    8 + sizeof(cpumask_var_t));
 
 struct idpf_rx_queue_stats {