From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58728) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7GCW-0005SB-Ni for qemu-devel@nongnu.org; Mon, 30 May 2016 01:57:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b7GCS-0005l8-J6 for qemu-devel@nongnu.org; Mon, 30 May 2016 01:57:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47651) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7GCS-0005l3-Bx for qemu-devel@nongnu.org; Mon, 30 May 2016 01:57:16 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B7A357F0AF for ; Mon, 30 May 2016 05:57:15 +0000 (UTC) References: <1464453454-5703-1-git-send-email-wexu@redhat.com> <1464453454-5703-4-git-send-email-wexu@redhat.com> From: Jason Wang Message-ID: <574BD636.6070901@redhat.com> Date: Mon, 30 May 2016 13:57:10 +0800 MIME-Version: 1.0 In-Reply-To: <1464453454-5703-4-git-send-email-wexu@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [ RFC Patch v6 3/3] virtio-net rsc: add 2 new rsc information fields to 'virtio_net_hdr' List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: wexu@redhat.com, qemu-devel@nongnu.org Cc: victork@redhat.com, mst@redhat.com, yvugenfi@redhat.com, marcel@redhat.com, dfleytma@redhat.com On 2016=E5=B9=B405=E6=9C=8829=E6=97=A5 00:37, wexu@redhat.com wrote: > From: Wei Xu > > Field 'coalesced' is to indicate how many packets are coalesced and fie= ld > 'dup_ack' is how many duplicate acks are merged, guest driver can use t= hese > information to notify what's the exact scene of original traffic over t= he > networks. > > Signed-off-by: Wei Xu > --- > hw/net/virtio-net.c | 8 ++++++++ > include/standard-headers/linux/virtio_net.h | 2 ++ > 2 files changed, 10 insertions(+) > > diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c > index cc8cbe4..20f552a 100644 > --- a/hw/net/virtio-net.c > +++ b/hw/net/virtio-net.c > @@ -1768,6 +1768,10 @@ static size_t virtio_net_rsc_drain_seg(NetRscCha= in *chain, NetRscSeg *seg) > if ((chain->proto =3D=3D ETH_P_IP) && seg->is_coalesced) { > virtio_net_rsc_ipv4_checksum(h, seg->unit.ip); > } > + h->coalesced =3D seg->packets; > + h->dup_ack =3D seg->dup_ack; > + h->gso_type =3D chain->gso_type; > + h->gso_size =3D chain->max_payload; > ret =3D virtio_net_do_receive(seg->nc, seg->buf, seg->size); > QTAILQ_REMOVE(&chain->buffers, seg, next); > g_free(seg->buf); > @@ -2302,9 +2306,13 @@ static ssize_t virtio_net_receive(NetClientState= *nc, > const uint8_t *buf, size_t size) > { > VirtIONet *n; > + struct virtio_net_hdr *h; > =20 > n =3D qemu_get_nic_opaque(nc); > if (n->host_features & (1ULL << VIRTIO_NET_F_GUEST_RSC)) { > + h =3D (struct virtio_net_hdr *)buf; > + h->coalesced =3D 0; > + h->dup_ack =3D 0; > return virtio_net_rsc_receive(nc, buf, size); > } else { > return virtio_net_do_receive(nc, buf, size); > diff --git a/include/standard-headers/linux/virtio_net.h b/include/stan= dard-headers/linux/virtio_net.h > index 5b95762..c837417 100644 > --- a/include/standard-headers/linux/virtio_net.h > +++ b/include/standard-headers/linux/virtio_net.h > @@ -114,6 +114,8 @@ struct virtio_net_hdr { > __virtio16 gso_size; /* Bytes to append to hdr_len per frame */ > __virtio16 csum_start; /* Position to start checksumming from */ > __virtio16 csum_offset; /* Offset after that to place checksum */ > + __virtio16 coalesced; /* packets coalesced by host */ Can we just reuse gso_segs for this? > + __virtio16 dup_ack; /* duplicate ack count */ > }; > =20 > /* This is the version of the header to use when the MRG_RXBUF