* [PATCH] reorder: introduce API to obtain memory footprint
@ 2023-04-14 8:52 Volodymyr Fialko
2023-06-01 15:07 ` Thomas Monjalon
0 siblings, 1 reply; 6+ messages in thread
From: Volodymyr Fialko @ 2023-04-14 8:52 UTC (permalink / raw)
To: dev, Reshma Pattan; +Cc: jerinj, anoobj, Volodymyr Fialko
At present, it is not easy to determine the memory requirement for the
reorder buffer without delving into its implementation details.
To facilitate the use of reorder buffer with user allocation, a new API
`rte_reorder_memory_footprint_get()` is introduced.
This API will provide the amount of required memory for reorder buffer.
Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
---
app/test/test_reorder.c | 8 ++++----
lib/reorder/rte_reorder.c | 13 +++++++++----
lib/reorder/rte_reorder.h | 16 ++++++++++++++++
lib/reorder/version.map | 2 ++
4 files changed, 31 insertions(+), 8 deletions(-)
diff --git a/app/test/test_reorder.c b/app/test/test_reorder.c
index f391597a78..6daa913ef9 100644
--- a/app/test/test_reorder.c
+++ b/app/test/test_reorder.c
@@ -68,12 +68,12 @@ test_reorder_init(void)
struct rte_reorder_buffer *b = NULL;
unsigned int size;
/*
- * The minimum memory area size that should be passed to library is,
- * sizeof(struct rte_reorder_buffer) + (2 * size * sizeof(struct rte_mbuf *));
+ * The minimum memory area size that should be passed to library determined
+ * by rte_reorder_memory_footprint_get().
* Otherwise error will be thrown
*/
- size = 100;
+ size = rte_reorder_memory_footprint_get(REORDER_BUFFER_SIZE) - 1;
b = rte_reorder_init(b, size, "PKT1", REORDER_BUFFER_SIZE);
TEST_ASSERT((b == NULL) && (rte_errno == EINVAL),
"No error on init with NULL buffer.");
@@ -84,7 +84,7 @@ test_reorder_init(void)
"No error on init with invalid mem zone size.");
rte_free(b);
- size = 262336;
+ size = rte_reorder_memory_footprint_get(REORDER_BUFFER_SIZE);
b = rte_malloc(NULL, size, 0);
b = rte_reorder_init(b, size, "PKT1", REORDER_BUFFER_SIZE_INVALID);
TEST_ASSERT((b == NULL) && (rte_errno == EINVAL),
diff --git a/lib/reorder/rte_reorder.c b/lib/reorder/rte_reorder.c
index 66d2cc07b7..f55f383700 100644
--- a/lib/reorder/rte_reorder.c
+++ b/lib/reorder/rte_reorder.c
@@ -54,12 +54,17 @@ struct rte_reorder_buffer {
static void
rte_reorder_free_mbufs(struct rte_reorder_buffer *b);
+unsigned int
+rte_reorder_memory_footprint_get(unsigned int size)
+{
+ return sizeof(struct rte_reorder_buffer) + (2 * size * sizeof(struct rte_mbuf *));
+}
+
struct rte_reorder_buffer *
rte_reorder_init(struct rte_reorder_buffer *b, unsigned int bufsize,
const char *name, unsigned int size)
{
- const unsigned int min_bufsize = sizeof(*b) +
- (2 * size * sizeof(struct rte_mbuf *));
+ const unsigned int min_bufsize = rte_reorder_memory_footprint_get(size);
static const struct rte_mbuf_dynfield reorder_seqn_dynfield_desc = {
.name = RTE_REORDER_SEQN_DYNFIELD_NAME,
.size = sizeof(rte_reorder_seqn_t),
@@ -148,8 +153,8 @@ rte_reorder_create(const char *name, unsigned socket_id, unsigned int size)
{
struct rte_reorder_buffer *b = NULL;
struct rte_tailq_entry *te, *te_inserted;
- const unsigned int bufsize = sizeof(struct rte_reorder_buffer) +
- (2 * size * sizeof(struct rte_mbuf *));
+
+ const unsigned int bufsize = rte_reorder_memory_footprint_get(size);
/* Check user arguments. */
if (!rte_is_power_of_2(size)) {
diff --git a/lib/reorder/rte_reorder.h b/lib/reorder/rte_reorder.h
index 9a5998f2f6..16dc4ee400 100644
--- a/lib/reorder/rte_reorder.h
+++ b/lib/reorder/rte_reorder.h
@@ -212,6 +212,22 @@ __rte_experimental
unsigned int
rte_reorder_min_seqn_set(struct rte_reorder_buffer *b, rte_reorder_seqn_t min_seqn);
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Determine the amount of memory needed by the reorder buffer to accommodate a given number of
+ * elements. @see rte_reorder_init()
+ *
+ * @param size
+ * Number of elements that can be stored in reorder buffer.
+ * @return
+ * Reorder buffer footprint measured in bytes.
+ */
+__rte_experimental
+unsigned int
+rte_reorder_memory_footprint_get(unsigned int size);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/reorder/version.map b/lib/reorder/version.map
index e21b91f526..7ff6a622f4 100644
--- a/lib/reorder/version.map
+++ b/lib/reorder/version.map
@@ -19,4 +19,6 @@ EXPERIMENTAL {
# added in 23.03
rte_reorder_drain_up_to_seqn;
rte_reorder_min_seqn_set;
+ # added in 23.07
+ rte_reorder_memory_footprint_get;
};
--
2.34.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] reorder: introduce API to obtain memory footprint
2023-04-14 8:52 [PATCH] reorder: introduce API to obtain memory footprint Volodymyr Fialko
@ 2023-06-01 15:07 ` Thomas Monjalon
2023-06-02 11:06 ` Pattan, Reshma
0 siblings, 1 reply; 6+ messages in thread
From: Thomas Monjalon @ 2023-06-01 15:07 UTC (permalink / raw)
To: Reshma Pattan, Volodymyr Fialko; +Cc: dev, jerinj, anoobj
Hello,
2 comments below
14/04/2023 10:52, Volodymyr Fialko:
> At present, it is not easy to determine the memory requirement for the
> reorder buffer without delving into its implementation details.
> To facilitate the use of reorder buffer with user allocation, a new API
> `rte_reorder_memory_footprint_get()` is introduced.
> This API will provide the amount of required memory for reorder buffer.
>
> Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
[...]
> +__rte_experimental
> +unsigned int
> +rte_reorder_memory_footprint_get(unsigned int size);
It should be of type size_t.
But I see other functions in this lib use the wrong type (unsigned int).
Like previous patches for the reorder library from Volodymyr,
the official maintainer (Reshma) is not reviewing.
Does it mean Reshma is not interested anymore in this maintenance?
Applied, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH] reorder: introduce API to obtain memory footprint
2023-06-01 15:07 ` Thomas Monjalon
@ 2023-06-02 11:06 ` Pattan, Reshma
2023-06-02 11:30 ` Volodymyr Fialko
0 siblings, 1 reply; 6+ messages in thread
From: Pattan, Reshma @ 2023-06-02 11:06 UTC (permalink / raw)
To: Thomas Monjalon, Volodymyr Fialko; +Cc: dev, jerinj, anoobj
> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
>
> Like previous patches for the reorder library from Volodymyr, the official
> maintainer (Reshma) is not reviewing.
> Does it mean Reshma is not interested anymore in this maintenance?
Hi Thomas,
I would like to drop from the maintainers responsibility for this library.
If any one is interested to be a Maintainer please do remove my name and add a new Maintainer name to the Maintainers list.
Thanks,
Reshma
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH] reorder: introduce API to obtain memory footprint
2023-06-02 11:06 ` Pattan, Reshma
@ 2023-06-02 11:30 ` Volodymyr Fialko
2023-06-02 11:33 ` Thomas Monjalon
0 siblings, 1 reply; 6+ messages in thread
From: Volodymyr Fialko @ 2023-06-02 11:30 UTC (permalink / raw)
To: Pattan, Reshma, Thomas Monjalon
Cc: dev, Jerin Jacob Kollanukkaran, Anoob Joseph
Hi Thomas and Reshma,
I would be interested in taking on the role of maintaining the reorder library.
> -----Original Message-----
> From: Pattan, Reshma <reshma.pattan@intel.com>
> Sent: Friday, June 2, 2023 1:06 PM
> To: Thomas Monjalon <thomas@monjalon.net>; Volodymyr Fialko <vfialko@marvell.com>
> Cc: dev@dpdk.org; Jerin Jacob Kollanukkaran <jerinj@marvell.com>; Anoob Joseph
> <anoobj@marvell.com>
> Subject: [EXT] RE: [PATCH] reorder: introduce API to obtain memory footprint
>
> External Email
>
> ----------------------------------------------------------------------
>
>
> > -----Original Message-----
> > From: Thomas Monjalon <thomas@monjalon.net>
> >
> > Like previous patches for the reorder library from Volodymyr, the
> > official maintainer (Reshma) is not reviewing.
> > Does it mean Reshma is not interested anymore in this maintenance?
>
> Hi Thomas,
>
> I would like to drop from the maintainers responsibility for this library.
> If any one is interested to be a Maintainer please do remove my name and add a new Maintainer
> name to the Maintainers list.
>
>
> Thanks,
> Reshma
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] reorder: introduce API to obtain memory footprint
2023-06-02 11:30 ` Volodymyr Fialko
@ 2023-06-02 11:33 ` Thomas Monjalon
2023-06-06 7:15 ` Pattan, Reshma
0 siblings, 1 reply; 6+ messages in thread
From: Thomas Monjalon @ 2023-06-02 11:33 UTC (permalink / raw)
To: Pattan, Reshma, Volodymyr Fialko
Cc: dev, Jerin Jacob Kollanukkaran, Anoob Joseph
02/06/2023 13:30, Volodymyr Fialko:
> Hi Thomas and Reshma,
>
> I would be interested in taking on the role of maintaining the reorder library.
If Reshma accepts, please send a patch to replace Reshma.
It will require an ack from Reshma.
Thank you both
> From: Pattan, Reshma <reshma.pattan@intel.com>
> > > From: Thomas Monjalon <thomas@monjalon.net>
> > >
> > > Like previous patches for the reorder library from Volodymyr, the
> > > official maintainer (Reshma) is not reviewing.
> > > Does it mean Reshma is not interested anymore in this maintenance?
> >
> > Hi Thomas,
> >
> > I would like to drop from the maintainers responsibility for this library.
> > If any one is interested to be a Maintainer please do remove my name and add a new Maintainer
> > name to the Maintainers list.
> >
> >
> > Thanks,
> > Reshma
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH] reorder: introduce API to obtain memory footprint
2023-06-02 11:33 ` Thomas Monjalon
@ 2023-06-06 7:15 ` Pattan, Reshma
0 siblings, 0 replies; 6+ messages in thread
From: Pattan, Reshma @ 2023-06-06 7:15 UTC (permalink / raw)
To: Thomas Monjalon, Volodymyr Fialko
Cc: dev, Jerin Jacob Kollanukkaran, Anoob Joseph
> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
<snip>
> Subject: Re: [PATCH] reorder: introduce API to obtain memory footprint
>
> 02/06/2023 13:30, Volodymyr Fialko:
> > Hi Thomas and Reshma,
> >
> > I would be interested in taking on the role of maintaining the reorder library.
>
> If Reshma accepts, please send a patch to replace Reshma.
> It will require an ack from Reshma.
> Thank you both
>
I am fine with the idea, I will ack the patch.
Thanks,
Reshma
>
<Snip>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-06-06 7:16 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-14 8:52 [PATCH] reorder: introduce API to obtain memory footprint Volodymyr Fialko
2023-06-01 15:07 ` Thomas Monjalon
2023-06-02 11:06 ` Pattan, Reshma
2023-06-02 11:30 ` Volodymyr Fialko
2023-06-02 11:33 ` Thomas Monjalon
2023-06-06 7:15 ` Pattan, Reshma
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).