Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 278368
b: refs/heads/master
c: 0a5912d
h: refs/heads/master
v: v3
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Dec 5, 2011
1 parent bac5fa4 commit 98cb5ae
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b474ae77609b725098d5a7cc8f69c1c528710d53
refs/heads/master: 0a5912db7b4f9c3ff3bd0dbb67f36484a3b21a35
23 changes: 10 additions & 13 deletions trunk/net/ipv4/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -888,9 +888,6 @@ int tcp_sendpage(struct sock *sk, struct page *page, int offset,
}
EXPORT_SYMBOL(tcp_sendpage);

#define TCP_PAGE(sk) (sk->sk_sndmsg_page)
#define TCP_OFF(sk) (sk->sk_sndmsg_off)

static inline int select_size(const struct sock *sk, bool sg)
{
const struct tcp_sock *tp = tcp_sk(sk);
Expand Down Expand Up @@ -1008,13 +1005,13 @@ int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
} else {
int merge = 0;
int i = skb_shinfo(skb)->nr_frags;
struct page *page = TCP_PAGE(sk);
struct page *page = sk->sk_sndmsg_page;
int off;

if (page && page_count(page) == 1)
TCP_OFF(sk) = 0;
sk->sk_sndmsg_off = 0;

off = TCP_OFF(sk);
off = sk->sk_sndmsg_off;

if (skb_can_coalesce(skb, i, page, off) &&
off != PAGE_SIZE) {
Expand All @@ -1031,7 +1028,7 @@ int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
} else if (page) {
if (off == PAGE_SIZE) {
put_page(page);
TCP_PAGE(sk) = page = NULL;
sk->sk_sndmsg_page = page = NULL;
off = 0;
}
} else
Expand All @@ -1057,9 +1054,9 @@ int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
/* If this page was new, give it to the
* socket so it does not get leaked.
*/
if (!TCP_PAGE(sk)) {
TCP_PAGE(sk) = page;
TCP_OFF(sk) = 0;
if (!sk->sk_sndmsg_page) {
sk->sk_sndmsg_page = page;
sk->sk_sndmsg_off = 0;
}
goto do_error;
}
Expand All @@ -1069,15 +1066,15 @@ int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
skb_frag_size_add(&skb_shinfo(skb)->frags[i - 1], copy);
} else {
skb_fill_page_desc(skb, i, page, off, copy);
if (TCP_PAGE(sk)) {
if (sk->sk_sndmsg_page) {
get_page(page);
} else if (off + copy < PAGE_SIZE) {
get_page(page);
TCP_PAGE(sk) = page;
sk->sk_sndmsg_page = page;
}
}

TCP_OFF(sk) = off + copy;
sk->sk_sndmsg_off = off + copy;
}

if (!copied)
Expand Down

0 comments on commit 98cb5ae

Please sign in to comment.