net: Use skb accessors in network core

In preparation for unifying the skb_frag and bio_vec, use the fine
accessors which already exist and use skb_frag_t instead of
struct skb_frag_struct.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Matthew Wilcox (Oracle)
2019-07-22 20:08:26 -07:00
committed by David S. Miller
parent d7840976e3
commit d8e18a516f
6 changed files with 38 additions and 32 deletions

View File

@@ -1776,19 +1776,21 @@ static int tcp_zerocopy_receive(struct sock *sk,
break;
frags = skb_shinfo(skb)->frags;
while (offset) {
if (frags->size > offset)
if (skb_frag_size(frags) > offset)
goto out;
offset -= frags->size;
offset -= skb_frag_size(frags);
frags++;
}
}
if (frags->size != PAGE_SIZE || frags->page_offset) {
if (skb_frag_size(frags) != PAGE_SIZE || frags->page_offset) {
int remaining = zc->recv_skip_hint;
int size = skb_frag_size(frags);
while (remaining && (frags->size != PAGE_SIZE ||
while (remaining && (size != PAGE_SIZE ||
frags->page_offset)) {
remaining -= frags->size;
remaining -= size;
frags++;
size = skb_frag_size(frags);
}
zc->recv_skip_hint -= remaining;
break;
@@ -3781,7 +3783,7 @@ int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *hp,
return 1;
for (i = 0; i < shi->nr_frags; ++i) {
const struct skb_frag_struct *f = &shi->frags[i];
const skb_frag_t *f = &shi->frags[i];
unsigned int offset = f->page_offset;
struct page *page = skb_frag_page(f) + (offset >> PAGE_SHIFT);