Commit b6d9bf74 authored by Joanne Hugé's avatar Joanne Hugé

Rewrite tracing, fix bugs, add simple monitoring

parent e4e825e3
...@@ -4,13 +4,14 @@ ...@@ -4,13 +4,14 @@
#define RTE_TEST_TX_DESC_DEFAULT 1024 #define RTE_TEST_TX_DESC_DEFAULT 1024
static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT;
static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT;
struct rte_mempool *mbuf_pool; struct rte_mempool *tx_mbuf_pool;
struct rte_mempool *rx_mbuf_pool;
struct rte_ether_addr s_addr; struct rte_ether_addr s_addr;
struct rte_ether_addr d_addr; struct rte_ether_addr d_addr;
static const struct rte_eth_conf port_conf_default = { static const struct rte_eth_conf port_conf_default = {
.rxmode = { .max_lro_pkt_size = RTE_ETHER_MAX_LEN } .rxmode = { .max_lro_pkt_size = RTE_ETHER_MAX_LEN }
}; };
static inline int port_init(int portid, struct rte_mempool *mbuf_pool) { static inline int port_init(int portid, struct rte_mempool *rx_mbuf_pool) {
struct rte_eth_conf port_conf = port_conf_default; struct rte_eth_conf port_conf = port_conf_default;
const uint16_t rx_rings = 1, tx_rings = 1; const uint16_t rx_rings = 1, tx_rings = 1;
int retval; int retval;
...@@ -23,7 +24,7 @@ static inline int port_init(int portid, struct rte_mempool *mbuf_pool) { ...@@ -23,7 +24,7 @@ static inline int port_init(int portid, struct rte_mempool *mbuf_pool) {
/* Allocate and set up 1 RX queue per Ethernet port. */ /* Allocate and set up 1 RX queue per Ethernet port. */
for (q = 0; q < rx_rings; q++) { for (q = 0; q < rx_rings; q++) {
retval = rte_eth_rx_queue_setup(portid, q, nb_rxd, retval = rte_eth_rx_queue_setup(portid, q, nb_rxd,
rte_eth_dev_socket_id(portid), NULL, mbuf_pool); rte_eth_dev_socket_id(portid), NULL, rx_mbuf_pool);
if (retval < 0) if (retval < 0)
return retval; return retval;
} }
...@@ -55,13 +56,17 @@ static void init_dpdk(int argc, char ** argv) { ...@@ -55,13 +56,17 @@ static void init_dpdk(int argc, char ** argv) {
argv += ret; argv += ret;
nb_mbufs = RTE_MAX((nb_rxd + nb_txd + BURST_SIZE + MEMPOOL_CACHE_SIZE), 8192U); nb_mbufs = RTE_MAX((nb_rxd + nb_txd + BURST_SIZE + MEMPOOL_CACHE_SIZE), 8192U);
nb_mbufs = 1024U * 16; nb_mbufs = 1024U * 16 - 1;
mbuf_pool = rte_pktmbuf_pool_create("MBUF_POOL", nb_mbufs, tx_mbuf_pool = rte_pktmbuf_pool_create("TX_MBUF_POOL", nb_mbufs,
MEMPOOL_CACHE_SIZE, 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id()); MEMPOOL_CACHE_SIZE, 0, RTE_MBUF_DEFAULT_BUF_SIZE, SOCKET_ID_ANY);
if (mbuf_pool == NULL) if (tx_mbuf_pool == NULL)
rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n"); rte_exit(EXIT_FAILURE, "Cannot create tx mbuf pool\n");
rx_mbuf_pool = rte_pktmbuf_pool_create("RX_MBUF_POOL", nb_mbufs,
MEMPOOL_CACHE_SIZE, 0, RTE_MBUF_DEFAULT_BUF_SIZE, SOCKET_ID_ANY);
if (rx_mbuf_pool == NULL)
rte_exit(EXIT_FAILURE, "Cannot create rx mbuf pool\n");
if (port_init(0, mbuf_pool) != 0) if (port_init(0, rx_mbuf_pool) != 0)
rte_exit(EXIT_FAILURE, "Cannot init port %"PRIu8 "\n", 0); rte_exit(EXIT_FAILURE, "Cannot init port %"PRIu8 "\n", 0);
} }
This diff is collapsed.
...@@ -36,7 +36,7 @@ static inline void log_limit(const char * section, const char * msg, ...) { ...@@ -36,7 +36,7 @@ static inline void log_limit(const char * section, const char * msg, ...) {
puts(line); puts(line);
} }
#if 0 #if 1
static void log_info(const char * section, const char * msg, ...) { static void log_info(const char * section, const char * msg, ...) {
time_t t; time_t t;
struct tm ts; struct tm ts;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment