remove extra parentheses in return statement
[dpdk.git] / lib / librte_mempool / rte_mempool.h
index 6d4ce9a..9745bf0 100644 (file)
@@ -142,6 +142,12 @@ struct rte_mempool_objsz {
 /** Mempool over one chunk of physically continuous memory */
 #define        MEMPOOL_PG_NUM_DEFAULT  1
 
+#ifndef RTE_MEMPOOL_ALIGN
+#define RTE_MEMPOOL_ALIGN      RTE_CACHE_LINE_SIZE
+#endif
+
+#define RTE_MEMPOOL_ALIGN_MASK (RTE_MEMPOOL_ALIGN - 1)
+
 /**
  * Mempool object header structure
  *
@@ -262,13 +268,7 @@ struct rte_mempool {
 /* return the header of a mempool object (internal) */
 static inline struct rte_mempool_objhdr *__mempool_get_header(void *obj)
 {
-       return RTE_PTR_SUB(obj, sizeof(struct rte_mempool_objhdr));
-}
-
-/* return the trailer of a mempool object (internal) */
-static inline struct rte_mempool_objtlr *__mempool_get_trailer(void *obj)
-{
-       return RTE_PTR_SUB(obj, sizeof(struct rte_mempool_objtlr));
+       return (struct rte_mempool_objhdr *)RTE_PTR_SUB(obj, sizeof(struct rte_mempool_objhdr));
 }
 
 /**
@@ -286,6 +286,13 @@ static inline struct rte_mempool *rte_mempool_from_obj(void *obj)
        return hdr->mp;
 }
 
+/* return the trailer of a mempool object (internal) */
+static inline struct rte_mempool_objtlr *__mempool_get_trailer(void *obj)
+{
+       struct rte_mempool *mp = rte_mempool_from_obj(obj);
+       return (struct rte_mempool_objtlr *)RTE_PTR_ADD(obj, mp->elt_size);
+}
+
 /**
  * @internal Check and update cookies or panic.
  *
@@ -633,7 +640,6 @@ rte_mempool_xmem_create(const char *name, unsigned n, unsigned elt_size,
                int socket_id, unsigned flags, void *vaddr,
                const phys_addr_t paddr[], uint32_t pg_num, uint32_t pg_shift);
 
-#ifdef RTE_LIBRTE_XEN_DOM0
 /**
  * Create a new mempool named *name* in memory on Xen Dom0.
  *
@@ -721,7 +727,7 @@ rte_dom0_mempool_create(const char *name, unsigned n, unsigned elt_size,
                rte_mempool_ctor_t *mp_init, void *mp_init_arg,
                rte_mempool_obj_ctor_t *obj_init, void *obj_init_arg,
                int socket_id, unsigned flags);
-#endif
+
 
 /**
  * Dump the status of the mempool to the console.
@@ -1254,7 +1260,7 @@ rte_mempool_virt2phy(const struct rte_mempool *mp, const void *elt)
                uintptr_t off;
 
                off = (const char *)elt - (const char *)mp->elt_va_start;
-               return (mp->elt_pa[off >> mp->pg_shift] + (off & mp->pg_mask));
+               return mp->elt_pa[off >> mp->pg_shift] + (off & mp->pg_mask);
        } else {
                /*
                 * If huge pages are disabled, we cannot assume the