From e0e52c7c2975f3815c248b3d3a91b466b382a804 Mon Sep 17 00:00:00 2001 From: Fan Zhang Date: Wed, 24 Oct 2018 13:49:02 +0100 Subject: [PATCH] net/softnic: configure crypto port This patch enables the crypt port configuration in softnic. Signed-off-by: Fan Zhang Acked-by: Cristian Dumitrescu --- .../net/softnic/rte_eth_softnic_pipeline.c | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/drivers/net/softnic/rte_eth_softnic_pipeline.c b/drivers/net/softnic/rte_eth_softnic_pipeline.c index 3d37ba3fee..5e180f8f70 100644 --- a/drivers/net/softnic/rte_eth_softnic_pipeline.c +++ b/drivers/net/softnic/rte_eth_softnic_pipeline.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -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; } -- 2.20.1