DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] mempool: enhance dump function to print ops name
@ 2020-07-11  9:59 Hemant Agrawal
  2020-07-31 12:55 ` Olivier Matz
  2020-08-17 11:15 ` [dpdk-dev] [PATCH v2] " Hemant Agrawal
  0 siblings, 2 replies; 6+ messages in thread
From: Hemant Agrawal @ 2020-07-11  9:59 UTC (permalink / raw)
  To: dev; +Cc: olivier.matz, Hemant Agrawal

Enhance the dump function to also print the ops index
and associated mempool ops name

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 lib/librte_mempool/rte_mempool.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
index 5b23e2ae78..462ea850a1 100644
--- a/lib/librte_mempool/rte_mempool.c
+++ b/lib/librte_mempool/rte_mempool.c
@@ -1186,6 +1186,7 @@ rte_mempool_dump(FILE *f, struct rte_mempool *mp)
 	unsigned lcore_id;
 #endif
 	struct rte_mempool_memhdr *memhdr;
+	struct rte_mempool_ops *ops;
 	unsigned common_count;
 	unsigned cache_count;
 	size_t mem_len = 0;
@@ -1208,6 +1209,10 @@ rte_mempool_dump(FILE *f, struct rte_mempool *mp)
 
 	fprintf(f, "  private_data_size=%"PRIu32"\n", mp->private_data_size);
 
+	ops = rte_mempool_get_ops(mp->ops_index);
+	fprintf(f, "  ops_index=%d ops_name: <%s>\n",
+		mp->ops_index, ops ? ops->name:"NA");
+
 	STAILQ_FOREACH(memhdr, &mp->mem_list, next)
 		mem_len += memhdr->len;
 	if (mem_len != 0) {
@@ -1250,7 +1255,6 @@ rte_mempool_dump(FILE *f, struct rte_mempool *mp)
 #else
 	fprintf(f, "  no statistics available\n");
 #endif
-
 	rte_mempool_audit(mp);
 }
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] mempool: enhance dump function to print ops name
  2020-07-11  9:59 [dpdk-dev] [PATCH] mempool: enhance dump function to print ops name Hemant Agrawal
@ 2020-07-31 12:55 ` Olivier Matz
  2020-08-17 11:15 ` [dpdk-dev] [PATCH v2] " Hemant Agrawal
  1 sibling, 0 replies; 6+ messages in thread
From: Olivier Matz @ 2020-07-31 12:55 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev

Hi Hemant,

Thank you for submitting this improvement. Minor comments
below.

On Sat, Jul 11, 2020 at 03:29:36PM +0530, Hemant Agrawal wrote:
> Enhance the dump function to also print the ops index
> and associated mempool ops name
> 
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
>  lib/librte_mempool/rte_mempool.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
> index 5b23e2ae78..462ea850a1 100644
> --- a/lib/librte_mempool/rte_mempool.c
> +++ b/lib/librte_mempool/rte_mempool.c
> @@ -1186,6 +1186,7 @@ rte_mempool_dump(FILE *f, struct rte_mempool *mp)
>  	unsigned lcore_id;
>  #endif
>  	struct rte_mempool_memhdr *memhdr;
> +	struct rte_mempool_ops *ops;
>  	unsigned common_count;
>  	unsigned cache_count;
>  	size_t mem_len = 0;
> @@ -1208,6 +1209,10 @@ rte_mempool_dump(FILE *f, struct rte_mempool *mp)
>  
>  	fprintf(f, "  private_data_size=%"PRIu32"\n", mp->private_data_size);
>  
> +	ops = rte_mempool_get_ops(mp->ops_index);
> +	fprintf(f, "  ops_index=%d ops_name: <%s>\n",
> +		mp->ops_index, ops ? ops->name:"NA");
> +

Could you have 2 printed lines for it? One for index, and another
for the name.

About the ternary operator, even if checkpatch does not complain,
I prefer having one space on each side around the colon (this form
is more common in dpdk).

>  	STAILQ_FOREACH(memhdr, &mp->mem_list, next)
>  		mem_len += memhdr->len;
>  	if (mem_len != 0) {
> @@ -1250,7 +1255,6 @@ rte_mempool_dump(FILE *f, struct rte_mempool *mp)
>  #else
>  	fprintf(f, "  no statistics available\n");
>  #endif
> -
>  	rte_mempool_audit(mp);
>  }

Uneeded line removal there.


Thanks!
Olivier

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH v2] mempool: enhance dump function to print ops name
  2020-07-11  9:59 [dpdk-dev] [PATCH] mempool: enhance dump function to print ops name Hemant Agrawal
  2020-07-31 12:55 ` Olivier Matz
@ 2020-08-17 11:15 ` Hemant Agrawal
  2020-08-29 11:29   ` Andrew Rybchenko
  2020-09-08  5:41   ` [dpdk-dev] [PATCH v3] " Hemant Agrawal
  1 sibling, 2 replies; 6+ messages in thread
From: Hemant Agrawal @ 2020-08-17 11:15 UTC (permalink / raw)
  To: dev; +Cc: olivier.matz

Enhance the dump function to also print the ops index
and associated mempool ops name

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 lib/librte_mempool/rte_mempool.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
index 7774f0c8da..10c5cb708f 100644
--- a/lib/librte_mempool/rte_mempool.c
+++ b/lib/librte_mempool/rte_mempool.c
@@ -1266,6 +1266,7 @@ rte_mempool_dump(FILE *f, struct rte_mempool *mp)
 	unsigned lcore_id;
 #endif
 	struct rte_mempool_memhdr *memhdr;
