examples/ipsec-secgw: add event worker launch
[dpdk.git] / examples / ipsec-secgw / event_helper.h
index 913b172..9a4dfab 100644 (file)
                RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
                        __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__ ,)))
 
+#define EH_LOG_INFO(...) \
+       RTE_LOG(INFO, EH, \
+               RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
+                       __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__ ,)))
+
 /* Max event devices supported */
 #define EVENT_MODE_MAX_EVENT_DEVS RTE_EVENT_MAX_DEVS
 
@@ -35,6 +40,9 @@
 #define EVENT_MODE_MAX_LCORE_LINKS \
        (EVENT_MODE_MAX_EVENT_DEVS * EVENT_MODE_MAX_EVENT_QUEUES_PER_DEV)
 
+/* Max adapters that one Rx core can handle */
+#define EVENT_MODE_MAX_ADAPTERS_PER_RX_CORE EVENT_MODE_MAX_RX_ADAPTERS
+
 /* Max adapters that one Tx core can handle */
 #define EVENT_MODE_MAX_ADAPTERS_PER_TX_CORE EVENT_MODE_MAX_TX_ADAPTERS
 
@@ -46,6 +54,14 @@ enum eh_pkt_transfer_mode {
        EH_PKT_TRANSFER_MODE_EVENT,
 };
 
+/**
+ * Event mode packet rx types
+ */
+enum eh_rx_types {
+       EH_RX_TYPE_NON_BURST = 0,
+       EH_RX_TYPE_BURST
+};
+
 /* Event dev params */
 struct eventdev_params {
        uint8_t eventdev_id;
@@ -156,6 +172,22 @@ struct eh_conf {
                /**< Mode specific parameters */
 };
 
+/* Workers registered by the application */
+struct eh_app_worker_params {
+       union {
+               RTE_STD_C11
+               struct {
+                       uint64_t burst : 1;
+                       /**< Specify status of rx type burst */
+               };
+               uint64_t u64;
+       } cap;
+                       /**< Capabilities of this worker */
+       void (*worker_thread)(struct eh_event_link_info *links,
+                       uint8_t nb_links);
+                       /**< Worker thread */
+};
+
 /**
  * Initialize event mode devices
  *
@@ -214,4 +246,34 @@ eh_devs_uninit(struct eh_conf *conf);
 uint8_t
 eh_get_tx_queue(struct eh_conf *conf, uint8_t eventdev_id);
 
+/**
+ * Display event mode configuration
+ *
+ * @param conf
+ *   Event helper configuration
+ */
+void
+eh_display_conf(struct eh_conf *conf);
+
+
+/**
+ * Launch eventmode worker
+ *
+ * The application can request the eventmode helper subsystem to launch the
+ * worker based on the capabilities of event device and the options selected
+ * while initializing the eventmode.
+ *
+ * @param conf
+ *   Event helper configuration
+ * @param app_wrkr
+ *   List of all the workers registered by application, along with its
+ *   capabilities
+ * @param nb_wrkr_param
+ *   Number of workers passed by the application
+ *
+ */
+void
+eh_launch_worker(struct eh_conf *conf, struct eh_app_worker_params *app_wrkr,
+               uint8_t nb_wrkr_param);
+
 #endif /* _EVENT_HELPER_H_ */