From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 81C581B689 for ; Mon, 25 Dec 2017 02:48:58 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Dec 2017 17:48:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,452,1508828400"; d="scan'208";a="4629844" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga002.fm.intel.com with ESMTP; 24 Dec 2017 17:48:57 -0800 Received: from fmsmsx118.amr.corp.intel.com (10.18.116.18) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 24 Dec 2017 17:48:57 -0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx118.amr.corp.intel.com (10.18.116.18) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 24 Dec 2017 17:48:57 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.159]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.213]) with mapi id 14.03.0319.002; Mon, 25 Dec 2017 09:48:55 +0800 From: "Yao, Lei A" To: "Hu, Jiayu" , "dev@dpdk.org" CC: "yliu@fridaylinux.org" , "Tan, Jianfeng" , "Hu, Jiayu" Thread-Topic: [dpdk-dev] [PATCH] vhost: support UDP Fragmentation Offload Thread-Index: AQHTYpWjrwgYgQvjCkyUaUZ/C5GV/aNTfxyQ Date: Mon, 25 Dec 2017 01:48:55 +0000 Message-ID: <2DBBFF226F7CF64BAFCA79B681719D953A306161@SHSMSX101.ccr.corp.intel.com> References: <1511247412-130965-1-git-send-email-jiayu.hu@intel.com> In-Reply-To: <1511247412-130965-1-git-send-email-jiayu.hu@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMzJkZjMzZTctYzk1MC00Mjk0LWJkODQtZTc0YThmZmUyN2I2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6Ing5Z0JSYUt5MEY4ZDZiZkloR09pVTg1a2tyd0dZeExZcWRFUE9pSVZ5YmM9In0= x-ctpclassification: CTP_IC dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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: Mon, 25 Dec 2017 01:48:59 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jiayu Hu > Sent: Tuesday, November 21, 2017 2:57 PM > To: dev@dpdk.org > Cc: yliu@fridaylinux.org; Tan, Jianfeng ; Hu, Jia= yu > > Subject: [dpdk-dev] [PATCH] vhost: support UDP Fragmentation Offload >=20 > 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. >=20 > Signed-off-by: Jiayu Hu Tested-by: Lei Yao This patch has been tested on my server, with guest_ufo=3Don,host_ufo=3Don= are added to the qemu cmdlind, using vhost-user as backend, vm can send and rec= eive =20 big UDP packets. > --- > 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(+) >=20 > 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 */ >=20 > /** > + * 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) | \ > (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 =3D m_buf->tso_segsz; > net_hdr->hdr_len =3D 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 =3D VIRTIO_NET_HDR_GSO_UDP; > + net_hdr->gso_size =3D m_buf->tso_segsz; > + net_hdr->hdr_len =3D 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 =3D hdr->gso_size; > m->l4_len =3D (tcp_hdr->data_off & 0xf0) >> 2; > break; > + case VIRTIO_NET_HDR_GSO_UDP: > + m->ol_flags |=3D PKT_TX_UDP_SEG; > + m->tso_segsz =3D hdr->gso_size; > + m->l4_len =3D sizeof(struct udp_hdr); > + break; > default: > RTE_LOG(WARNING, VHOST_DATA, > "unsupported gso type %u.\n", hdr- > >gso_type); > -- > 2.7.4