diff --git a/include/dpdk_layer.h b/include/dpdk_layer.h index 0af00de62..f5bda736f 100644 --- a/include/dpdk_layer.h +++ b/include/dpdk_layer.h @@ -33,13 +33,25 @@ extern "C" { // there are three periodic messages (ARP, ND, ND-RA) that could be sent at once #define DP_PERIODIC_Q_SIZE (DP_MAX_PORTS * 3) -// 40Gb/s with 1500B packets means ~3.3M packets/s -// assuming 0.1s delay in processing means ~350k mbufs needed +// While dpservice is processing RTE_GRAPH_BURST_SIZE, the NIC will store packets here +// Seen recommendations to keep this at 2*RTE_GRAPH_BURST_SIZE or 4*RTE_GRAPH_BURST_SIZE +#define DP_RX_QUEUE_SIZE (4 * RTE_GRAPH_BURST_SIZE) +// Seen this recommended to be bigger than Rx because multiple Rx streams share the same Tx +// but in our case we are only using one worker thread, so there is no concurrent Tx +#define DP_TX_QUEUE_SIZE DP_RX_QUEUE_SIZE + #ifdef ENABLE_PYTEST #define DP_MBUF_POOL_SIZE (50*1024) #else -#define DP_MBUF_POOL_SIZE (350*1024) +// packet pool needs to be able to hold all packets from all port Rx queues +// (as requested in the configure stage via DP_RX_QUEUE_SIZE) +// then also all packets in a burst can allocate a chunk - RTE_GRAPH_BURST_SIZE +// then there are service queues/periodic/grpc/... +// thus a headroom of 4k should be OK +#define DP_MBUF_POOL_HEADROOM 4096 +#define DP_MBUF_POOL_SIZE ((DP_NR_STD_RX_QUEUES * DP_RX_QUEUE_SIZE) * DP_MAX_PORTS + DP_MBUF_POOL_HEADROOM) #endif + // max Ether MTU 1500 + frame header 14 + frame footer 4 + IPv6 tunnel header 40 #define DP_MBUF_BUF_SIZE (1558 + RTE_PKTMBUF_HEADROOM) diff --git a/src/dp_port.c b/src/dp_port.c index 8a8e12501..6dd733ffc 100644 --- a/src/dp_port.c +++ b/src/dp_port.c @@ -123,7 +123,7 @@ static int dp_port_init_ethdev(struct dp_port *port, struct rte_eth_dev_info *de /* RX and TX queues config */ for (uint16_t i = 0; i < DP_NR_STD_RX_QUEUES; ++i) { - ret = rte_eth_rx_queue_setup(port->port_id, i, 1024, + ret = rte_eth_rx_queue_setup(port->port_id, i, DP_RX_QUEUE_SIZE, port->socket_id, &rxq_conf, dp_layer->rte_mempool); @@ -137,7 +137,7 @@ static int dp_port_init_ethdev(struct dp_port *port, struct rte_eth_dev_info *de txq_conf.offloads = port_conf.txmode.offloads; for (uint16_t i = 0; i < DP_NR_STD_TX_QUEUES; ++i) { - ret = rte_eth_tx_queue_setup(port->port_id, i, 2048, + ret = rte_eth_tx_queue_setup(port->port_id, i, DP_TX_QUEUE_SIZE, port->socket_id, &txq_conf); if (DP_FAILED(ret)) {