X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_mbuf%2Frte_mbuf.h;h=e0c5268d5b7419d713824eab1c184c62a910fbb4;hb=1c1d4d7a923d4804f1926fc5264f9ecdd8977b04;hp=88f6f33146c54bf3fc553959ddda83b7d2988d58;hpb=4ef869927ebf4bb7228ee2e3930bd325b8aa744e;p=dpdk.git diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index 88f6f33146..e0c5268d5b 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -1,35 +1,34 @@ /*- * BSD LICENSE * - * Copyright(c) 2010-2012 Intel Corporation. All rights reserved. + * Copyright(c) 2010-2013 Intel Corporation. All rights reserved. * All rights reserved. * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions * are met: * - * * Redistributions of source code must retain the above copyright + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the * distribution. - * * Neither the name of Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * */ #ifndef _RTE_MBUF_H_ @@ -115,12 +114,26 @@ struct rte_ctrlmbuf { */ #define PKT_TX_OFFLOAD_MASK (PKT_TX_VLAN_PKT | PKT_TX_IP_CKSUM | PKT_TX_L4_MASK) -/* Compare mask for vlan_macip_lens, used for context build up */ +/** Offload features */ +union rte_vlan_macip { + uint32_t data; + struct { + uint16_t l3_len:9; /**< L3 (IP) Header Length. */ + uint16_t l2_len:7; /**< L2 (MAC) Header Length. */ + uint16_t vlan_tci; + /**< VLAN Tag Control Identifier (CPU order). */ + } f; +}; + +/* + * Compare mask for vlan_macip_len.data, + * should be in sync with rte_vlan_macip.f layout. + * */ #define TX_VLAN_CMP_MASK 0xFFFF0000 /**< VLAN length - 16-bits. */ #define TX_MAC_LEN_CMP_MASK 0x0000FE00 /**< MAC length - 7-bits. */ #define TX_IP_LEN_CMP_MASK 0x000001FF /**< IP length - 9-bits. */ -/** MAC+IP length. */ -#define TX_MACIP_LEN_CMP_MASK (TX_MAC_LEN_CMP_MASK | TX_IP_LEN_CMP_MASK) +/**< MAC+IP length. */ +#define TX_MACIP_LEN_CMP_MASK (TX_MAC_LEN_CMP_MASK | TX_IP_LEN_CMP_MASK) /** * A packet message buffer. @@ -137,15 +150,14 @@ struct rte_pktmbuf { uint32_t pkt_len; /**< Total pkt len: sum of all segment data_len. */ /* offload features */ - uint16_t vlan_tci; /**< VLAN Tag Control Identifier (CPU order). */ - uint16_t l2_len:7; /**< L2 (MAC) Header Length. */ - uint16_t l3_len:9; /**< L3 (IP) Header Length. */ + union rte_vlan_macip vlan_macip; union { uint32_t rss; /**< RSS hash result if RSS enabled */ struct { uint16_t hash; uint16_t id; } fdir; /**< Filter identifier if FDIR enabled */ + uint32_t sched; /**< Hierarchical scheduler */ } hash; /**< hash information */ }; @@ -396,7 +408,8 @@ static inline struct rte_mbuf *__rte_mbuf_raw_alloc(struct rte_mempool *mp) * @param m * The mbuf to be freed. */ -static inline void __rte_mbuf_raw_free(struct rte_mbuf *m) +static inline void __attribute__((always_inline)) +__rte_mbuf_raw_free(struct rte_mbuf *m) { #ifdef RTE_MBUF_SCATTER_GATHER RTE_MBUF_ASSERT(rte_mbuf_refcnt_read(m) == 0); @@ -543,9 +556,7 @@ static inline void rte_pktmbuf_reset(struct rte_mbuf *m) m->pkt.next = NULL; m->pkt.pkt_len = 0; - m->pkt.l2_len = 0; - m->pkt.l3_len = 0; - m->pkt.vlan_tci = 0; + m->pkt.vlan_macip.data = 0; m->pkt.nb_segs = 1; m->pkt.in_port = 0xff; @@ -657,7 +668,8 @@ static inline void rte_pktmbuf_detach(struct rte_mbuf *m) * @param m * The packet mbuf segment to be freed. */ -static inline void rte_pktmbuf_free_seg(struct rte_mbuf *m) +static inline void __attribute__((always_inline)) +rte_pktmbuf_free_seg(struct rte_mbuf *m) { __rte_mbuf_sanity_check(m, RTE_MBUF_PKT, 0);