#include <stdint.h>
#include <getopt.h>
#include <signal.h>
#include <stdbool.h>
#include <unistd.h>
#define RTE_LOGTYPE_DMA RTE_LOGTYPE_USER1
#define MAX_PKT_BURST 32
#define MEMPOOL_CACHE_SIZE 512
#define MIN_POOL_SIZE 65536U
#define CMD_LINE_OPT_MAC_UPDATING "mac-updating"
#define CMD_LINE_OPT_NO_MAC_UPDATING "no-mac-updating"
#define CMD_LINE_OPT_PORTMASK "portmask"
#define CMD_LINE_OPT_NB_QUEUE "nb-queue"
#define CMD_LINE_OPT_COPY_TYPE "copy-type"
#define CMD_LINE_OPT_RING_SIZE "ring-size"
#define CMD_LINE_OPT_BATCH_SIZE "dma-batch-size"
#define CMD_LINE_OPT_FRAME_SIZE "max-frame-size"
#define CMD_LINE_OPT_STATS_INTERVAL "stats-interval"
#define RX_DEFAULT_RINGSIZE 1024
#define TX_DEFAULT_RINGSIZE 1024
#define MAX_RX_QUEUES_COUNT 8
struct rxtx_port_config {
uint16_t rxtx_port;
uint16_t nb_queues;
uint16_t dmadev_ids[MAX_RX_QUEUES_COUNT];
};
struct rxtx_transmission_config {
struct rxtx_port_config ports[RTE_MAX_ETHPORTS];
uint16_t nb_ports;
uint16_t nb_lcores;
};
struct dma_port_statistics {
uint64_t rx[RTE_MAX_ETHPORTS];
uint64_t tx[RTE_MAX_ETHPORTS];
uint64_t tx_dropped[RTE_MAX_ETHPORTS];
uint64_t copy_dropped[RTE_MAX_ETHPORTS];
};
struct dma_port_statistics port_statistics;
struct total_statistics {
uint64_t total_packets_dropped;
uint64_t total_packets_tx;
uint64_t total_packets_rx;
uint64_t total_submitted;
uint64_t total_completed;
uint64_t total_failed;
};
typedef enum copy_mode_t {
#define COPY_MODE_SW "sw"
COPY_MODE_SW_NUM,
#define COPY_MODE_DMA "hw"
COPY_MODE_DMA_NUM,
COPY_MODE_INVALID_NUM,
COPY_MODE_SIZE_NUM = COPY_MODE_INVALID_NUM
} copy_mode_t;
static uint32_t dma_enabled_port_mask;
static uint16_t nb_queues = 1;
static int mac_updating = 1;
static copy_mode_t copy_mode = COPY_MODE_DMA_NUM;
static unsigned short ring_size = 2048;
static unsigned short stats_interval = 1;
#define MBUF_RING_SIZE 2048
#define MBUF_RING_MASK (MBUF_RING_SIZE - 1)
struct dma_bufs {
struct rte_mbuf *copies[MBUF_RING_SIZE];
uint16_t sent;
};
struct rxtx_transmission_config cfg;
static uint16_t nb_rxd = RX_DEFAULT_RINGSIZE;
static uint16_t nb_txd = TX_DEFAULT_RINGSIZE;
static volatile bool force_quit;
static uint32_t dma_batch_sz = MAX_PKT_BURST;
static uint32_t max_frame_size;
static void
print_port_stats(uint16_t port_id)
{
printf("\nStatistics for port %u ------------------------------"
"\nPackets sent: %34"PRIu64
"\nPackets received: %30"PRIu64
"\nPackets dropped on tx: %25"PRIu64
"\nPackets dropped on copy: %23"PRIu64,
port_id,
port_statistics.tx[port_id],
port_statistics.rx[port_id],
port_statistics.tx_dropped[port_id],
port_statistics.copy_dropped[port_id]);
}
static void
{
printf("\nDMA channel %u", dev_id);
printf(
"\n\t Total submitted ops: %"PRIu64
"", stats.
submitted);
printf(
"\n\t Total completed ops: %"PRIu64
"", stats.
completed);
printf(
"\n\t Total failed ops: %"PRIu64
"", stats.
errors);
}
static void
print_total_stats(struct total_statistics *ts)
{
printf("\nAggregate statistics ==============================="
"\nTotal packets Tx: %22"PRIu64" [pkt/s]"
"\nTotal packets Rx: %22"PRIu64" [pkt/s]"
"\nTotal packets dropped: %17"PRIu64" [pkt/s]",
ts->total_packets_tx / stats_interval,
ts->total_packets_rx / stats_interval,
ts->total_packets_dropped / stats_interval);
if (copy_mode == COPY_MODE_DMA_NUM) {
printf("\nTotal submitted ops: %19"PRIu64" [ops/s]"
"\nTotal completed ops: %19"PRIu64" [ops/s]"
"\nTotal failed ops: %22"PRIu64" [ops/s]",
ts->total_submitted / stats_interval,
ts->total_completed / stats_interval,
ts->total_failed / stats_interval);
}
printf("\n====================================================\n");
}
static void
print_stats(char *prgname)
{
struct total_statistics ts, delta_ts;
uint32_t i, port_id, dev_id;
char status_string[255];
int status_strlen;
const char clr[] = { 27, '[', '2', 'J', '\0' };
const char topLeft[] = { 27, '[', '1', ';', '1', 'H', '\0' };
status_strlen = snprintf(status_string, sizeof(status_string),
"%s, ", prgname);
status_strlen += snprintf(status_string + status_strlen,
sizeof(status_string) - status_strlen,
"Worker Threads = %d, ",
status_strlen += snprintf(status_string + status_strlen,
sizeof(status_string) - status_strlen,
"Copy Mode = %s,\n", copy_mode == COPY_MODE_SW_NUM ?
COPY_MODE_SW : COPY_MODE_DMA);
status_strlen += snprintf(status_string + status_strlen,
sizeof(status_string) - status_strlen,
"Updating MAC = %s, ", mac_updating ?
"enabled" : "disabled");
status_strlen += snprintf(status_string + status_strlen,
sizeof(status_string) - status_strlen,
"Rx Queues = %d, ", nb_queues);
status_strlen += snprintf(status_string + status_strlen,
sizeof(status_string) - status_strlen,
"Ring Size = %d", ring_size);
memset(&ts, 0, sizeof(struct total_statistics));
while (!force_quit) {
sleep(stats_interval);
printf("%s%s", clr, topLeft);
memset(&delta_ts, 0, sizeof(struct total_statistics));
printf("%s\n", status_string);
for (i = 0; i < cfg.nb_ports; i++) {
port_id = cfg.ports[i].rxtx_port;
print_port_stats(port_id);
delta_ts.total_packets_dropped +=
port_statistics.tx_dropped[port_id]
+ port_statistics.copy_dropped[port_id];
delta_ts.total_packets_tx +=
port_statistics.tx[port_id];
delta_ts.total_packets_rx +=
port_statistics.rx[port_id];
if (copy_mode == COPY_MODE_DMA_NUM) {
uint32_t j;
for (j = 0; j < cfg.ports[i].nb_queues; j++) {
dev_id = cfg.ports[i].dmadev_ids[j];
print_dmadev_stats(dev_id, stats);
delta_ts.total_failed += stats.
errors;
}
}
}
delta_ts.total_packets_tx -= ts.total_packets_tx;
delta_ts.total_packets_rx -= ts.total_packets_rx;
delta_ts.total_packets_dropped -= ts.total_packets_dropped;
delta_ts.total_submitted -= ts.total_submitted;
delta_ts.total_completed -= ts.total_completed;
delta_ts.total_failed -= ts.total_failed;
printf("\n");
print_total_stats(&delta_ts);
fflush(stdout);
ts.total_packets_tx += delta_ts.total_packets_tx;
ts.total_packets_rx += delta_ts.total_packets_rx;
ts.total_packets_dropped += delta_ts.total_packets_dropped;
ts.total_submitted += delta_ts.total_submitted;
ts.total_completed += delta_ts.total_completed;
ts.total_failed += delta_ts.total_failed;
}
}
static void
update_mac_addrs(
struct rte_mbuf *m, uint32_t dest_portid)
{
void *tmp;
*((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dest_portid << 40);
}
static inline void
{
dst->data_off = src->data_off;
memcpy(&dst->rx_descriptor_fields1, &src->rx_descriptor_fields1,
}
static inline void
{
}
static uint32_t
uint32_t nb_rx, uint16_t dev_id)
{
struct dma_bufs *dma = &dma_bufs[dev_id];
int ret;
uint32_t i;
for (i = 0; i < nb_rx; i++) {
if (ret < 0)
break;
dma->bufs[ret & MBUF_RING_MASK] = pkts[i];
dma->copies[ret & MBUF_RING_MASK] = pkts_copy[i];
}
ret = i;
return ret;
}
static inline uint32_t
uint32_t num, uint32_t step, uint16_t dev_id)
{
uint32_t i, k, m, n;
k = 0;
for (i = 0; i < num; i += m) {
n = dma_enqueue_packets(pkts + i, pkts_copy + i, m, dev_id);
k += n;
if (n > 0)
if (n != m)
break;
}
return k;
}
static inline uint32_t
uint16_t dev_id)
{
struct dma_bufs *dma = &dma_bufs[dev_id];
uint16_t nb_dq, filled;
return nb_dq;
for (filled = 0; filled < nb_dq; filled++) {
src[filled] = dma->bufs[(dma->sent + filled) & MBUF_RING_MASK];
dst[filled] = dma->copies[(dma->sent + filled) & MBUF_RING_MASK];
}
dma->sent += nb_dq;
return filled;
}
static void
dma_rx_port(struct rxtx_port_config *rx_config)
{
int32_t ret;
uint32_t nb_rx, nb_enq, i, j;
struct rte_mbuf *pkts_burst[MAX_PKT_BURST];
struct rte_mbuf *pkts_burst_copy[MAX_PKT_BURST];
for (i = 0; i < rx_config->nb_queues; i++) {
pkts_burst, MAX_PKT_BURST);
if (nb_rx == 0)
continue;
port_statistics.rx[rx_config->rxtx_port] += nb_rx;
(void *)pkts_burst_copy, nb_rx);
"Unable to allocate memory.\n");
for (j = 0; j < nb_rx; j++)
pktmbuf_metadata_copy(pkts_burst[j],
pkts_burst_copy[j]);
if (copy_mode == COPY_MODE_DMA_NUM) {
nb_enq = dma_enqueue(pkts_burst, pkts_burst_copy,
nb_rx, dma_batch_sz, rx_config->dmadev_ids[i]);
(void *)&pkts_burst[nb_enq],
nb_rx - nb_enq);
(void *)&pkts_burst_copy[nb_enq],
nb_rx - nb_enq);
port_statistics.copy_dropped[rx_config->rxtx_port] +=
(nb_rx - nb_enq);
nb_rx = dma_dequeue(pkts_burst, pkts_burst_copy,
MAX_PKT_BURST, rx_config->dmadev_ids[i]);
} else {
for (j = 0; j < nb_rx; j++)
pktmbuf_sw_copy(pkts_burst[j],
pkts_burst_copy[j]);
}
(void *)pkts_burst, nb_rx);
(void *)pkts_burst_copy, nb_rx, NULL);
(void *)&pkts_burst_copy[nb_enq],
nb_rx - nb_enq);
port_statistics.copy_dropped[rx_config->rxtx_port] +=
(nb_rx - nb_enq);
}
}
static void
dma_tx_port(struct rxtx_port_config *tx_config)
{
uint32_t i, j, nb_dq, nb_tx;
for (i = 0; i < tx_config->nb_queues; i++) {
(void *)mbufs, MAX_PKT_BURST, NULL);
if (nb_dq == 0)
continue;
if (mac_updating) {
for (j = 0; j < nb_dq; j++)
update_mac_addrs(mbufs[j],
tx_config->rxtx_port);
}
(void *)mbufs, nb_dq);
port_statistics.tx[tx_config->rxtx_port] += nb_tx;
port_statistics.tx_dropped[tx_config->rxtx_port] +=
(nb_dq - nb_tx);
(void *)&mbufs[nb_tx], nb_dq - nb_tx);
}
}
}
static void
rx_main_loop(void)
{
uint16_t i;
uint16_t nb_ports = cfg.nb_ports;
RTE_LOG(INFO, DMA,
"Entering main rx loop for copy on lcore %u\n",
while (!force_quit)
for (i = 0; i < nb_ports; i++)
dma_rx_port(&cfg.ports[i]);
}
static void
tx_main_loop(void)
{
uint16_t i;
uint16_t nb_ports = cfg.nb_ports;
RTE_LOG(INFO, DMA,
"Entering main tx loop for copy on lcore %u\n",
while (!force_quit)
for (i = 0; i < nb_ports; i++)
dma_tx_port(&cfg.ports[i]);
}
static void
rxtx_main_loop(void)
{
uint16_t i;
uint16_t nb_ports = cfg.nb_ports;
RTE_LOG(INFO, DMA,
"Entering main rx and tx loop for copy on"
while (!force_quit)
for (i = 0; i < nb_ports; i++) {
dma_rx_port(&cfg.ports[i]);
dma_tx_port(&cfg.ports[i]);
}
}
static void start_forwarding_cores(void)
{
RTE_LOG(INFO, DMA,
"Entering %s on lcore %u\n",
if (cfg.nb_lcores == 1) {
NULL, lcore_id);
} else if (cfg.nb_lcores > 1) {
NULL, lcore_id);
lcore_id);
}
}
static void
dma_usage(const char *prgname)
{
printf("%s [EAL options] -- -p PORTMASK [-q NQ]\n"
" -b --dma-batch-size: number of requests per DMA batch\n"
" -f --max-frame-size: max frame size\n"
" -p --portmask: hexadecimal bitmask of ports to configure\n"
" -q NQ: number of RX queues per port (default is 1)\n"
" --[no-]mac-updating: Enable or disable MAC addresses updating (enabled by default)\n"
" When enabled:\n"
" - The source MAC address is replaced by the TX port MAC address\n"
" - The destination MAC address is replaced by 02:00:00:00:00:TX_PORT_ID\n"
" -c --copy-type CT: type of copy: sw|hw\n"
" -s --ring-size RS: size of dmadev descriptor ring for hardware copy mode or rte_ring for software copy mode\n"
" -i --stats-interval SI: interval, in seconds, between stats prints (default is 1)\n",
prgname);
}
static int
dma_parse_portmask(const char *portmask)
{
char *end = NULL;
unsigned long pm;
pm = strtoul(portmask, &end, 16);
if ((portmask[0] == '\0') || (end == NULL) || (*end != '\0'))
return 0;
return pm;
}
static copy_mode_t
dma_parse_copy_mode(const char *copy_mode)
{
if (strcmp(copy_mode, COPY_MODE_SW) == 0)
return COPY_MODE_SW_NUM;
else if (strcmp(copy_mode, COPY_MODE_DMA) == 0)
return COPY_MODE_DMA_NUM;
return COPY_MODE_INVALID_NUM;
}
static int
dma_parse_args(int argc, char **argv, unsigned int nb_ports)
{
static const char short_options[] =
"b:"
"c:"
"f:"
"p:"
"q:"
"s:"
"i:"
;
static const struct option lgopts[] = {
{CMD_LINE_OPT_MAC_UPDATING, no_argument, &mac_updating, 1},
{CMD_LINE_OPT_NO_MAC_UPDATING, no_argument, &mac_updating, 0},
{CMD_LINE_OPT_PORTMASK, required_argument, NULL, 'p'},
{CMD_LINE_OPT_NB_QUEUE, required_argument, NULL, 'q'},
{CMD_LINE_OPT_COPY_TYPE, required_argument, NULL, 'c'},
{CMD_LINE_OPT_RING_SIZE, required_argument, NULL, 's'},
{CMD_LINE_OPT_BATCH_SIZE, required_argument, NULL, 'b'},
{CMD_LINE_OPT_FRAME_SIZE, required_argument, NULL, 'f'},
{CMD_LINE_OPT_STATS_INTERVAL, required_argument, NULL, 'i'},
{NULL, 0, 0, 0}
};
const unsigned int default_port_mask = (1 << nb_ports) - 1;
int opt, ret;
char **argvopt;
int option_index;
char *prgname = argv[0];
dma_enabled_port_mask = default_port_mask;
argvopt = argv;
while ((opt = getopt_long(argc, argvopt, short_options,
lgopts, &option_index)) != EOF) {
switch (opt) {
case 'b':
dma_batch_sz = atoi(optarg);
if (dma_batch_sz > MAX_PKT_BURST) {
printf("Invalid dma batch size, %s.\n", optarg);
dma_usage(prgname);
return -1;
}
break;
case 'f':
max_frame_size = atoi(optarg);
printf("Invalid max frame size, %s.\n", optarg);
dma_usage(prgname);
return -1;
}
break;
case 'p':
dma_enabled_port_mask = dma_parse_portmask(optarg);
if (dma_enabled_port_mask & ~default_port_mask ||
dma_enabled_port_mask <= 0) {
printf("Invalid portmask, %s, suggest 0x%x\n",
optarg, default_port_mask);
dma_usage(prgname);
return -1;
}
break;
case 'q':
nb_queues = atoi(optarg);
if (nb_queues == 0 || nb_queues > MAX_RX_QUEUES_COUNT) {
printf("Invalid RX queues number %s. Max %u\n",
optarg, MAX_RX_QUEUES_COUNT);
dma_usage(prgname);
return -1;
}
break;
case 'c':
copy_mode = dma_parse_copy_mode(optarg);
if (copy_mode == COPY_MODE_INVALID_NUM) {
printf("Invalid copy type. Use: sw, hw\n");
dma_usage(prgname);
return -1;
}
break;
case 's':
ring_size = atoi(optarg);
if (ring_size == 0) {
printf("Invalid ring size, %s.\n", optarg);
dma_usage(prgname);
return -1;
}
if (ring_size > MBUF_RING_SIZE) {
printf("Max ring_size is %d, setting ring_size to max",
MBUF_RING_SIZE);
ring_size = MBUF_RING_SIZE;
}
break;
case 'i':
stats_interval = atoi(optarg);
if (stats_interval == 0) {
printf("Invalid stats interval, setting to 1\n");
stats_interval = 1;
}
break;
case 0:
break;
default:
dma_usage(prgname);
return -1;
}
}
printf("MAC updating %s\n", mac_updating ? "enabled" : "disabled");
if (optind >= 0)
argv[optind - 1] = prgname;
ret = optind - 1;
optind = 1;
return ret;
}
static int
check_link_status(uint32_t port_mask)
{
uint16_t portid;
printf("\nChecking link status\n");
if ((port_mask & (1 << portid)) == 0)
continue;
memset(&link, 0, sizeof(link));
if (ret < 0) {
printf("Port %u link get failed: err=%d\n",
portid, ret);
continue;
}
sizeof(link_status_text), &link);
printf("Port %d %s\n", portid, link_status_text);
if (link.link_status)
}
}
static void
configure_dmadev_queue(uint32_t dev_id)
{
.nb_desc = ring_size
};
uint16_t vchan = 0;
rte_exit(EXIT_FAILURE,
"Error with rte_dma_configure()\n");
printf("Error with queue configuration\n");
}
if (info.nb_vchans != 1) {
printf("Error, no configured queues reported on device id %u\n", dev_id);
}
rte_exit(EXIT_FAILURE,
"Error with rte_dma_start()\n");
}
static void
assign_dmadevs(void)
{
uint16_t nb_dmadev = 0;
uint32_t i, j;
for (i = 0; i < cfg.nb_ports; i++) {
for (j = 0; j < cfg.ports[i].nb_queues; j++) {
if (dev_id == -1)
goto end;
cfg.ports[i].dmadev_ids[j] = dev_id;
configure_dmadev_queue(cfg.ports[i].dmadev_ids[j]);
++nb_dmadev;
}
}
end:
if (nb_dmadev < cfg.nb_ports * cfg.ports[0].nb_queues)
"Not enough dmadevs (%u) for all queues (%u).\n",
nb_dmadev, cfg.nb_ports * cfg.ports[0].nb_queues);
RTE_LOG(INFO, DMA,
"Number of used dmadevs: %u.\n", nb_dmadev);
}
static void
assign_rings(void)
{
uint32_t i;
for (i = 0; i < cfg.nb_ports; i++) {
snprintf(ring_name, sizeof(ring_name), "rx_to_tx_ring_%u", i);
ring_name, ring_size,
if (cfg.ports[i].rx_to_tx_ring == NULL)
rte_exit(EXIT_FAILURE,
"Ring create failed: %s\n",
}
}
static uint32_t
eth_dev_get_overhead_len(uint32_t max_rx_pktlen, uint16_t max_mtu)
{
uint32_t overhead_len;
if (max_mtu != UINT16_MAX && max_rx_pktlen > max_mtu)
overhead_len = max_rx_pktlen - max_mtu;
else
return overhead_len;
}
static int
{
uint32_t overhead_len;
if (max_frame_size == 0)
return 0;
return -1;
conf->
rxmode.
mtu = max_frame_size - overhead_len;
return 0;
}
static inline void
port_init(uint16_t portid,
struct rte_mempool *mbuf_pool, uint16_t nb_queues)
{
},
.rx_adv_conf = {
.rss_conf = {
.rss_key = NULL,
}
}
};
int ret, i;
if ((dma_enabled_port_mask & (1 << portid)) == 0) {
printf("Skipping disabled port %u\n", portid);
return;
}
printf("Initializing port %u... ", portid);
fflush(stdout);
if (ret < 0)
rte_exit(EXIT_FAILURE,
"Cannot get device info: %s, port=%u\n",
ret = config_port_max_pkt_len(&local_port_conf, &dev_info);
if (ret != 0)
"Invalid max frame size: %u (port %u)\n",
max_frame_size, portid);
if (ret < 0)
rte_exit(EXIT_FAILURE,
"Cannot configure device:"
" err=%d, port=%u\n", ret, portid);
&nb_txd);
if (ret < 0)
"Cannot adjust number of descriptors: err=%d, port=%u\n",
ret, portid);
for (i = 0; i < nb_queues; i++) {
mbuf_pool);
if (ret < 0)
"rte_eth_rx_queue_setup:err=%d,port=%u, queue_id=%u\n",
ret, portid, i);
}
&txq_conf);
if (ret < 0)
"rte_eth_tx_queue_setup:err=%d,port=%u\n",
ret, portid);
if (ret < 0)
"rte_eth_dev_start:err=%d, port=%u\n",
ret, portid);
portid,
cfg.ports[cfg.nb_ports].rxtx_port = portid;
cfg.ports[cfg.nb_ports++].nb_queues = nb_queues;
}
static void
dmadev_dump(void)
{
uint32_t i, j;
if (copy_mode != COPY_MODE_DMA_NUM)
return;
for (i = 0; i < cfg.nb_ports; i++)
for (j = 0; j < cfg.ports[i].nb_queues; j++)
}
static void
signal_handler(int signum)
{
if (signum == SIGINT || signum == SIGTERM) {
printf("\n\nSignal %d received, preparing to exit...\n",
signum);
force_quit = true;
} else if (signum == SIGUSR1) {
dmadev_dump();
}
}
int
main(int argc, char **argv)
{
int ret;
uint16_t nb_ports, portid;
uint32_t i;
unsigned int nb_mbufs;
size_t sz;
if (ret < 0)
rte_exit(EXIT_FAILURE,
"Invalid EAL arguments\n");
argc -= ret;
argv += ret;
force_quit = false;
signal(SIGINT, signal_handler);
signal(SIGTERM, signal_handler);
signal(SIGUSR1, signal_handler);
if (nb_ports == 0)
rte_exit(EXIT_FAILURE,
"No Ethernet ports - bye\n");
ret = dma_parse_args(argc, argv, nb_ports);
if (ret < 0)
rte_exit(EXIT_FAILURE,
"Invalid DMA arguments\n");
nb_mbufs =
RTE_MAX(nb_ports * (nb_queues * (nb_rxd + nb_txd +
4 * MAX_PKT_BURST + ring_size) + ring_size +
MIN_POOL_SIZE);
sz = max_frame_size + RTE_PKTMBUF_HEADROOM;
sz =
RTE_MAX(sz, (
size_t)RTE_MBUF_DEFAULT_BUF_SIZE);
if (dma_pktmbuf_pool == NULL)
rte_exit(EXIT_FAILURE,
"Cannot init mbuf pool\n");
cfg.nb_ports = 0;
port_init(portid, dma_pktmbuf_pool, nb_queues);
memset(&port_statistics, 0, sizeof(port_statistics));
while (!check_link_status(dma_enabled_port_mask) && !force_quit)
sleep(1);
if (cfg.nb_lcores < 1)
"There should be at least one worker lcore.\n");
if (copy_mode == COPY_MODE_DMA_NUM)
assign_dmadevs();
assign_rings();
start_forwarding_cores();
print_stats(argv[0]);
uint32_t j;
for (i = 0; i < cfg.nb_ports; i++) {
printf("Closing port %d\n", cfg.ports[i].rxtx_port);
if (ret != 0)
RTE_LOG(ERR, DMA,
"rte_eth_dev_stop: err=%s, port=%u\n",
if (copy_mode == COPY_MODE_DMA_NUM) {
for (j = 0; j < cfg.ports[i].nb_queues; j++) {
printf("Stopping dmadev %d\n",
cfg.ports[i].dmadev_ids[j]);
}
} else
}
printf("Bye...\n");
return 0;
}
#define offsetof(TYPE, MEMBER)
__rte_noreturn void rte_exit(int exit_code, const char *format,...) __rte_format_printf(2
#define RTE_DMADEV_DEFAULT_MAX
static __rte_experimental uint16_t rte_dma_completed(int16_t dev_id, uint16_t vchan, const uint16_t nb_cpls, uint16_t *last_idx, bool *has_error)
__rte_experimental int rte_dma_info_get(int16_t dev_id, struct rte_dma_info *dev_info)
static __rte_experimental int rte_dma_copy(int16_t dev_id, uint16_t vchan, rte_iova_t src, rte_iova_t dst, uint32_t length, uint64_t flags)
__rte_experimental int rte_dma_stats_get(int16_t dev_id, uint16_t vchan, struct rte_dma_stats *stats)
__rte_experimental int rte_dma_configure(int16_t dev_id, const struct rte_dma_conf *dev_conf)
__rte_experimental int16_t rte_dma_next_dev(int16_t start_dev_id)
__rte_experimental int rte_dma_vchan_setup(int16_t dev_id, uint16_t vchan, const struct rte_dma_vchan_conf *conf)
static __rte_experimental int rte_dma_submit(int16_t dev_id, uint16_t vchan)
__rte_experimental int rte_dma_dump(int16_t dev_id, FILE *f)
__rte_experimental int rte_dma_start(int16_t dev_id)
__rte_experimental int rte_dma_stop(int16_t dev_id)
int rte_eal_init(int argc, char **argv)
int rte_eal_cleanup(void)
const char * rte_strerror(int errnum)
int rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_queue, uint16_t nb_tx_queue, const struct rte_eth_conf *eth_conf)
int rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, uint16_t nb_rx_desc, unsigned int socket_id, const struct rte_eth_rxconf *rx_conf, struct rte_mempool *mb_pool)
static uint16_t rte_eth_rx_burst(uint16_t port_id, uint16_t queue_id, struct rte_mbuf **rx_pkts, const uint16_t nb_pkts)
int rte_eth_link_get(uint16_t port_id, struct rte_eth_link *link)
int rte_eth_promiscuous_enable(uint16_t port_id)
__rte_experimental int rte_eth_link_to_str(char *str, size_t len, const struct rte_eth_link *eth_link)
int rte_eth_dev_stop(uint16_t port_id)
int rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info)
int rte_eth_tx_queue_setup(uint16_t port_id, uint16_t tx_queue_id, uint16_t nb_tx_desc, unsigned int socket_id, const struct rte_eth_txconf *tx_conf)
#define RTE_ETH_LINK_MAX_STR_LEN
static uint16_t rte_eth_tx_burst(uint16_t port_id, uint16_t queue_id, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
int rte_eth_macaddr_get(uint16_t port_id, struct rte_ether_addr *mac_addr)
#define RTE_ETH_RSS_PROTO_MASK
uint16_t rte_eth_dev_count_avail(void)
int rte_eth_dev_close(uint16_t port_id)
int rte_eth_dev_socket_id(uint16_t port_id)
int rte_eth_dev_adjust_nb_rx_tx_desc(uint16_t port_id, uint16_t *nb_rx_desc, uint16_t *nb_tx_desc)
#define RTE_ETH_FOREACH_DEV(p)
int rte_eth_dev_start(uint16_t port_id)
#define RTE_ETHER_MAX_JUMBO_FRAME_LEN
#define RTE_ETHER_ADDR_PRT_FMT
#define RTE_ETHER_HDR_LEN
#define RTE_ETHER_ADDR_BYTES(mac_addrs)
#define RTE_ETHER_CRC_LEN
#define RTE_ETHER_MIN_LEN
static void rte_ether_addr_copy(const struct rte_ether_addr *__restrict ea_from, struct rte_ether_addr *__restrict ea_to)
int() lcore_function_t(void *)
int rte_eal_remote_launch(lcore_function_t *f, void *arg, unsigned worker_id)
void rte_eal_mp_wait_lcore(void)
unsigned int rte_lcore_count(void)
unsigned int rte_socket_id(void)
unsigned int rte_get_next_lcore(unsigned int i, int skip_main, int wrap)
static unsigned rte_lcore_id(void)
#define RTE_LOG(l, t,...)
#define rte_pktmbuf_data_len(m)
struct rte_mempool * rte_pktmbuf_pool_create(const char *name, unsigned n, unsigned cache_size, uint16_t priv_size, uint16_t data_room_size, int socket_id)
#define rte_pktmbuf_iova(m)
#define rte_pktmbuf_mtod(m, t)
static void * rte_memcpy(void *dst, const void *src, size_t n)
static __rte_always_inline int rte_mempool_get_bulk(struct rte_mempool *mp, void **obj_table, unsigned int n)
static __rte_always_inline void rte_mempool_put_bulk(struct rte_mempool *mp, void *const *obj_table, unsigned int n)
void rte_ring_free(struct rte_ring *r)
static __rte_always_inline unsigned int rte_ring_enqueue_burst(struct rte_ring *r, void *const *obj_table, unsigned int n, unsigned int *free_space)
struct rte_ring * rte_ring_create(const char *name, unsigned int count, int socket_id, unsigned int flags)
static __rte_always_inline unsigned int rte_ring_dequeue_burst(struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available)
#define RTE_RING_NAMESIZE
enum rte_dma_direction direction
struct rte_eth_txmode txmode
struct rte_eth_rxmode rxmode
struct rte_eth_conf::@147 rx_adv_conf
struct rte_eth_rss_conf rss_conf
struct rte_eth_txconf default_txconf
struct rte_eth_rxconf default_rxconf
uint64_t flow_type_rss_offloads
enum rte_eth_rx_mq_mode mq_mode
uint8_t addr_bytes[RTE_ETHER_ADDR_LEN]
struct rte_ether_addr src_addr
struct rte_ether_addr dst_addr