Regarding Linux NAPI Implementation

I am trying to understand a network driver with NAPI support and have some doubts about the same.

If I talk about insolvency whenever network packets arrive on the interface, it is notified of the CPU and the corresponding Ethernet driver code (interrupt handler) is executed. Then, the network driver code then copies the packet from the Ethernet device memory to the DMA buffers and, finally, the packets are transferred to the upper level.

Is above true for a disabled NAPI Ethernet driver?

Now, for an Ethernet driver with NAPI support, initially, when packets arrive through the interface, it is notified of the CPU and the corresponding Ethernet driver code (interrupt handler). Inside the interrupt handler code, we check to see if the packet interrupt type is accepted.

 if(statusword & SNULL_RX_INTER)
   snull_rx_ints(dev,0);//Disbale further interrupts
   netif_rx_schedule(dev);

What does this mean by disabling further interrupts?

Does this mean that packets are still captured by the device and stored in the device’s memory, but the CPU is not informed about the availability of these packets?

In addition, what does the CPU mean to combine the device, since the processor runs the snull_poll () method every few seconds and copies any number of packets to the device’s memory in the DMA buffer and transfers to the upper level?

It would be very helpful if someone would provide me with a clear picture.

+4
source share
1 answer

Ethernet NAPI , , CPU Ethernet ( ). , .

, ?

, . NAPI ISR.
, Ethernet . , , , , , (.. ), ?

, -

.
Ethernet .

" ".
(, ), , Ethernet.

?

, NAPI .
, .

, CPU - ,

, ""?
, ( ) (.. ) , .
, , .
, ( ). NAPI, , , , , .

snull_poll() DMA ?

NAPI " " .
, Ethernet , , .

NAPI " ".
, , .
( ), "" NAPI.

BTW
, "CPU ..." " CPU".
( ), .
, (.. ) .
, , CPU, .

/net/ethernet/smsc/smsc 911x.c Linux.

Ethernet- SMSC LAN911x , , , . MAC, PHY TX RX FIFO .

SMSCLan9118 smsc911x_irqhandler, (INT_STS) ( INT_EN), ,        if (likely(intsts & inten & INT_STS_RSFL_))
1627.

INT_STS

#define INT_STS                         0x58

5.3 " " () 0x58

58h INT_STS Interrupt Status 

, smsc911x , HW.
32- ISR, :

u32 intsts = smsc911x_reg_read(pdata, INT_STS);

, 32 ( intsts) Boolean ANDed 32 ( inten).
, . , HW , ( INT_EN).
if , (INT_STS_RSFL _), .

5.3.3 INT_STSInterrupt Status Register

RX Status FIFO Level Interrupt (RSFL).
Generated when the RX Status FIFO reaches the programmed level

likely() CPU. (, ANDing , , ).

, .

LAN9118, .
, RX FIFO .

5.3.6 FIFO_INT—FIFO Level Interrupts

RX Status Level.
The value in this field sets the level, in number of DWORDs, at which the RX Status FIFO Level interrupt (RSFL) will be generated. 
When the RX Status FIFO used space is greater than this value an RX Status FIFO Level interrupt (RSFL) will be generated. 

smsc911x, -, . FIF Status FIFO DWORD. 0x00 (.. "" ). , " ".

+6

Source: https://habr.com/ru/post/1539980/


All Articles