Messages in this thread | | | From | Hayes Wang <> | Subject | RE: [PATCH net-next] r8152: divide the tx and rx bottom functions | Date | Fri, 16 Aug 2019 10:04:58 +0000 |
| |
Eric Dumazet [mailto:eric.dumazet@gmail.com] > 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); int work_done;
work_done = rx_bottom(tp, budget); bottom_half(tp);
--> callback occurs here and try to call napi_schedule
napi_complete_done(napi, work_done)
That is, no tx or rx could be handled unless something trigger napi_schedule.
Best Regards, Hayes
| |