distributor: rename v2.0 ABI to _single suffix

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 <marcinx.baran@intel.com>
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: David Hunt <david.hunt@intel.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
This commit is contained in:
Marcin Baran 2019-11-20 17:23:36 +00:00 committed by David Marchand
parent 6e5b516761
commit 4ab92c53ed
7 changed files with 66 additions and 80 deletions

View file

@ -13,7 +13,7 @@ LDLIBS += -lrte_eal -lrte_mbuf -lrte_ethdev
EXPORT_MAP := rte_distributor_version.map
# 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

View file

@ -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

View file

@ -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

View file

@ -17,7 +17,7 @@
#include <rte_tailq.h>
#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;

View file

@ -15,10 +15,10 @@
#include <rte_pause.h>
#include <rte_tailq.h>
#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;

View file

@ -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

View file

@ -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;
};