[dpdk-dev,v13,08/14] eal/bsd: dummy for new intr definition

Message ID 1434686442-578-9-git-send-email-cunming.liang@intel.com (mailing list archive)
State Changes Requested, archived
Headers

Commit Message

Cunming Liang June 19, 2015, 4 a.m. UTC
  To make bsd compiling happy with new intr changes.

Signed-off-by: Cunming Liang <cunming.liang@intel.com>
---
v13 changes
 - version map cleanup for v2.1

v12 changes
 - fix unused variables compiling warning 

v8 changes
 - add stub for new function

v7 changes
 - remove stub 'linux only' function from source file

 lib/librte_eal/bsdapp/eal/eal_interrupts.c         | 30 +++++++++
 .../bsdapp/eal/include/exec-env/rte_interrupts.h   | 78 ++++++++++++++++++++++
 lib/librte_eal/bsdapp/eal/rte_eal_version.map      | 12 ++++
 3 files changed, 120 insertions(+)
  

Comments

Thomas Monjalon July 13, 2015, 5:06 p.m. UTC | #1
2015-06-19 12:00, Cunming Liang:
> To make bsd compiling happy with new intr changes.

This patch doesn't make FreeBSD happy.
DPDK works on Linux and FreeBSD.
Why not adopt an API which could be implemented for FreeBSD, instead of being
tightly linked to Linux epoll?
  
Cunming Liang July 17, 2015, 5:58 a.m. UTC | #2
> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Tuesday, July 14, 2015 1:06 AM
> To: Liang, Cunming
> Cc: dev@dpdk.org; shemming@brocade.com; david.marchand@6wind.com;
> Zhou, Danny; Wang, Liang-min; Richardson, Bruce; Liu, Yong;
> nhorman@tuxdriver.com
> Subject: Re: [PATCH v13 08/14] eal/bsd: dummy for new intr definition
> 
> 2015-06-19 12:00, Cunming Liang:
> > To make bsd compiling happy with new intr changes.
> 
> This patch doesn't make FreeBSD happy.
> DPDK works on Linux and FreeBSD.
> Why not adopt an API which could be implemented for FreeBSD, instead of being
> tightly linked to Linux epoll?
The *rte_epoll_* API is not provided as a EAL API, only exists in linuxapp for the low level needs of combing rx event with other user events.
I haven't defined the abstract EAL API for both linux and freebsd yet.
The next step is 1) to have a bsdapp level API (base on kqueue), 2) trying to provide a common EAL API to cover both.
It's planed in next release.
  

Patch

diff --git a/lib/librte_eal/bsdapp/eal/eal_interrupts.c b/lib/librte_eal/bsdapp/eal/eal_interrupts.c
index 26a55c7..90addaf 100644
--- a/lib/librte_eal/bsdapp/eal/eal_interrupts.c
+++ b/lib/librte_eal/bsdapp/eal/eal_interrupts.c
@@ -68,3 +68,33 @@  rte_eal_intr_init(void)
 {
 	return 0;
 }
+
+int
+rte_intr_rx_ctl(struct rte_intr_handle *intr_handle,
+		int epfd, int op, unsigned int vec, void *data)
+{
+	RTE_SET_USED(intr_handle);
+	RTE_SET_USED(epfd);
+	RTE_SET_USED(op);
+	RTE_SET_USED(vec);
+	RTE_SET_USED(data);
+
+	return -ENOTSUP;
+}
+
+int
+rte_intr_efd_enable(struct rte_intr_handle *intr_handle, uint32_t nb_efd)
+{
+	RTE_SET_USED(intr_handle);
+	RTE_SET_USED(nb_efd);
+
+	return 0;
+}
+
+void
+rte_intr_efd_disable(struct rte_intr_handle *intr_handle)
+{
+	RTE_SET_USED(intr_handle);
+
+	return;
+}
diff --git a/lib/librte_eal/bsdapp/eal/include/exec-env/rte_interrupts.h b/lib/librte_eal/bsdapp/eal/include/exec-env/rte_interrupts.h
index 87a9cf6..5ae64af 100644
--- a/lib/librte_eal/bsdapp/eal/include/exec-env/rte_interrupts.h
+++ b/lib/librte_eal/bsdapp/eal/include/exec-env/rte_interrupts.h
@@ -38,6 +38,8 @@ 
 #ifndef _RTE_LINUXAPP_INTERRUPTS_H_
 #define _RTE_LINUXAPP_INTERRUPTS_H_
 
