]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
netvsc: add comments about callback's and NAPI
authorstephen hemminger <stephen@networkplumber.org>
Thu, 16 Mar 2017 23:12:38 +0000 (16:12 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 17 Mar 2017 04:39:51 +0000 (21:39 -0700)
Add some short description of how callback's and NAPI interoperate.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/hyperv/netvsc.c

index 0a2e9bd98d2ce39ea0095c1422655f7a54a5cb20..989b7cd993802be01a20b80c45059c394f0fd4a8 100644 (file)
@@ -1209,6 +1209,10 @@ static struct hv_device *netvsc_channel_to_device(struct vmbus_channel *channel)
        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)
 {
        struct netvsc_channel *nvchan
@@ -1238,7 +1242,11 @@ int netvsc_poll(struct napi_struct *napi, int budget)
        }
        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 &&
            napi_complete_done(napi, work_done) &&
            hv_end_read(&channel->inbound) != 0)
@@ -1248,6 +1256,9 @@ int netvsc_poll(struct napi_struct *napi, int budget)
        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)
 {
        struct netvsc_channel *nvchan = context;