* When copying the flowid from inp -> outbound mbuf, also assign the

hashtype to to the outbound mbuf as well as the flowid.

* Add in socket options to fetch the hashid, the hashtype and RSS CPU
  ID for a given socket.
This commit is contained in:
Adrian Chadd 2014-05-18 22:37:31 +00:00
parent 2f71993288
commit 9c42397277
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=266421

View File

@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
#include "opt_mpath.h"
#include "opt_route.h"
#include "opt_sctp.h"
#include "opt_rss.h"
#include <sys/param.h>
#include <sys/systm.h>
@ -71,6 +72,7 @@ __FBSDID("$FreeBSD$");
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <netinet/in_pcb.h>
#include <netinet/in_rss.h>
#include <netinet/in_var.h>
#include <netinet/ip_var.h>
#include <netinet/ip_options.h>
@ -144,6 +146,7 @@ ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro, int flags,
M_SETFIB(m, inp->inp_inc.inc_fibnum);
if (inp->inp_flags & (INP_HW_FLOWID|INP_SW_FLOWID)) {
m->m_pkthdr.flowid = inp->inp_flowid;
M_HASHTYPE_SET(m, inp->inp_flowtype);
m->m_flags |= M_FLOWID;
}
}
@ -1171,6 +1174,11 @@ ip_ctloutput(struct socket *so, struct sockopt *sopt)
case IP_DONTFRAG:
case IP_BINDANY:
case IP_RECVTOS:
case IP_FLOWID:
case IP_FLOWTYPE:
#ifdef RSS
case IP_RSSCPUID:
#endif
switch (sopt->sopt_name) {
case IP_TOS:
@ -1232,6 +1240,18 @@ ip_ctloutput(struct socket *so, struct sockopt *sopt)
case IP_RECVTOS:
optval = OPTBIT(INP_RECVTOS);
break;
case IP_FLOWID:
optval = inp->inp_flowid;
break;
case IP_FLOWTYPE:
optval = inp->inp_flowtype;
break;
#ifdef RSS
case IP_RSSCPUID:
optval = rss_hash2cpuid(inp->inp_flowid,
inp->inp_flowtype);
break;
#endif
}
error = sooptcopyout(sopt, &optval, sizeof optval);
break;