linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next v2 0/1] idpf: Don't hardcode napi_struct size
@ 2024-09-30 16:24 Joe Damato
  2024-09-30 16:24 ` [net-next v2 1/1] idpf: Don't hard code " Joe Damato
  0 siblings, 1 reply; 3+ messages in thread
From: Joe Damato @ 2024-09-30 16:24 UTC (permalink / raw)
  To: netdev
  Cc: Joe Damato, Alexander Lobakin, David S. Miller, Eric Dumazet,
	moderated list:INTEL ETHERNET DRIVERS, Jakub Kicinski, open list,
	Paolo Abeni, Przemek Kitszel, Tony Nguyen

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/20240925180017.82891-1-jdamato@fastly.com/
[2]: https://lore.kernel.org/netdev/20240912100738.16567-1-jdamato@fastly.com/
[3]: https://lore.kernel.org/netdev/20240912100738.16567-6-jdamato@fastly.com/

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(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [net-next v2 1/1] idpf: Don't hard code napi_struct size
  2024-09-30 16:24 [net-next v2 0/1] idpf: Don't hardcode napi_struct size Joe Damato
@ 2024-09-30 16:24 ` Joe Damato
  2024-10-04  0:32   ` Jakub Kicinski
  0 siblings, 1 reply; 3+ messages in thread
From: Joe Damato @ 2024-09-30 16:24 UTC (permalink / raw)
  To: netdev
  Cc: Joe Damato, Simon Horman, Tony Nguyen, Przemek Kitszel,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Alexander Lobakin, moderated list:INTEL ETHERNET DRIVERS,
	open list

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.

Signed-off-by: Joe Damato <jdamato@fastly.com>
Reviewed-by: Simon Horman <horms@kernel.org>
---
 v2:
   - Added Simon Horman's Reviewed-by tag

 drivers/net/ethernet/intel/idpf/idpf_txrx.h | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/idpf/idpf_txrx.h b/drivers/net/ethernet/intel/idpf/idpf_txrx.h
index f0537826f840..d5e904ddcb6e 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_txrx.h
+++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.h
@@ -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;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [net-next v2 1/1] idpf: Don't hard code napi_struct size
  2024-09-30 16:24 ` [net-next v2 1/1] idpf: Don't hard code " Joe Damato
@ 2024-10-04  0:32   ` Jakub Kicinski
  0 siblings, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2024-10-04  0:32 UTC (permalink / raw)
  To: Joe Damato
  Cc: netdev, Simon Horman, Tony Nguyen, Przemek Kitszel,
	David S. Miller, Eric Dumazet, Paolo Abeni, Alexander Lobakin,
	moderated list:INTEL ETHERNET DRIVERS, open list

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-10-04  0:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-30 16:24 [net-next v2 0/1] idpf: Don't hardcode napi_struct size Joe Damato
2024-09-30 16:24 ` [net-next v2 1/1] idpf: Don't hard code " Joe Damato
2024-10-04  0:32   ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).