eal: allow user to override default mempool driver
DPDK has support for both sw and hw mempool and currently user is limited to use ring_mp_mc pool. In case user want to use other pool handle, need to update config RTE_MEMPOOL_OPS_DEFAULT, then build and run with desired pool handle. Introducing eal option to override default pool handle. Now user can override the RTE_MEMPOOL_OPS_DEFAULT by passing pool handle to eal `--mbuf-pool-ops-name=""`. Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com> Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com> Acked-by: Olivier Matz <olivier.matz@6wind.com>
This commit is contained in:
parent
72d013644b
commit
a103a97e71
@ -163,6 +163,9 @@ Other options, specific to Linux and are not supported under FreeBSD are as foll
|
|||||||
* ``--huge-dir``:
|
* ``--huge-dir``:
|
||||||
The directory where hugetlbfs is mounted.
|
The directory where hugetlbfs is mounted.
|
||||||
|
|
||||||
|
* ``mbuf-pool-ops-name``:
|
||||||
|
Pool ops name for mbuf to use.
|
||||||
|
|
||||||
* ``--file-prefix``:
|
* ``--file-prefix``:
|
||||||
The prefix text used for hugepage filenames.
|
The prefix text used for hugepage filenames.
|
||||||
|
|
||||||
|
@ -157,6 +157,9 @@ The EAL options are as follows:
|
|||||||
* ``--huge-dir``:
|
* ``--huge-dir``:
|
||||||
The directory where hugetlbfs is mounted.
|
The directory where hugetlbfs is mounted.
|
||||||
|
|
||||||
|
* ``mbuf-pool-ops-name``:
|
||||||
|
Pool ops name for mbuf to use.
|
||||||
|
|
||||||
* ``--file-prefix``:
|
* ``--file-prefix``:
|
||||||
The prefix text used for hugepage filenames.
|
The prefix text used for hugepage filenames.
|
||||||
|
|
||||||
|
@ -110,6 +110,10 @@ See the DPDK Getting Started Guides for more information on these options.
|
|||||||
|
|
||||||
Specify the directory where the hugetlbfs is mounted.
|
Specify the directory where the hugetlbfs is mounted.
|
||||||
|
|
||||||
|
* ``mbuf-pool-ops-name``:
|
||||||
|
|
||||||
|
Pool ops name for mbuf to use.
|
||||||
|
|
||||||
* ``--proc-type``
|
* ``--proc-type``
|
||||||
|
|
||||||
Set the type of the current process.
|
Set the type of the current process.
|
||||||
|
@ -112,6 +112,13 @@ struct internal_config internal_config;
|
|||||||
/* used by rte_rdtsc() */
|
/* used by rte_rdtsc() */
|
||||||
int rte_cycles_vmware_tsc_map;
|
int rte_cycles_vmware_tsc_map;
|
||||||
|
|
||||||
|
/* Return mbuf pool ops name */
|
||||||
|
const char *
|
||||||
|
rte_eal_mbuf_default_mempool_ops(void)
|
||||||
|
{
|
||||||
|
return internal_config.mbuf_pool_ops_name;
|
||||||
|
}
|
||||||
|
|
||||||
/* Return a pointer to the configuration structure */
|
/* Return a pointer to the configuration structure */
|
||||||
struct rte_config *
|
struct rte_config *
|
||||||
rte_eal_get_configuration(void)
|
rte_eal_get_configuration(void)
|
||||||
@ -391,6 +398,9 @@ eal_parse_args(int argc, char **argv)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
|
case OPT_MBUF_POOL_OPS_NAME_NUM:
|
||||||
|
internal_config.mbuf_pool_ops_name = optarg;
|
||||||
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
eal_usage(prgname);
|
eal_usage(prgname);
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
|
@ -244,6 +244,7 @@ DPDK_17.11 {
|
|||||||
|
|
||||||
rte_bus_get_iommu_class;
|
rte_bus_get_iommu_class;
|
||||||
rte_eal_iova_mode;
|
rte_eal_iova_mode;
|
||||||
|
rte_eal_mbuf_default_mempool_ops;
|
||||||
rte_pci_get_iommu_class;
|
rte_pci_get_iommu_class;
|
||||||
rte_pci_match;
|
rte_pci_match;
|
||||||
|
|
||||||
|
@ -85,6 +85,7 @@ eal_long_options[] = {
|
|||||||
{OPT_LCORES, 1, NULL, OPT_LCORES_NUM },
|
{OPT_LCORES, 1, NULL, OPT_LCORES_NUM },
|
||||||
{OPT_LOG_LEVEL, 1, NULL, OPT_LOG_LEVEL_NUM },
|
{OPT_LOG_LEVEL, 1, NULL, OPT_LOG_LEVEL_NUM },
|
||||||
{OPT_MASTER_LCORE, 1, NULL, OPT_MASTER_LCORE_NUM },
|
{OPT_MASTER_LCORE, 1, NULL, OPT_MASTER_LCORE_NUM },
|
||||||
|
{OPT_MBUF_POOL_OPS_NAME, 1, NULL, OPT_MBUF_POOL_OPS_NAME_NUM},
|
||||||
{OPT_NO_HPET, 0, NULL, OPT_NO_HPET_NUM },
|
{OPT_NO_HPET, 0, NULL, OPT_NO_HPET_NUM },
|
||||||
{OPT_NO_HUGE, 0, NULL, OPT_NO_HUGE_NUM },
|
{OPT_NO_HUGE, 0, NULL, OPT_NO_HUGE_NUM },
|
||||||
{OPT_NO_PCI, 0, NULL, OPT_NO_PCI_NUM },
|
{OPT_NO_PCI, 0, NULL, OPT_NO_PCI_NUM },
|
||||||
@ -220,6 +221,7 @@ eal_reset_internal_config(struct internal_config *internal_cfg)
|
|||||||
#endif
|
#endif
|
||||||
internal_cfg->vmware_tsc_map = 0;
|
internal_cfg->vmware_tsc_map = 0;
|
||||||
internal_cfg->create_uio_dev = 0;
|
internal_cfg->create_uio_dev = 0;
|
||||||
|
internal_cfg->mbuf_pool_ops_name = RTE_MBUF_DEFAULT_MEMPOOL_OPS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -1279,6 +1281,7 @@ eal_common_usage(void)
|
|||||||
" '@' can be omitted if cpus and lcores have the same value\n"
|
" '@' can be omitted if cpus and lcores have the same value\n"
|
||||||
" -s SERVICE COREMASK Hexadecimal bitmask of cores to be used as service cores\n"
|
" -s SERVICE COREMASK Hexadecimal bitmask of cores to be used as service cores\n"
|
||||||
" --"OPT_MASTER_LCORE" ID Core ID that is used as master\n"
|
" --"OPT_MASTER_LCORE" ID Core ID that is used as master\n"
|
||||||
|
" --"OPT_MBUF_POOL_OPS_NAME" Pool ops name for mbuf to use\n"
|
||||||
" -n CHANNELS Number of memory channels\n"
|
" -n CHANNELS Number of memory channels\n"
|
||||||
" -m MB Memory to allocate (see also --"OPT_SOCKET_MEM")\n"
|
" -m MB Memory to allocate (see also --"OPT_SOCKET_MEM")\n"
|
||||||
" -r RANKS Force number of memory ranks (don't detect)\n"
|
" -r RANKS Force number of memory ranks (don't detect)\n"
|
||||||
|
@ -82,7 +82,7 @@ struct internal_config {
|
|||||||
volatile enum rte_intr_mode vfio_intr_mode;
|
volatile enum rte_intr_mode vfio_intr_mode;
|
||||||
const char *hugefile_prefix; /**< the base filename of hugetlbfs files */
|
const char *hugefile_prefix; /**< the base filename of hugetlbfs files */
|
||||||
const char *hugepage_dir; /**< specific hugetlbfs directory to use */
|
const char *hugepage_dir; /**< specific hugetlbfs directory to use */
|
||||||
|
const char *mbuf_pool_ops_name; /**< mbuf pool ops name */
|
||||||
unsigned num_hugepage_sizes; /**< how many sizes on this system */
|
unsigned num_hugepage_sizes; /**< how many sizes on this system */
|
||||||
struct hugepage_info hugepage_info[MAX_HUGEPAGE_SIZES];
|
struct hugepage_info hugepage_info[MAX_HUGEPAGE_SIZES];
|
||||||
};
|
};
|
||||||
|
@ -61,6 +61,8 @@ enum {
|
|||||||
OPT_LOG_LEVEL_NUM,
|
OPT_LOG_LEVEL_NUM,
|
||||||
#define OPT_MASTER_LCORE "master-lcore"
|
#define OPT_MASTER_LCORE "master-lcore"
|
||||||
OPT_MASTER_LCORE_NUM,
|
OPT_MASTER_LCORE_NUM,
|
||||||
|
#define OPT_MBUF_POOL_OPS_NAME "mbuf-pool-ops-name"
|
||||||
|
OPT_MBUF_POOL_OPS_NAME_NUM,
|
||||||
#define OPT_PROC_TYPE "proc-type"
|
#define OPT_PROC_TYPE "proc-type"
|
||||||
OPT_PROC_TYPE_NUM,
|
OPT_PROC_TYPE_NUM,
|
||||||
#define OPT_NO_HPET "no-hpet"
|
#define OPT_NO_HPET "no-hpet"
|
||||||
|
@ -299,6 +299,15 @@ static inline int rte_gettid(void)
|
|||||||
*/
|
*/
|
||||||
enum rte_iova_mode rte_eal_iova_mode(void);
|
enum rte_iova_mode rte_eal_iova_mode(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get default pool ops name for mbuf
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* returns default pool ops name.
|
||||||
|
*/
|
||||||
|
const char *
|
||||||
|
rte_eal_mbuf_default_mempool_ops(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run function before main() with low priority.
|
* Run function before main() with low priority.
|
||||||
*
|
*
|
||||||
|
@ -121,6 +121,13 @@ struct internal_config internal_config;
|
|||||||
/* used by rte_rdtsc() */
|
/* used by rte_rdtsc() */
|
||||||
int rte_cycles_vmware_tsc_map;
|
int rte_cycles_vmware_tsc_map;
|
||||||
|
|
||||||
|
/* Return mbuf pool ops name */
|
||||||
|
const char *
|
||||||
|
rte_eal_mbuf_default_mempool_ops(void)
|
||||||
|
{
|
||||||
|
return internal_config.mbuf_pool_ops_name;
|
||||||
|
}
|
||||||
|
|
||||||
/* Return a pointer to the configuration structure */
|
/* Return a pointer to the configuration structure */
|
||||||
struct rte_config *
|
struct rte_config *
|
||||||
rte_eal_get_configuration(void)
|
rte_eal_get_configuration(void)
|
||||||
@ -616,6 +623,10 @@ eal_parse_args(int argc, char **argv)
|
|||||||
internal_config.create_uio_dev = 1;
|
internal_config.create_uio_dev = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case OPT_MBUF_POOL_OPS_NAME_NUM:
|
||||||
|
internal_config.mbuf_pool_ops_name = optarg;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (opt < OPT_LONG_MIN_NUM && isprint(opt)) {
|
if (opt < OPT_LONG_MIN_NUM && isprint(opt)) {
|
||||||
RTE_LOG(ERR, EAL, "Option %c is not supported "
|
RTE_LOG(ERR, EAL, "Option %c is not supported "
|
||||||
|
@ -249,6 +249,7 @@ DPDK_17.11 {
|
|||||||
|
|
||||||
rte_bus_get_iommu_class;
|
rte_bus_get_iommu_class;
|
||||||
rte_eal_iova_mode;
|
rte_eal_iova_mode;
|
||||||
|
rte_eal_mbuf_default_mempool_ops;
|
||||||
rte_pci_get_iommu_class;
|
rte_pci_get_iommu_class;
|
||||||
rte_pci_match;
|
rte_pci_match;
|
||||||
|
|
||||||
|
@ -157,6 +157,7 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
|
|||||||
{
|
{
|
||||||
struct rte_mempool *mp;
|
struct rte_mempool *mp;
|
||||||
struct rte_pktmbuf_pool_private mbp_priv;
|
struct rte_pktmbuf_pool_private mbp_priv;
|
||||||
|
const char *mp_ops_name;
|
||||||
unsigned elt_size;
|
unsigned elt_size;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -176,8 +177,8 @@ rte_pktmbuf_pool_create(const char *name, unsigned n,
|
|||||||
if (mp == NULL)
|
if (mp == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
ret = rte_mempool_set_ops_byname(mp,
|
mp_ops_name = rte_eal_mbuf_default_mempool_ops();
|
||||||
RTE_MBUF_DEFAULT_MEMPOOL_OPS, NULL);
|
ret = rte_mempool_set_ops_byname(mp, mp_ops_name, NULL);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
RTE_LOG(ERR, MBUF, "error setting mempool handler\n");
|
RTE_LOG(ERR, MBUF, "error setting mempool handler\n");
|
||||||
rte_mempool_free(mp);
|
rte_mempool_free(mp);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user