Ben Greear wrote: > On a related note, I am now working on a way to use a hook in the > netif_wake_queue callback to wake up pktgen. This should allow me to > have a pktgen that does not need to spin in a tight loop like it does > now. So far, I was able to saturate two GigE ports using about 3% of > the CPU (as reported by top), using 1514 byte pkts. Still tweaking > to fix some corner cases... I think this is mostly working now. The patch to netdevice.h looks like this:: --- linux-2.6.7/include/linux/netdevice.h 2004-06-15 22:20:04.000000000 -0700 +++ linux-2.6.7.p4s/include/linux/netdevice.h 2004-10-06 14:31:54.000000000 -0700 @@ -466,9 +474,17 @@ void (*poll_controller)(struct net_device *dev); #endif + /* Callback for when the queue is woken, used by pktgen currently */ + int (*notify_queue_woken)(struct net_device *dev); + void* nqw_data; /* To be used by the method above as needed */ + /* bridge stuff */ struct net_bridge_port *br_port; +#if defined(CONFIG_MACVLAN) || defined(CONFIG_MACVLAN_MODULE) + struct macvlan_port *macvlan_priv; +#endif + #ifdef CONFIG_NET_FASTROUTE #define NETDEV_FASTROUTE_HMASK 0xF /* Semi-private data. Keep it at the end of device struct. */ @@ -619,8 +635,13 @@ if (netpoll_trap()) return; #endif - if (test_and_clear_bit(__LINK_STATE_XOFF, &dev->state)) + if (test_and_clear_bit(__LINK_STATE_XOFF, &dev->state)) { __netif_schedule(dev); + + if (dev->notify_queue_woken) { + dev->notify_queue_woken(dev); + } + } } I'm attaching my version of pktgen since the diff is bigger than the actual file. With this, I can send right at 600kpps to myself (60 byte + CRC pkts), and only use about 35% cpu as reported by top. I also tried maxing out 6 ports and I hit what I believe is the PCI-X limit on my machine with an aggregate throughput of about 1.3Gbps tx + 1.3Gbps rx. CPU load is about 21% in this case. It may be that other programs would like to use the notify_queue_woken hook, so if this were ever to hit the kernel proper, might want to make this a linked list of callbacks instead of a simple pointer. Enjoy, Ben -- Ben Greear Candela Technologies Inc http://www.candelatech.com