mbuf: fix reset on mbuf free
[dpdk.git] / lib / librte_mbuf / rte_mbuf.c
index 09d93e6..5f77840 100644 (file)
@@ -104,7 +104,7 @@ rte_pktmbuf_init(struct rte_mempool *mp,
        /* init some constant fields */
        m->pool = mp;
        m->nb_segs = 1;
-       m->port = MBUF_INVALID_PORT;
+       m->port = RTE_MBUF_PORT_INVALID;
        rte_mbuf_refcnt_set(m, 1);
        m->next = NULL;
 }
@@ -129,10 +129,10 @@ rte_pktmbuf_free_pinned_extmem(void *addr, void *opaque)
 
        rte_mbuf_ext_refcnt_set(m->shinfo, 1);
        m->ol_flags = EXT_ATTACHED_MBUF;
-       if (m->next != NULL) {
+       if (m->next != NULL)
                m->next = NULL;
+       if (m->nb_segs != 1)
                m->nb_segs = 1;
-       }
        rte_mbuf_raw_free(m);
 }
 
@@ -207,7 +207,7 @@ __rte_pktmbuf_init_extmem(struct rte_mempool *mp,
        /* init some constant fields */
        m->pool = mp;
        m->nb_segs = 1;
-       m->port = MBUF_INVALID_PORT;
+       m->port = RTE_MBUF_PORT_INVALID;
        m->ol_flags = EXT_ATTACHED_MBUF;
        rte_mbuf_refcnt_set(m, 1);
        m->next = NULL;