mempool: enhance dump function to print ops name
PATCH 1/1 mempool: enhance dump function to print ops name
Enhance the dump function to also print the ops index and associated mempool ops name
--- lib/librte_mempool/rte_mempool.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
lib/librte_mempool/rte_mempool.c +5 -1
@@ -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); }
Signature · 1 line
2.17.1
Hi Hemant,
Thank you for submitting this improvement. Minor comments below.
Quoted 21 lines · Hemant Agrawal
Enhance the dump function to also print the ops index and associated mempool ops name
Signed-off-by Hemant Agrawal <[email protected]>--- lib/librte_mempool/rte_mempool.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)lib/librte_mempool/rte_mempool.c +1
-0@@ -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 ;
lib/librte_mempool/rte_mempool.c rte_mempool_dump(FILE *f, struct rte_mempool *mp) · line 1215
Quoted 7 lines
lib/librte_mempool/rte_mempool.c +4
-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).
lib/librte_mempool/rte_mempool.c rte_mempool_dump(FILE *f, struct rte_mempool *mp) · line 1259
Quoted 10 lines
lib/librte_mempool/rte_mempool.c +0
-1STAILQ_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
PATCH v2 1/1 mempool: enhance dump function to print ops name
In reply to Hemant AgrawalEnhance the dump function to also print the ops index and associated mempool ops name
--- lib/librte_mempool/rte_mempool.c | 5 +++++ 1 file changed, 5 insertions(+)
lib/librte_mempool/rte_mempool.c +5 -0
@@ -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 ) {
Signature · 1 line
2.17.1
Quoted 4 lines · Hemant Agrawal
Enhance the dump function to also print the ops index and associated mempool ops name
Signed-off-by Hemant Agrawal <[email protected]>
with a nit below
Quoted 17 lines
--- lib/librte_mempool/rte_mempool.c | 5 +++++ 1 file changed, 5 insertions(+)lib/librte_mempool/rte_mempool.c +1
-0@@ -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 ;
lib/librte_mempool/rte_mempool.c rte_mempool_dump(FILE *f, struct rte_mempool *mp) · line 1294
Quoted 6 lines
lib/librte_mempool/rte_mempool.c +3
-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"
Quoted 4 lines
lib/librte_mempool/rte_mempool.c +1
-0+STAILQ_FOREACH (memhdr, &mp->mem_list, next) mem_len += memhdr->len;if (mem_len !=0 ) {
PATCH v3 1/1 mempool: enhance dump function to print ops name
In reply to Hemant AgrawalEnhance the dump function to also print the ops index and associated mempool ops name
--- lib/librte_mempool/rte_mempool.c | 5 +++++ 1 file changed, 5 insertions(+)
lib/librte_mempool/rte_mempool.c +5 -0
@@ -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 ) {
Signature · 1 line
2.17.1
Thomas Monjalon
AppliedQuoted 5 lines
Enhance the dump function to also print the ops index and associated mempool ops name
Signed-off-by Hemant Agrawal <[email protected]>Acked-by Andrew Rybchenko <[email protected]>
Applied, thanks