From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0046.outbound.protection.outlook.com [104.47.41.46]) by dpdk.org (Postfix) with ESMTP id DCA567CB5 for ; Thu, 1 Jun 2017 10:06:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=wfHtOa/Xc93Sp6ZnQa+QEKtwvS/Kbi8gJUt7c16f0mk=; b=HAnxw/wEAGMJftMzafLeo7ol4oxJf/98pW4EOPkLhfGTzy07oooEz+RJ3LA9kVt42XJEdYjJZZJr1U0nZGpYapCIv73DU6JS9Oe4WBfLwUVgMEQK1ZFAGxYc/glRZqJw7E0ntvoD629BaF25onGkm2gSUGNCKzJ2RiPNdjtua+4= Authentication-Results: 6wind.com; dkim=none (message not signed) header.d=none;6wind.com; dmarc=none action=none header.from=caviumnetworks.com; Received: from localhost.localdomain (14.140.2.178) by DM5PR07MB3098.namprd07.prod.outlook.com (10.172.85.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1143.10; Thu, 1 Jun 2017 08:06:44 +0000 From: Santosh Shukla To: olivier.matz@6wind.com, dev@dpdk.org Cc: hemant.agrawal@nxp.com, jerin.jacob@caviumnetworks.com, Santosh Shukla Date: Thu, 1 Jun 2017 13:35:58 +0530 Message-Id: <20170601080559.10684-2-santosh.shukla@caviumnetworks.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170601080559.10684-1-santosh.shukla@caviumnetworks.com> References: <20170601080559.10684-1-santosh.shukla@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: MA1PR01CA0102.INDPRD01.PROD.OUTLOOK.COM (10.174.56.146) To DM5PR07MB3098.namprd07.prod.outlook.com (10.172.85.8) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR07MB3098: X-MS-Office365-Filtering-Correlation-Id: 3c9a93cf-8178-4a00-0201-08d4a8c5264d X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:DM5PR07MB3098; X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3098; 3:YY6NeW/XEScNCmNgy287OX2a3uLCj/7YNUXtPRGD1KNRZCIiP3CbIQQj5+Zb/r8y7RQjiNe/jHAjpAZY8t3kXjFZraY1hJfxjV9Z8xqJNZZZf4TXxoV2UgYX8G0EkniXjtDgDk2b56xd/eii1DFSu2nI9QxYwgEyVArNs9LJCWoC5M8wAK/OfcTOHICDrCebvz5duvRLnx6+PuAhuz8yvuDaj/y7G+WjaWOPHTfTTShd33qz+NW7B4BH44KMT6diCUyjRKNA2IQdRGfW5AJEYkZp49NH/ZhZeUwnAMxGrxUP+a6NW2foNbScajshUk7sTKq7u/OBC2XF21Ihc/gxvA==; 25:kEfTPAGN2uGN5KRZSwWLAy2ZBuWbzotbkUrun4wAA2Etdgcn1BMeyUvh+z9p01jFz/OSIvr6+YmV+yApkBkxbfBllSw7AANDiP6ckaJDNQekmUBIAo12sndd+TdcOa4IAX7Zwz0oeBFBHWqJV3VXnjYGzHOvXEyAguZ44VplLD6gTFpZkf7D/eNQXF4RyB+FZGK/9LCA9mj9RG4pnjbPw1lcmk4+YIJc7y/Hp41h3Tf48YAIQtejm66YAN6oLBiivskSTCxyt8NjKG5rM+wQ31asonvw5mtYS+ytoH1STQnntXAUSkyrC5SpqSOZWeNoARQHn4Dd8SDK7sXqEgmfDAmQfmWOpswoFfUhfdq2QPSAuDFLKkvGkH6RMTQWTyIpVIFbkfvhCFt8XH6fWPnKCzUu85/PJioJCoom12XA6Zr8Ftw+V9UYq1qu9I2nRDyOlN7nE8HepWpOjYo1yQ/jwKbUHvkZDoeXLjygEKFCJZY= X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3098; 31:w+8XEhmkAHJxa9uloi+Lq43I4iLIrjqMHVydqPjAdZFXll8/xcxU1HoHgUv1JPJCZ+Qulx9qFVx2xRijsU/M13Os1tbWzXzYwRWy3yKQ6Rhd1sFb8+MEJOWHBlctjvW6ad+Ffd3C58V6mlSW0VgOWmaUh0CLL47c38Rv/8bg+9pgMmXCDjO0eDbr5+FPFqy37cJirFgF+sdpPt5wEXZoJmCFBfO9Wf9VVrjuvnWWguE=; 20:U3NUNfCEQoM5um9lRw11IU4zvdSQsRfgMBm/0tqQ+mVLmEujs1rzKME6ec7c4mR4k8Y52h8/JoXdc9+2N7SjMQ+iLXkDTlUyfC4Sn4jAmB69rvLiNOHBCOWWkTHvmy1AQOP4GIojqypVnDJlhSZLxZCC2JnWSWE9FSUkuKq3wwPc0Z90R8WEPviFccDOJvH5GOI4UdjxaZ+cbxZtSVmu7qcgpHPUBfEVAIn+QXCfKigB9laX9oW3svhMAbMOWccVxpia4aR0b504pkng/xFgGqCtX8CDM6NGO1r52ulYo3TT2H0JR9E6Y0+Fsh+K/9FroMQ2FR/zBnKMRY11rkkGRmyIpuhk+yP4fIUk/ob4Nud3Fb8rabeUoUqz27P4XgJxT/f0lFvw3FMrPuFlpT3V3guZsubl5EOmCuRqaneDwEsahdpemUcjd5Yyy+xyGkSjsALBb+dR+/E4HARwpulWGJ6OVJ/WHhR4w8pvUty8yI8TrsAHUqn/afkqbM7/rVvbLd1cG2UKx4KZhB8zAardq24x3Fm/UGRS36ULyyH3kYFx8I0zQtaSPSbrY7gNKkwks37fCw3aXjbrZQpERKnxV0Qn91EOp/VC6HwbQsKxy+0= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700087)(100105000095)(100000701087)(100105300095)(100000702087)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(100000703087)(100105400095)(93006095)(10201501046)(3002001)(6041248)(20161123564025)(20161123555025)(20161123562025)(20161123558100)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(100000704087)(100105200095)(100000705087)(100105500095); SRVR:DM5PR07MB3098; BCL:0; PCL:0; RULEID:(100000800087)(100110000095)(100000801087)(100110300095)(100000802087)(100110100095)(100000803087)(100110400095)(100000804087)(100110200095)(100000805087)(100110500095); SRVR:DM5PR07MB3098; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR07MB3098; 4:2ybe8HCRktEsUeFQxmExvoNw+nczz1Ubjyyyv0d/xr?= =?us-ascii?Q?5l0k2sCXyFVXmENkNVyzg8Ut4CjhPbd9pZBguVhlLyT9YeC+dSUfbtuX+vza?= =?us-ascii?Q?gl7uj9VKjCNjc3FXaeA3kAdF1nebzhLveoF2BY8zKzRObcc7PXmLIonCZ3ki?= =?us-ascii?Q?ozV7b55gD/eKZalxzHKhtkESFh3kcfIOEIC5HTHzWZITlavjR6ekyefQhRMD?= =?us-ascii?Q?C1zxbUU+jT1nbPn1B4N2FCGpU+GoxrKQHJkqUxDQ4fqdOIPA+UzAk77OZ5yz?= =?us-ascii?Q?HuVjYPK474cHOxgCbnBHNExJAmSevVTipHcd2lVQ/BNPCSbesHX6mKlnfuPp?= =?us-ascii?Q?jy2vitkHl4UEt8w5gwunWhQ3UAf4ZhQa+54FzokXksgQTAVQ/f/Mxn1/yt/H?= =?us-ascii?Q?3MSwTJrFhN7IEXQe4GmFMfnytgkZF0liwx60RqBdaaZWhqXWaqEMZUSIco7k?= =?us-ascii?Q?fyCNjsI5hFASDL0XE/C8YxfbfpdUmQq6MpJ1iLfz2svJfHOD5c343ISJPZgD?= =?us-ascii?Q?a8U2XuJU4R9cI6AglO5FqtRxR1YT7S++Z6mkJcUOVxLyAf4uWMJbZGvqEcPa?= =?us-ascii?Q?hIIUsyQfy0F8vjzw/z37WWyoLqk6ch+3pGrS7yq7Gc8Li7tUSX4v6BV1juM0?= =?us-ascii?Q?zGmkEEnTir2yDtMkprOTlYA3St/3gl2Hc/O+QstrGGwK1FLz2Bk4FgQgdmHF?= =?us-ascii?Q?5VMe03dBmWZGJDdIxaBRsUn+i6fq8eZgEHJlWJKJ/CFHrO3JTPVHIgykmOj4?= =?us-ascii?Q?l7GlpqiTXn9vPUDViL0wCXytzW2riAoZfuKwMxuoSPro5I5FbRK6Mi7WoiWv?= =?us-ascii?Q?glu/Cxad4mQcHTL5OWk5vKuT+eUTRYkd3nxAKhRhtnYulR4HxV2J59YBfnsX?= =?us-ascii?Q?cjVkAhJUNpcUNyqOH5NlXwbttx8kP1qymI29BqSZ2mWf3RSnM/QDkLzMke6Y?= =?us-ascii?Q?1EW6T7xwzXL0Ealovvfr4y1l18+2Bxq+jDGIn/LBr74fQZuUnBqT+76eYhlX?= =?us-ascii?Q?1l9Qi5GSuuH+auG/kDTQIfpvoJb+p5pTkWZM2Q6QH1hDHfX7IkhMKxgNZ5Tz?= =?us-ascii?Q?fa/p/63AuwUrtH7Iux8Bp/Z26Y0Kh25C7ZMAqx7v7+tbreGYDiphDHTIF+7v?= =?us-ascii?Q?b+3icEJdo=3D?= X-Forefront-PRVS: 0325F6C77B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(39450400003)(39850400002)(39840400002)(39400400002)(39410400002)(189998001)(66066001)(47776003)(107886003)(38730400002)(110136004)(6116002)(3846002)(5660300001)(5009440100003)(2906002)(48376002)(50466002)(478600001)(50226002)(8676002)(81166006)(53936002)(1076002)(76176999)(25786009)(305945005)(50986999)(6666003)(7736002)(2950100002)(42882006)(575784001)(6486002)(6512007)(5003940100001)(33646002)(72206003)(8656002)(42186005)(36756003)(6506006)(4326008)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR07MB3098; H:localhost.localdomain; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR07MB3098; 23:xml1mIR5h6R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gNuz28ct9vXmQH59bcUwoAPEM0++G74nf5AgCvwBpe6u9GH1bKX8VMDjucjA0AWn6pXvhcSsDErHK059QLzr2XDpSAVb8THzASC0Bpnk+gVNxWiQf8vAkO+tlDPqeM7LRTWQvfPLeUDSOE+JvFjFGfQDtrhKpJ3SMa8ZgbquFa5HsH/3rMY090hylmyk4vEtyZ/tWChM5qgOzBPJBi+NlkOUWD5UulxGjPiLpzB6QPdRGlXxXlei8rIimpTCw1WqbPw1/Al5HsMH73KOXM1Zi7BSliSy5qJgUSpFXEFEFah42zQV47jZCAac5L6NMzcpEtWdM+gJ6eMdb4Llpnf2zOsG1ZwkJee9BppURu42AtdCsvWxYo2ttyg9X65C9Lf4HaXClY7tiQlTpLnohT5mC31qOswqdaAztKL8Ig3QTeuC29ZO/pSxstBO; 24:NHcDm4QDdU3iZIrMHr4A79yQ211w3+aKAqqVSH2MOQreDxVNYzBZcO8iklEwesJqVgjlXowff+Mdiksr34JsOKHk+rgABRIBykK1Fz8hrGc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3098; 7:54W5zWNlbaQ643wefarO6iWV8pMqARPoh7ookNvgi16Mno7DETwvGDeMN3ogWJ6rgH5T/oSGpWnRi0CjqwRnWhzlJTZ28l9I+q0hqC2jNWYbIusCv4RDLkaJR2ZlJ/fGxEhrLroMPOGXkBrS+wSD/NiNvWwtLGUP9Tt5ttHTXSKyM/gxHAWGSBXC9HuZHDAykIKbaKreBwOneN5ND3d5vYXRBlDk4PzJK6/xogWKttrVEV8RpN7//WLKzRwjK56+TZYuw1v5zji6xUc2RpmD0CQBVHg12SMFoYbhTOUFKKKUP/tnefaQBuvblfL1Pv0L4BygNsgsiBUrH91bklzirA== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2017 08:06:44.7093 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR07MB3098 Subject: [dpdk-dev] [PATCH 1/2] eal: Introducing option to set mempool handle X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jun 2017 08:06:49 -0000 Platform can have external PCI cards like Intel 40G card and Integrated NIC like OcteoTX. Where both NIC has their preferred pool handle. Example: Intel 40G NIC preferred pool is ring_mp_mc and OcteonTX preferred pool handle would be ext-mempool's handle named 'octeontx-fpavf'. There is no way that either of NIC's could use their choice of mempool handle. Because Currently mempool handle programmed in static way i.e. User has to set pool handle name in CONFIG_RTE_MEMPOOL_OPS_DEFAULT='' So introducing eal option --pkt-mempool="". Signed-off-by: Santosh Shukla --- lib/librte_eal/bsdapp/eal/eal.c | 9 +++++++ lib/librte_eal/bsdapp/eal/rte_eal_version.map | 7 +++++ lib/librte_eal/common/eal_common_options.c | 3 +++ lib/librte_eal/common/eal_internal_cfg.h | 2 ++ lib/librte_eal/common/eal_options.h | 2 ++ lib/librte_eal/common/include/rte_eal.h | 9 +++++++ lib/librte_eal/linuxapp/eal/eal.c | 36 +++++++++++++++++++++++++ lib/librte_eal/linuxapp/eal/rte_eal_version.map | 7 +++++ lib/librte_mbuf/rte_mbuf.c | 8 ++++-- 9 files changed, 81 insertions(+), 2 deletions(-) diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c index 05f0c1f90..7d8824707 100644 --- a/lib/librte_eal/bsdapp/eal/eal.c +++ b/lib/librte_eal/bsdapp/eal/eal.c @@ -113,6 +113,15 @@ struct internal_config internal_config; /* used by rte_rdtsc() */ int rte_cycles_vmware_tsc_map; +char *__rte_unused +rte_eal_get_mp_name(void) +{ + if (internal_config.mp_name[0] == 0x0) + return NULL; + else + return internal_config.mp_name; +} + /* Return a pointer to the configuration structure */ struct rte_config * rte_eal_get_configuration(void) diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map index 2e48a7366..a1e9ad95f 100644 --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map @@ -193,3 +193,10 @@ DPDK_17.05 { vfio_get_group_no; } DPDK_17.02; + +DPDK_17.08 { + global: + + rte_eal_get_mp_name; + +} DPDK_17.05; diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c index f470195f3..1c147a696 100644 --- a/lib/librte_eal/common/eal_common_options.c +++ b/lib/librte_eal/common/eal_common_options.c @@ -95,6 +95,7 @@ eal_long_options[] = { {OPT_VFIO_INTR, 1, NULL, OPT_VFIO_INTR_NUM }, {OPT_VMWARE_TSC_MAP, 0, NULL, OPT_VMWARE_TSC_MAP_NUM }, {OPT_XEN_DOM0, 0, NULL, OPT_XEN_DOM0_NUM }, + {OPT_PKT_MEMPOOL, 1, NULL, OPT_PKT_MEMPOOL_NUM }, {0, 0, NULL, 0 } }; @@ -161,6 +162,7 @@ eal_reset_internal_config(struct internal_config *internal_cfg) #endif internal_cfg->vmware_tsc_map = 0; internal_cfg->create_uio_dev = 0; + memset(&internal_cfg->mp_name[0], 0x0, MAX_POOL_NAME_LEN); } static int @@ -1083,5 +1085,6 @@ eal_common_usage(void) " --"OPT_NO_PCI" Disable PCI\n" " --"OPT_NO_HPET" Disable HPET\n" " --"OPT_NO_SHCONF" No shared config (mmap'd files)\n" + " --"OPT_PKT_MEMPOOL" Use pool name as mempool for port\n" "\n", RTE_MAX_LCORE); } diff --git a/lib/librte_eal/common/eal_internal_cfg.h b/lib/librte_eal/common/eal_internal_cfg.h index 7b7e8c887..b8fedd2e6 100644 --- a/lib/librte_eal/common/eal_internal_cfg.h +++ b/lib/librte_eal/common/eal_internal_cfg.h @@ -43,6 +43,7 @@ #include #define MAX_HUGEPAGE_SIZES 3 /**< support up to 3 page sizes */ +#define MAX_POOL_NAME_LEN 256 /**< Max len of a pool name */ /* * internal configuration structure for the number, size and @@ -84,6 +85,7 @@ struct internal_config { const char *hugepage_dir; /**< specific hugetlbfs directory to use */ unsigned num_hugepage_sizes; /**< how many sizes on this system */ + char mp_name[MAX_POOL_NAME_LEN]; /**< mempool handle name */ struct hugepage_info hugepage_info[MAX_HUGEPAGE_SIZES]; }; extern struct internal_config internal_config; /**< Global EAL configuration. */ diff --git a/lib/librte_eal/common/eal_options.h b/lib/librte_eal/common/eal_options.h index a881c62e2..4e52ee255 100644 --- a/lib/librte_eal/common/eal_options.h +++ b/lib/librte_eal/common/eal_options.h @@ -83,6 +83,8 @@ enum { OPT_VMWARE_TSC_MAP_NUM, #define OPT_XEN_DOM0 "xen-dom0" OPT_XEN_DOM0_NUM, +#define OPT_PKT_MEMPOOL "pkt-mempool" + OPT_PKT_MEMPOOL_NUM, OPT_LONG_MAX_NUM }; diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h index abf020bf9..c2f696a3d 100644 --- a/lib/librte_eal/common/include/rte_eal.h +++ b/lib/librte_eal/common/include/rte_eal.h @@ -283,6 +283,15 @@ static inline int rte_gettid(void) return RTE_PER_LCORE(_thread_id); } +/** + * Get mempool name from cmdline. + * + * @return + * On success, returns the pool name. + * On Failure, returs NULL. + */ +char *rte_eal_get_mp_name(void); + #define RTE_INIT(func) \ static void __attribute__((constructor, used)) func(void) diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index 7c78f2dc2..b2a6c8068 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c @@ -122,6 +122,15 @@ struct internal_config internal_config; /* used by rte_rdtsc() */ int rte_cycles_vmware_tsc_map; +char * +rte_eal_get_mp_name(void) +{ + if (internal_config.mp_name[0] == 0x0) + return NULL; + else + return internal_config.mp_name; +} + /* Return a pointer to the configuration structure */ struct rte_config * rte_eal_get_configuration(void) @@ -478,6 +487,23 @@ eal_parse_vfio_intr(const char *mode) return -1; } +static int +eal_parse_mp_name(const char *name) +{ + int len; + + if (name == NULL) + return -1; + + len = strlen(name); + if (len >= MAX_POOL_NAME_LEN) + return -1; + + strcpy(internal_config.mp_name, name); + + return 0; +} + /* Parse the arguments for --log-level only */ static void eal_log_level_parse(int argc, char **argv) @@ -611,6 +637,16 @@ eal_parse_args(int argc, char **argv) internal_config.create_uio_dev = 1; break; + case OPT_PKT_MEMPOOL_NUM: + if (eal_parse_mp_name(optarg) < 0) { + RTE_LOG(ERR, EAL, "invalid parameters for --" + OPT_PKT_MEMPOOL "\n"); + eal_usage(prgname); + ret = -1; + goto out; + } + break; + default: if (opt < OPT_LONG_MIN_NUM && isprint(opt)) { RTE_LOG(ERR, EAL, "Option %c is not supported " diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map index 670bab3a5..e57330bec 100644 --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map @@ -198,3 +198,10 @@ DPDK_17.05 { vfio_get_group_no; } DPDK_17.02; + +DPDK_17.08 { + global: + + rte_eal_get_mp_name; + +} DPDK_17.05 diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c index 0e3e36a58..38f4b3de0 100644 --- a/lib/librte_mbuf/rte_mbuf.c +++ b/lib/librte_mbuf/rte_mbuf.c @@ -158,6 +158,7 @@ rte_pktmbuf_pool_create(const char *name, unsigned n, { struct rte_mempool *mp; struct rte_pktmbuf_pool_private mbp_priv; + const char *mp_name = NULL; unsigned elt_size; int ret; @@ -177,8 +178,11 @@ rte_pktmbuf_pool_create(const char *name, unsigned n, if (mp == NULL) return NULL; - ret = rte_mempool_set_ops_byname(mp, - RTE_MBUF_DEFAULT_MEMPOOL_OPS, NULL); + mp_name = rte_eal_get_mp_name(); + if (mp_name == NULL) + mp_name = RTE_MBUF_DEFAULT_MEMPOOL_OPS; + + ret = rte_mempool_set_ops_byname(mp, mp_name, NULL); if (ret != 0) { RTE_LOG(ERR, MBUF, "error setting mempool handler\n"); rte_mempool_free(mp); -- 2.11.0