apps: fix default mbuf size

Latest mbuf changes (priv_size addition and related fixes)
exposed small problem with testpmd and few other sample apps:
when mbuf size is exaclty 2KB or less, that causes
ixgbe PMD to select scattered RX even for configs with 'normal'
max packet length (max_rx_pkt_len == ETHER_MAX_LEN).
To overcome that problem and unify the code, new macro was created
to represent recommended minimal buffer length for mbuf.
When appropriate, samples are updated to use that macro.

Fixes: dfb03bbe2b ("app/testpmd: use standard functions to initialize
mbufs and mbuf pool")

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
This commit is contained in:
Konstantin Ananyev 2015-04-30 00:31:51 +01:00 committed by Thomas Monjalon
parent 11f51a26d3
commit 824cb29c0e
41 changed files with 65 additions and 87 deletions

View File

@ -48,7 +48,8 @@
* Default size of the mbuf data buffer to receive standard 1518-byte
* Ethernet frames in a mono-segment memory buffer.
*/
#define DEFAULT_MBUF_DATA_SIZE 2048 /**< Default size of mbuf data buffer. */
#define DEFAULT_MBUF_DATA_SIZE RTE_MBUF_DEFAULT_BUF_SIZE
/**< Default size of mbuf data buffer. */
/*
* The maximum number of segments per packet is used when creating

View File

@ -502,8 +502,6 @@ quit_workers(struct rte_distributor *d, struct rte_mempool *p)
worker_idx = 0;
}
#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM)
static int
test_distributor(void)
{
@ -531,7 +529,7 @@ test_distributor(void)
(BIG_BATCH * 2) - 1 : (511 * rte_lcore_count());
if (p == NULL) {
p = rte_pktmbuf_pool_create("DT_MBUF_POOL", nb_bufs, BURST,
0, MBUF_DATA_SIZE, rte_socket_id());
0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
if (p == NULL) {
printf("Error creating mempool\n");
return -1;

View File

@ -212,8 +212,6 @@ quit_workers(struct rte_distributor *d, struct rte_mempool *p)
worker_idx = 0;
}
#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM)
static int
test_distributor_perf(void)
{
@ -244,7 +242,7 @@ test_distributor_perf(void)
(BIG_BATCH * 2) - 1 : (511 * rte_lcore_count());
if (p == NULL) {
p = rte_pktmbuf_pool_create("DPT_MBUF_POOL", nb_bufs, BURST,
0, MBUF_DATA_SIZE, rte_socket_id());
0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
if (p == NULL) {
printf("Error creating mempool\n");
return -1;

View File

@ -75,11 +75,9 @@
ETH_TXQ_FLAGS_NOXSUMSCTP | ETH_TXQ_FLAGS_NOXSUMUDP | \
ETH_TXQ_FLAGS_NOXSUMTCP)
#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM)
#define MBUF_CACHE_SIZE (250)
#define BURST_SIZE (32)
#define DEFAULT_MBUF_DATA_SIZE (2048)
#define RTE_TEST_RX_DESC_MAX (2048)
#define RTE_TEST_TX_DESC_MAX (2048)
#define MAX_PKT_BURST (512)
@ -280,8 +278,8 @@ test_setup(void)
RTE_TEST_TX_DESC_MAX + MAX_PKT_BURST;
if (test_params->mbuf_pool == NULL) {
test_params->mbuf_pool = rte_pktmbuf_pool_create("MBUF_POOL",
nb_mbuf_per_pool, MBUF_CACHE_SIZE, 0, MBUF_DATA_SIZE,
rte_socket_id());
nb_mbuf_per_pool, MBUF_CACHE_SIZE, 0,
RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
TEST_ASSERT_NOT_NULL(test_params->mbuf_pool,
"rte_mempool_create failed");
}

View File

@ -65,11 +65,9 @@
#define RX_RING_SIZE 128
#define TX_RING_SIZE 512
#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM)
#define MBUF_CACHE_SIZE (250)
#define BURST_SIZE (32)
#define DEFAULT_MBUF_DATA_SIZE (2048)
#define TEST_RX_DESC_MAX (2048)
#define TEST_TX_DESC_MAX (2048)
#define MAX_PKT_BURST (32)
@ -389,8 +387,8 @@ test_setup(void)
nb_mbuf_per_pool = TEST_RX_DESC_MAX + DEF_PKT_BURST +
TEST_TX_DESC_MAX + MAX_PKT_BURST;
test_params.mbuf_pool = rte_pktmbuf_pool_create("TEST_MODE4",
nb_mbuf_per_pool, MBUF_CACHE_SIZE, 0, MBUF_DATA_SIZE,
socket_id);
nb_mbuf_per_pool, MBUF_CACHE_SIZE, 0,
RTE_MBUF_DEFAULT_BUF_SIZE, socket_id);
TEST_ASSERT(test_params.mbuf_pool != NULL,
"rte_mempool_create failed\n");

View File

@ -47,7 +47,6 @@
#define NB_ETHPORTS_USED (1)
#define NB_SOCKETS (2)
#define MEMPOOL_CACHE_SIZE 250
#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM)
#define MAX_PKT_BURST (32)
#define RTE_TEST_RX_DESC_DEFAULT (128)
#define RTE_TEST_TX_DESC_DEFAULT (512)
@ -290,8 +289,8 @@ init_mbufpool(unsigned nb_mbuf)
snprintf(s, sizeof(s), "mbuf_pool_%d", socketid);
mbufpool[socketid] =
rte_pktmbuf_pool_create(s, nb_mbuf,
MEMPOOL_CACHE_SIZE, 0, MBUF_DATA_SIZE,
socketid);
MEMPOOL_CACHE_SIZE, 0,
RTE_MBUF_DEFAULT_BUF_SIZE, socketid);
if (mbufpool[socketid] == NULL)
rte_exit(EXIT_FAILURE,
"Cannot init mbuf pool on socket %d\n",

View File

@ -48,7 +48,6 @@ static struct rte_mempool *mp;
#define RING_SIZE 256
#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM)
#define NB_MBUF 512
static int
@ -407,7 +406,7 @@ static int
test_pmd_ring(void)
{
mp = rte_pktmbuf_pool_create("mbuf_pool", NB_MBUF, 32,
0, MBUF_DATA_SIZE, rte_socket_id());
0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
if (mp == NULL)
return -1;

View File

@ -50,7 +50,6 @@
#define REORDER_BUFFER_SIZE 16384
#define NUM_MBUFS (2*REORDER_BUFFER_SIZE)
#define REORDER_BUFFER_SIZE_INVALID 2049
#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM)
struct reorder_unittest_params {
struct rte_mempool *p;
@ -352,7 +351,8 @@ test_setup(void)
/* mempool creation */
if (test_params->p == NULL) {
test_params->p = rte_pktmbuf_pool_create("RO_MBUF_POOL",
NUM_MBUFS, BURST, 0, MBUF_DATA_SIZE, rte_socket_id());
NUM_MBUFS, BURST, 0, RTE_MBUF_DEFAULT_BUF_SIZE,
rte_socket_id());
if (test_params->p == NULL) {
printf("%s: Error creating mempool\n", __func__);
return -1;

View File

@ -65,7 +65,7 @@
#define PORT_TX_RING_SIZE 512
#define RING_RX_SIZE 128
#define RING_TX_SIZE 128
#define POOL_BUFFER_SIZE (2048 + RTE_PKTMBUF_HEADROOM)
#define POOL_BUFFER_SIZE RTE_MBUF_DEFAULT_BUF_SIZE
#define POOL_SIZE (32 * 1024)
#define POOL_CACHE_SIZE 256
#define BURST_SIZE 8

View File

@ -96,7 +96,6 @@
#define RTE_LOGTYPE_DCB RTE_LOGTYPE_USER1
#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM)
#define NB_MBUF (1024*8)
#define MAX_PKT_BURST 32
@ -739,7 +738,7 @@ main(int argc, char *argv[])
rte_exit(EXIT_FAILURE, "You can have max 4 ports\n");
mbuf_pool = rte_pktmbuf_pool_create("MBUF_POOL", NB_MBUF, 32,
0, MBUF_DATA_SIZE, rte_socket_id());
0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
if (mbuf_pool == NULL)
rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n");

View File

@ -47,7 +47,6 @@
#define RX_RING_SIZE 256
#define TX_RING_SIZE 512
#define NUM_MBUFS ((64*1024)-1)
#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM)
#define MBUF_CACHE_SIZE 250
#define BURST_SIZE 32
#define RTE_RING_SZ 1024
@ -529,8 +528,8 @@ main(int argc, char *argv[])
"when using a single port\n");
mbuf_pool = rte_pktmbuf_pool_create("MBUF_POOL",
NUM_MBUFS * nb_ports, MBUF_CACHE_SIZE, 0, MBUF_DATA_SIZE,
rte_socket_id());
NUM_MBUFS * nb_ports, MBUF_CACHE_SIZE, 0,
RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
if (mbuf_pool == NULL)
rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n");
nb_ports_available = nb_ports;

View File

@ -70,7 +70,6 @@
#include "crypto.h"
#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM)
#define NB_MBUF (32 * 1024)
#define MAX_PKT_BURST 32
@ -613,7 +612,7 @@ init_mem(void)
snprintf(s, sizeof(s), "mbuf_pool_%d", socketid);
pktmbuf_pool[socketid] =
rte_pktmbuf_pool_create(s, NB_MBUF, 32, 0,
MBUF_DATA_SIZE, socketid);
RTE_MBUF_DEFAULT_BUF_SIZE, socketid);
if (pktmbuf_pool[socketid] == NULL) {
printf("Cannot init mbuf pool on socket %d\n", socketid);
return -1;

View File

@ -76,8 +76,6 @@
#define RTE_LOGTYPE_IP_FRAG RTE_LOGTYPE_USER1
#define MBUF_SIZE (2048 + RTE_PKTMBUF_HEADROOM)
/* allow max jumbo frame 9.5 KB */
#define JUMBO_FRAME_MAX_SIZE 0x2600
@ -745,7 +743,7 @@ init_mem(void)
snprintf(buf, sizeof(buf), "pool_direct_%i", socket);
mp = rte_pktmbuf_pool_create(buf, NB_MBUF, 32,
0, MBUF_DATA_SIZE, socket);
0, RTE_MBUF_DEFAULT_BUF_SIZE, socket);
if (mp == NULL) {
RTE_LOG(ERR, IP_FRAG, "Cannot create direct mempool\n");
return -1;

View File

@ -146,7 +146,7 @@ struct app_params app = {
.bsz_swq_wr = 64,
/* Buffer pool */
.pool_buffer_size = 2048 + RTE_PKTMBUF_HEADROOM,
.pool_buffer_size = RTE_MBUF_DEFAULT_BUF_SIZE,
.pool_size = 32 * 1024,
.pool_cache_size = 256,

View File

@ -85,7 +85,7 @@
#define MAX_JUMBO_PKT_LEN 9600
#define BUF_SIZE 2048
#define BUF_SIZE RTE_MBUF_DEFAULT_DATAROOM
#define MBUF_SIZE \
(BUF_SIZE + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM)

View File

@ -77,7 +77,7 @@
#define MCAST_CLONE_PORTS 2
#define MCAST_CLONE_SEGS 2
#define PKT_MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM)
#define PKT_MBUF_DATA_SIZE RTE_MBUF_DEFAULT_BUF_SIZE
#define NB_PKT_MBUF 8192
#define HDR_MBUF_DATA_SIZE (2 * RTE_PKTMBUF_HEADROOM)

View File

@ -71,7 +71,6 @@ static uint32_t l2fwd_ivshmem_enabled_port_mask = 0;
static struct ether_addr l2fwd_ivshmem_ports_eth_addr[RTE_MAX_ETHPORTS];
#define NB_MBUF 8192
#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM)
#define MAX_RX_QUEUE_PER_LCORE 16
#define MAX_TX_QUEUE_PER_PORT 16
@ -671,7 +670,7 @@ int main(int argc, char **argv)
/* create a shared mbuf pool */
l2fwd_ivshmem_pktmbuf_pool =
rte_pktmbuf_pool_create(MBUF_MP_NAME, NB_MBUF, 32,
0, MBUF_DATA_SIZE, rte_socket_id());
0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
if (l2fwd_ivshmem_pktmbuf_pool == NULL)
rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n");

View File

@ -70,7 +70,6 @@
#define RTE_LOGTYPE_L2FWD RTE_LOGTYPE_USER1
#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM)
#define NB_MBUF 8192
#define MAX_PKT_BURST 32
@ -834,7 +833,7 @@ main(int argc, char **argv)
/* create the mbuf pool */
l2fwd_pktmbuf_pool =
rte_pktmbuf_pool_create("mbuf_pool", NB_MBUF, 32,
0, MBUF_DATA_SIZE, rte_socket_id());
0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
if (l2fwd_pktmbuf_pool == NULL)
rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n");

View File

@ -71,7 +71,6 @@
#define RTE_LOGTYPE_L2FWD RTE_LOGTYPE_USER1
#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM)
#define NB_MBUF 8192
#define MAX_PKT_BURST 32
@ -561,7 +560,7 @@ main(int argc, char **argv)
/* create the mbuf pool */
l2fwd_pktmbuf_pool = rte_pktmbuf_pool_create("mbuf_pool", NB_MBUF, 32,
0, MBUF_DATA_SIZE, rte_socket_id());
0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
if (l2fwd_pktmbuf_pool == NULL)
rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n");

View File

@ -80,8 +80,6 @@
#define MEMPOOL_CACHE_SIZE 256
#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM)
/*
* This expression is used to calculate the number of mbufs needed
* depending on user input, taking into account memory for rx and tx hardware
@ -1849,7 +1847,8 @@ init_mem(unsigned nb_mbuf)
snprintf(s, sizeof(s), "mbuf_pool_%d", socketid);
pktmbuf_pool[socketid] =
rte_pktmbuf_pool_create(s, nb_mbuf,
MEMPOOL_CACHE_SIZE, 0, MBUF_DATA_SIZE,
MEMPOOL_CACHE_SIZE, 0,
RTE_MBUF_DEFAULT_BUF_SIZE,
socketid);
if (pktmbuf_pool[socketid] == NULL)
rte_exit(EXIT_FAILURE,

View File

@ -121,8 +121,6 @@
#define MEMPOOL_CACHE_SIZE 256
#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM)
/*
* This expression is used to calculate the number of mbufs needed depending on
* user input, taking into account memory for rx and tx hardware rings, cache
@ -1380,7 +1378,8 @@ init_mem(unsigned nb_mbuf)
snprintf(s, sizeof(s), "mbuf_pool_%d", socketid);
pktmbuf_pool[socketid] =
rte_pktmbuf_pool_create(s, nb_mbuf,
MEMPOOL_CACHE_SIZE, 0, MBUF_DATA_SIZE,
MEMPOOL_CACHE_SIZE, 0,
RTE_MBUF_DEFAULT_BUF_SIZE,
socketid);
if (pktmbuf_pool[socketid] == NULL)
rte_exit(EXIT_FAILURE,

View File

@ -94,8 +94,6 @@
#define MEMPOOL_CACHE_SIZE 256
#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM)
/*
* This expression is used to calculate the number of mbufs needed depending on user input, taking
* into account memory for rx and tx hardware rings, cache per lcore and mtable per port per lcore.
@ -925,8 +923,8 @@ init_mem(unsigned nb_mbuf)
if (pktmbuf_pool[socketid] == NULL) {
snprintf(s, sizeof(s), "mbuf_pool_%d", socketid);
pktmbuf_pool[socketid] = rte_pktmbuf_pool_create(s,
nb_mbuf, MEMPOOL_CACHE_SIZE, 0, MBUF_DATA_SIZE,
socketid);
nb_mbuf, MEMPOOL_CACHE_SIZE, 0,
RTE_MBUF_DEFAULT_BUF_SIZE, socketid);
if (pktmbuf_pool[socketid] == NULL)
rte_exit(EXIT_FAILURE, "Cannot init mbuf pool on socket %d\n", socketid);
else

View File

@ -119,8 +119,6 @@
#define MEMPOOL_CACHE_SIZE 256
#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM)
/*
* This expression is used to calculate the number of mbufs needed depending on user input, taking
* into account memory for rx and tx hardware rings, cache per lcore and mtable per port per lcore.
@ -2316,8 +2314,8 @@ init_mem(unsigned nb_mbuf)
snprintf(s, sizeof(s), "mbuf_pool_%d", socketid);
pktmbuf_pool[socketid] =
rte_pktmbuf_pool_create(s, nb_mbuf,
MEMPOOL_CACHE_SIZE, 0, MBUF_DATA_SIZE,
socketid);
MEMPOOL_CACHE_SIZE, 0,
RTE_MBUF_DEFAULT_BUF_SIZE, socketid);
if (pktmbuf_pool[socketid] == NULL)
rte_exit(EXIT_FAILURE,
"Cannot init mbuf pool on socket %d\n", socketid);

View File

@ -72,7 +72,6 @@
#define RTE_LOGTYPE_LSI RTE_LOGTYPE_USER1
#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM)
#define NB_MBUF 8192
#define MAX_PKT_BURST 32
@ -615,7 +614,7 @@ main(int argc, char **argv)
/* create the mbuf pool */
lsi_pktmbuf_pool =
rte_pktmbuf_pool_create("mbuf_pool", NB_MBUF, 32, 0,
MBUF_DATA_SIZE, rte_socket_id());
RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
if (lsi_pktmbuf_pool == NULL)
rte_panic("Cannot init mbuf pool\n");

View File

@ -83,7 +83,7 @@
/* Mempools */
#ifndef APP_DEFAULT_MBUF_DATA_SIZE
#define APP_DEFAULT_MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM)
#define APP_DEFAULT_MBUF_DATA_SIZE RTE_MBUF_DEFAULT_BUF_SIZE
#endif
#ifndef APP_DEFAULT_MEMPOOL_BUFFERS

View File

@ -71,7 +71,6 @@
#define MBUFS_PER_CLIENT 1536
#define MBUFS_PER_PORT 1536
#define MBUF_CACHE_SIZE 512
#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM)
#define RTE_MP_RX_DESC_DEFAULT 512
#define RTE_MP_TX_DESC_DEFAULT 512
@ -103,7 +102,7 @@ init_mbuf_pools(void)
printf("Creating mbuf pool '%s' [%u mbufs] ...\n",
PKTMBUF_POOL_NAME, num_mbufs);
pktmbuf_pool = rte_pktmbuf_pool_create(PKTMBUF_POOL_NAME, num_mbufs,
MBUF_CACHE_SIZE, 0, MBUF_DATA_SIZE, rte_socket_id());
MBUF_CACHE_SIZE, 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
return (pktmbuf_pool == NULL); /* 0 on success */
}

View File

@ -77,7 +77,8 @@
#define RTE_LOGTYPE_L2FWD RTE_LOGTYPE_USER1
#define MBUF_NAME "mbuf_pool_%d"
#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM)
#define MBUF_SIZE \
(RTE_MBUF_DEFAULT_DATAROOM + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM)
#define NB_MBUF 8192
#define RING_MASTER_NAME "l2fwd_ring_m2s_"
#define RING_SLAVE_NAME "l2fwd_ring_s2m_"

View File

@ -78,7 +78,6 @@
#define RTE_LOGTYPE_APP RTE_LOGTYPE_USER1
#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM)
#define NB_MBUFS 64*1024 /* use 64k mbufs */
#define MBUF_CACHE_SIZE 256
#define PKT_BURST 32
@ -447,7 +446,7 @@ main(int argc, char **argv)
mp = (proc_type == RTE_PROC_SECONDARY) ?
rte_mempool_lookup(_SMP_MBUF_POOL) :
rte_pktmbuf_pool_create(_SMP_MBUF_POOL, NB_MBUFS,
MBUF_CACHE_SIZE, 0, MBUF_DATA_SIZE,
MBUF_CACHE_SIZE, 0, RTE_MBUF_DEFAULT_BUF_SIZE,
rte_socket_id());
if (mp == NULL)
rte_exit(EXIT_FAILURE, "Cannot get memory pool for buffers\n");

View File

@ -47,7 +47,7 @@
#include "compat_netmap.h"
#define BUF_SIZE (2048)
#define BUF_SIZE RTE_MBUF_DEFAULT_DATAROOM
#define MBUF_DATA_SIZE (BUF_SIZE + RTE_PKTMBUF_HEADROOM)
#define MBUF_PER_POOL 8192

View File

@ -50,7 +50,6 @@
#define MAX_PKTS_BURST 32
#define REORDER_BUFFER_SIZE 8192
#define MBUF_PER_POOL 65535
#define MBUF_DATA_SIZE (1600 + RTE_PKTMBUF_HEADROOM)
#define MBUF_POOL_CACHE_SIZE 250
#define RING_SIZE 16384
@ -623,7 +622,7 @@ main(int argc, char **argv)
"when using a single port\n");
mbuf_pool = rte_pktmbuf_pool_create("mbuf_pool", MBUF_PER_POOL,
MBUF_POOL_CACHE_SIZE, 0, MBUF_DATA_SIZE,
MBUF_POOL_CACHE_SIZE, 0, RTE_MBUF_DEFAULT_BUF_SIZE,
rte_socket_id());
if (mbuf_pool == NULL)
rte_exit(EXIT_FAILURE, "%s\n", rte_strerror(rte_errno));

