diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2011-10-18 17:00:24 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-10-19 03:10:46 -0400 |
commit | 9e903e085262ffbf1fc44a17ac06058aca03524a (patch) | |
tree | 4acefc97ba38c1733474d25c0b2053b56af97db1 /drivers/scsi/cxgbi | |
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')
-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, | |||
1814 | copy = min(datalen, sglen); | 1814 | copy = min(datalen, sglen); |
1815 | if (i && page == frags[i - 1].page && | 1815 | if (i && page == frags[i - 1].page && |
1816 | sgoffset + sg->offset == | 1816 | sgoffset + sg->offset == |
1817 | frags[i - 1].page_offset + frags[i - 1].size) { | 1817 | frags[i - 1].page_offset + skb_frag_size(&frags[i - 1])) { |
1818 | frags[i - 1].size += copy; | 1818 | skb_frag_size_add(&frags[i - 1], copy); |
1819 | } else { | 1819 | } else { |
1820 | if (i >= frag_max) { | 1820 | if (i >= frag_max) { |
1821 | pr_warn("too many pages %u, dlen %u.\n", | 1821 | 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, | |||
1825 | 1825 | ||
1826 | frags[i].page = page; | 1826 | frags[i].page = page; |
1827 | frags[i].page_offset = sg->offset + sgoffset; | 1827 | frags[i].page_offset = sg->offset + sgoffset; |
1828 | frags[i].size = copy; | 1828 | skb_frag_size_set(&frags[i], copy); |
1829 | i++; | 1829 | i++; |
1830 | } | 1830 | } |
1831 | datalen -= copy; | 1831 | datalen -= copy; |
@@ -1951,8 +1951,8 @@ int cxgbi_conn_init_pdu(struct iscsi_task *task, unsigned int offset, | |||
1951 | char *src = kmap_atomic(frag->page, | 1951 | char *src = kmap_atomic(frag->page, |
1952 | KM_SOFTIRQ0); | 1952 | KM_SOFTIRQ0); |
1953 | 1953 | ||
1954 | memcpy(dst, src+frag->page_offset, frag->size); | 1954 | memcpy(dst, src+frag->page_offset, skb_frag_size(frag)); |
1955 | dst += frag->size; | 1955 | dst += skb_frag_size(frag); |
1956 | kunmap_atomic(src, KM_SOFTIRQ0); | 1956 | kunmap_atomic(src, KM_SOFTIRQ0); |
1957 | } | 1957 | } |
1958 | if (padlen) { | 1958 | if (padlen) { |