Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Feb 2011 15:29:24 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        Randall Stewart <rrs@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r218232 - head/sys/netinet
Message-ID:  <201102031529.25072.jhb@freebsd.org>
In-Reply-To: <201102031922.p13JML8i055697@svn.freebsd.org>
References:  <201102031922.p13JML8i055697@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday, February 03, 2011 2:22:21 pm Randall Stewart wrote:
> Author: rrs
> Date: Thu Feb  3 19:22:21 2011
> New Revision: 218232
> URL: http://svn.freebsd.org/changeset/base/218232
> 
> Log:
>   1) Move per John Baldwin to mp_maxid
>   2) Some signed/unsigned errors found by Mac OS compiler (from Michael)
>   3) a couple of copyright updates on the effected files.

Note that mp_maxid is the maxium valid ID, so you typically have to do things 
like:

	for (i = 0; i <= mp_maxid; i++) {
		if (CPU_ABSENT(i))
			continue;
		...
	}

There is a CPU_FOREACH() macro that does the above (but assumes you want to 
skip over non-existent CPUs).

> Modified: head/sys/netinet/sctp_input.c
> 
==============================================================================
> --- head/sys/netinet/sctp_input.c	Thu Feb  3 18:50:10 2011	(r218231)
> +++ head/sys/netinet/sctp_input.c	Thu Feb  3 19:22:21 2011	(r218232)
> @@ -1,5 +1,8 @@
>  /*-
>   * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
> + * Copyright (c) 2008-2011, by Randall Stewart, rrs@lakerest.net and
> + *                          Michael Tuexen, tuexen@fh-muenster.de
> + *                          All rights reserved.
>   *
>   * Redistribution and use in source and binary forms, with or without
>   * modification, are permitted provided that the following conditions are 
met:
> @@ -2918,7 +2921,7 @@ sctp_handle_ecn_echo(struct sctp_ecne_ch
>  	uint8_t override_bit = 0;
>  	uint32_t tsn, window_data_tsn;
>  	int len;
> -	int pkt_cnt;
> +	unsigned int pkt_cnt;
>  
>  	len = ntohs(cp->ch.chunk_length);
>  	if ((len != sizeof(struct sctp_ecne_chunk)) &&
> @@ -5933,7 +5936,7 @@ sctp_input(struct mbuf *m, int off)
>  	int offset;
>  	int cpu_to_use;
>  
> -	if (mp_ncpus > 1) {
> +	if (mp_maxid > 1) {

The old version of this is still correct.

>  		ip = mtod(m, struct ip *);
>  		offset = off + sizeof(*sh);
>  		if (SCTP_BUF_LEN(m) < offset) {
> @@ -5944,7 +5947,7 @@ sctp_input(struct mbuf *m, int off)
>  			ip = mtod(m, struct ip *);
>  		}
>  		sh = (struct sctphdr *)((caddr_t)ip + off);
> -		cpu_to_use = ntohl(sh->v_tag) % mp_ncpus;
> +		cpu_to_use = ntohl(sh->v_tag) % mp_maxid;

Hmmm, this is more complicated.   Can sctp_queue_to_mcore() handle the fact 
that a cpu_to_use value might not be valid?  If not you might want to maintain 
a separate "dense" virtual CPU ID table numbered 0 .. mp_ncpus - 1 that maps 
to "present" FreeBSD CPU IDs.  I think Robert has done something similar to 
support RSS in TCP.  Does that make sense?

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201102031529.25072.jhb>