Two ways to receiving rx packets.

1) Non-Napi aware driver:

The device driver interrupt handler calls netif_rx to put the skb received from netdevice into input_pkt_queue per CPU and then call netif_rx_schedule() to add blacklog dev(virtul device) into CPU poll_list and raises softirq.

2) Napi aware driver:

The device driver interrupt handler calls netif_rx_schedule() or netif_rx_schedule_pre() and __netif_rx_schedule() to add dev into poll_list and raises softirq.

After raise_softirq NET_RX_SOFTIRQ the net_rx_action() will be called.  net_rx_action() is added by net_dev_init function with the function open_softirq() to add into NET_RX_SOFTIRQ.

IN net_rx_action() the Non-Napi aware device will run the poll function asigned by net_dev_init() with the line of "sd->backlog.poll = process_backlog"

The Napi aware device will register poll function into poll_list in the networking initial function of device driver, in net_rx_action function the the poll_list will retrived all the devices and run their poll functions. The packets receiving from Non-Napi aware driver, the process_blacklog function will be run in net_rx_action().    

 

  10-2. NAPI-aware drivers versus non-NAPI-aware devices

 

3)when the packets, which received by Non-NAPI device, pass to the function of  process_blacklog() , they are dequeued from input_pkt_queue of local CPU and pass to netif_receive_skb(). viceversa, when the packets, received by Napi aware device, would passed to the poll function implemented by device driver and later on pass to netif_receive_skb() function.

創作者介紹
創作者 Horace papa's life 的頭像
horace papa

Horace papa's life

horace papa 發表在 痞客邦 留言(0) 人氣( 45 )