netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net/mlx5e: simplify condition after napi budget handling change
@ 2023-05-31  2:00 Jakub Kicinski
  2023-05-31  3:05 ` Rahul Rameshbabu
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Kicinski @ 2023-05-31  2:00 UTC (permalink / raw)
  To: saeedm; +Cc: netdev, Jakub Kicinski

Since recent commit budget can't be 0 here.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
pw-bot: au

 drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c
index fbb2d963fb7e..a7d9b7cb4297 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c
@@ -207,7 +207,7 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget)
 		}
 		ch_stats->aff_change++;
 		aff_change = true;
-		if (budget && work_done == budget)
+		if (work_done == budget)
 			work_done--;
 	}
 
-- 
2.40.1


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

* Re: [PATCH net-next] net/mlx5e: simplify condition after napi budget handling change
  2023-05-31  2:00 [PATCH net-next] net/mlx5e: simplify condition after napi budget handling change Jakub Kicinski
@ 2023-05-31  3:05 ` Rahul Rameshbabu
  2023-05-31  5:19   ` Jakub Kicinski
  0 siblings, 1 reply; 4+ messages in thread
From: Rahul Rameshbabu @ 2023-05-31  3:05 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: saeedm, netdev

You might want to clean up
drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c as well in the
mlx5e_ptp_napi_poll function as well.

  static int mlx5e_ptp_napi_poll(struct napi_struct *napi, int budget)
  {
    struct mlx5e_ptp *c = container_of(napi, struct mlx5e_ptp, napi);
    struct mlx5e_ch_stats *ch_stats = c->stats;
    struct mlx5e_rq *rq = &c->rq;
    bool busy = false;
    int work_done = 0;
    int i;

    rcu_read_lock();

    ch_stats->poll++;

    if (test_bit(MLX5E_PTP_STATE_TX, c->state)) {
      for (i = 0; i < c->num_tc; i++) {
        busy |= mlx5e_poll_tx_cq(&c->ptpsq[i].txqsq.cq, budget);
        busy |= mlx5e_ptp_poll_ts_cq(&c->ptpsq[i].ts_cq, budget);
      }
    }
    if (test_bit(MLX5E_PTP_STATE_RX, c->state) && likely(budget)) {

That last conditional would be reduced to the following with this commit.

    if (test_bit(MLX5E_PTP_STATE_RX, c->state)) {

On Tue, 30 May, 2023 19:00:51 -0700 Jakub Kicinski <kuba@kernel.org> wrote:
> Since recent commit budget can't be 0 here.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> pw-bot: au
>
>  drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c
> index fbb2d963fb7e..a7d9b7cb4297 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c
> @@ -207,7 +207,7 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget)
>  		}
>  		ch_stats->aff_change++;
>  		aff_change = true;
> -		if (budget && work_done == budget)
> +		if (work_done == budget)
>  			work_done--;
>  	}

-- Rahul Rameshbabu

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

* Re: [PATCH net-next] net/mlx5e: simplify condition after napi budget handling change
  2023-05-31  3:05 ` Rahul Rameshbabu
@ 2023-05-31  5:19   ` Jakub Kicinski
  2023-05-31 22:04     ` Saeed Mahameed
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Kicinski @ 2023-05-31  5:19 UTC (permalink / raw)
  To: Rahul Rameshbabu; +Cc: saeedm, netdev

reminder: please avoid top posting on the list

On Tue, 30 May 2023 20:05:32 -0700 Rahul Rameshbabu wrote:
> You might want to clean up
> drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c as well in the
> mlx5e_ptp_napi_poll function as well.
> 
>   static int mlx5e_ptp_napi_poll(struct napi_struct *napi, int budget)

This is a separate NAPI instance, I don't think I should be touching
this. I can remove a check from TLS, tho, it seems:

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_txrx.h b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_txrx.h
index 2dd78dd4ad65..5eadd47cee40 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_txrx.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_txrx.h
@@ -44,9 +44,9 @@ mlx5e_ktls_tx_try_handle_resync_dump_comp(struct mlx5e_txqsq *sq,
 bool mlx5e_ktls_rx_handle_resync_list(struct mlx5e_channel *c, int budget);
 
 static inline bool
-mlx5e_ktls_rx_pending_resync_list(struct mlx5e_channel *c, int budget)
+mlx5e_ktls_rx_pending_resync_list(struct mlx5e_channel *c)
 {
-	return budget && test_bit(MLX5E_SQ_STATE_PENDING_TLS_RX_RESYNC, &c->async_icosq.state);
+	return test_bit(MLX5E_SQ_STATE_PENDING_TLS_RX_RESYNC, &c->async_icosq.state);
 }
 
 static inline bool mlx5e_ktls_skb_offloaded(struct sk_buff *skb)
@@ -76,7 +76,7 @@ mlx5e_ktls_rx_handle_resync_list(struct mlx5e_channel *c, int budget)
 }
 
 static inline bool
-mlx5e_ktls_rx_pending_resync_list(struct mlx5e_channel *c, int budget)
+mlx5e_ktls_rx_pending_resync_list(struct mlx5e_channel *c)
 {
 	return false;
 }
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c
index a7d9b7cb4297..5012a5610353 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c
@@ -186,7 +186,7 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget)
 		clear_bit(MLX5E_SQ_STATE_PENDING_XSK_TX, &c->async_icosq.state);
 
 	/* Keep after async ICOSQ CQ poll */
-	if (unlikely(mlx5e_ktls_rx_pending_resync_list(c, budget)))
+	if (unlikely(mlx5e_ktls_rx_pending_resync_list(c)))
 		busy |= mlx5e_ktls_rx_handle_resync_list(c, budget);
 
 	busy |= INDIRECT_CALL_2(rq->post_wqes,

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

* Re: [PATCH net-next] net/mlx5e: simplify condition after napi budget handling change
  2023-05-31  5:19   ` Jakub Kicinski
@ 2023-05-31 22:04     ` Saeed Mahameed
  0 siblings, 0 replies; 4+ messages in thread
From: Saeed Mahameed @ 2023-05-31 22:04 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: Rahul Rameshbabu, saeedm, netdev

On 30 May 22:19, Jakub Kicinski wrote:
>reminder: please avoid top posting on the list
>
>On Tue, 30 May 2023 20:05:32 -0700 Rahul Rameshbabu wrote:
>> You might want to clean up
>> drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c as well in the
>> mlx5e_ptp_napi_poll function as well.
>>
>>   static int mlx5e_ptp_napi_poll(struct napi_struct *napi, int budget)
>
>This is a separate NAPI instance, I don't think I should be touching
>this. I can remove a check from TLS, tho, it seems:
>

I will apply this to net-next-mlx5 as is, Rahul and Tariq can follow up on
PTP and TLS if necessary 


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

end of thread, other threads:[~2023-05-31 22:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-31  2:00 [PATCH net-next] net/mlx5e: simplify condition after napi budget handling change Jakub Kicinski
2023-05-31  3:05 ` Rahul Rameshbabu
2023-05-31  5:19   ` Jakub Kicinski
2023-05-31 22:04     ` Saeed Mahameed

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