From: Jack Lange Date: Tue, 5 Jan 2010 19:36:50 +0000 (-0600) Subject: Merge branch 'devel' of ssh://palacios@newskysaw.cs.northwestern.edu/home/palacios... X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=ec01e0d8a7a3debd92ce2787a9d8bfd15d38df04;hp=d0dd50e04b4847a2b170d11c849f477b7ca84168 Merge branch 'devel' of ssh://palacios@newskysaw.cs.northwestern.edu/home/palacios/palacios into devel --- diff --git a/palacios/src/devices/lnx_virtio_nic.c b/palacios/src/devices/lnx_virtio_nic.c index f68d3df..0f76641 100644 --- a/palacios/src/devices/lnx_virtio_nic.c +++ b/palacios/src/devices/lnx_virtio_nic.c @@ -280,16 +280,31 @@ static int send_pkt_to_guest(struct virtio_net_state * virtio, uchar_t * buf, ui //copy header to the header descriptor memcpy((void *)hdr_addr, &hdr, sizeof(struct virtio_net_hdr)); + //Zheng 01/02/2010: zero payload + if (offset >= data_len) { + hdr_desc->flags &= ~VIRTIO_NEXT_FLAG; + } + //copy data to the next descriptors - for (buf_idx = 0; offset < data_len; buf_idx = q->desc[hdr_idx].next) { + //Zheng 01/02/2010: put data into the next descriptor, rather than 0! + for (buf_idx = hdr_desc->next; offset < data_len; buf_idx = q->desc[hdr_idx].next) { + // for (buf_idx = 0; offset < data_len; buf_idx = q->desc[hdr_idx].next) { struct vring_desc * buf_desc = &(q->desc[buf_idx]); uint32_t len = 0; - buf_desc->flags = VIRTIO_NEXT_FLAG; + //Zheng 01/02/2010: commented this - we need to check + // if there still is some data left + //buf_desc->flags = VIRTIO_NEXT_FLAG; len = copy_data_to_desc(virtio, buf_desc, buf + offset, data_len - offset); offset += len; + + //Zheng 01/02/2010: check if there still is some data left + if (offset < data_len) { + buf_desc->flags = VIRTIO_NEXT_FLAG; + } + buf_desc->length = len; // TODO: do we need this? }