From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Subject: [RFC 6/6] port: remove legacy API
Date: Fri, 24 Jul 2026 09:44:02 -0700 [thread overview]
Message-ID: <20260724164520.192203-7-stephen@networkplumber.org> (raw)
In-Reply-To: <20260724164520.192203-1-stephen@networkplumber.org>
Remove the legacy port library API (rte_port_*) as announced for
removal in the 24.11 release. The SWX port API remains.
The sched, ip_frag, cryptodev and eventdev dependencies were only
used by the legacy port types, so drop them. The pcap dependency
is kept for the SWX source/sink port.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
doc/api/doxy-api-index.md | 7 -
doc/guides/prog_guide/img/figure32.png | Bin 11603 -> 0 bytes
doc/guides/prog_guide/packet_framework.rst | 132 +---
doc/guides/rel_notes/deprecation.rst | 5 -
doc/guides/rel_notes/release_26_11.rst | 3 +
lib/port/meson.build | 22 +-
lib/port/port_log.c | 7 -
lib/port/port_log.h | 11 -
lib/port/rte_port.h | 223 ------
lib/port/rte_port_ethdev.c | 530 --------------
lib/port/rte_port_ethdev.h | 75 --
lib/port/rte_port_eventdev.c | 590 ---------------
lib/port/rte_port_eventdev.h | 94 ---
lib/port/rte_port_fd.c | 524 --------------
lib/port/rte_port_fd.h | 74 --
lib/port/rte_port_frag.c | 280 --------
lib/port/rte_port_frag.h | 70 --
lib/port/rte_port_ras.c | 336 ---------
lib/port/rte_port_ras.h | 58 --
lib/port/rte_port_ring.c | 796 ---------------------
lib/port/rte_port_ring.h | 91 ---
lib/port/rte_port_sched.c | 298 --------
lib/port/rte_port_sched.h | 52 --
lib/port/rte_port_source_sink.c | 616 ----------------
lib/port/rte_port_source_sink.h | 57 --
lib/port/rte_port_sym_crypto.c | 558 ---------------
lib/port/rte_port_sym_crypto.h | 92 ---
27 files changed, 10 insertions(+), 5591 deletions(-)
delete mode 100644 doc/guides/prog_guide/img/figure32.png
delete mode 100644 lib/port/port_log.c
delete mode 100644 lib/port/port_log.h
delete mode 100644 lib/port/rte_port.h
delete mode 100644 lib/port/rte_port_ethdev.c
delete mode 100644 lib/port/rte_port_ethdev.h
delete mode 100644 lib/port/rte_port_eventdev.c
delete mode 100644 lib/port/rte_port_eventdev.h
delete mode 100644 lib/port/rte_port_fd.c
delete mode 100644 lib/port/rte_port_fd.h
delete mode 100644 lib/port/rte_port_frag.c
delete mode 100644 lib/port/rte_port_frag.h
delete mode 100644 lib/port/rte_port_ras.c
delete mode 100644 lib/port/rte_port_ras.h
delete mode 100644 lib/port/rte_port_ring.c
delete mode 100644 lib/port/rte_port_ring.h
delete mode 100644 lib/port/rte_port_sched.c
delete mode 100644 lib/port/rte_port_sched.h
delete mode 100644 lib/port/rte_port_source_sink.c
delete mode 100644 lib/port/rte_port_source_sink.h
delete mode 100644 lib/port/rte_port_sym_crypto.c
delete mode 100644 lib/port/rte_port_sym_crypto.h
diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md
index 760b770d6f..16827a602b 100644
--- a/doc/api/doxy-api-index.md
+++ b/doc/api/doxy-api-index.md
@@ -182,13 +182,6 @@ The public API headers are grouped by topics:
[bitmap](@ref rte_bitmap.h)
- **packet framework**:
- * [port](@ref rte_port.h):
- [ethdev](@ref rte_port_ethdev.h),
- [ring](@ref rte_port_ring.h),
- [frag](@ref rte_port_frag.h),
- [reass](@ref rte_port_ras.h),
- [sched](@ref rte_port_sched.h),
- [src/sink](@ref rte_port_source_sink.h)
* SWX pipeline:
[control](@ref rte_swx_ctl.h),
[extern](@ref rte_swx_extern.h),
diff --git a/doc/guides/prog_guide/img/figure32.png b/doc/guides/prog_guide/img/figure32.png
deleted file mode 100644
index 5215113fd9d533ff56526e21e1832bc7a6cabd04..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 11603
zcmb`NcQjn>+wX^H;XwrP=pv62BJya7P9hP}dz2v}+Ni<kgODykB8WD68G-~e!w5nO
z(aVh9qs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qB><u)b
zZ8}FzISnvi8^2~5FXtrbpsOyj7CkX>nn4zz|1beaz$f*aAcTnarK7~$sgg6m@kIJk
zJ(A@kVJ7|VdQum1#Z00a4JhU(OK9`>fXsgFMg<^x%0?xaM}5Ez;l(dfgKm(~IU%2?
z+6m3`!agCu3H>%ptFubc-~SQK#}XaCxWVXLB?z5u3+ohdFzwo<eiHVhqa{_@EMc(z
zcz>}>RFx-R-M#<PhzlnKGLy6)fmA~bcTyoyvu(*~&K;>vTegS>cL8HWvx}b_0J39q
zV6rVhtt%|ive7i5tjrqSn%G;2O05S&tZATr;8Hg!Ib`%<Gk@8;6c9;+haesMgF+E6
ziF=a!<LQH6fP7<&QU7pn+%Fr?mBIX<zX;_r_Os@{hnM_&nkjzpf0!1gNPlX_WAzQC
XpF?WbPu~YeLUe8#Xq8>R7xljYKq0l$
diff --git a/doc/guides/prog_guide/packet_framework.rst b/doc/guides/prog_guide/packet_framework.rst
index 98cf3be109..3b5ede7dc2 100644
--- a/doc/guides/prog_guide/packet_framework.rst
+++ b/doc/guides/prog_guide/packet_framework.rst
@@ -4,132 +4,12 @@
Packet Framework Library
========================
-Design Objectives
------------------
-
-The main design objectives for the DPDK Packet Framework are:
-
-* Provide standard methodology to build complex packet processing pipelines.
- Provide reusable and extensible templates for the commonly used pipeline functional blocks;
-
-* Provide capability to switch between pure software and hardware-accelerated implementations for the same pipeline functional block;
-
-* Provide the best trade-off between flexibility and performance.
- Hardcoded pipelines usually provide the best performance, but are not flexible,
- while developing flexible frameworks is never a problem, but performance is usually low;
-
-* Provide a framework that is logically similar to Open Flow.
-
-Overview
---------
-
-Packet processing applications are frequently structured as pipelines of multiple stages,
-with the logic of each stage glued around a lookup table.
-For each incoming packet, the table defines the set of actions to be applied to the packet,
-as well as the next stage to send the packet to.
-
-The DPDK Packet Framework minimizes the development effort required to build packet processing pipelines
-by defining a standard methodology for pipeline development,
-as well as providing libraries of reusable templates for the commonly used pipeline blocks.
-
-The pipeline is constructed by connecting the set of input ports with the set of output ports
-through the set of tables in a tree-like topology.
-As a result of lookup operation for the current packet in the current table,
-one of the table entries (on lookup hit) or the default table entry (on lookup miss)
-provides the set of actions to be applied on the current packet,
-as well as the next hop for the packet, which can be either another table, an output port or packet drop.
-
-An example of packet processing pipeline is presented in :numref:`packet_framework_figure_32`:
-
-.. _packet_framework_figure_32:
-
-.. figure:: img/figure32.*
-
- Example of Packet Processing Pipeline where Input Ports 0 and 1
- are Connected with Output Ports 0, 1 and 2 through Tables 0 and 1
-
-
-Port Library Design
--------------------
-
-Port Types
-~~~~~~~~~~
-
-:numref:`packet_framework_table_qos_19` is a non-exhaustive list of ports
-that can be implemented with the Packet Framework.
-
-.. _packet_framework_table_qos_19:
-
-.. table:: Port Types
-
- +---+------------------+---------------------------------------------------------------------------------------+
- | # | Port type | Description |
- | | | |
- +===+==================+=======================================================================================+
- | 1 | SW ring | SW circular buffer used for message passing between the application threads. Uses |
- | | | the DPDK rte_ring primitive. Expected to be the most commonly used type of |
- | | | port. |
- | | | |
- +---+------------------+---------------------------------------------------------------------------------------+
- | 2 | HW ring | Queue of buffer descriptors used to interact with NIC, switch or accelerator ports. |
- | | | For NIC ports, it uses the DPDK rte_eth_rx_queue or rte_eth_tx_queue |
- | | | primitives. |
- | | | |
- +---+------------------+---------------------------------------------------------------------------------------+
- | 3 | IP reassembly | Input packets are either IP fragments or complete IP datagrams. Output packets are |
- | | | complete IP datagrams. |
- | | | |
- +---+------------------+---------------------------------------------------------------------------------------+
- | 4 | IP fragmentation | Input packets are jumbo (IP datagrams with length bigger than MTU) or non-jumbo |
- | | | packets. Output packets are non-jumbo packets. |
- | | | |
- +---+------------------+---------------------------------------------------------------------------------------+
- | 5 | Traffic manager | Traffic manager attached to a specific NIC output port, performing congestion |
- | | | management and hierarchical scheduling according to pre-defined SLAs. |
- | | | |
- +---+------------------+---------------------------------------------------------------------------------------+
- | 6 | Source | Input port used as packet generator. Similar to Linux kernel /dev/zero character |
- | | | device. |
- | | | |
- +---+------------------+---------------------------------------------------------------------------------------+
- | 7 | Sink | Output port used to drop all input packets. Similar to Linux kernel /dev/null |
- | | | character device. |
- | | | |
- +---+------------------+---------------------------------------------------------------------------------------+
- | 8 | Sym_crypto | Output port used to extract DPDK Cryptodev operations from a fixed offset of the |
- | | | packet and then enqueue to the Cryptodev PMD. Input port used to dequeue the |
- | | | Cryptodev operations from the Cryptodev PMD and then retrieve the packets from them. |
- +---+------------------+---------------------------------------------------------------------------------------+
-
-Port Interface
-~~~~~~~~~~~~~~
-
-Each port is unidirectional, i.e. either input port or output port.
-Each input/output port is required to implement an abstract interface that
-defines the initialization and run-time operation of the port.
-The port abstract interface is described below.
-
-.. table:: 20 Port Abstract Interface
-
- +---+----------------+-----------------------------------------------------------------------------------------+
- | # | Port Operation | Description |
- | | | |
- +===+================+=========================================================================================+
- | 1 | Create | Create the low-level port object (e.g. queue). Can internally allocate memory. |
- | | | |
- +---+----------------+-----------------------------------------------------------------------------------------+
- | 2 | Free | Free the resources (e.g. memory) used by the low-level port object. |
- | | | |
- +---+----------------+-----------------------------------------------------------------------------------------+
- | 3 | RX | Read a burst of input packets. Non-blocking operation. Only defined for input ports. |
- | | | |
- +---+----------------+-----------------------------------------------------------------------------------------+
- | 4 | TX | Write a burst of input packets. Non-blocking operation. Only defined for output ports. |
- | | | |
- +---+----------------+-----------------------------------------------------------------------------------------+
- | 5 | Flush | Flush the output buffer. Only defined for output ports. |
- | | | |
- +---+----------------+-----------------------------------------------------------------------------------------+
+The Packet Framework is a set of libraries (port, table and pipeline)
+for building flexible packet processing pipelines:
+the pipeline is constructed by connecting a set of input ports
+with a set of output ports through a set of match-action tables.
+The current framework API is the Software Switch (SWX) pipeline
+described below.
The Software Switch (SWX) Pipeline
----------------------------------
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 9dcf86098f..75b56b0e10 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -148,11 +148,6 @@ Deprecation Notices
The graph walk functions will process nodes in topological order
using bitmap scanning instead of the circular buffer.
-* port: The port library legacy API (functions rte_port_*)
- will be deprecated and subsequently removed in DPDK 24.11 release.
- Before this, the new port library API (functions rte_swx_port_*)
- will gradually transition from experimental to stable status.
-
* bus/vmbus: Starting DPDK 25.11, all the vmbus API defined in
``drivers/bus/vmbus/rte_bus_vmbus.h`` will become internal to DPDK.
Those API functions are used internally by DPDK core and netvsc PMD.
diff --git a/doc/guides/rel_notes/release_26_11.rst b/doc/guides/rel_notes/release_26_11.rst
index 306482c1d9..bc0ac01d5d 100644
--- a/doc/guides/rel_notes/release_26_11.rst
+++ b/doc/guides/rel_notes/release_26_11.rst
@@ -82,6 +82,9 @@ Removed Items
* Removed the legacy table library API (``rte_table_*`` functions).
The SWX table API (``rte_swx_table_*``) remains.
+* Removed the legacy port library API (``rte_port_*`` functions).
+ The SWX port API (``rte_swx_port_*``) remains.
+
API Changes
-----------
diff --git a/lib/port/meson.build b/lib/port/meson.build
index b597772872..ef88b917a3 100644
--- a/lib/port/meson.build
+++ b/lib/port/meson.build
@@ -8,39 +8,19 @@ if is_windows
endif
sources = files(
- 'port_log.c',
- 'rte_port_ethdev.c',
- 'rte_port_fd.c',
- 'rte_port_frag.c',
- 'rte_port_ras.c',
- 'rte_port_ring.c',
- 'rte_port_sched.c',
- 'rte_port_source_sink.c',
- 'rte_port_sym_crypto.c',
- 'rte_port_eventdev.c',
'rte_swx_port_ethdev.c',
'rte_swx_port_fd.c',
'rte_swx_port_ring.c',
'rte_swx_port_source_sink.c',
)
headers = files(
- 'rte_port_ethdev.h',
- 'rte_port_fd.h',
- 'rte_port_frag.h',
- 'rte_port_ras.h',
- 'rte_port.h',
- 'rte_port_ring.h',
- 'rte_port_sched.h',
- 'rte_port_source_sink.h',
- 'rte_port_sym_crypto.h',
- 'rte_port_eventdev.h',
'rte_swx_port.h',
'rte_swx_port_ethdev.h',
'rte_swx_port_fd.h',
'rte_swx_port_ring.h',
'rte_swx_port_source_sink.h',
)
-deps += ['ethdev', 'sched', 'ip_frag', 'cryptodev', 'eventdev']
+deps += ['ethdev']
if dpdk_conf.has('RTE_HAS_LIBPCAP')
dpdk_conf.set('RTE_PORT_PCAP', 1)
diff --git a/lib/port/port_log.c b/lib/port/port_log.c
deleted file mode 100644
index e7a10d80ef..0000000000
--- a/lib/port/port_log.c
+++ /dev/null
@@ -1,7 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright (c) 2024 Stephen Hemminger <stephen@networkplumber.org>
- */
-
-#include <rte_log.h>
-
-RTE_LOG_REGISTER_DEFAULT(port_logtype, INFO);
diff --git a/lib/port/port_log.h b/lib/port/port_log.h
deleted file mode 100644
index 28d75ee48b..0000000000
--- a/lib/port/port_log.h
+++ /dev/null
@@ -1,11 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright (c) 2023 Red Hat, Inc.
- */
-
-#include <rte_log.h>
-
-extern int port_logtype;
-#define RTE_LOGTYPE_PORT port_logtype
-
-#define PORT_LOG(level, ...) \
- RTE_LOG_LINE(level, PORT, "" __VA_ARGS__)
diff --git a/lib/port/rte_port.h b/lib/port/rte_port.h
deleted file mode 100644
index 81f57c41a5..0000000000
--- a/lib/port/rte_port.h
+++ /dev/null
@@ -1,223 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
- */
-
-#ifndef __INCLUDE_RTE_PORT_H__
-#define __INCLUDE_RTE_PORT_H__
-
-/**
- * @file
- * RTE Port
- *
- * This tool is part of the DPDK Packet Framework tool suite and provides
- * a standard interface to implement different types of packet ports.
- */
-
-#include <stdint.h>
-#include <rte_mbuf.h>
-
-/**@{
- * Macros to allow accessing metadata stored in the mbuf headroom
- * just beyond the end of the mbuf data structure returned by a port
- */
-#define RTE_MBUF_METADATA_UINT8_PTR(mbuf, offset) \
- (&((uint8_t *)(mbuf))[offset])
-#define RTE_MBUF_METADATA_UINT16_PTR(mbuf, offset) \
- ((uint16_t *) RTE_MBUF_METADATA_UINT8_PTR(mbuf, offset))
-#define RTE_MBUF_METADATA_UINT32_PTR(mbuf, offset) \
- ((uint32_t *) RTE_MBUF_METADATA_UINT8_PTR(mbuf, offset))
-#define RTE_MBUF_METADATA_UINT64_PTR(mbuf, offset) \
- ((uint64_t *) RTE_MBUF_METADATA_UINT8_PTR(mbuf, offset))
-
-#define RTE_MBUF_METADATA_UINT8(mbuf, offset) \
- (*RTE_MBUF_METADATA_UINT8_PTR(mbuf, offset))
-#define RTE_MBUF_METADATA_UINT16(mbuf, offset) \
- (*RTE_MBUF_METADATA_UINT16_PTR(mbuf, offset))
-#define RTE_MBUF_METADATA_UINT32(mbuf, offset) \
- (*RTE_MBUF_METADATA_UINT32_PTR(mbuf, offset))
-#define RTE_MBUF_METADATA_UINT64(mbuf, offset) \
- (*RTE_MBUF_METADATA_UINT64_PTR(mbuf, offset))
-/**@}*/
-
-/*
- * Port IN
- */
-/** Maximum number of packets read from any input port in a single burst.
-Cannot be changed. */
-#define RTE_PORT_IN_BURST_SIZE_MAX 64
-
-/** Input port statistics */
-struct rte_port_in_stats {
- uint64_t n_pkts_in;
- uint64_t n_pkts_drop;
-};
-
-/**
- * Input port create
- *
- * @param params
- * Parameters for input port creation
- * @param socket_id
- * CPU socket ID (e.g. for memory allocation purpose)
- * @return
- * Handle to input port instance
- */
-typedef void* (*rte_port_in_op_create)(void *params, int socket_id);
-
-/**
- * Input port free
- *
- * @param port
- * Handle to input port instance
- * @return
- * 0 on success, error code otherwise
- */
-typedef int (*rte_port_in_op_free)(void *port);
-
-/**
- * Input port packet burst RX
- *
- * @param port
- * Handle to input port instance
- * @param pkts
- * Burst of input packets
- * @param n_pkts
- * Number of packets in the input burst
- * @return
- * 0 on success, error code otherwise
- */
-typedef int (*rte_port_in_op_rx)(
- void *port,
- struct rte_mbuf **pkts,
- uint32_t n_pkts);
-
-/**
- * Input port stats get
- *
- * @param port
- * Handle to output port instance
- * @param stats
- * Handle to port_in stats struct to copy data
- * @param clear
- * Flag indicating that stats should be cleared after read
- *
- * @return
- * Error code or 0 on success.
- */
-typedef int (*rte_port_in_op_stats_read)(
- void *port,
- struct rte_port_in_stats *stats,
- int clear);
-
-/** Input port interface defining the input port operation */
-struct rte_port_in_ops {
- rte_port_in_op_create f_create; /**< Create */
- rte_port_in_op_free f_free; /**< Free */
- rte_port_in_op_rx f_rx; /**< Packet RX (packet burst) */
- rte_port_in_op_stats_read f_stats; /**< Stats */
-};
-
-/*
- * Port OUT
- */
-/** Output port statistics */
-struct rte_port_out_stats {
- uint64_t n_pkts_in;
- uint64_t n_pkts_drop;
-};
-
-/**
- * Output port create
- *
- * @param params
- * Parameters for output port creation
- * @param socket_id
- * CPU socket ID (e.g. for memory allocation purpose)
- * @return
- * Handle to output port instance
- */
-typedef void* (*rte_port_out_op_create)(void *params, int socket_id);
-
-/**
- * Output port free
- *
- * @param port
- * Handle to output port instance
- * @return
- * 0 on success, error code otherwise
- */
-typedef int (*rte_port_out_op_free)(void *port);
-
-/**
- * Output port single packet TX
- *
- * @param port
- * Handle to output port instance
- * @param pkt
- * Input packet
- * @return
- * 0 on success, error code otherwise
- */
-typedef int (*rte_port_out_op_tx)(
- void *port,
- struct rte_mbuf *pkt);
-
-/**
- * Output port packet burst TX
- *
- * @param port
- * Handle to output port instance
- * @param pkts
- * Burst of input packets specified as array of up to 64 pointers to struct
- * rte_mbuf
- * @param pkts_mask
- * 64-bit bitmask specifying which packets in the input burst are valid. When
- * pkts_mask bit n is set, then element n of pkts array is pointing to a
- * valid packet. Otherwise, element n of pkts array will not be accessed.
- * @return
- * 0 on success, error code otherwise
- */
-typedef int (*rte_port_out_op_tx_bulk)(
- void *port,
- struct rte_mbuf **pkts,
- uint64_t pkts_mask);
-
-/**
- * Output port flush
- *
- * @param port
- * Handle to output port instance
- * @return
- * 0 on success, error code otherwise
- */
-typedef int (*rte_port_out_op_flush)(void *port);
-
-/**
- * Output port stats read
- *
- * @param port
- * Handle to output port instance
- * @param stats
- * Handle to port_out stats struct to copy data
- * @param clear
- * Flag indicating that stats should be cleared after read
- *
- * @return
- * Error code or 0 on success.
- */
-typedef int (*rte_port_out_op_stats_read)(
- void *port,
- struct rte_port_out_stats *stats,
- int clear);
-
-/** Output port interface defining the output port operation */
-struct rte_port_out_ops {
- rte_port_out_op_create f_create; /**< Create */
- rte_port_out_op_free f_free; /**< Free */
- rte_port_out_op_tx f_tx; /**< Packet TX (single packet) */
- rte_port_out_op_tx_bulk f_tx_bulk; /**< Packet TX (packet burst) */
- rte_port_out_op_flush f_flush; /**< Flush */
- rte_port_out_op_stats_read f_stats; /**< Stats */
-};
-
-#endif
diff --git a/lib/port/rte_port_ethdev.c b/lib/port/rte_port_ethdev.c
deleted file mode 100644
index bdab2fbf6c..0000000000
--- a/lib/port/rte_port_ethdev.c
+++ /dev/null
@@ -1,530 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
- */
-#include <string.h>
-#include <stdint.h>
-
-#include <eal_export.h>
-#include <rte_mbuf.h>
-#include <rte_ethdev.h>
-#include <rte_malloc.h>
-
-#include "rte_port_ethdev.h"
-
-#include "port_log.h"
-
-/*
- * Port ETHDEV Reader
- */
-#ifdef RTE_PORT_STATS_COLLECT
-
-#define RTE_PORT_ETHDEV_READER_STATS_PKTS_IN_ADD(port, val) \
- port->stats.n_pkts_in += val
-#define RTE_PORT_ETHDEV_READER_STATS_PKTS_DROP_ADD(port, val) \
- port->stats.n_pkts_drop += val
-
-#else
-
-#define RTE_PORT_ETHDEV_READER_STATS_PKTS_IN_ADD(port, val)
-#define RTE_PORT_ETHDEV_READER_STATS_PKTS_DROP_ADD(port, val)
-
-#endif
-
-struct rte_port_ethdev_reader {
- struct rte_port_in_stats stats;
-
- uint16_t queue_id;
- uint16_t port_id;
-};
-
-static void *
-rte_port_ethdev_reader_create(void *params, int socket_id)
-{
- struct rte_port_ethdev_reader_params *conf =
- params;
- struct rte_port_ethdev_reader *port;
-
- /* Check input parameters */
- if (conf == NULL) {
- PORT_LOG(ERR, "%s: params is NULL", __func__);
- return NULL;
- }
-
- /* Memory allocation */
- port = rte_zmalloc_socket("PORT", sizeof(*port),
- RTE_CACHE_LINE_SIZE, socket_id);
- if (port == NULL) {
- PORT_LOG(ERR, "%s: Failed to allocate port", __func__);
- return NULL;
- }
-
- /* Initialization */
- port->port_id = conf->port_id;
- port->queue_id = conf->queue_id;
-
- return port;
-}
-
-static int
-rte_port_ethdev_reader_rx(void *port, struct rte_mbuf **pkts, uint32_t n_pkts)
-{
- struct rte_port_ethdev_reader *p =
- port;
- uint16_t rx_pkt_cnt;
-
- rx_pkt_cnt = rte_eth_rx_burst(p->port_id, p->queue_id, pkts, n_pkts);
- RTE_PORT_ETHDEV_READER_STATS_PKTS_IN_ADD(p, rx_pkt_cnt);
- return rx_pkt_cnt;
-}
-
-static int
-rte_port_ethdev_reader_free(void *port)
-{
- if (port == NULL) {
- PORT_LOG(ERR, "%s: port is NULL", __func__);
- return -EINVAL;
- }
-
- rte_free(port);
-
- return 0;
-}
-
-static int rte_port_ethdev_reader_stats_read(void *port,
- struct rte_port_in_stats *stats, int clear)
-{
- struct rte_port_ethdev_reader *p =
- port;
-
- if (stats != NULL)
- memcpy(stats, &p->stats, sizeof(p->stats));
-
- if (clear)
- memset(&p->stats, 0, sizeof(p->stats));
-
- return 0;
-}
-
-/*
- * Port ETHDEV Writer
- */
-#ifdef RTE_PORT_STATS_COLLECT
-
-#define RTE_PORT_ETHDEV_WRITER_STATS_PKTS_IN_ADD(port, val) \
- port->stats.n_pkts_in += val
-#define RTE_PORT_ETHDEV_WRITER_STATS_PKTS_DROP_ADD(port, val) \
- port->stats.n_pkts_drop += val
-
-#else
-
-#define RTE_PORT_ETHDEV_WRITER_STATS_PKTS_IN_ADD(port, val)
-#define RTE_PORT_ETHDEV_WRITER_STATS_PKTS_DROP_ADD(port, val)
-
-#endif
-
-struct rte_port_ethdev_writer {
- struct rte_port_out_stats stats;
-
- struct rte_mbuf *tx_buf[2 * RTE_PORT_IN_BURST_SIZE_MAX];
- uint32_t tx_burst_sz;
- uint16_t tx_buf_count;
- uint64_t bsz_mask;
- uint16_t queue_id;
- uint16_t port_id;
-};
-
-static void *
-rte_port_ethdev_writer_create(void *params, int socket_id)
-{
- struct rte_port_ethdev_writer_params *conf =
- params;
- struct rte_port_ethdev_writer *port;
-
- /* Check input parameters */
- if ((conf == NULL) ||
- (conf->tx_burst_sz == 0) ||
- (conf->tx_burst_sz > RTE_PORT_IN_BURST_SIZE_MAX) ||
- (!rte_is_power_of_2(conf->tx_burst_sz))) {
- PORT_LOG(ERR, "%s: Invalid input parameters", __func__);
- return NULL;
- }
-
- /* Memory allocation */
- port = rte_zmalloc_socket("PORT", sizeof(*port),
- RTE_CACHE_LINE_SIZE, socket_id);
- if (port == NULL) {
- PORT_LOG(ERR, "%s: Failed to allocate port", __func__);
- return NULL;
- }
-
- /* Initialization */
- port->port_id = conf->port_id;
- port->queue_id = conf->queue_id;
- port->tx_burst_sz = conf->tx_burst_sz;
- port->tx_buf_count = 0;
- port->bsz_mask = 1LLU << (conf->tx_burst_sz - 1);
-
- return port;
-}
-
-static inline void
-send_burst(struct rte_port_ethdev_writer *p)
-{
- uint32_t nb_tx;
-
- nb_tx = rte_eth_tx_burst(p->port_id, p->queue_id,
- p->tx_buf, p->tx_buf_count);
-
- RTE_PORT_ETHDEV_WRITER_STATS_PKTS_DROP_ADD(p, p->tx_buf_count - nb_tx);
- for ( ; nb_tx < p->tx_buf_count; nb_tx++)
- rte_pktmbuf_free(p->tx_buf[nb_tx]);
-
- p->tx_buf_count = 0;
-}
-
-static int
-rte_port_ethdev_writer_tx(void *port, struct rte_mbuf *pkt)
-{
- struct rte_port_ethdev_writer *p =
- port;
-
- p->tx_buf[p->tx_buf_count++] = pkt;
- RTE_PORT_ETHDEV_WRITER_STATS_PKTS_IN_ADD(p, 1);
- if (p->tx_buf_count >= p->tx_burst_sz)
- send_burst(p);
-
- return 0;
-}
-
-static int
-rte_port_ethdev_writer_tx_bulk(void *port,
- struct rte_mbuf **pkts,
- uint64_t pkts_mask)
-{
- struct rte_port_ethdev_writer *p =
- port;
- uint64_t bsz_mask = p->bsz_mask;
- uint32_t tx_buf_count = p->tx_buf_count;
- uint64_t expr = (pkts_mask & (pkts_mask + 1)) |
- ((pkts_mask & bsz_mask) ^ bsz_mask);
-
- if (expr == 0) {
- uint64_t n_pkts = rte_popcount64(pkts_mask);
- uint32_t n_pkts_ok;
-
- if (tx_buf_count)
- send_burst(p);
-
- RTE_PORT_ETHDEV_WRITER_STATS_PKTS_IN_ADD(p, n_pkts);
- n_pkts_ok = rte_eth_tx_burst(p->port_id, p->queue_id, pkts,
- n_pkts);
-
- RTE_PORT_ETHDEV_WRITER_STATS_PKTS_DROP_ADD(p, n_pkts - n_pkts_ok);
- for ( ; n_pkts_ok < n_pkts; n_pkts_ok++) {
- struct rte_mbuf *pkt = pkts[n_pkts_ok];
-
- rte_pktmbuf_free(pkt);
- }
- } else {
- for ( ; pkts_mask; ) {
- uint32_t pkt_index = rte_ctz64(pkts_mask);
- uint64_t pkt_mask = 1LLU << pkt_index;
- struct rte_mbuf *pkt = pkts[pkt_index];
-
- p->tx_buf[tx_buf_count++] = pkt;
- RTE_PORT_ETHDEV_WRITER_STATS_PKTS_IN_ADD(p, 1);
- pkts_mask &= ~pkt_mask;
- }
-
- p->tx_buf_count = tx_buf_count;
- if (tx_buf_count >= p->tx_burst_sz)
- send_burst(p);
- }
-
- return 0;
-}
-
-static int
-rte_port_ethdev_writer_flush(void *port)
-{
- struct rte_port_ethdev_writer *p =
- port;
-
- if (p->tx_buf_count > 0)
- send_burst(p);
-
- return 0;
-}
-
-static int
-rte_port_ethdev_writer_free(void *port)
-{
- if (port == NULL) {
- PORT_LOG(ERR, "%s: Port is NULL", __func__);
- return -EINVAL;
- }
-
- rte_port_ethdev_writer_flush(port);
- rte_free(port);
-
- return 0;
-}
-
-static int rte_port_ethdev_writer_stats_read(void *port,
- struct rte_port_out_stats *stats, int clear)
-{
- struct rte_port_ethdev_writer *p =
- port;
-
- if (stats != NULL)
- memcpy(stats, &p->stats, sizeof(p->stats));
-
- if (clear)
- memset(&p->stats, 0, sizeof(p->stats));
-
- return 0;
-}
-
-/*
- * Port ETHDEV Writer Nodrop
- */
-#ifdef RTE_PORT_STATS_COLLECT
-
-#define RTE_PORT_ETHDEV_WRITER_NODROP_STATS_PKTS_IN_ADD(port, val) \
- port->stats.n_pkts_in += val
-#define RTE_PORT_ETHDEV_WRITER_NODROP_STATS_PKTS_DROP_ADD(port, val) \
- port->stats.n_pkts_drop += val
-
-#else
-
-#define RTE_PORT_ETHDEV_WRITER_NODROP_STATS_PKTS_IN_ADD(port, val)
-#define RTE_PORT_ETHDEV_WRITER_NODROP_STATS_PKTS_DROP_ADD(port, val)
-
-#endif
-
-struct rte_port_ethdev_writer_nodrop {
- struct rte_port_out_stats stats;
-
- struct rte_mbuf *tx_buf[2 * RTE_PORT_IN_BURST_SIZE_MAX];
- uint32_t tx_burst_sz;
- uint16_t tx_buf_count;
- uint64_t bsz_mask;
- uint64_t n_retries;
- uint16_t queue_id;
- uint16_t port_id;
-};
-
-static void *
-rte_port_ethdev_writer_nodrop_create(void *params, int socket_id)
-{
- struct rte_port_ethdev_writer_nodrop_params *conf =
- params;
- struct rte_port_ethdev_writer_nodrop *port;
-
- /* Check input parameters */
- if ((conf == NULL) ||
- (conf->tx_burst_sz == 0) ||
- (conf->tx_burst_sz > RTE_PORT_IN_BURST_SIZE_MAX) ||
- (!rte_is_power_of_2(conf->tx_burst_sz))) {
- PORT_LOG(ERR, "%s: Invalid input parameters", __func__);
- return NULL;
- }
-
- /* Memory allocation */
- port = rte_zmalloc_socket("PORT", sizeof(*port),
- RTE_CACHE_LINE_SIZE, socket_id);
- if (port == NULL) {
- PORT_LOG(ERR, "%s: Failed to allocate port", __func__);
- return NULL;
- }
-
- /* Initialization */
- port->port_id = conf->port_id;
- port->queue_id = conf->queue_id;
- port->tx_burst_sz = conf->tx_burst_sz;
- port->tx_buf_count = 0;
- port->bsz_mask = 1LLU << (conf->tx_burst_sz - 1);
-
- /*
- * When n_retries is 0 it means that we should wait for every packet to
- * send no matter how many retries should it take. To limit number of
- * branches in fast path, we use UINT64_MAX instead of branching.
- */
- port->n_retries = (conf->n_retries == 0) ? UINT64_MAX : conf->n_retries;
-
- return port;
-}
-
-static inline void
-send_burst_nodrop(struct rte_port_ethdev_writer_nodrop *p)
-{
- uint32_t nb_tx = 0, i;
-
- nb_tx = rte_eth_tx_burst(p->port_id, p->queue_id, p->tx_buf,
- p->tx_buf_count);
-
- /* We sent all the packets in a first try */
- if (nb_tx >= p->tx_buf_count) {
- p->tx_buf_count = 0;
- return;
- }
-
- for (i = 0; i < p->n_retries; i++) {
- nb_tx += rte_eth_tx_burst(p->port_id, p->queue_id,
- p->tx_buf + nb_tx, p->tx_buf_count - nb_tx);
-
- /* We sent all the packets in more than one try */
- if (nb_tx >= p->tx_buf_count) {
- p->tx_buf_count = 0;
- return;
- }
- }
-
- /* We didn't send the packets in maximum allowed attempts */
- RTE_PORT_ETHDEV_WRITER_NODROP_STATS_PKTS_DROP_ADD(p, p->tx_buf_count - nb_tx);
- for ( ; nb_tx < p->tx_buf_count; nb_tx++)
- rte_pktmbuf_free(p->tx_buf[nb_tx]);
-
- p->tx_buf_count = 0;
-}
-
-static int
-rte_port_ethdev_writer_nodrop_tx(void *port, struct rte_mbuf *pkt)
-{
- struct rte_port_ethdev_writer_nodrop *p =
- port;
-
- p->tx_buf[p->tx_buf_count++] = pkt;
- RTE_PORT_ETHDEV_WRITER_NODROP_STATS_PKTS_IN_ADD(p, 1);
- if (p->tx_buf_count >= p->tx_burst_sz)
- send_burst_nodrop(p);
-
- return 0;
-}
-
-static int
-rte_port_ethdev_writer_nodrop_tx_bulk(void *port,
- struct rte_mbuf **pkts,
- uint64_t pkts_mask)
-{
- struct rte_port_ethdev_writer_nodrop *p =
- port;
-
- uint64_t bsz_mask = p->bsz_mask;
- uint32_t tx_buf_count = p->tx_buf_count;
- uint64_t expr = (pkts_mask & (pkts_mask + 1)) |
- ((pkts_mask & bsz_mask) ^ bsz_mask);
-
- if (expr == 0) {
- uint64_t n_pkts = rte_popcount64(pkts_mask);
- uint32_t n_pkts_ok;
-
- if (tx_buf_count)
- send_burst_nodrop(p);
-
- RTE_PORT_ETHDEV_WRITER_NODROP_STATS_PKTS_IN_ADD(p, n_pkts);
- n_pkts_ok = rte_eth_tx_burst(p->port_id, p->queue_id, pkts,
- n_pkts);
-
- if (n_pkts_ok >= n_pkts)
- return 0;
-
- /*
- * If we did not manage to send all packets in single burst,
- * move remaining packets to the buffer and call send burst.
- */
- for (; n_pkts_ok < n_pkts; n_pkts_ok++) {
- struct rte_mbuf *pkt = pkts[n_pkts_ok];
- p->tx_buf[p->tx_buf_count++] = pkt;
- }
- send_burst_nodrop(p);
- } else {
- for ( ; pkts_mask; ) {
- uint32_t pkt_index = rte_ctz64(pkts_mask);
- uint64_t pkt_mask = 1LLU << pkt_index;
- struct rte_mbuf *pkt = pkts[pkt_index];
-
- p->tx_buf[tx_buf_count++] = pkt;
- RTE_PORT_ETHDEV_WRITER_NODROP_STATS_PKTS_IN_ADD(p, 1);
- pkts_mask &= ~pkt_mask;
- }
-
- p->tx_buf_count = tx_buf_count;
- if (tx_buf_count >= p->tx_burst_sz)
- send_burst_nodrop(p);
- }
-
- return 0;
-}
-
-static int
-rte_port_ethdev_writer_nodrop_flush(void *port)
-{
- struct rte_port_ethdev_writer_nodrop *p =
- port;
-
- if (p->tx_buf_count > 0)
- send_burst_nodrop(p);
-
- return 0;
-}
-
-static int
-rte_port_ethdev_writer_nodrop_free(void *port)
-{
- if (port == NULL) {
- PORT_LOG(ERR, "%s: Port is NULL", __func__);
- return -EINVAL;
- }
-
- rte_port_ethdev_writer_nodrop_flush(port);
- rte_free(port);
-
- return 0;
-}
-
-static int rte_port_ethdev_writer_nodrop_stats_read(void *port,
- struct rte_port_out_stats *stats, int clear)
-{
- struct rte_port_ethdev_writer_nodrop *p =
- port;
-
- if (stats != NULL)
- memcpy(stats, &p->stats, sizeof(p->stats));
-
- if (clear)
- memset(&p->stats, 0, sizeof(p->stats));
-
- return 0;
-}
-
-/*
- * Summary of port operations
- */
-RTE_EXPORT_SYMBOL(rte_port_ethdev_reader_ops)
-struct rte_port_in_ops rte_port_ethdev_reader_ops = {
- .f_create = rte_port_ethdev_reader_create,
- .f_free = rte_port_ethdev_reader_free,
- .f_rx = rte_port_ethdev_reader_rx,
- .f_stats = rte_port_ethdev_reader_stats_read,
-};
-
-RTE_EXPORT_SYMBOL(rte_port_ethdev_writer_ops)
-struct rte_port_out_ops rte_port_ethdev_writer_ops = {
- .f_create = rte_port_ethdev_writer_create,
- .f_free = rte_port_ethdev_writer_free,
- .f_tx = rte_port_ethdev_writer_tx,
- .f_tx_bulk = rte_port_ethdev_writer_tx_bulk,
- .f_flush = rte_port_ethdev_writer_flush,
- .f_stats = rte_port_ethdev_writer_stats_read,
-};
-
-RTE_EXPORT_SYMBOL(rte_port_ethdev_writer_nodrop_ops)
-struct rte_port_out_ops rte_port_ethdev_writer_nodrop_ops = {
- .f_create = rte_port_ethdev_writer_nodrop_create,
- .f_free = rte_port_ethdev_writer_nodrop_free,
- .f_tx = rte_port_ethdev_writer_nodrop_tx,
- .f_tx_bulk = rte_port_ethdev_writer_nodrop_tx_bulk,
- .f_flush = rte_port_ethdev_writer_nodrop_flush,
- .f_stats = rte_port_ethdev_writer_nodrop_stats_read,
-};
diff --git a/lib/port/rte_port_ethdev.h b/lib/port/rte_port_ethdev.h
deleted file mode 100644
index 7729ff0da3..0000000000
--- a/lib/port/rte_port_ethdev.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
- */
-
-#ifndef __INCLUDE_RTE_PORT_ETHDEV_H__
-#define __INCLUDE_RTE_PORT_ETHDEV_H__
-
-/**
- * @file
- * RTE Port Ethernet Device
- *
- * ethdev_reader: input port built on top of pre-initialized NIC RX queue
- * ethdev_writer: output port built on top of pre-initialized NIC TX queue
- */
-
-#include <stdint.h>
-
-#include "rte_port.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** ethdev_reader port parameters */
-struct rte_port_ethdev_reader_params {
- /** NIC RX port ID */
- uint16_t port_id;
-
- /** NIC RX queue ID */
- uint16_t queue_id;
-};
-
-/** ethdev_reader port operations */
-extern struct rte_port_in_ops rte_port_ethdev_reader_ops;
-
-/** ethdev_writer port parameters */
-struct rte_port_ethdev_writer_params {
- /** NIC RX port ID */
- uint16_t port_id;
-
- /** NIC RX queue ID */
- uint16_t queue_id;
-
- /** Recommended burst size to NIC TX queue. The actual burst size can be
- bigger or smaller than this value. */
- uint32_t tx_burst_sz;
-};
-
-/** ethdev_writer port operations */
-extern struct rte_port_out_ops rte_port_ethdev_writer_ops;
-
-/** ethdev_writer_nodrop port parameters */
-struct rte_port_ethdev_writer_nodrop_params {
- /** NIC RX port ID */
- uint16_t port_id;
-
- /** NIC RX queue ID */
- uint16_t queue_id;
-
- /** Recommended burst size to NIC TX queue. The actual burst size can be
- bigger or smaller than this value. */
- uint32_t tx_burst_sz;
-
- /** Maximum number of retries, 0 for no limit */
- uint32_t n_retries;
-};
-
-/** ethdev_writer_nodrop port operations */
-extern struct rte_port_out_ops rte_port_ethdev_writer_nodrop_ops;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/port/rte_port_eventdev.c b/lib/port/rte_port_eventdev.c
deleted file mode 100644
index c3a287b834..0000000000
--- a/lib/port/rte_port_eventdev.c
+++ /dev/null
@@ -1,590 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2019 Intel Corporation
- */
-
-#include <string.h>
-#include <stdint.h>
-
-#include <eal_export.h>
-#include <rte_mbuf.h>
-#include <rte_malloc.h>
-
-#include "rte_port_eventdev.h"
-
-#include "port_log.h"
-
-/*
- * Port EVENTDEV Reader
- */
-#ifdef RTE_PORT_STATS_COLLECT
-
-#define RTE_PORT_EVENTDEV_READER_STATS_PKTS_IN_ADD(port, val) \
- do {port->stats.n_pkts_in += val;} while (0)
-#define RTE_PORT_EVENTDEV_READER_STATS_PKTS_DROP_ADD(port, val) \
- do {port->stats.n_pkts_drop += val;} while (0)
-
-#else
-
-#define RTE_PORT_EVENTDEV_READER_STATS_PKTS_IN_ADD(port, val)
-#define RTE_PORT_EVENTDEV_READER_STATS_PKTS_DROP_ADD(port, val)
-
-#endif
-
-struct rte_port_eventdev_reader {
- struct rte_port_in_stats stats;
-
- uint8_t eventdev_id;
- uint16_t port_id;
-
- struct rte_event ev[RTE_PORT_IN_BURST_SIZE_MAX];
-};
-
-static void *
-rte_port_eventdev_reader_create(void *params, int socket_id)
-{
- struct rte_port_eventdev_reader_params *conf =
- params;
- struct rte_port_eventdev_reader *port;
-
- /* Check input parameters */
- if (conf == NULL) {
- PORT_LOG(ERR, "%s: params is NULL", __func__);
- return NULL;
- }
-
- /* Memory allocation */
- port = rte_zmalloc_socket("PORT", sizeof(*port),
- RTE_CACHE_LINE_SIZE, socket_id);
- if (port == NULL) {
- PORT_LOG(ERR, "%s: Failed to allocate port", __func__);
- return NULL;
- }
-
- /* Initialization */
- port->eventdev_id = conf->eventdev_id;
- port->port_id = conf->port_id;
-
- return port;
-}
-
-static int
-rte_port_eventdev_reader_rx(void *port, struct rte_mbuf **pkts, uint32_t n_pkts)
-{
- struct rte_port_eventdev_reader *p = port;
- uint16_t rx_evts_cnt, i;
-
- rx_evts_cnt = rte_event_dequeue_burst(p->eventdev_id, p->port_id,
- p->ev, n_pkts, 0);
-
- for (i = 0; i < rx_evts_cnt; i++)
- pkts[i] = p->ev[i].mbuf;
-
- RTE_PORT_EVENTDEV_READER_STATS_PKTS_IN_ADD(p, rx_evts_cnt);
-
- return rx_evts_cnt;
-}
-
-static int
-rte_port_eventdev_reader_free(void *port)
-{
- if (port == NULL) {
- PORT_LOG(ERR, "%s: port is NULL", __func__);
- return -EINVAL;
- }
-
- rte_free(port);
-
- return 0;
-}
-
-static int rte_port_eventdev_reader_stats_read(void *port,
- struct rte_port_in_stats *stats, int clear)
-{
- struct rte_port_eventdev_reader *p =
- port;
-
- if (stats != NULL)
- memcpy(stats, &p->stats, sizeof(p->stats));
-
- if (clear)
- memset(&p->stats, 0, sizeof(p->stats));
-
- return 0;
-}
-
-/*
- * Port EVENTDEV Writer
- */
-#ifdef RTE_PORT_STATS_COLLECT
-
-#define RTE_PORT_EVENTDEV_WRITER_STATS_PKTS_IN_ADD(port, val) \
- do {port->stats.n_pkts_in += val;} while (0)
-#define RTE_PORT_EVENTDEV_WRITER_STATS_PKTS_DROP_ADD(port, val) \
- do {port->stats.n_pkts_drop += val;} while (0)
-
-#else
-
-#define RTE_PORT_EVENTDEV_WRITER_STATS_PKTS_IN_ADD(port, val)
-#define RTE_PORT_EVENTDEV_WRITER_STATS_PKTS_DROP_ADD(port, val)
-
-#endif
-
-struct rte_port_eventdev_writer {
- struct rte_port_out_stats stats;
-
- struct rte_event ev[2 * RTE_PORT_IN_BURST_SIZE_MAX];
-
- uint32_t enq_burst_sz;
- uint32_t enq_buf_count;
- uint64_t bsz_mask;
-
- uint8_t eventdev_id;
- uint8_t port_id;
- uint8_t queue_id;
- uint8_t sched_type;
- uint8_t evt_op;
-};
-
-static void *
-rte_port_eventdev_writer_create(void *params, int socket_id)
-{
- struct rte_port_eventdev_writer_params *conf =
- params;
- struct rte_port_eventdev_writer *port;
- unsigned int i;
-
- /* Check input parameters */
- if ((conf == NULL) ||
- (conf->enq_burst_sz == 0) ||
- (conf->enq_burst_sz > RTE_PORT_IN_BURST_SIZE_MAX) ||
- (!rte_is_power_of_2(conf->enq_burst_sz))) {
- PORT_LOG(ERR, "%s: Invalid input parameters", __func__);
- return NULL;
- }
-
- /* Memory allocation */
- port = rte_zmalloc_socket("PORT", sizeof(*port),
- RTE_CACHE_LINE_SIZE, socket_id);
- if (port == NULL) {
- PORT_LOG(ERR, "%s: Failed to allocate port", __func__);
- return NULL;
- }
-
- /* Initialization */
- port->enq_burst_sz = conf->enq_burst_sz;
- port->enq_buf_count = 0;
- port->bsz_mask = 1LLU << (conf->enq_burst_sz - 1);
-
- port->eventdev_id = conf->eventdev_id;
- port->port_id = conf->port_id;
- port->queue_id = conf->queue_id;
- port->sched_type = conf->sched_type;
- port->evt_op = conf->evt_op;
- memset(&port->ev, 0, sizeof(port->ev));
-
- for (i = 0; i < RTE_DIM(port->ev); i++) {
- port->ev[i].queue_id = port->queue_id;
- port->ev[i].sched_type = port->sched_type;
- port->ev[i].op = port->evt_op;
- }
-
- return port;
-}
-
-static inline void
-send_burst(struct rte_port_eventdev_writer *p)
-{
- uint32_t nb_enq;
-
- nb_enq = rte_event_enqueue_burst(p->eventdev_id, p->port_id,
- p->ev, p->enq_buf_count);
-
- RTE_PORT_EVENTDEV_WRITER_STATS_PKTS_DROP_ADD(p, p->enq_buf_count -
- nb_enq);
-
- for (; nb_enq < p->enq_buf_count; nb_enq++)
- rte_pktmbuf_free(p->ev[nb_enq].mbuf);
-
- p->enq_buf_count = 0;
-}
-
-static int
-rte_port_eventdev_writer_tx(void *port, struct rte_mbuf *pkt)
-{
- struct rte_port_eventdev_writer *p = port;
-
- p->ev[p->enq_buf_count++].mbuf = pkt;
- RTE_PORT_EVENTDEV_WRITER_STATS_PKTS_IN_ADD(p, 1);
- if (p->enq_buf_count >= p->enq_burst_sz)
- send_burst(p);
-
- return 0;
-}
-
-static int
-rte_port_eventdev_writer_tx_bulk(void *port,
- struct rte_mbuf **pkts,
- uint64_t pkts_mask)
-{
- struct rte_port_eventdev_writer *p =
- port;
- uint64_t bsz_mask = p->bsz_mask;
- uint32_t enq_buf_count = p->enq_buf_count;
- uint64_t expr = (pkts_mask & (pkts_mask + 1)) |
- ((pkts_mask & bsz_mask) ^ bsz_mask);
-
- if (expr == 0) {
- uint64_t n_pkts = rte_popcount64(pkts_mask);
- uint32_t i, n_enq_ok;
-
- if (enq_buf_count)
- send_burst(p);
-
- RTE_PORT_EVENTDEV_WRITER_STATS_PKTS_IN_ADD(p, n_pkts);
-
- struct rte_event events[2 * RTE_PORT_IN_BURST_SIZE_MAX] = {};
- for (i = 0; i < n_pkts; i++) {
- events[i].mbuf = pkts[i];
- events[i].queue_id = p->queue_id;
- events[i].sched_type = p->sched_type;
- events[i].op = p->evt_op;
- }
-
- n_enq_ok = rte_event_enqueue_burst(p->eventdev_id, p->port_id,
- events, n_pkts);
-
- RTE_PORT_EVENTDEV_WRITER_STATS_PKTS_DROP_ADD(p,
- n_pkts - n_enq_ok);
- for (; n_enq_ok < n_pkts; n_enq_ok++)
- rte_pktmbuf_free(pkts[n_enq_ok]);
-
- } else {
- for (; pkts_mask;) {
- uint32_t pkt_index = rte_ctz64(pkts_mask);
- uint64_t pkt_mask = 1LLU << pkt_index;
-
- p->ev[enq_buf_count++].mbuf = pkts[pkt_index];
-
- RTE_PORT_EVENTDEV_WRITER_STATS_PKTS_IN_ADD(p, 1);
- pkts_mask &= ~pkt_mask;
- }
-
- p->enq_buf_count = enq_buf_count;
- if (enq_buf_count >= p->enq_burst_sz)
- send_burst(p);
- }
-
- return 0;
-}
-
-static int
-rte_port_eventdev_writer_flush(void *port)
-{
- struct rte_port_eventdev_writer *p =
- port;
-
- if (p->enq_buf_count > 0)
- send_burst(p);
-
- return 0;
-}
-
-static int
-rte_port_eventdev_writer_free(void *port)
-{
- if (port == NULL) {
- PORT_LOG(ERR, "%s: Port is NULL", __func__);
- return -EINVAL;
- }
-
- rte_port_eventdev_writer_flush(port);
- rte_free(port);
-
- return 0;
-}
-
-static int rte_port_eventdev_writer_stats_read(void *port,
- struct rte_port_out_stats *stats, int clear)
-{
- struct rte_port_eventdev_writer *p =
- port;
-
- if (stats != NULL)
- memcpy(stats, &p->stats, sizeof(p->stats));
-
- if (clear)
- memset(&p->stats, 0, sizeof(p->stats));
-
- return 0;
-}
-
-/*
- * Port EVENTDEV Writer Nodrop
- */
-#ifdef RTE_PORT_STATS_COLLECT
-
-#define RTE_PORT_EVENTDEV_WRITER_NODROP_STATS_PKTS_IN_ADD(port, val) \
- do {port->stats.n_pkts_in += val;} while (0)
-#define RTE_PORT_EVENTDEV_WRITER_NODROP_STATS_PKTS_DROP_ADD(port, val) \
- do {port->stats.n_pkts_drop += val;} while (0)
-
-#else
-
-#define RTE_PORT_EVENTDEV_WRITER_NODROP_STATS_PKTS_IN_ADD(port, val)
-#define RTE_PORT_EVENTDEV_WRITER_NODROP_STATS_PKTS_DROP_ADD(port, val)
-
-#endif
-
-struct rte_port_eventdev_writer_nodrop {
- struct rte_port_out_stats stats;
-
- struct rte_event ev[2 * RTE_PORT_IN_BURST_SIZE_MAX];
-
- uint32_t enq_burst_sz;
- uint32_t enq_buf_count;
- uint64_t bsz_mask;
- uint64_t n_retries;
- uint8_t eventdev_id;
- uint8_t port_id;
- uint8_t queue_id;
- uint8_t sched_type;
- uint8_t evt_op;
-};
-
-
-static void *
-rte_port_eventdev_writer_nodrop_create(void *params, int socket_id)
-{
- struct rte_port_eventdev_writer_nodrop_params *conf =
- params;
- struct rte_port_eventdev_writer_nodrop *port;
- unsigned int i;
-
- /* Check input parameters */
- if ((conf == NULL) ||
- (conf->enq_burst_sz == 0) ||
- (conf->enq_burst_sz > RTE_PORT_IN_BURST_SIZE_MAX) ||
- (!rte_is_power_of_2(conf->enq_burst_sz))) {
- PORT_LOG(ERR, "%s: Invalid input parameters", __func__);
- return NULL;
- }
-
- /* Memory allocation */
- port = rte_zmalloc_socket("PORT", sizeof(*port),
- RTE_CACHE_LINE_SIZE, socket_id);
- if (port == NULL) {
- PORT_LOG(ERR, "%s: Failed to allocate port", __func__);
- return NULL;
- }
-
- /* Initialization */
- port->enq_burst_sz = conf->enq_burst_sz;
- port->enq_buf_count = 0;
- port->bsz_mask = 1LLU << (conf->enq_burst_sz - 1);
-
- port->eventdev_id = conf->eventdev_id;
- port->port_id = conf->port_id;
- port->queue_id = conf->queue_id;
- port->sched_type = conf->sched_type;
- port->evt_op = conf->evt_op;
- memset(&port->ev, 0, sizeof(port->ev));
-
- for (i = 0; i < RTE_DIM(port->ev); i++) {
- port->ev[i].queue_id = port->queue_id;
- port->ev[i].sched_type = port->sched_type;
- port->ev[i].op = port->evt_op;
- }
- /*
- * When n_retries is 0 it means that we should wait for every event to
- * send no matter how many retries should it take. To limit number of
- * branches in fast path, we use UINT64_MAX instead of branching.
- */
- port->n_retries = (conf->n_retries == 0) ? UINT64_MAX : conf->n_retries;
-
- return port;
-}
-
-static inline void
-send_burst_nodrop(struct rte_port_eventdev_writer_nodrop *p)
-{
- uint32_t nb_enq, i;
-
- nb_enq = rte_event_enqueue_burst(p->eventdev_id, p->port_id,
- p->ev, p->enq_buf_count);
-
- /* We sent all the packets in a first try */
- if (nb_enq >= p->enq_buf_count) {
- p->enq_buf_count = 0;
- return;
- }
-
- for (i = 0; i < p->n_retries; i++) {
- nb_enq += rte_event_enqueue_burst(p->eventdev_id, p->port_id,
- p->ev + nb_enq,
- p->enq_buf_count - nb_enq);
-
- /* We sent all the events in more than one try */
- if (nb_enq >= p->enq_buf_count) {
- p->enq_buf_count = 0;
- return;
- }
- }
- /* We didn't send the events in maximum allowed attempts */
- RTE_PORT_EVENTDEV_WRITER_NODROP_STATS_PKTS_DROP_ADD(p,
- p->enq_buf_count - nb_enq);
- for (; nb_enq < p->enq_buf_count; nb_enq++)
- rte_pktmbuf_free(p->ev[nb_enq].mbuf);
-
- p->enq_buf_count = 0;
-}
-
-static int
-rte_port_eventdev_writer_nodrop_tx(void *port, struct rte_mbuf *pkt)
-{
- struct rte_port_eventdev_writer_nodrop *p = port;
-
- p->ev[p->enq_buf_count++].mbuf = pkt;
-
- RTE_PORT_EVENTDEV_WRITER_NODROP_STATS_PKTS_IN_ADD(p, 1);
- if (p->enq_buf_count >= p->enq_burst_sz)
- send_burst_nodrop(p);
-
- return 0;
-}
-
-static int
-rte_port_eventdev_writer_nodrop_tx_bulk(void *port,
- struct rte_mbuf **pkts,
- uint64_t pkts_mask)
-{
- struct rte_port_eventdev_writer_nodrop *p =
- port;
-
- uint64_t bsz_mask = p->bsz_mask;
- uint32_t enq_buf_count = p->enq_buf_count;
- uint64_t expr = (pkts_mask & (pkts_mask + 1)) |
- ((pkts_mask & bsz_mask) ^ bsz_mask);
-
- if (expr == 0) {
- uint64_t n_pkts = rte_popcount64(pkts_mask);
- uint32_t i, n_enq_ok;
-
- if (enq_buf_count)
- send_burst_nodrop(p);
-
- RTE_PORT_EVENTDEV_WRITER_NODROP_STATS_PKTS_IN_ADD(p, n_pkts);
-
- struct rte_event events[RTE_PORT_IN_BURST_SIZE_MAX] = {};
-
- for (i = 0; i < n_pkts; i++) {
- events[i].mbuf = pkts[i];
- events[i].queue_id = p->queue_id;
- events[i].sched_type = p->sched_type;
- events[i].op = p->evt_op;
- }
-
- n_enq_ok = rte_event_enqueue_burst(p->eventdev_id, p->port_id,
- events, n_pkts);
-
- if (n_enq_ok >= n_pkts)
- return 0;
-
- /*
- * If we did not manage to enqueue all events in single burst,
- * move remaining events to the buffer and call send burst.
- */
- for (; n_enq_ok < n_pkts; n_enq_ok++) {
- struct rte_mbuf *pkt = pkts[n_enq_ok];
- p->ev[p->enq_buf_count++].mbuf = pkt;
- }
- send_burst_nodrop(p);
- } else {
- for (; pkts_mask;) {
- uint32_t pkt_index = rte_ctz64(pkts_mask);
- uint64_t pkt_mask = 1LLU << pkt_index;
-
- p->ev[enq_buf_count++].mbuf = pkts[pkt_index];
-
- RTE_PORT_EVENTDEV_WRITER_STATS_PKTS_IN_ADD(p, 1);
- pkts_mask &= ~pkt_mask;
- }
-
- p->enq_buf_count = enq_buf_count;
- if (enq_buf_count >= p->enq_burst_sz)
- send_burst_nodrop(p);
- }
-
- return 0;
-}
-
-static int
-rte_port_eventdev_writer_nodrop_flush(void *port)
-{
- struct rte_port_eventdev_writer_nodrop *p =
- port;
-
- if (p->enq_buf_count > 0)
- send_burst_nodrop(p);
-
- return 0;
-}
-
-static int
-rte_port_eventdev_writer_nodrop_free(void *port)
-{
- if (port == NULL) {
- PORT_LOG(ERR, "%s: Port is NULL", __func__);
- return -EINVAL;
- }
-
- rte_port_eventdev_writer_nodrop_flush(port);
- rte_free(port);
-
- return 0;
-}
-
-static int rte_port_eventdev_writer_nodrop_stats_read(void *port,
- struct rte_port_out_stats *stats, int clear)
-{
- struct rte_port_eventdev_writer_nodrop *p =
- port;
-
- if (stats != NULL)
- memcpy(stats, &p->stats, sizeof(p->stats));
-
- if (clear)
- memset(&p->stats, 0, sizeof(p->stats));
-
- return 0;
-}
-
-/*
- * Summary of port operations
- */
-RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_port_eventdev_reader_ops, 19.11)
-struct rte_port_in_ops rte_port_eventdev_reader_ops = {
- .f_create = rte_port_eventdev_reader_create,
- .f_free = rte_port_eventdev_reader_free,
- .f_rx = rte_port_eventdev_reader_rx,
- .f_stats = rte_port_eventdev_reader_stats_read,
-};
-
-RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_port_eventdev_writer_ops, 19.11)
-struct rte_port_out_ops rte_port_eventdev_writer_ops = {
- .f_create = rte_port_eventdev_writer_create,
- .f_free = rte_port_eventdev_writer_free,
- .f_tx = rte_port_eventdev_writer_tx,
- .f_tx_bulk = rte_port_eventdev_writer_tx_bulk,
- .f_flush = rte_port_eventdev_writer_flush,
- .f_stats = rte_port_eventdev_writer_stats_read,
-};
-
-RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_port_eventdev_writer_nodrop_ops, 19.11)
-struct rte_port_out_ops rte_port_eventdev_writer_nodrop_ops = {
- .f_create = rte_port_eventdev_writer_nodrop_create,
- .f_free = rte_port_eventdev_writer_nodrop_free,
- .f_tx = rte_port_eventdev_writer_nodrop_tx,
- .f_tx_bulk = rte_port_eventdev_writer_nodrop_tx_bulk,
- .f_flush = rte_port_eventdev_writer_nodrop_flush,
- .f_stats = rte_port_eventdev_writer_nodrop_stats_read,
-};
diff --git a/lib/port/rte_port_eventdev.h b/lib/port/rte_port_eventdev.h
deleted file mode 100644
index d9eccf07d4..0000000000
--- a/lib/port/rte_port_eventdev.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2019 Intel Corporation
- */
-
-#ifndef __INCLUDE_RTE_PORT_EVENTDEV_H__
-#define __INCLUDE_RTE_PORT_EVENTDEV_H__
-
-/**
- * @file
- * RTE Port Eventdev Interface
- *
- * eventdev_reader: input port built on top of pre-initialized eventdev
- * interface
- * eventdev_writer: output port built on top of pre-initialized eventdev
- * interface
- */
-
-#include <stdint.h>
-#include <rte_eventdev.h>
-
-#include "rte_port.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** Eventdev_reader port parameters */
-struct rte_port_eventdev_reader_params {
- /** Eventdev Device ID */
- uint8_t eventdev_id;
-
- /** Eventdev Port ID */
- uint8_t port_id;
-};
-
-/** Eventdev_reader port operations. */
-extern struct rte_port_in_ops rte_port_eventdev_reader_ops;
-
-/** Eventdev_writer port parameters. */
-struct rte_port_eventdev_writer_params {
- /** Eventdev Device ID. */
- uint8_t eventdev_id;
-
- /** Eventdev Port ID. */
- uint8_t port_id;
-
- /** Eventdev Queue ID. */
- uint8_t queue_id;
-
- /** Burst size to eventdev interface. */
- uint32_t enq_burst_sz;
-
- /** Scheduler synchronization type (RTE_SCHED_TYPE_*)*/
- uint8_t sched_type;
-
- /** The type of eventdev enqueue operation - new/forward/release */
- uint8_t evt_op;
-};
-
-/** Eventdev_writer port operations. */
-extern struct rte_port_out_ops rte_port_eventdev_writer_ops;
-
-/** Event_writer_nodrop port parameters. */
-struct rte_port_eventdev_writer_nodrop_params {
- /** Eventdev Device ID. */
- uint8_t eventdev_id;
-
- /** Eventdev Port ID. */
- uint16_t port_id;
-
- /** Eventdev Queue ID. */
- uint16_t queue_id;
-
- /** Burst size to eventdev interface. */
- uint32_t enq_burst_sz;
-
- /** Scheduler synchronization type (RTE_SCHED_TYPE_*)*/
- uint8_t sched_type;
-
- /** The type of eventdev enqueue operation - new/forward/release */
- uint8_t evt_op;
-
- /** Maximum number of retries, 0 for no limit. */
- uint32_t n_retries;
-};
-
-/** Eventdev_writer_nodrop port operations. */
-extern struct rte_port_out_ops rte_port_eventdev_writer_nodrop_ops;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/port/rte_port_fd.c b/lib/port/rte_port_fd.c
deleted file mode 100644
index dbc9efef1b..0000000000
--- a/lib/port/rte_port_fd.c
+++ /dev/null
@@ -1,524 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2016 Intel Corporation
- */
-#include <string.h>
-#include <stdint.h>
-#include <unistd.h>
-
-#include <eal_export.h>
-#include <rte_mbuf.h>
-#include <rte_malloc.h>
-
-#include "rte_port_fd.h"
-
-#include "port_log.h"
-
-/*
- * Port FD Reader
- */
-#ifdef RTE_PORT_STATS_COLLECT
-
-#define RTE_PORT_FD_READER_STATS_PKTS_IN_ADD(port, val) \
- do { port->stats.n_pkts_in += val; } while (0)
-#define RTE_PORT_FD_READER_STATS_PKTS_DROP_ADD(port, val) \
- do { port->stats.n_pkts_drop += val; } while (0)
-
-#else
-
-#define RTE_PORT_FD_READER_STATS_PKTS_IN_ADD(port, val)
-#define RTE_PORT_FD_READER_STATS_PKTS_DROP_ADD(port, val)
-
-#endif
-
-struct rte_port_fd_reader {
- struct rte_port_in_stats stats;
- int fd;
- uint32_t mtu;
- struct rte_mempool *mempool;
-};
-
-static void *
-rte_port_fd_reader_create(void *params, int socket_id)
-{
- struct rte_port_fd_reader_params *conf =
- params;
- struct rte_port_fd_reader *port;
-
- /* Check input parameters */
- if (conf == NULL) {
- PORT_LOG(ERR, "%s: params is NULL", __func__);
- return NULL;
- }
- if (conf->fd < 0) {
- PORT_LOG(ERR, "%s: Invalid file descriptor", __func__);
- return NULL;
- }
- if (conf->mtu == 0) {
- PORT_LOG(ERR, "%s: Invalid MTU", __func__);
- return NULL;
- }
- if (conf->mempool == NULL) {
- PORT_LOG(ERR, "%s: Invalid mempool", __func__);
- return NULL;
- }
-
- /* Memory allocation */
- port = rte_zmalloc_socket("PORT", sizeof(*port),
- RTE_CACHE_LINE_SIZE, socket_id);
- if (port == NULL) {
- PORT_LOG(ERR, "%s: Failed to allocate port", __func__);
- return NULL;
- }
-
- /* Initialization */
- port->fd = conf->fd;
- port->mtu = conf->mtu;
- port->mempool = conf->mempool;
-
- return port;
-}
-
-static int
-rte_port_fd_reader_rx(void *port, struct rte_mbuf **pkts, uint32_t n_pkts)
-{
- struct rte_port_fd_reader *p = port;
- uint32_t i, j;
-
- if (rte_pktmbuf_alloc_bulk(p->mempool, pkts, n_pkts) != 0)
- return 0;
-
- for (i = 0; i < n_pkts; i++) {
- struct rte_mbuf *pkt = pkts[i];
- void *pkt_data = rte_pktmbuf_mtod(pkt, void *);
- ssize_t n_bytes;
-
- n_bytes = read(p->fd, pkt_data, (size_t) p->mtu);
- if (n_bytes <= 0)
- break;
-
- pkt->data_len = n_bytes;
- pkt->pkt_len = n_bytes;
- }
-
- for (j = i; j < n_pkts; j++)
- rte_pktmbuf_free(pkts[j]);
-
- RTE_PORT_FD_READER_STATS_PKTS_IN_ADD(p, i);
-
- return i;
-}
-
-static int
-rte_port_fd_reader_free(void *port)
-{
- if (port == NULL) {
- PORT_LOG(ERR, "%s: port is NULL", __func__);
- return -EINVAL;
- }
-
- rte_free(port);
-
- return 0;
-}
-
-static int rte_port_fd_reader_stats_read(void *port,
- struct rte_port_in_stats *stats, int clear)
-{
- struct rte_port_fd_reader *p =
- port;
-
- if (stats != NULL)
- memcpy(stats, &p->stats, sizeof(p->stats));
-
- if (clear)
- memset(&p->stats, 0, sizeof(p->stats));
-
- return 0;
-}
-
-/*
- * Port FD Writer
- */
-#ifdef RTE_PORT_STATS_COLLECT
-
-#define RTE_PORT_FD_WRITER_STATS_PKTS_IN_ADD(port, val) \
- do { port->stats.n_pkts_in += val; } while (0)
-#define RTE_PORT_FD_WRITER_STATS_PKTS_DROP_ADD(port, val) \
- do { port->stats.n_pkts_drop += val; } while (0)
-
-#else
-
-#define RTE_PORT_FD_WRITER_STATS_PKTS_IN_ADD(port, val)
-#define RTE_PORT_FD_WRITER_STATS_PKTS_DROP_ADD(port, val)
-
-#endif
-
-struct rte_port_fd_writer {
- struct rte_port_out_stats stats;
-
- struct rte_mbuf *tx_buf[2 * RTE_PORT_IN_BURST_SIZE_MAX];
- uint32_t tx_burst_sz;
- uint16_t tx_buf_count;
- uint32_t fd;
-};
-
-static void *
-rte_port_fd_writer_create(void *params, int socket_id)
-{
- struct rte_port_fd_writer_params *conf =
- params;
- struct rte_port_fd_writer *port;
-
- /* Check input parameters */
- if ((conf == NULL) ||
- (conf->tx_burst_sz == 0) ||
- (conf->tx_burst_sz > RTE_PORT_IN_BURST_SIZE_MAX) ||
- (!rte_is_power_of_2(conf->tx_burst_sz))) {
- PORT_LOG(ERR, "%s: Invalid input parameters", __func__);
- return NULL;
- }
-
- /* Memory allocation */
- port = rte_zmalloc_socket("PORT", sizeof(*port),
- RTE_CACHE_LINE_SIZE, socket_id);
- if (port == NULL) {
- PORT_LOG(ERR, "%s: Failed to allocate port", __func__);
- return NULL;
- }
-
- /* Initialization */
- port->fd = conf->fd;
- port->tx_burst_sz = conf->tx_burst_sz;
- port->tx_buf_count = 0;
-
- return port;
-}
-
-static inline void
-send_burst(struct rte_port_fd_writer *p)
-{
- uint32_t i;
-
- for (i = 0; i < p->tx_buf_count; i++) {
- struct rte_mbuf *pkt = p->tx_buf[i];
- void *pkt_data = rte_pktmbuf_mtod(pkt, void*);
- size_t n_bytes = rte_pktmbuf_data_len(pkt);
- ssize_t ret;
-
- ret = write(p->fd, pkt_data, n_bytes);
- if (ret < 0)
- break;
- }
-
- RTE_PORT_FD_WRITER_STATS_PKTS_DROP_ADD(p, p->tx_buf_count - i);
-
- for (i = 0; i < p->tx_buf_count; i++)
- rte_pktmbuf_free(p->tx_buf[i]);
-
- p->tx_buf_count = 0;
-}
-
-static int
-rte_port_fd_writer_tx(void *port, struct rte_mbuf *pkt)
-{
- struct rte_port_fd_writer *p =
- port;
-
- p->tx_buf[p->tx_buf_count++] = pkt;
- RTE_PORT_FD_WRITER_STATS_PKTS_IN_ADD(p, 1);
- if (p->tx_buf_count >= p->tx_burst_sz)
- send_burst(p);
-
- return 0;
-}
-
-static int
-rte_port_fd_writer_tx_bulk(void *port,
- struct rte_mbuf **pkts,
- uint64_t pkts_mask)
-{
- struct rte_port_fd_writer *p =
- port;
- uint32_t tx_buf_count = p->tx_buf_count;
-
- if ((pkts_mask & (pkts_mask + 1)) == 0) {
- uint64_t n_pkts = rte_popcount64(pkts_mask);
- uint32_t i;
-
- for (i = 0; i < n_pkts; i++)
- p->tx_buf[tx_buf_count++] = pkts[i];
- RTE_PORT_FD_WRITER_STATS_PKTS_IN_ADD(p, n_pkts);
- } else
- for ( ; pkts_mask; ) {
- uint32_t pkt_index = rte_ctz64(pkts_mask);
- uint64_t pkt_mask = 1LLU << pkt_index;
- struct rte_mbuf *pkt = pkts[pkt_index];
-
- p->tx_buf[tx_buf_count++] = pkt;
- RTE_PORT_FD_WRITER_STATS_PKTS_IN_ADD(p, 1);
- pkts_mask &= ~pkt_mask;
- }
-
- p->tx_buf_count = tx_buf_count;
- if (tx_buf_count >= p->tx_burst_sz)
- send_burst(p);
-
- return 0;
-}
-
-static int
-rte_port_fd_writer_flush(void *port)
-{
- struct rte_port_fd_writer *p =
- port;
-
- if (p->tx_buf_count > 0)
- send_burst(p);
-
- return 0;
-}
-
-static int
-rte_port_fd_writer_free(void *port)
-{
- if (port == NULL) {
- PORT_LOG(ERR, "%s: Port is NULL", __func__);
- return -EINVAL;
- }
-
- rte_port_fd_writer_flush(port);
- rte_free(port);
-
- return 0;
-}
-
-static int rte_port_fd_writer_stats_read(void *port,
- struct rte_port_out_stats *stats, int clear)
-{
- struct rte_port_fd_writer *p =
- port;
-
- if (stats != NULL)
- memcpy(stats, &p->stats, sizeof(p->stats));
-
- if (clear)
- memset(&p->stats, 0, sizeof(p->stats));
-
- return 0;
-}
-
-/*
- * Port FD Writer Nodrop
- */
-#ifdef RTE_PORT_STATS_COLLECT
-
-#define RTE_PORT_FD_WRITER_NODROP_STATS_PKTS_IN_ADD(port, val) \
- do { port->stats.n_pkts_in += val; } while (0)
-#define RTE_PORT_FD_WRITER_NODROP_STATS_PKTS_DROP_ADD(port, val) \
- do { port->stats.n_pkts_drop += val; } while (0)
-
-#else
-
-#define RTE_PORT_FD_WRITER_NODROP_STATS_PKTS_IN_ADD(port, val)
-#define RTE_PORT_FD_WRITER_NODROP_STATS_PKTS_DROP_ADD(port, val)
-
-#endif
-
-struct rte_port_fd_writer_nodrop {
- struct rte_port_out_stats stats;
-
- struct rte_mbuf *tx_buf[2 * RTE_PORT_IN_BURST_SIZE_MAX];
- uint32_t tx_burst_sz;
- uint16_t tx_buf_count;
- uint64_t n_retries;
- uint32_t fd;
-};
-
-static void *
-rte_port_fd_writer_nodrop_create(void *params, int socket_id)
-{
- struct rte_port_fd_writer_nodrop_params *conf =
- params;
- struct rte_port_fd_writer_nodrop *port;
-
- /* Check input parameters */
- if ((conf == NULL) ||
- (conf->fd < 0) ||
- (conf->tx_burst_sz == 0) ||
- (conf->tx_burst_sz > RTE_PORT_IN_BURST_SIZE_MAX) ||
- (!rte_is_power_of_2(conf->tx_burst_sz))) {
- PORT_LOG(ERR, "%s: Invalid input parameters", __func__);
- return NULL;
- }
-
- /* Memory allocation */
- port = rte_zmalloc_socket("PORT", sizeof(*port),
- RTE_CACHE_LINE_SIZE, socket_id);
- if (port == NULL) {
- PORT_LOG(ERR, "%s: Failed to allocate port", __func__);
- return NULL;
- }
-
- /* Initialization */
- port->fd = conf->fd;
- port->tx_burst_sz = conf->tx_burst_sz;
- port->tx_buf_count = 0;
-
- /*
- * When n_retries is 0 it means that we should wait for every packet to
- * send no matter how many retries should it take. To limit number of
- * branches in fast path, we use UINT64_MAX instead of branching.
- */
- port->n_retries = (conf->n_retries == 0) ? UINT64_MAX : conf->n_retries;
-
- return port;
-}
-
-static inline void
-send_burst_nodrop(struct rte_port_fd_writer_nodrop *p)
-{
- uint64_t n_retries;
- uint32_t i;
-
- n_retries = 0;
- for (i = 0; (i < p->tx_buf_count) && (n_retries < p->n_retries); i++) {
- struct rte_mbuf *pkt = p->tx_buf[i];
- void *pkt_data = rte_pktmbuf_mtod(pkt, void*);
- size_t n_bytes = rte_pktmbuf_data_len(pkt);
-
- for ( ; n_retries < p->n_retries; n_retries++) {
- ssize_t ret;
-
- ret = write(p->fd, pkt_data, n_bytes);
- if (ret)
- break;
- }
- }
-
- RTE_PORT_FD_WRITER_NODROP_STATS_PKTS_DROP_ADD(p, p->tx_buf_count - i);
-
- for (i = 0; i < p->tx_buf_count; i++)
- rte_pktmbuf_free(p->tx_buf[i]);
-
- p->tx_buf_count = 0;
-}
-
-static int
-rte_port_fd_writer_nodrop_tx(void *port, struct rte_mbuf *pkt)
-{
- struct rte_port_fd_writer_nodrop *p =
- port;
-
- p->tx_buf[p->tx_buf_count++] = pkt;
- RTE_PORT_FD_WRITER_NODROP_STATS_PKTS_IN_ADD(p, 1);
- if (p->tx_buf_count >= p->tx_burst_sz)
- send_burst_nodrop(p);
-
- return 0;
-}
-
-static int
-rte_port_fd_writer_nodrop_tx_bulk(void *port,
- struct rte_mbuf **pkts,
- uint64_t pkts_mask)
-{
- struct rte_port_fd_writer_nodrop *p =
- port;
- uint32_t tx_buf_count = p->tx_buf_count;
-
- if ((pkts_mask & (pkts_mask + 1)) == 0) {
- uint64_t n_pkts = rte_popcount64(pkts_mask);
- uint32_t i;
-
- for (i = 0; i < n_pkts; i++)
- p->tx_buf[tx_buf_count++] = pkts[i];
- RTE_PORT_FD_WRITER_NODROP_STATS_PKTS_IN_ADD(p, n_pkts);
- } else
- for ( ; pkts_mask; ) {
- uint32_t pkt_index = rte_ctz64(pkts_mask);
- uint64_t pkt_mask = 1LLU << pkt_index;
- struct rte_mbuf *pkt = pkts[pkt_index];
-
- p->tx_buf[tx_buf_count++] = pkt;
- RTE_PORT_FD_WRITER_NODROP_STATS_PKTS_IN_ADD(p, 1);
- pkts_mask &= ~pkt_mask;
- }
-
- p->tx_buf_count = tx_buf_count;
- if (tx_buf_count >= p->tx_burst_sz)
- send_burst_nodrop(p);
-
- return 0;
-}
-
-static int
-rte_port_fd_writer_nodrop_flush(void *port)
-{
- struct rte_port_fd_writer_nodrop *p =
- port;
-
- if (p->tx_buf_count > 0)
- send_burst_nodrop(p);
-
- return 0;
-}
-
-static int
-rte_port_fd_writer_nodrop_free(void *port)
-{
- if (port == NULL) {
- PORT_LOG(ERR, "%s: Port is NULL", __func__);
- return -EINVAL;
- }
-
- rte_port_fd_writer_nodrop_flush(port);
- rte_free(port);
-
-return 0;
-}
-
-static int rte_port_fd_writer_nodrop_stats_read(void *port,
- struct rte_port_out_stats *stats, int clear)
-{
- struct rte_port_fd_writer_nodrop *p =
- port;
-
- if (stats != NULL)
- memcpy(stats, &p->stats, sizeof(p->stats));
-
- if (clear)
- memset(&p->stats, 0, sizeof(p->stats));
-
- return 0;
-}
-
-/*
- * Summary of port operations
- */
-RTE_EXPORT_SYMBOL(rte_port_fd_reader_ops)
-struct rte_port_in_ops rte_port_fd_reader_ops = {
- .f_create = rte_port_fd_reader_create,
- .f_free = rte_port_fd_reader_free,
- .f_rx = rte_port_fd_reader_rx,
- .f_stats = rte_port_fd_reader_stats_read,
-};
-
-RTE_EXPORT_SYMBOL(rte_port_fd_writer_ops)
-struct rte_port_out_ops rte_port_fd_writer_ops = {
- .f_create = rte_port_fd_writer_create,
- .f_free = rte_port_fd_writer_free,
- .f_tx = rte_port_fd_writer_tx,
- .f_tx_bulk = rte_port_fd_writer_tx_bulk,
- .f_flush = rte_port_fd_writer_flush,
- .f_stats = rte_port_fd_writer_stats_read,
-};
-
-RTE_EXPORT_SYMBOL(rte_port_fd_writer_nodrop_ops)
-struct rte_port_out_ops rte_port_fd_writer_nodrop_ops = {
- .f_create = rte_port_fd_writer_nodrop_create,
- .f_free = rte_port_fd_writer_nodrop_free,
- .f_tx = rte_port_fd_writer_nodrop_tx,
- .f_tx_bulk = rte_port_fd_writer_nodrop_tx_bulk,
- .f_flush = rte_port_fd_writer_nodrop_flush,
- .f_stats = rte_port_fd_writer_nodrop_stats_read,
-};
diff --git a/lib/port/rte_port_fd.h b/lib/port/rte_port_fd.h
deleted file mode 100644
index 40a5e4a426..0000000000
--- a/lib/port/rte_port_fd.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2016 Intel Corporation
- */
-
-#ifndef __INCLUDE_RTE_PORT_FD_H__
-#define __INCLUDE_RTE_PORT_FD_H__
-
-/**
- * @file
- * RTE Port FD Device
- *
- * fd_reader: input port built on top of valid non-blocking file descriptor
- * fd_writer: output port built on top of valid non-blocking file descriptor
- */
-
-#include <stdint.h>
-
-#include "rte_port.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** fd_reader port parameters */
-struct rte_port_fd_reader_params {
- /** File descriptor */
- int fd;
-
- /** Maximum Transfer Unit (MTU) */
- uint32_t mtu;
-
- /** Pre-initialized buffer pool */
- struct rte_mempool *mempool;
-};
-
-/** fd_reader port operations */
-extern struct rte_port_in_ops rte_port_fd_reader_ops;
-
-/** fd_writer port parameters */
-struct rte_port_fd_writer_params {
- /** File descriptor */
- int fd;
-
- /**< Recommended write burst size. The actual burst size can be
- * bigger or smaller than this value.
- */
- uint32_t tx_burst_sz;
-};
-
-/** fd_writer port operations */
-extern struct rte_port_out_ops rte_port_fd_writer_ops;
-
-/** fd_writer_nodrop port parameters */
-struct rte_port_fd_writer_nodrop_params {
- /** File descriptor */
- int fd;
-
- /**< Recommended write burst size. The actual burst size can be
- * bigger or smaller than this value.
- */
- uint32_t tx_burst_sz;
-
- /** Maximum number of retries, 0 for no limit */
- uint32_t n_retries;
-};
-
-/** fd_writer_nodrop port operations */
-extern struct rte_port_out_ops rte_port_fd_writer_nodrop_ops;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/port/rte_port_frag.c b/lib/port/rte_port_frag.c
deleted file mode 100644
index 9444f5939c..0000000000
--- a/lib/port/rte_port_frag.c
+++ /dev/null
@@ -1,280 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
- */
-#include <string.h>
-
-#include <eal_export.h>
-#include <rte_ip_frag.h>
-
-#include "rte_port_frag.h"
-
-#include "port_log.h"
-
-/* Max number of fragments per packet allowed */
-#define RTE_PORT_FRAG_MAX_FRAGS_PER_PACKET 0x80
-
-#ifdef RTE_PORT_STATS_COLLECT
-
-#define RTE_PORT_RING_READER_FRAG_STATS_PKTS_IN_ADD(port, val) \
- port->stats.n_pkts_in += val
-#define RTE_PORT_RING_READER_FRAG_STATS_PKTS_DROP_ADD(port, val) \
- port->stats.n_pkts_drop += val
-
-#else
-
-#define RTE_PORT_RING_READER_FRAG_STATS_PKTS_IN_ADD(port, val)
-#define RTE_PORT_RING_READER_FRAG_STATS_PKTS_DROP_ADD(port, val)
-
-#endif
-
-typedef int32_t
- (*frag_op)(struct rte_mbuf *pkt_in,
- struct rte_mbuf **pkts_out,
- uint16_t nb_pkts_out,
- uint16_t mtu_size,
- struct rte_mempool *pool_direct,
- struct rte_mempool *pool_indirect);
-
-struct __rte_cache_aligned rte_port_ring_reader_frag {
- struct rte_port_in_stats stats;
-
- /* Input parameters */
- struct rte_ring *ring;
- uint32_t mtu;
- uint32_t metadata_size;
- struct rte_mempool *pool_direct;
- struct rte_mempool *pool_indirect;
-
- /* Internal buffers */
- struct rte_mbuf *pkts[RTE_PORT_IN_BURST_SIZE_MAX];
- struct rte_mbuf *frags[RTE_PORT_FRAG_MAX_FRAGS_PER_PACKET];
- uint32_t n_pkts;
- uint32_t pos_pkts;
- uint32_t n_frags;
- uint32_t pos_frags;
-
- frag_op f_frag;
-};
-
-static void *
-rte_port_ring_reader_frag_create(void *params, int socket_id, int is_ipv4)
-{
- struct rte_port_ring_reader_frag_params *conf =
- params;
- struct rte_port_ring_reader_frag *port;
-
- /* Check input parameters */
- if (conf == NULL) {
- PORT_LOG(ERR, "%s: Parameter conf is NULL", __func__);
- return NULL;
- }
- if (conf->ring == NULL) {
- PORT_LOG(ERR, "%s: Parameter ring is NULL", __func__);
- return NULL;
- }
- if (conf->mtu == 0) {
- PORT_LOG(ERR, "%s: Parameter mtu is invalid", __func__);
- return NULL;
- }
- if (conf->pool_direct == NULL) {
- PORT_LOG(ERR, "%s: Parameter pool_direct is NULL",
- __func__);
- return NULL;
- }
- if (conf->pool_indirect == NULL) {
- PORT_LOG(ERR, "%s: Parameter pool_indirect is NULL",
- __func__);
- return NULL;
- }
-
- /* Memory allocation */
- port = rte_zmalloc_socket("PORT", sizeof(*port), RTE_CACHE_LINE_SIZE,
- socket_id);
- if (port == NULL) {
- PORT_LOG(ERR, "%s: port is NULL", __func__);
- return NULL;
- }
-
- /* Initialization */
- port->ring = conf->ring;
- port->mtu = conf->mtu;
- port->metadata_size = conf->metadata_size;
- port->pool_direct = conf->pool_direct;
- port->pool_indirect = conf->pool_indirect;
-
- port->n_pkts = 0;
- port->pos_pkts = 0;
- port->n_frags = 0;
- port->pos_frags = 0;
-
- port->f_frag = (is_ipv4) ?
- rte_ipv4_fragment_packet : rte_ipv6_fragment_packet;
-
- return port;
-}
-
-static void *
-rte_port_ring_reader_ipv4_frag_create(void *params, int socket_id)
-{
- return rte_port_ring_reader_frag_create(params, socket_id, 1);
-}
-
-static void *
-rte_port_ring_reader_ipv6_frag_create(void *params, int socket_id)
-{
- return rte_port_ring_reader_frag_create(params, socket_id, 0);
-}
-
-static int
-rte_port_ring_reader_frag_rx(void *port,
- struct rte_mbuf **pkts,
- uint32_t n_pkts)
-{
- struct rte_port_ring_reader_frag *p =
- port;
- uint32_t n_pkts_out;
-
- n_pkts_out = 0;
-
- /* Get packets from the "frag" buffer */
- if (p->n_frags >= n_pkts) {
- memcpy(pkts, &p->frags[p->pos_frags], n_pkts * sizeof(void *));
- p->pos_frags += n_pkts;
- p->n_frags -= n_pkts;
-
- return n_pkts;
- }
-
- memcpy(pkts, &p->frags[p->pos_frags], p->n_frags * sizeof(void *));
- n_pkts_out = p->n_frags;
- p->n_frags = 0;
-
- /* Look to "pkts" buffer to get more packets */
- for ( ; ; ) {
- struct rte_mbuf *pkt;
- uint32_t n_pkts_to_provide, i;
- int status;
-
- /* If "pkts" buffer is empty, read packet burst from ring */
- if (p->n_pkts == 0) {
- p->n_pkts = rte_ring_sc_dequeue_burst(p->ring,
- (void **) p->pkts, RTE_PORT_IN_BURST_SIZE_MAX,
- NULL);
- RTE_PORT_RING_READER_FRAG_STATS_PKTS_IN_ADD(p, p->n_pkts);
- if (p->n_pkts == 0)
- return n_pkts_out;
- p->pos_pkts = 0;
- }
-
- /* Read next packet from "pkts" buffer */
- pkt = p->pkts[p->pos_pkts++];
- p->n_pkts--;
-
- /* If not jumbo, pass current packet to output */
- if (pkt->pkt_len <= p->mtu) {
- pkts[n_pkts_out++] = pkt;
-
- n_pkts_to_provide = n_pkts - n_pkts_out;
- if (n_pkts_to_provide == 0)
- return n_pkts;
-
- continue;
- }
-
- /* Fragment current packet into the "frags" buffer */
- status = p->f_frag(
- pkt,
- p->frags,
- RTE_PORT_FRAG_MAX_FRAGS_PER_PACKET,
- p->mtu,
- p->pool_direct,
- p->pool_indirect
- );
-
- if (status < 0) {
- rte_pktmbuf_free(pkt);
- RTE_PORT_RING_READER_FRAG_STATS_PKTS_DROP_ADD(p, 1);
- continue;
- }
-
- p->n_frags = (uint32_t) status;
- p->pos_frags = 0;
-
- /* Copy meta-data from input jumbo packet to its fragments */
- for (i = 0; i < p->n_frags; i++) {
- uint8_t *src =
- RTE_MBUF_METADATA_UINT8_PTR(pkt, sizeof(struct rte_mbuf));
- uint8_t *dst =
- RTE_MBUF_METADATA_UINT8_PTR(p->frags[i], sizeof(struct rte_mbuf));
-
- memcpy(dst, src, p->metadata_size);
- }
-
- /* Free input jumbo packet */
- rte_pktmbuf_free(pkt);
-
- /* Get packets from "frag" buffer */
- n_pkts_to_provide = n_pkts - n_pkts_out;
- if (p->n_frags >= n_pkts_to_provide) {
- memcpy(&pkts[n_pkts_out], p->frags,
- n_pkts_to_provide * sizeof(void *));
- p->n_frags -= n_pkts_to_provide;
- p->pos_frags += n_pkts_to_provide;
-
- return n_pkts;
- }
-
- memcpy(&pkts[n_pkts_out], p->frags,
- p->n_frags * sizeof(void *));
- n_pkts_out += p->n_frags;
- p->n_frags = 0;
- }
-}
-
-static int
-rte_port_ring_reader_frag_free(void *port)
-{
- if (port == NULL) {
- PORT_LOG(ERR, "%s: Parameter port is NULL", __func__);
- return -1;
- }
-
- rte_free(port);
-
- return 0;
-}
-
-static int
-rte_port_frag_reader_stats_read(void *port,
- struct rte_port_in_stats *stats, int clear)
-{
- struct rte_port_ring_reader_frag *p =
- port;
-
- if (stats != NULL)
- memcpy(stats, &p->stats, sizeof(p->stats));
-
- if (clear)
- memset(&p->stats, 0, sizeof(p->stats));
-
- return 0;
-}
-
-/*
- * Summary of port operations
- */
-RTE_EXPORT_SYMBOL(rte_port_ring_reader_ipv4_frag_ops)
-struct rte_port_in_ops rte_port_ring_reader_ipv4_frag_ops = {
- .f_create = rte_port_ring_reader_ipv4_frag_create,
- .f_free = rte_port_ring_reader_frag_free,
- .f_rx = rte_port_ring_reader_frag_rx,
- .f_stats = rte_port_frag_reader_stats_read,
-};
-
-RTE_EXPORT_SYMBOL(rte_port_ring_reader_ipv6_frag_ops)
-struct rte_port_in_ops rte_port_ring_reader_ipv6_frag_ops = {
- .f_create = rte_port_ring_reader_ipv6_frag_create,
- .f_free = rte_port_ring_reader_frag_free,
- .f_rx = rte_port_ring_reader_frag_rx,
- .f_stats = rte_port_frag_reader_stats_read,
-};
diff --git a/lib/port/rte_port_frag.h b/lib/port/rte_port_frag.h
deleted file mode 100644
index 9a10f10523..0000000000
--- a/lib/port/rte_port_frag.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
- */
-
-#ifndef __INCLUDE_RTE_PORT_IP_FRAG_H__
-#define __INCLUDE_RTE_PORT_IP_FRAG_H__
-
-/**
- * @file
- * RTE Port for IPv4 Fragmentation
- *
- * This port is built on top of pre-initialized single consumer rte_ring. In
- * order to minimize the amount of packets stored in the ring at any given
- * time, the IP fragmentation functionality is executed on ring read operation,
- * hence this port is implemented as an input port. A regular ring_writer port
- * can be created to write to the same ring.
- *
- * The packets written to the ring are either complete IP datagrams or jumbo
- * frames (i.e. IP packets with length bigger than provided MTU value). The
- * packets read from the ring are all non-jumbo frames. The complete IP
- * datagrams written to the ring are not changed. The jumbo frames are
- * fragmented into several IP packets with length less or equal to MTU.
- */
-
-#include <stdint.h>
-
-
-#include "rte_port.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** ring_reader_ipv4_frag port parameters */
-struct rte_port_ring_reader_frag_params {
- /** Underlying single consumer ring that has to be pre-initialized. */
- struct rte_ring *ring;
-
- /** Maximum Transfer Unit (MTU). Maximum IP packet size (in bytes). */
- uint32_t mtu;
-
- /** Size of application dependent meta-data stored per each input packet
- that has to be copied to each of the fragments originating from the
- same input IP datagram. */
- uint32_t metadata_size;
-
- /** Pre-initialized buffer pool used for allocating direct buffers for
- the output fragments. */
- struct rte_mempool *pool_direct;
-
- /** Pre-initialized buffer pool used for allocating indirect buffers for
- the output fragments. */
- struct rte_mempool *pool_indirect;
-};
-
-#define rte_port_ring_reader_ipv4_frag_params rte_port_ring_reader_frag_params
-
-#define rte_port_ring_reader_ipv6_frag_params rte_port_ring_reader_frag_params
-
-/** ring_reader_ipv4_frag port operations */
-extern struct rte_port_in_ops rte_port_ring_reader_ipv4_frag_ops;
-
-/** ring_reader_ipv6_frag port operations */
-extern struct rte_port_in_ops rte_port_ring_reader_ipv6_frag_ops;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/port/rte_port_ras.c b/lib/port/rte_port_ras.c
deleted file mode 100644
index 58ab7a1c5b..0000000000
--- a/lib/port/rte_port_ras.c
+++ /dev/null
@@ -1,336 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
- */
-#include <string.h>
-
-#include <eal_export.h>
-#include <rte_ip_frag.h>
-#include <rte_cycles.h>
-#include <rte_log.h>
-
-#include "rte_port_ras.h"
-
-#include "port_log.h"
-
-#ifndef RTE_PORT_RAS_N_BUCKETS
-#define RTE_PORT_RAS_N_BUCKETS 4094
-#endif
-
-#ifndef RTE_PORT_RAS_N_ENTRIES_PER_BUCKET
-#define RTE_PORT_RAS_N_ENTRIES_PER_BUCKET 8
-#endif
-
-#ifndef RTE_PORT_RAS_N_ENTRIES
-#define RTE_PORT_RAS_N_ENTRIES (RTE_PORT_RAS_N_BUCKETS * RTE_PORT_RAS_N_ENTRIES_PER_BUCKET)
-#endif
-
-#ifdef RTE_PORT_STATS_COLLECT
-
-#define RTE_PORT_RING_WRITER_RAS_STATS_PKTS_IN_ADD(port, val) \
- port->stats.n_pkts_in += val
-#define RTE_PORT_RING_WRITER_RAS_STATS_PKTS_DROP_ADD(port, val) \
- port->stats.n_pkts_drop += val
-
-#else
-
-#define RTE_PORT_RING_WRITER_RAS_STATS_PKTS_IN_ADD(port, val)
-#define RTE_PORT_RING_WRITER_RAS_STATS_PKTS_DROP_ADD(port, val)
-
-#endif
-
-struct rte_port_ring_writer_ras;
-
-typedef void (*ras_op)(
- struct rte_port_ring_writer_ras *p,
- struct rte_mbuf *pkt);
-
-static void
-process_ipv4(struct rte_port_ring_writer_ras *p, struct rte_mbuf *pkt);
-static void
-process_ipv6(struct rte_port_ring_writer_ras *p, struct rte_mbuf *pkt);
-
-struct rte_port_ring_writer_ras {
- struct rte_port_out_stats stats;
-
- struct rte_mbuf *tx_buf[RTE_PORT_IN_BURST_SIZE_MAX];
- struct rte_ring *ring;
- uint32_t tx_burst_sz;
- uint32_t tx_buf_count;
- struct rte_ip_frag_tbl *frag_tbl;
- struct rte_ip_frag_death_row death_row;
-
- ras_op f_ras;
-};
-
-static void *
-rte_port_ring_writer_ras_create(void *params, int socket_id, int is_ipv4)
-{
- struct rte_port_ring_writer_ras_params *conf =
- params;
- struct rte_port_ring_writer_ras *port;
- uint64_t frag_cycles;
-
- /* Check input parameters */
- if (conf == NULL) {
- PORT_LOG(ERR, "%s: Parameter conf is NULL", __func__);
- return NULL;
- }
- if (conf->ring == NULL) {
- PORT_LOG(ERR, "%s: Parameter ring is NULL", __func__);
- return NULL;
- }
- if ((conf->tx_burst_sz == 0) ||
- (conf->tx_burst_sz > RTE_PORT_IN_BURST_SIZE_MAX)) {
- PORT_LOG(ERR, "%s: Parameter tx_burst_sz is invalid",
- __func__);
- return NULL;
- }
-
- /* Memory allocation */
- port = rte_zmalloc_socket("PORT", sizeof(*port),
- RTE_CACHE_LINE_SIZE, socket_id);
- if (port == NULL) {
- PORT_LOG(ERR, "%s: Failed to allocate socket", __func__);
- return NULL;
- }
-
- /* Create fragmentation table */
- frag_cycles = (rte_get_tsc_hz() + MS_PER_S - 1) / MS_PER_S * MS_PER_S;
- frag_cycles *= 100;
-
- port->frag_tbl = rte_ip_frag_table_create(
- RTE_PORT_RAS_N_BUCKETS,
- RTE_PORT_RAS_N_ENTRIES_PER_BUCKET,
- RTE_PORT_RAS_N_ENTRIES,
- frag_cycles,
- socket_id);
-
- if (port->frag_tbl == NULL) {
- PORT_LOG(ERR, "%s: rte_ip_frag_table_create failed",
- __func__);
- rte_free(port);
- return NULL;
- }
-
- /* Initialization */
- port->ring = conf->ring;
- port->tx_burst_sz = conf->tx_burst_sz;
- port->tx_buf_count = 0;
-
- port->f_ras = (is_ipv4 == 1) ? process_ipv4 : process_ipv6;
-
- return port;
-}
-
-static void *
-rte_port_ring_writer_ipv4_ras_create(void *params, int socket_id)
-{
- return rte_port_ring_writer_ras_create(params, socket_id, 1);
-}
-
-static void *
-rte_port_ring_writer_ipv6_ras_create(void *params, int socket_id)
-{
- return rte_port_ring_writer_ras_create(params, socket_id, 0);
-}
-
-static inline void
-send_burst(struct rte_port_ring_writer_ras *p)
-{
- uint32_t nb_tx;
-
- nb_tx = rte_ring_sp_enqueue_burst(p->ring, (void **)p->tx_buf,
- p->tx_buf_count, NULL);
-
- RTE_PORT_RING_WRITER_RAS_STATS_PKTS_DROP_ADD(p, p->tx_buf_count - nb_tx);
- for ( ; nb_tx < p->tx_buf_count; nb_tx++)
- rte_pktmbuf_free(p->tx_buf[nb_tx]);
-
- p->tx_buf_count = 0;
-}
-
-static void
-process_ipv4(struct rte_port_ring_writer_ras *p, struct rte_mbuf *pkt)
-{
- /* Assume there is no ethernet header */
- struct rte_ipv4_hdr *pkt_hdr =
- rte_pktmbuf_mtod(pkt, struct rte_ipv4_hdr *);
-
- /* Get "More fragments" flag and fragment offset */
- uint16_t frag_field = rte_be_to_cpu_16(pkt_hdr->fragment_offset);
- uint16_t frag_offset = (uint16_t)(frag_field & RTE_IPV4_HDR_OFFSET_MASK);
- uint16_t frag_flag = (uint16_t)(frag_field & RTE_IPV4_HDR_MF_FLAG);
-
- /* If it is a fragmented packet, then try to reassemble */
- if ((frag_flag == 0) && (frag_offset == 0))
- p->tx_buf[p->tx_buf_count++] = pkt;
- else {
- struct rte_mbuf *mo;
- struct rte_ip_frag_tbl *tbl = p->frag_tbl;
- struct rte_ip_frag_death_row *dr = &p->death_row;
-
- pkt->l3_len = sizeof(*pkt_hdr);
-
- /* Process this fragment */
- mo = rte_ipv4_frag_reassemble_packet(tbl, dr, pkt, rte_rdtsc(),
- pkt_hdr);
- if (mo != NULL)
- p->tx_buf[p->tx_buf_count++] = mo;
-
- rte_ip_frag_free_death_row(&p->death_row, 3);
- }
-}
-
-static void
-process_ipv6(struct rte_port_ring_writer_ras *p, struct rte_mbuf *pkt)
-{
- /* Assume there is no ethernet header */
- struct rte_ipv6_hdr *pkt_hdr =
- rte_pktmbuf_mtod(pkt, struct rte_ipv6_hdr *);
-
- struct rte_ipv6_fragment_ext *frag_hdr;
- uint16_t frag_data = 0;
- frag_hdr = rte_ipv6_frag_get_ipv6_fragment_header(pkt_hdr);
- if (frag_hdr != NULL)
- frag_data = rte_be_to_cpu_16(frag_hdr->frag_data);
-
- /* If it is a fragmented packet, then try to reassemble */
- if ((frag_data & RTE_IPV6_FRAG_USED_MASK) == 0)
- p->tx_buf[p->tx_buf_count++] = pkt;
- else {
- struct rte_mbuf *mo;
- struct rte_ip_frag_tbl *tbl = p->frag_tbl;
- struct rte_ip_frag_death_row *dr = &p->death_row;
-
- pkt->l3_len = sizeof(*pkt_hdr) + sizeof(*frag_hdr);
-
- /* Process this fragment */
- mo = rte_ipv6_frag_reassemble_packet(tbl, dr, pkt, rte_rdtsc(), pkt_hdr,
- frag_hdr);
- if (mo != NULL)
- p->tx_buf[p->tx_buf_count++] = mo;
-
- rte_ip_frag_free_death_row(&p->death_row, 3);
- }
-}
-
-static int
-rte_port_ring_writer_ras_tx(void *port, struct rte_mbuf *pkt)
-{
- struct rte_port_ring_writer_ras *p =
- port;
-
- RTE_PORT_RING_WRITER_RAS_STATS_PKTS_IN_ADD(p, 1);
- p->f_ras(p, pkt);
- if (p->tx_buf_count >= p->tx_burst_sz)
- send_burst(p);
-
- return 0;
-}
-
-static int
-rte_port_ring_writer_ras_tx_bulk(void *port,
- struct rte_mbuf **pkts,
- uint64_t pkts_mask)
-{
- struct rte_port_ring_writer_ras *p =
- port;
-
- if ((pkts_mask & (pkts_mask + 1)) == 0) {
- uint64_t n_pkts = rte_popcount64(pkts_mask);
- uint32_t i;
-
- for (i = 0; i < n_pkts; i++) {
- struct rte_mbuf *pkt = pkts[i];
-
- RTE_PORT_RING_WRITER_RAS_STATS_PKTS_IN_ADD(p, 1);
- p->f_ras(p, pkt);
- if (p->tx_buf_count >= p->tx_burst_sz)
- send_burst(p);
- }
- } else {
- for ( ; pkts_mask; ) {
- uint32_t pkt_index = rte_ctz64(pkts_mask);
- uint64_t pkt_mask = 1LLU << pkt_index;
- struct rte_mbuf *pkt = pkts[pkt_index];
-
- RTE_PORT_RING_WRITER_RAS_STATS_PKTS_IN_ADD(p, 1);
- p->f_ras(p, pkt);
- if (p->tx_buf_count >= p->tx_burst_sz)
- send_burst(p);
-
- pkts_mask &= ~pkt_mask;
- }
- }
-
- return 0;
-}
-
-static int
-rte_port_ring_writer_ras_flush(void *port)
-{
- struct rte_port_ring_writer_ras *p =
- port;
-
- if (p->tx_buf_count > 0)
- send_burst(p);
-
- return 0;
-}
-
-static int
-rte_port_ring_writer_ras_free(void *port)
-{
- struct rte_port_ring_writer_ras *p =
- port;
-
- if (port == NULL) {
- PORT_LOG(ERR, "%s: Parameter port is NULL", __func__);
- return -1;
- }
-
- rte_port_ring_writer_ras_flush(port);
- rte_ip_frag_table_destroy(p->frag_tbl);
- rte_free(port);
-
- return 0;
-}
-
-static int
-rte_port_ras_writer_stats_read(void *port,
- struct rte_port_out_stats *stats, int clear)
-{
- struct rte_port_ring_writer_ras *p =
- port;
-
- if (stats != NULL)
- memcpy(stats, &p->stats, sizeof(p->stats));
-
- if (clear)
- memset(&p->stats, 0, sizeof(p->stats));
-
- return 0;
-}
-
-/*
- * Summary of port operations
- */
-RTE_EXPORT_SYMBOL(rte_port_ring_writer_ipv4_ras_ops)
-struct rte_port_out_ops rte_port_ring_writer_ipv4_ras_ops = {
- .f_create = rte_port_ring_writer_ipv4_ras_create,
- .f_free = rte_port_ring_writer_ras_free,
- .f_tx = rte_port_ring_writer_ras_tx,
- .f_tx_bulk = rte_port_ring_writer_ras_tx_bulk,
- .f_flush = rte_port_ring_writer_ras_flush,
- .f_stats = rte_port_ras_writer_stats_read,
-};
-
-RTE_EXPORT_SYMBOL(rte_port_ring_writer_ipv6_ras_ops)
-struct rte_port_out_ops rte_port_ring_writer_ipv6_ras_ops = {
- .f_create = rte_port_ring_writer_ipv6_ras_create,
- .f_free = rte_port_ring_writer_ras_free,
- .f_tx = rte_port_ring_writer_ras_tx,
- .f_tx_bulk = rte_port_ring_writer_ras_tx_bulk,
- .f_flush = rte_port_ring_writer_ras_flush,
- .f_stats = rte_port_ras_writer_stats_read,
-};
diff --git a/lib/port/rte_port_ras.h b/lib/port/rte_port_ras.h
deleted file mode 100644
index 86e36f5362..0000000000
--- a/lib/port/rte_port_ras.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
- */
-
-#ifndef __INCLUDE_RTE_PORT_RAS_H__
-#define __INCLUDE_RTE_PORT_RAS_H__
-
-/**
- * @file
- * RTE Port for IPv4 Reassembly
- *
- * This port is built on top of pre-initialized single producer rte_ring. In
- * order to minimize the amount of packets stored in the ring at any given
- * time, the IP reassembly functionality is executed on ring write operation,
- * hence this port is implemented as an output port. A regular ring_reader port
- * can be created to read from the same ring.
- *
- * The packets written to the ring are either complete IP datagrams or IP
- * fragments. The packets read from the ring are all complete IP datagrams,
- * either jumbo frames (i.e. IP packets with length bigger than MTU) or not.
- * The complete IP datagrams written to the ring are not changed. The IP
- * fragments written to the ring are first reassembled and into complete IP
- * datagrams or dropped on error or IP reassembly time-out.
- */
-
-#include <stdint.h>
-
-#include "rte_port.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** ring_writer_ipv4_ras port parameters */
-struct rte_port_ring_writer_ras_params {
- /** Underlying single consumer ring that has to be pre-initialized. */
- struct rte_ring *ring;
-
- /** Recommended burst size to ring. The actual burst size can be bigger
- or smaller than this value. */
- uint32_t tx_burst_sz;
-};
-
-#define rte_port_ring_writer_ipv4_ras_params rte_port_ring_writer_ras_params
-
-#define rte_port_ring_writer_ipv6_ras_params rte_port_ring_writer_ras_params
-
-/** ring_writer_ipv4_ras port operations */
-extern struct rte_port_out_ops rte_port_ring_writer_ipv4_ras_ops;
-
-/** ring_writer_ipv6_ras port operations */
-extern struct rte_port_out_ops rte_port_ring_writer_ipv6_ras_ops;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/port/rte_port_ring.c b/lib/port/rte_port_ring.c
deleted file mode 100644
index 307a576d65..0000000000
--- a/lib/port/rte_port_ring.c
+++ /dev/null
@@ -1,796 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
- */
-#include <string.h>
-#include <stdint.h>
-
-#include <eal_export.h>
-#include <rte_mbuf.h>
-#include <rte_ring.h>
-#include <rte_malloc.h>
-
-#include "rte_port_ring.h"
-
-#include "port_log.h"
-
-/*
- * Port RING Reader
- */
-#ifdef RTE_PORT_STATS_COLLECT
-
-#define RTE_PORT_RING_READER_STATS_PKTS_IN_ADD(port, val) \
- port->stats.n_pkts_in += val
-#define RTE_PORT_RING_READER_STATS_PKTS_DROP_ADD(port, val) \
- port->stats.n_pkts_drop += val
-
-#else
-
-#define RTE_PORT_RING_READER_STATS_PKTS_IN_ADD(port, val)
-#define RTE_PORT_RING_READER_STATS_PKTS_DROP_ADD(port, val)
-
-#endif
-
-struct rte_port_ring_reader {
- struct rte_port_in_stats stats;
-
- struct rte_ring *ring;
-};
-
-static void *
-rte_port_ring_reader_create_internal(void *params, int socket_id,
- uint32_t is_multi)
-{
- struct rte_port_ring_reader_params *conf =
- params;
- struct rte_port_ring_reader *port;
-
- /* Check input parameters */
- if ((conf == NULL) ||
- (conf->ring == NULL) ||
- (rte_ring_is_cons_single(conf->ring) && is_multi) ||
- (!rte_ring_is_cons_single(conf->ring) && !is_multi)) {
- PORT_LOG(ERR, "%s: Invalid Parameters", __func__);
- return NULL;
- }
-
- /* Memory allocation */
- port = rte_zmalloc_socket("PORT", sizeof(*port),
- RTE_CACHE_LINE_SIZE, socket_id);
- if (port == NULL) {
- PORT_LOG(ERR, "%s: Failed to allocate port", __func__);
- return NULL;
- }
-
- /* Initialization */
- port->ring = conf->ring;
-
- return port;
-}
-
-static void *
-rte_port_ring_reader_create(void *params, int socket_id)
-{
- return rte_port_ring_reader_create_internal(params, socket_id, 0);
-}
-
-static void *
-rte_port_ring_multi_reader_create(void *params, int socket_id)
-{
- return rte_port_ring_reader_create_internal(params, socket_id, 1);
-}
-
-static int
-rte_port_ring_reader_rx(void *port, struct rte_mbuf **pkts, uint32_t n_pkts)
-{
- struct rte_port_ring_reader *p = port;
- uint32_t nb_rx;
-
- nb_rx = rte_ring_sc_dequeue_burst(p->ring, (void **) pkts,
- n_pkts, NULL);
- RTE_PORT_RING_READER_STATS_PKTS_IN_ADD(p, nb_rx);
-
- return nb_rx;
-}
-
-static int
-rte_port_ring_multi_reader_rx(void *port, struct rte_mbuf **pkts,
- uint32_t n_pkts)
-{
- struct rte_port_ring_reader *p = port;
- uint32_t nb_rx;
-
- nb_rx = rte_ring_mc_dequeue_burst(p->ring, (void **) pkts,
- n_pkts, NULL);
- RTE_PORT_RING_READER_STATS_PKTS_IN_ADD(p, nb_rx);
-
- return nb_rx;
-}
-
-static int
-rte_port_ring_reader_free(void *port)
-{
- if (port == NULL) {
- PORT_LOG(ERR, "%s: port is NULL", __func__);
- return -EINVAL;
- }
-
- rte_free(port);
-
- return 0;
-}
-
-static int
-rte_port_ring_reader_stats_read(void *port,
- struct rte_port_in_stats *stats, int clear)
-{
- struct rte_port_ring_reader *p =
- port;
-
- if (stats != NULL)
- memcpy(stats, &p->stats, sizeof(p->stats));
-
- if (clear)
- memset(&p->stats, 0, sizeof(p->stats));
-
- return 0;
-}
-
-/*
- * Port RING Writer
- */
-#ifdef RTE_PORT_STATS_COLLECT
-
-#define RTE_PORT_RING_WRITER_STATS_PKTS_IN_ADD(port, val) \
- port->stats.n_pkts_in += val
-#define RTE_PORT_RING_WRITER_STATS_PKTS_DROP_ADD(port, val) \
- port->stats.n_pkts_drop += val
-
-#else
-
-#define RTE_PORT_RING_WRITER_STATS_PKTS_IN_ADD(port, val)
-#define RTE_PORT_RING_WRITER_STATS_PKTS_DROP_ADD(port, val)
-
-#endif
-
-struct rte_port_ring_writer {
- struct rte_port_out_stats stats;
-
- struct rte_mbuf *tx_buf[2 * RTE_PORT_IN_BURST_SIZE_MAX];
- struct rte_ring *ring;
- uint32_t tx_burst_sz;
- uint32_t tx_buf_count;
- uint64_t bsz_mask;
- uint32_t is_multi;
-};
-
-static void *
-rte_port_ring_writer_create_internal(void *params, int socket_id,
- uint32_t is_multi)
-{
- struct rte_port_ring_writer_params *conf =
- params;
- struct rte_port_ring_writer *port;
-
- /* Check input parameters */
- if ((conf == NULL) ||
- (conf->ring == NULL) ||
- (rte_ring_is_prod_single(conf->ring) && is_multi) ||
- (!rte_ring_is_prod_single(conf->ring) && !is_multi) ||
- (conf->tx_burst_sz > RTE_PORT_IN_BURST_SIZE_MAX)) {
- PORT_LOG(ERR, "%s: Invalid Parameters", __func__);
- return NULL;
- }
-
- /* Memory allocation */
- port = rte_zmalloc_socket("PORT", sizeof(*port),
- RTE_CACHE_LINE_SIZE, socket_id);
- if (port == NULL) {
- PORT_LOG(ERR, "%s: Failed to allocate port", __func__);
- return NULL;
- }
-
- /* Initialization */
- port->ring = conf->ring;
- port->tx_burst_sz = conf->tx_burst_sz;
- port->tx_buf_count = 0;
- port->bsz_mask = 1LLU << (conf->tx_burst_sz - 1);
- port->is_multi = is_multi;
-
- return port;
-}
-
-static void *
-rte_port_ring_writer_create(void *params, int socket_id)
-{
- return rte_port_ring_writer_create_internal(params, socket_id, 0);
-}
-
-static void *
-rte_port_ring_multi_writer_create(void *params, int socket_id)
-{
- return rte_port_ring_writer_create_internal(params, socket_id, 1);
-}
-
-static inline void
-send_burst(struct rte_port_ring_writer *p)
-{
- uint32_t nb_tx;
-
- nb_tx = rte_ring_sp_enqueue_burst(p->ring, (void **)p->tx_buf,
- p->tx_buf_count, NULL);
-
- RTE_PORT_RING_WRITER_STATS_PKTS_DROP_ADD(p, p->tx_buf_count - nb_tx);
- for ( ; nb_tx < p->tx_buf_count; nb_tx++)
- rte_pktmbuf_free(p->tx_buf[nb_tx]);
-
- p->tx_buf_count = 0;
-}
-
-static inline void
-send_burst_mp(struct rte_port_ring_writer *p)
-{
- uint32_t nb_tx;
-
- nb_tx = rte_ring_mp_enqueue_burst(p->ring, (void **)p->tx_buf,
- p->tx_buf_count, NULL);
-
- RTE_PORT_RING_WRITER_STATS_PKTS_DROP_ADD(p, p->tx_buf_count - nb_tx);
- for ( ; nb_tx < p->tx_buf_count; nb_tx++)
- rte_pktmbuf_free(p->tx_buf[nb_tx]);
-
- p->tx_buf_count = 0;
-}
-
-static int
-rte_port_ring_writer_tx(void *port, struct rte_mbuf *pkt)
-{
- struct rte_port_ring_writer *p = port;
-
- p->tx_buf[p->tx_buf_count++] = pkt;
- RTE_PORT_RING_WRITER_STATS_PKTS_IN_ADD(p, 1);
- if (p->tx_buf_count >= p->tx_burst_sz)
- send_burst(p);
-
- return 0;
-}
-
-static int
-rte_port_ring_multi_writer_tx(void *port, struct rte_mbuf *pkt)
-{
- struct rte_port_ring_writer *p = port;
-
- p->tx_buf[p->tx_buf_count++] = pkt;
- RTE_PORT_RING_WRITER_STATS_PKTS_IN_ADD(p, 1);
- if (p->tx_buf_count >= p->tx_burst_sz)
- send_burst_mp(p);
-
- return 0;
-}
-
-static __rte_always_inline int
-rte_port_ring_writer_tx_bulk_internal(void *port,
- struct rte_mbuf **pkts,
- uint64_t pkts_mask,
- uint32_t is_multi)
-{
- struct rte_port_ring_writer *p =
- port;
-
- uint64_t bsz_mask = p->bsz_mask;
- uint32_t tx_buf_count = p->tx_buf_count;
- uint64_t expr = (pkts_mask & (pkts_mask + 1)) |
- ((pkts_mask & bsz_mask) ^ bsz_mask);
-
- if (expr == 0) {
- uint64_t n_pkts = rte_popcount64(pkts_mask);
- uint32_t n_pkts_ok;
-
- if (tx_buf_count) {
- if (is_multi)
- send_burst_mp(p);
- else
- send_burst(p);
- }
-
- RTE_PORT_RING_WRITER_STATS_PKTS_IN_ADD(p, n_pkts);
- if (is_multi)
- n_pkts_ok = rte_ring_mp_enqueue_burst(p->ring,
- (void **)pkts, n_pkts, NULL);
- else
- n_pkts_ok = rte_ring_sp_enqueue_burst(p->ring,
- (void **)pkts, n_pkts, NULL);
-
- RTE_PORT_RING_WRITER_STATS_PKTS_DROP_ADD(p, n_pkts - n_pkts_ok);
- for ( ; n_pkts_ok < n_pkts; n_pkts_ok++) {
- struct rte_mbuf *pkt = pkts[n_pkts_ok];
-
- rte_pktmbuf_free(pkt);
- }
- } else {
- for ( ; pkts_mask; ) {
- uint32_t pkt_index = rte_ctz64(pkts_mask);
- uint64_t pkt_mask = 1LLU << pkt_index;
- struct rte_mbuf *pkt = pkts[pkt_index];
-
- p->tx_buf[tx_buf_count++] = pkt;
- RTE_PORT_RING_WRITER_STATS_PKTS_IN_ADD(p, 1);
- pkts_mask &= ~pkt_mask;
- }
-
- p->tx_buf_count = tx_buf_count;
- if (tx_buf_count >= p->tx_burst_sz) {
- if (is_multi)
- send_burst_mp(p);
- else
- send_burst(p);
- }
- }
-
- return 0;
-}
-
-static int
-rte_port_ring_writer_tx_bulk(void *port,
- struct rte_mbuf **pkts,
- uint64_t pkts_mask)
-{
- return rte_port_ring_writer_tx_bulk_internal(port, pkts, pkts_mask, 0);
-}
-
-static int
-rte_port_ring_multi_writer_tx_bulk(void *port,
- struct rte_mbuf **pkts,
- uint64_t pkts_mask)
-{
- return rte_port_ring_writer_tx_bulk_internal(port, pkts, pkts_mask, 1);
-}
-
-static int
-rte_port_ring_writer_flush(void *port)
-{
- struct rte_port_ring_writer *p = port;
-
- if (p->tx_buf_count > 0)
- send_burst(p);
-
- return 0;
-}
-
-static int
-rte_port_ring_multi_writer_flush(void *port)
-{
- struct rte_port_ring_writer *p = port;
-
- if (p->tx_buf_count > 0)
- send_burst_mp(p);
-
- return 0;
-}
-
-static int
-rte_port_ring_writer_free(void *port)
-{
- struct rte_port_ring_writer *p = port;
-
- if (port == NULL) {
- PORT_LOG(ERR, "%s: Port is NULL", __func__);
- return -EINVAL;
- }
-
- if (p->is_multi)
- rte_port_ring_multi_writer_flush(port);
- else
- rte_port_ring_writer_flush(port);
-
- rte_free(port);
-
- return 0;
-}
-
-static int
-rte_port_ring_writer_stats_read(void *port,
- struct rte_port_out_stats *stats, int clear)
-{
- struct rte_port_ring_writer *p =
- port;
-
- if (stats != NULL)
- memcpy(stats, &p->stats, sizeof(p->stats));
-
- if (clear)
- memset(&p->stats, 0, sizeof(p->stats));
-
- return 0;
-}
-
-/*
- * Port RING Writer Nodrop
- */
-#ifdef RTE_PORT_STATS_COLLECT
-
-#define RTE_PORT_RING_WRITER_NODROP_STATS_PKTS_IN_ADD(port, val) \
- port->stats.n_pkts_in += val
-#define RTE_PORT_RING_WRITER_NODROP_STATS_PKTS_DROP_ADD(port, val) \
- port->stats.n_pkts_drop += val
-
-#else
-
-#define RTE_PORT_RING_WRITER_NODROP_STATS_PKTS_IN_ADD(port, val)
-#define RTE_PORT_RING_WRITER_NODROP_STATS_PKTS_DROP_ADD(port, val)
-
-#endif
-
-struct rte_port_ring_writer_nodrop {
- struct rte_port_out_stats stats;
-
- struct rte_mbuf *tx_buf[2 * RTE_PORT_IN_BURST_SIZE_MAX];
- struct rte_ring *ring;
- uint32_t tx_burst_sz;
- uint32_t tx_buf_count;
- uint64_t bsz_mask;
- uint64_t n_retries;
- uint32_t is_multi;
-};
-
-static void *
-rte_port_ring_writer_nodrop_create_internal(void *params, int socket_id,
- uint32_t is_multi)
-{
- struct rte_port_ring_writer_nodrop_params *conf =
- params;
- struct rte_port_ring_writer_nodrop *port;
-
- /* Check input parameters */
- if ((conf == NULL) ||
- (conf->ring == NULL) ||
- (rte_ring_is_prod_single(conf->ring) && is_multi) ||
- (!rte_ring_is_prod_single(conf->ring) && !is_multi) ||
- (conf->tx_burst_sz > RTE_PORT_IN_BURST_SIZE_MAX)) {
- PORT_LOG(ERR, "%s: Invalid Parameters", __func__);
- return NULL;
- }
-
- /* Memory allocation */
- port = rte_zmalloc_socket("PORT", sizeof(*port),
- RTE_CACHE_LINE_SIZE, socket_id);
- if (port == NULL) {
- PORT_LOG(ERR, "%s: Failed to allocate port", __func__);
- return NULL;
- }
-
- /* Initialization */
- port->ring = conf->ring;
- port->tx_burst_sz = conf->tx_burst_sz;
- port->tx_buf_count = 0;
- port->bsz_mask = 1LLU << (conf->tx_burst_sz - 1);
- port->is_multi = is_multi;
-
- /*
- * When n_retries is 0 it means that we should wait for every packet to
- * send no matter how many retries should it take. To limit number of
- * branches in fast path, we use UINT64_MAX instead of branching.
- */
- port->n_retries = (conf->n_retries == 0) ? UINT64_MAX : conf->n_retries;
-
- return port;
-}
-
-static void *
-rte_port_ring_writer_nodrop_create(void *params, int socket_id)
-{
- return rte_port_ring_writer_nodrop_create_internal(params, socket_id, 0);
-}
-
-static void *
-rte_port_ring_multi_writer_nodrop_create(void *params, int socket_id)
-{
- return rte_port_ring_writer_nodrop_create_internal(params, socket_id, 1);
-}
-
-static inline void
-send_burst_nodrop(struct rte_port_ring_writer_nodrop *p)
-{
- uint32_t nb_tx = 0, i;
-
- nb_tx = rte_ring_sp_enqueue_burst(p->ring, (void **)p->tx_buf,
- p->tx_buf_count, NULL);
-
- /* We sent all the packets in a first try */
- if (nb_tx >= p->tx_buf_count) {
- p->tx_buf_count = 0;
- return;
- }
-
- for (i = 0; i < p->n_retries; i++) {
- nb_tx += rte_ring_sp_enqueue_burst(p->ring,
- (void **) (p->tx_buf + nb_tx),
- p->tx_buf_count - nb_tx, NULL);
-
- /* We sent all the packets in more than one try */
- if (nb_tx >= p->tx_buf_count) {
- p->tx_buf_count = 0;
- return;
- }
- }
-
- /* We didn't send the packets in maximum allowed attempts */
- RTE_PORT_RING_WRITER_NODROP_STATS_PKTS_DROP_ADD(p, p->tx_buf_count - nb_tx);
- for ( ; nb_tx < p->tx_buf_count; nb_tx++)
- rte_pktmbuf_free(p->tx_buf[nb_tx]);
-
- p->tx_buf_count = 0;
-}
-
-static inline void
-send_burst_mp_nodrop(struct rte_port_ring_writer_nodrop *p)
-{
- uint32_t nb_tx = 0, i;
-
- nb_tx = rte_ring_mp_enqueue_burst(p->ring, (void **)p->tx_buf,
- p->tx_buf_count, NULL);
-
- /* We sent all the packets in a first try */
- if (nb_tx >= p->tx_buf_count) {
- p->tx_buf_count = 0;
- return;
- }
-
- for (i = 0; i < p->n_retries; i++) {
- nb_tx += rte_ring_mp_enqueue_burst(p->ring,
- (void **) (p->tx_buf + nb_tx),
- p->tx_buf_count - nb_tx, NULL);
-
- /* We sent all the packets in more than one try */
- if (nb_tx >= p->tx_buf_count) {
- p->tx_buf_count = 0;
- return;
- }
- }
-
- /* We didn't send the packets in maximum allowed attempts */
- RTE_PORT_RING_WRITER_NODROP_STATS_PKTS_DROP_ADD(p, p->tx_buf_count - nb_tx);
- for ( ; nb_tx < p->tx_buf_count; nb_tx++)
- rte_pktmbuf_free(p->tx_buf[nb_tx]);
-
- p->tx_buf_count = 0;
-}
-
-static int
-rte_port_ring_writer_nodrop_tx(void *port, struct rte_mbuf *pkt)
-{
- struct rte_port_ring_writer_nodrop *p =
- port;
-
- p->tx_buf[p->tx_buf_count++] = pkt;
- RTE_PORT_RING_WRITER_NODROP_STATS_PKTS_IN_ADD(p, 1);
- if (p->tx_buf_count >= p->tx_burst_sz)
- send_burst_nodrop(p);
-
- return 0;
-}
-
-static int
-rte_port_ring_multi_writer_nodrop_tx(void *port, struct rte_mbuf *pkt)
-{
- struct rte_port_ring_writer_nodrop *p =
- port;
-
- p->tx_buf[p->tx_buf_count++] = pkt;
- RTE_PORT_RING_WRITER_NODROP_STATS_PKTS_IN_ADD(p, 1);
- if (p->tx_buf_count >= p->tx_burst_sz)
- send_burst_mp_nodrop(p);
-
- return 0;
-}
-
-static __rte_always_inline int
-rte_port_ring_writer_nodrop_tx_bulk_internal(void *port,
- struct rte_mbuf **pkts,
- uint64_t pkts_mask,
- uint32_t is_multi)
-{
- struct rte_port_ring_writer_nodrop *p =
- port;
-
- uint64_t bsz_mask = p->bsz_mask;
- uint32_t tx_buf_count = p->tx_buf_count;
- uint64_t expr = (pkts_mask & (pkts_mask + 1)) |
- ((pkts_mask & bsz_mask) ^ bsz_mask);
-
- if (expr == 0) {
- uint64_t n_pkts = rte_popcount64(pkts_mask);
- uint32_t n_pkts_ok;
-
- if (tx_buf_count) {
- if (is_multi)
- send_burst_mp_nodrop(p);
- else
- send_burst_nodrop(p);
- }
-
- RTE_PORT_RING_WRITER_NODROP_STATS_PKTS_IN_ADD(p, n_pkts);
- if (is_multi)
- n_pkts_ok =
- rte_ring_mp_enqueue_burst(p->ring,
- (void **)pkts, n_pkts, NULL);
- else
- n_pkts_ok =
- rte_ring_sp_enqueue_burst(p->ring,
- (void **)pkts, n_pkts, NULL);
-
- if (n_pkts_ok >= n_pkts)
- return 0;
-
- /*
- * If we didn't manage to send all packets in single burst, move
- * remaining packets to the buffer and call send burst.
- */
- for (; n_pkts_ok < n_pkts; n_pkts_ok++) {
- struct rte_mbuf *pkt = pkts[n_pkts_ok];
-
- p->tx_buf[p->tx_buf_count++] = pkt;
- }
- if (is_multi)
- send_burst_mp_nodrop(p);
- else
- send_burst_nodrop(p);
- } else {
- for ( ; pkts_mask; ) {
- uint32_t pkt_index = rte_ctz64(pkts_mask);
- uint64_t pkt_mask = 1LLU << pkt_index;
- struct rte_mbuf *pkt = pkts[pkt_index];
-
- p->tx_buf[tx_buf_count++] = pkt;
- RTE_PORT_RING_WRITER_NODROP_STATS_PKTS_IN_ADD(p, 1);
- pkts_mask &= ~pkt_mask;
- }
-
- p->tx_buf_count = tx_buf_count;
- if (tx_buf_count >= p->tx_burst_sz) {
- if (is_multi)
- send_burst_mp_nodrop(p);
- else
- send_burst_nodrop(p);
- }
- }
-
- return 0;
-}
-
-static int
-rte_port_ring_writer_nodrop_tx_bulk(void *port,
- struct rte_mbuf **pkts,
- uint64_t pkts_mask)
-{
- return
- rte_port_ring_writer_nodrop_tx_bulk_internal(port, pkts, pkts_mask, 0);
-}
-
-static int
-rte_port_ring_multi_writer_nodrop_tx_bulk(void *port,
- struct rte_mbuf **pkts,
- uint64_t pkts_mask)
-{
- return
- rte_port_ring_writer_nodrop_tx_bulk_internal(port, pkts, pkts_mask, 1);
-}
-
-static int
-rte_port_ring_writer_nodrop_flush(void *port)
-{
- struct rte_port_ring_writer_nodrop *p =
- port;
-
- if (p->tx_buf_count > 0)
- send_burst_nodrop(p);
-
- return 0;
-}
-
-static int
-rte_port_ring_multi_writer_nodrop_flush(void *port)
-{
- struct rte_port_ring_writer_nodrop *p =
- port;
-
- if (p->tx_buf_count > 0)
- send_burst_mp_nodrop(p);
-
- return 0;
-}
-
-static int
-rte_port_ring_writer_nodrop_free(void *port)
-{
- struct rte_port_ring_writer_nodrop *p =
- port;
-
- if (port == NULL) {
- PORT_LOG(ERR, "%s: Port is NULL", __func__);
- return -EINVAL;
- }
-
- if (p->is_multi)
- rte_port_ring_multi_writer_nodrop_flush(port);
- else
- rte_port_ring_writer_nodrop_flush(port);
-
- rte_free(port);
-
- return 0;
-}
-
-static int
-rte_port_ring_writer_nodrop_stats_read(void *port,
- struct rte_port_out_stats *stats, int clear)
-{
- struct rte_port_ring_writer_nodrop *p =
- port;
-
- if (stats != NULL)
- memcpy(stats, &p->stats, sizeof(p->stats));
-
- if (clear)
- memset(&p->stats, 0, sizeof(p->stats));
-
- return 0;
-}
-
-/*
- * Summary of port operations
- */
-RTE_EXPORT_SYMBOL(rte_port_ring_reader_ops)
-struct rte_port_in_ops rte_port_ring_reader_ops = {
- .f_create = rte_port_ring_reader_create,
- .f_free = rte_port_ring_reader_free,
- .f_rx = rte_port_ring_reader_rx,
- .f_stats = rte_port_ring_reader_stats_read,
-};
-
-RTE_EXPORT_SYMBOL(rte_port_ring_writer_ops)
-struct rte_port_out_ops rte_port_ring_writer_ops = {
- .f_create = rte_port_ring_writer_create,
- .f_free = rte_port_ring_writer_free,
- .f_tx = rte_port_ring_writer_tx,
- .f_tx_bulk = rte_port_ring_writer_tx_bulk,
- .f_flush = rte_port_ring_writer_flush,
- .f_stats = rte_port_ring_writer_stats_read,
-};
-
-RTE_EXPORT_SYMBOL(rte_port_ring_writer_nodrop_ops)
-struct rte_port_out_ops rte_port_ring_writer_nodrop_ops = {
- .f_create = rte_port_ring_writer_nodrop_create,
- .f_free = rte_port_ring_writer_nodrop_free,
- .f_tx = rte_port_ring_writer_nodrop_tx,
- .f_tx_bulk = rte_port_ring_writer_nodrop_tx_bulk,
- .f_flush = rte_port_ring_writer_nodrop_flush,
- .f_stats = rte_port_ring_writer_nodrop_stats_read,
-};
-
-RTE_EXPORT_SYMBOL(rte_port_ring_multi_reader_ops)
-struct rte_port_in_ops rte_port_ring_multi_reader_ops = {
- .f_create = rte_port_ring_multi_reader_create,
- .f_free = rte_port_ring_reader_free,
- .f_rx = rte_port_ring_multi_reader_rx,
- .f_stats = rte_port_ring_reader_stats_read,
-};
-
-RTE_EXPORT_SYMBOL(rte_port_ring_multi_writer_ops)
-struct rte_port_out_ops rte_port_ring_multi_writer_ops = {
- .f_create = rte_port_ring_multi_writer_create,
- .f_free = rte_port_ring_writer_free,
- .f_tx = rte_port_ring_multi_writer_tx,
- .f_tx_bulk = rte_port_ring_multi_writer_tx_bulk,
- .f_flush = rte_port_ring_multi_writer_flush,
- .f_stats = rte_port_ring_writer_stats_read,
-};
-
-RTE_EXPORT_SYMBOL(rte_port_ring_multi_writer_nodrop_ops)
-struct rte_port_out_ops rte_port_ring_multi_writer_nodrop_ops = {
- .f_create = rte_port_ring_multi_writer_nodrop_create,
- .f_free = rte_port_ring_writer_nodrop_free,
- .f_tx = rte_port_ring_multi_writer_nodrop_tx,
- .f_tx_bulk = rte_port_ring_multi_writer_nodrop_tx_bulk,
- .f_flush = rte_port_ring_multi_writer_nodrop_flush,
- .f_stats = rte_port_ring_writer_nodrop_stats_read,
-};
diff --git a/lib/port/rte_port_ring.h b/lib/port/rte_port_ring.h
deleted file mode 100644
index 2089d0889b..0000000000
--- a/lib/port/rte_port_ring.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
- */
-
-#ifndef __INCLUDE_RTE_PORT_RING_H__
-#define __INCLUDE_RTE_PORT_RING_H__
-
-/**
- * @file
- * RTE Port Ring
- *
- * ring_reader:
- * input port built on top of pre-initialized single consumer ring
- * ring_writer:
- * output port built on top of pre-initialized single producer ring
- * ring_multi_reader:
- * input port built on top of pre-initialized multi consumers ring
- * ring_multi_writer:
- * output port built on top of pre-initialized multi producers ring
- */
-
-#include <stdint.h>
-
-#include "rte_port.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** ring_reader port parameters */
-struct rte_port_ring_reader_params {
- /** Underlying consumer ring that has to be pre-initialized */
- struct rte_ring *ring;
-};
-
-/** ring_reader port operations */
-extern struct rte_port_in_ops rte_port_ring_reader_ops;
-
-/** ring_writer port parameters */
-struct rte_port_ring_writer_params {
- /** Underlying producer ring that has to be pre-initialized */
- struct rte_ring *ring;
-
- /** Recommended burst size to ring. The actual burst size can be
- bigger or smaller than this value. */
- uint32_t tx_burst_sz;
-};
-
-/** ring_writer port operations */
-extern struct rte_port_out_ops rte_port_ring_writer_ops;
-
-/** ring_writer_nodrop port parameters */
-struct rte_port_ring_writer_nodrop_params {
- /** Underlying producer ring that has to be pre-initialized */
- struct rte_ring *ring;
-
- /** Recommended burst size to ring. The actual burst size can be
- bigger or smaller than this value. */
- uint32_t tx_burst_sz;
-
- /** Maximum number of retries, 0 for no limit */
- uint32_t n_retries;
-};
-
-/** ring_writer_nodrop port operations */
-extern struct rte_port_out_ops rte_port_ring_writer_nodrop_ops;
-
-/** ring_multi_reader port parameters */
-#define rte_port_ring_multi_reader_params rte_port_ring_reader_params
-
-/** ring_multi_reader port operations */
-extern struct rte_port_in_ops rte_port_ring_multi_reader_ops;
-
-/** ring_multi_writer port parameters */
-#define rte_port_ring_multi_writer_params rte_port_ring_writer_params
-
-/** ring_multi_writer port operations */
-extern struct rte_port_out_ops rte_port_ring_multi_writer_ops;
-
-/** ring_multi_writer_nodrop port parameters */
-#define rte_port_ring_multi_writer_nodrop_params \
- rte_port_ring_writer_nodrop_params
-
-/** ring_multi_writer_nodrop port operations */
-extern struct rte_port_out_ops rte_port_ring_multi_writer_nodrop_ops;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/port/rte_port_sched.c b/lib/port/rte_port_sched.c
deleted file mode 100644
index 3091078aa1..0000000000
--- a/lib/port/rte_port_sched.c
+++ /dev/null
@@ -1,298 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
- */
-#include <string.h>
-
-#include <eal_export.h>
-#include <rte_malloc.h>
-
-#include "rte_port_sched.h"
-
-#include "port_log.h"
-
-/*
- * Reader
- */
-#ifdef RTE_PORT_STATS_COLLECT
-
-#define RTE_PORT_SCHED_READER_PKTS_IN_ADD(port, val) \
- port->stats.n_pkts_in += val
-#define RTE_PORT_SCHED_READER_PKTS_DROP_ADD(port, val) \
- port->stats.n_pkts_drop += val
-
-#else
-
-#define RTE_PORT_SCHED_READER_PKTS_IN_ADD(port, val)
-#define RTE_PORT_SCHED_READER_PKTS_DROP_ADD(port, val)
-
-#endif
-
-struct rte_port_sched_reader {
- struct rte_port_in_stats stats;
-
- struct rte_sched_port *sched;
-};
-
-static void *
-rte_port_sched_reader_create(void *params, int socket_id)
-{
- struct rte_port_sched_reader_params *conf =
- params;
- struct rte_port_sched_reader *port;
-
- /* Check input parameters */
- if ((conf == NULL) ||
- (conf->sched == NULL)) {
- PORT_LOG(ERR, "%s: Invalid params", __func__);
- return NULL;
- }
-
- /* Memory allocation */
- port = rte_zmalloc_socket("PORT", sizeof(*port),
- RTE_CACHE_LINE_SIZE, socket_id);
- if (port == NULL) {
- PORT_LOG(ERR, "%s: Failed to allocate port", __func__);
- return NULL;
- }
-
- /* Initialization */
- port->sched = conf->sched;
-
- return port;
-}
-
-static int
-rte_port_sched_reader_rx(void *port, struct rte_mbuf **pkts, uint32_t n_pkts)
-{
- struct rte_port_sched_reader *p = port;
- uint32_t nb_rx;
-
- nb_rx = rte_sched_port_dequeue(p->sched, pkts, n_pkts);
- RTE_PORT_SCHED_READER_PKTS_IN_ADD(p, nb_rx);
-
- return nb_rx;
-}
-
-static int
-rte_port_sched_reader_free(void *port)
-{
- if (port == NULL) {
- PORT_LOG(ERR, "%s: port is NULL", __func__);
- return -EINVAL;
- }
-
- rte_free(port);
-
- return 0;
-}
-
-static int
-rte_port_sched_reader_stats_read(void *port,
- struct rte_port_in_stats *stats, int clear)
-{
- struct rte_port_sched_reader *p =
- port;
-
- if (stats != NULL)
- memcpy(stats, &p->stats, sizeof(p->stats));
-
- if (clear)
- memset(&p->stats, 0, sizeof(p->stats));
-
- return 0;
-}
-
-/*
- * Writer
- */
-#ifdef RTE_PORT_STATS_COLLECT
-
-#define RTE_PORT_SCHED_WRITER_STATS_PKTS_IN_ADD(port, val) \
- port->stats.n_pkts_in += val
-#define RTE_PORT_SCHED_WRITER_STATS_PKTS_DROP_ADD(port, val) \
- port->stats.n_pkts_drop += val
-
-#else
-
-#define RTE_PORT_SCHED_WRITER_STATS_PKTS_IN_ADD(port, val)
-#define RTE_PORT_SCHED_WRITER_STATS_PKTS_DROP_ADD(port, val)
-
-#endif
-
-struct rte_port_sched_writer {
- struct rte_port_out_stats stats;
-
- struct rte_mbuf *tx_buf[2 * RTE_PORT_IN_BURST_SIZE_MAX];
- struct rte_sched_port *sched;
- uint32_t tx_burst_sz;
- uint32_t tx_buf_count;
- uint64_t bsz_mask;
-};
-
-static void *
-rte_port_sched_writer_create(void *params, int socket_id)
-{
- struct rte_port_sched_writer_params *conf =
- params;
- struct rte_port_sched_writer *port;
-
- /* Check input parameters */
- if ((conf == NULL) ||
- (conf->sched == NULL) ||
- (conf->tx_burst_sz == 0) ||
- (conf->tx_burst_sz > RTE_PORT_IN_BURST_SIZE_MAX) ||
- (!rte_is_power_of_2(conf->tx_burst_sz))) {
- PORT_LOG(ERR, "%s: Invalid params", __func__);
- return NULL;
- }
-
- /* Memory allocation */
- port = rte_zmalloc_socket("PORT", sizeof(*port),
- RTE_CACHE_LINE_SIZE, socket_id);
- if (port == NULL) {
- PORT_LOG(ERR, "%s: Failed to allocate port", __func__);
- return NULL;
- }
-
- /* Initialization */
- port->sched = conf->sched;
- port->tx_burst_sz = conf->tx_burst_sz;
- port->tx_buf_count = 0;
- port->bsz_mask = 1LLU << (conf->tx_burst_sz - 1);
-
- return port;
-}
-
-static int
-rte_port_sched_writer_tx(void *port, struct rte_mbuf *pkt)
-{
- struct rte_port_sched_writer *p = (struct rte_port_sched_writer *) port;
-
- p->tx_buf[p->tx_buf_count++] = pkt;
- RTE_PORT_SCHED_WRITER_STATS_PKTS_IN_ADD(p, 1);
- if (p->tx_buf_count >= p->tx_burst_sz) {
- __rte_unused uint32_t nb_tx;
-
- nb_tx = rte_sched_port_enqueue(p->sched, p->tx_buf, p->tx_buf_count);
- RTE_PORT_SCHED_WRITER_STATS_PKTS_DROP_ADD(p, p->tx_buf_count - nb_tx);
- p->tx_buf_count = 0;
- }
-
- return 0;
-}
-
-static int
-rte_port_sched_writer_tx_bulk(void *port,
- struct rte_mbuf **pkts,
- uint64_t pkts_mask)
-{
- struct rte_port_sched_writer *p = (struct rte_port_sched_writer *) port;
- uint64_t bsz_mask = p->bsz_mask;
- uint32_t tx_buf_count = p->tx_buf_count;
- uint64_t expr = (pkts_mask & (pkts_mask + 1)) |
- ((pkts_mask & bsz_mask) ^ bsz_mask);
-
- if (expr == 0) {
- __rte_unused uint32_t nb_tx;
- uint64_t n_pkts = rte_popcount64(pkts_mask);
-
- if (tx_buf_count) {
- nb_tx = rte_sched_port_enqueue(p->sched, p->tx_buf,
- tx_buf_count);
- RTE_PORT_SCHED_WRITER_STATS_PKTS_DROP_ADD(p, tx_buf_count - nb_tx);
- p->tx_buf_count = 0;
- }
-
- nb_tx = rte_sched_port_enqueue(p->sched, pkts, n_pkts);
- RTE_PORT_SCHED_WRITER_STATS_PKTS_DROP_ADD(p, n_pkts - nb_tx);
- } else {
- for ( ; pkts_mask; ) {
- uint32_t pkt_index = rte_ctz64(pkts_mask);
- uint64_t pkt_mask = 1LLU << pkt_index;
- struct rte_mbuf *pkt = pkts[pkt_index];
-
- p->tx_buf[tx_buf_count++] = pkt;
- RTE_PORT_SCHED_WRITER_STATS_PKTS_IN_ADD(p, 1);
- pkts_mask &= ~pkt_mask;
- }
- p->tx_buf_count = tx_buf_count;
-
- if (tx_buf_count >= p->tx_burst_sz) {
- __rte_unused uint32_t nb_tx;
-
- nb_tx = rte_sched_port_enqueue(p->sched, p->tx_buf,
- tx_buf_count);
- RTE_PORT_SCHED_WRITER_STATS_PKTS_DROP_ADD(p, tx_buf_count - nb_tx);
- p->tx_buf_count = 0;
- }
- }
-
- return 0;
-}
-
-static int
-rte_port_sched_writer_flush(void *port)
-{
- struct rte_port_sched_writer *p = (struct rte_port_sched_writer *) port;
-
- if (p->tx_buf_count) {
- __rte_unused uint32_t nb_tx;
-
- nb_tx = rte_sched_port_enqueue(p->sched, p->tx_buf, p->tx_buf_count);
- RTE_PORT_SCHED_WRITER_STATS_PKTS_DROP_ADD(p, p->tx_buf_count - nb_tx);
- p->tx_buf_count = 0;
- }
-
- return 0;
-}
-
-static int
-rte_port_sched_writer_free(void *port)
-{
- if (port == NULL) {
- PORT_LOG(ERR, "%s: port is NULL", __func__);
- return -EINVAL;
- }
-
- rte_port_sched_writer_flush(port);
- rte_free(port);
-
- return 0;
-}
-
-static int
-rte_port_sched_writer_stats_read(void *port,
- struct rte_port_out_stats *stats, int clear)
-{
- struct rte_port_sched_writer *p =
- port;
-
- if (stats != NULL)
- memcpy(stats, &p->stats, sizeof(p->stats));
-
- if (clear)
- memset(&p->stats, 0, sizeof(p->stats));
-
- return 0;
-}
-
-/*
- * Summary of port operations
- */
-RTE_EXPORT_SYMBOL(rte_port_sched_reader_ops)
-struct rte_port_in_ops rte_port_sched_reader_ops = {
- .f_create = rte_port_sched_reader_create,
- .f_free = rte_port_sched_reader_free,
- .f_rx = rte_port_sched_reader_rx,
- .f_stats = rte_port_sched_reader_stats_read,
-};
-
-RTE_EXPORT_SYMBOL(rte_port_sched_writer_ops)
-struct rte_port_out_ops rte_port_sched_writer_ops = {
- .f_create = rte_port_sched_writer_create,
- .f_free = rte_port_sched_writer_free,
- .f_tx = rte_port_sched_writer_tx,
- .f_tx_bulk = rte_port_sched_writer_tx_bulk,
- .f_flush = rte_port_sched_writer_flush,
- .f_stats = rte_port_sched_writer_stats_read,
-};
diff --git a/lib/port/rte_port_sched.h b/lib/port/rte_port_sched.h
deleted file mode 100644
index 1bf08ae6a9..0000000000
--- a/lib/port/rte_port_sched.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
- */
-
-#ifndef __INCLUDE_RTE_PORT_SCHED_H__
-#define __INCLUDE_RTE_PORT_SCHED_H__
-
-/**
- * @file
- * RTE Port Hierarchical Scheduler
- *
- * sched_reader: input port built on top of pre-initialized rte_sched_port
- * sched_writer: output port built on top of pre-initialized rte_sched_port
- */
-
-#include <stdint.h>
-
-#include <rte_sched.h>
-
-#include "rte_port.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** sched_reader port parameters */
-struct rte_port_sched_reader_params {
- /** Underlying pre-initialized rte_sched_port */
- struct rte_sched_port *sched;
-};
-
-/** sched_reader port operations */
-extern struct rte_port_in_ops rte_port_sched_reader_ops;
-
-/** sched_writer port parameters */
-struct rte_port_sched_writer_params {
- /** Underlying pre-initialized rte_sched_port */
- struct rte_sched_port *sched;
-
- /** Recommended burst size. The actual burst size can be bigger or
- smaller than this value. */
- uint32_t tx_burst_sz;
-};
-
-/** sched_writer port operations */
-extern struct rte_port_out_ops rte_port_sched_writer_ops;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/port/rte_port_source_sink.c b/lib/port/rte_port_source_sink.c
deleted file mode 100644
index 0557e12506..0000000000
--- a/lib/port/rte_port_source_sink.c
+++ /dev/null
@@ -1,616 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2016 Intel Corporation
- */
-#include <stdint.h>
-#include <string.h>
-
-#include <eal_export.h>
-#include <rte_mbuf.h>
-#include <rte_malloc.h>
-#include <rte_memcpy.h>
-
-#ifdef RTE_PORT_PCAP
-#include <rte_ether.h>
-#include <pcap.h>
-#endif
-
-#include "rte_port_source_sink.h"
-
-#include "port_log.h"
-
-/*
- * Port SOURCE
- */
-#ifdef RTE_PORT_STATS_COLLECT
-
-#define RTE_PORT_SOURCE_STATS_PKTS_IN_ADD(port, val) \
- port->stats.n_pkts_in += val
-#define RTE_PORT_SOURCE_STATS_PKTS_DROP_ADD(port, val) \
- port->stats.n_pkts_drop += val
-
-#else
-
-#define RTE_PORT_SOURCE_STATS_PKTS_IN_ADD(port, val)
-#define RTE_PORT_SOURCE_STATS_PKTS_DROP_ADD(port, val)
-
-#endif
-
-struct rte_port_source {
- struct rte_port_in_stats stats;
-
- struct rte_mempool *mempool;
-
- /* PCAP buffers and indices */
- uint8_t **pkts;
- uint8_t *pkt_buff;
- uint32_t *pkt_len;
- uint32_t n_pkts;
- uint32_t pkt_index;
-};
-
-#ifdef RTE_PORT_PCAP
-
-static int
-pcap_source_load(struct rte_port_source *port,
- const char *file_name,
- uint32_t n_bytes_per_pkt,
- int socket_id)
-{
- uint32_t n_pkts = 0;
- uint32_t i;
- uint32_t *pkt_len_aligns = NULL;
- size_t total_buff_len = 0;
- pcap_t *pcap_handle;
- char pcap_errbuf[PCAP_ERRBUF_SIZE];
- uint32_t max_len;
- struct pcap_pkthdr pcap_hdr;
- const uint8_t *pkt;
- uint8_t *buff = NULL;
- uint32_t pktmbuf_maxlen = (uint32_t)
- (rte_pktmbuf_data_room_size(port->mempool) -
- RTE_PKTMBUF_HEADROOM);
-
- if (n_bytes_per_pkt == 0)
- max_len = pktmbuf_maxlen;
- else
- max_len = RTE_MIN(n_bytes_per_pkt, pktmbuf_maxlen);
-
- /* first time open, get packet number */
- pcap_handle = pcap_open_offline(file_name, pcap_errbuf);
- if (pcap_handle == NULL) {
- PORT_LOG(ERR, "Failed to open pcap file "
- "'%s' for reading", file_name);
- goto error_exit;
- }
-
- while ((pkt = pcap_next(pcap_handle, &pcap_hdr)) != NULL)
- n_pkts++;
-
- pcap_close(pcap_handle);
-
- port->pkt_len = rte_zmalloc_socket("PCAP",
- (sizeof(*port->pkt_len) * n_pkts), 0, socket_id);
- if (port->pkt_len == NULL) {
- PORT_LOG(ERR, "No enough memory");
- goto error_exit;
- }
-
- pkt_len_aligns = rte_malloc("PCAP",
- (sizeof(*pkt_len_aligns) * n_pkts), 0);
- if (pkt_len_aligns == NULL) {
- PORT_LOG(ERR, "No enough memory");
- goto error_exit;
- }
-
- port->pkts = rte_zmalloc_socket("PCAP",
- (sizeof(*port->pkts) * n_pkts), 0, socket_id);
- if (port->pkts == NULL) {
- PORT_LOG(ERR, "No enough memory");
- goto error_exit;
- }
-
- /* open 2nd time, get pkt_len */
- pcap_handle = pcap_open_offline(file_name, pcap_errbuf);
- if (pcap_handle == NULL) {
- PORT_LOG(ERR, "Failed to open pcap file "
- "'%s' for reading", file_name);
- goto error_exit;
- }
-
- for (i = 0; i < n_pkts; i++) {
- pcap_next(pcap_handle, &pcap_hdr);
- port->pkt_len[i] = RTE_MIN(max_len, pcap_hdr.len);
- pkt_len_aligns[i] = RTE_CACHE_LINE_ROUNDUP(
- port->pkt_len[i]);
- total_buff_len += pkt_len_aligns[i];
- }
-
- pcap_close(pcap_handle);
-
- /* allocate a big trunk of data for pcap file load */
- buff = rte_zmalloc_socket("PCAP",
- total_buff_len, 0, socket_id);
- if (buff == NULL) {
- PORT_LOG(ERR, "No enough memory");
- goto error_exit;
- }
-
- port->pkt_buff = buff;
-
- /* open file one last time to copy the pkt content */
- pcap_handle = pcap_open_offline(file_name, pcap_errbuf);
- if (pcap_handle == NULL) {
- PORT_LOG(ERR, "Failed to open pcap file "
- "'%s' for reading", file_name);
- goto error_exit;
- }
-
- for (i = 0; i < n_pkts; i++) {
- pkt = pcap_next(pcap_handle, &pcap_hdr);
- rte_memcpy(buff, pkt, port->pkt_len[i]);
- port->pkts[i] = buff;
- buff += pkt_len_aligns[i];
- }
-
- pcap_close(pcap_handle);
-
- port->n_pkts = n_pkts;
-
- rte_free(pkt_len_aligns);
-
- PORT_LOG(INFO, "Successfully load pcap file "
- "'%s' with %u pkts",
- file_name, port->n_pkts);
-
- return 0;
-
-error_exit:
- rte_free(pkt_len_aligns);
- rte_free(port->pkt_len);
- rte_free(port->pkts);
- rte_free(port->pkt_buff);
-
- return -1;
-}
-
-#define PCAP_SOURCE_LOAD(port, file_name, n_bytes, socket_id) \
- pcap_source_load(port, file_name, n_bytes, socket_id)
-
-#else /* RTE_PORT_PCAP */
-
-#define PCAP_SOURCE_LOAD(port, file_name, n_bytes, socket_id) \
-__extension__ ({ \
- int _ret = 0; \
- \
- if (file_name) { \
- PORT_LOG(ERR, "Source port field " \
- "\"file_name\" is not NULL."); \
- _ret = -1; \
- } \
- \
- _ret; \
-})
-
-#endif /* RTE_PORT_PCAP */
-
-static void *
-rte_port_source_create(void *params, int socket_id)
-{
- struct rte_port_source_params *p =
- params;
- struct rte_port_source *port;
-
- /* Check input arguments*/
- if ((p == NULL) || (p->mempool == NULL)) {
- PORT_LOG(ERR, "%s: Invalid params", __func__);
- return NULL;
- }
-
- /* Memory allocation */
- port = rte_zmalloc_socket("PORT", sizeof(*port),
- RTE_CACHE_LINE_SIZE, socket_id);
- if (port == NULL) {
- PORT_LOG(ERR, "%s: Failed to allocate port", __func__);
- return NULL;
- }
-
- /* Initialization */
- port->mempool = (struct rte_mempool *) p->mempool;
-
- if (p->file_name) {
- int status = PCAP_SOURCE_LOAD(port, p->file_name,
- p->n_bytes_per_pkt, socket_id);
-
- if (status < 0) {
- rte_free(port);
- port = NULL;
- }
- }
-
- return port;
-}
-
-static int
-rte_port_source_free(void *port)
-{
- struct rte_port_source *p =
- port;
-
- /* Check input parameters */
- if (p == NULL)
- return 0;
-
- rte_free(p->pkt_len);
- rte_free(p->pkts);
- rte_free(p->pkt_buff);
-
- rte_free(p);
-
- return 0;
-}
-
-static int
-rte_port_source_rx(void *port, struct rte_mbuf **pkts, uint32_t n_pkts)
-{
- struct rte_port_source *p = port;
- uint32_t i;
-
- if (rte_pktmbuf_alloc_bulk(p->mempool, pkts, n_pkts) != 0)
- return 0;
-
- if (p->pkt_buff != NULL) {
- for (i = 0; i < n_pkts; i++) {
- uint8_t *pkt_data = rte_pktmbuf_mtod(pkts[i],
- uint8_t *);
-
- rte_memcpy(pkt_data, p->pkts[p->pkt_index],
- p->pkt_len[p->pkt_index]);
- pkts[i]->data_len = p->pkt_len[p->pkt_index];
- pkts[i]->pkt_len = pkts[i]->data_len;
-
- p->pkt_index++;
- if (p->pkt_index >= p->n_pkts)
- p->pkt_index = 0;
- }
- }
-
- RTE_PORT_SOURCE_STATS_PKTS_IN_ADD(p, n_pkts);
-
- return n_pkts;
-}
-
-static int
-rte_port_source_stats_read(void *port,
- struct rte_port_in_stats *stats, int clear)
-{
- struct rte_port_source *p =
- port;
-
- if (stats != NULL)
- memcpy(stats, &p->stats, sizeof(p->stats));
-
- if (clear)
- memset(&p->stats, 0, sizeof(p->stats));
-
- return 0;
-}
-
-/*
- * Port SINK
- */
-#ifdef RTE_PORT_STATS_COLLECT
-
-#define RTE_PORT_SINK_STATS_PKTS_IN_ADD(port, val) \
- (port->stats.n_pkts_in += val)
-#define RTE_PORT_SINK_STATS_PKTS_DROP_ADD(port, val) \
- (port->stats.n_pkts_drop += val)
-
-#else
-
-#define RTE_PORT_SINK_STATS_PKTS_IN_ADD(port, val)
-#define RTE_PORT_SINK_STATS_PKTS_DROP_ADD(port, val)
-
-#endif
-
-struct rte_port_sink {
- struct rte_port_out_stats stats;
-
- /* PCAP dumper handle and pkts number */
- void *dumper;
- uint32_t max_pkts;
- uint32_t pkt_index;
- uint32_t dump_finish;
-};
-
-#ifdef RTE_PORT_PCAP
-
-static int
-pcap_sink_open(struct rte_port_sink *port,
- const char *file_name,
- uint32_t max_n_pkts)
-{
- pcap_t *tx_pcap;
- pcap_dumper_t *pcap_dumper;
-
- /** Open a dead pcap handler for opening dumper file */
- tx_pcap = pcap_open_dead(DLT_EN10MB, 65535);
- if (tx_pcap == NULL) {
- PORT_LOG(ERR, "Cannot open pcap dead handler");
- return -1;
- }
-
- /* The dumper is created using the previous pcap_t reference */
- pcap_dumper = pcap_dump_open(tx_pcap, file_name);
- if (pcap_dumper == NULL) {
- PORT_LOG(ERR, "Failed to open pcap file "
- "\"%s\" for writing", file_name);
- return -1;
- }
-
- port->dumper = pcap_dumper;
- port->max_pkts = max_n_pkts;
- port->pkt_index = 0;
- port->dump_finish = 0;
-
- PORT_LOG(INFO, "Ready to dump packets to file \"%s\"",
- file_name);
-
- return 0;
-}
-
-static void
-pcap_sink_write_pkt(struct rte_port_sink *port, struct rte_mbuf *mbuf)
-{
- uint8_t *pcap_dumper = (port->dumper);
- struct pcap_pkthdr pcap_hdr;
- uint8_t jumbo_pkt_buf[RTE_ETHER_MAX_JUMBO_FRAME_LEN];
- uint8_t *pkt;
-
- /* Maximum num packets already reached */
- if (port->dump_finish)
- return;
-
- pkt = rte_pktmbuf_mtod(mbuf, uint8_t *);
-
- pcap_hdr.len = mbuf->pkt_len;
- pcap_hdr.caplen = pcap_hdr.len;
- gettimeofday(&(pcap_hdr.ts), NULL);
-
- if (mbuf->nb_segs > 1) {
- struct rte_mbuf *jumbo_mbuf;
- uint32_t pkt_index = 0;
-
- /* if packet size longer than RTE_ETHER_MAX_JUMBO_FRAME_LEN,
- * ignore it.
- */
- if (mbuf->pkt_len > RTE_ETHER_MAX_JUMBO_FRAME_LEN)
- return;
-
- for (jumbo_mbuf = mbuf; jumbo_mbuf != NULL;
- jumbo_mbuf = jumbo_mbuf->next) {
- rte_memcpy(&jumbo_pkt_buf[pkt_index],
- rte_pktmbuf_mtod(jumbo_mbuf, uint8_t *),
- jumbo_mbuf->data_len);
- pkt_index += jumbo_mbuf->data_len;
- }
-
- jumbo_pkt_buf[pkt_index] = '\0';
-
- pkt = jumbo_pkt_buf;
- }
-
- pcap_dump(pcap_dumper, &pcap_hdr, pkt);
-
- port->pkt_index++;
-
- if ((port->max_pkts != 0) && (port->pkt_index >= port->max_pkts)) {
- port->dump_finish = 1;
- PORT_LOG(INFO, "Dumped %u packets to file",
- port->pkt_index);
- }
-
-}
-
-#define PCAP_SINK_OPEN(port, file_name, max_n_pkts) \
- pcap_sink_open(port, file_name, max_n_pkts)
-
-#define PCAP_SINK_WRITE_PKT(port, mbuf) \
- pcap_sink_write_pkt(port, mbuf)
-
-#define PCAP_SINK_FLUSH_PKT(dumper) \
-do { \
- if (dumper) \
- pcap_dump_flush((pcap_dumper_t *)dumper); \
-} while (0)
-
-#define PCAP_SINK_CLOSE(dumper) \
-do { \
- if (dumper) \
- pcap_dump_close((pcap_dumper_t *)dumper); \
-} while (0)
-
-#else
-
-#define PCAP_SINK_OPEN(port, file_name, max_n_pkts) \
-__extension__ ({ \
- int _ret = 0; \
- \
- if (file_name) { \
- PORT_LOG(ERR, "Sink port field " \
- "\"file_name\" is not NULL."); \
- _ret = -1; \
- } \
- \
- _ret; \
-})
-
-#define PCAP_SINK_WRITE_PKT(port, mbuf) {}
-
-#define PCAP_SINK_FLUSH_PKT(dumper)
-
-#define PCAP_SINK_CLOSE(dumper)
-
-#endif
-
-static void *
-rte_port_sink_create(void *params, int socket_id)
-{
- struct rte_port_sink *port;
- struct rte_port_sink_params *p = params;
-
- /* Memory allocation */
- port = rte_zmalloc_socket("PORT", sizeof(*port),
- RTE_CACHE_LINE_SIZE, socket_id);
- if (port == NULL) {
- PORT_LOG(ERR, "%s: Failed to allocate port", __func__);
- return NULL;
- }
-
- if (!p)
- return port;
-
- if (p->file_name) {
- int status = PCAP_SINK_OPEN(port, p->file_name,
- p->max_n_pkts);
-
- if (status < 0) {
- rte_free(port);
- port = NULL;
- }
- }
-
- return port;
-}
-
-static int
-rte_port_sink_tx(void *port, struct rte_mbuf *pkt)
-{
- struct rte_port_sink *p = port;
-
- RTE_PORT_SINK_STATS_PKTS_IN_ADD(p, 1);
- if (p->dumper != NULL)
- PCAP_SINK_WRITE_PKT(p, pkt);
- rte_pktmbuf_free(pkt);
- RTE_PORT_SINK_STATS_PKTS_DROP_ADD(p, 1);
-
- return 0;
-}
-
-static int
-rte_port_sink_tx_bulk(void *port, struct rte_mbuf **pkts,
- uint64_t pkts_mask)
-{
- struct rte_port_sink *p = port;
-
- if ((pkts_mask & (pkts_mask + 1)) == 0) {
- uint64_t n_pkts = rte_popcount64(pkts_mask);
- uint32_t i;
-
- RTE_PORT_SINK_STATS_PKTS_IN_ADD(p, n_pkts);
- RTE_PORT_SINK_STATS_PKTS_DROP_ADD(p, n_pkts);
-
- if (p->dumper) {
- for (i = 0; i < n_pkts; i++)
- PCAP_SINK_WRITE_PKT(p, pkts[i]);
- }
-
- for (i = 0; i < n_pkts; i++) {
- struct rte_mbuf *pkt = pkts[i];
-
- rte_pktmbuf_free(pkt);
- }
-
- } else {
- if (p->dumper) {
- uint64_t dump_pkts_mask = pkts_mask;
- uint32_t pkt_index;
-
- for ( ; dump_pkts_mask; ) {
- pkt_index = rte_ctz64(
- dump_pkts_mask);
- PCAP_SINK_WRITE_PKT(p, pkts[pkt_index]);
- dump_pkts_mask &= ~(1LLU << pkt_index);
- }
- }
-
- for ( ; pkts_mask; ) {
- uint32_t pkt_index = rte_ctz64(pkts_mask);
- uint64_t pkt_mask = 1LLU << pkt_index;
- struct rte_mbuf *pkt = pkts[pkt_index];
-
- RTE_PORT_SINK_STATS_PKTS_IN_ADD(p, 1);
- RTE_PORT_SINK_STATS_PKTS_DROP_ADD(p, 1);
- rte_pktmbuf_free(pkt);
- pkts_mask &= ~pkt_mask;
- }
- }
-
- return 0;
-}
-
-static int
-rte_port_sink_flush(void *port)
-{
- struct rte_port_sink *p =
- port;
-
- if (p == NULL)
- return 0;
-
- PCAP_SINK_FLUSH_PKT(p->dumper);
-
- return 0;
-}
-
-static int
-rte_port_sink_free(void *port)
-{
- struct rte_port_sink *p =
- port;
-
- if (p == NULL)
- return 0;
-
- PCAP_SINK_CLOSE(p->dumper);
-
- rte_free(p);
-
- return 0;
-}
-
-static int
-rte_port_sink_stats_read(void *port, struct rte_port_out_stats *stats,
- int clear)
-{
- struct rte_port_sink *p =
- port;
-
- if (stats != NULL)
- memcpy(stats, &p->stats, sizeof(p->stats));
-
- if (clear)
- memset(&p->stats, 0, sizeof(p->stats));
-
- return 0;
-}
-
-/*
- * Summary of port operations
- */
-RTE_EXPORT_SYMBOL(rte_port_source_ops)
-struct rte_port_in_ops rte_port_source_ops = {
- .f_create = rte_port_source_create,
- .f_free = rte_port_source_free,
- .f_rx = rte_port_source_rx,
- .f_stats = rte_port_source_stats_read,
-};
-
-RTE_EXPORT_SYMBOL(rte_port_sink_ops)
-struct rte_port_out_ops rte_port_sink_ops = {
- .f_create = rte_port_sink_create,
- .f_free = rte_port_sink_free,
- .f_tx = rte_port_sink_tx,
- .f_tx_bulk = rte_port_sink_tx_bulk,
- .f_flush = rte_port_sink_flush,
- .f_stats = rte_port_sink_stats_read,
-};
diff --git a/lib/port/rte_port_source_sink.h b/lib/port/rte_port_source_sink.h
deleted file mode 100644
index 3122dd5038..0000000000
--- a/lib/port/rte_port_source_sink.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2016 Intel Corporation
- */
-
-#ifndef __INCLUDE_RTE_PORT_SOURCE_SINK_H__
-#define __INCLUDE_RTE_PORT_SOURCE_SINK_H__
-
-/**
- * @file
- * RTE Port Source/Sink
- *
- * source: input port that can be used to generate packets
- * sink: output port that drops all packets written to it
- */
-
-#include "rte_port.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** source port parameters */
-struct rte_port_source_params {
- /** Pre-initialized buffer pool */
- struct rte_mempool *mempool;
-
- /** The full path of the pcap file to read packets from */
- const char *file_name;
- /** The number of bytes to be read from each packet in the
- * pcap file. If this value is 0, the whole packet is read;
- * if it is bigger than packet size, the generated packets
- * will contain the whole packet */
- uint32_t n_bytes_per_pkt;
-};
-
-/** source port operations */
-extern struct rte_port_in_ops rte_port_source_ops;
-
-/** sink port parameters */
-struct rte_port_sink_params {
- /** The full path of the pcap file to write the packets to */
- const char *file_name;
- /** The maximum number of packets write to the pcap file.
- * If this value is 0, the "infinite" write will be carried
- * out.
- */
- uint32_t max_n_pkts;
-};
-
-/** sink port operations */
-extern struct rte_port_out_ops rte_port_sink_ops;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/port/rte_port_sym_crypto.c b/lib/port/rte_port_sym_crypto.c
deleted file mode 100644
index 30c9d1283e..0000000000
--- a/lib/port/rte_port_sym_crypto.c
+++ /dev/null
@@ -1,558 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2018 Intel Corporation
- */
-#include <string.h>
-
-#include <eal_export.h>
-#include <rte_common.h>
-#include <rte_malloc.h>
-
-#include "rte_port_sym_crypto.h"
-
-#include "port_log.h"
-
-/*
- * Port Crypto Reader
- */
-#ifdef RTE_PORT_STATS_COLLECT
-
-#define RTE_PORT_SYM_CRYPTO_READER_STATS_PKTS_IN_ADD(port, val) \
- (port)->stats.n_pkts_in += (val)
-#define RTE_PORT_SYM_CRYPTO_READER_STATS_PKTS_DROP_ADD(port, val) \
- (port)->stats.n_pkts_drop += (val)
-
-#else
-
-#define RTE_PORT_SYM_CRYPTO_READER_STATS_PKTS_IN_ADD(port, val)
-#define RTE_PORT_SYM_CRYPTO_READER_STATS_PKTS_DROP_ADD(port, val)
-
-#endif
-
-struct rte_port_sym_crypto_reader {
- struct rte_port_in_stats stats;
-
- uint8_t cryptodev_id;
- uint16_t queue_id;
- struct rte_crypto_op *ops[RTE_PORT_IN_BURST_SIZE_MAX];
- rte_port_sym_crypto_reader_callback_fn f_callback;
- void *arg_callback;
-};
-
-static void *
-rte_port_sym_crypto_reader_create(void *params, int socket_id)
-{
- struct rte_port_sym_crypto_reader_params *conf =
- params;
- struct rte_port_sym_crypto_reader *port;
-
- /* Check input parameters */
- if (conf == NULL) {
- PORT_LOG(ERR, "%s: params is NULL", __func__);
- return NULL;
- }
-
- /* Memory allocation */
- port = rte_zmalloc_socket("PORT", sizeof(*port),
- RTE_CACHE_LINE_SIZE, socket_id);
- if (port == NULL) {
- PORT_LOG(ERR, "%s: Failed to allocate port", __func__);
- return NULL;
- }
-
- /* Initialization */
- port->cryptodev_id = conf->cryptodev_id;
- port->queue_id = conf->queue_id;
- port->f_callback = conf->f_callback;
- port->arg_callback = conf->arg_callback;
-
- return port;
-}
-
-static int
-rte_port_sym_crypto_reader_rx(void *port, struct rte_mbuf **pkts, uint32_t n_pkts)
-{
- struct rte_port_sym_crypto_reader *p =
- port;
- uint16_t rx_ops_cnt, i, n = 0;
-
- rx_ops_cnt = rte_cryptodev_dequeue_burst(p->cryptodev_id, p->queue_id,
- p->ops, n_pkts);
-
- for (i = 0; i < rx_ops_cnt; i++) {
- struct rte_crypto_op *op = p->ops[i];
-
- /** Drop failed pkts */
- if (unlikely(op->status != RTE_CRYPTO_OP_STATUS_SUCCESS)) {
- rte_pktmbuf_free(op->sym->m_src);
- continue;
- }
-
- pkts[n++] = op->sym->m_src;
- }
-
- if (p->f_callback)
- (*p->f_callback)(pkts, n, p->arg_callback);
-
- RTE_PORT_SYM_CRYPTO_READER_STATS_PKTS_IN_ADD(p, n);
- RTE_PORT_SYM_CRYPTO_READER_STATS_PKTS_DROP_ADD(p, rx_ops_cnt - n);
-
- return n;
-}
-
-static int
-rte_port_sym_crypto_reader_free(void *port)
-{
- if (port == NULL) {
- PORT_LOG(ERR, "%s: port is NULL", __func__);
- return -EINVAL;
- }
-
- rte_free(port);
-
- return 0;
-}
-
-static int rte_port_sym_crypto_reader_stats_read(void *port,
- struct rte_port_in_stats *stats, int clear)
-{
- struct rte_port_sym_crypto_reader *p =
- port;
-
- if (stats != NULL)
- memcpy(stats, &p->stats, sizeof(p->stats));
-
- if (clear)
- memset(&p->stats, 0, sizeof(p->stats));
-
- return 0;
-}
-
-/*
- * Port crypto Writer
- */
-#ifdef RTE_PORT_STATS_COLLECT
-
-#define RTE_PORT_SYM_CRYPTO_WRITER_STATS_PKTS_IN_ADD(port, val) \
- (port)->stats.n_pkts_in += (val)
-#define RTE_PORT_SYM_CRYPTO_WRITER_STATS_PKTS_DROP_ADD(port, val) \
- (port)->stats.n_pkts_drop += (val)
-
-#else
-
-#define RTE_PORT_SYM_CRYPTO_WRITER_STATS_PKTS_IN_ADD(port, val)
-#define RTE_PORT_SYM_CRYPTO_WRITER_STATS_PKTS_DROP_ADD(port, val)
-
-#endif
-
-struct rte_port_sym_crypto_writer {
- struct rte_port_out_stats stats;
-
- struct rte_crypto_op *tx_buf[2 * RTE_PORT_IN_BURST_SIZE_MAX];
-
- uint32_t tx_burst_sz;
- uint32_t tx_buf_count;
- uint64_t bsz_mask;
-
- uint8_t cryptodev_id;
- uint16_t queue_id;
- uint16_t crypto_op_offset;
-};
-
-static void *
-rte_port_sym_crypto_writer_create(void *params, int socket_id)
-{
- struct rte_port_sym_crypto_writer_params *conf =
- params;
- struct rte_port_sym_crypto_writer *port;
-
- /* Check input parameters */
- if ((conf == NULL) ||
- (conf->tx_burst_sz == 0) ||
- (conf->tx_burst_sz > RTE_PORT_IN_BURST_SIZE_MAX) ||
- (!rte_is_power_of_2(conf->tx_burst_sz))) {
- PORT_LOG(ERR, "%s: Invalid input parameters", __func__);
- return NULL;
- }
-
- /* Memory allocation */
- port = rte_zmalloc_socket("PORT", sizeof(*port),
- RTE_CACHE_LINE_SIZE, socket_id);
- if (port == NULL) {
- PORT_LOG(ERR, "%s: Failed to allocate port", __func__);
- return NULL;
- }
-
- /* Initialization */
- port->tx_burst_sz = conf->tx_burst_sz;
- port->tx_buf_count = 0;
- port->bsz_mask = 1LLU << (conf->tx_burst_sz - 1);
-
- port->cryptodev_id = conf->cryptodev_id;
- port->queue_id = conf->queue_id;
- port->crypto_op_offset = conf->crypto_op_offset;
-
- return port;
-}
-
-static inline void
-send_burst(struct rte_port_sym_crypto_writer *p)
-{
- uint32_t nb_tx;
-
- nb_tx = rte_cryptodev_enqueue_burst(p->cryptodev_id, p->queue_id,
- p->tx_buf, p->tx_buf_count);
-
- RTE_PORT_SYM_CRYPTO_WRITER_STATS_PKTS_DROP_ADD(p, p->tx_buf_count -
- nb_tx);
- for (; nb_tx < p->tx_buf_count; nb_tx++)
- rte_pktmbuf_free(p->tx_buf[nb_tx]->sym->m_src);
-
- p->tx_buf_count = 0;
-}
-
-static int
-rte_port_sym_crypto_writer_tx(void *port, struct rte_mbuf *pkt)
-{
- struct rte_port_sym_crypto_writer *p =
- port;
-
- p->tx_buf[p->tx_buf_count++] = (struct rte_crypto_op *)
- RTE_MBUF_METADATA_UINT8_PTR(pkt, p->crypto_op_offset);
- RTE_PORT_SYM_CRYPTO_WRITER_STATS_PKTS_IN_ADD(p, 1);
- if (p->tx_buf_count >= p->tx_burst_sz)
- send_burst(p);
-
- return 0;
-}
-
-static int
-rte_port_sym_crypto_writer_tx_bulk(void *port,
- struct rte_mbuf **pkts,
- uint64_t pkts_mask)
-{
- struct rte_port_sym_crypto_writer *p =
- port;
- uint64_t bsz_mask = p->bsz_mask;
- uint32_t tx_buf_count = p->tx_buf_count;
- uint64_t expr = (pkts_mask & (pkts_mask + 1)) |
- ((pkts_mask & bsz_mask) ^ bsz_mask);
-
- if (expr == 0) {
- uint64_t n_pkts = rte_popcount64(pkts_mask);
- uint32_t i;
-
- RTE_PORT_SYM_CRYPTO_WRITER_STATS_PKTS_IN_ADD(p, n_pkts);
-
- for (i = 0; i < n_pkts; i++)
- p->tx_buf[p->tx_buf_count++] = (struct rte_crypto_op *)
- RTE_MBUF_METADATA_UINT8_PTR(pkts[i],
- p->crypto_op_offset);
-
- if (p->tx_buf_count >= p->tx_burst_sz)
- send_burst(p);
- } else {
- for (; pkts_mask;) {
- uint32_t pkt_index = rte_ctz64(pkts_mask);
- uint64_t pkt_mask = 1LLU << pkt_index;
- struct rte_mbuf *pkt = pkts[pkt_index];
-
- p->tx_buf[tx_buf_count++] = (struct rte_crypto_op *)
- RTE_MBUF_METADATA_UINT8_PTR(pkt,
- p->crypto_op_offset);
-
- RTE_PORT_SYM_CRYPTO_WRITER_STATS_PKTS_IN_ADD(p, 1);
- pkts_mask &= ~pkt_mask;
- }
-
- p->tx_buf_count = tx_buf_count;
- if (tx_buf_count >= p->tx_burst_sz)
- send_burst(p);
- }
-
- return 0;
-}
-
-static int
-rte_port_sym_crypto_writer_flush(void *port)
-{
- struct rte_port_sym_crypto_writer *p =
- port;
-
- if (p->tx_buf_count > 0)
- send_burst(p);
-
- return 0;
-}
-
-static int
-rte_port_sym_crypto_writer_free(void *port)
-{
- if (port == NULL) {
- PORT_LOG(ERR, "%s: Port is NULL", __func__);
- return -EINVAL;
- }
-
- rte_port_sym_crypto_writer_flush(port);
- rte_free(port);
-
- return 0;
-}
-
-static int rte_port_sym_crypto_writer_stats_read(void *port,
- struct rte_port_out_stats *stats, int clear)
-{
- struct rte_port_sym_crypto_writer *p =
- port;
-
- if (stats != NULL)
- memcpy(stats, &p->stats, sizeof(p->stats));
-
- if (clear)
- memset(&p->stats, 0, sizeof(p->stats));
-
- return 0;
-}
-
-/*
- * Port crypto Writer Nodrop
- */
-#ifdef RTE_PORT_STATS_COLLECT
-
-#define RTE_PORT_SYM_CRYPTO_WRITER_NODROP_STATS_PKTS_IN_ADD(port, val) \
- (port)->stats.n_pkts_in += (val)
-#define RTE_PORT_SYM_CRYPTO_WRITER_NODROP_STATS_PKTS_DROP_ADD(port, val) \
- (port)->stats.n_pkts_drop += (val)
-
-#else
-
-#define RTE_PORT_SYM_CRYPTO_WRITER_NODROP_STATS_PKTS_IN_ADD(port, val)
-#define RTE_PORT_SYM_CRYPTO_WRITER_NODROP_STATS_PKTS_DROP_ADD(port, val)
-
-#endif
-
-struct rte_port_sym_crypto_writer_nodrop {
- struct rte_port_out_stats stats;
-
- struct rte_crypto_op *tx_buf[2 * RTE_PORT_IN_BURST_SIZE_MAX];
- uint32_t tx_burst_sz;
- uint32_t tx_buf_count;
- uint64_t bsz_mask;
- uint64_t n_retries;
-
- uint8_t cryptodev_id;
- uint16_t queue_id;
- uint16_t crypto_op_offset;
-};
-
-static void *
-rte_port_sym_crypto_writer_nodrop_create(void *params, int socket_id)
-{
- struct rte_port_sym_crypto_writer_nodrop_params *conf =
- params;
- struct rte_port_sym_crypto_writer_nodrop *port;
-
- /* Check input parameters */
- if ((conf == NULL) ||
- (conf->tx_burst_sz == 0) ||
- (conf->tx_burst_sz > RTE_PORT_IN_BURST_SIZE_MAX) ||
- (!rte_is_power_of_2(conf->tx_burst_sz))) {
- PORT_LOG(ERR, "%s: Invalid input parameters", __func__);
- return NULL;
- }
-
- /* Memory allocation */
- port = rte_zmalloc_socket("PORT", sizeof(*port),
- RTE_CACHE_LINE_SIZE, socket_id);
- if (port == NULL) {
- PORT_LOG(ERR, "%s: Failed to allocate port", __func__);
- return NULL;
- }
-
- /* Initialization */
- port->cryptodev_id = conf->cryptodev_id;
- port->queue_id = conf->queue_id;
- port->crypto_op_offset = conf->crypto_op_offset;
- port->tx_burst_sz = conf->tx_burst_sz;
- port->tx_buf_count = 0;
- port->bsz_mask = 1LLU << (conf->tx_burst_sz - 1);
-
- /*
- * When n_retries is 0 it means that we should wait for every packet to
- * send no matter how many retries should it take. To limit number of
- * branches in fast path, we use UINT64_MAX instead of branching.
- */
- port->n_retries = (conf->n_retries == 0) ? UINT64_MAX : conf->n_retries;
-
- return port;
-}
-
-static inline void
-send_burst_nodrop(struct rte_port_sym_crypto_writer_nodrop *p)
-{
- uint32_t nb_tx = 0, i;
-
- nb_tx = rte_cryptodev_enqueue_burst(p->cryptodev_id, p->queue_id,
- p->tx_buf, p->tx_buf_count);
-
- /* We sent all the packets in a first try */
- if (nb_tx >= p->tx_buf_count) {
- p->tx_buf_count = 0;
- return;
- }
-
- for (i = 0; i < p->n_retries; i++) {
- nb_tx += rte_cryptodev_enqueue_burst(p->cryptodev_id,
- p->queue_id, p->tx_buf + nb_tx,
- p->tx_buf_count - nb_tx);
-
- /* We sent all the packets in more than one try */
- if (nb_tx >= p->tx_buf_count) {
- p->tx_buf_count = 0;
- return;
- }
- }
-
- /* We didn't send the packets in maximum allowed attempts */
- RTE_PORT_SYM_CRYPTO_WRITER_NODROP_STATS_PKTS_DROP_ADD(p,
- p->tx_buf_count - nb_tx);
- for ( ; nb_tx < p->tx_buf_count; nb_tx++)
- rte_pktmbuf_free(p->tx_buf[nb_tx]->sym->m_src);
-
- p->tx_buf_count = 0;
-}
-
-static int
-rte_port_sym_crypto_writer_nodrop_tx(void *port, struct rte_mbuf *pkt)
-{
- struct rte_port_sym_crypto_writer_nodrop *p =
- port;
-
- p->tx_buf[p->tx_buf_count++] = (struct rte_crypto_op *)
- RTE_MBUF_METADATA_UINT8_PTR(pkt, p->crypto_op_offset);
- RTE_PORT_SYM_CRYPTO_WRITER_STATS_PKTS_IN_ADD(p, 1);
- if (p->tx_buf_count >= p->tx_burst_sz)
- send_burst_nodrop(p);
-
- return 0;
-}
-
-static int
-rte_port_sym_crypto_writer_nodrop_tx_bulk(void *port,
- struct rte_mbuf **pkts,
- uint64_t pkts_mask)
-{
- struct rte_port_sym_crypto_writer_nodrop *p =
- port;
-
- uint64_t bsz_mask = p->bsz_mask;
- uint32_t tx_buf_count = p->tx_buf_count;
- uint64_t expr = (pkts_mask & (pkts_mask + 1)) |
- ((pkts_mask & bsz_mask) ^ bsz_mask);
-
- if (expr == 0) {
- uint64_t n_pkts = rte_popcount64(pkts_mask);
- uint32_t i;
-
- RTE_PORT_SYM_CRYPTO_WRITER_NODROP_STATS_PKTS_IN_ADD(p, n_pkts);
-
- for (i = 0; i < n_pkts; i++)
- p->tx_buf[p->tx_buf_count++] = (struct rte_crypto_op *)
- RTE_MBUF_METADATA_UINT8_PTR(pkts[i],
- p->crypto_op_offset);
-
- if (p->tx_buf_count >= p->tx_burst_sz)
- send_burst_nodrop(p);
- } else {
- for ( ; pkts_mask; ) {
- uint32_t pkt_index = rte_ctz64(pkts_mask);
- uint64_t pkt_mask = 1LLU << pkt_index;
- struct rte_mbuf *pkt = pkts[pkt_index];
-
- p->tx_buf[tx_buf_count++] = (struct rte_crypto_op *)
- RTE_MBUF_METADATA_UINT8_PTR(pkt,
- p->crypto_op_offset);
- RTE_PORT_SYM_CRYPTO_WRITER_NODROP_STATS_PKTS_IN_ADD(p,
- 1);
- pkts_mask &= ~pkt_mask;
- }
-
- p->tx_buf_count = tx_buf_count;
- if (tx_buf_count >= p->tx_burst_sz)
- send_burst_nodrop(p);
- }
-
- return 0;
-}
-
-static int
-rte_port_sym_crypto_writer_nodrop_flush(void *port)
-{
- struct rte_port_sym_crypto_writer_nodrop *p =
- port;
-
- if (p->tx_buf_count > 0)
- send_burst_nodrop(p);
-
- return 0;
-}
-
-static int
-rte_port_sym_crypto_writer_nodrop_free(void *port)
-{
- if (port == NULL) {
- PORT_LOG(ERR, "%s: Port is NULL", __func__);
- return -EINVAL;
- }
-
- rte_port_sym_crypto_writer_nodrop_flush(port);
- rte_free(port);
-
- return 0;
-}
-
-static int rte_port_sym_crypto_writer_nodrop_stats_read(void *port,
- struct rte_port_out_stats *stats, int clear)
-{
- struct rte_port_sym_crypto_writer_nodrop *p =
- port;
-
- if (stats != NULL)
- memcpy(stats, &p->stats, sizeof(p->stats));
-
- if (clear)
- memset(&p->stats, 0, sizeof(p->stats));
-
- return 0;
-}
-
-
-/*
- * Summary of port operations
- */
-RTE_EXPORT_SYMBOL(rte_port_sym_crypto_reader_ops)
-struct rte_port_in_ops rte_port_sym_crypto_reader_ops = {
- .f_create = rte_port_sym_crypto_reader_create,
- .f_free = rte_port_sym_crypto_reader_free,
- .f_rx = rte_port_sym_crypto_reader_rx,
- .f_stats = rte_port_sym_crypto_reader_stats_read,
-};
-
-RTE_EXPORT_SYMBOL(rte_port_sym_crypto_writer_ops)
-struct rte_port_out_ops rte_port_sym_crypto_writer_ops = {
- .f_create = rte_port_sym_crypto_writer_create,
- .f_free = rte_port_sym_crypto_writer_free,
- .f_tx = rte_port_sym_crypto_writer_tx,
- .f_tx_bulk = rte_port_sym_crypto_writer_tx_bulk,
- .f_flush = rte_port_sym_crypto_writer_flush,
- .f_stats = rte_port_sym_crypto_writer_stats_read,
-};
-
-RTE_EXPORT_SYMBOL(rte_port_sym_crypto_writer_nodrop_ops)
-struct rte_port_out_ops rte_port_sym_crypto_writer_nodrop_ops = {
- .f_create = rte_port_sym_crypto_writer_nodrop_create,
- .f_free = rte_port_sym_crypto_writer_nodrop_free,
- .f_tx = rte_port_sym_crypto_writer_nodrop_tx,
- .f_tx_bulk = rte_port_sym_crypto_writer_nodrop_tx_bulk,
- .f_flush = rte_port_sym_crypto_writer_nodrop_flush,
- .f_stats = rte_port_sym_crypto_writer_nodrop_stats_read,
-};
diff --git a/lib/port/rte_port_sym_crypto.h b/lib/port/rte_port_sym_crypto.h
deleted file mode 100644
index d03cdc1e8b..0000000000
--- a/lib/port/rte_port_sym_crypto.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2018 Intel Corporation
- */
-
-#ifndef __INCLUDE_RTE_PORT_SYM_CRYPTO_H__
-#define __INCLUDE_RTE_PORT_SYM_CRYPTO_H__
-
-/**
- * @file
- * RTE Port sym crypto Interface
- *
- * crypto_reader: input port built on top of pre-initialized crypto interface
- * crypto_writer: output port built on top of pre-initialized crypto interface
- */
-
-#include <stdint.h>
-
-#include <rte_cryptodev.h>
-
-#include "rte_port.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** Function prototype for reader post action. */
-typedef void (*rte_port_sym_crypto_reader_callback_fn)(struct rte_mbuf **pkts,
- uint16_t n_pkts, void *arg);
-
-/** Crypto_reader port parameters */
-struct rte_port_sym_crypto_reader_params {
- /** Target cryptodev ID. */
- uint8_t cryptodev_id;
-
- /** Target cryptodev Queue Pair ID. */
- uint16_t queue_id;
-
- /** Crypto reader post callback function. */
- rte_port_sym_crypto_reader_callback_fn f_callback;
-
- /** Crypto reader post callback function arguments. */
- void *arg_callback;
-};
-
-/** Crypto_reader port operations. */
-extern struct rte_port_in_ops rte_port_sym_crypto_reader_ops;
-
-
-/** Crypto_writer port parameters. */
-struct rte_port_sym_crypto_writer_params {
- /** Target cryptodev ID. */
- uint8_t cryptodev_id;
-
- /** Target cryptodev Queue Pair ID. */
- uint16_t queue_id;
-
- /** offset to rte_crypto_op in the mbufs. */
- uint16_t crypto_op_offset;
-
- /** Burst size to crypto interface. */
- uint32_t tx_burst_sz;
-};
-
-/** Crypto_writer port operations. */
-extern struct rte_port_out_ops rte_port_sym_crypto_writer_ops;
-
-/** Crypto_writer_nodrop port parameters. */
-struct rte_port_sym_crypto_writer_nodrop_params {
- /** Target cryptodev ID. */
- uint8_t cryptodev_id;
-
- /** Target cryptodev queue pair id. */
- uint16_t queue_id;
-
- /** Offset to rte_crypto_op in the mbufs. */
- uint16_t crypto_op_offset;
-
- /** Burst size to crypto interface. */
- uint32_t tx_burst_sz;
-
- /** Maximum number of retries, 0 for no limit. */
- uint32_t n_retries;
-};
-
-/** Crypto_writer_nodrop port operations. */
-extern struct rte_port_out_ops rte_port_sym_crypto_writer_nodrop_ops;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--
2.53.0
prev parent reply other threads:[~2026-07-24 16:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-24 16:43 [PATCH 0/6] remove legacy Packet Framework API Stephen Hemminger
2026-07-24 16:43 ` [RFC 1/6] app/test: remove packet framework tests Stephen Hemminger
2026-07-24 16:43 ` [RFC 2/6] app/test-pipeline: remove application Stephen Hemminger
2026-07-24 16:43 ` [RFC 3/6] examples/ip_pipeline: remove example Stephen Hemminger
2026-07-24 16:44 ` [RFC 4/6] pipeline: remove legacy API Stephen Hemminger
2026-07-24 16:44 ` Stephen Hemminger [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260724164520.192203-7-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=cristian.dumitrescu@intel.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox