Commit 262b7f14 authored by stephen hemminger's avatar stephen hemminger Committed by David S. Miller

netvsc: add comments about callback's and NAPI

Add some short description of how callback's and NAPI interoperate.
Signed-off-by: default avatarStephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6de38af6
...@@ -1209,6 +1209,10 @@ static struct hv_device *netvsc_channel_to_device(struct vmbus_channel *channel) ...@@ -1209,6 +1209,10 @@ static struct hv_device *netvsc_channel_to_device(struct vmbus_channel *channel)
return primary ? primary->device_obj : channel->device_obj; return primary ? primary->device_obj : channel->device_obj;
} }
/* Network processing softirq
* Process data in incoming ring buffer from host
* Stops when ring is empty or budget is met or exceeded.
*/
int netvsc_poll(struct napi_struct *napi, int budget) int netvsc_poll(struct napi_struct *napi, int budget)
{ {
struct netvsc_channel *nvchan struct netvsc_channel *nvchan
...@@ -1238,7 +1242,11 @@ int netvsc_poll(struct napi_struct *napi, int budget) ...@@ -1238,7 +1242,11 @@ int netvsc_poll(struct napi_struct *napi, int budget)
} }
hv_pkt_iter_close(channel); hv_pkt_iter_close(channel);
/* If ring is empty and NAPI is not doing polling */ /* If budget was not exhausted and
* not doing busy poll
* then re-enable host interrupts
* and reschedule if ring is not empty.
*/
if (work_done < budget && if (work_done < budget &&
napi_complete_done(napi, work_done) && napi_complete_done(napi, work_done) &&
hv_end_read(&channel->inbound) != 0) hv_end_read(&channel->inbound) != 0)
...@@ -1248,6 +1256,9 @@ int netvsc_poll(struct napi_struct *napi, int budget) ...@@ -1248,6 +1256,9 @@ int netvsc_poll(struct napi_struct *napi, int budget)
return work_done; return work_done;
} }
/* Call back when data is available in host ring buffer.
* Processing is deferred until network softirq (NAPI)
*/
void netvsc_channel_cb(void *context) void netvsc_channel_cb(void *context)
{ {
struct netvsc_channel *nvchan = context; struct netvsc_channel *nvchan = context;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment