From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0045.outbound.protection.outlook.com [104.47.32.45]) by dpdk.org (Postfix) with ESMTP id 121407EDC for ; Tue, 4 Sep 2018 06:03:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hPRrecACZYOvBnf3kAqw7PpIlUBNwsoQ67PNecZHOMw=; b=L7Etzr3jZnLGWchZDI6K+nALxw9mBsuC2dDlyNhn5CI3W0gGSo9J1w9wrIQLYdoxyGQ6/Feo72R0XV9Bms/jgV8sEUVxCnGxmo5ORpE1CFZCMUeYwpRmBxksOxZ9HjbRvPFHwGcFnXbXyh4JnC+4TZq10UKVys9SrMqVMGQS/Es= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Anoob.Joseph@cavium.com; Received: from ajoseph83.caveonetworks.com.com (115.113.156.2) by BYAPR07MB4902.namprd07.prod.outlook.com (2603:10b6:a02:ef::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1101.15; Tue, 4 Sep 2018 04:03:48 +0000 From: Anoob Joseph To: Akhil Goyal , Pablo de Lara , Thomas Monjalon Cc: Srisivasubramanian S , Jerin Jacob , Narayana Prasad , dev@dpdk.org, Ankur Dwivedi , Anoob Joseph , Murthy NSSR , Nithin Dabilpuram , Ragothaman Jayaraman , Tejasree Kondoj Date: Tue, 4 Sep 2018 09:29:15 +0530 Message-Id: <1536033560-21541-29-git-send-email-ajoseph@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1536033560-21541-1-git-send-email-ajoseph@caviumnetworks.com> References: <1528476325-15585-1-git-send-email-anoob.joseph@caviumnetworks.com> <1536033560-21541-1-git-send-email-ajoseph@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [115.113.156.2] X-ClientProxiedBy: BMXPR01CA0023.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:d::33) To BYAPR07MB4902.namprd07.prod.outlook.com (2603:10b6:a02:ef::25) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8bfe80df-eee2-4f37-3540-08d6121b6cef X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BYAPR07MB4902; X-Microsoft-Exchange-Diagnostics: 1; BYAPR07MB4902; 3:KfN9GDL4CI58nHfItoK3o2jjlYjnmOXRX+2RmqK7wAQP0HJ3f/7QB7Py7pjXv0IvdidV2ON2gfPlkSJXFxhVNHkZ2p57/hgO4WV0cSE8KEbsmbnE5jKGc7X/eFSlRKJ4gb4VId0Y8hOhIvi518alcFVbDaiT/sdV/IzQjw4Z3roAzG1TFn8OpWQ+CaaTQJOkmJhaRpP4J5xkxT/sExHSbJUsvW4qSphBTjFPh1Hxh4IGfbKESzcP4dcYn3VqKgpQ; 25:SvFLDfU9XFDOiH7ZIOzT/PjjpztXEOQiPBITrTHOdLWtOTjXT2xmrBR4oR9wAA16DbOlC+LiJ6fVY/99jux4pN+QXSV4ulyDxWwx73lB+achoZ9SJiBexWDJSOM3L1pAWnSjsxZUSKVZs5LPHa5vieianljy87+UbJWPQBU2sM4l7zRAKOsHbEO1qM5orzLm+F1fHS4aFsl/QhouhuQk7z/2Jr/ZpXjZvAFaiTK8qJfezOUCUYez1E4rpreQ+qm0r7DbOVxtcsmjsn5J5V7xfzy77pJBPyyJEGhyHtmUtG1duJ5t5Z99lAm4yLFj3ZR8XaUBymxNCEZjX1278sMXog==; 31:zs1AVWeH4/3LUDU7SQY20foCoUgAQIGfGdWY48KLpoFoVjToiqd47w/HxCgBM8KS8+Odc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a2O2Kgypu/AJqOgI96gWDLJPgvVPLeuy+Tfhxqoff5xiYs28TRholcQUBOrfRQ3OHHqQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(93006095)(3231311)(944501410)(52105095)(3002001)(149027)(150027)(6041310)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(201708071742011)(7699016); SRVR:BYAPR07MB4902; BCL:0; PCL:0; RULEID:; SRVR:BYAPR07MB4902; X-Forefront-PRVS: 0785459C39 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(396003)(136003)(346002)(376002)(39860400002)(199004)(189003)(26005)(51416003)(52116002)(76176011)(81166006)(305945005)(81156014)(7736002)(105586002)(316002)(6506007)(106356001)(6512007)(8936002)(446003)(54906003)(25786009)(6666003)(68736007)(50226002)(110136005)(53936002)(16586007)(42882007)(386003)(5660300001)(2906002)(72206003)(50466002)(6486002)(36756003)(6116002)(107886003)(2616005)(14444005)(186003)(3846002)(478600001)(66066001)(476003)(8676002)(47776003)(486006)(956004)(48376002)(11346002)(4326008)(97736004)(16526019); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR07MB4902; H:ajoseph83.caveonetworks.com.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BYAPR07MB4902; 23:kzTpPI305VnDFvHkd+CHLGHnJ0S5iMBbySq2Owx9i?= =?us-ascii?Q?vpsSftcF6SiszNivm6wfEPBO/b8kAAxWkw1zAYEJ2t5X44OuFmjZlBOz7kgv?= =?us-ascii?Q?7P+UoZOCbQgEYvQPRmW3P+tLdt9VyEP96HB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OySjng5qOvhaFjuIR7ndUiXYwZwU5KBuJhNbdt+C7opoCtT2KHByOZcR/22sPO0t9DFnFYhLNpUX2NO6Wte1cwrQQwJ32JrfHYr4m1h4XHvh6M8oToRGZoQ==; 5:RUC/Yh8OEUiC2i6SAN1hSVZBBJSs5a35aI79TkySvQbyj+GQLzvZUrLzRnvPXu1gznvYmiiJVUO13ZbmaSE6T7HRVzFjgLCLPCxcmxANFIB2uiJG0aLXclXgwk03576RoNg8j6V9CZceVCMUBboUW2lbPeYC/4/FOwJSQonCoKY=; 7:HnON4+GLaUA7tqi49qJTZ1WG07/oFLrhNGjuru0YFioTbigyZ/nHHZuMKfAUYktdPc9aS1Dp/3GZgdD8gl+LteF9KKhnlP4msiNvvRvG3QCa9h0BuR7kbeIXJeCfwCrSIHkOs9C6zHzHQONl2+oF+gNpXXCcBEKR+knXcYR8eNt6atBlNYleylGz+QEZHdnkcwqd9Mc9jaLcSxPfSkQESu8hKoubRYWbzfNDst65QYpDpZS4LedkXC9ichWR3GOA SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Sep 2018 04:03:48.2255 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8bfe80df-eee2-4f37-3540-08d6121b6cef X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR07MB4902 Subject: [dpdk-dev] [PATCH v2 28/33] common/cpt: add common code for enqueuing cpt instruction 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: Tue, 04 Sep 2018 04:03:53 -0000 From: Srisivasubramanian S Signed-off-by: Ankur Dwivedi Signed-off-by: Anoob Joseph Signed-off-by: Murthy NSSR Signed-off-by: Nithin Dabilpuram Signed-off-by: Ragothaman Jayaraman Signed-off-by: Srisivasubramanian S Signed-off-by: Tejasree Kondoj --- drivers/common/cpt/cpt_common.h | 4 +++ drivers/common/cpt/cpt_request_mgr.h | 50 +++++++++++++++++++++++++++++++++++- 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/drivers/common/cpt/cpt_common.h b/drivers/common/cpt/cpt_common.h index 61621dc..6debf42 100644 --- a/drivers/common/cpt/cpt_common.h +++ b/drivers/common/cpt/cpt_common.h @@ -15,6 +15,10 @@ */ #define CRYPTO_OCTEONTX 0x1 + +/* Default command timeout in seconds */ +#define DEFAULT_COMMAND_TIMEOUT 4 + #define CPT_COUNT_THOLD 32 #define CPT_TIMER_THOLD 0x3F diff --git a/drivers/common/cpt/cpt_request_mgr.h b/drivers/common/cpt/cpt_request_mgr.h index d843ee7..4bf8de3 100644 --- a/drivers/common/cpt/cpt_request_mgr.h +++ b/drivers/common/cpt/cpt_request_mgr.h @@ -5,6 +5,9 @@ #ifndef _CPT_REQUEST_MGR_H_ #define _CPT_REQUEST_MGR_H_ +#include +#include + #include "cpt_common.h" #include "cpt_mcode_defines.h" @@ -34,6 +37,49 @@ cpt_get_session_size(void) return (sizeof(struct cpt_sess_misc) + RTE_ALIGN_CEIL(ctx_len, 8)); } +static __rte_always_inline int32_t __hot +cpt_enqueue_req(struct cpt_instance *instance, struct pending_queue *pqueue, + void *req) +{ + struct cpt_request_info *user_req = (struct cpt_request_info *)req; + int32_t ret = 0; + + if (unlikely(!req)) + return 0; + + if (unlikely(pqueue->pending_count >= DEFAULT_CMD_QLEN)) + return -EAGAIN; + + fill_cpt_inst(instance, req); + + CPT_LOG_DP_DEBUG("req: %p op: %p dma_mode 0x%x se_req %u\n", + req, + user_req->op, + user_req->dma_mode, + user_req->se_req); + + /* Fill time_out cycles */ + user_req->time_out = rte_get_timer_cycles() + + DEFAULT_COMMAND_TIMEOUT * rte_get_timer_hz(); + user_req->extra_time = 0; + + /* Default mode of software queue */ + mark_cpt_inst(instance); + + pqueue->rid_queue[pqueue->enq_tail].rid = + (uintptr_t)user_req; + /* We will use soft queue length here to limit + * requests + */ + MOD_INC(pqueue->enq_tail, DEFAULT_CMD_QLEN); + pqueue->pending_count += 1; + + CPT_LOG_DP_DEBUG("Submitted NB cmd with request: %p " + "op: %p\n", user_req, user_req->op); + + return ret; +} + static __rte_always_inline int __hot cpt_pmd_crypto_operation(struct cpt_instance *instance, struct rte_crypto_op *op, struct pending_queue *pqueue, @@ -45,7 +91,6 @@ cpt_pmd_crypto_operation(struct cpt_instance *instance, int ret = 0; uint64_t cpt_op; struct cpt_vf *cptvf = (struct cpt_vf *)instance; - RTE_SET_USED(pqueue); if (unlikely(op->sess_type == RTE_CRYPTO_OP_SESSIONLESS)) { int sess_len; @@ -83,6 +128,9 @@ cpt_pmd_crypto_operation(struct cpt_instance *instance, goto req_fail; } + /* Enqueue prepared instruction to HW */ + ret = cpt_enqueue_req(instance, pqueue, prep_req); + if (unlikely(ret)) { if (unlikely(ret == -EAGAIN)) goto req_fail; -- 2.7.4