mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-18 03:23:53 -04:00
net: use napi_id_valid helper
In commit 6597e8d358 ("netdev-genl: Elide napi_id when not present"),
napi_id_valid function was added. Use the helper to refactor open-coded
checks in the source.
Suggested-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Stefano Jordhani <sjordhani@gmail.com>
Reviewed-by: Joe Damato <jdamato@fastly.com>
Reviewed-by: Jens Axboe <axboe@kernel.dk> # for iouring
Link: https://patch.msgid.link/20250214181801.931-1-sjordhani@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
b706d9f068
commit
b9d752105e
@@ -447,7 +447,7 @@ static bool ep_busy_loop(struct eventpoll *ep, int nonblock)
|
||||
if (!budget)
|
||||
budget = BUSY_POLL_BUDGET;
|
||||
|
||||
if (napi_id >= MIN_NAPI_ID && ep_busy_loop_on(ep)) {
|
||||
if (napi_id_valid(napi_id) && ep_busy_loop_on(ep)) {
|
||||
napi_busy_loop(napi_id, nonblock ? NULL : ep_busy_loop_end,
|
||||
ep, prefer_busy_poll, budget);
|
||||
if (ep_events_available(ep))
|
||||
@@ -492,7 +492,7 @@ static inline void ep_set_busy_poll_napi_id(struct epitem *epi)
|
||||
* or
|
||||
* Nothing to do if we already have this ID
|
||||
*/
|
||||
if (napi_id < MIN_NAPI_ID || napi_id == ep->napi_id)
|
||||
if (!napi_id_valid(napi_id) || napi_id == ep->napi_id)
|
||||
return;
|
||||
|
||||
/* record NAPI ID for use in next busy poll */
|
||||
@@ -546,7 +546,7 @@ static void ep_suspend_napi_irqs(struct eventpoll *ep)
|
||||
{
|
||||
unsigned int napi_id = READ_ONCE(ep->napi_id);
|
||||
|
||||
if (napi_id >= MIN_NAPI_ID && READ_ONCE(ep->prefer_busy_poll))
|
||||
if (napi_id_valid(napi_id) && READ_ONCE(ep->prefer_busy_poll))
|
||||
napi_suspend_irqs(napi_id);
|
||||
}
|
||||
|
||||
@@ -554,7 +554,7 @@ static void ep_resume_napi_irqs(struct eventpoll *ep)
|
||||
{
|
||||
unsigned int napi_id = READ_ONCE(ep->napi_id);
|
||||
|
||||
if (napi_id >= MIN_NAPI_ID && READ_ONCE(ep->prefer_busy_poll))
|
||||
if (napi_id_valid(napi_id) && READ_ONCE(ep->prefer_busy_poll))
|
||||
napi_resume_irqs(napi_id);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user