From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 62DBF1B448 for ; Fri, 28 Sep 2018 14:41:35 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Sep 2018 05:41:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,314,1534834800"; d="scan'208";a="76853809" Received: from silpixa00398673.ir.intel.com (HELO silpixa00398673.ger.corp.intel.com) ([10.237.223.54]) by orsmga007.jf.intel.com with ESMTP; 28 Sep 2018 05:41:21 -0700 From: Fan Zhang To: dev@dpdk.org Cc: cristian.dumitrescu@intel.com, "Zhang, Roy Fan" , Zhang Date: Fri, 28 Sep 2018 13:26:11 +0100 Message-Id: <20180928122615.48390-4-roy.fan.zhang@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180928122615.48390-1-roy.fan.zhang@intel.com> References: <20180828081929.34085-1-roy.fan.zhang@intel.com> <20180928122615.48390-1-roy.fan.zhang@intel.com> Subject: [dpdk-dev] [PATCH v2 3/7] examples/ip_pipeline: configure crypto port X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Sep 2018 12:41:36 -0000 From: "Zhang, Roy Fan" This patch adds symmetric crypto port configuration to ip_pipeline sample application. Signed-off-by: Zhang, Roy Fan Acked-by: Dumitrescu, Cristian --- examples/ip_pipeline/pipeline.c | 60 +++++++++++++++++++++++++++++++++++++++++ examples/ip_pipeline/pipeline.h | 13 +++++++++ 2 files changed, 73 insertions(+) diff --git a/examples/ip_pipeline/pipeline.c b/examples/ip_pipeline/pipeline.c index b2fd215b1..b23d6c09a 100644 --- a/examples/ip_pipeline/pipeline.c +++ b/examples/ip_pipeline/pipeline.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -36,6 +37,7 @@ #include "tap.h" #include "tmgr.h" #include "swq.h" +#include "cryptodev.h" #ifndef PIPELINE_MSGQ_SIZE #define PIPELINE_MSGQ_SIZE 64 @@ -162,6 +164,7 @@ pipeline_port_in_create(const char *pipeline_name, struct rte_port_kni_reader_params kni; #endif struct rte_port_source_params source; + struct rte_port_sym_crypto_reader_params sym_crypto; } pp; struct pipeline *pipeline; @@ -295,6 +298,27 @@ pipeline_port_in_create(const char *pipeline_name, break; } + case PORT_IN_CRYPTODEV: + { + struct cryptodev *cryptodev; + + cryptodev = cryptodev_find(params->dev_name); + if (cryptodev == NULL) + return -1; + + if (params->rxq.queue_id > cryptodev->n_queues - 1) + return -1; + + pp.sym_crypto.cryptodev_id = cryptodev->dev_id; + pp.sym_crypto.queue_id = params->cryptodev.queue_id; + pp.sym_crypto.f_callback = params->cryptodev.f_callback; + pp.sym_crypto.arg_callback = params->cryptodev.arg_callback; + p.ops = &rte_port_sym_crypto_reader_ops; + p.arg_create = &pp.sym_crypto; + + break; + } + default: return -1; } @@ -384,6 +408,7 @@ pipeline_port_out_create(const char *pipeline_name, struct rte_port_kni_writer_params kni; #endif struct rte_port_sink_params sink; + struct rte_port_sym_crypto_writer_params sym_crypto; } pp; union { @@ -393,6 +418,7 @@ pipeline_port_out_create(const char *pipeline_name, #ifdef RTE_LIBRTE_KNI struct rte_port_kni_writer_nodrop_params kni; #endif + struct rte_port_sym_crypto_writer_nodrop_params sym_crypto; } pp_nodrop; struct pipeline *pipeline; @@ -548,6 +574,40 @@ pipeline_port_out_create(const char *pipeline_name, break; } + case PORT_OUT_CRYPTODEV: + { + struct cryptodev *cryptodev; + + cryptodev = cryptodev_find(params->dev_name); + if (cryptodev == NULL) + return -1; + + if (params->cryptodev.queue_id >= cryptodev->n_queues) + return -1; + + pp.sym_crypto.cryptodev_id = cryptodev->dev_id; + pp.sym_crypto.queue_id = params->cryptodev.queue_id; + pp.sym_crypto.tx_burst_sz = params->burst_size; + pp.sym_crypto.crypto_op_offset = params->cryptodev.op_offset; + + pp_nodrop.sym_crypto.cryptodev_id = cryptodev->dev_id; + pp_nodrop.sym_crypto.queue_id = params->cryptodev.queue_id; + pp_nodrop.sym_crypto.tx_burst_sz = params->burst_size; + pp_nodrop.sym_crypto.n_retries = params->retry; + pp_nodrop.sym_crypto.crypto_op_offset = + params->cryptodev.op_offset; + + if (params->retry == 0) { + p.ops = &rte_port_sym_crypto_writer_ops; + p.arg_create = &pp.sym_crypto; + } else { + p.ops = &rte_port_sym_crypto_writer_nodrop_ops; + p.arg_create = &pp_nodrop.sym_crypto; + } + + break; + } + default: return -1; } diff --git a/examples/ip_pipeline/pipeline.h b/examples/ip_pipeline/pipeline.h index a953a29fa..fb283e558 100644 --- a/examples/ip_pipeline/pipeline.h +++ b/examples/ip_pipeline/pipeline.h @@ -27,6 +27,7 @@ enum port_in_type { PORT_IN_TAP, PORT_IN_KNI, PORT_IN_SOURCE, + PORT_IN_CRYPTODEV, }; struct port_in_params { @@ -48,6 +49,12 @@ struct 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; @@ -62,6 +69,7 @@ enum port_out_type { PORT_OUT_TAP, PORT_OUT_KNI, PORT_OUT_SINK, + PORT_OUT_CRYPTODEV, }; struct port_out_params { @@ -76,6 +84,11 @@ struct 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; -- 2.13.6