Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* [PATCH] mlx5/core: remove mlx5_core_cq.tasklet_ctx.priv field
@ 2024-11-19  4:24 Caleb Sander Mateos
  2024-11-19 23:53 ` Jacob Keller
  2024-11-21  8:15 ` Paolo Abeni
  0 siblings, 2 replies; 4+ messages in thread
From: Caleb Sander Mateos @ 2024-11-19  4:24 UTC (permalink / raw)
  To: Saeed Mahameed, Leon Romanovsky, Tariq Toukan, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Caleb Sander Mateos, netdev, linux-rdma, linux-kernel

The priv field in mlx5_core_cq's tasklet_ctx struct points to the
mlx5_eq_tasklet tasklet_ctx field of the CQ's mlx5_eq_comp. mlx5_core_cq
already stores a pointer to the EQ. Use this eq pointer to get a pointer
to the tasklet_ctx with no additional pointer dereferences and no void *
casts. Remove the now unused priv field.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/cq.c | 5 ++---
 include/linux/mlx5/cq.h                      | 1 -
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cq.c b/drivers/net/ethernet/mellanox/mlx5/core/cq.c
index 1fd403713baf..dc5a291f0993 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/cq.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/cq.c
@@ -68,11 +68,11 @@ void mlx5_cq_tasklet_cb(struct tasklet_struct *t)
 
 static void mlx5_add_cq_to_tasklet(struct mlx5_core_cq *cq,
 				   struct mlx5_eqe *eqe)
 {
 	unsigned long flags;
-	struct mlx5_eq_tasklet *tasklet_ctx = cq->tasklet_ctx.priv;
+	struct mlx5_eq_tasklet *tasklet_ctx = &cq->eq->tasklet_ctx;
 	bool schedule_tasklet = false;
 
 	spin_lock_irqsave(&tasklet_ctx->lock, flags);
 	/* When migrating CQs between EQs will be implemented, please note
 	 * that you need to sync this point. It is possible that
@@ -117,18 +117,17 @@ int mlx5_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
 		return err;
 
 	cq->cqn = MLX5_GET(create_cq_out, out, cqn);
 	cq->cons_index = 0;
 	cq->arm_sn     = 0;
+	/* assuming CQ will be deleted before the EQ */
 	cq->eq         = eq;
 	cq->uid = MLX5_GET(create_cq_in, in, uid);
 	refcount_set(&cq->refcount, 1);
 	init_completion(&cq->free);
 	if (!cq->comp)
 		cq->comp = mlx5_add_cq_to_tasklet;
-	/* assuming CQ will be deleted before the EQ */
-	cq->tasklet_ctx.priv = &eq->tasklet_ctx;
 	INIT_LIST_HEAD(&cq->tasklet_ctx.list);
 
 	/* Add to comp EQ CQ tree to recv comp events */
 	err = mlx5_eq_add_cq(&eq->core, cq);
 	if (err)
diff --git a/include/linux/mlx5/cq.h b/include/linux/mlx5/cq.h
index 991526039ccb..cd034ea0ee34 100644
--- a/include/linux/mlx5/cq.h
+++ b/include/linux/mlx5/cq.h
@@ -53,11 +53,10 @@ struct mlx5_core_cq {
 	struct mlx5_rsc_debug	*dbg;
 	int			pid;
 	struct {
 		struct list_head list;
 		void (*comp)(struct mlx5_core_cq *cq, struct mlx5_eqe *eqe);
-		void		*priv;
 	} tasklet_ctx;
 	int			reset_notify_added;
 	struct list_head	reset_notify;
 	struct mlx5_eq_comp	*eq;
 	u16 uid;
-- 
2.45.2


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

* Re: [PATCH] mlx5/core: remove mlx5_core_cq.tasklet_ctx.priv field
  2024-11-19  4:24 [PATCH] mlx5/core: remove mlx5_core_cq.tasklet_ctx.priv field Caleb Sander Mateos
@ 2024-11-19 23:53 ` Jacob Keller
  2024-11-21  8:15 ` Paolo Abeni
  1 sibling, 0 replies; 4+ messages in thread
From: Jacob Keller @ 2024-11-19 23:53 UTC (permalink / raw)
  To: Caleb Sander Mateos, Saeed Mahameed, Leon Romanovsky,
	Tariq Toukan, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: netdev, linux-rdma, linux-kernel



On 11/18/2024 8:24 PM, Caleb Sander Mateos wrote:
> The priv field in mlx5_core_cq's tasklet_ctx struct points to the
> mlx5_eq_tasklet tasklet_ctx field of the CQ's mlx5_eq_comp. mlx5_core_cq
> already stores a pointer to the EQ. Use this eq pointer to get a pointer
> to the tasklet_ctx with no additional pointer dereferences and no void *
> casts. Remove the now unused priv field.
> 
> Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
> ---

This needs to tag net-next, as it doesn't fix any user-visible bug.
Additionally, net-next just closed for preparation of 6.13, and this
will need to wait until it re-opens on Dec 2nd.

The code change itself seems reasonable to me, saving an otherwise
unnecessary pointer.

When you resend it when the window is open, feel free to add:

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>

Thanks,
Jake

>  drivers/net/ethernet/mellanox/mlx5/core/cq.c | 5 ++---
>  include/linux/mlx5/cq.h                      | 1 -
>  2 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cq.c b/drivers/net/ethernet/mellanox/mlx5/core/cq.c
> index 1fd403713baf..dc5a291f0993 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/cq.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/cq.c
> @@ -68,11 +68,11 @@ void mlx5_cq_tasklet_cb(struct tasklet_struct *t)
>  
>  static void mlx5_add_cq_to_tasklet(struct mlx5_core_cq *cq,
>  				   struct mlx5_eqe *eqe)
>  {
>  	unsigned long flags;
> -	struct mlx5_eq_tasklet *tasklet_ctx = cq->tasklet_ctx.priv;
> +	struct mlx5_eq_tasklet *tasklet_ctx = &cq->eq->tasklet_ctx;
>  	bool schedule_tasklet = false;
>  
>  	spin_lock_irqsave(&tasklet_ctx->lock, flags);
>  	/* When migrating CQs between EQs will be implemented, please note
>  	 * that you need to sync this point. It is possible that
> @@ -117,18 +117,17 @@ int mlx5_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
>  		return err;
>  
>  	cq->cqn = MLX5_GET(create_cq_out, out, cqn);
>  	cq->cons_index = 0;
>  	cq->arm_sn     = 0;
> +	/* assuming CQ will be deleted before the EQ */
>  	cq->eq         = eq;
>  	cq->uid = MLX5_GET(create_cq_in, in, uid);
>  	refcount_set(&cq->refcount, 1);
>  	init_completion(&cq->free);
>  	if (!cq->comp)
>  		cq->comp = mlx5_add_cq_to_tasklet;
> -	/* assuming CQ will be deleted before the EQ */
> -	cq->tasklet_ctx.priv = &eq->tasklet_ctx;
>  	INIT_LIST_HEAD(&cq->tasklet_ctx.list);
>  
>  	/* Add to comp EQ CQ tree to recv comp events */
>  	err = mlx5_eq_add_cq(&eq->core, cq);
>  	if (err)
> diff --git a/include/linux/mlx5/cq.h b/include/linux/mlx5/cq.h
> index 991526039ccb..cd034ea0ee34 100644
> --- a/include/linux/mlx5/cq.h
> +++ b/include/linux/mlx5/cq.h
> @@ -53,11 +53,10 @@ struct mlx5_core_cq {
>  	struct mlx5_rsc_debug	*dbg;
>  	int			pid;
>  	struct {
>  		struct list_head list;
>  		void (*comp)(struct mlx5_core_cq *cq, struct mlx5_eqe *eqe);
> -		void		*priv;
>  	} tasklet_ctx;
>  	int			reset_notify_added;
>  	struct list_head	reset_notify;
>  	struct mlx5_eq_comp	*eq;
>  	u16 uid;


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

* Re: [PATCH] mlx5/core: remove mlx5_core_cq.tasklet_ctx.priv field
  2024-11-19  4:24 [PATCH] mlx5/core: remove mlx5_core_cq.tasklet_ctx.priv field Caleb Sander Mateos
  2024-11-19 23:53 ` Jacob Keller
@ 2024-11-21  8:15 ` Paolo Abeni
  2024-11-21 16:47   ` Caleb Sander
  1 sibling, 1 reply; 4+ messages in thread
From: Paolo Abeni @ 2024-11-21  8:15 UTC (permalink / raw)
  To: Caleb Sander Mateos, Saeed Mahameed, Tariq Toukan,
	Leon Romanovsky
  Cc: netdev, linux-rdma, linux-kernel, Andrew Lunn, Eric Dumazet,
	Jakub Kicinski, David S. Miller

On 11/19/24 05:24, Caleb Sander Mateos wrote:
> The priv field in mlx5_core_cq's tasklet_ctx struct points to the
> mlx5_eq_tasklet tasklet_ctx field of the CQ's mlx5_eq_comp. mlx5_core_cq
> already stores a pointer to the EQ. Use this eq pointer to get a pointer
> to the tasklet_ctx with no additional pointer dereferences and no void *
> casts. Remove the now unused priv field.
> 
> Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>

[Under the assumption Tariq is still handling the mlx5 tree, and patches
from 3rd party contributors are supposed to land directly into the
net/net-next tree]

@Caleb: please include the target tree ('net-next') into the subj
prefix. More importantly:

## Form letter - net-next-closed

The merge window for v6.13 has begun and net-next is closed for new
drivers, features, code refactoring and optimizations. We are currently
accepting bug fixes only.

Please repost when net-next reopens after Dec 2nd.

RFC patches sent for review only are welcome at any time.

See:
https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#development-cycle





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

* Re: [PATCH] mlx5/core: remove mlx5_core_cq.tasklet_ctx.priv field
  2024-11-21  8:15 ` Paolo Abeni
@ 2024-11-21 16:47   ` Caleb Sander
  0 siblings, 0 replies; 4+ messages in thread
From: Caleb Sander @ 2024-11-21 16:47 UTC (permalink / raw)
  To: Paolo Abeni
  Cc: Saeed Mahameed, Tariq Toukan, Leon Romanovsky, netdev, linux-rdma,
	linux-kernel, Andrew Lunn, Eric Dumazet, Jakub Kicinski,
	David S. Miller

On Thu, Nov 21, 2024 at 12:15 AM Paolo Abeni <pabeni@redhat.com> wrote:
>
> On 11/19/24 05:24, Caleb Sander Mateos wrote:
> > The priv field in mlx5_core_cq's tasklet_ctx struct points to the
> > mlx5_eq_tasklet tasklet_ctx field of the CQ's mlx5_eq_comp. mlx5_core_cq
> > already stores a pointer to the EQ. Use this eq pointer to get a pointer
> > to the tasklet_ctx with no additional pointer dereferences and no void *
> > casts. Remove the now unused priv field.
> >
> > Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
>
> [Under the assumption Tariq is still handling the mlx5 tree, and patches
> from 3rd party contributors are supposed to land directly into the
> net/net-next tree]
>
> @Caleb: please include the target tree ('net-next') into the subj
> prefix. More importantly:

Sorry, I realized I forgot to add a subject prefix after I had sent
out the patch. net-next is indeed what I intended.

>
> ## Form letter - net-next-closed
>
> The merge window for v6.13 has begun and net-next is closed for new
> drivers, features, code refactoring and optimizations. We are currently
> accepting bug fixes only.
>
> Please repost when net-next reopens after Dec 2nd.
>
> RFC patches sent for review only are welcome at any time.
>
> See:
> https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#development-cycle

Sure, there's no rush to get this in, it's just a small cleanup. I
will resend the patch when the branch opens again. Appreciate the
development cycle reference.

Thanks,
Caleb

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

end of thread, other threads:[~2024-11-21 16:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-19  4:24 [PATCH] mlx5/core: remove mlx5_core_cq.tasklet_ctx.priv field Caleb Sander Mateos
2024-11-19 23:53 ` Jacob Keller
2024-11-21  8:15 ` Paolo Abeni
2024-11-21 16:47   ` Caleb Sander

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox