Reputation: 474
I know the fact - we should call netif_receive_skb() when we're implementing NAPI poll() function. However, I don't really understand why? why? why?....
If we call "netif_rx()" in napi->poll(), is there any "duplicate" queueing happened? or we raise duplicate softirq un-necessarily?
Actually, I did some sort of performance testing with iperf tool with 1G gigabit ethernet card and it only shows 10-30mbps throughput difference only. (However, if I call netif_rx() in napi->poll, it doubles # of NET_RX SIRQs...)
Why should we call netif_receive_skb() directly in napi->poll()? To process packet as much as possible in napi->poll() context is really helping the performance??
Best regards,
Upvotes: 4
Views: 5342
Reputation: 802
Maybe has to do with locking. netif_receive_skb() is to be called from NET_RX softirq, and softirqs can be executed simultaneously on different CPUs, so proper locking should be implemented to avoid race condition.
Upvotes: 1
Reputation: 46
When we try to review the source code, we will find that, every time we entered the netif_rx, it disabled the preempt, and by the time it left, it enabled the preempt again. Disabling/enabling preempt too often will certainly cause a performance(system performance) reduces.
Upvotes: 1