idpf: Don't hardcode napi_struct size
Subsystems (3)
v2 cover idpf: Don't hardcode napi_struct size
Greetings:
Welcome to v2. This was previously an RFC [1], only changes applied are to the commit message. See changelog below.
While working on an RFC which adds fields to napi_struct [2], I got a warning from the kernel test robot about tripping an assertion in idpf which seems to hardcode the size of napi_struct. The assertion was triggered after applying patch 3 from the RFC [3].
I did not want to the include this change in my RFC v4 because I wanted to keep the review of that RFC focused on the in core work instead, so I was hoping Intel would be OK to merge this (or a change which accomplishes the same thing).
Please note: I do not have this hardware and thus have only compile tested this.
Thanks,
Joe
v2:
- No longer an RFC
- Added Simon Horman's Reviewed-By tag
[1]: https://lore.kernel.org/lkml/[email protected]/
[2]: https://lore.kernel.org/netdev/[email protected]/
[3]: https://lore.kernel.org/netdev/[email protected]/
Joe Damato (1):
idpf: Don't hard code napi_struct size
drivers/net/ethernet/intel/idpf/idpf_txrx.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
Signature · 1 line
2.25.1
PATCH v2 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)".
While fixing this, also move other calculations into compile time defines.
---
v2:
- Added Simon Horman's Reviewed-by tag
drivers/net/ethernet/intel/idpf/idpf_txrx.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/idpf/idpf_txrx.h +7 -3
@@ -437,9 +437,13 @@ struct idpf_q_vector {cpumask_var_t affinity_mask;__cacheline_group_end_aligned (cold); }; -libeth_cacheline_set_assert(struct idpf_q_vector, 112, -424 +2 *sizeof (struct dim ), - 8 + sizeof(cpumask_var_t)); + +#define IDPF_Q_VECTOR_RO_SZ (112) +#define IDPF_Q_VECTOR_RW_SZ (sizeof(struct napi_struct) + 24 + \ + 2 * sizeof(struct dim)) +#define IDPF_Q_VECTOR_COLD_SZ (8 + sizeof(cpumask_var_t)) +libeth_cacheline_set_assert(struct idpf_q_vector, IDPF_Q_VECTOR_RO_SZ, + IDPF_Q_VECTOR_RW_SZ, IDPF_Q_VECTOR_COLD_SZ);struct idpf_rx_queue_stats {u64_stats_t packets;
Signature · 1 line
2.25.1
Jakub Kicinski
maintainerRe: [net-next v2 1/1] idpf: Don't hard code napi_struct size
Quoted 5 lines · On Mon, 30 Sep 2024 16:24:22 +0000 Joe Damato wrote:
The
sizeof(struct napi_struct)can change. Don't hardcode the size to 400 bytes and instead use "sizeof(struct napi_struct)".While fixing this, also move other calculations into compile time defines.
Anticipating v3 with smaller diff based on Olek's suggestion so:
pw-bot: cr