From owner-svn-src-head@FreeBSD.ORG Sun Feb 13 20:45:08 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2D1CE10656A4; Sun, 13 Feb 2011 20:45:08 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id F15A28FC0A; Sun, 13 Feb 2011 20:45:07 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 86FCD46B89; Sun, 13 Feb 2011 15:45:07 -0500 (EST) Date: Sun, 13 Feb 2011 20:45:07 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Randall Stewart In-Reply-To: <201102061317.p16DHfrW065985@svn.freebsd.org> Message-ID: References: <201102061317.p16DHfrW065985@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r218371 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Feb 2011 20:45:08 -0000 On Sun, 6 Feb 2011, Randall Stewart wrote: > Author: rrs > Date: Sun Feb 6 13:17:40 2011 > New Revision: 218371 > URL: http://svn.freebsd.org/changeset/base/218371 > > Log: > 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. Beware that selecting a flowid at this level has implications not just for load balancing, but also CPU affinity in the transmit path for multiqueue drivers such as cxgb, etc. With the pcbgroup patch going into the tree soon, flowids will grow types to be set by device drivers, network layers, etc, so that other layers can use those semantics. Once we do that, we'll need to retain that at the connection level, etc, as we.. Robert > > MFC after: 3 Months > > Modified: > head/sys/netinet/sctp_input.c > > Modified: head/sys/netinet/sctp_input.c > ============================================================================== > --- head/sys/netinet/sctp_input.c Sun Feb 6 12:21:29 2011 (r218370) > +++ head/sys/netinet/sctp_input.c Sun Feb 6 13:17:40 2011 (r218371) > @@ -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; > } >