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 852A0A04C2; Mon, 25 Nov 2019 17:13:43 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3D3B82952; Mon, 25 Nov 2019 17:13:43 +0100 (CET) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by dpdk.org (Postfix) with ESMTP id 06EEA28EE for ; Mon, 25 Nov 2019 17:13:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574698421; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=a2mkx1kwwtz5OclbfFFQpqaczEZmYu+otNAh/F8eoPU=; b=AGCMFjOVgFEn/nQCOzdXYpUUCovICz13yhdzzIGYe7RXG1JSPqpze1c4YfpMp43iGNE4// VjFSaVoupk5Og6FjIojiyZFp7oyQedfRbfz1TfsRyokLun2jLmBhmdMEGg8wFH8yqXvE3g PtuTfHiwGkbZe21QZd+Vlx58JgA6oaE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-417-X3aN5rvwOMOIfYwnkl9RJw-1; Mon, 25 Nov 2019 11:13:37 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 91655802ADB; Mon, 25 Nov 2019 16:13:32 +0000 (UTC) Received: from dmarchan.remote.csb (ovpn-204-70.brq.redhat.com [10.40.204.70]) by smtp.corp.redhat.com (Postfix) with ESMTP id 53327100032E; Mon, 25 Nov 2019 16:13:25 +0000 (UTC) From: David Marchand To: nhorman@tuxdriver.com, dev@dpdk.org Cc: thomas@monjalon.net, arybchenko@solarflare.com, stable@dpdk.org, Ray Kinsella , John McNamara , Marko Kovacevic , Qiming Yang , Wenzhuo Lu , Declan Doherty , Adrien Mazarguil , Ferruh Yigit , Cristian Dumitrescu Date: Mon, 25 Nov 2019 17:13:14 +0100 Message-Id: <20191125161314.18804-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: X3aN5rvwOMOIfYwnkl9RJw-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Subject: [dpdk-dev] [RFC PATCH] mark experimental variables 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" So far, we did not pay attention to direct access to variables but they are part of the API/ABI too and should be clearly identified. Introduce a __rte_experimental_var tag and mark existing variables. Fixes: a4bcd61de82d ("buildtools: add script to check experimental API expo= rts") Cc: stable@dpdk.org Signed-off-by: David Marchand --- Quick patch to try to catch experimental variables. Not sure if we could use a single section, so please advise if there is better to do about this. --- buildtools/check-experimental-syms.sh | 17 +++++++++++++++-- devtools/checkpatches.sh | 14 +++++++++----- doc/guides/contributing/abi_policy.rst | 7 ++++--- drivers/net/ice/rte_pmd_ice.h | 3 +++ lib/librte_cryptodev/rte_crypto_asym.h | 3 +++ lib/librte_eal/common/include/rte_compat.h | 5 +++++ lib/librte_ethdev/rte_flow.h | 17 +++++++++++++++++ lib/librte_port/rte_port_eventdev.h | 5 +++++ 8 files changed, 61 insertions(+), 10 deletions(-) diff --git a/buildtools/check-experimental-syms.sh b/buildtools/check-exper= imental-syms.sh index f3603e5ba..27f7b39f6 100755 --- a/buildtools/check-experimental-syms.sh +++ b/buildtools/check-experimental-syms.sh @@ -34,13 +34,26 @@ do =09=09Please add __rte_experimental to the definition of $SYM =09=09END_OF_MESSAGE =09=09ret=3D1 +=09elif grep -q "\.data.*[[:space:]]$SYM$" $DUMPFILE && +=09=09! grep -q "\.data\.experimental.*[[:space:]]$SYM$" $DUMPFILE +=09then +=09=09cat >&2 <<- END_OF_MESSAGE +=09=09$SYM is not flagged as experimental +=09=09but is listed in version map +=09=09Please add __rte_experimental_var to the definition of $SYM +=09=09END_OF_MESSAGE +=09=09ret=3D1 =09fi done =20 # Filter out symbols suffixed with a . for icc for SYM in `awk '{ -=09if ($2 !=3D "l" && $4 =3D=3D ".text.experimental" && !($NF ~ /\.$/)) { -=09=09print $NF +=09if ($2 =3D=3D "l" || $NF ~ /\.$/) { +=09=09next; +=09} +=09if ($4 =3D=3D ".text.experimental" || +=09 $4 =3D=3D ".data.experimental") { +=09=09print $NF; =09} }' $DUMPFILE` do diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh index b16bace92..d3d02b8ce 100755 --- a/devtools/checkpatches.sh +++ b/devtools/checkpatches.sh @@ -90,11 +90,15 @@ check_experimental_tags() { # =09=09=09=09"headers ("current_file")"; =09=09=09ret =3D 1; =09=09} -=09=09if ($1 !=3D "+__rte_experimental" || $2 !=3D "") { -=09=09=09print "__rte_experimental must appear alone on the line" \ -=09=09=09=09" immediately preceding the return type of a function." -=09=09=09ret =3D 1; + +=09=09if (NF =3D=3D 1 && ($1 =3D=3D "+__rte_experimental" || +=09=09=09=09$1 =3D=3D "+__rte_experimental_var")) { +=09=09=09next; =09=09} +=09=09print "__rte_experimental or __rte_experimental_var must " \ +=09=09=09"appear alone on the line immediately preceding the " \ +=09=09=09"return type of a function."; +=09=09ret =3D 1; =09} =09END { =09=09exit ret; @@ -178,7 +182,7 @@ check () { # =09=09ret=3D1 =09fi =20 -=09! $verbose || printf '\nChecking __rte_experimental tags:\n' +=09! $verbose || printf '\nChecking __rte_experimental* tags:\n' =09report=3D$(check_experimental_tags "$tmpinput") =09if [ $? -ne 0 ] ; then =09=09$headline_printed || print_headline "$3" diff --git a/doc/guides/contributing/abi_policy.rst b/doc/guides/contributi= ng/abi_policy.rst index 05ca95980..189ef6491 100644 --- a/doc/guides/contributing/abi_policy.rst +++ b/doc/guides/contributing/abi_policy.rst @@ -300,9 +300,10 @@ Note that marking an API as experimental is a multi st= ep process. To mark an API as experimental, the symbols which are desired to be export= ed must be placed in an EXPERIMENTAL version block in the corresponding libra= ries' version map script. -Secondly, the corresponding prototypes of those exported functions (in the -development header files), must be marked with the ``__rte_experimental`` = tag -(see ``rte_compat.h``). +Secondly, the corresponding prototypes of those exported functions (resp. +variables) must be marked with the ``__rte_experimental`` (resp. +``__rte_experimental_var``) tag in the development header files (see +``rte_compat.h``). The DPDK build makefiles perform a check to ensure that the map file and t= he C code reflect the same list of symbols. This check can be circumvented by defining ``ALLOW_EXPERIMENTAL_API`` diff --git a/drivers/net/ice/rte_pmd_ice.h b/drivers/net/ice/rte_pmd_ice.h index e254db053..dbd5586d4 100644 --- a/drivers/net/ice/rte_pmd_ice.h +++ b/drivers/net/ice/rte_pmd_ice.h @@ -15,6 +15,8 @@ */ =20 #include <stdio.h> + +#include <rte_compat.h> #include <rte_mbuf.h> #include <rte_mbuf_dyn.h> =20 @@ -81,6 +83,7 @@ union rte_net_ice_proto_xtr_metadata { }; =20 /* Offset of mbuf dynamic field for protocol extraction data */ +__rte_experimental_var extern int rte_net_ice_dynfield_proto_xtr_metadata_offs; =20 /* Mask of mbuf dynamic flags for protocol extraction type */ diff --git a/lib/librte_cryptodev/rte_crypto_asym.h b/lib/librte_cryptodev/= rte_crypto_asym.h index 0d34ce8df..d4e84910f 100644 --- a/lib/librte_cryptodev/rte_crypto_asym.h +++ b/lib/librte_cryptodev/rte_crypto_asym.h @@ -24,6 +24,7 @@ extern "C" { #include <rte_memory.h> #include <rte_mempool.h> #include <rte_common.h> +#include <rte_compat.h> =20 #include "rte_crypto_sym.h" =20 @@ -37,10 +38,12 @@ typedef struct rte_crypto_param_t { } rte_crypto_param; =20 /** asym xform type name strings */ +__rte_experimental_var extern const char * rte_crypto_asym_xform_strings[]; =20 /** asym operations type name strings */ +__rte_experimental_var extern const char * rte_crypto_asym_op_strings[]; =20 diff --git a/lib/librte_eal/common/include/rte_compat.h b/lib/librte_eal/co= mmon/include/rte_compat.h index 3eb33784b..3fd05179f 100644 --- a/lib/librte_eal/common/include/rte_compat.h +++ b/lib/librte_eal/common/include/rte_compat.h @@ -11,11 +11,16 @@ #define __rte_experimental \ __attribute__((deprecated("Symbol is not yet part of stable ABI"), \ section(".text.experimental"))) +#define __rte_experimental_var \ +__attribute__((deprecated("Symbol is not yet part of stable ABI"), \ +section(".data.experimental"))) =20 #else =20 #define __rte_experimental \ __attribute__((section(".text.experimental"))) +#define __rte_experimental_var \ +__attribute__((section(".data.experimental"))) =20 #endif =20 diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index 452d359a1..c8ea71acc 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -19,6 +19,7 @@ =20 #include <rte_arp.h> #include <rte_common.h> +#include <rte_compat.h> #include <rte_ether.h> #include <rte_icmp.h> #include <rte_ip.h> @@ -2531,9 +2532,11 @@ struct rte_flow_action_set_meta { }; =20 /* Mbuf dynamic field offset for metadata. */ +__rte_experimental_var extern int rte_flow_dynf_metadata_offs; =20 /* Mbuf dynamic field flag mask for metadata. */ +__rte_experimental_var extern uint64_t rte_flow_dynf_metadata_mask; =20 /* Mbuf dynamic field pointer for metadata. */ @@ -2548,14 +2551,24 @@ __rte_experimental static inline uint32_t rte_flow_dynf_metadata_get(struct rte_mbuf *m) { +#ifdef ALLOW_EXPERIMENTAL_API =09return *RTE_FLOW_DYNF_METADATA(m); +#else +=09RTE_SET_USED(m); +=09return 0; +#endif } =20 __rte_experimental static inline void rte_flow_dynf_metadata_set(struct rte_mbuf *m, uint32_t v) { +#ifdef ALLOW_EXPERIMENTAL_API =09*RTE_FLOW_DYNF_METADATA(m) =3D v; +#else +=09RTE_SET_USED(m); +=09RTE_SET_USED(v); +#endif } =20 /* @@ -2800,7 +2813,11 @@ __rte_experimental static inline int rte_flow_dynf_metadata_avail(void) { +#ifdef ALLOW_EXPERIMENTAL_API =09return !!rte_flow_dynf_metadata_mask; +#else +=09return 0; +#endif } =20 /** diff --git a/lib/librte_port/rte_port_eventdev.h b/lib/librte_port/rte_port= _eventdev.h index acf88f4e9..59246e204 100644 --- a/lib/librte_port/rte_port_eventdev.h +++ b/lib/librte_port/rte_port_eventdev.h @@ -25,6 +25,8 @@ extern "C" { **/ =20 #include <stdint.h> + +#include <rte_compat.h> #include <rte_eventdev.h> =20 #include "rte_port.h" @@ -39,6 +41,7 @@ struct rte_port_eventdev_reader_params { }; =20 /** Eventdev_reader port operations. */ +__rte_experimental_var extern struct rte_port_in_ops rte_port_eventdev_reader_ops; =20 /** Eventdev_writer port parameters. */ @@ -63,6 +66,7 @@ struct rte_port_eventdev_writer_params { }; =20 /** Eventdev_writer port operations. */ +__rte_experimental_var extern struct rte_port_out_ops rte_port_eventdev_writer_ops; =20 /** Event_writer_nodrop port parameters. */ @@ -90,6 +94,7 @@ struct rte_port_eventdev_writer_nodrop_params { }; =20 /** Eventdev_writer_nodrop port operations. */ +__rte_experimental_var extern struct rte_port_out_ops rte_port_eventdev_writer_nodrop_ops; =20 #ifdef __cplusplus --=20 2.23.0