X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_mbuf%2Frte_mbuf_dyn.c;h=538a43f6959f61a1eb58200cc2557ab71f152b9f;hb=deb31991b7849be943117458a4939e22fc194c65;hp=de7d2eb9a5065e4c1631237e3f2314638cce084a;hpb=359386e15b4778e5924dcb90d5d686a1c865436f;p=dpdk.git diff --git a/lib/librte_mbuf/rte_mbuf_dyn.c b/lib/librte_mbuf/rte_mbuf_dyn.c index de7d2eb9a5..538a43f695 100644 --- a/lib/librte_mbuf/rte_mbuf_dyn.c +++ b/lib/librte_mbuf/rte_mbuf_dyn.c @@ -67,13 +67,16 @@ process_score(void) shm->free_space[i] = 1; } - for (off = 0; off < sizeof(struct rte_mbuf); off++) { + off = 0; + while (off < sizeof(struct rte_mbuf)) { /* get the size of the free zone */ for (size = 0; (off + size) < sizeof(struct rte_mbuf) && shm->free_space[off + size]; size++) ; - if (size == 0) + if (size == 0) { + off++; continue; + } /* get the alignment of biggest object that can fit in * the zone at this offset. @@ -84,8 +87,10 @@ process_score(void) ; /* save it in free_space[] */ - for (i = off; i < off + size; i++) + for (i = off; i < off + align; i++) shm->free_space[i] = RTE_MAX(align, shm->free_space[i]); + + off += align; } } @@ -547,12 +552,20 @@ void rte_mbuf_dyn_dump(FILE *out) dynflag->params.name, dynflag->bitnum, dynflag->params.flags); } - fprintf(out, "Free space in mbuf (0 = free, value = zone alignment):\n"); + fprintf(out, "Free space in mbuf (0 = occupied, value = free zone alignment):\n"); for (i = 0; i < sizeof(struct rte_mbuf); i++) { if ((i % 8) == 0) fprintf(out, " %4.4zx: ", i); 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(); }