Commit 6a39a16a authored by Ian Campbell's avatar Ian Campbell Committed by David S. Miller

cxgbi: convert to SKB paged frag API.

Signed-off-by: default avatarIan Campbell <ian.campbell@citrix.com>
Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Mike Christie <michaelc@cs.wisc.edu>
Cc: James Bottomley <James.Bottomley@suse.de>
Cc: Karen Xie <kxie@chelsio.com>
Cc: linux-scsi@vger.kernel.org
Cc: netdev@vger.kernel.org
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a0006a86
...@@ -1787,7 +1787,7 @@ static int sgl_seek_offset(struct scatterlist *sgl, unsigned int sgcnt, ...@@ -1787,7 +1787,7 @@ static int sgl_seek_offset(struct scatterlist *sgl, unsigned int sgcnt,
} }
static int sgl_read_to_frags(struct scatterlist *sg, unsigned int sgoffset, static int sgl_read_to_frags(struct scatterlist *sg, unsigned int sgoffset,
unsigned int dlen, skb_frag_t *frags, unsigned int dlen, struct page_frag *frags,
int frag_max) int frag_max)
{ {
unsigned int datalen = dlen; unsigned int datalen = dlen;
...@@ -1814,8 +1814,8 @@ static int sgl_read_to_frags(struct scatterlist *sg, unsigned int sgoffset, ...@@ -1814,8 +1814,8 @@ static int sgl_read_to_frags(struct scatterlist *sg, unsigned int sgoffset,
copy = min(datalen, sglen); copy = min(datalen, sglen);
if (i && page == frags[i - 1].page && if (i && page == frags[i - 1].page &&
sgoffset + sg->offset == sgoffset + sg->offset ==
frags[i - 1].page_offset + skb_frag_size(&frags[i - 1])) { frags[i - 1].offset + frags[i - 1].size) {
skb_frag_size_add(&frags[i - 1], copy); frags[i - 1].size += copy;
} else { } else {
if (i >= frag_max) { if (i >= frag_max) {
pr_warn("too many pages %u, dlen %u.\n", pr_warn("too many pages %u, dlen %u.\n",
...@@ -1824,8 +1824,8 @@ static int sgl_read_to_frags(struct scatterlist *sg, unsigned int sgoffset, ...@@ -1824,8 +1824,8 @@ static int sgl_read_to_frags(struct scatterlist *sg, unsigned int sgoffset,
} }
frags[i].page = page; frags[i].page = page;
frags[i].page_offset = sg->offset + sgoffset; frags[i].offset = sg->offset + sgoffset;
skb_frag_size_set(&frags[i], copy); frags[i].size = copy;
i++; i++;
} }
datalen -= copy; datalen -= copy;
...@@ -1944,15 +1944,15 @@ int cxgbi_conn_init_pdu(struct iscsi_task *task, unsigned int offset, ...@@ -1944,15 +1944,15 @@ int cxgbi_conn_init_pdu(struct iscsi_task *task, unsigned int offset,
if (tdata->nr_frags > MAX_SKB_FRAGS || if (tdata->nr_frags > MAX_SKB_FRAGS ||
(padlen && tdata->nr_frags == MAX_SKB_FRAGS)) { (padlen && tdata->nr_frags == MAX_SKB_FRAGS)) {
char *dst = skb->data + task->hdr_len; char *dst = skb->data + task->hdr_len;
skb_frag_t *frag = tdata->frags; struct page_frag *frag = tdata->frags;
/* data fits in the skb's headroom */ /* data fits in the skb's headroom */
for (i = 0; i < tdata->nr_frags; i++, frag++) { for (i = 0; i < tdata->nr_frags; i++, frag++) {
char *src = kmap_atomic(frag->page, char *src = kmap_atomic(frag->page,
KM_SOFTIRQ0); KM_SOFTIRQ0);
memcpy(dst, src+frag->page_offset, skb_frag_size(frag)); memcpy(dst, src+frag->offset, frag->size);
dst += skb_frag_size(frag); dst += frag->size;
kunmap_atomic(src, KM_SOFTIRQ0); kunmap_atomic(src, KM_SOFTIRQ0);
} }
if (padlen) { if (padlen) {
...@@ -1962,11 +1962,13 @@ int cxgbi_conn_init_pdu(struct iscsi_task *task, unsigned int offset, ...@@ -1962,11 +1962,13 @@ int cxgbi_conn_init_pdu(struct iscsi_task *task, unsigned int offset,
skb_put(skb, count + padlen); skb_put(skb, count + padlen);
} else { } else {
/* data fit into frag_list */ /* data fit into frag_list */
for (i = 0; i < tdata->nr_frags; i++) for (i = 0; i < tdata->nr_frags; i++) {
get_page(tdata->frags[i].page); __skb_fill_page_desc(skb, i,
tdata->frags[i].page,
memcpy(skb_shinfo(skb)->frags, tdata->frags, tdata->frags[i].offset,
sizeof(skb_frag_t) * tdata->nr_frags); tdata->frags[i].size);
skb_frag_ref(skb, i);
}
skb_shinfo(skb)->nr_frags = tdata->nr_frags; skb_shinfo(skb)->nr_frags = tdata->nr_frags;
skb->len += count; skb->len += count;
skb->data_len += count; skb->data_len += count;
......
...@@ -574,7 +574,7 @@ struct cxgbi_endpoint { ...@@ -574,7 +574,7 @@ struct cxgbi_endpoint {
#define MAX_PDU_FRAGS ((ULP2_MAX_PDU_PAYLOAD + 512 - 1) / 512) #define MAX_PDU_FRAGS ((ULP2_MAX_PDU_PAYLOAD + 512 - 1) / 512)
struct cxgbi_task_data { struct cxgbi_task_data {
unsigned short nr_frags; unsigned short nr_frags;
skb_frag_t frags[MAX_PDU_FRAGS]; struct page_frag frags[MAX_PDU_FRAGS];
struct sk_buff *skb; struct sk_buff *skb;
unsigned int offset; unsigned int offset;
unsigned int count; unsigned int count;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment