Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 29 Mar 2015 10:13:39 +0200
From:      Hans Petter Selasky <hps@selasky.org>
To:        Gleb Smirnoff <glebius@FreeBSD.org>, Fabien Thomas <fabient@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r280759 - head/sys/netinet
Message-ID:  <5517B433.5010508@selasky.org>
In-Reply-To: <20150328191629.GY64665@FreeBSD.org>
References:  <201503271326.t2RDQxd3056112@svn.freebsd.org> <20150328083443.GV64665@FreeBSD.org> <20150328191629.GY64665@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 03/28/15 20:16, Gleb Smirnoff wrote:
> +uint16_t
> +ip_newid(void)
> +{
> +
> +	counter_u64_add(V_ip_id, 1);
> +	return (htons((*(uint64_t *)zpcpu_get(V_ip_id)) & 0xffff));
> +}

Technically you would need to enter a critical section here, so that the 
current process doesn't get swapped to a different CPU between the 
counter add and the zpcpu_get.

--HPS



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