From patchwork Fri Dec 1 00:00:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 120283 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp453735qgn; Thu, 30 Nov 2017 16:00:22 -0800 (PST) X-Google-Smtp-Source: AGs4zMaIZXCoFyiH+9dc3s47nAmTyDOuFiR4+cQp9qa0MkG99G2318jTYC4VFTf4R4qMogKIxbqk X-Received: by 10.237.63.33 with SMTP id p30mr6240810qtf.321.1512086422848; Thu, 30 Nov 2017 16:00:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512086422; cv=none; d=google.com; s=arc-20160816; b=wXmZbayHoQGC3CMCKqABcutFznu8SWKk0PSRyCpPt7hYmvoBqkUZWqHtnHZv403tPA LjZuYnS8dNo7tvSNIOGpR0xhjSymOPkRAMf5X4WeZ2BnCK9XBY8HWhrKqTmBMKJtrYQZ r2KFYEoOkc2GRPOxZlDjn/AMVFrcIU5vnH6y9JBzwpCl5Irdb/SwSUlpPjZTEcuT93qK U3xo5mWO003MlIENHjqnn01K++01NLpnDwNHLSGA9jWtD7qEgjKcCRaaUj6lpXq9AG0B CoWoG68kU+GCHQKshi/vhLQ7B8lI8w2/EpzZxLmA4C7IHgXXJIq6TJ3dRcOhr9fvry+7 wxMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=jDz2k/uAn6hKeeOjUGrILQv7JpmimIne1ObsBvJVy2o=; b=WlJzBEb4kyoTcdXYV0AmoIz1W5mq5JPqbFcToUL3w4FRWgDYFXUKwvA4SnCwu8E3UI jtSDYERn18E3vM054Kw81Q9HO5dbDnY453ID35iAGAOnM1+Yo5ZffMb41gi4s3+qimOa eoznD5KvQHOwOJxhDEBkvuOrTjJeZ+oJNZeRvV+Zq1299uj9BVw9QZCD++Jsz/GmfmZj bVrVPt4IQrG2HaGobFyaGsB+yItyT3FiTnXoVWIDflSpJ3VzAcPKk94CYQgQjk8c33mz cGxXTJGnVQtwfcpPERG1qjwQYr/NlGzTOIifRXNNxDJq2c7OeJkkX1xPSX6uZqPyAeTo aMFg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id z27si1777849qkg.6.2017.11.30.16.00.22; Thu, 30 Nov 2017 16:00:22 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 11A4060969; Fri, 1 Dec 2017 00:00:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 7E7A46092D; Fri, 1 Dec 2017 00:00:16 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 1A2F560958; Fri, 1 Dec 2017 00:00:13 +0000 (UTC) Received: from forward101j.mail.yandex.net (forward101j.mail.yandex.net [5.45.198.241]) by lists.linaro.org (Postfix) with ESMTPS id C76A760905 for ; Fri, 1 Dec 2017 00:00:11 +0000 (UTC) Received: from mxback6o.mail.yandex.net (mxback6o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::20]) by forward101j.mail.yandex.net (Yandex) with ESMTP id 165111242685 for ; Fri, 1 Dec 2017 03:00:10 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback6o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id RqF3u5gThS-09GWPndX; Fri, 01 Dec 2017 03:00:10 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id xYJqeQ91tR-09vqExK8; Fri, 01 Dec 2017 03:00:09 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Fri, 1 Dec 2017 03:00:05 +0300 Message-Id: <1512086407-25684-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512086407-25684-1-git-send-email-odpbot@yandex.ru> References: <1512086407-25684-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 317 Subject: [lng-odp] [PATCH 2.0 v1 1/3] test: enable dpdk initialization before running validation on linux-dpdk X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Balakrishna Garapati Signed-off-by: Balakrishna Garapati --- /** Email created from pull request 317 (GBalakrishna:port_syzmon_crypto_changes) ** https://github.com/Linaro/odp/pull/317 ** Patch: https://github.com/Linaro/odp/pull/317.patch ** Base sha: 00c7441fae53949dd87855d48102f932f8f64537 ** Merge commit sha: 47d0d3921c6a03fb7ac9b994e06521598c5bd982 **/ platform/linux-generic/test/wrapper-script.sh | 3 +++ test/Makefile.inc | 2 ++ test/performance/Makefile.am | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100755 platform/linux-generic/test/wrapper-script.sh diff --git a/platform/linux-generic/test/wrapper-script.sh b/platform/linux-generic/test/wrapper-script.sh new file mode 100755 index 000000000..977a032ae --- /dev/null +++ b/platform/linux-generic/test/wrapper-script.sh @@ -0,0 +1,3 @@ +#wrapper script for pre setting environment for validation suit. +#currently this is empty but needs to be created to make it align with +#linux-dpdk. diff --git a/test/Makefile.inc b/test/Makefile.inc index eaf791e08..3e7dfe57f 100644 --- a/test/Makefile.inc +++ b/test/Makefile.inc @@ -20,6 +20,8 @@ AM_CFLAGS = $(CUNIT_CFLAGS) AM_LDFLAGS = -L$(LIB) -static +LOG_COMPILER = $(top_srcdir)/platform/@with_platform@/test/wrapper-script.sh + @VALGRIND_CHECK_RULES@ TESTS_ENVIRONMENT = ODP_PLATFORM=${with_platform} \ diff --git a/test/performance/Makefile.am b/test/performance/Makefile.am index 1dccd82e1..4417c4843 100644 --- a/test/performance/Makefile.am +++ b/test/performance/Makefile.am @@ -31,6 +31,6 @@ odp_sched_latency_SOURCES = odp_sched_latency.c odp_scheduling_SOURCES = odp_scheduling.c odp_pktio_perf_SOURCES = odp_pktio_perf.c -dist_check_SCRIPTS = $(TESTSCRIPTS) +dist_check_SCRIPTS = $(TESTSCRIPTS) $(LOG_COMPILER) dist_check_DATA = udp64.pcap From patchwork Fri Dec 1 00:00:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 120284 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp454372qgn; Thu, 30 Nov 2017 16:00:54 -0800 (PST) X-Google-Smtp-Source: AGs4zMaf0X4JZIvJGlMo3eD3b6AsVFnNPKNXLHrBOEB3KQFotiJ2pbXEi/fXzFaj2JR4vGFP/W02 X-Received: by 10.55.127.193 with SMTP id a184mr5381837qkd.119.1512086454718; Thu, 30 Nov 2017 16:00:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512086454; cv=none; d=google.com; s=arc-20160816; b=fp1WMZC2xUD4tKjill9X1/tG+s4EKxV6otrPUuctnDeEJMXAB0V33oVfitGt+bLxxB DjTfXLHgerGftVs5MNa425UyejAHm/R34D2EfmHp9az7YUBoWyLgwHLFq44eK9qtV2L5 gCG89Rwb4U/4DX9iAAjBj6vVGWMUfINWExnzQA3N7zHyl7aR4OTg/3+2SvkNSobEZg89 ytxSY5eLuaNV0V6dLc8Yk9wO6tn1YCqfLFZmmmF2atipqWsFQnCwkPTZR0YE03BTeA1T YUsz2GMvyABvwr5Fb2/P8tiqFOslgnsaeS2rshs1LEAmNOr5JGzBUPhoXyrWSrHKQ/aE ygrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=Vt9E5L6oj2T9ORpep2U5s9uOjXGu2uBtMJVwhm9FXWg=; b=QWY70Gh6h4XO09pNFT/CUv/DaCM+JdQS71Zm4aBA4hXf7cs1SUPnTmIwSb5vEuei3/ b5oI6wsbl3GkbI2fyMXtHi5gzKoNHlhqqiafeFvgCtllwBcTr5tBfbTTDd3nlK08A7+i +DUDO+kpICdLDFleByVJzflznm4LFXAZOCfWQ91l25nJ89S3xLc9ffP+6PzZH32AGj/N 0npWnjZQUR1cLOWa3FTyx4iKVoDzSzwe2gxcevCqhgTLVylEIc7l5ufWr1LA7xQ0wk2b 2vjXFiOtatv0huTQJQvmeZ1716ShUylQ7yiQBrVhrCTxOerxB6R70fidNe5UJsmHDV9s H5RQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id f95si3120156qkh.109.2017.11.30.16.00.54; Thu, 30 Nov 2017 16:00:54 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 5D6D060972; Fri, 1 Dec 2017 00:00:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id C1C1C60958; Fri, 1 Dec 2017 00:00:17 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 20DCB6092D; Fri, 1 Dec 2017 00:00:15 +0000 (UTC) Received: from forward105o.mail.yandex.net (forward105o.mail.yandex.net [37.140.190.183]) by lists.linaro.org (Postfix) with ESMTPS id 237F76092D for ; Fri, 1 Dec 2017 00:00:12 +0000 (UTC) Received: from mxback12g.mail.yandex.net (mxback12g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:91]) by forward105o.mail.yandex.net (Yandex) with ESMTP id 9D22B4441604 for ; Fri, 1 Dec 2017 03:00:10 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback12g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id DhVvyHrdlV-0A4KwNsk; Fri, 01 Dec 2017 03:00:10 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id xYJqeQ91tR-0AvqPgga; Fri, 01 Dec 2017 03:00:10 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Fri, 1 Dec 2017 03:00:06 +0300 Message-Id: <1512086407-25684-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512086407-25684-1-git-send-email-odpbot@yandex.ru> References: <1512086407-25684-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 317 Subject: [lng-odp] [PATCH 2.0 v1 2/3] linux-dpdk: Changes which are needed for odp_crypto to work. X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Balakrishna Garapati All the changes are within the linux-dpdk/odp_crypto.c file: 1) Added missing brackets which made it impossible to to create a crypto session 2) Increased the number of queues created, from nb_queue_pairs - 1 to nb_queue_pairs, what seems to work better 3) Removed a memory leak - the memory allocated for iv and aad were not freed Signed-off-by: Szymon Sliwa Signed-off-by: Balakrishna Garapati --- /** Email created from pull request 317 (GBalakrishna:port_syzmon_crypto_changes) ** https://github.com/Linaro/odp/pull/317 ** Patch: https://github.com/Linaro/odp/pull/317.patch ** Base sha: 00c7441fae53949dd87855d48102f932f8f64537 ** Merge commit sha: 47d0d3921c6a03fb7ac9b994e06521598c5bd982 **/ platform/linux-dpdk/odp_crypto.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/platform/linux-dpdk/odp_crypto.c b/platform/linux-dpdk/odp_crypto.c index 8e0f8a9df..9844f2dd7 100644 --- a/platform/linux-dpdk/odp_crypto.c +++ b/platform/linux-dpdk/odp_crypto.c @@ -271,7 +271,7 @@ int odp_crypto_init_global(void) qp_conf.nb_descriptors = NB_MBUF; - for (queue_pair = 0; queue_pair < nb_queue_pairs - 1; + for (queue_pair = 0; queue_pair < nb_queue_pairs; queue_pair++) { rc = rte_cryptodev_queue_pair_setup(cdev_id, queue_pair, @@ -898,11 +898,12 @@ int odp_crypto_session_create(odp_crypto_session_param_t *param, /* Setup session */ session = rte_cryptodev_sym_session_create(cdev_id, first_xform); - if (session == NULL) + if (session == NULL) { /* remove the crypto_session_entry_t */ memset(entry, 0, sizeof(*entry)); free_session(entry); return -1; + } entry->rte_session = (intptr_t)session; entry->cipher_xform = cipher_xform; @@ -1216,6 +1217,9 @@ int odp_crypto_int(odp_packet_t pkt_in, goto err; } + op->sym->auth.aad.data = NULL; + op->sym->cipher.iv.data = NULL; + odp_spinlock_unlock(&global->lock); /* Set crypto operation data parameters */ @@ -1242,9 +1246,8 @@ int odp_crypto_int(odp_packet_t pkt_in, if (aad_len > 0) { op->sym->auth.aad.data = rte_malloc("aad", aad_len, 0); if (op->sym->auth.aad.data == NULL) { - rte_crypto_op_free(op); ODP_ERR("Failed to allocate memory for AAD"); - goto err; + goto err_op_free; } memcpy(op->sym->auth.aad.data, aad_head, aad_len); @@ -1254,16 +1257,14 @@ int odp_crypto_int(odp_packet_t pkt_in, } if (entry->iv.length == 0) { - rte_crypto_op_free(op); ODP_ERR("Wrong IV length"); - goto err; + goto err_op_free; } op->sym->cipher.iv.data = rte_malloc("iv", entry->iv.length, 0); if (op->sym->cipher.iv.data == NULL) { - rte_crypto_op_free(op); ODP_ERR("Failed to allocate memory for IV"); - goto err; + goto err_op_free; } if (param->override_iv_ptr) { @@ -1300,18 +1301,16 @@ int odp_crypto_int(odp_packet_t pkt_in, rc = rte_cryptodev_enqueue_burst(rte_session->dev_id, queue_pair, &op, 1); if (rc == 0) { - rte_crypto_op_free(op); ODP_ERR("Failed to enqueue packet"); - goto err; + goto err_op_free; } rc = rte_cryptodev_dequeue_burst(rte_session->dev_id, queue_pair, &op, 1); if (rc == 0) { - rte_crypto_op_free(op); ODP_ERR("Failed to dequeue packet"); - goto err; + goto err_op_free; } out_pkt = (odp_packet_t)op->sym->m_src; @@ -1331,6 +1330,8 @@ int odp_crypto_int(odp_packet_t pkt_in, op_result = get_op_result_from_packet(out_pkt); *op_result = local_result; + rte_free(op->sym->cipher.iv.data); + rte_free(op->sym->auth.aad.data); rte_crypto_op_free(op); /* Synchronous, simply return results */ @@ -1338,6 +1339,11 @@ int odp_crypto_int(odp_packet_t pkt_in, return 0; +err_op_free: + rte_free(op->sym->cipher.iv.data); + rte_free(op->sym->auth.aad.data); + rte_crypto_op_free(op); + err: if (allocated) { odp_packet_free(out_pkt); From patchwork Fri Dec 1 00:00:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 120285 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp455040qgn; Thu, 30 Nov 2017 16:01:31 -0800 (PST) X-Google-Smtp-Source: AGs4zMbagYiIhwvfq5w7T25ax/T8VcVH10VoE09leVpE0hwhAfjui4ez095eeko0wkRFhdOkTRQr X-Received: by 10.200.40.157 with SMTP id i29mr6235445qti.86.1512086491454; Thu, 30 Nov 2017 16:01:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512086491; cv=none; d=google.com; s=arc-20160816; b=LSuhl0fK0Tr+/RMDftRhWDD8l0c43k2GnWj8vqxfvofJg8QXFL/8qDw+79/uSRiScM EAJPdMeIz87xHXarkFNa7nOO41XO4+TaBno6WMZ8aqnShXMI1xDuGoLn3OYKUE1EcHl+ scLsnTisQ1trjgknAqZqrbArklD4PT8589NbNFTOXNEsVxIOwMRfZwwMzrBk5Azy6ycZ qfFOAMtn3pgiwyMpjCfJDBB/sbozqCGugyjX5z9aQpTUeAmDycrX7tD3QYKJ1k8Y7WP5 fcLQder9ZytqhXpeRXXBXP19o1tXh9fyCSdaTvZiUxkDNPdAbOC4rlFF0olSpOkNpqnb VF+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=AjOVflv9k2rPG3ZFZW0XYUeKoOT3HBM/kLU8J3ocyf8=; b=0G9vvyV8qrcX2Xe9ZbGOCgxgbpV43R2fH8RqtzwZTVxWd/jcoLYeHBJfl/vunHdoZw RmbNyKr2la54XwuG87db37jGwF3jaodWbQgDNHdYcHDO898hGFfFwmlNsiPB3eFkdTue GpjGcbvLXuogIQo8agRrd4gKoGBb3FNQ1dSPXdBQfV4e16lntCM/1zclKeQEkuzkavx6 1h4mQqqOKsGiSWPs3Jach/e3AWLJIGwd2Z7YN0ypEV61ueVbS7hmXifPW0L2AbZU09AW 4A7wRadSa/FLlvvBl7KlcDGcgs4bUFEfDXWL02rOy9w/odacfDjCJAawGKGcdkCl4KoX bVmQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id j26si5098895qtj.15.2017.11.30.16.01.31; Thu, 30 Nov 2017 16:01:31 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 1466760964; Fri, 1 Dec 2017 00:01:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 27F256096A; Fri, 1 Dec 2017 00:00:21 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 66BF96092D; Fri, 1 Dec 2017 00:00:15 +0000 (UTC) Received: from forward104j.mail.yandex.net (forward104j.mail.yandex.net [5.45.198.247]) by lists.linaro.org (Postfix) with ESMTPS id A816F60943 for ; Fri, 1 Dec 2017 00:00:12 +0000 (UTC) Received: from mxback13g.mail.yandex.net (mxback13g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:92]) by forward104j.mail.yandex.net (Yandex) with ESMTP id 4366245DC0 for ; Fri, 1 Dec 2017 03:00:11 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback13g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id Ve3hce5FkK-0Bk4HMS4; Fri, 01 Dec 2017 03:00:11 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id xYJqeQ91tR-0AveLrte; Fri, 01 Dec 2017 03:00:10 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Fri, 1 Dec 2017 03:00:07 +0300 Message-Id: <1512086407-25684-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512086407-25684-1-git-send-email-odpbot@yandex.ru> References: <1512086407-25684-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 317 Subject: [lng-odp] [PATCH 2.0 v1 3/3] linux-dpdk: crypto bug fixes X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Balakrishna Garapati Signed-off-by: Balakrishna Garapati --- /** Email created from pull request 317 (GBalakrishna:port_syzmon_crypto_changes) ** https://github.com/Linaro/odp/pull/317 ** Patch: https://github.com/Linaro/odp/pull/317.patch ** Base sha: 00c7441fae53949dd87855d48102f932f8f64537 ** Merge commit sha: 47d0d3921c6a03fb7ac9b994e06521598c5bd982 **/ platform/linux-dpdk/odp_crypto.c | 77 ++++++++++++++++++++++++---------------- 1 file changed, 46 insertions(+), 31 deletions(-) diff --git a/platform/linux-dpdk/odp_crypto.c b/platform/linux-dpdk/odp_crypto.c index 9844f2dd7..ea014c8e8 100644 --- a/platform/linux-dpdk/odp_crypto.c +++ b/platform/linux-dpdk/odp_crypto.c @@ -808,40 +808,53 @@ int odp_crypto_session_create(odp_crypto_session_param_t *param, /* Default to successful result */ *status = ODP_CRYPTO_SES_CREATE_ERR_NONE; - /* Cipher Data */ - cipher_xform.cipher.key.data = rte_malloc("crypto key", - param->cipher_key.length, 0); - if (cipher_xform.cipher.key.data == NULL) { - ODP_ERR("Failed to allocate memory for cipher key\n"); - /* remove the crypto_session_entry_t */ - memset(entry, 0, sizeof(*entry)); - free_session(entry); - return -1; - } - cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER; cipher_xform.next = NULL; - cipher_xform.cipher.key.length = param->cipher_key.length; - memcpy(cipher_xform.cipher.key.data, - param->cipher_key.data, - param->cipher_key.length); - - /* Authentication Data */ - auth_xform.auth.key.data = rte_malloc("auth key", - param->auth_key.length, 0); - if (auth_xform.auth.key.data == NULL) { - ODP_ERR("Failed to allocate memory for auth key\n"); - /* remove the crypto_session_entry_t */ - memset(entry, 0, sizeof(*entry)); - free_session(entry); - return -1; + + if (param->cipher_key.length) { + /* Cipher Data */ + cipher_xform.cipher.key.data = rte_malloc("crypto key", + param->cipher_key.length, 0); + if (cipher_xform.cipher.key.data == NULL) { + ODP_ERR("Failed to allocate memory for cipher key\n"); + /* remove the crypto_session_entry_t */ + memset(entry, 0, sizeof(*entry)); + free_session(entry); + return -1; + } + + cipher_xform.cipher.key.length = param->cipher_key.length; + memcpy(cipher_xform.cipher.key.data, + param->cipher_key.data, + param->cipher_key.length); + } else { + cipher_xform.cipher.key.data = 0; + cipher_xform.cipher.key.length = 0; } + auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH; auth_xform.next = NULL; - auth_xform.auth.key.length = param->auth_key.length; - memcpy(auth_xform.auth.key.data, - param->auth_key.data, - param->auth_key.length); + + if (param->auth_key.length) { + /* Authentication Data */ + auth_xform.auth.key.data = rte_malloc("auth key", + param->auth_key.length, 0); + if (auth_xform.auth.key.data == NULL) { + ODP_ERR("Failed to allocate memory for auth key\n"); + /* remove the crypto_session_entry_t */ + memset(entry, 0, sizeof(*entry)); + free_session(entry); + return -1; + } + auth_xform.auth.key.length = param->auth_key.length; + memcpy(auth_xform.auth.key.data, + param->auth_key.data, + param->auth_key.length); + } else { + auth_xform.auth.key.data = 0; + auth_xform.auth.key.length = 0; + } + /* Derive order */ if (ODP_CRYPTO_OP_ENCODE == param->op) @@ -1271,11 +1284,13 @@ int odp_crypto_int(odp_packet_t pkt_in, memcpy(op->sym->cipher.iv.data, param->override_iv_ptr, entry->iv.length); + op->sym->cipher.iv.phys_addr = + rte_malloc_virt2phy(op->sym->cipher.iv.data); + op->sym->cipher.iv.length = entry->iv.length; } else if (entry->iv.data) { memcpy(op->sym->cipher.iv.data, entry->iv.data, entry->iv.length); - op->sym->cipher.iv.phys_addr = rte_malloc_virt2phy(op->sym->cipher.iv.data); op->sym->cipher.iv.length = entry->iv.length; @@ -1326,7 +1341,7 @@ int odp_crypto_int(odp_packet_t pkt_in, (rc_auth == ODP_CRYPTO_ALG_ERR_NONE); _odp_buffer_event_subtype_set(packet_to_buffer(out_pkt), - ODP_EVENT_PACKET_BASIC); + ODP_EVENT_PACKET_CRYPTO); op_result = get_op_result_from_packet(out_pkt); *op_result = local_result;