|
@@ -889,21 +889,20 @@ static int add_recvbuf_mergeable(struct virtnet_info *vi,
|
|
|
|
|
|
buf = (char *)page_address(alloc_frag->page) + alloc_frag->offset;
|
|
buf = (char *)page_address(alloc_frag->page) + alloc_frag->offset;
|
|
buf += headroom; /* advance address leaving hole at front of pkt */
|
|
buf += headroom; /* advance address leaving hole at front of pkt */
|
|
- ctx = (void *)(unsigned long)len;
|
|
|
|
get_page(alloc_frag->page);
|
|
get_page(alloc_frag->page);
|
|
alloc_frag->offset += len + headroom;
|
|
alloc_frag->offset += len + headroom;
|
|
hole = alloc_frag->size - alloc_frag->offset;
|
|
hole = alloc_frag->size - alloc_frag->offset;
|
|
if (hole < len + headroom) {
|
|
if (hole < len + headroom) {
|
|
/* To avoid internal fragmentation, if there is very likely not
|
|
/* To avoid internal fragmentation, if there is very likely not
|
|
* enough space for another buffer, add the remaining space to
|
|
* enough space for another buffer, add the remaining space to
|
|
- * the current buffer. This extra space is not included in
|
|
|
|
- * the truesize stored in ctx.
|
|
|
|
|
|
+ * the current buffer.
|
|
*/
|
|
*/
|
|
len += hole;
|
|
len += hole;
|
|
alloc_frag->offset += hole;
|
|
alloc_frag->offset += hole;
|
|
}
|
|
}
|
|
|
|
|
|
sg_init_one(rq->sg, buf, len);
|
|
sg_init_one(rq->sg, buf, len);
|
|
|
|
+ ctx = (void *)(unsigned long)len;
|
|
err = virtqueue_add_inbuf_ctx(rq->vq, rq->sg, 1, buf, ctx, gfp);
|
|
err = virtqueue_add_inbuf_ctx(rq->vq, rq->sg, 1, buf, ctx, gfp);
|
|
if (err < 0)
|
|
if (err < 0)
|
|
put_page(virt_to_head_page(buf));
|
|
put_page(virt_to_head_page(buf));
|