DPDK  17.11.10
rte_eal_interrupts.h
Go to the documentation of this file.
1 /*-
2  * BSD LICENSE
3  *
4  * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in
15  * the documentation and/or other materials provided with the
16  * distribution.
17  * * Neither the name of Intel Corporation nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 #ifndef _RTE_INTERRUPTS_H_
35 #error "don't include this file directly, please include generic <rte_interrupts.h>"
36 #endif
37 
46 #ifndef _RTE_EAL_INTERRUPTS_H_
47 #define _RTE_EAL_INTERRUPTS_H_
48 
49 #define RTE_MAX_RXTX_INTR_VEC_ID 32
50 #define RTE_INTR_VEC_ZERO_OFFSET 0
51 #define RTE_INTR_VEC_RXTX_OFFSET 1
52 
67 };
68 
69 #define RTE_INTR_EVENT_ADD 1UL
70 #define RTE_INTR_EVENT_DEL 2UL
71 
72 typedef void (*rte_intr_event_cb_t)(int fd, void *arg);
73 
74 struct rte_epoll_data {
75  uint32_t event;
76  void *data;
77  rte_intr_event_cb_t cb_fun;
78  void *cb_arg;
79 };
80 
81 enum {
82  RTE_EPOLL_INVALID = 0,
83  RTE_EPOLL_VALID,
84  RTE_EPOLL_EXEC,
85 };
86 
89  volatile uint32_t status;
90  int fd;
91  int epfd;
92  struct rte_epoll_data epdata;
93 };
94 
98  union {
101  };
102  int fd;
104  uint32_t max_intr;
105  uint32_t nb_efd;
107  int efds[RTE_MAX_RXTX_INTR_VEC_ID];
108  struct rte_epoll_event elist[RTE_MAX_RXTX_INTR_VEC_ID];
110  int *intr_vec;
111 };
112 
113 #define RTE_EPOLL_PER_THREAD -1
131 int
132 rte_epoll_wait(int epfd, struct rte_epoll_event *events,
133  int maxevents, int timeout);
134 
152 int
153 rte_epoll_ctl(int epfd, int op, int fd,
154  struct rte_epoll_event *event);
155 
162 int
163 rte_intr_tls_epfd(void);
164 
181 int
182 rte_intr_rx_ctl(struct rte_intr_handle *intr_handle,
183  int epfd, int op, unsigned int vec, void *data);
184 
191 void
192 rte_intr_free_epoll_fd(struct rte_intr_handle *intr_handle);
193 
208 int
209 rte_intr_efd_enable(struct rte_intr_handle *intr_handle, uint32_t nb_efd);
210 
218 void
219 rte_intr_efd_disable(struct rte_intr_handle *intr_handle);
220 
227 int
228 rte_intr_dp_is_en(struct rte_intr_handle *intr_handle);
229 
237 int
238 rte_intr_allow_others(struct rte_intr_handle *intr_handle);
239 
247 int
248 rte_intr_cap_multiple(struct rte_intr_handle *intr_handle);
249 
250 #endif /* _RTE_EAL_INTERRUPTS_H_ */
struct rte_epoll_event elist[RTE_MAX_RXTX_INTR_VEC_ID]
int rte_intr_rx_ctl(struct rte_intr_handle *intr_handle, int epfd, int op, unsigned int vec, void *data)
int rte_intr_efd_enable(struct rte_intr_handle *intr_handle, uint32_t nb_efd)
int rte_epoll_ctl(int epfd, int op, int fd, struct rte_epoll_event *event)
int rte_intr_cap_multiple(struct rte_intr_handle *intr_handle)
int efds[RTE_MAX_RXTX_INTR_VEC_ID]
rte_intr_handle_type
int rte_intr_tls_epfd(void)
int rte_epoll_wait(int epfd, struct rte_epoll_event *events, int maxevents, int timeout)
#define RTE_STD_C11
Definition: rte_common.h:66
void rte_intr_free_epoll_fd(struct rte_intr_handle *intr_handle)
enum rte_intr_handle_type type
void rte_intr_efd_disable(struct rte_intr_handle *intr_handle)
int rte_intr_allow_others(struct rte_intr_handle *intr_handle)
int rte_intr_dp_is_en(struct rte_intr_handle *intr_handle)
volatile uint32_t status