From owner-freebsd-net@FreeBSD.ORG Tue Dec 31 04:03:13 2013 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E2DB1A21 for ; Tue, 31 Dec 2013 04:03:13 +0000 (UTC) Received: from mail-yh0-x22e.google.com (mail-yh0-x22e.google.com [IPv6:2607:f8b0:4002:c01::22e]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A14F91DAB for ; Tue, 31 Dec 2013 04:03:13 +0000 (UTC) Received: by mail-yh0-f46.google.com with SMTP id l109so2512846yhq.5 for ; Mon, 30 Dec 2013 20:03:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:mime-version:in-reply-to:content-type :content-transfer-encoding:message-id:cc:from:subject:date:to; bh=HiJwDr5tBb98oog11mFBpF5sLwfnlik4DbywvXk/ZCU=; b=T4RjtVBtCNAc4/byhNlze40fZRlgL5Vtob7s9O6fZmfgM7ah24r9L5mrbP2qmNVIIi /Px1lHCXhMeZTZ4TvY47E3QEmemlbfUFKMPHG6EfJqqphAtUE3g5N1Hf17kHGQPWMVkN YBnYUPN+sRtBX4L8fwTUtvEtgqyTZ9xZke4Y4ggO3gR997pK+d88QnMir4B4iYgmdZem uUjONiNpqZN2pqyGqPPAF9gFK2MVCpEl8VJyjO8vGssinQSN5LVb9agKd5zK88c2AAeG BNUAsLvbchU09caVD2CxGSoWhtIdaurtdQYqNQnKlK/qGYPa+3tV29NTnk5uQqSktUro IjVg== X-Received: by 10.236.44.102 with SMTP id m66mr5437150yhb.89.1388462592317; Mon, 30 Dec 2013 20:03:12 -0800 (PST) Received: from ?IPv6:2600:1013:b01b:979b:b848:f680:19c2:b4ce? ([2600:1013:b01b:979b:b848:f680:19c2:b4ce]) by mx.google.com with ESMTPSA id h66sm64555321yhb.7.2013.12.30.20.03.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 30 Dec 2013 20:03:11 -0800 (PST) References: Mime-Version: 1.0 (1.0) In-Reply-To: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Message-Id: X-Mailer: iPhone Mail (10B350) From: Oleg Moskalenko Subject: Re: Question about the "connected" UDP sockets Date: Mon, 30 Dec 2013 20:03:08 -0800 To: Sepherosa Ziehau Cc: FreeBSD Net X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Dec 2013 04:03:13 -0000 Thanks a lot ! Oleg Sent from my iPhone On Dec 30, 2013, at 7:38 PM, Sepherosa Ziehau wrote: > On Fri, Dec 27, 2013 at 1:49 AM, Oleg Moskalenko wro= te: >> Hi >>=20 >> I cannot find the information about the implementation details of the >> "connected" UDP sockets in FreeBSD. I know that in older Linux kernels al= l >=20 >=20 > You could start from sys/netinet/udp_usrreq.c:udp_connect(). >=20 >=20 >> UDP sockets are stored in a hash table - and the remote IP:port are not >> used for the hash calculation, so the performance is awful when you have >> thousands "connected" UDP sockets on the same local IP:port address. So a= >> UDP packet incoming to the local address has to go through the long list o= f >> sockets to find the proper destination. >>=20 >> How it is done in the FreeBSD ? Are the UDP "connected" sockets using a >> hash table with key based upon 5-tuple (protocol, remote-ip, remote-port,= >> local-ip, local-port} ? >=20 >=20 > UDP uses its own hash table for "connected" sockets (inpcb actually). > The "connected" inpcbs are hashed using lport/fport/laddr/faddr > (4-tuple). >=20 > Best Regards, > sephe