View File

@ -70,7 +70,6 @@
* Buffer pool configuration
*
***/
#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM)
#define NB_MBUF 8192
#define MEMPOOL_CACHE_SIZE 256
@ -361,7 +360,7 @@ main(int argc, char **argv)
/* Buffer pool init */
pool = rte_pktmbuf_pool_create("pool", NB_MBUF, MEMPOOL_CACHE_SIZE,
0, MBUF_DATA_SIZE, rte_socket_id());
0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
if (pool == NULL)
rte_exit(EXIT_FAILURE, "Buffer pool creation error\n");

View File

@ -336,7 +336,8 @@ int app_init(void)
/* create the mbuf pools for each RX Port */
snprintf(pool_name, MAX_NAME_LEN, "mbuf_pool%u", i);
qos_conf[i].mbuf_pool = rte_pktmbuf_pool_create(pool_name,
mp_size, burst_conf.rx_burst * 4, 0, MBUF_DATA_SIZE,
mp_size, burst_conf.rx_burst * 4, 0,
RTE_MBUF_DEFAULT_BUF_SIZE,
rte_eth_dev_socket_id(qos_conf[i].rx_port));
if (qos_conf[i].mbuf_pool == NULL)
rte_exit(EXIT_FAILURE, "Cannot init mbuf pool for socket %u\n", i);

