examples: numa updates
Signed-off-by: Intel
This commit is contained in:
parent
1ffc25b698
commit
e60f71ebd6
@ -98,8 +98,6 @@
|
|||||||
#define MAX_PKT_BURST 32
|
#define MAX_PKT_BURST 32
|
||||||
#define BURST_TX_DRAIN 200000ULL /* around 100us at 2 Ghz */
|
#define BURST_TX_DRAIN 200000ULL /* around 100us at 2 Ghz */
|
||||||
|
|
||||||
#define SOCKET0 0
|
|
||||||
|
|
||||||
#define TX_QUEUE_FLUSH_MASK 0xFFFFFFFF
|
#define TX_QUEUE_FLUSH_MASK 0xFFFFFFFF
|
||||||
#define TSC_COUNT_LIMIT 1000
|
#define TSC_COUNT_LIMIT 1000
|
||||||
|
|
||||||
|
@ -79,9 +79,6 @@
|
|||||||
#define FATAL_ERROR(fmt, args...) rte_exit(EXIT_FAILURE, fmt "\n", ##args)
|
#define FATAL_ERROR(fmt, args...) rte_exit(EXIT_FAILURE, fmt "\n", ##args)
|
||||||
#define PRINT_INFO(fmt, args...) RTE_LOG(INFO, APP, fmt "\n", ##args)
|
#define PRINT_INFO(fmt, args...) RTE_LOG(INFO, APP, fmt "\n", ##args)
|
||||||
|
|
||||||
/* NUMA socket to allocate mbuf pool on */
|
|
||||||
#define SOCKET 0
|
|
||||||
|
|
||||||
/* Max ports than can be used (each port is associated with two lcores) */
|
/* Max ports than can be used (each port is associated with two lcores) */
|
||||||
#define MAX_PORTS (RTE_MAX_LCORE / 2)
|
#define MAX_PORTS (RTE_MAX_LCORE / 2)
|
||||||
|
|
||||||
@ -457,13 +454,14 @@ init_port(uint8_t port)
|
|||||||
FATAL_ERROR("Could not configure port%u (%d)",
|
FATAL_ERROR("Could not configure port%u (%d)",
|
||||||
(unsigned)port, ret);
|
(unsigned)port, ret);
|
||||||
|
|
||||||
ret = rte_eth_rx_queue_setup(port, 0, NB_RXD, SOCKET, &rx_conf,
|
ret = rte_eth_rx_queue_setup(port, 0, NB_RXD, rte_eth_dev_socket_id(port),
|
||||||
pktmbuf_pool);
|
&rx_conf, pktmbuf_pool);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
FATAL_ERROR("Could not setup up RX queue for port%u (%d)",
|
FATAL_ERROR("Could not setup up RX queue for port%u (%d)",
|
||||||
(unsigned)port, ret);
|
(unsigned)port, ret);
|
||||||
|
|
||||||
ret = rte_eth_tx_queue_setup(port, 0, NB_TXD, SOCKET, &tx_conf);
|
ret = rte_eth_tx_queue_setup(port, 0, NB_TXD, rte_eth_dev_socket_id(port),
|
||||||
|
&tx_conf);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
FATAL_ERROR("Could not setup up TX queue for port%u (%d)",
|
FATAL_ERROR("Could not setup up TX queue for port%u (%d)",
|
||||||
(unsigned)port, ret);
|
(unsigned)port, ret);
|
||||||
@ -557,7 +555,7 @@ main(int argc, char** argv)
|
|||||||
MEMPOOL_CACHE_SZ,
|
MEMPOOL_CACHE_SZ,
|
||||||
sizeof(struct rte_pktmbuf_pool_private),
|
sizeof(struct rte_pktmbuf_pool_private),
|
||||||
rte_pktmbuf_pool_init, NULL, rte_pktmbuf_init, NULL,
|
rte_pktmbuf_pool_init, NULL, rte_pktmbuf_init, NULL,
|
||||||
SOCKET, 0);
|
rte_socket_id(), 0);
|
||||||
if (pktmbuf_pool == NULL) {
|
if (pktmbuf_pool == NULL) {
|
||||||
FATAL_ERROR("Could not initialise mbuf pool");
|
FATAL_ERROR("Could not initialise mbuf pool");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -115,8 +115,6 @@
|
|||||||
#define MAX_PKT_BURST 32
|
#define MAX_PKT_BURST 32
|
||||||
#define BURST_TX_DRAIN 200000ULL /* around 100us at 2 Ghz */
|
#define BURST_TX_DRAIN 200000ULL /* around 100us at 2 Ghz */
|
||||||
|
|
||||||
#define SOCKET0 0
|
|
||||||
|
|
||||||
/* Configure how many packets ahead to prefetch, when reading packets */
|
/* Configure how many packets ahead to prefetch, when reading packets */
|
||||||
#define PREFETCH_OFFSET 3
|
#define PREFETCH_OFFSET 3
|
||||||
|
|
||||||
@ -597,7 +595,7 @@ MAIN(int argc, char **argv)
|
|||||||
sizeof(struct rte_pktmbuf_pool_private),
|
sizeof(struct rte_pktmbuf_pool_private),
|
||||||
rte_pktmbuf_pool_init, NULL,
|
rte_pktmbuf_pool_init, NULL,
|
||||||
rte_pktmbuf_init, NULL,
|
rte_pktmbuf_init, NULL,
|
||||||
SOCKET0, 0);
|
rte_socket_id(), 0);
|
||||||
if (pool_direct == NULL)
|
if (pool_direct == NULL)
|
||||||
rte_panic("Cannot init direct mbuf pool\n");
|
rte_panic("Cannot init direct mbuf pool\n");
|
||||||
|
|
||||||
@ -607,7 +605,7 @@ MAIN(int argc, char **argv)
|
|||||||
0,
|
0,
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
rte_pktmbuf_init, NULL,
|
rte_pktmbuf_init, NULL,
|
||||||
SOCKET0, 0);
|
rte_socket_id(), 0);
|
||||||
if (pool_indirect == NULL)
|
if (pool_indirect == NULL)
|
||||||
rte_panic("Cannot init indirect mbuf pool\n");
|
rte_panic("Cannot init indirect mbuf pool\n");
|
||||||
|
|
||||||
@ -671,7 +669,7 @@ MAIN(int argc, char **argv)
|
|||||||
printf("rxq=%d ", queueid);
|
printf("rxq=%d ", queueid);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
ret = rte_eth_rx_queue_setup(portid, queueid, nb_rxd,
|
ret = rte_eth_rx_queue_setup(portid, queueid, nb_rxd,
|
||||||
SOCKET0, &rx_conf,
|
rte_eth_dev_socket_id(portid), &rx_conf,
|
||||||
pool_direct);
|
pool_direct);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup: "
|
rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup: "
|
||||||
@ -686,7 +684,7 @@ MAIN(int argc, char **argv)
|
|||||||
printf("txq=%u,%d ", lcore_id, queueid);
|
printf("txq=%u,%d ", lcore_id, queueid);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
ret = rte_eth_tx_queue_setup(portid, queueid, nb_txd,
|
ret = rte_eth_tx_queue_setup(portid, queueid, nb_txd,
|
||||||
SOCKET0, &tx_conf);
|
rte_eth_dev_socket_id(portid), &tx_conf);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup: "
|
rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup: "
|
||||||
"err=%d, port=%d\n", ret, portid);
|
"err=%d, port=%d\n", ret, portid);
|
||||||
@ -712,7 +710,7 @@ MAIN(int argc, char **argv)
|
|||||||
check_all_ports_link_status((uint8_t)nb_ports, enabled_port_mask);
|
check_all_ports_link_status((uint8_t)nb_ports, enabled_port_mask);
|
||||||
|
|
||||||
/* create the LPM table */
|
/* create the LPM table */
|
||||||
l3fwd_lpm = rte_lpm_create("L3FWD_LPM", SOCKET0, L3FWD_LPM_MAX_RULES, 0);
|
l3fwd_lpm = rte_lpm_create("L3FWD_LPM", rte_socket_id(), L3FWD_LPM_MAX_RULES, 0);
|
||||||
if (l3fwd_lpm == NULL)
|
if (l3fwd_lpm == NULL)
|
||||||
rte_panic("Unable to create the l3fwd LPM table\n");
|
rte_panic("Unable to create the l3fwd LPM table\n");
|
||||||
|
|
||||||
|
@ -115,8 +115,6 @@
|
|||||||
#define MAX_PKT_BURST 32
|
#define MAX_PKT_BURST 32
|
||||||
#define BURST_TX_DRAIN 200000ULL /* around 100us at 2 Ghz */
|
#define BURST_TX_DRAIN 200000ULL /* around 100us at 2 Ghz */
|
||||||
|
|
||||||
#define SOCKET0 0
|
|
||||||
|
|
||||||
/* Configure how many packets ahead to prefetch, when reading packets */
|
/* Configure how many packets ahead to prefetch, when reading packets */
|
||||||
#define PREFETCH_OFFSET 3
|
#define PREFETCH_OFFSET 3
|
||||||
|
|
||||||
@ -205,7 +203,7 @@ static struct rte_fbk_hash_params mcast_hash_params = {
|
|||||||
.name = "MCAST_HASH",
|
.name = "MCAST_HASH",
|
||||||
.entries = 1024,
|
.entries = 1024,
|
||||||
.entries_per_bucket = 4,
|
.entries_per_bucket = 4,
|
||||||
.socket_id = SOCKET0,
|
.socket_id = 0,
|
||||||
.hash_func = NULL,
|
.hash_func = NULL,
|
||||||
.init_val = 0,
|
.init_val = 0,
|
||||||
};
|
};
|
||||||
@ -638,6 +636,7 @@ init_mcast_hash(void)
|
|||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
|
mcast_hash_params.socket_id = rte_socket_id();
|
||||||
mcast_hash = rte_fbk_hash_create(&mcast_hash_params);
|
mcast_hash = rte_fbk_hash_create(&mcast_hash_params);
|
||||||
if (mcast_hash == NULL){
|
if (mcast_hash == NULL){
|
||||||
return -1;
|
return -1;
|
||||||
@ -735,21 +734,21 @@ MAIN(int argc, char **argv)
|
|||||||
packet_pool = rte_mempool_create("packet_pool", NB_PKT_MBUF,
|
packet_pool = rte_mempool_create("packet_pool", NB_PKT_MBUF,
|
||||||
PKT_MBUF_SIZE, 32, sizeof(struct rte_pktmbuf_pool_private),
|
PKT_MBUF_SIZE, 32, sizeof(struct rte_pktmbuf_pool_private),
|
||||||
rte_pktmbuf_pool_init, NULL, rte_pktmbuf_init, NULL,
|
rte_pktmbuf_pool_init, NULL, rte_pktmbuf_init, NULL,
|
||||||
SOCKET0, 0);
|
rte_socket_id(), 0);
|
||||||
|
|
||||||
if (packet_pool == NULL)
|
if (packet_pool == NULL)
|
||||||
rte_exit(EXIT_FAILURE, "Cannot init packet mbuf pool\n");
|
rte_exit(EXIT_FAILURE, "Cannot init packet mbuf pool\n");
|
||||||
|
|
||||||
header_pool = rte_mempool_create("header_pool", NB_HDR_MBUF,
|
header_pool = rte_mempool_create("header_pool", NB_HDR_MBUF,
|
||||||
HDR_MBUF_SIZE, 32, 0, NULL, NULL, rte_pktmbuf_init, NULL,
|
HDR_MBUF_SIZE, 32, 0, NULL, NULL, rte_pktmbuf_init, NULL,
|
||||||
SOCKET0, 0);
|
rte_socket_id(), 0);
|
||||||
|
|
||||||
if (header_pool == NULL)
|
if (header_pool == NULL)
|
||||||
rte_exit(EXIT_FAILURE, "Cannot init header mbuf pool\n");
|
rte_exit(EXIT_FAILURE, "Cannot init header mbuf pool\n");
|
||||||
|
|
||||||
clone_pool = rte_mempool_create("clone_pool", NB_CLONE_MBUF,
|
clone_pool = rte_mempool_create("clone_pool", NB_CLONE_MBUF,
|
||||||
CLONE_MBUF_SIZE, 32, 0, NULL, NULL, rte_pktmbuf_init, NULL,
|
CLONE_MBUF_SIZE, 32, 0, NULL, NULL, rte_pktmbuf_init, NULL,
|
||||||
SOCKET0, 0);
|
rte_socket_id(), 0);
|
||||||
|
|
||||||
if (clone_pool == NULL)
|
if (clone_pool == NULL)
|
||||||
rte_exit(EXIT_FAILURE, "Cannot init clone mbuf pool\n");
|
rte_exit(EXIT_FAILURE, "Cannot init clone mbuf pool\n");
|
||||||
@ -815,7 +814,7 @@ MAIN(int argc, char **argv)
|
|||||||
printf("rxq=%hu ", queueid);
|
printf("rxq=%hu ", queueid);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
ret = rte_eth_rx_queue_setup(portid, queueid, nb_rxd,
|
ret = rte_eth_rx_queue_setup(portid, queueid, nb_rxd,
|
||||||
SOCKET0, &rx_conf,
|
rte_eth_dev_socket_id(portid), &rx_conf,
|
||||||
packet_pool);
|
packet_pool);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup: err=%d, port=%d\n",
|
rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup: err=%d, port=%d\n",
|
||||||
@ -830,7 +829,7 @@ MAIN(int argc, char **argv)
|
|||||||
printf("txq=%u,%hu ", lcore_id, queueid);
|
printf("txq=%u,%hu ", lcore_id, queueid);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
ret = rte_eth_tx_queue_setup(portid, queueid, nb_txd,
|
ret = rte_eth_tx_queue_setup(portid, queueid, nb_txd,
|
||||||
SOCKET0, &tx_conf);
|
rte_lcore_to_socket_id(lcore_id), &tx_conf);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup: err=%d, "
|
rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup: err=%d, "
|
||||||
"port=%d\n", ret, portid);
|
"port=%d\n", ret, portid);
|
||||||
|
@ -102,8 +102,6 @@
|
|||||||
#define MAX_PKT_BURST 32
|
#define MAX_PKT_BURST 32
|
||||||
#define BURST_TX_DRAIN 200000ULL /* around 100us at 2 Ghz */
|
#define BURST_TX_DRAIN 200000ULL /* around 100us at 2 Ghz */
|
||||||
|
|
||||||
#define SOCKET0 0
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Configurable number of RX/TX ring descriptors
|
* Configurable number of RX/TX ring descriptors
|
||||||
*/
|
*/
|
||||||
@ -609,7 +607,7 @@ MAIN(int argc, char **argv)
|
|||||||
sizeof(struct rte_pktmbuf_pool_private),
|
sizeof(struct rte_pktmbuf_pool_private),
|
||||||
rte_pktmbuf_pool_init, NULL,
|
rte_pktmbuf_pool_init, NULL,
|
||||||
rte_pktmbuf_init, NULL,
|
rte_pktmbuf_init, NULL,
|
||||||
SOCKET0, 0);
|
rte_socket_id(), 0);
|
||||||
if (l2fwd_pktmbuf_pool == NULL)
|
if (l2fwd_pktmbuf_pool == NULL)
|
||||||
rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n");
|
rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n");
|
||||||
|
|
||||||
@ -709,10 +707,10 @@ MAIN(int argc, char **argv)
|
|||||||
rte_exit(EXIT_FAILURE, "rte_eth_rx_queue_setup:err=%d, port=%u\n",
|
rte_exit(EXIT_FAILURE, "rte_eth_rx_queue_setup:err=%d, port=%u\n",
|
||||||
ret, (unsigned) portid);
|
ret, (unsigned) portid);
|
||||||
|
|
||||||
/* init one TX queue logical core on each port */
|
/* init one TX queue on each port */
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
ret = rte_eth_tx_queue_setup(portid, 0, nb_txd,
|
ret = rte_eth_tx_queue_setup(portid, 0, nb_txd,
|
||||||
SOCKET0, &tx_conf);
|
rte_eth_dev_socket_id(portid), &tx_conf);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup:err=%d, port=%u\n",
|
rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup:err=%d, port=%u\n",
|
||||||
ret, (unsigned) portid);
|
ret, (unsigned) portid);
|
||||||
|
@ -152,8 +152,6 @@
|
|||||||
|
|
||||||
#define NB_SOCKETS 8
|
#define NB_SOCKETS 8
|
||||||
|
|
||||||
#define SOCKET0 0
|
|
||||||
|
|
||||||
/* Configure how many packets ahead to prefetch, when reading packets */
|
/* Configure how many packets ahead to prefetch, when reading packets */
|
||||||
#define PREFETCH_OFFSET 3
|
#define PREFETCH_OFFSET 3
|
||||||
|
|
||||||
@ -323,7 +321,7 @@ struct rte_hash_parameters ipv4_l3fwd_hash_params = {
|
|||||||
.key_len = sizeof(struct ipv4_5tuple),
|
.key_len = sizeof(struct ipv4_5tuple),
|
||||||
.hash_func = DEFAULT_HASH_FUNC,
|
.hash_func = DEFAULT_HASH_FUNC,
|
||||||
.hash_func_init_val = 0,
|
.hash_func_init_val = 0,
|
||||||
.socket_id = SOCKET0,
|
.socket_id = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct rte_hash_parameters ipv6_l3fwd_hash_params = {
|
struct rte_hash_parameters ipv6_l3fwd_hash_params = {
|
||||||
@ -333,7 +331,7 @@ struct rte_hash_parameters ipv6_l3fwd_hash_params = {
|
|||||||
.key_len = sizeof(struct ipv6_5tuple),
|
.key_len = sizeof(struct ipv6_5tuple),
|
||||||
.hash_func = DEFAULT_HASH_FUNC,
|
.hash_func = DEFAULT_HASH_FUNC,
|
||||||
.hash_func_init_val = 0,
|
.hash_func_init_val = 0,
|
||||||
.socket_id = SOCKET0,
|
.socket_id = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define IPV4_L3FWD_NUM_ROUTES \
|
#define IPV4_L3FWD_NUM_ROUTES \
|
||||||
|
@ -103,8 +103,6 @@
|
|||||||
#define MAX_PKT_BURST 32
|
#define MAX_PKT_BURST 32
|
||||||
#define BURST_TX_DRAIN 200000ULL /* around 100us at 2 Ghz */
|
#define BURST_TX_DRAIN 200000ULL /* around 100us at 2 Ghz */
|
||||||
|
|
||||||
#define SOCKET0 0
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Configurable number of RX/TX ring descriptors
|
* Configurable number of RX/TX ring descriptors
|
||||||
*/
|
*/
|
||||||
@ -663,7 +661,7 @@ MAIN(int argc, char **argv)
|
|||||||
sizeof(struct rte_pktmbuf_pool_private),
|
sizeof(struct rte_pktmbuf_pool_private),
|
||||||
rte_pktmbuf_pool_init, NULL,
|
rte_pktmbuf_pool_init, NULL,
|
||||||
rte_pktmbuf_init, NULL,
|
rte_pktmbuf_init, NULL,
|
||||||
SOCKET0, 0);
|
rte_socket_id(), 0);
|
||||||
if (lsi_pktmbuf_pool == NULL)
|
if (lsi_pktmbuf_pool == NULL)
|
||||||
rte_panic("Cannot init mbuf pool\n");
|
rte_panic("Cannot init mbuf pool\n");
|
||||||
|
|
||||||
@ -762,7 +760,7 @@ MAIN(int argc, char **argv)
|
|||||||
/* init one RX queue */
|
/* init one RX queue */
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
ret = rte_eth_rx_queue_setup(portid, 0, nb_rxd,
|
ret = rte_eth_rx_queue_setup(portid, 0, nb_rxd,
|
||||||
SOCKET0, &rx_conf,
|
rte_eth_dev_socket_id(portid), &rx_conf,
|
||||||
lsi_pktmbuf_pool);
|
lsi_pktmbuf_pool);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
rte_exit(EXIT_FAILURE, "rte_eth_rx_queue_setup: err=%d, port=%u\n",
|
rte_exit(EXIT_FAILURE, "rte_eth_rx_queue_setup: err=%d, port=%u\n",
|
||||||
@ -771,7 +769,7 @@ MAIN(int argc, char **argv)
|
|||||||
/* init one TX queue logical core on each port */
|
/* init one TX queue logical core on each port */
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
ret = rte_eth_tx_queue_setup(portid, 0, nb_txd,
|
ret = rte_eth_tx_queue_setup(portid, 0, nb_txd,
|
||||||
SOCKET0, &tx_conf);
|
rte_eth_dev_socket_id(portid), &tx_conf);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup: err=%d,port=%u\n",
|
rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup: err=%d,port=%u\n",
|
||||||
ret, (unsigned) portid);
|
ret, (unsigned) portid);
|
||||||
|
@ -146,7 +146,7 @@ init_mbuf_pools(void)
|
|||||||
pktmbuf_pool = rte_mempool_create(PKTMBUF_POOL_NAME, num_mbufs,
|
pktmbuf_pool = rte_mempool_create(PKTMBUF_POOL_NAME, num_mbufs,
|
||||||
MBUF_SIZE, MBUF_CACHE_SIZE,
|
MBUF_SIZE, MBUF_CACHE_SIZE,
|
||||||
sizeof(struct rte_pktmbuf_pool_private), rte_pktmbuf_pool_init,
|
sizeof(struct rte_pktmbuf_pool_private), rte_pktmbuf_pool_init,
|
||||||
NULL, rte_pktmbuf_init, NULL, SOCKET0, NO_FLAGS );
|
NULL, rte_pktmbuf_init, NULL, rte_socket_id(), NO_FLAGS );
|
||||||
|
|
||||||
return (pktmbuf_pool == NULL); /* 0 on success */
|
return (pktmbuf_pool == NULL); /* 0 on success */
|
||||||
}
|
}
|
||||||
@ -185,13 +185,13 @@ init_port(uint8_t port_num)
|
|||||||
|
|
||||||
for (q = 0; q < rx_rings; q++) {
|
for (q = 0; q < rx_rings; q++) {
|
||||||
retval = rte_eth_rx_queue_setup(port_num, q, rx_ring_size,
|
retval = rte_eth_rx_queue_setup(port_num, q, rx_ring_size,
|
||||||
SOCKET0, &rx_conf_default, pktmbuf_pool);
|
rte_eth_dev_socket_id(port_num), &rx_conf_default, pktmbuf_pool);
|
||||||
if (retval < 0) return retval;
|
if (retval < 0) return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( q = 0; q < tx_rings; q ++ ) {
|
for ( q = 0; q < tx_rings; q ++ ) {
|
||||||
retval = rte_eth_tx_queue_setup(port_num, q, tx_ring_size,
|
retval = rte_eth_tx_queue_setup(port_num, q, tx_ring_size,
|
||||||
SOCKET0, &tx_conf_default);
|
rte_eth_dev_socket_id(port_num), &tx_conf_default);
|
||||||
if (retval < 0) return retval;
|
if (retval < 0) return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,6 +214,8 @@ static int
|
|||||||
init_shm_rings(void)
|
init_shm_rings(void)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
unsigned socket_id;
|
||||||
|
const char * q_name;
|
||||||
const unsigned ringsize = CLIENT_QUEUE_RINGSIZE;
|
const unsigned ringsize = CLIENT_QUEUE_RINGSIZE;
|
||||||
|
|
||||||
clients = rte_malloc("client details",
|
clients = rte_malloc("client details",
|
||||||
@ -223,8 +225,10 @@ init_shm_rings(void)
|
|||||||
|
|
||||||
for (i = 0; i < num_clients; i++) {
|
for (i = 0; i < num_clients; i++) {
|
||||||
/* Create an RX queue for each client */
|
/* Create an RX queue for each client */
|
||||||
clients[i].rx_q = rte_ring_create(get_rx_queue_name(i),
|
socket_id = rte_socket_id();
|
||||||
ringsize, SOCKET0,
|
q_name = get_rx_queue_name(i);
|
||||||
|
clients[i].rx_q = rte_ring_create(q_name,
|
||||||
|
ringsize, socket_id,
|
||||||
RING_F_SP_ENQ | RING_F_SC_DEQ ); /* single prod, single cons */
|
RING_F_SP_ENQ | RING_F_SC_DEQ ); /* single prod, single cons */
|
||||||
if (clients[i].rx_q == NULL)
|
if (clients[i].rx_q == NULL)
|
||||||
rte_exit(EXIT_FAILURE, "Cannot create rx ring queue for client %u\n", i);
|
rte_exit(EXIT_FAILURE, "Cannot create rx ring queue for client %u\n", i);
|
||||||
|
@ -35,9 +35,6 @@
|
|||||||
#ifndef _MAIN_H_
|
#ifndef _MAIN_H_
|
||||||
#define _MAIN_H_
|
#define _MAIN_H_
|
||||||
|
|
||||||
#define SOCKET0 0
|
|
||||||
#define SOCKET1 1
|
|
||||||
|
|
||||||
#ifdef RTE_EXEC_ENV_BAREMETAL
|
#ifdef RTE_EXEC_ENV_BAREMETAL
|
||||||
#define MAIN _main
|
#define MAIN _main
|
||||||
#else
|
#else
|
||||||
|
@ -75,8 +75,6 @@
|
|||||||
|
|
||||||
#define RTE_LOGTYPE_APP RTE_LOGTYPE_USER1
|
#define RTE_LOGTYPE_APP RTE_LOGTYPE_USER1
|
||||||
|
|
||||||
#define SOCKET0 0
|
|
||||||
|
|
||||||
static const char *_MSG_POOL = "MSG_POOL";
|
static const char *_MSG_POOL = "MSG_POOL";
|
||||||
static const char *_SEC_2_PRI = "SEC_2_PRI";
|
static const char *_SEC_2_PRI = "SEC_2_PRI";
|
||||||
static const char *_PRI_2_SEC = "PRI_2_SEC";
|
static const char *_PRI_2_SEC = "PRI_2_SEC";
|
||||||
@ -122,12 +120,12 @@ main(int argc, char **argv)
|
|||||||
rte_exit(EXIT_FAILURE, "Cannot init EAL\n");
|
rte_exit(EXIT_FAILURE, "Cannot init EAL\n");
|
||||||
|
|
||||||
if (rte_eal_process_type() == RTE_PROC_PRIMARY){
|
if (rte_eal_process_type() == RTE_PROC_PRIMARY){
|
||||||
send_ring = rte_ring_create(_PRI_2_SEC, ring_size, SOCKET0, flags);
|
send_ring = rte_ring_create(_PRI_2_SEC, ring_size, rte_socket_id(), flags);
|
||||||
recv_ring = rte_ring_create(_SEC_2_PRI, ring_size, SOCKET0, flags);
|
recv_ring = rte_ring_create(_SEC_2_PRI, ring_size, rte_socket_id(), flags);
|
||||||
message_pool = rte_mempool_create(_MSG_POOL, pool_size,
|
message_pool = rte_mempool_create(_MSG_POOL, pool_size,
|
||||||
string_size, pool_cache, priv_data_sz,
|
string_size, pool_cache, priv_data_sz,
|
||||||
NULL, NULL, NULL, NULL,
|
NULL, NULL, NULL, NULL,
|
||||||
SOCKET0, flags);
|
rte_socket_id(), flags);
|
||||||
} else {
|
} else {
|
||||||
recv_ring = rte_ring_lookup(_PRI_2_SEC);
|
recv_ring = rte_ring_lookup(_PRI_2_SEC);
|
||||||
send_ring = rte_ring_lookup(_SEC_2_PRI);
|
send_ring = rte_ring_lookup(_SEC_2_PRI);
|
||||||
|
@ -80,8 +80,6 @@
|
|||||||
|
|
||||||
#define RTE_LOGTYPE_APP RTE_LOGTYPE_USER1
|
#define RTE_LOGTYPE_APP RTE_LOGTYPE_USER1
|
||||||
|
|
||||||
#define SOCKET0 0
|
|
||||||
|
|
||||||
#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM)
|
#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM)
|
||||||
#define NB_MBUFS 64*1024 /* use 64k mbufs */
|
#define NB_MBUFS 64*1024 /* use 64k mbufs */
|
||||||
#define MBUF_CACHE_SIZE 256
|
#define MBUF_CACHE_SIZE 256
|
||||||
@ -280,7 +278,7 @@ smp_port_init(uint8_t port, struct rte_mempool *mbuf_pool, uint16_t num_queues)
|
|||||||
|
|
||||||
for (q = 0; q < rx_rings; q ++) {
|
for (q = 0; q < rx_rings; q ++) {
|
||||||
retval = rte_eth_rx_queue_setup(port, q, RX_RING_SIZE,
|
retval = rte_eth_rx_queue_setup(port, q, RX_RING_SIZE,
|
||||||
SOCKET0, &rx_conf_default,
|
rte_eth_dev_socket_id(port), &rx_conf_default,
|
||||||
mbuf_pool);
|
mbuf_pool);
|
||||||
if (retval < 0)
|
if (retval < 0)
|
||||||
return retval;
|
return retval;
|
||||||
@ -288,7 +286,7 @@ smp_port_init(uint8_t port, struct rte_mempool *mbuf_pool, uint16_t num_queues)
|
|||||||
|
|
||||||
for (q = 0; q < tx_rings; q ++) {
|
for (q = 0; q < tx_rings; q ++) {
|
||||||
retval = rte_eth_tx_queue_setup(port, q, RX_RING_SIZE,
|
retval = rte_eth_tx_queue_setup(port, q, RX_RING_SIZE,
|
||||||
SOCKET0, &tx_conf_default);
|
rte_eth_dev_socket_id(port), &tx_conf_default);
|
||||||
if (retval < 0)
|
if (retval < 0)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
@ -482,7 +480,7 @@ main(int argc, char **argv)
|
|||||||
MBUF_CACHE_SIZE, sizeof(struct rte_pktmbuf_pool_private),
|
MBUF_CACHE_SIZE, sizeof(struct rte_pktmbuf_pool_private),
|
||||||
rte_pktmbuf_pool_init, NULL,
|
rte_pktmbuf_pool_init, NULL,
|
||||||
rte_pktmbuf_init, NULL,
|
rte_pktmbuf_init, NULL,
|
||||||
SOCKET0, 0);
|
rte_socket_id(), 0);
|
||||||
if (mp == NULL)
|
if (mp == NULL)
|
||||||
rte_exit(EXIT_FAILURE, "Cannot get memory pool for buffers\n");
|
rte_exit(EXIT_FAILURE, "Cannot get memory pool for buffers\n");
|
||||||
|
|
||||||
|
@ -74,9 +74,6 @@
|
|||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
/* basic constants used in application */
|
/* basic constants used in application */
|
||||||
#define SOCKET0 0
|
|
||||||
#define SOCKET1 1
|
|
||||||
|
|
||||||
#define NUM_QUEUES 128
|
#define NUM_QUEUES 128
|
||||||
|
|
||||||
#define NUM_MBUFS 64*1024
|
#define NUM_MBUFS 64*1024
|
||||||
@ -211,7 +208,7 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
|
|||||||
|
|
||||||
for (q = 0; q < rxRings; q ++) {
|
for (q = 0; q < rxRings; q ++) {
|
||||||
retval = rte_eth_rx_queue_setup(port, q, rxRingSize,
|
retval = rte_eth_rx_queue_setup(port, q, rxRingSize,
|
||||||
SOCKET0, &rx_conf_default,
|
rte_eth_dev_socket_id(port), &rx_conf_default,
|
||||||
mbuf_pool);
|
mbuf_pool);
|
||||||
if (retval < 0)
|
if (retval < 0)
|
||||||
return retval;
|
return retval;
|
||||||
@ -219,7 +216,7 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
|
|||||||
|
|
||||||
for (q = 0; q < txRings; q ++) {
|
for (q = 0; q < txRings; q ++) {
|
||||||
retval = rte_eth_tx_queue_setup(port, q, txRingSize,
|
retval = rte_eth_tx_queue_setup(port, q, txRingSize,
|
||||||
SOCKET0, &tx_conf_default);
|
rte_eth_dev_socket_id(port), &tx_conf_default);
|
||||||
if (retval < 0)
|
if (retval < 0)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
@ -388,7 +385,7 @@ MAIN(int argc, char *argv[])
|
|||||||
sizeof(struct rte_pktmbuf_pool_private),
|
sizeof(struct rte_pktmbuf_pool_private),
|
||||||
rte_pktmbuf_pool_init, NULL,
|
rte_pktmbuf_pool_init, NULL,
|
||||||
rte_pktmbuf_init, NULL,
|
rte_pktmbuf_init, NULL,
|
||||||
SOCKET0, 0);
|
rte_socket_id(), 0);
|
||||||
if (mbuf_pool == NULL)
|
if (mbuf_pool == NULL)
|
||||||
rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n");
|
rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user