net/memif: fix multi-process Tx
[dpdk.git] / lib / librte_lpm / rte_lpm.h
index 12c22a6..906ec44 100644 (file)
@@ -16,6 +16,7 @@
 #include <stdlib.h>
 #include <rte_branch_prediction.h>
 #include <rte_byteorder.h>
+#include <rte_config.h>
 #include <rte_memory.h>
 #include <rte_common.h>
 #include <rte_vect.h>
@@ -87,7 +88,7 @@ struct rte_lpm_tbl_entry_v20 {
         */
        uint8_t valid_group :1;
        uint8_t depth       :6; /**< Rule depth. */
-};
+} __rte_aligned(sizeof(uint16_t));
 
 __extension__
 struct rte_lpm_tbl_entry {
@@ -120,7 +121,7 @@ struct rte_lpm_tbl_entry_v20 {
                uint8_t group_idx;
                uint8_t next_hop;
        };
-};
+} __rte_aligned(sizeof(uint16_t));
 
 __extension__
 struct rte_lpm_tbl_entry {
@@ -353,6 +354,10 @@ rte_lpm_lookup(struct rte_lpm *lpm, uint32_t ip, uint32_t *next_hop)
        ptbl = (const uint32_t *)(&lpm->tbl24[tbl24_index]);
        tbl_entry = *ptbl;
 
+       /* Memory ordering is not required in lookup. Because dataflow
+        * dependency exists, compiler or HW won't be able to re-order
+        * the operations.
+        */
        /* Copy tbl8 entry (only if needed) */
        if (unlikely((tbl_entry & RTE_LPM_VALID_EXT_ENTRY_BITMASK) ==
                        RTE_LPM_VALID_EXT_ENTRY_BITMASK)) {
@@ -441,7 +446,7 @@ rte_lpm_lookup_bulk_func(const struct rte_lpm *lpm, const uint32_t *ips,
  * @param hop
  *   Next hop of the most specific rule found for IP (valid on lookup hit only).
  *   This is an 4 elements array of two byte values.
- *   If the lookup was succesfull for the given IP, then least significant byte
+ *   If the lookup was successful for the given IP, then least significant byte
  *   of the corresponding element is the  actual next hop and the most
  *   significant byte is zero.
  *   If the lookup for the given IP failed, then corresponding element would