+	struct rte_mempool_ops *ops;
 	unsigned common_count;
 	unsigned cache_count;
 	size_t mem_len = 0;
@@ -1288,6 +1289,10 @@ rte_mempool_dump(FILE *f, struct rte_mempool *mp)
 
 	fprintf(f, "  private_data_size=%"PRIu32"\n", mp->private_data_size);
 
+	fprintf(f, "  ops_index=%d\n", mp->ops_index);
+	ops = rte_mempool_get_ops(mp->ops_index);
+	fprintf(f, "  ops_name: <%s>\n", ops ? ops->name : "NA");
+
 	STAILQ_FOREACH(memhdr, &mp->mem_list, next)
 		mem_len += memhdr->len;
 	if (mem_len != 0) {
-- 
2.17.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH v2] mempool: enhance dump function to print ops name
  2020-08-17 11:15 ` [dpdk-dev] [PATCH v2] " Hemant Agrawal
@ 2020-08-29 11:29   ` Andrew Rybchenko
  2020-09-08  5:41   ` [dpdk-dev] [PATCH v3] " Hemant Agrawal
  1 sibling, 0 replies; 6+ messages in thread
From: Andrew Rybchenko @ 2020-08-29 11:29 UTC (permalink / raw)
  To: Hemant Agrawal, dev; +Cc: olivier.matz

On 8/17/20 2:15 PM, Hemant Agrawal wrote:
> Enhance the dump function to also print the ops index
> and associated mempool ops name
>
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>

Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>

with a nit below

> ---
>  lib/librte_mempool/rte_mempool.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
> index 7774f0c8da..10c5cb708f 100644
> --- a/lib/librte_mempool/rte_mempool.c
> +++ b/lib/librte_mempool/rte_mempool.c
> @@ -1266,6 +1266,7 @@ rte_mempool_dump(FILE *f, struct rte_mempool *mp)
>  	unsigned lcore_id;
>  #endif
>  	struct rte_mempool_memhdr *memhdr;
> +	struct rte_mempool_ops *ops;
>  	unsigned common_count;
>  	unsigned cache_count;
>  	size_t mem_len = 0;
> @@ -1288,6 +1289,10 @@ rte_mempool_dump(FILE *f, struct rte_mempool *mp)
>  
>  	fprintf(f, "  private_data_size=%"PRIu32"\n", mp->private_data_size);
>  
> +	fprintf(f, "  ops_index=%d\n", mp->ops_index);
> +	ops = rte_mempool_get_ops(mp->ops_index);
> +	fprintf(f, "  ops_name: <%s>\n", ops ? ops->name : "NA");

DPDK coding style suggests to use explicit comparison vs NULL, i.e.
ops != NULL ? ops->name : "NA"

> +
>  	STAILQ_FOREACH(memhdr, &mp->mem_list, next)
>  		mem_len += memhdr->len;
>  	if (mem_len != 0) {


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH v3] mempool: enhance dump function to print ops name
  2020-08-17 11:15 ` [dpdk-dev] [PATCH v2] " Hemant Agrawal
  2020-08-29 11:29   ` Andrew Rybchenko
@ 2020-09-08  5:41   ` Hemant Agrawal
  2020-10-06 21:43     ` Thomas Monjalon
  1 sibling, 1 reply; 6+ messages in thread
From: Hemant Agrawal @ 2020-09-08  5:41 UTC (permalink / raw)
  To: dev; +Cc: thomas, olivier.matz

Enhance the dump function to also print the ops index
and associated mempool ops name

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 lib/librte_mempool/rte_mempool.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
index 7774f0c8da..d72056d28d 100644
--- a/lib/librte_mempool/rte_mempool.c
+++ b/lib/librte_mempool/rte_mempool.c
@@ -1266,6 +1266,7 @@ rte_mempool_dump(FILE *f, struct rte_mempool *mp)
 	unsigned lcore_id;
 #endif
 	struct rte_mempool_memhdr *memhdr;
+	struct rte_mempool_ops *ops;
 	unsigned common_count;
 	unsigned cache_count;
 	size_t mem_len = 0;
@@ -1288,6 +1289,10 @@ rte_mempool_dump(FILE *f, struct rte_mempool *mp)
 
 	fprintf(f, "  private_data_size=%"PRIu32"\n", mp->private_data_size);
 
+	fprintf(f, "  ops_index=%d\n", mp->ops_index);
+	ops = rte_mempool_get_ops(mp->ops_index);
+	fprintf(f, "  ops_name: <%s>\n", (ops != NULL) ? ops->name : "NA");
+
 	STAILQ_FOREACH(memhdr, &mp->mem_list, next)
 		mem_len += memhdr->len;
 	if (mem_len != 0) {
-- 
2.17.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH v3] mempool: enhance dump function to print ops name
  2020-09-08  5:41   ` [dpdk-dev] [PATCH v3] " Hemant Agrawal
@ 2020-10-06 21:43     ` Thomas Monjalon
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Monjalon @ 2020-10-06 21:43 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev, olivier.matz, arybchenko

> Enhance the dump function to also print the ops index
> and associated mempool ops name
> 
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>

Applied, thanks



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-10-06 21:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-11  9:59 [dpdk-dev] [PATCH] mempool: enhance dump function to print ops name Hemant Agrawal
2020-07-31 12:55 ` Olivier Matz
2020-08-17 11:15 ` [dpdk-dev] [PATCH v2] " Hemant Agrawal
2020-08-29 11:29   ` Andrew Rybchenko
2020-09-08  5:41   ` [dpdk-dev] [PATCH v3] " Hemant Agrawal
2020-10-06 21:43     ` Thomas Monjalon

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git