net/mlx5e: simplify condition after napi budget handling change
Subsystems (5)
Jakub Kicinski
maintainerPATCH 1/1 net/mlx5e: simplify condition after napi budget handling change
Since recent commit budget can't be 0 here.
---
pw-bot: au
drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c +1 -1
@@ -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--; }
Signature · 1 line
2.40.1
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)) {Quoted 14 lines · On Tue, 30 May, 2023 19:00:51 -0700 Jakub Kicinski <[email protected]> wrote:
Since recent commit budget can't be 0 here.
Signed-off-by Jakub Kicinski <[email protected]>---
pw-bot: audrivers/net/ethernet/mellanox/mlx5/core/en_txrx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c +0
-0
drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c int mlx5e_napi_poll(struct napi_struct *napi, int budget) · line 212
Quoted 7 lines
drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c +1
-1@@ -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
Jakub Kicinski
maintainerreminder: please avoid top posting on the list
Quoted 5 lines · 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.cas well in themlx5e_ptp_napi_pollfunction 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:
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_txrx.h +3 -3
@@ -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; }
drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c +1 -1
@@ -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,
Quoted 12 lines · Jakub Kicinski
reminder: please avoid top posting on the list
Quoted 5 lines · 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.cas well in themlx5e_ptp_napi_pollfunction 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