diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2011-10-18 21:00:24 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-10-19 03:10:46 -0400 |
commit | 9e903e085262ffbf1fc44a17ac06058aca03524a (patch) | |
tree | 4acefc97ba38c1733474d25c0b2053b56af97db1 /drivers/scsi/cxgbi/libcxgbi.c | |
parent | dd767856a36e00b631d65ebc4bb81b19915532d6 (diff) |
net: add skb frag size accessors
To ease skb->truesize sanitization, its better to be able to localize
all references to skb frags size.
Define accessors : skb_frag_size() to fetch frag size, and
skb_frag_size_{set|add|sub}() to manipulate it.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/scsi/cxgbi/libcxgbi.c')
-rw-r--r-- | drivers/scsi/cxgbi/libcxgbi.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c index 77ac217ad5ce..be69da38ccaa 100644 --- a/drivers/scsi/cxgbi/libcxgbi.c +++ b/drivers/scsi/cxgbi/libcxgbi.c @@ -1814,8 +1814,8 @@ static int sgl_read_to_frags(struct scatterlist *sg, unsigned int sgoffset, copy = min(datalen, sglen); if (i && page == frags[i - 1].page && sgoffset + sg->offset == - frags[i - 1].page_offset + frags[i - 1].size) { - frags[i - 1].size += copy; + frags[i - 1].page_offset + skb_frag_size(&frags[i - 1])) { + skb_frag_size_add(&frags[i - 1], copy); } else { if (i >= frag_max) { pr_warn("too many pages %u, dlen %u.\n", @@ -1825,7 +1825,7 @@ static int sgl_read_to_frags(struct scatterlist *sg, unsigned int sgoffset, frags[i].page = page; frags[i].page_offset = sg->offset + sgoffset; - frags[i].size = copy; + skb_frag_size_set(&frags[i], copy); i++; } datalen -= copy; @@ -1951,8 +1951,8 @@ int cxgbi_conn_init_pdu(struct iscsi_task *task, unsigned int offset, char *src = kmap_atomic(frag->page, KM_SOFTIRQ0); - memcpy(dst, src+frag->page_offset, frag->size); - dst += frag->size; + memcpy(dst, src+frag->page_offset, skb_frag_size(frag)); + dst += skb_frag_size(frag); kunmap_atomic(src, KM_SOFTIRQ0); } if (padlen) { |