net/sfc/base: fix MAC Tx stats for less or equal to 64 bytes
[dpdk.git] / drivers / mempool / dpaa / dpaa_mempool.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  *
3  *   Copyright 2017 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 <rte_dpaa_bus.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, uint64_t addr)
47 {
48         if (bp_info->ptov_off)
49                 return ((void *) (size_t)(addr + bp_info->ptov_off));
50         return rte_dpaa_mem_ptov(addr);
51 }
52
53 #define DPAA_MEMPOOL_TO_POOL_INFO(__mp) \
54         ((struct dpaa_bp_info *)__mp->pool_data)
55
56 #define DPAA_MEMPOOL_TO_BPID(__mp) \
57         (((struct dpaa_bp_info *)__mp->pool_data)->bpid)
58
59 extern struct dpaa_bp_info rte_dpaa_bpid_info[DPAA_MAX_BPOOLS];
60
61 #define DPAA_BPID_TO_POOL_INFO(__bpid) (&rte_dpaa_bpid_info[__bpid])
62
63 #endif