Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 334015
b: refs/heads/master
c: 6a8ed46
h: refs/heads/master
i:
  334013: a42badb
  334011: 8d1f526
  334007: 64664e6
  333999: 404ea3b
  333983: 53ea32d
  333951: f8bd848
v: v3
  • Loading branch information
Ian Campbell authored and David S. Miller committed Oct 11, 2012
1 parent da14c7f commit 5d93992
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6caab7b0544e83e6c160b5e80f5a4a7dd69545c7
refs/heads/master: 6a8ed462f16b8455eec5ae00eb6014159a6721f0
40 changes: 35 additions & 5 deletions trunk/drivers/net/xen-netback/netback.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,21 +335,35 @@ unsigned int xen_netbk_count_skb_slots(struct xenvif *vif, struct sk_buff *skb)

for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
unsigned long size = skb_frag_size(&skb_shinfo(skb)->frags[i]);
unsigned long offset = skb_shinfo(skb)->frags[i].page_offset;
unsigned long bytes;

offset &= ~PAGE_MASK;

while (size > 0) {
BUG_ON(offset >= PAGE_SIZE);
BUG_ON(copy_off > MAX_BUFFER_OFFSET);

if (start_new_rx_buffer(copy_off, size, 0)) {
bytes = PAGE_SIZE - offset;

if (bytes > size)
bytes = size;

if (start_new_rx_buffer(copy_off, bytes, 0)) {
count++;
copy_off = 0;
}

bytes = size;
if (copy_off + bytes > MAX_BUFFER_OFFSET)
bytes = MAX_BUFFER_OFFSET - copy_off;

copy_off += bytes;

offset += bytes;
size -= bytes;

if (offset == PAGE_SIZE)
offset = 0;
}
}
return count;
Expand Down Expand Up @@ -403,14 +417,24 @@ static void netbk_gop_frag_copy(struct xenvif *vif, struct sk_buff *skb,
unsigned long bytes;

/* Data must not cross a page boundary. */
BUG_ON(size + offset > PAGE_SIZE);
BUG_ON(size + offset > PAGE_SIZE<<compound_order(page));

meta = npo->meta + npo->meta_prod - 1;

/* Skip unused frames from start of page */
page += offset >> PAGE_SHIFT;
offset &= ~PAGE_MASK;

while (size > 0) {
BUG_ON(offset >= PAGE_SIZE);
BUG_ON(npo->copy_off > MAX_BUFFER_OFFSET);

if (start_new_rx_buffer(npo->copy_off, size, *head)) {
bytes = PAGE_SIZE - offset;

if (bytes > size)
bytes = size;

if (start_new_rx_buffer(npo->copy_off, bytes, *head)) {
/*
* Netfront requires there to be some data in the head
* buffer.
Expand All @@ -420,7 +444,6 @@ static void netbk_gop_frag_copy(struct xenvif *vif, struct sk_buff *skb,
meta = get_next_rx_buffer(vif, npo);
}

bytes = size;
if (npo->copy_off + bytes > MAX_BUFFER_OFFSET)
bytes = MAX_BUFFER_OFFSET - npo->copy_off;

Expand Down Expand Up @@ -453,6 +476,13 @@ static void netbk_gop_frag_copy(struct xenvif *vif, struct sk_buff *skb,
offset += bytes;
size -= bytes;

/* Next frame */
if (offset == PAGE_SIZE && size) {
BUG_ON(!PageCompound(page));
page++;
offset = 0;
}

/* Leave a gap for the GSO descriptor. */
if (*head && skb_shinfo(skb)->gso_size && !vif->gso_prefix)
vif->rx.req_cons++;
Expand Down

0 comments on commit 5d93992

Please sign in to comment.