Skip to contentSkip to conversation

NAPI behavior when (work < weight)

RFC Vladimir Kondratiev 2 participants 2 messages Feb 4, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi

I am observing that if driver does not calls napi_complete() when less than full budget consumed, various strange things happen.

For example, if driver going to napi_disable(), it may wait forever in the loop:

	while (test_and_set_bit(NAPI_STATE_SCHED, &n->state))
		msleep(1);

if last NAPI consumed less then full budget, because bit NAPI_STATE_SCHED never cleared.

Is it expected that driver calls napi_complete() when less than full budget consumed? Documentation does not say so.

What is intended behavior in case above?

Thanks, Vladimir

#1 lore raw
Quoted 11 lines · Vladimir Kondratiev

Hi

I am observing that if driver does not calls napi_complete() when less than full budget consumed, various strange things happen.

For example, if driver going to napi_disable(), it may wait forever in the loop:

	while (test_and_set_bit(NAPI_STATE_SCHED, &n->state))
		msleep(1);
Quoted 7 lines

if last NAPI consumed less then full budget, because bit NAPI_STATE_SCHED never cleared.

Is it expected that driver calls napi_complete() when less than full budget consumed? Documentation does not say so.

What is intended behavior in case above?

A driver must call napi_complete() (or better : napi_complete_done() ) when/if returning work_done < budget

Thats because of the way we have to rearm interrupts in the driver, _after_ calling napi_complete()