Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause 2 : : * 3 : : * Copyright 2017,2019 NXP 4 : : * 5 : : */ 6 : : #ifndef __DPAA_MEMPOOL_H__ 7 : : #define __DPAA_MEMPOOL_H__ 8 : : 9 : : /* System headers */ 10 : : #include <stdio.h> 11 : : #include <stdbool.h> 12 : : #include <inttypes.h> 13 : : #include <unistd.h> 14 : : 15 : : #include <rte_mempool.h> 16 : : 17 : : #include <bus_dpaa_driver.h> 18 : : #include <rte_dpaa_logs.h> 19 : : 20 : : #include <fsl_usd.h> 21 : : #include <fsl_bman.h> 22 : : 23 : : #define CPU_SPIN_BACKOFF_CYCLES 512 24 : : 25 : : /* total number of bpools on SoC */ 26 : : #define DPAA_MAX_BPOOLS 256 27 : : 28 : : /* Maximum release/acquire from BMAN */ 29 : : #define DPAA_MBUF_MAX_ACQ_REL 8 30 : : 31 : : /* Buffers are allocated from single mem segment i.e. phys contiguous */ 32 : : #define DPAA_MPOOL_SINGLE_SEGMENT 0x01 33 : : 34 : : struct dpaa_bp_info { 35 : : struct rte_mempool *mp; 36 : : struct bman_pool *bp; 37 : : uint32_t bpid; 38 : : uint32_t size; 39 : : uint32_t meta_data_size; 40 : : int32_t dpaa_ops_index; 41 : : int64_t ptov_off; 42 : : uint8_t flags; 43 : : }; 44 : : 45 : : static inline void * 46 : : DPAA_MEMPOOL_PTOV(struct dpaa_bp_info *bp_info __rte_unused, uint64_t addr) 47 : : { 48 : 0 : return rte_dpaa_mem_ptov(addr); 49 : : } 50 : : 51 : : #define DPAA_MEMPOOL_TO_POOL_INFO(__mp) \ 52 : : ((struct dpaa_bp_info *)__mp->pool_data) 53 : : 54 : : #define DPAA_MEMPOOL_TO_BPID(__mp) \ 55 : : (((struct dpaa_bp_info *)__mp->pool_data)->bpid) 56 : : 57 : : extern struct dpaa_bp_info *rte_dpaa_bpid_info; 58 : : 59 : : #define DPAA_BPID_TO_POOL_INFO(__bpid) (&rte_dpaa_bpid_info[__bpid]) 60 : : 61 : : /* Mempool related logs */ 62 : : 63 : : #define DPAA_MEMPOOL_LOG(level, ...) \ 64 : : RTE_LOG_LINE_PREFIX(level, DPAA_MEMPOOL, "%s(): ", __func__, __VA_ARGS__) 65 : : 66 : : #define MEMPOOL_INIT_FUNC_TRACE() DPAA_MEMPOOL_LOG(DEBUG, " >>") 67 : : 68 : : #define DPAA_MEMPOOL_DPDEBUG(fmt, args...) \ 69 : : RTE_LOG_DP(DEBUG, DPAA_MEMPOOL, fmt, ## args) 70 : : #define DPAA_MEMPOOL_DEBUG(fmt, args...) \ 71 : : DPAA_MEMPOOL_LOG(DEBUG, fmt, ## args) 72 : : #define DPAA_MEMPOOL_ERR(fmt, args...) \ 73 : : DPAA_MEMPOOL_LOG(ERR, fmt, ## args) 74 : : #define DPAA_MEMPOOL_INFO(fmt, args...) \ 75 : : DPAA_MEMPOOL_LOG(INFO, fmt, ## args) 76 : : #define DPAA_MEMPOOL_WARN(fmt, args...) \ 77 : : DPAA_MEMPOOL_LOG(WARNING, fmt, ## args) 78 : : 79 : : #endif