[5/5] mbuf: support to dump free_flags for dynamic flag

Message ID 20200613154922.42379-6-xiaolong.ye@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series small fixes for mbuf's dynamic field/flag feature |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Xiaolong Ye June 13, 2020, 3:49 p.m. UTC
  Add support to dump free_flags as below format:

Free bit in mbuf->ol_flags (0 = occupied, 1 = free):
  0000: 0 0 0 0 0 0 0 0
  0008: 0 0 0 0 0 0 0 0
  0010: 0 0 0 0 0 0 0 1
  0018: 1 1 1 1 1 1 1 1
  0020: 1 1 1 1 1 1 1 1
  0028: 1 0 0 0 0 0 0 0
  0030: 0 0 0 0 0 0 0 0
  0038: 0 0 0 0 0 0 0 0

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 lib/librte_mbuf/rte_mbuf_dyn.c | 8 ++++++++
 1 file changed, 8 insertions(+)
  

Comments

Olivier Matz June 25, 2020, 3:55 p.m. UTC | #1
On Sat, Jun 13, 2020 at 11:49:21PM +0800, Xiaolong Ye wrote:
> Add support to dump free_flags as below format:
> 
> Free bit in mbuf->ol_flags (0 = occupied, 1 = free):
>   0000: 0 0 0 0 0 0 0 0
>   0008: 0 0 0 0 0 0 0 0
>   0010: 0 0 0 0 0 0 0 1
>   0018: 1 1 1 1 1 1 1 1
>   0020: 1 1 1 1 1 1 1 1
>   0028: 1 0 0 0 0 0 0 0
>   0030: 0 0 0 0 0 0 0 0
>   0038: 0 0 0 0 0 0 0 0
> 
> Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>

Acked-by: Olivier Matz <olivier.matz@6wind.com>
  

Patch

diff --git a/lib/librte_mbuf/rte_mbuf_dyn.c b/lib/librte_mbuf/rte_mbuf_dyn.c
index f071651acf..538a43f695 100644
--- a/lib/librte_mbuf/rte_mbuf_dyn.c
+++ b/lib/librte_mbuf/rte_mbuf_dyn.c
@@ -559,5 +559,13 @@  void rte_mbuf_dyn_dump(FILE *out)
 		fprintf(out, "%2.2x%s", shm->free_space[i],
 			(i % 8 != 7) ? " " : "\n");
 	}
+	fprintf(out, "Free bit in mbuf->ol_flags (0 = occupied, 1 = free):\n");
+	for (i = 0; i < sizeof(uint64_t) * CHAR_BIT; i++) {
+		if ((i % 8) == 0)
+			fprintf(out, "  %4.4zx: ", i);
+		fprintf(out, "%1.1x%s", (shm->free_flags & (1ULL << i)) ? 1 : 0,
+			(i % 8 != 7) ? " " : "\n");
+	}
+
 	rte_mcfg_tailq_write_unlock();
 }