From patchwork Thu Oct 17 14:31:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Burakov, Anatoly" X-Patchwork-Id: 61405 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D2A241E9BF; Thu, 17 Oct 2019 16:32:22 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 20F081E99D for ; Thu, 17 Oct 2019 16:32:15 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Oct 2019 07:32:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,308,1566889200"; d="scan'208";a="396282197" Received: from silpixa00399498.ir.intel.com (HELO silpixa00399498.ger.corp.intel.com) ([10.237.223.151]) by fmsmga005.fm.intel.com with ESMTP; 17 Oct 2019 07:32:13 -0700 From: Anatoly Burakov To: dev@dpdk.org Cc: Marcin Baran , David Hunt , john.mcnamara@intel.com, bruce.richardson@intel.com, thomas@monjalon.net, david.marchand@redhat.com Date: Thu, 17 Oct 2019 15:31:57 +0100 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v4 07/10] distributor: rename v2.0 ABI to _single suffix 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" From: Marcin Baran The original ABI versioning was slightly misleading in that the DPDK 2.0 ABI was really a single mode for the distributor, and is used as such throughout the distributor code. Fix this by renaming all _v20 API's to _single API's, and remove symbol versioning. Signed-off-by: Marcin Baran Signed-off-by: Anatoly Burakov Acked-by: David Hunt --- Notes: v4: - Changed it back to how it was with v2 - Removed remaining v2.0 symbols v3: - Removed single mode from distributor as per Dave's comments v2: - Moved this to before ABI version bump to avoid compile breakage lib/librte_distributor/Makefile | 2 +- lib/librte_distributor/meson.build | 2 +- lib/librte_distributor/rte_distributor.c | 24 ++++---- .../rte_distributor_private.h | 10 ++-- ...ributor_v20.c => rte_distributor_single.c} | 57 ++++++++----------- ...ributor_v20.h => rte_distributor_single.h} | 26 ++++----- .../rte_distributor_version.map | 18 +----- 7 files changed, 58 insertions(+), 81 deletions(-) rename lib/librte_distributor/{rte_distributor_v20.c => rte_distributor_single.c} (84%) rename lib/librte_distributor/{rte_distributor_v20.h => rte_distributor_single.h} (89%) diff --git a/lib/librte_distributor/Makefile b/lib/librte_distributor/Makefile index 0ef80dcff4..d9d0089166 100644 --- a/lib/librte_distributor/Makefile +++ b/lib/librte_distributor/Makefile @@ -15,7 +15,7 @@ EXPORT_MAP := rte_distributor_version.map LIBABIVER := 1 # all source are stored in SRCS-y -SRCS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) := rte_distributor_v20.c +SRCS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) := rte_distributor_single.c SRCS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += rte_distributor.c ifeq ($(CONFIG_RTE_ARCH_X86),y) SRCS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += rte_distributor_match_sse.c diff --git a/lib/librte_distributor/meson.build b/lib/librte_distributor/meson.build index dba7e3b2aa..bd12ddb2f1 100644 --- a/lib/librte_distributor/meson.build +++ b/lib/librte_distributor/meson.build @@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Intel Corporation -sources = files('rte_distributor.c', 'rte_distributor_v20.c') +sources = files('rte_distributor.c', 'rte_distributor_single.c') if arch_subdir == 'x86' sources += files('rte_distributor_match_sse.c') else diff --git a/lib/librte_distributor/rte_distributor.c b/lib/librte_distributor/rte_distributor.c index ca3f21b833..b4fc0bfead 100644 --- a/lib/librte_distributor/rte_distributor.c +++ b/lib/librte_distributor/rte_distributor.c @@ -18,7 +18,7 @@ #include "rte_distributor_private.h" #include "rte_distributor.h" -#include "rte_distributor_v20.h" +#include "rte_distributor_single.h" TAILQ_HEAD(rte_dist_burst_list, rte_distributor); @@ -42,7 +42,7 @@ rte_distributor_request_pkt(struct rte_distributor *d, volatile int64_t *retptr64; if (unlikely(d->alg_type == RTE_DIST_ALG_SINGLE)) { - rte_distributor_request_pkt_v20(d->d_v20, + rte_distributor_request_pkt_single(d->d_single, worker_id, oldpkt[0]); return; } @@ -88,7 +88,8 @@ rte_distributor_poll_pkt(struct rte_distributor *d, unsigned int i; if (unlikely(d->alg_type == RTE_DIST_ALG_SINGLE)) { - pkts[0] = rte_distributor_poll_pkt_v20(d->d_v20, worker_id); + pkts[0] = rte_distributor_poll_pkt_single(d->d_single, + worker_id); return (pkts[0]) ? 1 : 0; } @@ -123,7 +124,7 @@ rte_distributor_get_pkt(struct rte_distributor *d, if (unlikely(d->alg_type == RTE_DIST_ALG_SINGLE)) { if (return_count <= 1) { - pkts[0] = rte_distributor_get_pkt_v20(d->d_v20, + pkts[0] = rte_distributor_get_pkt_single(d->d_single, worker_id, oldpkt[0]); return (pkts[0]) ? 1 : 0; } else @@ -153,7 +154,7 @@ rte_distributor_return_pkt(struct rte_distributor *d, if (unlikely(d->alg_type == RTE_DIST_ALG_SINGLE)) { if (num == 1) - return rte_distributor_return_pkt_v20(d->d_v20, + return rte_distributor_return_pkt_single(d->d_single, worker_id, oldpkt[0]); else return -EINVAL; @@ -330,7 +331,8 @@ rte_distributor_process(struct rte_distributor *d, if (d->alg_type == RTE_DIST_ALG_SINGLE) { /* Call the old API */ - return rte_distributor_process_v20(d->d_v20, mbufs, num_mbufs); + return rte_distributor_process_single(d->d_single, + mbufs, num_mbufs); } if (unlikely(num_mbufs == 0)) { @@ -464,7 +466,7 @@ rte_distributor_returned_pkts(struct rte_distributor *d, if (d->alg_type == RTE_DIST_ALG_SINGLE) { /* Call the old API */ - return rte_distributor_returned_pkts_v20(d->d_v20, + return rte_distributor_returned_pkts_single(d->d_single, mbufs, max_mbufs); } @@ -507,7 +509,7 @@ rte_distributor_flush(struct rte_distributor *d) if (d->alg_type == RTE_DIST_ALG_SINGLE) { /* Call the old API */ - return rte_distributor_flush_v20(d->d_v20); + return rte_distributor_flush_single(d->d_single); } flushed = total_outstanding(d); @@ -538,7 +540,7 @@ rte_distributor_clear_returns(struct rte_distributor *d) if (d->alg_type == RTE_DIST_ALG_SINGLE) { /* Call the old API */ - rte_distributor_clear_returns_v20(d->d_v20); + rte_distributor_clear_returns_single(d->d_single); return; } @@ -578,9 +580,9 @@ rte_distributor_create(const char *name, rte_errno = ENOMEM; return NULL; } - d->d_v20 = rte_distributor_create_v20(name, + d->d_single = rte_distributor_create_single(name, socket_id, num_workers); - if (d->d_v20 == NULL) { + if (d->d_single == NULL) { free(d); /* rte_errno will have been set */ return NULL; diff --git a/lib/librte_distributor/rte_distributor_private.h b/lib/librte_distributor/rte_distributor_private.h index 33cd89410c..bdb62b6e92 100644 --- a/lib/librte_distributor/rte_distributor_private.h +++ b/lib/librte_distributor/rte_distributor_private.h @@ -55,7 +55,7 @@ extern "C" { * the next cache line to worker 0, we pad this out to three cache lines. * Only 64-bits of the memory is actually used though. */ -union rte_distributor_buffer_v20 { +union rte_distributor_buffer_single { volatile int64_t bufptr64; char pad[RTE_CACHE_LINE_SIZE*3]; } __rte_cache_aligned; @@ -80,8 +80,8 @@ struct rte_distributor_returned_pkts { struct rte_mbuf *mbufs[RTE_DISTRIB_MAX_RETURNS]; }; -struct rte_distributor_v20 { - TAILQ_ENTRY(rte_distributor_v20) next; /**< Next in list. */ +struct rte_distributor_single { + TAILQ_ENTRY(rte_distributor_single) next; /**< Next in list. */ char name[RTE_DISTRIBUTOR_NAMESIZE]; /**< Name of the ring. */ unsigned int num_workers; /**< Number of workers polling */ @@ -96,7 +96,7 @@ struct rte_distributor_v20 { struct rte_distributor_backlog backlog[RTE_DISTRIB_MAX_WORKERS]; - union rte_distributor_buffer_v20 bufs[RTE_DISTRIB_MAX_WORKERS]; + union rte_distributor_buffer_single bufs[RTE_DISTRIB_MAX_WORKERS]; struct rte_distributor_returned_pkts returns; }; @@ -154,7 +154,7 @@ struct rte_distributor { enum rte_distributor_match_function dist_match_fn; - struct rte_distributor_v20 *d_v20; + struct rte_distributor_single *d_single; }; void diff --git a/lib/librte_distributor/rte_distributor_v20.c b/lib/librte_distributor/rte_distributor_single.c similarity index 84% rename from lib/librte_distributor/rte_distributor_v20.c rename to lib/librte_distributor/rte_distributor_single.c index cdc0969a89..9a6ef826c9 100644 --- a/lib/librte_distributor/rte_distributor_v20.c +++ b/lib/librte_distributor/rte_distributor_single.c @@ -15,10 +15,10 @@ #include #include -#include "rte_distributor_v20.h" +#include "rte_distributor_single.h" #include "rte_distributor_private.h" -TAILQ_HEAD(rte_distributor_list, rte_distributor_v20); +TAILQ_HEAD(rte_distributor_list, rte_distributor_single); static struct rte_tailq_elem rte_distributor_tailq = { .name = "RTE_DISTRIBUTOR", @@ -28,23 +28,22 @@ EAL_REGISTER_TAILQ(rte_distributor_tailq) /**** APIs called by workers ****/ void -rte_distributor_request_pkt_v20(struct rte_distributor_v20 *d, +rte_distributor_request_pkt_single(struct rte_distributor_single *d, unsigned worker_id, struct rte_mbuf *oldpkt) { - union rte_distributor_buffer_v20 *buf = &d->bufs[worker_id]; + union rte_distributor_buffer_single *buf = &d->bufs[worker_id]; int64_t req = (((int64_t)(uintptr_t)oldpkt) << RTE_DISTRIB_FLAG_BITS) | RTE_DISTRIB_GET_BUF; while (unlikely(buf->bufptr64 & RTE_DISTRIB_FLAGS_MASK)) rte_pause(); buf->bufptr64 = req; } -VERSION_SYMBOL(rte_distributor_request_pkt, _v20, 2.0); struct rte_mbuf * -rte_distributor_poll_pkt_v20(struct rte_distributor_v20 *d, +rte_distributor_poll_pkt_single(struct rte_distributor_single *d, unsigned worker_id) { - union rte_distributor_buffer_v20 *buf = &d->bufs[worker_id]; + union rte_distributor_buffer_single *buf = &d->bufs[worker_id]; if (buf->bufptr64 & RTE_DISTRIB_GET_BUF) return NULL; @@ -52,31 +51,28 @@ rte_distributor_poll_pkt_v20(struct rte_distributor_v20 *d, int64_t ret = buf->bufptr64 >> RTE_DISTRIB_FLAG_BITS; return (struct rte_mbuf *)((uintptr_t)ret); } -VERSION_SYMBOL(rte_distributor_poll_pkt, _v20, 2.0); struct rte_mbuf * -rte_distributor_get_pkt_v20(struct rte_distributor_v20 *d, +rte_distributor_get_pkt_single(struct rte_distributor_single *d, unsigned worker_id, struct rte_mbuf *oldpkt) { struct rte_mbuf *ret; - rte_distributor_request_pkt_v20(d, worker_id, oldpkt); - while ((ret = rte_distributor_poll_pkt_v20(d, worker_id)) == NULL) + rte_distributor_request_pkt_single(d, worker_id, oldpkt); + while ((ret = rte_distributor_poll_pkt_single(d, worker_id)) == NULL) rte_pause(); return ret; } -VERSION_SYMBOL(rte_distributor_get_pkt, _v20, 2.0); int -rte_distributor_return_pkt_v20(struct rte_distributor_v20 *d, +rte_distributor_return_pkt_single(struct rte_distributor_single *d, unsigned worker_id, struct rte_mbuf *oldpkt) { - union rte_distributor_buffer_v20 *buf = &d->bufs[worker_id]; + union rte_distributor_buffer_single *buf = &d->bufs[worker_id]; uint64_t req = (((int64_t)(uintptr_t)oldpkt) << RTE_DISTRIB_FLAG_BITS) | RTE_DISTRIB_RETURN_BUF; buf->bufptr64 = req; return 0; } -VERSION_SYMBOL(rte_distributor_return_pkt, _v20, 2.0); /**** APIs called on distributor core ***/ @@ -102,7 +98,7 @@ backlog_pop(struct rte_distributor_backlog *bl) /* stores a packet returned from a worker inside the returns array */ static inline void -store_return(uintptr_t oldbuf, struct rte_distributor_v20 *d, +store_return(uintptr_t oldbuf, struct rte_distributor_single *d, unsigned *ret_start, unsigned *ret_count) { /* store returns in a circular buffer - code is branch-free */ @@ -113,7 +109,7 @@ store_return(uintptr_t oldbuf, struct rte_distributor_v20 *d, } static inline void -handle_worker_shutdown(struct rte_distributor_v20 *d, unsigned int wkr) +handle_worker_shutdown(struct rte_distributor_single *d, unsigned int wkr) { d->in_flight_tags[wkr] = 0; d->in_flight_bitmask &= ~(1UL << wkr); @@ -143,7 +139,7 @@ handle_worker_shutdown(struct rte_distributor_v20 *d, unsigned int wkr) * Note that the tags were set before first level call * to rte_distributor_process. */ - rte_distributor_process_v20(d, pkts, i); + rte_distributor_process_single(d, pkts, i); bl->count = bl->start = 0; } } @@ -153,7 +149,7 @@ handle_worker_shutdown(struct rte_distributor_v20 *d, unsigned int wkr) * to do a partial flush. */ static int -process_returns(struct rte_distributor_v20 *d) +process_returns(struct rte_distributor_single *d) { unsigned wkr; unsigned flushed = 0; @@ -192,7 +188,7 @@ process_returns(struct rte_distributor_v20 *d) /* process a set of packets to distribute them to workers */ int -rte_distributor_process_v20(struct rte_distributor_v20 *d, +rte_distributor_process_single(struct rte_distributor_single *d, struct rte_mbuf **mbufs, unsigned num_mbufs) { unsigned next_idx = 0; @@ -293,11 +289,10 @@ rte_distributor_process_v20(struct rte_distributor_v20 *d, d->returns.count = ret_count; return num_mbufs; } -VERSION_SYMBOL(rte_distributor_process, _v20, 2.0); /* return to the caller, packets returned from workers */ int -rte_distributor_returned_pkts_v20(struct rte_distributor_v20 *d, +rte_distributor_returned_pkts_single(struct rte_distributor_single *d, struct rte_mbuf **mbufs, unsigned max_mbufs) { struct rte_distributor_returned_pkts *returns = &d->returns; @@ -314,13 +309,12 @@ rte_distributor_returned_pkts_v20(struct rte_distributor_v20 *d, return retval; } -VERSION_SYMBOL(rte_distributor_returned_pkts, _v20, 2.0); /* return the number of packets in-flight in a distributor, i.e. packets * being worked on or queued up in a backlog. */ static inline unsigned -total_outstanding(const struct rte_distributor_v20 *d) +total_outstanding(const struct rte_distributor_single *d) { unsigned wkr, total_outstanding; @@ -335,35 +329,33 @@ total_outstanding(const struct rte_distributor_v20 *d) /* flush the distributor, so that there are no outstanding packets in flight or * queued up. */ int -rte_distributor_flush_v20(struct rte_distributor_v20 *d) +rte_distributor_flush_single(struct rte_distributor_single *d) { const unsigned flushed = total_outstanding(d); while (total_outstanding(d) > 0) - rte_distributor_process_v20(d, NULL, 0); + rte_distributor_process_single(d, NULL, 0); return flushed; } -VERSION_SYMBOL(rte_distributor_flush, _v20, 2.0); /* clears the internal returns array in the distributor */ void -rte_distributor_clear_returns_v20(struct rte_distributor_v20 *d) +rte_distributor_clear_returns_single(struct rte_distributor_single *d) { d->returns.start = d->returns.count = 0; #ifndef __OPTIMIZE__ memset(d->returns.mbufs, 0, sizeof(d->returns.mbufs)); #endif } -VERSION_SYMBOL(rte_distributor_clear_returns, _v20, 2.0); /* creates a distributor instance */ -struct rte_distributor_v20 * -rte_distributor_create_v20(const char *name, +struct rte_distributor_single * +rte_distributor_create_single(const char *name, unsigned socket_id, unsigned num_workers) { - struct rte_distributor_v20 *d; + struct rte_distributor_single *d; struct rte_distributor_list *distributor_list; char mz_name[RTE_MEMZONE_NAMESIZE]; const struct rte_memzone *mz; @@ -399,4 +391,3 @@ rte_distributor_create_v20(const char *name, return d; } -VERSION_SYMBOL(rte_distributor_create, _v20, 2.0); diff --git a/lib/librte_distributor/rte_distributor_v20.h b/lib/librte_distributor/rte_distributor_single.h similarity index 89% rename from lib/librte_distributor/rte_distributor_v20.h rename to lib/librte_distributor/rte_distributor_single.h index 12865658ba..2f80aa43d1 100644 --- a/lib/librte_distributor/rte_distributor_v20.h +++ b/lib/librte_distributor/rte_distributor_single.h @@ -2,8 +2,8 @@ * Copyright(c) 2010-2014 Intel Corporation */ -#ifndef _RTE_DISTRIB_V20_H_ -#define _RTE_DISTRIB_V20_H_ +#ifndef _RTE_DISTRIB_SINGLE_H_ +#define _RTE_DISTRIB_SINGLE_H_ /** * @file @@ -19,7 +19,7 @@ extern "C" { #define RTE_DISTRIBUTOR_NAMESIZE 32 /**< Length of name for instance */ -struct rte_distributor_v20; +struct rte_distributor_single; struct rte_mbuf; /** @@ -38,8 +38,8 @@ struct rte_mbuf; * @return * The newly created distributor instance */ -struct rte_distributor_v20 * -rte_distributor_create_v20(const char *name, unsigned int socket_id, +struct rte_distributor_single * +rte_distributor_create_single(const char *name, unsigned int socket_id, unsigned int num_workers); /* *** APIS to be called on the distributor lcore *** */ @@ -74,7 +74,7 @@ rte_distributor_create_v20(const char *name, unsigned int socket_id, * The number of mbufs processed. */ int -rte_distributor_process_v20(struct rte_distributor_v20 *d, +rte_distributor_process_single(struct rte_distributor_single *d, struct rte_mbuf **mbufs, unsigned int num_mbufs); /** @@ -92,7 +92,7 @@ rte_distributor_process_v20(struct rte_distributor_v20 *d, * The number of mbufs returned in the mbufs array. */ int -rte_distributor_returned_pkts_v20(struct rte_distributor_v20 *d, +rte_distributor_returned_pkts_single(struct rte_distributor_single *d, struct rte_mbuf **mbufs, unsigned int max_mbufs); /** @@ -107,7 +107,7 @@ rte_distributor_returned_pkts_v20(struct rte_distributor_v20 *d, * The number of queued/in-flight packets that were completed by this call. */ int -rte_distributor_flush_v20(struct rte_distributor_v20 *d); +rte_distributor_flush_single(struct rte_distributor_single *d); /** * Clears the array of returned packets used as the source for the @@ -119,7 +119,7 @@ rte_distributor_flush_v20(struct rte_distributor_v20 *d); * The distributor instance to be used */ void -rte_distributor_clear_returns_v20(struct rte_distributor_v20 *d); +rte_distributor_clear_returns_single(struct rte_distributor_single *d); /* *** APIS to be called on the worker lcores *** */ /* @@ -148,7 +148,7 @@ rte_distributor_clear_returns_v20(struct rte_distributor_v20 *d); * A new packet to be processed by the worker thread. */ struct rte_mbuf * -rte_distributor_get_pkt_v20(struct rte_distributor_v20 *d, +rte_distributor_get_pkt_single(struct rte_distributor_single *d, unsigned int worker_id, struct rte_mbuf *oldpkt); /** @@ -164,7 +164,7 @@ rte_distributor_get_pkt_v20(struct rte_distributor_v20 *d, * The previous packet being processed by the worker */ int -rte_distributor_return_pkt_v20(struct rte_distributor_v20 *d, +rte_distributor_return_pkt_single(struct rte_distributor_single *d, unsigned int worker_id, struct rte_mbuf *mbuf); /** @@ -188,7 +188,7 @@ rte_distributor_return_pkt_v20(struct rte_distributor_v20 *d, * The previous packet, if any, being processed by the worker */ void -rte_distributor_request_pkt_v20(struct rte_distributor_v20 *d, +rte_distributor_request_pkt_single(struct rte_distributor_single *d, unsigned int worker_id, struct rte_mbuf *oldpkt); /** @@ -208,7 +208,7 @@ rte_distributor_request_pkt_v20(struct rte_distributor_v20 *d, * packet is yet available. */ struct rte_mbuf * -rte_distributor_poll_pkt_v20(struct rte_distributor_v20 *d, +rte_distributor_poll_pkt_single(struct rte_distributor_single *d, unsigned int worker_id); #ifdef __cplusplus diff --git a/lib/librte_distributor/rte_distributor_version.map b/lib/librte_distributor/rte_distributor_version.map index 3a285b394e..00e26b4804 100644 --- a/lib/librte_distributor/rte_distributor_version.map +++ b/lib/librte_distributor/rte_distributor_version.map @@ -1,19 +1,3 @@ -DPDK_2.0 { - global: - - rte_distributor_clear_returns; - rte_distributor_create; - rte_distributor_flush; - rte_distributor_get_pkt; - rte_distributor_poll_pkt; - rte_distributor_process; - rte_distributor_request_pkt; - rte_distributor_return_pkt; - rte_distributor_returned_pkts; - - local: *; -}; - DPDK_17.05 { global: @@ -26,4 +10,4 @@ DPDK_17.05 { rte_distributor_request_pkt; rte_distributor_return_pkt; rte_distributor_returned_pkts; -} DPDK_2.0; +};