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.orig Thu Dec 27 10:51:56 2001 +++ linux/include/net/sock.h Thu Dec 27 10:53:26 2001 @@ -1231,7 +1231,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 President of Candela Technologies Inc http://www.candelatech.com ScryMUD: http://scry.wanfear.com http://scry.wanfear.com/~greear - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/