From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id F2141199B3 for ; Wed, 6 Dec 2017 09:37:06 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 65CF14E90F; Wed, 6 Dec 2017 08:37:06 +0000 (UTC) Received: from [10.36.112.55] (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5E878600C9; Wed, 6 Dec 2017 08:37:01 +0000 (UTC) To: Jiayu Hu , dev@dpdk.org Cc: yliu@fridaylinux.org, jianfeng.tan@intel.com References: <1511247412-130965-1-git-send-email-jiayu.hu@intel.com> From: Maxime Coquelin Message-ID: Date: Wed, 6 Dec 2017 09:36:57 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <1511247412-130965-1-git-send-email-jiayu.hu@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 06 Dec 2017 08:37:06 +0000 (UTC) Subject: Re: [dpdk-dev] [PATCH] vhost: support UDP Fragmentation Offload X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Dec 2017 08:37:07 -0000 On 11/21/2017 07:56 AM, Jiayu Hu wrote: > In virtio, UDP Fragmentation Offload (UFO) includes two parts: host UFO > and guest UFO. Guest UFO means the frontend can receive large UDP packets, > and host UFO means the backend can receive large UDP packets. This patch > supports host UFO and guest UFO for vhost-user. > > Signed-off-by: Jiayu Hu > --- > lib/librte_mbuf/rte_mbuf.h | 7 +++++++ > lib/librte_vhost/vhost.h | 2 ++ > lib/librte_vhost/virtio_net.c | 10 ++++++++++ > 3 files changed, 19 insertions(+) > > diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h > index ce8a05d..3d8cfc9 100644 > --- a/lib/librte_mbuf/rte_mbuf.h > +++ b/lib/librte_mbuf/rte_mbuf.h > @@ -209,6 +209,13 @@ extern "C" { > /* add new TX flags here */ > > /** > + * UDP Fragmentation Offload flag. This flag is used for enabling UDP > + * fragmentation in SW or in HW. When use UFO, mbuf->tso_segsz is used > + * to store the MSS of UDP fragments. > + */ > +#define PKT_TX_UDP_SEG (1ULL << 42) > + > +/** > * Request security offload processing on the TX packet. > */ > #define PKT_TX_SEC_OFFLOAD (1ULL << 43) > diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h > index 1cc81c1..fc109ef 100644 > --- a/lib/librte_vhost/vhost.h > +++ b/lib/librte_vhost/vhost.h > @@ -206,10 +206,12 @@ struct vhost_msg { > (1ULL << VHOST_USER_F_PROTOCOL_FEATURES) | \ > (1ULL << VIRTIO_NET_F_HOST_TSO4) | \ > (1ULL << VIRTIO_NET_F_HOST_TSO6) | \ > + (1ULL << VIRTIO_NET_F_HOST_UFO) | \ > (1ULL << VIRTIO_NET_F_CSUM) | \ > (1ULL << VIRTIO_NET_F_GUEST_CSUM) | \ > (1ULL << VIRTIO_NET_F_GUEST_TSO4) | \ > (1ULL << VIRTIO_NET_F_GUEST_TSO6) | \ > + (1ULL << VIRTIO_NET_F_GUEST_UFO) | \ I actually have the same question as for GSO. Dos it impact performance as it seems enabled by default in QEMU? How do you test it? Thanks, Maxime > (1ULL << VIRTIO_RING_F_INDIRECT_DESC) | \ > (1ULL << VIRTIO_NET_F_MTU) | \ > (1ULL << VIRTIO_F_IOMMU_PLATFORM)) > diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c > index 6fee16e..3a3a0ad 100644 > --- a/lib/librte_vhost/virtio_net.c > +++ b/lib/librte_vhost/virtio_net.c > @@ -188,6 +188,11 @@ virtio_enqueue_offload(struct rte_mbuf *m_buf, struct virtio_net_hdr *net_hdr) > net_hdr->gso_size = m_buf->tso_segsz; > net_hdr->hdr_len = m_buf->l2_len + m_buf->l3_len > + m_buf->l4_len; > + } else if (m_buf->ol_flags & PKT_TX_UDP_SEG) { > + net_hdr->gso_type = VIRTIO_NET_HDR_GSO_UDP; > + net_hdr->gso_size = m_buf->tso_segsz; > + net_hdr->hdr_len = m_buf->l2_len + m_buf->l3_len + > + m_buf->l4_len; > } else { > ASSIGN_UNLESS_EQUAL(net_hdr->gso_type, 0); > ASSIGN_UNLESS_EQUAL(net_hdr->gso_size, 0); > @@ -834,6 +839,11 @@ vhost_dequeue_offload(struct virtio_net_hdr *hdr, struct rte_mbuf *m) > m->tso_segsz = hdr->gso_size; > m->l4_len = (tcp_hdr->data_off & 0xf0) >> 2; > break; > + case VIRTIO_NET_HDR_GSO_UDP: > + m->ol_flags |= PKT_TX_UDP_SEG; > + m->tso_segsz = hdr->gso_size; > + m->l4_len = sizeof(struct udp_hdr); > + break; > default: > RTE_LOG(WARNING, VHOST_DATA, > "unsupported gso type %u.\n", hdr->gso_type); >