1

I have gone through multiple posts (in and outside Stackoverflow) regarding this topic. Currently, I am working on to modify the i40e-2.0.30 driver for Intel X710 NIC.

Thanks to this illustrated blog post (https://blog.packagecloud.io/eng/2016/06/22/monitoring-tuning-linux-networking-stack-receiving-data/), understanding the driver code became lot easier.

My post is particularly concerned with the NAPI Poll mechanism. I understand that NAPI Poll function is triggered when a packet arrives, and if the amount of work done while receiving the packets exceeds the allocated budget, NAPI Polling continues; else polling stops.

Based on this information, I modified my driver to keep polling if a particular signature of data arrives on a particular queue ( using flow director), e.g. UDP Packets on Port XXX for 10,000 poll cycles. But, I am trying to eliminate the possibility of interrupts as much as possible.

Thus, here is my main questions. Will I be able to schedule the NAPI poll to be executed at a certain point in time ? Like, I want NAPI poll to be executed every 500 ms and may be last for 20ms. For instance, I will be expecting my packet at time T ms, while I might start the polling at time (T-10) ms and stop polling at (T + 10) ms. This may, I might be able to reduce the usage of interrupts. Right now, I have been resetting the interrupts every 10,000 poll cycles.

Any explanation or reference on this would be really helpful.

Thanks, Kushal.

cooshal
  • 758
  • 8
  • 21
  • *"e.g. UDP Packets on Port XXX"* -- Why is your driver for an Ethernet controller concerned with TCP/UDP ports? You don't seem to be maintaining the TCP/IP model or proper code modularity. *"I am trying to eliminate the possibility of interrupts as much as possible."* -- Your goal is misguided. You will probably lower (not improve) performance. See https://stackoverflow.com/questions/23574203/regarding-napi-implementation-in-linux-kernel – sawdust Sep 08 '17 at 08:14
  • @sawdust: hey ! thanks for the reply. I saw your stackoverflow answer in the given url too. My goal is to establish a synchronous communication between two hosts and to provide an upper bound on the receiving side jitter. that was the reason, I am trying to eliminate as much interrupts as possible. The Flow Director example could be for a heartbeat necesary for synchrounous communication. I will go through your answer again for a deeper understanding. thanks again – cooshal Sep 08 '17 at 10:54
  • Hi again @sawdust, I tried implementing few things during this weekend. I tried to invoke the NAPI scheduling and NAPI poll on regular time intervals. So, my point was to try and avoid the Rx Interrupts as much as possible and rather invoke NAPI Poll during my expected packet arrival time (every 500 ms, for example). I tried invoking napi_schedule on every time interval tick event. It seems like it doesn't work like that. Any suggestions on this ? or am I trying the wrong approach here ? Any inputs/feedbacks would be valuable. Thanks. – cooshal Sep 10 '17 at 18:17
  • Have you looked at kernel source for examples? The [Free Electrons cross reference](http://elixir.free-electrons.com/linux/latest/source) is very handy. Your pursuit of *"avoid(ing) the Rx Interrupts as much as possible"* is IMO misguided because that is not what NAPI is for. Perhaps you should attach an Ethernet hub, and use Wireshark (on another PC) to monitor the Ethernet traffic in and out of your target host. Seems like you don't understand the existence of other protocols like ARP, ICMP, and DHCP that will generate unexpected frames. – sawdust Sep 11 '17 at 23:26
  • well, you are right. that is the reason I have been testing my settings by setting the ports in promiscuous mode. its similar to what wireshark does for monitoring purposes. Yeah, I have been looking into the kernel source lately. Somehow, there must be a flaw in my process/steps. I am trying to figure that out. Thank you. I will post further if I figure out something. – cooshal Sep 12 '17 at 08:49

0 Answers0