On Thu, 19 Nov 2020 09:30:15 +0100 Björn Töpel wrote:
> + /* The NAPI context has more processing work, but busy-polling
> + * is preferred. Exit early.
> + */
> + if (napi_prefer_busy_poll(n)) {
> + if (napi_complete_done(n, work)) {
> + /* If timeout is not set, we need to make sure
> + * that the NAPI is re-scheduled.
> + */
> + napi_schedule(n);
> + }
> + goto out_unlock;
> + }
Do we really need to go through napi_complete_done() here?
Isn't it sufficient to check:
if (napi_prefer_busy_poll(n) &&
hrtimer_active(&n->timer)) // not 100% sure this is the
// right helper for the check
If timer is scheduled it will fire and worst case sirq will kick back
in after timeout. napi_complete_done() should had been called by the
driver already to schedule the timer. If the driver doesn't call
napi_complete_done() we should not allow it to use busy_poll() anyway.