drivers: add init and fini on octeontx2 NPA object
[dpdk.git] / drivers / mempool / octeontx2 / otx2_mempool.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2019 Marvell International Ltd.
3  */
4
5 #ifndef __OTX2_MEMPOOL_H__
6 #define __OTX2_MEMPOOL_H__
7
8 #include <rte_bitmap.h>
9 #include <rte_bus_pci.h>
10 #include <rte_devargs.h>
11 #include <rte_mempool.h>
12
13 #include "otx2_common.h"
14 #include "otx2_mbox.h"
15
16 enum npa_lf_status {
17         NPA_LF_ERR_PARAM            = -512,
18         NPA_LF_ERR_ALLOC            = -513,
19         NPA_LF_ERR_INVALID_BLOCK_SZ = -514,
20         NPA_LF_ERR_AURA_ID_ALLOC    = -515,
21         NPA_LF_ERR_AURA_POOL_INIT   = -516,
22         NPA_LF_ERR_AURA_POOL_FINI   = -517,
23         NPA_LF_ERR_BASE_INVALID     = -518,
24 };
25
26 struct otx2_npa_lf;
27 struct otx2_npa_qint {
28         struct otx2_npa_lf *lf;
29         uint8_t qintx;
30 };
31
32 struct otx2_npa_lf {
33         uint16_t qints;
34         uintptr_t base;
35         uint8_t aura_sz;
36         uint16_t pf_func;
37         uint32_t nr_pools;
38         void *npa_bmp_mem;
39         void *npa_qint_mem;
40         uint16_t npa_msixoff;
41         struct otx2_mbox *mbox;
42         uint32_t stack_pg_ptrs;
43         uint32_t stack_pg_bytes;
44         struct rte_bitmap *npa_bmp;
45         struct rte_pci_device *pci_dev;
46         struct rte_intr_handle *intr_handle;
47 };
48
49 #define AURA_ID_MASK  (BIT_ULL(16) - 1)
50
51 /* NPA LF */
52 int otx2_npa_lf_init(struct rte_pci_device *pci_dev, void *otx2_dev);
53 int otx2_npa_lf_fini(void);
54
55 #endif /* __OTX2_MEMPOOL_H__ */