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

Function pipeline_mempool_setup

dpdk/app/test-eventdev/test_pipeline_common.c:759–824  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

757}
758
759int
760pipeline_mempool_setup(struct evt_test *test, struct evt_options *opt)
761{
762 struct test_pipeline *t = evt_test_priv(test);
763 int i, ret;
764
765 if (!opt->mbuf_sz)
766 opt->mbuf_sz = RTE_MBUF_DEFAULT_BUF_SIZE;
767
768 if (!opt->max_pkt_sz)
769 opt->max_pkt_sz = RTE_ETHER_MAX_LEN;
770
771 RTE_ETH_FOREACH_DEV(i) {
772 struct rte_eth_dev_info dev_info;
773 uint16_t data_size = 0;
774
775 memset(&dev_info, 0, sizeof(dev_info));
776 ret = rte_eth_dev_info_get(i, &dev_info);
777 if (ret != 0) {
778 evt_err("Error during getting device (port %u) info: %s\n",
779 i, strerror(-ret));
780 return ret;
781 }
782
783 if (dev_info.rx_desc_lim.nb_mtu_seg_max != UINT16_MAX &&
784 dev_info.rx_desc_lim.nb_mtu_seg_max != 0) {
785 data_size = opt->max_pkt_sz /
786 dev_info.rx_desc_lim.nb_mtu_seg_max;
787 data_size += RTE_PKTMBUF_HEADROOM;
788
789 if (data_size > opt->mbuf_sz)
790 opt->mbuf_sz = data_size;
791 }
792 if (opt->per_port_pool) {
793 char name[RTE_MEMPOOL_NAMESIZE];
794
795 snprintf(name, RTE_MEMPOOL_NAMESIZE, "%s-%d",
796 test->name, i);
797 t->pool[i] = rte_pktmbuf_pool_create(
798 name, /* mempool name */
799 opt->pool_sz, /* number of elements*/
800 0, /* cache size*/
801 0, opt->mbuf_sz, opt->socket_id); /* flags */
802
803 if (t->pool[i] == NULL) {
804 evt_err("failed to create mempool %s", name);
805 return -ENOMEM;
806 }
807 }
808 }
809
810 if (!opt->per_port_pool) {
811 t->pool[0] = rte_pktmbuf_pool_create(
812 test->name, /* mempool name */
813 opt->pool_sz, /* number of elements*/
814 0, /* cache size*/
815 0, opt->mbuf_sz, opt->socket_id); /* flags */
816

Callers

nothing calls this directly

Calls 5

evt_test_privFunction · 0.85
memsetFunction · 0.85
rte_eth_dev_info_getFunction · 0.85
snprintfFunction · 0.85
rte_pktmbuf_pool_createFunction · 0.85

Tested by

no test coverage detected