diff options
author | Adrian Chadd <adrian@FreeBSD.org> | 2014-09-09 01:45:39 +0000 |
---|---|---|
committer | Adrian Chadd <adrian@FreeBSD.org> | 2014-09-09 01:45:39 +0000 |
commit | 9d3ddf438402c8e711dd639be6052d51cb45b680 (patch) | |
tree | 7a08d9539d5dc0c08bba7869418c535b30644538 /sys/netinet/ip_input.c | |
parent | b174de323a42a678e7204b372818f0425846c9db (diff) | |
download | src-9d3ddf438402c8e711dd639be6052d51cb45b680.tar.gz src-9d3ddf438402c8e711dd639be6052d51cb45b680.zip |
Add support for receiving and setting flowtype, flowid and RSS bucket
information as part of recvmsg().
This is primarily used for debugging/verification of the various
processing paths in the IP, PCB and driver layers.
Unfortunately the current implementation of the control message path
results in a ~10% or so drop in UDP frame throughput when it's used.
Differential Revision: https://reviews.freebsd.org/D527
Reviewed by: grehan
Notes
Notes:
svn path=/head/; revision=271293
Diffstat (limited to 'sys/netinet/ip_input.c')
-rw-r--r-- | sys/netinet/ip_input.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index d622e011ead0..c16017d88871 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -1662,6 +1662,43 @@ makedummy: if (*mp) mp = &(*mp)->m_next; } + + if (inp->inp_flags2 & INP_RECVFLOWID) { + uint32_t flowid, flow_type; + + flowid = m->m_pkthdr.flowid; + flow_type = M_HASHTYPE_GET(m); + + /* + * XXX should handle the failure of one or the + * other - don't populate both? + */ + *mp = sbcreatecontrol((caddr_t) &flowid, + sizeof(uint32_t), IP_FLOWID, IPPROTO_IP); + if (*mp) + mp = &(*mp)->m_next; + *mp = sbcreatecontrol((caddr_t) &flow_type, + sizeof(uint32_t), IP_FLOWTYPE, IPPROTO_IP); + if (*mp) + mp = &(*mp)->m_next; + } + +#ifdef RSS + if (inp->inp_flags2 & INP_RECVRSSBUCKETID) { + uint32_t flowid, flow_type; + uint32_t rss_bucketid; + + flowid = m->m_pkthdr.flowid; + flow_type = M_HASHTYPE_GET(m); + + if (rss_hash2bucket(flowid, flow_type, &rss_bucketid) == 0) { + *mp = sbcreatecontrol((caddr_t) &rss_bucketid, + sizeof(uint32_t), IP_RSSBUCKETID, IPPROTO_IP); + if (*mp) + mp = &(*mp)->m_next; + } + } +#endif } /* |