From: Hemant Agrawal <hemant.agrawal@nxp.com>
To: David Hunt <david.hunt@intel.com>, "dev@dpdk.org" <dev@dpdk.org>,
"Thomas Monjalon" <thomas.monjalon@6wind.com>
Cc: "olivier.matz@6wind.com" <olivier.matz@6wind.com>,
"viktorin@rehivetech.com" <viktorin@rehivetech.com>,
"jerin.jacob@caviumnetworks.com" <jerin.jacob@caviumnetworks.com>,
"Shreyansh Jain" <shreyansh.jain@nxp.com>
Subject: [dpdk-dev] usages issue with external mempool
Date: Tue, 26 Jul 2016 10:11:13 +0000 [thread overview]
Message-ID: <DB5PR04MB1605210D71D8CA61C01C78B6890E0@DB5PR04MB1605.eurprd04.prod.outlook.com> (raw)
Hi,
There was lengthy discussions w.r.t external mempool patches. However, I am still finding usages issue with the agreed approach.
The existing API to create packet mempool, "rte_pktmbuf_pool_create" does not provide the option to change the object init iterator. This may be the reason that many applications (e.g. OVS) are using rte_mempool_create to create packet mempool with their own object iterator (e.g. ovs_rte_pktmbuf_init).
e.g the existing usages are:
dmp->mp = rte_mempool_create(mp_name, mp_size, MBUF_SIZE(mtu),
MP_CACHE_SZ,
sizeof(struct rte_pktmbuf_pool_private),
rte_pktmbuf_pool_init, NULL,
ovs_rte_pktmbuf_init, NULL,
socket_id, 0);
With the new API set for packet pool create, this need to be changed to:
dmp->mp = rte_mempool_create_empty(mp_name, mp_size, MBUF_SIZE(mtu),
MP_CACHE_SZ,
sizeof(struct rte_pktmbuf_pool_private),
socket_id, 0);
if (dmp->mp == NULL)
break;
rte_errno = rte_mempool_set_ops_byname(dmp-mp,
RTE_MBUF_DEFAULT_MEMPOOL_OPS, NULL);
if (rte_errno != 0) {
RTE_LOG(ERR, MBUF, "error setting mempool handler\n");
return NULL;
}
rte_pktmbuf_pool_init(dmp->mp, NULL);
ret = rte_mempool_populate_default(dmp->mp);
if (ret < 0) {
rte_mempool_free(dmp->mp);
rte_errno = -ret;
return NULL;
}
rte_mempool_obj_iter(dmp->mp, ovs_rte_pktmbuf_init, NULL);
This is not a user friendly approach to ask for changing 1 API to 6 new APIs. Or, am I missing something?
I think, we should do one of the following:
1. Enhance "rte_pktmbuf_pool_create" to optionally accept "rte_mempool_obj_cb_t *obj_init, void *obj_init_arg" as inputs. If obj_init is not present, default can be used.
2. Create a new wrapper API (e.g. e_pktmbuf_pool_create_new) with the above said behavior e.g.:
/* helper to create a mbuf pool */
struct rte_mempool *
rte_pktmbuf_pool_create_new(const char *name, unsigned n,
unsigned cache_size, uint16_t priv_size, uint16_t data_room_size,
rte_mempool_obj_cb_t *obj_init, void *obj_init_arg,
int socket_id)
3. Let the existing rte_mempool_create accept flag as "MEMPOOL_F_HW_PKT_POOL". Obviously, if this flag is set - all other flag values should be ignored. This was discussed earlier also.
Please share your opinion.
Regards,
Hemant
next reply other threads:[~2016-07-26 10:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-26 10:11 Hemant Agrawal [this message]
2016-07-27 9:51 ` Jerin Jacob
2016-07-27 10:00 ` Thomas Monjalon
2016-07-27 13:23 ` Hemant Agrawal
2016-07-27 13:35 ` Thomas Monjalon
2016-07-27 16:52 ` Hemant Agrawal
2016-07-28 7:09 ` Thomas Monjalon
2016-07-28 8:32 ` Olivier MATZ
2016-07-28 10:25 ` Jerin Jacob
2016-07-29 10:09 ` Hemant Agrawal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DB5PR04MB1605210D71D8CA61C01C78B6890E0@DB5PR04MB1605.eurprd04.prod.outlook.com \
--to=hemant.agrawal@nxp.com \
--cc=david.hunt@intel.com \
--cc=dev@dpdk.org \
--cc=jerin.jacob@caviumnetworks.com \
--cc=olivier.matz@6wind.com \
--cc=shreyansh.jain@nxp.com \
--cc=thomas.monjalon@6wind.com \
--cc=viktorin@rehivetech.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).