aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/core/skbuff.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index dfb304066f22..aaf4abc4417d 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -1547,9 +1547,9 @@ static void sock_spd_release(struct splice_pipe_desc *spd, unsigned int i)
1547 put_page(spd->pages[i]); 1547 put_page(spd->pages[i]);
1548} 1548}
1549 1549
1550static inline struct page *linear_to_page(struct page *page, unsigned int *len, 1550static struct page *linear_to_page(struct page *page, unsigned int *len,
1551 unsigned int *offset, 1551 unsigned int *offset,
1552 struct sk_buff *skb, struct sock *sk) 1552 struct sk_buff *skb, struct sock *sk)
1553{ 1553{
1554 struct page *p = sk->sk_sndmsg_page; 1554 struct page *p = sk->sk_sndmsg_page;
1555 unsigned int off; 1555 unsigned int off;
@@ -1598,23 +1598,23 @@ static bool spd_can_coalesce(const struct splice_pipe_desc *spd,
1598/* 1598/*
1599 * Fill page/offset/length into spd, if it can hold more pages. 1599 * Fill page/offset/length into spd, if it can hold more pages.
1600 */ 1600 */
1601static inline int spd_fill_page(struct splice_pipe_desc *spd, 1601static bool spd_fill_page(struct splice_pipe_desc *spd,
1602 struct pipe_inode_info *pipe, struct page *page, 1602 struct pipe_inode_info *pipe, struct page *page,
1603 unsigned int *len, unsigned int offset, 1603 unsigned int *len, unsigned int offset,
1604 struct sk_buff *skb, int linear, 1604 struct sk_buff *skb, int linear,
1605 struct sock *sk) 1605 struct sock *sk)
1606{ 1606{
1607 if (unlikely(spd->nr_pages == MAX_SKB_FRAGS)) 1607 if (unlikely(spd->nr_pages == MAX_SKB_FRAGS))
1608 return 1; 1608 return true;
1609 1609
1610 if (linear) { 1610 if (linear) {
1611 page = linear_to_page(page, len, &offset, skb, sk); 1611 page = linear_to_page(page, len, &offset, skb, sk);
1612 if (!page) 1612 if (!page)
1613 return 1; 1613 return true;
1614 } 1614 }
1615 if (spd_can_coalesce(spd, page, offset)) { 1615 if (spd_can_coalesce(spd, page, offset)) {
1616 spd->partial[spd->nr_pages - 1].len += *len; 1616 spd->partial[spd->nr_pages - 1].len += *len;
1617 return 0; 1617 return false;
1618 } 1618 }
1619 get_page(page); 1619 get_page(page);
1620 spd->pages[spd->nr_pages] = page; 1620 spd->pages[spd->nr_pages] = page;
@@ -1622,7 +1622,7 @@ static inline int spd_fill_page(struct splice_pipe_desc *spd,
1622 spd->partial[spd->nr_pages].offset = offset; 1622 spd->partial[spd->nr_pages].offset = offset;
1623 spd->nr_pages++; 1623 spd->nr_pages++;
1624 1624
1625 return 0; 1625 return false;
1626} 1626}
1627 1627
1628static inline void __segment_seek(struct page **page, unsigned int *poff, 1628static inline void __segment_seek(struct page **page, unsigned int *poff,
@@ -1639,20 +1639,20 @@ static inline void __segment_seek(struct page **page, unsigned int *poff,
1639 *plen -= off; 1639 *plen -= off;
1640} 1640}
1641 1641
1642static inline int __splice_segment(struct page *page, unsigned int poff, 1642static bool __splice_segment(struct page *page, unsigned int poff,
1643 unsigned int plen, unsigned int *off, 1643 unsigned int plen, unsigned int *off,
1644 unsigned int *len, struct sk_buff *skb, 1644 unsigned int *len, struct sk_buff *skb,
1645 struct splice_pipe_desc *spd, int linear, 1645 struct splice_pipe_desc *spd, int linear,
1646 struct sock *sk, 1646 struct sock *sk,
1647 struct pipe_inode_info *pipe) 1647 struct pipe_inode_info *pipe)
1648{ 1648{
1649 if (!*len) 1649 if (!*len)
1650 return 1; 1650 return true;
1651 1651
1652 /* skip this segment if already processed */ 1652 /* skip this segment if already processed */
1653 if (*off >= plen) { 1653 if (*off >= plen) {
1654 *off -= plen; 1654 *off -= plen;
1655 return 0; 1655 return false;
1656 } 1656 }
1657 1657
1658 /* ignore any bits we already processed */ 1658 /* ignore any bits we already processed */
@@ -1668,23 +1668,23 @@ static inline int __splice_segment(struct page *page, unsigned int poff,
1668 flen = min_t(unsigned int, flen, PAGE_SIZE - poff); 1668 flen = min_t(unsigned int, flen, PAGE_SIZE - poff);
1669 1669
1670 if (spd_fill_page(spd, pipe, page, &flen, poff, skb, linear, sk)) 1670 if (spd_fill_page(spd, pipe, page, &flen, poff, skb, linear, sk))
1671 return 1; 1671 return true;
1672 1672
1673 __segment_seek(&page, &poff, &plen, flen); 1673 __segment_seek(&page, &poff, &plen, flen);
1674 *len -= flen; 1674 *len -= flen;
1675 1675
1676 } while (*len && plen); 1676 } while (*len && plen);
1677 1677
1678 return 0; 1678 return false;
1679} 1679}
1680 1680
1681/* 1681/*
1682 * Map linear and fragment data from the skb to spd. It reports failure if the 1682 * Map linear and fragment data from the skb to spd. It reports true if the
1683 * pipe is full or if we already spliced the requested length. 1683 * pipe is full or if we already spliced the requested length.
1684 */ 1684 */
1685static int __skb_splice_bits(struct sk_buff *skb, struct pipe_inode_info *pipe, 1685static bool __skb_splice_bits(struct sk_buff *skb, struct pipe_inode_info *pipe,
1686 unsigned int *offset, unsigned int *len, 1686 unsigned int *offset, unsigned int *len,
1687 struct splice_pipe_desc *spd, struct sock *sk) 1687 struct splice_pipe_desc *spd, struct sock *sk)
1688{ 1688{
1689 int seg; 1689 int seg;
1690 1690
@@ -1695,7 +1695,7 @@ static int __skb_splice_bits(struct sk_buff *skb, struct pipe_inode_info *pipe,
1695 (unsigned long) skb->data & (PAGE_SIZE - 1), 1695 (unsigned long) skb->data & (PAGE_SIZE - 1),
1696 skb_headlen(skb), 1696 skb_headlen(skb),
1697 offset, len, skb, spd, 1, sk, pipe)) 1697 offset, len, skb, spd, 1, sk, pipe))
1698 return 1; 1698 return true;
1699 1699
1700 /* 1700 /*
1701 * then map the fragments 1701 * then map the fragments
@@ -1706,10 +1706,10 @@ static int __skb_splice_bits(struct sk_buff *skb, struct pipe_inode_info *pipe,
1706 if (__splice_segment(skb_frag_page(f), 1706 if (__splice_segment(skb_frag_page(f),
1707 f->page_offset, skb_frag_size(f), 1707 f->page_offset, skb_frag_size(f),
1708 offset, len, skb, spd, 0, sk, pipe)) 1708 offset, len, skb, spd, 0, sk, pipe))
1709 return 1; 1709 return true;
1710 } 1710 }
1711 1711
1712 return 0; 1712 return false;
1713} 1713}
1714 1714
1715/* 1715/*