[dpdk-users] A question about the function __mempool_get_bulk() of dpdk-16.04
Xiaoban_Wu at student.uml.edu
Tue Jun 7 22:52:25 CEST 2016
Dear DPDK Users,
I have been reading the pktgen-3.0.02 source codes with dpdk-16.04.
In the pktgen.c, function pktgen_send_pkts(), line 1098, it calls function wr_pktmbuf_alloc_bulk_noreset(). Then it calls the function rte_mempool_get_bulk() which calls the function __mempool_get_bulk().
Since in the function rte_pktmbuf_pool_create(), the "flags" is set to zero in default, this leads to that when calling __mempool_get_bulk(), the input parameter"is_mc==1". Hence the function __mempool_get_bulk() will execute the line 961-992 except that when "ret" is less that 0.
My question is why at line 992, this has to return 0? In the line 941, the comment says that ">=0: Success; number of objects supplied." I am confused by this comment, since in line 985-990, we can see that the input parameter "obj_table" is supplied by new values and the number of the new values is "n". Does this means that we need to "return n;" instead of "return 0;"?
Am I missing something here? Thank you so much for your help.
All the best,
More information about the users