Skip to content

Commit

Permalink
net: skb_can_coalesce returns a boolean
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Apr 24, 2012
1 parent 783c175 commit 38ba0a6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions include/linux/skbuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -1963,16 +1963,16 @@ static inline int skb_add_data(struct sk_buff *skb,
return -EFAULT;
}

static inline int skb_can_coalesce(struct sk_buff *skb, int i,
const struct page *page, int off)
static inline bool skb_can_coalesce(struct sk_buff *skb, int i,
const struct page *page, int off)
{
if (i) {
const struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i - 1];

return page == skb_frag_page(frag) &&
off == frag->page_offset + skb_frag_size(frag);
}
return 0;
return false;
}

static inline int __skb_linearize(struct sk_buff *skb)
Expand Down
3 changes: 2 additions & 1 deletion net/ipv4/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -848,9 +848,10 @@ static ssize_t do_tcp_sendpages(struct sock *sk, struct page **pages, int poffse
while (psize > 0) {
struct sk_buff *skb = tcp_write_queue_tail(sk);
struct page *page = pages[poffset / PAGE_SIZE];
int copy, i, can_coalesce;
int copy, i;
int offset = poffset % PAGE_SIZE;
int size = min_t(size_t, psize, PAGE_SIZE - offset);
bool can_coalesce;

if (!tcp_send_head(sk) || (copy = size_goal - skb->len) <= 0) {
new_segment:
Expand Down

0 comments on commit 38ba0a6

Please sign in to comment.