+#include <rte_common.h>
+
 enum rte_intr_handle_type {
 	RTE_INTR_HANDLE_UNKNOWN = 0,
 	RTE_INTR_HANDLE_UIO,      /**< uio device handle */
@@ -49,6 +51,82 @@  enum rte_intr_handle_type {
 struct rte_intr_handle {
 	int fd;                          /**< file descriptor */
 	enum rte_intr_handle_type type;  /**< handle type */
+	int max_intr;                    /**< max interrupt requested */
+	uint32_t nb_efd;                 /**< number of available efds */
+	int *intr_vec;               /**< intr vector number array */
 };
 
+/**
+ * @param intr_handle
+ *   Pointer to the interrupt handle.
+ * @param epfd
+ *   Epoll instance fd which the intr vector associated to.
+ * @param op
+ *   The operation be performed for the vector.
+ *   Operation type of {ADD, DEL}.
+ * @param vec
+ *   RX intr vector number added to the epoll instance wait list.
+ * @param data
+ *   User raw data.
+ * @return
+ *   - On success, zero.
+ *   - On failure, a negative value.
+ */
+int
+rte_intr_rx_ctl(struct rte_intr_handle *intr_handle,
+		int epfd, int op, unsigned int vec, void *data);
+
+/**
+ * It enables the fastpath event fds if it's necessary.
+ * It creates event fds when multi-vectors allowed,
+ * otherwise it multiplexes the single event fds.
+ *
+ * @param intr_handle
+ *   Pointer to the interrupt handle.
+ * @param nb_vec
+ *   Number of intrrupt vector trying to enable.
+ * @return
+ *   - On success, zero.
+ *   - On failure, a negative value.
+ */
+int
+rte_intr_efd_enable(struct rte_intr_handle *intr_handle, uint32_t nb_efd);
+
+/**
+ * It disable the fastpath event fds.
+ * It deletes registered eventfds and closes the open fds.
+ *
+ * @param intr_handle
+ *   Pointer to the interrupt handle.
+ */
+void
+rte_intr_efd_disable(struct rte_intr_handle *intr_handle);
+
+/**
+ * The fastpath interrupt is enabled or not.
+ *
+ * @param intr_handle
+ *   Pointer to the interrupt handle.
+ */
+static inline int
+rte_intr_dp_is_en(struct rte_intr_handle *intr_handle)
+{
+	RTE_SET_USED(intr_handle);
+	return 0;
+}
+
+/**
+ * The interrupt handle instance allows other cause or not.
+ * Other cause stands for none fastpath interrupt.
+ *
+ * @param intr_handle
+ *   Pointer to the interrupt handle.
+ */
+static inline int
+rte_intr_allow_others(struct rte_intr_handle *intr_handle)
+{
+	RTE_SET_USED(intr_handle);
+	return 1;
+}
+
 #endif /* _RTE_LINUXAPP_INTERRUPTS_H_ */
diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
index 67b6a6c..f866f03 100644
--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
@@ -92,3 +92,15 @@  DPDK_2.0 {
 
 	local: *;
 };
+
+DPDK_2.1 {
+	global:
+
+	rte_intr_allow_others;
+	rte_intr_dp_is_en;
+	rte_intr_efd_enable;
+	rte_intr_efd_disable;
+	rte_intr_rx_ctl;
+
+	local: *;
+} DPDK_2.0;