1) Use same scheme Michael and I discussed for a selected for a flowid

2) If flowid is not set, arrange so it is stored.
3) If flowid is set by lower layer, use it.

MFC after:	3 Months
This commit is contained in:
Randall Stewart 2011-02-06 13:17:40 +00:00
parent 5aa85abd1d
commit 38521fb9b4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=218371

View File

@ -5946,32 +5946,32 @@ sctp_input(struct mbuf *m, int off)
struct sctphdr *sh;
int offset;
int cpu_to_use;
uint32_t tag;
uint32_t flowid, tag;
if (mp_ncpus > 1) {
ip = mtod(m, struct ip *);
offset = off + sizeof(*sh);
if (SCTP_BUF_LEN(m) < offset) {
if ((m = m_pullup(m, offset)) == 0) {
SCTP_STAT_INCR(sctps_hdrops);
return;
}
ip = mtod(m, struct ip *);
}
sh = (struct sctphdr *)((caddr_t)ip + off);
if (sh->v_tag) {
tag = htonl(sh->v_tag);
if (m->m_flags & M_FLOWID) {
flowid = m->m_pkthdr.flowid;
} else {
/*
* Distribute new INIT's to all CPU's don't just
* pick on 0.
* No flow id built by lower layers fix it so we
* create one.
*/
struct timeval tv;
(void)SCTP_GETTIME_TIMEVAL(&tv);
tag = (uint32_t) tv.tv_usec;
ip = mtod(m, struct ip *);
offset = off + sizeof(*sh);
if (SCTP_BUF_LEN(m) < offset) {
if ((m = m_pullup(m, offset)) == 0) {
SCTP_STAT_INCR(sctps_hdrops);
return;
}
ip = mtod(m, struct ip *);
}
sh = (struct sctphdr *)((caddr_t)ip + off);
tag = htonl(sh->v_tag);
flowid = tag ^ ntohs(sh->dest_port) ^ ntohs(sh->src_port);
m->m_pkthdr.flowid = flowid;
m->m_flags |= M_FLOWID;
}
cpu_to_use = sctp_cpuarry[tag % mp_ncpus];
cpu_to_use = sctp_cpuarry[flowid % mp_ncpus];
sctp_queue_to_mcore(m, off, cpu_to_use);
return;
}