View File

@ -50,7 +50,6 @@ extern "C" {
#define APP_RX_DESC_DEFAULT 128
#define APP_TX_DESC_DEFAULT 256
#define MBUF_DATA_SIZE (1528 + RTE_PKTMBUF_HEADROOM)
#define APP_RING_SIZE (8*1024)
#define NB_MBUF (2*1024*1024)

View File

@ -40,7 +40,7 @@
#define RX_DESC_PER_QUEUE 128
#define TX_DESC_PER_QUEUE 512
#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM)
#define MBUF_DATA_SIZE RTE_MBUF_DEFAULT_BUF_SIZE
#define MBUF_PER_POOL 8192
#define QUOTA_WATERMARK_MEMZONE_NAME "qw_global_vars"

View File

@ -43,7 +43,6 @@
#define TX_RING_SIZE 512
#define NUM_MBUFS 8191
#define MBUF_DATA_SIZE (1600 + RTE_PKTMBUF_HEADROOM)
#define MBUF_CACHE_SIZE 250
#define BURST_SIZE 32
@ -205,8 +204,8 @@ main(int argc, char *argv[])
rte_exit(EXIT_FAILURE, "Error: number of ports must be even\n");
mbuf_pool = rte_pktmbuf_pool_create("MBUF_POOL",
NUM_MBUFS * nb_ports, MBUF_CACHE_SIZE, 0, MBUF_DATA_SIZE,
rte_socket_id());
NUM_MBUFS * nb_ports, MBUF_CACHE_SIZE, 0,
RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
if (mbuf_pool == NULL)
rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n");

View File

@ -43,7 +43,6 @@
#define TX_RING_SIZE 512
#define NUM_MBUFS 8191
#define MBUF_DATA_SIZE (1600 + RTE_PKTMBUF_HEADROOM)
#define MBUF_CACHE_SIZE 250
#define BURST_SIZE 32
@ -191,7 +190,7 @@ main(int argc, char *argv[])
/* Creates a new mempool in memory to hold the mbufs. */
mbuf_pool = rte_pktmbuf_pool_create("MBUF_POOL", NUM_MBUFS * nb_ports,
MBUF_CACHE_SIZE, 0, MBUF_DATA_SIZE, rte_socket_id());
MBUF_CACHE_SIZE, 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
if (mbuf_pool == NULL)
rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n");

View File

@ -66,16 +66,16 @@
(num_switching_cores*RTE_TEST_TX_DESC_DEFAULT) +\
(num_switching_cores*MBUF_CACHE_SIZE))
#define MBUF_CACHE_SIZE 128
#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM)
#define MBUF_CACHE_SIZE 128
#define MBUF_DATA_SIZE RTE_MBUF_DEFAULT_BUF_SIZE
/*
* No frame data buffer allocated from host are required for zero copy
* implementation, guest will allocate the frame data buffer, and vhost
* directly use it.
*/
#define VIRTIO_DESCRIPTOR_LEN_ZCP 1518
#define MBUF_DATA_SIZE_ZCP (VIRTIO_DESCRIPTOR_LEN_ZCP + RTE_PKTMBUF_HEADROOM)
#define VIRTIO_DESCRIPTOR_LEN_ZCP RTE_MBUF_DEFAULT_DATAROOM
#define MBUF_DATA_SIZE_ZCP RTE_MBUF_DEFAULT_BUF_SIZE
#define MBUF_CACHE_SIZE_ZCP 0
#define MAX_PKT_BURST 32 /* Max burst size for RX/TX */

