mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-02 00:24:12 +08:00
net/mlx5e: Fix napi poll with zero budget
napi->poll can be called with budget 0, e.g. in netpoll scenarios
where the caller only wants to poll TX rings
(poll_one_napi@net/core/netpoll.c).
The below commit changed RX polling from "while" loop to "do {} while",
which caused to ignore the initial budget and handle at least one RX
packet.
This fixes the following warning:
[ 2852.049194] mlx5e_napi_poll+0x0/0x260 [mlx5_core] exceeded budget in poll
[ 2852.049195] ------------[ cut here ]------------
[ 2852.049195] WARNING: CPU: 0 PID: 25691 at net/core/netpoll.c:171 netpoll_poll_dev+0x18a/0x1a0
Fixes: 4b7dfc9925
("net/mlx5e: Early-return on empty completion queues")
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
Reported-by: Martin KaFai Lau <kafai@fb.com>
Tested-by: Martin KaFai Lau <kafai@fb.com>
Cc: kernel-team@fb.com
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
This commit is contained in:
parent
d2aa060d40
commit
2a8d6065e7
@ -49,7 +49,7 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget)
|
|||||||
struct mlx5e_channel *c = container_of(napi, struct mlx5e_channel,
|
struct mlx5e_channel *c = container_of(napi, struct mlx5e_channel,
|
||||||
napi);
|
napi);
|
||||||
bool busy = false;
|
bool busy = false;
|
||||||
int work_done;
|
int work_done = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < c->num_tc; i++)
|
for (i = 0; i < c->num_tc; i++)
|
||||||
@ -58,15 +58,17 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget)
|
|||||||
if (c->xdp)
|
if (c->xdp)
|
||||||
busy |= mlx5e_poll_xdpsq_cq(&c->rq.xdpsq.cq);
|
busy |= mlx5e_poll_xdpsq_cq(&c->rq.xdpsq.cq);
|
||||||
|
|
||||||
work_done = mlx5e_poll_rx_cq(&c->rq.cq, budget);
|
if (likely(budget)) { /* budget=0 means: don't poll rx rings */
|
||||||
busy |= work_done == budget;
|
work_done = mlx5e_poll_rx_cq(&c->rq.cq, budget);
|
||||||
|
busy |= work_done == budget;
|
||||||
|
}
|
||||||
|
|
||||||
busy |= c->rq.post_wqes(&c->rq);
|
busy |= c->rq.post_wqes(&c->rq);
|
||||||
|
|
||||||
if (busy) {
|
if (busy) {
|
||||||
if (likely(mlx5e_channel_no_affinity_change(c)))
|
if (likely(mlx5e_channel_no_affinity_change(c)))
|
||||||
return budget;
|
return budget;
|
||||||
if (work_done == budget)
|
if (budget && work_done == budget)
|
||||||
work_done--;
|
work_done--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user