X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_mbuf%2Frte_mbuf.h;h=4a9ab415c536518a26d10a69b2a4a590dc2d5c9f;hb=591a9d7985c1230652d9f7ea1f9221e8c66ec188;hp=e0c5268d5b7419d713824eab1c184c62a910fbb4;hpb=1c1d4d7a923d4804f1926fc5264f9ecdd8977b04;p=dpdk.git diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index e0c5268d5b..4a9ab415c5 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2010-2013 Intel Corporation. All rights reserved. + * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -624,6 +624,7 @@ static inline void rte_pktmbuf_attach(struct rte_mbuf *mi, struct rte_mbuf *md) mi->pkt.next = NULL; mi->pkt.pkt_len = mi->pkt.data_len; mi->pkt.nb_segs = 1; + mi->ol_flags = md->ol_flags; __rte_mbuf_sanity_check(mi, RTE_MBUF_PKT, 1); __rte_mbuf_sanity_check(md, RTE_MBUF_PKT, 0); @@ -659,17 +660,9 @@ static inline void rte_pktmbuf_detach(struct rte_mbuf *m) #endif /* RTE_MBUF_SCATTER_GATHER */ -/** - * Free a segment of a packet mbuf into its original mempool. - * - * Free an mbuf, without parsing other segments in case of chained - * buffers. - * - * @param m - * The packet mbuf segment to be freed. - */ -static inline void __attribute__((always_inline)) -rte_pktmbuf_free_seg(struct rte_mbuf *m) + +static inline struct rte_mbuf* __attribute__((always_inline)) +__rte_pktmbuf_prefree_seg(struct rte_mbuf *m) { __rte_mbuf_sanity_check(m, RTE_MBUF_PKT, 0); @@ -690,12 +683,29 @@ rte_pktmbuf_free_seg(struct rte_mbuf *m) __rte_mbuf_raw_free(md); } #endif - __rte_mbuf_raw_free(m); + return(m); #ifdef RTE_MBUF_SCATTER_GATHER } + return (NULL); #endif } +/** + * Free a segment of a packet mbuf into its original mempool. + * + * Free an mbuf, without parsing other segments in case of chained + * buffers. + * + * @param m + * The packet mbuf segment to be freed. + */ +static inline void __attribute__((always_inline)) +rte_pktmbuf_free_seg(struct rte_mbuf *m) +{ + if (likely(NULL != (m = __rte_pktmbuf_prefree_seg(m)))) + __rte_mbuf_raw_free(m); +} + /** * Free a packet mbuf back into its original mempool. * @@ -1016,13 +1026,15 @@ static inline int rte_pktmbuf_is_contiguous(const struct rte_mbuf *m) * Dump all fields for the given packet mbuf and all its associated * segments (in the case of a chained buffer). * + * @param f + * A pointer to a file for output * @param m * The packet mbuf. * @param dump_len * If dump_len != 0, also dump the "dump_len" first data bytes of * the packet. */ -void rte_pktmbuf_dump(const struct rte_mbuf *m, unsigned dump_len); +void rte_pktmbuf_dump(FILE *f, const struct rte_mbuf *m, unsigned dump_len); #ifdef __cplusplus }