net/softnic: configure crypto port
authorFan Zhang <roy.fan.zhang@intel.com>
Wed, 24 Oct 2018 12:49:02 +0000 (13:49 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Fri, 26 Oct 2018 12:13:45 +0000 (14:13 +0200)
This patch enables the crypt port configuration in softnic.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
drivers/net/softnic/rte_eth_softnic_pipeline.c

index 3d37ba3..5e180f8 100644 (file)
@@ -15,6 +15,7 @@
 #include <rte_port_source_sink.h>
 #include <rte_port_fd.h>
 #include <rte_port_sched.h>
+#include <rte_port_sym_crypto.h>
 
 #include <rte_table_acl.h>
 #include <rte_table_array.h>
@@ -224,6 +225,7 @@ softnic_pipeline_port_in_create(struct pmd_internals *softnic,
                struct rte_port_sched_reader_params sched;
                struct rte_port_fd_reader_params fd;
                struct rte_port_source_params source;
+               struct rte_port_sym_crypto_reader_params cryptodev;
        } pp;
 
        struct pipeline *pipeline;
@@ -341,6 +343,23 @@ softnic_pipeline_port_in_create(struct pmd_internals *softnic,
                break;
        }
 
+       case PORT_IN_CRYPTODEV:
+       {
+               struct softnic_cryptodev *cryptodev;
+
+               cryptodev = softnic_cryptodev_find(softnic, params->dev_name);
+               if (cryptodev == NULL)
+                       return -1;
+
+               pp.cryptodev.cryptodev_id = cryptodev->dev_id;
+               pp.cryptodev.queue_id = params->cryptodev.queue_id;
+               pp.cryptodev.f_callback = params->cryptodev.f_callback;
+               pp.cryptodev.arg_callback = params->cryptodev.arg_callback;
+               p.ops = &rte_port_sym_crypto_reader_ops;
+               p.arg_create = &pp.cryptodev;
+               break;
+       }
+
        default:
                return -1;
        }
@@ -427,12 +446,14 @@ softnic_pipeline_port_out_create(struct pmd_internals *softnic,
                struct rte_port_sched_writer_params sched;
                struct rte_port_fd_writer_params fd;
                struct rte_port_sink_params sink;
+               struct rte_port_sym_crypto_writer_params cryptodev;
        } pp;
 
        union {
                struct rte_port_ethdev_writer_nodrop_params ethdev;
                struct rte_port_ring_writer_nodrop_params ring;
                struct rte_port_fd_writer_nodrop_params fd;
+               struct rte_port_sym_crypto_writer_nodrop_params cryptodev;
        } pp_nodrop;
 
        struct pipeline *pipeline;
@@ -562,6 +583,40 @@ softnic_pipeline_port_out_create(struct pmd_internals *softnic,
                break;
        }
 
+       case PORT_OUT_CRYPTODEV:
+       {
+               struct softnic_cryptodev *cryptodev;
+
+               cryptodev = softnic_cryptodev_find(softnic, params->dev_name);
+               if (cryptodev == NULL)
+                       return -1;
+
+               if (params->cryptodev.queue_id >= cryptodev->n_queues)
+                       return -1;
+
+               pp.cryptodev.cryptodev_id = cryptodev->dev_id;
+               pp.cryptodev.queue_id = params->cryptodev.queue_id;
+               pp.cryptodev.tx_burst_sz = params->burst_size;
+               pp.cryptodev.crypto_op_offset = params->cryptodev.op_offset;
+
+               pp_nodrop.cryptodev.cryptodev_id = cryptodev->dev_id;
+               pp_nodrop.cryptodev.queue_id = params->cryptodev.queue_id;
+               pp_nodrop.cryptodev.tx_burst_sz = params->burst_size;
+               pp_nodrop.cryptodev.n_retries = params->retry;
+               pp_nodrop.cryptodev.crypto_op_offset =
+                               params->cryptodev.op_offset;
+
+               if (params->retry == 0) {
+                       p.ops = &rte_port_sym_crypto_writer_ops;
+                       p.arg_create = &pp.cryptodev;
+               } else {
+                       p.ops = &rte_port_sym_crypto_writer_nodrop_ops;
+                       p.arg_create = &pp_nodrop.cryptodev;
+               }
+
+               break;
+       }
+
        default:
                return -1;
        }