aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/networking/NAPI_HOWTO.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/networking/NAPI_HOWTO.txt')
-rw-r--r--Documentation/networking/NAPI_HOWTO.txt26
1 files changed, 13 insertions, 13 deletions
diff --git a/Documentation/networking/NAPI_HOWTO.txt b/Documentation/networking/NAPI_HOWTO.txt
index 93af3e87c65b..fb8dc6422a52 100644
--- a/Documentation/networking/NAPI_HOWTO.txt
+++ b/Documentation/networking/NAPI_HOWTO.txt
@@ -95,8 +95,8 @@ There are two types of event register ACK mechanisms.
95 Move all to dev->poll() 95 Move all to dev->poll()
96 96
97C) Ability to detect new work correctly. 97C) Ability to detect new work correctly.
98NAPI works by shutting down event interrupts when theres work and 98NAPI works by shutting down event interrupts when there's work and
99turning them on when theres none. 99turning them on when there's none.
100New packets might show up in the small window while interrupts were being 100New packets might show up in the small window while interrupts were being
101re-enabled (refer to appendix 2). A packet might sneak in during the period 101re-enabled (refer to appendix 2). A packet might sneak in during the period
102we are enabling interrupts. We only get to know about such a packet when the 102we are enabling interrupts. We only get to know about such a packet when the
@@ -114,7 +114,7 @@ Locking rules and environmental guarantees
114only one CPU can pick the initial interrupt and hence the initial 114only one CPU can pick the initial interrupt and hence the initial
115netif_rx_schedule(dev); 115netif_rx_schedule(dev);
116- The core layer invokes devices to send packets in a round robin format. 116- The core layer invokes devices to send packets in a round robin format.
117This implies receive is totaly lockless because of the guarantee only that 117This implies receive is totally lockless because of the guarantee that only
118one CPU is executing it. 118one CPU is executing it.
119- contention can only be the result of some other CPU accessing the rx 119- contention can only be the result of some other CPU accessing the rx
120ring. This happens only in close() and suspend() (when these methods 120ring. This happens only in close() and suspend() (when these methods
@@ -510,7 +510,7 @@ static int my_poll (struct net_device *dev, int *budget)
510 an interrupt will be generated */ 510 an interrupt will be generated */
511 goto done; 511 goto done;
512 } 512 }
513 /* done! at least thats what it looks like ;-> 513 /* done! at least that's what it looks like ;->
514 if new packets came in after our last check on status bits 514 if new packets came in after our last check on status bits
515 they'll be caught by the while check and we go back and clear them 515 they'll be caught by the while check and we go back and clear them
516 since we havent exceeded our quota */ 516 since we havent exceeded our quota */
@@ -535,11 +535,11 @@ done:
535 * 1. it can race with disabling irqs in irq handler (which are done to 535 * 1. it can race with disabling irqs in irq handler (which are done to
536 * schedule polls) 536 * schedule polls)
537 * 2. it can race with dis/enabling irqs in other poll threads 537 * 2. it can race with dis/enabling irqs in other poll threads
538 * 3. if an irq raised after the begining of the outer beginning 538 * 3. if an irq raised after the beginning of the outer beginning
539 * loop(marked in the code above), it will be immediately 539 * loop (marked in the code above), it will be immediately
540 * triggered here. 540 * triggered here.
541 * 541 *
542 * Summarizing: the logic may results in some redundant irqs both 542 * Summarizing: the logic may result in some redundant irqs both
543 * due to races in masking and due to too late acking of already 543 * due to races in masking and due to too late acking of already
544 * processed irqs. The good news: no events are ever lost. 544 * processed irqs. The good news: no events are ever lost.
545 */ 545 */
@@ -601,7 +601,7 @@ a)
601 601
6025) dev->close() and dev->suspend() issues 6025) dev->close() and dev->suspend() issues
603========================================== 603==========================================
604The driver writter neednt worry about this. The top net layer takes 604The driver writer needn't worry about this; the top net layer takes
605care of it. 605care of it.
606 606
6076) Adding new Stats to /proc 6076) Adding new Stats to /proc
@@ -622,9 +622,9 @@ FC should be programmed to apply in the case when the system cant pull out
622packets fast enough i.e send a pause only when you run out of rx buffers. 622packets fast enough i.e send a pause only when you run out of rx buffers.
623Note FC in itself is a good solution but we have found it to not be 623Note FC in itself is a good solution but we have found it to not be
624much of a commodity feature (both in NICs and switches) and hence falls 624much of a commodity feature (both in NICs and switches) and hence falls
625under the same category as using NIC based mitigation. Also experiments 625under the same category as using NIC based mitigation. Also, experiments
626indicate that its much harder to resolve the resource allocation 626indicate that it's much harder to resolve the resource allocation
627issue (aka lazy receiving that NAPI offers) and hence quantify its usefullness 627issue (aka lazy receiving that NAPI offers) and hence quantify its usefulness
628proved harder. In any case, FC works even better with NAPI but is not 628proved harder. In any case, FC works even better with NAPI but is not
629necessary. 629necessary.
630 630
@@ -678,10 +678,10 @@ routine:
678CSR5 bit of interest is only the rx status. 678CSR5 bit of interest is only the rx status.
679If you look at the last if statement: 679If you look at the last if statement:
680you just finished grabbing all the packets from the rx ring .. you check if 680you just finished grabbing all the packets from the rx ring .. you check if
681status bit says theres more packets just in ... it says none; you then 681status bit says there are more packets just in ... it says none; you then
682enable rx interrupts again; if a new packet just came in during this check, 682enable rx interrupts again; if a new packet just came in during this check,
683we are counting that CSR5 will be set in that small window of opportunity 683we are counting that CSR5 will be set in that small window of opportunity
684and that by re-enabling interrupts, we would actually triger an interrupt 684and that by re-enabling interrupts, we would actually trigger an interrupt
685to register the new packet for processing. 685to register the new packet for processing.
686 686
687[The above description nay be very verbose, if you have better wording 687[The above description nay be very verbose, if you have better wording