From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Subject: [PATCH v4 6/7] port: remove legacy API
Date: Tue, 28 Jul 2026 09:35:14 -0700 [thread overview]
Message-ID: <20260728163713.364168-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/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 ---
26 files changed, 10 insertions(+), 5591 deletions(-)
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 760b770d6f8ac636e56541b4db609768e6558e11..16827a602b501491948e583c08bc49c55de44bf1 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/packet_framework.rst b/doc/guides/prog_guide/packet_framework.rst
index 98cf3be1099d88f78665b207beb982bd5c534c86..3b5ede7dc2792cc5eeeed93c6968ccb234564876 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 9dcf86098f0d391a44ee1887ba823a1dd04ac295..75b56b0e104d95a0d6a4c049bbcec561272104ea 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 50b0d3ac06e35b8fd5b86baafd85723d7539cb5d..31b075b3ccf203b45706b6cb39d5a38f4c20a05b 100644
--- a/doc/guides/rel_notes/release_26_11.rst
+++ b/doc/guides/rel_notes/release_26_11.rst
@@ -91,6 +91,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 b5977728723a9ef9e21a23ae3a1eca7342b93dc5..ef88b917a3293fbdc51ea22ef862a8e9f432cae8 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 e7a10d80ef8ca58aec03e4764517cc5d8b8dfe79..0000000000000000000000000000000000000000
--- 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 28d75ee48b3be232751ac60f8eefc3d4d03850bb..0000000000000000000000000000000000000000
--- 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 81f57c41a59a4a43e765cea6c873332233ebb203..0000000000000000000000000000000000000000
--- 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 bdab2fbf6c58dd521acaadc436faf3e9dde93cb2..0000000000000000000000000000000000000000
--- 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 7729ff0da343292cea6ef43064153bd6912c1c7b..0000000000000000000000000000000000000000
--- 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 c3a287b83476173cd1a1d699282c47d7598d68db..0000000000000000000000000000000000000000
--- 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 d9eccf07d474b84a54848a640d1d08752c3907bd..0000000000000000000000000000000000000000
--- 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 dbc9efef1b1035fe762109cad0702beb95dcee76..0000000000000000000000000000000000000000
--- 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 40a5e4a426d8b5be33434adbdde2c0819b2daeef..0000000000000000000000000000000000000000
--- 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 9444f5939cb3f73ebca5aad94d7f877cf8ad02e9..0000000000000000000000000000000000000000
--- 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 9a10f10523e676352656a4d27906eefb0af991d8..0000000000000000000000000000000000000000
--- 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 58ab7a1c5ba685e14e2a54c5729f1b007d4b01c6..0000000000000000000000000000000000000000
--- 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 86e36f5362a66d7eca63217477d6893d352c6561..0000000000000000000000000000000000000000
--- 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 307a576d658bc267f59465e38fb30a41b9f6f67a..0000000000000000000000000000000000000000
--- 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 2089d0889b3405ba6892a3e6bf30f34a8603ef4c..0000000000000000000000000000000000000000
--- 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 3091078aa150f5f6c3d7a31f5809fe5a3a87db9d..0000000000000000000000000000000000000000
--- 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 1bf08ae6a9d785896bc2dc08a5697b94a13c29c2..0000000000000000000000000000000000000000
--- 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 0557e125066b92ec1ad390418543ab0a60706415..0000000000000000000000000000000000000000
--- 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 3122dd50380e305ce386e6962a188888262fffa2..0000000000000000000000000000000000000000
--- 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 30c9d1283e63b6ba3350c0d25ce082cb7b295500..0000000000000000000000000000000000000000
--- 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 d03cdc1e8ba7f0a338d91188f3a1fd2998aefb8f..0000000000000000000000000000000000000000
--- 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
next prev parent reply other threads:[~2026-07-28 16:39 UTC|newest]
Thread overview: 29+ 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 ` [RFC 6/6] port: " Stephen Hemminger
2026-07-25 7:54 ` [PATCH 0/6] remove legacy Packet Framework API David Marchand
2026-07-25 13:36 ` Stephen Hemminger
2026-07-27 23:11 ` [RFC v2 0/6] remove legacy packet framework Stephen Hemminger
2026-07-27 23:11 ` [RFC v2 1/6] app/test: remove packet framework tests Stephen Hemminger
2026-07-27 23:11 ` [RFC v2 2/6] app/test-pipeline: remove application Stephen Hemminger
2026-07-27 23:11 ` [RFC v2 3/6] examples/ip_pipeline: remove example Stephen Hemminger
2026-07-27 23:11 ` [RFC v2 4/6] pipeline: remove legacy API Stephen Hemminger
2026-07-27 23:11 ` [RFC v2 6/6] port: " Stephen Hemminger
2026-07-28 14:20 ` [PATCH v3 0/6] remove legacy packet framework Stephen Hemminger
2026-07-28 14:20 ` [PATCH v3 1/6] app/test: remove packet framework tests Stephen Hemminger
2026-07-28 14:20 ` [PATCH v3 2/6] app/test-pipeline: remove application Stephen Hemminger
2026-07-28 14:20 ` [PATCH v3 3/6] examples/ip_pipeline: remove example Stephen Hemminger
2026-07-28 14:20 ` [PATCH v3 4/6] pipeline: remove legacy API Stephen Hemminger
2026-07-28 14:20 ` [PATCH v3 6/6] port: " Stephen Hemminger
2026-07-28 14:48 ` [PATCH v3 0/6] remove legacy packet framework David Marchand
2026-07-28 16:35 ` [PATCH v4 0/7] remove deprecated " Stephen Hemminger
2026-07-28 16:35 ` [PATCH v4 1/7] app/test: remove packet framework tests Stephen Hemminger
2026-07-28 16:35 ` [PATCH v4 2/7] app/test-pipeline: remove application Stephen Hemminger
2026-07-28 16:35 ` [PATCH v4 3/7] examples/ip_pipeline: remove example Stephen Hemminger
2026-07-28 16:35 ` [PATCH v4 4/7] pipeline: remove legacy API Stephen Hemminger
2026-07-28 16:35 ` [PATCH v4 5/7] table: " Stephen Hemminger
2026-07-28 16:35 ` Stephen Hemminger [this message]
2026-07-28 16:35 ` [PATCH v4 7/7] doc: remove packet framework images Stephen Hemminger
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=20260728163713.364168-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