net/bonding: check flow setting
[dpdk.git] / drivers / mempool / octeontx2 / otx2_mempool_ops.c
index 5229a7c..d827fd8 100644 (file)
@@ -15,6 +15,10 @@ otx2_npa_enq(struct rte_mempool *mp, void * const *obj_table, unsigned int n)
        const uint64_t addr = npa_lf_aura_handle_to_base(aura_handle) +
                                 NPA_LF_AURA_OP_FREE0;
 
+       /* Ensure mbuf init changes are written before the free pointers
+        * are enqueued to the stack.
+        */
+       rte_io_wmb();
        for (index = 0; index < n; index++)
                otx2_store_pair((uint64_t)obj_table[index], reg, addr);
 
@@ -607,7 +611,8 @@ npa_lf_aura_pool_pair_alloc(struct otx2_npa_lf *lf, const uint32_t block_size,
        /* Update aura fields */
        aura->pool_addr = pool_id;/* AF will translate to associated poolctx */
        aura->ena = 1;
-       aura->shift = __builtin_clz(block_count) - 8;
+       aura->shift = rte_log2_u32(block_count);
+       aura->shift = aura->shift < 8 ? 0 : aura->shift - 8;
        aura->limit = block_count;
        aura->pool_caching = 1;
        aura->err_int_ena = BIT(NPA_AURA_ERR_INT_AURA_ADD_OVER);
@@ -622,7 +627,8 @@ npa_lf_aura_pool_pair_alloc(struct otx2_npa_lf *lf, const uint32_t block_size,
        pool->ena = 1;
        pool->buf_size = block_size / OTX2_ALIGN;
        pool->stack_max_pages = stack_size;
-       pool->shift = __builtin_clz(block_count) - 8;
+       pool->shift = rte_log2_u32(block_count);
+       pool->shift = pool->shift < 8 ? 0 : pool->shift - 8;
        pool->ptr_start = 0;
        pool->ptr_end = ~0;
        pool->stack_caching = 1;