MCPcopy Create free account
hub / github.com/F-Stack/f-stack / create_mempools

Function create_mempools

dpdk/app/test-bbdev/test_bbdev_perf.c:530–655  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

528}
529
530static int
531create_mempools(struct active_device *ad, int socket_id,
532 enum rte_bbdev_op_type org_op_type, uint16_t num_ops)
533{
534 struct rte_mempool *mp;
535 unsigned int ops_pool_size, mbuf_pool_size = 0;
536 char pool_name[RTE_MEMPOOL_NAMESIZE];
537 const char *op_type_str;
538 enum rte_bbdev_op_type op_type = org_op_type;
539
540 struct op_data_entries *in = &test_vector.entries[DATA_INPUT];
541 struct op_data_entries *hard_out =
542 &test_vector.entries[DATA_HARD_OUTPUT];
543 struct op_data_entries *soft_out =
544 &test_vector.entries[DATA_SOFT_OUTPUT];
545 struct op_data_entries *harq_in =
546 &test_vector.entries[DATA_HARQ_INPUT];
547 struct op_data_entries *harq_out =
548 &test_vector.entries[DATA_HARQ_OUTPUT];
549
550 /* allocate ops mempool */
551 ops_pool_size = optimal_mempool_size(RTE_MAX(
552 /* Ops used plus 1 reference op */
553 RTE_MAX((unsigned int)(ad->nb_queues * num_ops + 1),
554 /* Minimal cache size plus 1 reference op */
555 (unsigned int)(1.5 * rte_lcore_count() *
556 OPS_CACHE_SIZE + 1)),
557 OPS_POOL_SIZE_MIN));
558
559 if (org_op_type == RTE_BBDEV_OP_NONE)
560 op_type = RTE_BBDEV_OP_TURBO_ENC;
561
562 op_type_str = rte_bbdev_op_type_str(op_type);
563 TEST_ASSERT_NOT_NULL(op_type_str, "Invalid op type: %u", op_type);
564
565 snprintf(pool_name, sizeof(pool_name), "%s_pool_%u", op_type_str,
566 ad->dev_id);
567 mp = rte_bbdev_op_pool_create(pool_name, op_type,
568 ops_pool_size, OPS_CACHE_SIZE, socket_id);
569 TEST_ASSERT_NOT_NULL(mp,
570 "ERROR Failed to create %u items ops pool for dev %u on socket %u.",
571 ops_pool_size,
572 ad->dev_id,
573 socket_id);
574 ad->ops_mempool = mp;
575
576 /* Do not create inputs and outputs mbufs for BaseBand Null Device */
577 if (org_op_type == RTE_BBDEV_OP_NONE)
578 return TEST_SUCCESS;
579
580 /* Inputs */
581 if (in->nb_segments > 0) {
582 mbuf_pool_size = optimal_mempool_size(ops_pool_size *
583 in->nb_segments);
584 mp = create_mbuf_pool(in, ad->dev_id, socket_id,
585 mbuf_pool_size, "in");
586 TEST_ASSERT_NOT_NULL(mp,
587 "ERROR Failed to create %u items input pktmbuf pool for dev %u on socket %u.",

Callers 1

run_test_case_on_deviceFunction · 0.85

Calls 6

optimal_mempool_sizeFunction · 0.85
rte_lcore_countFunction · 0.85
rte_bbdev_op_type_strFunction · 0.85
snprintfFunction · 0.85
rte_bbdev_op_pool_createFunction · 0.85
create_mbuf_poolFunction · 0.85

Tested by

no test coverage detected