Damjan Marion | c42552d | 2016-04-12 05:10:25 +0200 | [diff] [blame] | 1 | From eed80f56477e26a5711ea3749d1881797b3c82a5 Mon Sep 17 00:00:00 2001 |
| 2 | From: Damjan Marion <damarion@cisco.com> |
| 3 | Date: Wed, 16 Dec 2015 04:25:23 +0100 |
| 4 | Subject: [PATCH 4/6] mbuf: rearrange rte_mbuf metadata to suit vpp |
| 5 | |
| 6 | --- |
| 7 | .../linuxapp/eal/include/exec-env/rte_kni_common.h | 5 +++-- |
| 8 | lib/librte_mbuf/rte_mbuf.h | 20 ++++++++++++-------- |
| 9 | 2 files changed, 15 insertions(+), 10 deletions(-) |
| 10 | |
| 11 | diff --git a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h |
| 12 | index 7e5e598..fdbeb4a 100644 |
| 13 | --- a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h |
| 14 | +++ b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h |
| 15 | @@ -118,11 +118,12 @@ struct rte_kni_mbuf { |
| 16 | char pad2[4]; |
| 17 | uint32_t pkt_len; /**< Total pkt len: sum of all segment data_len. */ |
| 18 | uint16_t data_len; /**< Amount of data in segment buffer. */ |
| 19 | + char pad3[8]; |
| 20 | + void *next; |
| 21 | |
| 22 | /* fields on second cache line */ |
| 23 | - char pad3[8] __attribute__((__aligned__(RTE_CACHE_LINE_MIN_SIZE))); |
| 24 | + char pad4[16] __attribute__((__aligned__(RTE_CACHE_LINE_MIN_SIZE))); |
| 25 | void *pool; |
| 26 | - void *next; |
| 27 | }; |
| 28 | |
| 29 | /* |
| 30 | diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h |
| 31 | index 75a227d..ca4d0fb 100644 |
| 32 | --- a/lib/librte_mbuf/rte_mbuf.h |
| 33 | +++ b/lib/librte_mbuf/rte_mbuf.h |
| 34 | @@ -731,6 +731,12 @@ typedef uint64_t MARKER64[0]; /**< marker that allows us to overwrite 8 bytes |
| 35 | /** |
| 36 | * The generic rte_mbuf, containing a packet mbuf. |
| 37 | */ |
| 38 | +/* |
| 39 | + * offload in the second cache line, next in the first. Better for vpp |
| 40 | + * at least as of right now. |
| 41 | + * If you change this structure, you must change the user-mode |
| 42 | + * version in rte_mbuf.h |
| 43 | + */ |
| 44 | struct rte_mbuf { |
| 45 | MARKER cacheline0; |
| 46 | |
| 47 | @@ -783,6 +789,12 @@ struct rte_mbuf { |
| 48 | uint32_t pkt_len; /**< Total pkt len: sum of all segments. */ |
| 49 | uint16_t data_len; /**< Amount of data in segment buffer. */ |
| 50 | uint16_t vlan_tci; /**< VLAN Tag Control Identifier (CPU order) */ |
| 51 | + uint32_t seqn; /**< Sequence number. See also rte_reorder_insert() */ |
| 52 | + uint16_t vlan_tci_outer; /**< Outer VLAN Tag Control Identifier (CPU order) */ |
| 53 | + struct rte_mbuf *next; /**< Next segment of scattered packet. */ |
| 54 | + |
| 55 | + /* second cache line - fields only used in slow path or on TX */ |
| 56 | + MARKER cacheline1 __rte_cache_min_aligned; |
| 57 | |
| 58 | union { |
| 59 | uint32_t rss; /**< RSS hash result if RSS enabled */ |
| 60 | @@ -806,20 +818,12 @@ struct rte_mbuf { |
| 61 | uint32_t usr; /**< User defined tags. See rte_distributor_process() */ |
| 62 | } hash; /**< hash information */ |
| 63 | |
| 64 | - uint32_t seqn; /**< Sequence number. See also rte_reorder_insert() */ |
| 65 | - |
| 66 | - uint16_t vlan_tci_outer; /**< Outer VLAN Tag Control Identifier (CPU order) */ |
| 67 | - |
| 68 | - /* second cache line - fields only used in slow path or on TX */ |
| 69 | - MARKER cacheline1 __rte_cache_min_aligned; |
| 70 | - |
| 71 | union { |
| 72 | void *userdata; /**< Can be used for external metadata */ |
| 73 | uint64_t udata64; /**< Allow 8-byte userdata on 32-bit */ |
| 74 | }; |
| 75 | |
| 76 | struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */ |
| 77 | - struct rte_mbuf *next; /**< Next segment of scattered packet. */ |
| 78 | |
| 79 | /* fields to support TX offloads */ |
| 80 | union { |
| 81 | -- |
| 82 | 2.7.4 |
| 83 | |