View File

@ -67,7 +67,6 @@
(num_switching_cores*MBUF_CACHE_SIZE))
#define MBUF_CACHE_SIZE 64
#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM)
/*
* RX and TX Prefetch, Host, and Write-back threshold values should be
@ -1476,7 +1475,7 @@ main(int argc, char *argv[])
/* Create the mbuf pool. */
mbuf_pool = rte_pktmbuf_pool_create("MBUF_POOL",
NUM_MBUFS_PER_PORT * valid_num_ports, MBUF_CACHE_SIZE, 0,
MBUF_DATA_SIZE, rte_socket_id());
RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
if (mbuf_pool == NULL)
rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n");

View File

@ -76,7 +76,6 @@
*/
#define NUM_MBUFS_PER_PORT (128*512)
#define MBUF_CACHE_SIZE 64
#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM)
#define MAX_PKT_BURST 32
@ -615,7 +614,7 @@ main(int argc, char *argv[])
mbuf_pool = rte_pktmbuf_pool_create("MBUF_POOL",
NUM_MBUFS_PER_PORT * nb_ports, MBUF_CACHE_SIZE,
0, MBUF_DATA_SIZE, rte_socket_id());
0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
if (mbuf_pool == NULL)
rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n");

View File

@ -74,7 +74,6 @@
#define NUM_MBUFS 64*1024
#define MBUF_CACHE_SIZE 64
#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM)
#define INVALID_PORT_ID 0xFF
@ -442,7 +441,7 @@ main(int argc, char *argv[])
}
mbuf_pool = rte_pktmbuf_pool_create("MBUF_POOL", NUM_MBUFS * nb_ports,
MBUF_CACHE_SIZE, 0, MBUF_DATA_SIZE, rte_socket_id());
MBUF_CACHE_SIZE, 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
if (mbuf_pool == NULL)
rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n");

View File

@ -217,6 +217,16 @@ const char *rte_get_rx_ol_flag_name(uint64_t mask);
*/
const char *rte_get_tx_ol_flag_name(uint64_t mask);
/**
* Some NICs need at least 2KB buffer to RX standard Ethernet frame without
* splitting it into multiple segments.
* So, for mbufs that planned to be involved into RX/TX, the recommended
* minimal buffer length is 2KB + RTE_PKTMBUF_HEADROOM.
*/
#define RTE_MBUF_DEFAULT_DATAROOM 2048
#define RTE_MBUF_DEFAULT_BUF_SIZE \
(RTE_MBUF_DEFAULT_DATAROOM + RTE_PKTMBUF_HEADROOM)
/* define a set of marker types that can be used to refer to set points in the
* mbuf */
typedef void *MARKER[0]; /**< generic marker for a point in a structure */