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 BDDE9A04B4; Fri, 8 Nov 2019 17:26:44 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A6CBC1C23D; Fri, 8 Nov 2019 17:26:07 +0100 (CET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 313251C211 for ; Fri, 8 Nov 2019 17:26:06 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Nov 2019 08:25:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,282,1569308400"; d="scan'208";a="196947487" Received: from silpixa00399498.ir.intel.com (HELO silpixa00399498.ger.corp.intel.com) ([10.237.223.151]) by orsmga008.jf.intel.com with ESMTP; 08 Nov 2019 08:25:49 -0800 From: Anatoly Burakov To: dev@dpdk.org Cc: Marcin Baran , David Hunt , john.mcnamara@intel.com, ray.kinsella@intel.com, bruce.richardson@intel.com, thomas@monjalon.net, david.marchand@redhat.com Date: Fri, 8 Nov 2019 16:25:28 +0000 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v7 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/distributor_private.h | 10 +-- lib/librte_distributor/meson.build | 2 +- lib/librte_distributor/rte_distributor.c | 24 +++---- ...ributor_v20.c => rte_distributor_single.c} | 64 +++++++++---------- ...ributor_v20.h => rte_distributor_single.h} | 26 ++++---- .../rte_distributor_version.map | 18 +----- 7 files changed, 66 insertions(+), 80 deletions(-) rename lib/librte_distributor/{rte_distributor_v20.c => rte_distributor_single.c} (87%) 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/distributor_private.h b/lib/librte_distributor/distributor_private.h index c89371123e..489aef2acb 100644 --- a/lib/librte_distributor/distributor_private.h +++ b/lib/librte_distributor/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/meson.build b/lib/librte_distributor/meson.build index c9617d7b14..50b91887b5 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 a4c8ff6a96..6c5b0c86e8 100644 --- a/lib/librte_distributor/rte_distributor.c +++ b/lib/librte_distributor/rte_distributor.c @@ -17,7 +17,7 @@ #include #include "rte_distributor.h" -#include "rte_distributor_v20.h" +#include "rte_distributor_single.h" #include "distributor_private.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; } @@ -93,7 +93,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; } @@ -133,7 +134,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 @@ -163,7 +164,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; @@ -354,7 +355,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)) { @@ -494,7 +496,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); } @@ -537,7 +539,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); @@ -568,7 +570,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; } @@ -610,9 +612,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_v20.c b/lib/librte_distributor/rte_distributor_single.c similarity index 87% rename from lib/librte_distributor/rte_distributor_v20.c rename to lib/librte_distributor/rte_distributor_single.c index 655944bdb3..91d8824c64 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 "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", @@ -27,11 +27,11 @@ EAL_REGISTER_TAILQ(rte_distributor_tailq) /**** APIs called by workers ****/ -void __vsym -rte_distributor_request_pkt_v20(struct rte_distributor_v20 *d, +void +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(__atomic_load_n(&buf->bufptr64, __ATOMIC_RELAXED) @@ -42,11 +42,11 @@ rte_distributor_request_pkt_v20(struct rte_distributor_v20 *d, __atomic_store_n(&(buf->bufptr64), req, __ATOMIC_RELEASE); } -struct rte_mbuf * __vsym -rte_distributor_poll_pkt_v20(struct rte_distributor_v20 *d, +struct rte_mbuf * +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]; /* Sync with distributor. Acquire bufptr64. */ if (__atomic_load_n(&buf->bufptr64, __ATOMIC_ACQUIRE) & RTE_DISTRIB_GET_BUF) @@ -57,22 +57,22 @@ rte_distributor_poll_pkt_v20(struct rte_distributor_v20 *d, return (struct rte_mbuf *)((uintptr_t)ret); } -struct rte_mbuf * __vsym -rte_distributor_get_pkt_v20(struct rte_distributor_v20 *d, +struct rte_mbuf * +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; } -int __vsym -rte_distributor_return_pkt_v20(struct rte_distributor_v20 *d, +int +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; /* Sync with distributor on RETURN_BUF flag. */ @@ -104,7 +104,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 */ @@ -115,7 +115,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); @@ -146,7 +146,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; } } @@ -156,7 +156,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; @@ -200,8 +200,8 @@ process_returns(struct rte_distributor_v20 *d) } /* process a set of packets to distribute them to workers */ -int __vsym -rte_distributor_process_v20(struct rte_distributor_v20 *d, +int +rte_distributor_process_single(struct rte_distributor_single *d, struct rte_mbuf **mbufs, unsigned num_mbufs) { unsigned next_idx = 0; @@ -316,8 +316,8 @@ rte_distributor_process_v20(struct rte_distributor_v20 *d, } /* return to the caller, packets returned from workers */ -int __vsym -rte_distributor_returned_pkts_v20(struct rte_distributor_v20 *d, +int +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; @@ -339,7 +339,7 @@ rte_distributor_returned_pkts_v20(struct rte_distributor_v20 *d, * 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; @@ -353,20 +353,20 @@ total_outstanding(const struct rte_distributor_v20 *d) /* flush the distributor, so that there are no outstanding packets in flight or * queued up. */ -int __vsym -rte_distributor_flush_v20(struct rte_distributor_v20 *d) +int +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; } /* clears the internal returns array in the distributor */ -void __vsym -rte_distributor_clear_returns_v20(struct rte_distributor_v20 *d) +void +rte_distributor_clear_returns_single(struct rte_distributor_single *d) { d->returns.start = d->returns.count = 0; #ifndef __OPTIMIZE__ @@ -375,12 +375,12 @@ rte_distributor_clear_returns_v20(struct rte_distributor_v20 *d) } /* creates a distributor instance */ -struct rte_distributor_v20 * __vsym -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; 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; +}; -- 2.17.1