#include <rte_memcpy.h>
#include <rte_memzone.h>
#include <rte_eal.h>
-#include <rte_per_lcore.h>
#include <rte_launch.h>
#include <rte_atomic.h>
#include <rte_cycles.h>
#include <rte_debug.h>
#include <rte_ether.h>
#include <rte_ethdev.h>
-#include <rte_ring.h>
#include <rte_mempool.h>
#include <rte_mbuf.h>
#include <rte_ip.h>
return -7;
}
lp->type = e_APP_LCORE_IO;
- for (i = 0; i < lp->io.rx.n_nic_queues; i ++) {
+ const size_t n_queues = RTE_MIN(lp->io.rx.n_nic_queues,
+ RTE_DIM(lp->io.rx.nic_queues));
+ for (i = 0; i < n_queues; i ++) {
if ((lp->io.rx.nic_queues[i].port == port) &&
(lp->io.rx.nic_queues[i].queue == queue)) {
return -8;
if (lp->io.rx.n_nic_queues >= APP_MAX_NIC_RX_QUEUES_PER_IO_LCORE) {
return -9;
}
- lp->io.rx.nic_queues[lp->io.rx.n_nic_queues].port = (uint8_t) port;
+ lp->io.rx.nic_queues[lp->io.rx.n_nic_queues].port = port;
lp->io.rx.nic_queues[lp->io.rx.n_nic_queues].queue = (uint8_t) queue;
lp->io.rx.n_nic_queues ++;
return -7;
}
lp->type = e_APP_LCORE_IO;
- for (i = 0; i < lp->io.tx.n_nic_ports; i ++) {
+ const size_t n_ports = RTE_MIN(lp->io.tx.n_nic_ports,
+ RTE_DIM(lp->io.tx.nic_ports));
+ for (i = 0; i < n_ports; i ++) {
if (lp->io.tx.nic_ports[i] == port) {
return -8;
}
if (lp->io.tx.n_nic_ports >= APP_MAX_NIC_TX_PORTS_PER_IO_LCORE) {
return -9;
}
- lp->io.tx.nic_ports[lp->io.tx.n_nic_ports] = (uint8_t) port;
+ lp->io.tx.nic_ports[lp->io.tx.n_nic_ports] = port;
lp->io.tx.n_nic_ports ++;
n_tuples ++;
static int
app_check_every_rx_port_is_tx_enabled(void)
{
- uint8_t port;
+ uint16_t port;
for (port = 0; port < APP_MAX_NIC_PORTS; port ++) {
if ((app_get_nic_rx_queues_per_port(port) > 0) && (app.nic_tx_port_mask[port] == 0)) {
argv[optind - 1] = prgname;
ret = optind - 1;
- optind = 0; /* reset getopt lib */
+ optind = 1; /* reset getopt lib */
return ret;
}
int
-app_get_nic_rx_queues_per_port(uint8_t port)
+app_get_nic_rx_queues_per_port(uint16_t port)
{
uint32_t i, count;
}
int
-app_get_lcore_for_nic_rx(uint8_t port, uint8_t queue, uint32_t *lcore_out)
+app_get_lcore_for_nic_rx(uint16_t port, uint8_t queue, uint32_t *lcore_out)
{
uint32_t lcore;
continue;
}
- for (i = 0; i < lp->rx.n_nic_queues; i ++) {
+ const size_t n_queues = RTE_MIN(lp->rx.n_nic_queues,
+ RTE_DIM(lp->rx.nic_queues));
+ for (i = 0; i < n_queues; i ++) {
if ((lp->rx.nic_queues[i].port == port) &&
(lp->rx.nic_queues[i].queue == queue)) {
*lcore_out = lcore;
}
int
-app_get_lcore_for_nic_tx(uint8_t port, uint32_t *lcore_out)
+app_get_lcore_for_nic_tx(uint16_t port, uint32_t *lcore_out)
{
uint32_t lcore;
continue;
}
- for (i = 0; i < lp->tx.n_nic_ports; i ++) {
+ const size_t n_ports = RTE_MIN(lp->tx.n_nic_ports,
+ RTE_DIM(lp->tx.nic_ports));
+ for (i = 0; i < n_ports; i ++) {
if (lp->tx.nic_ports[i] == port) {
*lcore_out = lcore;
return 0;
/* Print NIC RX configuration */
printf("NIC RX ports: ");
for (port = 0; port < APP_MAX_NIC_PORTS; port ++) {
- uint32_t n_rx_queues = app_get_nic_rx_queues_per_port((uint8_t) port);
+ uint32_t n_rx_queues = app_get_nic_rx_queues_per_port(port);
if (n_rx_queues == 0) {
continue;