diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 389fc24f8a..c3b6700b67 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -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 diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c index afe33a7fce..00b1d41387 100644 --- a/app/test/test_distributor.c +++ b/app/test/test_distributor.c @@ -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; diff --git a/app/test/test_distributor_perf.c b/app/test/test_distributor_perf.c index 4ed3552c9b..92b222010f 100644 --- a/app/test/test_distributor_perf.c +++ b/app/test/test_distributor_perf.c @@ -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; diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c index 674d8ddb37..305d45d450 100644 --- a/app/test/test_link_bonding.c +++ b/app/test/test_link_bonding.c @@ -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"); } diff --git a/app/test/test_link_bonding_mode4.c b/app/test/test_link_bonding_mode4.c index 590daad7fc..460539de8f 100644 --- a/app/test/test_link_bonding_mode4.c +++ b/app/test/test_link_bonding_mode4.c @@ -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"); diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c index 49a494de05..1fd6843cdf 100644 --- a/app/test/test_pmd_perf.c +++ b/app/test/test_pmd_perf.c @@ -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", diff --git a/app/test/test_pmd_ring.c b/app/test/test_pmd_ring.c index 53897f755d..a555db87a6 100644 --- a/app/test/test_pmd_ring.c +++ b/app/test/test_pmd_ring.c @@ -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; diff --git a/app/test/test_reorder.c b/app/test/test_reorder.c index 91fbe9aa98..5752d7e86b 100644 --- a/app/test/test_reorder.c +++ b/app/test/test_reorder.c @@ -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; diff --git a/app/test/test_table.h b/app/test/test_table.h index be331c0c9c..accc6f897a 100644 --- a/app/test/test_table.h +++ b/app/test/test_table.h @@ -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 diff --git a/examples/bond/main.c b/examples/bond/main.c index fcb4c4e99c..e90dc1d7a7 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -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"); diff --git a/examples/distributor/main.c b/examples/distributor/main.c index 78fe3e9042..ae3e7b32d6 100644 --- a/examples/distributor/main.c +++ b/examples/distributor/main.c @@ -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; diff --git a/examples/dpdk_qat/main.c b/examples/dpdk_qat/main.c index 053be91bee..c66a8cca5b 100644 --- a/examples/dpdk_qat/main.c +++ b/examples/dpdk_qat/main.c @@ -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; diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c index c702fdd23b..0922ba6777 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -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; diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c index 275fb35a05..d79762f15c 100644 --- a/examples/ip_pipeline/init.c +++ b/examples/ip_pipeline/init.c @@ -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, diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c index 75ecfed598..9ecb6f92c9 100644 --- a/examples/ip_reassembly/main.c +++ b/examples/ip_reassembly/main.c @@ -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) diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c index 575e98919f..2a2b915f0f 100644 --- a/examples/ipv4_multicast/main.c +++ b/examples/ipv4_multicast/main.c @@ -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) diff --git a/examples/l2fwd-ivshmem/host/host.c b/examples/l2fwd-ivshmem/host/host.c index 197f22ba2b..d923711e45 100644 --- a/examples/l2fwd-ivshmem/host/host.c +++ b/examples/l2fwd-ivshmem/host/host.c @@ -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"); diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c index fcebbda0ec..7b59f4e26b 100644 --- a/examples/l2fwd-jobstats/main.c +++ b/examples/l2fwd-jobstats/main.c @@ -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"); diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c index d0a1ec8d95..6ed7690387 100644 --- a/examples/l2fwd/main.c +++ b/examples/l2fwd/main.c @@ -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"); diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c index 1a04004816..a5d4f25ebc 100644 --- a/examples/l3fwd-acl/main.c +++ b/examples/l3fwd-acl/main.c @@ -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, diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index bb0b66f50d..6ac342bdec 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -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, diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c index f007bc1255..6e56cfb3ac 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -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 diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index 78710386ab..e32512eff3 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -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); diff --git a/examples/link_status_interrupt/main.c b/examples/link_status_interrupt/main.c index 6adbd7936e..c57a08a463 100644 --- a/examples/link_status_interrupt/main.c +++ b/examples/link_status_interrupt/main.c @@ -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"); diff --git a/examples/load_balancer/main.h b/examples/load_balancer/main.h index 17c0f7702f..d98468a7c0 100644 --- a/examples/load_balancer/main.h +++ b/examples/load_balancer/main.h @@ -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 diff --git a/examples/multi_process/client_server_mp/mp_server/init.c b/examples/multi_process/client_server_mp/mp_server/init.c index dc3647d1a0..7afd51af53 100644 --- a/examples/multi_process/client_server_mp/mp_server/init.c +++ b/examples/multi_process/client_server_mp/mp_server/init.c @@ -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 */ } diff --git a/examples/multi_process/l2fwd_fork/main.c b/examples/multi_process/l2fwd_fork/main.c index 04a5d2072f..f2d7eab345 100644 --- a/examples/multi_process/l2fwd_fork/main.c +++ b/examples/multi_process/l2fwd_fork/main.c @@ -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_" diff --git a/examples/multi_process/symmetric_mp/main.c b/examples/multi_process/symmetric_mp/main.c index 7829c86fd5..931c94fab8 100644 --- a/examples/multi_process/symmetric_mp/main.c +++ b/examples/multi_process/symmetric_mp/main.c @@ -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"); diff --git a/examples/netmap_compat/bridge/bridge.c b/examples/netmap_compat/bridge/bridge.c index 2d935cb5bd..5adcf6143f 100644 --- a/examples/netmap_compat/bridge/bridge.c +++ b/examples/netmap_compat/bridge/bridge.c @@ -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 diff --git a/examples/packet_ordering/main.c b/examples/packet_ordering/main.c index 5403c3303f..1d9a86fc19 100644 --- a/examples/packet_ordering/main.c +++ b/examples/packet_ordering/main.c @@ -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)); diff --git a/examples/qos_meter/main.c b/examples/qos_meter/main.c index a5e25103a7..0de5e7fb55 100644 --- a/examples/qos_meter/main.c +++ b/examples/qos_meter/main.c @@ -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"); diff --git a/examples/qos_sched/init.c b/examples/qos_sched/init.c index aaf3466588..88cf8111b8 100644 --- a/examples/qos_sched/init.c +++ b/examples/qos_sched/init.c @@ -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); diff --git a/examples/qos_sched/main.h b/examples/qos_sched/main.h index 0e6f264f3d..643f1c81e9 100644 --- a/examples/qos_sched/main.h +++ b/examples/qos_sched/main.h @@ -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) diff --git a/examples/quota_watermark/include/conf.h b/examples/quota_watermark/include/conf.h index e80aca58d4..bdc3bbede8 100644 --- a/examples/quota_watermark/include/conf.h +++ b/examples/quota_watermark/include/conf.h @@ -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" diff --git a/examples/rxtx_callbacks/main.c b/examples/rxtx_callbacks/main.c index fb8da5184c..048b23f5c7 100644 --- a/examples/rxtx_callbacks/main.c +++ b/examples/rxtx_callbacks/main.c @@ -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"); diff --git a/examples/skeleton/basicfwd.c b/examples/skeleton/basicfwd.c index ae606bf45a..c89822cb23 100644 --- a/examples/skeleton/basicfwd.c +++ b/examples/skeleton/basicfwd.c @@ -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"); diff --git a/examples/vhost/main.c b/examples/vhost/main.c index 195d82f605..a01a0575b5 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -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 */ diff --git a/examples/vhost_xen/main.c b/examples/vhost_xen/main.c index b672bf3ea3..60312b5f21 100644 --- a/examples/vhost_xen/main.c +++ b/examples/vhost_xen/main.c @@ -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"); diff --git a/examples/vmdq/main.c b/examples/vmdq/main.c index 7596bac3ce..a142d491f8 100644 --- a/examples/vmdq/main.c +++ b/examples/vmdq/main.c @@ -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"); diff --git a/examples/vmdq_dcb/main.c b/examples/vmdq_dcb/main.c index 3c7f2b381d..c31c2ce68a 100644 --- a/examples/vmdq_dcb/main.c +++ b/examples/vmdq_dcb/main.c @@ -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"); diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index 70b098717f..ab6de676a1 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -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 */