Re: [PATCH net-next] net/mlx5e: simplify condition after napi budget handling change
From: Rahul Rameshbabu <rrameshbabu@nvidia.com>
Date: 2023-05-31 03:05:52
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 [off-list ref] wrote:quoted hunk ↗ jump to hunk
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