cryptodev: make xform key pointer constant
[dpdk.git] / drivers / net / softnic / rte_eth_softnic_internals.h
index 9aa19a9..08bc660 100644 (file)
@@ -38,6 +38,7 @@ struct pmd_params {
        const char *firmware;
        uint16_t conn_port;
        uint32_t cpu_id;
+       int sc; /**< Service cores. */
 
        /** Traffic Management (TM) */
        struct {
@@ -278,6 +279,28 @@ struct softnic_tap {
 
 TAILQ_HEAD(softnic_tap_list, softnic_tap);
 
+/**
+ * Cryptodev
+ */
+struct softnic_cryptodev_params {
+       const char *dev_name;
+       uint32_t dev_id; /**< Valid only when *dev_name* is NULL. */
+       uint32_t n_queues;
+       uint32_t queue_size;
+       uint32_t session_pool_size;
+};
+
+struct softnic_cryptodev {
+       TAILQ_ENTRY(softnic_cryptodev) node;
+       char name[NAME_SIZE];
+       uint16_t dev_id;
+       uint32_t n_queues;
+       struct rte_mempool *mp_create;
+       struct rte_mempool *mp_init;
+};
+
+TAILQ_HEAD(softnic_cryptodev_list, softnic_cryptodev);
+
 /**
  * Input port action
  */
@@ -309,6 +332,7 @@ struct softnic_table_action_profile_params {
        struct rte_table_action_nat_config nat;
        struct rte_table_action_ttl_config ttl;
        struct rte_table_action_stats_config stats;
+       struct rte_table_action_sym_crypto_config sym_crypto;
 };
 
 struct softnic_table_action_profile {
@@ -343,6 +367,7 @@ enum softnic_port_in_type {
        PORT_IN_TMGR,
        PORT_IN_TAP,
        PORT_IN_SOURCE,
+       PORT_IN_CRYPTODEV,
 };
 
 struct softnic_port_in_params {
@@ -364,6 +389,12 @@ struct softnic_port_in_params {
                        const char *file_name;
                        uint32_t n_bytes_per_pkt;
                } source;
+
+               struct {
+                       uint16_t queue_id;
+                       void *f_callback;
+                       void *arg_callback;
+               } cryptodev;
        };
        uint32_t burst_size;
 
@@ -377,6 +408,7 @@ enum softnic_port_out_type {
        PORT_OUT_TMGR,
        PORT_OUT_TAP,
        PORT_OUT_SINK,
+       PORT_OUT_CRYPTODEV,
 };
 
 struct softnic_port_out_params {
@@ -391,6 +423,11 @@ struct softnic_port_out_params {
                        const char *file_name;
                        uint32_t max_n_pkts;
                } sink;
+
+               struct {
+                       uint16_t queue_id;
+                       uint32_t op_offset;
+               } cryptodev;
        };
        uint32_t burst_size;
        int retry;
@@ -514,7 +551,7 @@ struct softnic_thread {
        struct rte_ring *msgq_req;
        struct rte_ring *msgq_rsp;
 
-       uint32_t enabled;
+       uint32_t service_id;
 };
 
 /**
@@ -574,6 +611,7 @@ struct pmd_internals {
        struct softnic_link_list link_list;
        struct softnic_tmgr_port_list tmgr_port_list;
        struct softnic_tap_list tap_list;
+       struct softnic_cryptodev_list cryptodev_list;
        struct softnic_port_in_action_profile_list port_in_action_profile_list;
        struct softnic_table_action_profile_list table_action_profile_list;
        struct pipeline_list pipeline_list;
@@ -740,6 +778,24 @@ struct softnic_tap *
 softnic_tap_create(struct pmd_internals *p,
        const char *name);
 
+/**
+ * Sym Crypto
+ */
+int
+softnic_cryptodev_init(struct pmd_internals *p);
+
+void
+softnic_cryptodev_free(struct pmd_internals *p);
+
+struct softnic_cryptodev *
+softnic_cryptodev_find(struct pmd_internals *p,
+       const char *name);
+
+struct softnic_cryptodev *
+softnic_cryptodev_create(struct pmd_internals *p,
+       const char *name,
+       struct softnic_cryptodev_params *params);
+
 /**
  * Input port action
  */
@@ -776,6 +832,9 @@ softnic_table_action_profile_create(struct pmd_internals *p,
        const char *name,
        struct softnic_table_action_profile_params *params);
 
+enum rte_table_action_policer
+softnic_table_action_policer(enum rte_mtr_policer_action action);
+
 /**
  * Pipeline
  */
@@ -788,6 +847,9 @@ softnic_pipeline_free(struct pmd_internals *p);
 void
 softnic_pipeline_disable_all(struct pmd_internals *p);
 
+uint32_t
+softnic_pipeline_thread_count(struct pmd_internals *p, uint32_t thread_id);
+
 struct pipeline *
 softnic_pipeline_find(struct pmd_internals *p, const char *name);
 
@@ -886,6 +948,9 @@ struct softnic_table_rule_match {
        } match;
 };
 
+#ifndef SYM_CRYPTO_MAX_KEY_SIZE
+#define SYM_CRYPTO_MAX_KEY_SIZE                (256)
+#endif
 struct softnic_table_rule_action {
        uint64_t action_mask;
        struct rte_table_action_fwd_params fwd;
@@ -899,6 +964,8 @@ struct softnic_table_rule_action {
        struct rte_table_action_time_params time;
        struct rte_table_action_tag_params tag;
        struct rte_table_action_decap_params decap;
+       struct rte_table_action_sym_crypto_params sym_crypto;
+       uint8_t sym_crypto_key[SYM_CRYPTO_MAX_KEY_SIZE];
 };
 
 struct rte_flow {