Commit 62c06801 authored by Thomas Graf's avatar Thomas Graf

[NET] Convert sk_queue_shrunk into SOCK_QUEUE_SHRUNK flag

Signed-off-by: default avatarThomas Graf <tgraf@suug.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e183abe6
...@@ -164,7 +164,6 @@ struct sock_common { ...@@ -164,7 +164,6 @@ struct sock_common {
* @sk_sndmsg_off - cached offset for sendmsg * @sk_sndmsg_off - cached offset for sendmsg
* @sk_send_head - front of stuff to transmit * @sk_send_head - front of stuff to transmit
* @sk_write_pending - a write to stream socket waits to start * @sk_write_pending - a write to stream socket waits to start
* @sk_queue_shrunk - write queue has been shrunk recently
* @sk_state_change - callback to indicate change in the state of the sock * @sk_state_change - callback to indicate change in the state of the sock
* @sk_data_ready - callback to indicate there is data to be processed * @sk_data_ready - callback to indicate there is data to be processed
* @sk_write_space - callback to indicate there is bf sending space available * @sk_write_space - callback to indicate there is bf sending space available
...@@ -243,7 +242,6 @@ struct sock { ...@@ -243,7 +242,6 @@ struct sock {
struct sk_buff *sk_send_head; struct sk_buff *sk_send_head;
int sk_write_pending; int sk_write_pending;
void *sk_security; void *sk_security;
__u8 sk_queue_shrunk;
/* three bytes hole, try to pack */ /* three bytes hole, try to pack */
void (*sk_state_change)(struct sock *sk); void (*sk_state_change)(struct sock *sk);
void (*sk_data_ready)(struct sock *sk, int bytes); void (*sk_data_ready)(struct sock *sk, int bytes);
...@@ -385,6 +383,7 @@ enum sock_flags { ...@@ -385,6 +383,7 @@ enum sock_flags {
SOCK_RCVTSTAMP, /* %SO_TIMESTAMP setting */ SOCK_RCVTSTAMP, /* %SO_TIMESTAMP setting */
SOCK_NO_LARGESEND, /* whether to sent large segments or not */ SOCK_NO_LARGESEND, /* whether to sent large segments or not */
SOCK_LOCALROUTE, /* route locally only, %SO_DONTROUTE setting */ SOCK_LOCALROUTE, /* route locally only, %SO_DONTROUTE setting */
SOCK_QUEUE_SHRUNK, /* write queue has been shrunk recently */
}; };
static inline void sock_set_flag(struct sock *sk, enum sock_flags flag) static inline void sock_set_flag(struct sock *sk, enum sock_flags flag)
...@@ -449,7 +448,7 @@ static inline void sk_stream_set_owner_r(struct sk_buff *skb, struct sock *sk) ...@@ -449,7 +448,7 @@ static inline void sk_stream_set_owner_r(struct sk_buff *skb, struct sock *sk)
static inline void sk_stream_free_skb(struct sock *sk, struct sk_buff *skb) static inline void sk_stream_free_skb(struct sock *sk, struct sk_buff *skb)
{ {
sk->sk_queue_shrunk = 1; sock_set_flag(sk, SOCK_QUEUE_SHRUNK);
sk->sk_wmem_queued -= skb->truesize; sk->sk_wmem_queued -= skb->truesize;
sk->sk_forward_alloc += skb->truesize; sk->sk_forward_alloc += skb->truesize;
__kfree_skb(skb); __kfree_skb(skb);
......
...@@ -3935,7 +3935,7 @@ void tcp_cwnd_application_limited(struct sock *sk) ...@@ -3935,7 +3935,7 @@ void tcp_cwnd_application_limited(struct sock *sk)
/* When incoming ACK allowed to free some skb from write_queue, /* When incoming ACK allowed to free some skb from write_queue,
* we remember this event in flag sk->sk_queue_shrunk and wake up socket * we remember this event in flag SOCK_QUEUE_SHRUNK and wake up socket
* on the exit from tcp input handler. * on the exit from tcp input handler.
* *
* PROBLEM: sndbuf expansion does not work well with largesend. * PROBLEM: sndbuf expansion does not work well with largesend.
...@@ -3963,8 +3963,8 @@ static void tcp_new_space(struct sock *sk) ...@@ -3963,8 +3963,8 @@ static void tcp_new_space(struct sock *sk)
static inline void tcp_check_space(struct sock *sk) static inline void tcp_check_space(struct sock *sk)
{ {
if (sk->sk_queue_shrunk) { if (sock_flag(sk, SOCK_QUEUE_SHRUNK)) {
sk->sk_queue_shrunk = 0; sock_reset_flag(sk, SOCK_QUEUE_SHRUNK);
if (sk->sk_socket && if (sk->sk_socket &&
test_bit(SOCK_NOSPACE, &sk->sk_socket->flags)) test_bit(SOCK_NOSPACE, &sk->sk_socket->flags))
tcp_new_space(sk); tcp_new_space(sk);
......
...@@ -593,9 +593,9 @@ int tcp_trim_head(struct sock *sk, struct sk_buff *skb, u32 len) ...@@ -593,9 +593,9 @@ int tcp_trim_head(struct sock *sk, struct sk_buff *skb, u32 len)
skb->ip_summed = CHECKSUM_HW; skb->ip_summed = CHECKSUM_HW;
skb->truesize -= len; skb->truesize -= len;
sk->sk_queue_shrunk = 1;
sk->sk_wmem_queued -= len; sk->sk_wmem_queued -= len;
sk->sk_forward_alloc += len; sk->sk_forward_alloc += len;
sock_set_flag(sk, SOCK_QUEUE_SHRUNK);
/* Any change of skb->len requires recalculation of tso /* Any change of skb->len requires recalculation of tso
* factor and mss. * factor and mss.
......
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