examples/ipsec-secgw: add event helper config init/uninit
[dpdk.git] / examples / ipsec-secgw / event_helper.h
index 8eb5e25..e17cab1 100644 (file)
 #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
 
+/* Used to indicate that queue schedule type is not set */
+#define SCHED_TYPE_NOT_SET     3
+
 /**
  * Packet transfer mode of the application
  */
@@ -51,12 +57,29 @@ 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 mode packet tx types
+ */
+enum eh_tx_types {
+       EH_TX_TYPE_INTERNAL_PORT = 0,
+       EH_TX_TYPE_NO_INTERNAL_PORT
+};
+
 /* Event dev params */
 struct eventdev_params {
        uint8_t eventdev_id;
        uint8_t nb_eventqueue;
        uint8_t nb_eventport;
        uint8_t ev_queue_mode;
+       uint8_t all_internal_ports;
 };
 
 /**
@@ -161,6 +184,44 @@ 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 tx_internal_port : 1;
+                       /**< Specify whether tx internal port is available */
+               };
+               uint64_t u64;
+       } cap;
+                       /**< Capabilities of this worker */
+       void (*worker_thread)(struct eh_event_link_info *links,
+                       uint8_t nb_links);
+                       /**< Worker thread */
+};
+
+/**
+ * Allocate memory for event helper configuration and initialize
+ * it with default values.
+ *
+ * @return
+ * - pointer to event helper configuration structure on success.
+ * - NULL on failure.
+ */
+struct eh_conf *
+eh_conf_init(void);
+
+/**
+ * Uninitialize event helper configuration and release its memory
+. *
+ * @param conf
+ *   Event helper configuration
+ */
+void
+eh_conf_uninit(struct eh_conf *conf);
+
 /**
  * Initialize event mode devices
  *
@@ -228,4 +289,25 @@ eh_get_tx_queue(struct eh_conf *conf, uint8_t eventdev_id);
 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_ */