From owner-freebsd-net Wed Aug 2 17: 1:32 2000 Delivered-To: freebsd-net@freebsd.org Received: from bubba.whistle.com (bubba.whistle.com [207.76.205.7]) by hub.freebsd.org (Postfix) with ESMTP id 7409A37B874 for ; Wed, 2 Aug 2000 17:01:23 -0700 (PDT) (envelope-from archie@whistle.com) Received: (from archie@localhost) by bubba.whistle.com (8.9.3/8.9.3) id RAA28226; Wed, 2 Aug 2000 17:01:16 -0700 (PDT) (envelope-from archie) From: Archie Cobbs Message-Id: <200008030001.RAA28226@bubba.whistle.com> Subject: Re: Max data queued for UDP In-Reply-To: <20000802111412.A29943@yahoo-inc.com> from jayanth at "Aug 2, 2000 11:14:12 am" To: jayanth Date: Wed, 2 Aug 2000 17:01:16 -0700 (PDT) Cc: freebsd-net@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL68 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org jayanth writes: > while running some tests for udp with very small packets(25 bytes) > I found that the total amount of data that can be queued > at the socket buffer(just queued, not read) is very limited, > close to around 4k - 5k bytes. > One of the issues is that the driver uses a cluster for > every data packet, however small the data packet is. > There is a per socket limit on the total amount of network > memory that can be used for a socket (sb->sb_mbmax), which > is typically 256k. There is also a variable that keeps > count of the total n/w network memory actually used > by the socket (sb->mb_cnt). The mb_cnt variable is > incremented by a cluster + sizeof(mbuf) for every > incoming packet. So for very small udp packets the total > no. of packets that can be queued is > sb_mbmax / (cluster + mbuf) = 256K / (2048 + 256) = 113 packets. > At this point, the sbspace() macro declares that there is > no space in the socket buffer, in terms of n/w memory. > (sbmax - sb_mbcnt becomes -ve) > > TCP already has an sbcompress() and I have code that does > the same for UDP. The code basically compresses the > data from the cluster into the mbuf and frees the > cluster, if the data fits in one mbuf. > > I am a little hesitant to do it in the driver code or > the ether_input() code as it might do a copy for > every protocol including tcp. > > feedback, please... IMHO, it makes sense to do it for UDP and raw sockets, but not generically. When you say "the driver uses a cluster for every data packet, however small the data packet is" are you referring to a specific Ethernet driver? If so then that driver is lame. It should at least have two possibilities: (a) normal mbuf, and (b) cluster. It's very easy and fast to make that minimal decision. -Archie ___________________________________________________________________________ Archie Cobbs * Whistle Communications, Inc. * http://www.whistle.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message