From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A85D8A04B5; Fri, 18 Sep 2020 04:41:38 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 745C21C224; Fri, 18 Sep 2020 04:41:38 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 5EDF71C220 for ; Fri, 18 Sep 2020 04:41:37 +0200 (CEST) IronPort-SDR: 3s3+ywBGOKIvQwf5spWXJvvjTH6Ql+28Of6cengnMswseaowEboL4qHnHXrs5JOF0rrhi9xDwI EeZIQ+nOuVYg== X-IronPort-AV: E=McAfee;i="6000,8403,9747"; a="139342136" X-IronPort-AV: E=Sophos;i="5.77,273,1596524400"; d="scan'208";a="139342136" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Sep 2020 19:41:31 -0700 IronPort-SDR: NIf28QWjDtKtJ8whgjsJaC+SdRE+kO7mEUiAsRDnZJ+CSYwO836hEJx1d36QcwhrY+AERJVLee COxySJui8Yaw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,273,1596524400"; d="scan'208";a="332409832" Received: from fmsmsx606.amr.corp.intel.com ([10.18.126.86]) by fmsmga004.fm.intel.com with ESMTP; 17 Sep 2020 19:41:31 -0700 Received: from shsmsx606.ccr.corp.intel.com (10.109.6.216) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 17 Sep 2020 19:41:30 -0700 Received: from shsmsx601.ccr.corp.intel.com (10.109.6.141) by SHSMSX606.ccr.corp.intel.com (10.109.6.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Fri, 18 Sep 2020 10:41:27 +0800 Received: from shsmsx601.ccr.corp.intel.com ([10.109.6.141]) by SHSMSX601.ccr.corp.intel.com ([10.109.6.141]) with mapi id 15.01.1713.004; Fri, 18 Sep 2020 10:41:27 +0800 From: "Guo, Jia" To: "Wang, Haiyue" , "Wu, Jingjing" , "Zhang, Qi Z" , "Xing, Beilei" CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v1] net/iavf: support flex desc metadata extraction Thread-Index: AQHWjJ6wMaARAZPMe0qG4o6ZBZEDcqltrmvQ Date: Fri, 18 Sep 2020 02:41:27 +0000 Message-ID: References: <20200909025415.6185-1-jia.guo@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 x-originating-ip: [10.239.127.36] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v1] net/iavf: support flex desc metadata extraction 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" hi, haiyue > -----Original Message----- > From: Wang, Haiyue > Sent: Thursday, September 17, 2020 11:00 AM > To: Guo, Jia ; Wu, Jingjing ; > Zhang, Qi Z ; Xing, Beilei > Cc: dev@dpdk.org; Guo, Jia > Subject: RE: [dpdk-dev] [PATCH v1] net/iavf: support flex desc metadata > extraction >=20 > Hi Jeff, >=20 > > -----Original Message----- > > From: dev On Behalf Of Jeff Guo > > Sent: Wednesday, September 9, 2020 10:54 > > To: Wu, Jingjing ; Zhang, Qi Z > > ; Xing, Beilei > > Cc: dev@dpdk.org; Guo, Jia > > Subject: [dpdk-dev] [PATCH v1] net/iavf: support flex desc metadata > > extraction > > > > Enable metadata extraction for flexible descriptors in AVF, that would > > allow network function directly get metadata without additional > > parsing which would reduce the CPU cost for VFs. The enabling metadata > > extractions involve the metadata of VLAN/IPv4/IPv6/IPv6-FLOW/TCP/OVS/ > > MPLS flexible descriptors, and the VF could negotiate the capability > > of the flexible descriptor with PF and correspondingly configure the > > specific offload at receiving queues. > > > > Signed-off-by: Jeff Guo > > --- > > doc/guides/rel_notes/release_20_11.rst | 6 + > > drivers/net/iavf/Makefile | 1 + > > drivers/net/iavf/iavf.h | 25 +- > > drivers/net/iavf/iavf_ethdev.c | 398 +++++++++++++++++++++++++ > > drivers/net/iavf/iavf_rxtx.c | 230 +++++++++++++- > > drivers/net/iavf/iavf_rxtx.h | 17 ++ > > drivers/net/iavf/iavf_vchnl.c | 22 +- > > drivers/net/iavf/meson.build | 2 + > > drivers/net/iavf/rte_pmd_iavf.h | 258 ++++++++++++++++ > > 9 files changed, 937 insertions(+), 22 deletions(-) create mode > > 100644 drivers/net/iavf/rte_pmd_iavf.h > > >=20 >=20 > > ------------- > > diff --git a/drivers/net/iavf/Makefile b/drivers/net/iavf/Makefile > > index 792cbb7f7..05fcbdc47 100644 > > --- a/drivers/net/iavf/Makefile > > +++ b/drivers/net/iavf/Makefile >=20 > meson build only now, remove the Makefile >=20 Oh, that is exactly. >=20 > > diff --git a/drivers/net/iavf/iavf_rxtx.c > > b/drivers/net/iavf/iavf_rxtx.c index 05a7dd898..fa71b4a80 100644 > > --- a/drivers/net/iavf/iavf_rxtx.c > > +++ b/drivers/net/iavf/iavf_rxtx.c > > @@ -26,6 +26,74 @@ >=20 >=20 > > + > > +/* Translate the rx flex descriptor status to pkt flags */ static > > +inline void iavf_rxd_to_pkt_fields(struct rte_mbuf *mb, > > + volatile union iavf_rx_flex_desc *rxdp, uint8_t rxdid) { if > > +(rxdid =3D=3D IAVF_RXDID_COMMS_GENERIC || > > + rxdid =3D=3D IAVF_RXDID_COMMS_AUX_VLAN || > > + rxdid =3D=3D IAVF_RXDID_COMMS_AUX_IPV4 || > > + rxdid =3D=3D IAVF_RXDID_COMMS_AUX_IPV6 || > > + rxdid =3D=3D IAVF_RXDID_COMMS_AUX_IPV6_FLOW || > > + rxdid =3D=3D IAVF_RXDID_COMMS_AUX_TCP || > > + rxdid =3D=3D IAVF_RXDID_COMMS_AUX_IP_OFFSET) > > +iavf_rxd_to_pkt_fields_aux(mb, rxdp); else if (rxdid =3D=3D > > +IAVF_RXDID_COMMS_OVS_1) iavf_rxd_to_pkt_fields_ovs(mb, rxdp); } >=20 > We can optimize this by calling function handle: >=20 > struct iavf_rx_queue *rxq->rxd_to_pkt_fields(mb, rxdp) >=20 > and when setup the queue, assign the right handle according to the rxdid. > if (rxdid =3D=3D IAVF_RXDID_COMMS_GENERIC ...) > rxq->rxd_to_pkt_fields =3D iavf_rxd_to_pkt_fields_aux; > else if (OVS_1) > rxq->rxd_to_pkt_fields =3D iavf_rxd_to_pkt_fields_ovs; >=20 >=20 Sounds not bad if it could let it more clear for handling these diversity p= rotocols, let's see what we could bring some modification in coming version= . > > --- a/drivers/net/iavf/meson.build > > +++ b/drivers/net/iavf/meson.build > > @@ -35,3 +35,5 @@ if arch_subdir =3D=3D 'x86' > > objs +=3D iavf_avx2_lib.extract_objects('iavf_rxtx_vec_avx2.c') > > endif > > endif > > + > > +install_headers('rte_pmd_iavf.h') > > diff --git a/drivers/net/iavf/rte_pmd_iavf.h > > b/drivers/net/iavf/rte_pmd_iavf.h new file mode 100644 index > > 000000000..858201bd7 > > --- /dev/null > > +++ b/drivers/net/iavf/rte_pmd_iavf.h > > @@ -0,0 +1,258 @@ > > +/* SPDX-Liavfnse-Identifier: BSD-3-Clause > > + * Copyright(c) 2019 Intel Corporation */ > > + > > +#ifndef _RTE_PMD_IAVF_H_ > > +#define _RTE_PMD_IAVF_H_ > > + > > +/** > > + * @file rte_pmd_iavf.h > > + * > > + * iavf PMD specific functions. > > + * > > + * @b EXPERIMENTAL: this API may change, or be removed, without prior > > +notiavf > > + * > > + */ > > + > > +#include > > +#include > > +#include > > + > > +#ifdef __cplusplus > > +extern "C" { > > +#endif > > + > > +/** > > + * The supported network flexible descriptor's extraction metadata > format. > > + */ > > +union rte_net_iavf_flex_desc_metadata { uint32_t metadata; > > + > > +struct { > > +uint16_t data0; > > +uint16_t data1; > > +} raw; > > + > > +struct { > > +uint16_t stag_vid:12, > > + stag_dei:1, > > + stag_pcp:3; > > +uint16_t ctag_vid:12, > > + ctag_dei:1, > > + ctag_pcp:3; > > +} vlan; > > + > > +struct { > > +uint16_t protocol:8, > > + ttl:8; > > +uint16_t tos:8, > > + ihl:4, > > + version:4; > > +} ipv4; > > + > > +struct { > > +uint16_t hoplimit:8, > > + nexthdr:8; > > +uint16_t flowhi4:4, > > + tc:8, > > + version:4; > > +} ipv6; > > + > > +struct { > > +uint16_t flowlo16; > > +uint16_t flowhi4:4, > > + tc:8, > > + version:4; > > +} ipv6_flow; > > + > > +struct { > > +uint16_t fin:1, > > + syn:1, > > + rst:1, > > + psh:1, > > + ack:1, > > + urg:1, > > + ece:1, > > + cwr:1, > > + res1:4, > > + doff:4; > > +uint16_t rsvd; > > +} tcp; > > + > > +uint32_t ip_ofs; > > +}; > > + > > +/* Offset of mbuf dynamic field for flexible descriptor's extraction > > +data */ extern int rte_net_iavf_dynfield_flex_desc_metadata_offs; > > + > > +/* Mask of mbuf dynamic flags for flexible descriptor's extraction > > +type */ extern uint64_t rte_net_iavf_dynflag_flex_desc_vlan_mask; > > +extern uint64_t rte_net_iavf_dynflag_flex_desc_ipv4_mask; > > +extern uint64_t rte_net_iavf_dynflag_flex_desc_ipv6_mask; > > +extern uint64_t rte_net_iavf_dynflag_flex_desc_ipv6_flow_mask; > > +extern uint64_t rte_net_iavf_dynflag_flex_desc_tcp_mask; > > +extern uint64_t rte_net_iavf_dynflag_flex_desc_ovs_mask; > > +extern uint64_t rte_net_iavf_dynflag_flex_desc_ip_offset_mask; > > + > > +/** > > + * The mbuf dynamic field pointer for flexible descriptor's extraction > metadata. > > + */ > > +#define RTE_NET_IAVF_DYNF_FLEX_DESC_METADATA(m) \ > > +RTE_MBUF_DYNFIELD((m), \ > > + rte_net_iavf_dynfield_flex_desc_metadata_offs, \ > > + uint32_t *) > > + > > +/** > > + * The mbuf dynamic flag for VLAN protocol extraction metadata, it is > > +valid > > + * when dev_args 'flex_desc' has 'vlan' specified. > > + */ > > +#define RTE_IAVF_PKT_RX_DYNF_FLEX_DESC_VLAN \ > > +(rte_net_iavf_dynflag_flex_desc_vlan_mask) > > + > > +/** > > + * The mbuf dynamic flag for IPv4 protocol extraction metadata, it is > > +valid > > + * when dev_args 'flex_desc' has 'ipv4' specified. > > + */ > > +#define RTE_IAVF_PKT_RX_DYNF_FLEX_DESC_IPV4 \ > > +(rte_net_iavf_dynflag_flex_desc_ipv4_mask) > > + > > +/** > > + * The mbuf dynamic flag for IPv6 protocol extraction metadata, it is > > +valid > > + * when dev_args 'flex_desc' has 'ipv6' specified. > > + */ > > +#define RTE_IAVF_PKT_RX_DYNF_FLEX_DESC_IPV6 \ > > +(rte_net_iavf_dynflag_flex_desc_ipv6_mask) > > + > > +/** > > + * The mbuf dynamic flag for IPv6 with flow protocol extraction > > +metadata, it is > > + * valid when dev_args 'flex_desc' has 'ipv6_flow' specified. > > + */ > > +#define RTE_IAVF_PKT_RX_DYNF_FLEX_DESC_IPV6_FLOW \ > > +(rte_net_iavf_dynflag_flex_desc_ipv6_flow_mask) > > + > > +/** > > + * The mbuf dynamic flag for TCP protocol extraction metadata, it is > > +valid > > + * when dev_args 'flex_desc' has 'tcp' specified. > > + */ > > +#define RTE_IAVF_PKT_RX_DYNF_FLEX_DESC_TCP \ > > +(rte_net_iavf_dynflag_flex_desc_tcp_mask) > > + > > +/** > > + * The mbuf dynamic flag for the extraction metadata of OVS flexible > > + * descriptor, it is valid when dev_args 'flex_desc' has 'ovs' specifi= ed. > > + */ > > +#define RTE_IAVF_PKT_RX_DYNF_FLEX_DESC_OVS \ > > +(rte_net_iavf_dynflag_flex_desc_ovs_mask) > > + > > +/** > > + * The mbuf dynamic flag for IP_OFFSET extraction metadata, it is > > +valid > > + * when dev_args 'flex_desc' has 'ip_offset' specified. > > + */ > > +#define RTE_IAVF_PKT_RX_DYNF_FLEX_DESC_IP_OFFSET \ > > +(rte_net_iavf_dynflag_flex_desc_ip_offset_mask) > > + > > +/** > > + * Check if mbuf dynamic field for flexible descriptor's extraction > > +metadata > > + * is registered. > > + * > > + * @return > > + * True if registered, false otherwise. > > + */ > > +__rte_experimental > > +static __rte_always_inline int > > +rte_net_iavf_dynf_flex_desc_metadata_avail(void) > > +{ > > +return rte_net_iavf_dynfield_flex_desc_metadata_offs !=3D -1; } > > + > > +/** > > + * Get the mbuf dynamic field for flexible descriptor's extraction met= adata. > > + * > > + * @param m > > + * The pointer to the mbuf. > > + * @return > > + * The saved protocol extraction metadata. > > + */ > > +__rte_experimental > > +static __rte_always_inline uint32_t > > +rte_net_iavf_dynf_flex_desc_metadata_get(struct rte_mbuf *m) > { return > > +*RTE_NET_IAVF_DYNF_FLEX_DESC_METADATA(m); > > +} > > + > > +/** > > + * Dump the mbuf dynamic field for flexible descriptor's extraction > metadata. > > + * > > + * @param m > > + * The pointer to the mbuf. > > + */ > > +__rte_experimental > > +static inline void > > +rte_net_iavf_dump_flex_desc_metadata(struct rte_mbuf *m) { union > > +rte_net_iavf_flex_desc_metadata data; > > + > > +if (!rte_net_iavf_dynf_flex_desc_metadata_avail()) > > +return; > > + > > +data.metadata =3D rte_net_iavf_dynf_flex_desc_metadata_get(m); > > + > > +if (m->ol_flags & RTE_IAVF_PKT_RX_DYNF_FLEX_DESC_VLAN) > > +printf(" - Flexible descriptor's Metadata: [0x%04x:0x%04x]," > > + "vlan,stag=3D%u:%u:%u,ctag=3D%u:%u:%u", > > + data.raw.data0, data.raw.data1, > > + data.vlan.stag_pcp, > > + data.vlan.stag_dei, > > + data.vlan.stag_vid, > > + data.vlan.ctag_pcp, > > + data.vlan.ctag_dei, > > + data.vlan.ctag_vid); > > +else if (m->ol_flags & RTE_IAVF_PKT_RX_DYNF_FLEX_DESC_IPV4) > > +printf(" - Flexible descriptor's Metadata: [0x%04x:0x%04x]," > > + "ipv4,ver=3D%u,hdrlen=3D%u,tos=3D%u,ttl=3D%u,proto=3D%u", > > + data.raw.data0, data.raw.data1, > > + data.ipv4.version, > > + data.ipv4.ihl, > > + data.ipv4.tos, > > + data.ipv4.ttl, > > + data.ipv4.protocol); > > +else if (m->ol_flags & RTE_IAVF_PKT_RX_DYNF_FLEX_DESC_IPV6) > > +printf(" - Flexible descriptor's Metadata: [0x%04x:0x%04x]," > > + "ipv6,ver=3D%u,tc=3D%u,flow_hi4=3D0x%x,nexthdr=3D%u,hoplimit=3D= %u", > > + data.raw.data0, data.raw.data1, > > + data.ipv6.version, > > + data.ipv6.tc, > > + data.ipv6.flowhi4, > > + data.ipv6.nexthdr, > > + data.ipv6.hoplimit); > > +else if (m->ol_flags & RTE_IAVF_PKT_RX_DYNF_FLEX_DESC_IPV6_FLOW) > > +printf(" - Flexible descriptor's Metadata: [0x%04x:0x%04x]," > > + "ipv6_flow,ver=3D%u,tc=3D%u,flow=3D0x%x%04x", > > + data.raw.data0, data.raw.data1, > > + data.ipv6_flow.version, > > + data.ipv6_flow.tc, > > + data.ipv6_flow.flowhi4, > > + data.ipv6_flow.flowlo16); > > +else if (m->ol_flags & RTE_IAVF_PKT_RX_DYNF_FLEX_DESC_TCP) > > +printf(" - Flexible descriptor's Metadata: [0x%04x:0x%04x]," > > + "tcp,doff=3D%u,flags=3D%s%s%s%s%s%s%s%s", > > + data.raw.data0, data.raw.data1, > > + data.tcp.doff, > > + data.tcp.cwr ? "C" : "", > > + data.tcp.ece ? "E" : "", > > + data.tcp.urg ? "U" : "", > > + data.tcp.ack ? "A" : "", > > + data.tcp.psh ? "P" : "", > > + data.tcp.rst ? "R" : "", > > + data.tcp.syn ? "S" : "", > > + data.tcp.fin ? "F" : ""); > > +else if (m->ol_flags & RTE_IAVF_PKT_RX_DYNF_FLEX_DESC_IP_OFFSET) > > +printf(" - Flexible descriptor's Extraction: ip_offset=3D%u", > > + data.ip_ofs); > > +} > > + > > +#ifdef __cplusplus > > +} > > +#endif > > + > > +#endif /* _RTE_PMD_IAVF_H_ */ >=20 > You need to export these global symbols into rte_pmd_iavf_version.map lik= e: >=20 Ok. > EXPERIMENTAL { > global: >=20 > rte_net_iavf_dynfield_proto_xtr_metadata_offs; > ... > }; >=20 > > -- > > 2.20.1 >=20