Some words about implementation of network drivers in Linux.

How to test the network part of the processor for maximum processing speed?

Of course it is better to test the network part with a hardware network tester, usually with testers jdsu. There is another way of testing: to write a simple utility that would continuously send traffic to the network.

The easiest example of such a programm:

  while (number > 0) {
    c = sendto(fd, file_buf, frameLen, 0, (struct sockaddr *)&sa, sizeof (sa));
    number --;

What has processor to do with the incoming traffic?

Due to the fact that we are interested in high performance we do not need the incoming packet to be transfered to the kernel.

We should loopback the packet while running of interrupt receive function and send it back to the network. In a scientific language it calls loop.

For solving of this problem we can use Linux network stack.

Network drivers are placed here:

To loopback the packet we should find the interrupt receive function and send the received there packet to the network back. Generally, each packet receiving has a function call of netif_receive_skb at the end. This function transmit the received packet to the kernel.

Run function search netif_receive_skb. The place where it is called from is generally the interrupt receive function.

Befor calling of netif_receive_skb we transmit the packet back to the network, and disable the call of netif_receive_skb.

  if (dev_queue_xmit(skb)){
//			netif_receive_skb(skb);

We should also find the place where the initial header have been removed. As a rule, it looks like the following:

skb->protocol = eth_type_trans(skb, mp->dev);

Comment it too:

//skb->protocol = eth_type_trans(skb, mp->dev);

That's all. All the received packets will be send back to the network immediatly whithout being transmitted to the kernel.