lib: add switch fall-through comments
[dpdk.git] / lib / librte_mbuf / rte_mbuf.h
index 349f051..9097f18 100644 (file)
@@ -184,6 +184,11 @@ extern "C" {
  */
 #define PKT_RX_LRO           (1ULL << 16)
 
+/**
+ * Indicate that the timestamp field in the mbuf is valid.
+ */
+#define PKT_RX_TIMESTAMP     (1ULL << 17)
+
 /* add new RX flags here */
 
 /* add new TX flags here */
@@ -398,7 +403,13 @@ struct rte_mbuf {
        MARKER cacheline0;
 
        void *buf_addr;           /**< Virtual address of segment buffer. */
-       phys_addr_t buf_physaddr; /**< Physical address of segment buffer. */
+       /**
+        * Physical address of segment buffer.
+        * Force alignment to 8-bytes, so as to ensure we have the exact
+        * same mbuf cacheline0 layout for 32-bit and 64-bit. This makes
+        * working on vector drivers easier.
+        */
+       phys_addr_t buf_physaddr __rte_aligned(sizeof(phys_addr_t));
 
        /* next 8 bytes are initialised on RX descriptor rearm */
        MARKER64 rearm_data;
@@ -481,6 +492,12 @@ struct rte_mbuf {
        uint16_t vlan_tci_outer;
 
        uint16_t buf_len;         /**< Length of segment buffer. */
+
+       /** Valid if PKT_RX_TIMESTAMP is set. The unit and time reference
+        * are not normalized but are always the same for a given port.
+        */
+       uint64_t timestamp;
+
        /* second cache line - fields only used in slow path or on TX */
        MARKER cacheline1 __rte_cache_min_aligned;
 
@@ -1139,21 +1156,25 @@ static inline int rte_pktmbuf_alloc_bulk(struct rte_mempool *pool,
                        rte_mbuf_refcnt_set(mbufs[idx], 1);
                        rte_pktmbuf_reset(mbufs[idx]);
                        idx++;
+                       /* fall-through */
        case 3:
                        RTE_ASSERT(rte_mbuf_refcnt_read(mbufs[idx]) == 0);
                        rte_mbuf_refcnt_set(mbufs[idx], 1);
                        rte_pktmbuf_reset(mbufs[idx]);
                        idx++;
+                       /* fall-through */
        case 2:
                        RTE_ASSERT(rte_mbuf_refcnt_read(mbufs[idx]) == 0);
                        rte_mbuf_refcnt_set(mbufs[idx], 1);
                        rte_pktmbuf_reset(mbufs[idx]);
                        idx++;
+                       /* fall-through */
        case 1:
                        RTE_ASSERT(rte_mbuf_refcnt_read(mbufs[idx]) == 0);
                        rte_mbuf_refcnt_set(mbufs[idx], 1);
                        rte_pktmbuf_reset(mbufs[idx]);
                        idx++;
+                       /* fall-through */
                }
        }
        return 0;
@@ -1208,6 +1229,7 @@ static inline void rte_pktmbuf_attach(struct rte_mbuf *mi, struct rte_mbuf *m)
        mi->nb_segs = 1;
        mi->ol_flags = m->ol_flags | IND_ATTACHED_MBUF;
        mi->packet_type = m->packet_type;
+       mi->timestamp = m->timestamp;
 
        __rte_mbuf_sanity_check(mi, 1);
        __rte_mbuf_sanity_check(m, 0);