net/dpaa: support Rx interrupt enable and disable
[dpdk.git] / drivers / bus / dpaa / include / fsl_usd.h
1 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
2  *
3  * Copyright 2010-2011 Freescale Semiconductor, Inc.
4  * All rights reserved.
5  * Copyright 2019 NXP
6  *
7  */
8
9 #ifndef __FSL_USD_H
10 #define __FSL_USD_H
11
12 #include <compat.h>
13 #include <fsl_qman.h>
14
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18
19 /* Thread-entry/exit hooks; */
20 int qman_thread_init(void);
21 int bman_thread_init(void);
22 int qman_thread_finish(void);
23 int bman_thread_finish(void);
24
25 #define QBMAN_ANY_PORTAL_IDX 0xffffffff
26
27 /* Obtain and free raw (unitialized) portals */
28
29 struct dpaa_raw_portal {
30         /* inputs */
31
32         /* set to non zero to turn on stashing */
33         uint8_t enable_stash;
34         /* Stashing attributes for the portal */
35         uint32_t cpu;
36         uint32_t cache;
37         uint32_t window;
38
39         /* Specifies the stash request queue this portal should use */
40         uint8_t sdest;
41
42         /* Specifes a specific portal index to map or QBMAN_ANY_PORTAL_IDX
43          * for don't care.  The portal index will be populated by the
44          * driver when the ioctl() successfully completes.
45          */
46         uint32_t index;
47
48         /* outputs */
49         uint64_t cinh;
50         uint64_t cena;
51 };
52
53 int qman_allocate_raw_portal(struct dpaa_raw_portal *portal);
54 int qman_free_raw_portal(struct dpaa_raw_portal *portal);
55
56 int bman_allocate_raw_portal(struct dpaa_raw_portal *portal);
57 int bman_free_raw_portal(struct dpaa_raw_portal *portal);
58
59 /* Obtain thread-local UIO file-descriptors */
60 int qman_thread_fd(void);
61 int bman_thread_fd(void);
62
63 /* Post-process interrupts. NB, the kernel IRQ handler disables the interrupt
64  * line before notifying us, and this post-processing re-enables it once
65  * processing is complete. As such, it is essential to call this before going
66  * into another blocking read/select/poll.
67  */
68 void qman_thread_irq(void);
69 void bman_thread_irq(void);
70 void qman_fq_portal_thread_irq(struct qman_portal *qp);
71
72 void qman_clear_irq(void);
73
74 /* Global setup */
75 int qman_global_init(void);
76 int bman_global_init(void);
77
78 /* Direct portal create and destroy */
79 struct qman_portal *fsl_qman_fq_portal_create(int *fd);
80 int fsl_qman_fq_portal_destroy(struct qman_portal *qp);
81 int fsl_qman_fq_portal_init(struct qman_portal *qp);
82
83 #ifdef __cplusplus
84 }
85 #endif
86
87 #endif /* __FSL_USD_H */