in_broadcast() called for almost every packet in ip_output()

Adrian Chadd adrian.chadd at
Wed Jul 20 20:41:20 UTC 2016


I care about the performance of unconnected UDP; it's how a lot of UDP
network services work to arbitrary clients. It works fine and
parallelises fine in the RSS case (as in, linear scaling to
num-queues; so I've done millions of pps through that path.)

The in_broadcast() overhead sucked; I found that out when using IP
aliases on an interface and discovered the in_broadcast() check sucked
time if you didn't bind the local address (forcing it to an address
lookup/determination each time, for reasons I forgot.)

So, ideally we'd just do some two-stage caching mechanism using
atomics, rcu, generation count, etc where we'd do a cheap hash lookup
to see if we have to do the slow broadcast check, and then the
broadcast check itself would be a hash rather than a linear O(n) list


More information about the freebsd-transport mailing list