From owner-freebsd-net Wed Aug 2 11:14:23 2000 Delivered-To: freebsd-net@freebsd.org Received: from mrout1.yahoo.com (mrout1.yahoo.com [208.48.125.95]) by hub.freebsd.org (Postfix) with ESMTP id 4C5C237BDEC for ; Wed, 2 Aug 2000 11:14:19 -0700 (PDT) (envelope-from jayanth@yahoo-inc.com) Received: from milk.yahoo.com (milk.yahoo.com [206.251.16.37]) by mrout1.yahoo.com (8.10.0/8.10.0/y.out) with ESMTP id e72IEC750436 for ; Wed, 2 Aug 2000 11:14:16 -0700 (PDT) Received: (from jayanth@localhost) by milk.yahoo.com (8.8.8/8.6.12) id LAA01215 for freebsd-net@FreeBSD.ORG; Wed, 2 Aug 2000 11:14:12 -0700 (PDT) Date: Wed, 2 Aug 2000 11:14:12 -0700 From: jayanth To: freebsd-net@FreeBSD.ORG Subject: Max data queued for UDP Message-ID: <20000802111412.A29943@yahoo-inc.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0.1us Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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... jayanth To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message