examples/ipsec-secgw: add event config display
[dpdk.git] / examples / ipsec-secgw / event_helper.h
index 040f977..8eb5e25 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
 
+/* Max Rx adapters supported */
+#define EVENT_MODE_MAX_RX_ADAPTERS RTE_EVENT_MAX_DEVS
+
+/* Max Tx adapters supported */
+#define EVENT_MODE_MAX_TX_ADAPTERS RTE_EVENT_MAX_DEVS
+
+/* Max Rx adapter connections */
+#define EVENT_MODE_MAX_CONNECTIONS_PER_ADAPTER 16
+
+/* Max Tx adapter connections */
+#define EVENT_MODE_MAX_CONNECTIONS_PER_TX_ADAPTER 16
+
+/* Max event queues supported per event device */
+#define EVENT_MODE_MAX_EVENT_QUEUES_PER_DEV RTE_EVENT_MAX_QUEUES_PER_DEV
+
+/* Max event-lcore links */
+#define EVENT_MODE_MAX_LCORE_LINKS \
+       (EVENT_MODE_MAX_EVENT_DEVS * EVENT_MODE_MAX_EVENT_QUEUES_PER_DEV)
+
+/* Max adapters that one Tx core can handle */
+#define EVENT_MODE_MAX_ADAPTERS_PER_TX_CORE EVENT_MODE_MAX_TX_ADAPTERS
+
 /**
  * Packet transfer mode of the application
  */
@@ -32,17 +59,87 @@ struct eventdev_params {
        uint8_t ev_queue_mode;
 };
 
+/**
+ * Event-lcore link configuration
+ */
+struct eh_event_link_info {
+       uint8_t eventdev_id;
+               /**< Event device ID */
+       uint8_t event_port_id;
+               /**< Event port ID */
+       uint8_t eventq_id;
+               /**< Event queue to be linked to the port */
+       uint8_t lcore_id;
+               /**< Lcore to be polling on this port */
+};
+
+/* Rx adapter connection info */
+struct rx_adapter_connection_info {
+       uint8_t ethdev_id;
+       uint8_t eventq_id;
+       int32_t ethdev_rx_qid;
+};
+
+/* Rx adapter conf */
+struct rx_adapter_conf {
+       int32_t eventdev_id;
+       int32_t adapter_id;
+       uint32_t rx_core_id;
+       uint8_t nb_connections;
+       struct rx_adapter_connection_info
+                       conn[EVENT_MODE_MAX_CONNECTIONS_PER_ADAPTER];
+};
+
+/* Tx adapter connection info */
+struct tx_adapter_connection_info {
+       uint8_t ethdev_id;
+       int32_t ethdev_tx_qid;
+};
+
+/* Tx adapter conf */
+struct tx_adapter_conf {
+       int32_t eventdev_id;
+       int32_t adapter_id;
+       uint32_t tx_core_id;
+       uint8_t nb_connections;
+       struct tx_adapter_connection_info
+                       conn[EVENT_MODE_MAX_CONNECTIONS_PER_TX_ADAPTER];
+       uint8_t tx_ev_queue;
+};
+
 /* Eventmode conf data */
 struct eventmode_conf {
        int nb_eventdev;
                /**< No of event devs */
        struct eventdev_params eventdev_config[EVENT_MODE_MAX_EVENT_DEVS];
                /**< Per event dev conf */
+       uint8_t nb_rx_adapter;
+               /**< No of Rx adapters */
+       struct rx_adapter_conf rx_adapter[EVENT_MODE_MAX_RX_ADAPTERS];
+               /**< Rx adapter conf */
+       uint8_t nb_tx_adapter;
+               /**< No of Tx adapters */
+       struct tx_adapter_conf tx_adapter[EVENT_MODE_MAX_TX_ADAPTERS];
+               /** Tx adapter conf */
+       uint8_t nb_link;
+               /**< No of links */
+       struct eh_event_link_info
+               link[EVENT_MODE_MAX_LCORE_LINKS];
+               /**< Per link conf */
+       struct rte_bitmap *eth_core_mask;
+               /**< Core mask of cores to be used for software Rx and Tx */
+       uint32_t eth_portmask;
+               /**< Mask of the eth ports to be used */
        union {
                RTE_STD_C11
                struct {
                        uint64_t sched_type                     : 2;
                /**< Schedule type */
+                       uint64_t all_ev_queue_to_ev_port        : 1;
+               /**<
+                * When enabled, all event queues need to be mapped to
+                * each event port
+                */
                };
                uint64_t u64;
        } ext_params;
@@ -104,4 +201,31 @@ eh_devs_init(struct eh_conf *conf);
 int32_t
 eh_devs_uninit(struct eh_conf *conf);
 
+/**
+ * Get eventdev tx queue
+ *
+ * If the application uses event device which does not support internal port
+ * then it needs to submit the events to a Tx queue before final transmission.
+ * This Tx queue will be created internally by the eventmode helper subsystem,
+ * and application will need its queue ID when it runs the execution loop.
+ *
+ * @param mode_conf
+ *   Event helper configuration
+ * @param eventdev_id
+ *   Event device ID
+ * @return
+ *   Tx queue ID
+ */
+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);
+
 #endif /* _EVENT_HELPER_H_ */