ethernet: If caller thread cpu is fixed, pass cpuid to ether_input_pkt()
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Sun, 9 Mar 2014 11:28:18 +0000 (19:28 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Sun, 9 Mar 2014 12:11:16 +0000 (20:11 +0800)
commitff37a3565eba5b54853bbc55b4cbe08fb9511b90
treed4e70bd11ab2ede861ae088136955109359c8fdd
parent35c7df0f4f27546af06ca79739de2787af052ad5
ethernet: If caller thread cpu is fixed, pass cpuid to ether_input_pkt()

So we could use optimized lwkt_sendmsg_oncpu() instead of lwkt_sendmsg(),
if the target netisr is on the same cpu as caller thread cpu.  Mainly to
avoid unnecessary wakeup() IPIs to other cpus.

THE RESULT:

On i7-3770 w/ HT enabled (8 logical cpus); NIC is 82599ES w/ 8 RX rings
and 8 TX rings.  Run:
    repeat 10 tcp_stream -H ... -i 256 -l 10 -r
(256 netperf TCP_MAERTS instances for 10 seconds, 10 rounds)

Total amount of cross IPIs before this commit is 6946097.  Total amount
of cross IPIs as of this commit is 5445324.  ~22% unnecessary wakeup()
IPIs are avoided!
sys/dev/netif/bce/if_bce.c
sys/dev/netif/bnx/if_bnx.c
sys/dev/netif/emx/if_emx.c
sys/dev/netif/igb/if_igb.c
sys/dev/netif/ix/if_ix.c
sys/dev/netif/jme/if_jme.c
sys/net/if_ethersubr.c
sys/net/if_var.h