public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ben Greear <greearb@candelatech.com>
To: linux-kernel <linux-kernel@vger.kernel.org>,
	"David S. Miller" <davem@redhat.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: [PATCH]:  Make UDP wait for 64k of free buffer before telling select/poll there is space to send.
Date: Sun, 23 Dec 2001 23:24:36 -0700	[thread overview]
Message-ID: <3C26CA24.4090809@candelatech.com> (raw)

This should allow better handling of large (> 2048 byte) UDP packets
when the socket write buffer is relatively large....

diff -u -r -N -X /home/greear/exclude.list linux/include/net/sock.h linux.dev/include/net/sock.h
--- linux/include/net/sock.h	Fri Dec 21 10:42:04 2001
+++ linux.dev/include/net/sock.h	Sun Dec 23 12:22:52 2001
@@ -1230,7 +1230,16 @@
   */
  static inline int sock_writeable(struct sock *sk)
  {
- 
return sock_wspace(sk) >= SOCK_MIN_WRITE_SPACE;
+   /* The goal is to only signal writable when there is at least 64k of buffer space
+    * when your send buffers are 128k or bigger.  The reason is that otherwise
+    * you get many failed UDP sends when you run > SOCK_MIN_WRITE_SPACE sized packets
+    * at extreme speed (ie faster than your network can keep up).  This change is
+    * designed to make select/poll wait untill you can actually be assured of sending
+    * the UDP packet at least into the kernel buffers w/out dropping it.
+    * This puts us more in line with sock_dev_write_space in core/sock.c too. --Ben
+    */
+   return sock_wspace(sk) >= max(SOCK_MIN_WRITE_SPACE,
+                                 min((unsigned int)(0xFFFF), sk->sndbuf >> 1));
  }

  static inline int gfp_any(void)

-- 
Ben Greear <greearb@candelatech.com>       <Ben_Greear AT excite.com>
President of Candela Technologies Inc      http://www.candelatech.com
ScryMUD:  http://scry.wanfear.com     http://scry.wanfear.com/~greear



                 reply	other threads:[~2001-12-24  6:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3C26CA24.4090809@candelatech.com \
    --to=greearb@candelatech.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=davem@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox