RE: [PATCH net-next] r8152: divide the tx and rx bottom functions
From: Hayes Wang
Date: Fri Aug 16 2019 - 06:05:05 EST
Eric Dumazet [mailto:eric.dumazet@xxxxxxxxx]
> Sent: Friday, August 16, 2019 5:27 PM
> Maybe you would avoid messing with a tasklet (we really try to get rid
> of tasklets in general) using two NAPI, one for TX, one for RX.
> Some drivers already use two NAPI, it is fine.
> This might avoid the ugly dance in r8152_poll(),
> calling napi_schedule(napi) after napi_complete_done() !
The reason is that the USB device couldn't control
the interrupt of USB controller. That is, I couldn't
disable the interrupt before napi_schedule and
enable it after napi_complete_done. If the callback
function occurs during the following timing, it is
possible no one would schedule the napi again.
static int r8152_poll(struct napi_struct *napi, int budget)
struct r8152 *tp = container_of(napi, struct r8152, napi);
work_done = rx_bottom(tp, budget);
--> callback occurs here and try to call napi_schedule
That is, no tx or rx could be handled unless
something trigger napi_schedule.