From 6081070972e396d68bcbec5014c0d14e154e43c0 Mon Sep 17 00:00:00 2001 From: dlg Date: Thu, 8 Oct 2015 11:39:59 +0000 Subject: [PATCH] if the mbuf has a valid flowid, use it instead of using siphash24 and a bunch of header fields we have to parse the mbuf for. siphash24 is about 20% of the cost of sending a udp packet on a trunk interface with tcpbench on my box. if there's a flowid set we get all that back. ok mpi@ mikeb@ sthen@ --- sys/net/if_trunk.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/net/if_trunk.c b/sys/net/if_trunk.c index 8678fe4f1bb..4285dbe0d12 100644 --- a/sys/net/if_trunk.c +++ b/sys/net/if_trunk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_trunk.c,v 1.119 2015/10/05 13:00:04 mikeb Exp $ */ +/* $OpenBSD: if_trunk.c,v 1.120 2015/10/08 11:39:59 dlg Exp $ */ /* * Copyright (c) 2005, 2006, 2007 Reyk Floeter @@ -969,6 +969,9 @@ trunk_hashmbuf(struct mbuf *m, SIPHASH_KEY *key) #endif SIPHASH_CTX ctx; + if (m->m_pkthdr.flowid & M_FLOWID_VALID) + return (m->m_pkthdr.flowid & M_FLOWID_MASK); + SipHash24_Init(&ctx, key); off = sizeof(*eh); if (m->m_len < off) -- 2.20.1