Commit e2580c9e authored by David S. Miller's avatar David S. Miller

Merge bk://kernel.bkbits.net/acme/net-2.6

into nuts.davemloft.net:/disk1/BK/net-2.6
parents c53373b8 44551947
...@@ -429,6 +429,11 @@ static inline int sk_stream_wspace(struct sock *sk) ...@@ -429,6 +429,11 @@ static inline int sk_stream_wspace(struct sock *sk)
extern void sk_stream_write_space(struct sock *sk); extern void sk_stream_write_space(struct sock *sk);
static inline int sk_stream_memory_free(struct sock *sk)
{
return sk->sk_wmem_queued < sk->sk_sndbuf;
}
/* The per-socket spinlock must be held here. */ /* The per-socket spinlock must be held here. */
#define sk_add_backlog(__sk, __skb) \ #define sk_add_backlog(__sk, __skb) \
do { if (!(__sk)->sk_backlog.tail) { \ do { if (!(__sk)->sk_backlog.tail) { \
......
...@@ -670,11 +670,6 @@ static int wait_for_tcp_connect(struct sock *sk, int flags, long *timeo_p) ...@@ -670,11 +670,6 @@ static int wait_for_tcp_connect(struct sock *sk, int flags, long *timeo_p)
return 0; return 0;
} }
static inline int tcp_memory_free(struct sock *sk)
{
return sk->sk_wmem_queued < sk->sk_sndbuf;
}
/* /*
* Wait for more memory for a socket * Wait for more memory for a socket
*/ */
...@@ -686,7 +681,7 @@ static int wait_for_tcp_memory(struct sock *sk, long *timeo) ...@@ -686,7 +681,7 @@ static int wait_for_tcp_memory(struct sock *sk, long *timeo)
long current_timeo = *timeo; long current_timeo = *timeo;
DEFINE_WAIT(wait); DEFINE_WAIT(wait);
if (tcp_memory_free(sk)) if (sk_stream_memory_free(sk))
current_timeo = vm_wait = (net_random() % (HZ / 5)) + 2; current_timeo = vm_wait = (net_random() % (HZ / 5)) + 2;
for (;;) { for (;;) {
...@@ -701,13 +696,13 @@ static int wait_for_tcp_memory(struct sock *sk, long *timeo) ...@@ -701,13 +696,13 @@ static int wait_for_tcp_memory(struct sock *sk, long *timeo)
if (signal_pending(current)) if (signal_pending(current))
goto do_interrupted; goto do_interrupted;
clear_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags); clear_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags);
if (tcp_memory_free(sk) && !vm_wait) if (sk_stream_memory_free(sk) && !vm_wait)
break; break;
set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); set_bit(SOCK_NOSPACE, &sk->sk_socket->flags);
tp->write_pending++; tp->write_pending++;
release_sock(sk); release_sock(sk);
if (!tcp_memory_free(sk) || vm_wait) if (!sk_stream_memory_free(sk) || vm_wait)
current_timeo = schedule_timeout(current_timeo); current_timeo = schedule_timeout(current_timeo);
lock_sock(sk); lock_sock(sk);
tp->write_pending--; tp->write_pending--;
...@@ -838,7 +833,7 @@ static ssize_t do_tcp_sendpages(struct sock *sk, struct page **pages, int poffse ...@@ -838,7 +833,7 @@ static ssize_t do_tcp_sendpages(struct sock *sk, struct page **pages, int poffse
if (!tp->send_head || (copy = mss_now - skb->len) <= 0) { if (!tp->send_head || (copy = mss_now - skb->len) <= 0) {
new_segment: new_segment:
if (!tcp_memory_free(sk)) if (!sk_stream_memory_free(sk))
goto wait_for_sndbuf; goto wait_for_sndbuf;
skb = tcp_alloc_pskb(sk, 0, tp->mss_cache, skb = tcp_alloc_pskb(sk, 0, tp->mss_cache,
...@@ -1005,7 +1000,7 @@ int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, ...@@ -1005,7 +1000,7 @@ int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
/* Allocate new segment. If the interface is SG, /* Allocate new segment. If the interface is SG,
* allocate skb fitting to single page. * allocate skb fitting to single page.
*/ */
if (!tcp_memory_free(sk)) if (!sk_stream_memory_free(sk))
goto wait_for_sndbuf; goto wait_for_sndbuf;
skb = tcp_alloc_pskb(sk, select_size(sk, tp), skb = tcp_alloc_pskb(sk, select_size(sk, tp),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment