udp: assign flowid to udp sockets round-robin

On a 2x8x2 SKL this increases measured throughput with 64
netperf -H $DUT -t UDP_STREAM -- -m 1

from 590kpps to 1.1Mpps
before:
https://people.freebsd.org/~mmacy/2018.05.11/udpsender.svg
after:
https://people.freebsd.org/~mmacy/2018.05.11/udpsender2.svg
This commit is contained in:
Matt Macy 2018-05-23 20:50:09 +00:00
parent d008c0d75f
commit 630ba2c514
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=334116

View File

@ -1565,6 +1565,7 @@ udp_abort(struct socket *so)
static int
udp_attach(struct socket *so, int proto, struct thread *td)
{
static uint32_t udp_flowid;
struct inpcb *inp;
struct inpcbinfo *pcbinfo;
int error;
@ -1585,6 +1586,8 @@ udp_attach(struct socket *so, int proto, struct thread *td)
inp = sotoinpcb(so);
inp->inp_vflag |= INP_IPV4;
inp->inp_ip_ttl = V_ip_defttl;
inp->inp_flowid = atomic_fetchadd_int(&udp_flowid, 1);
inp->inp_flowtype = M_HASHTYPE_OPAQUE;
error = udp_newudpcb(inp);
if (error) {