From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0065.outbound.protection.outlook.com [104.47.33.65]) by dpdk.org (Postfix) with ESMTP id E4B637CDC for ; Fri, 5 Oct 2018 15:02:27 +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=yp/s72JpDQEoJxW90On5hRKtYT9v0ES/+/pY1/UBJoo=; b=O48cQJgtDzfCmLudgci7wOru0PRwmla29yT7bGmkHoWJiSv8kL7ZBnUNKXkZWnUqm2mAWS5Fe17aEeG4TSi07fjgkV0D00O07xpk1RW3XQ0TVIs2lBsmEG+TWS11tfM6vgT3yzUM6T2iqqIcl18hoFVLJZQJmCj3gsM4VQzFeIc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Anoob.Joseph@cavium.com; Received: from ajoseph83.caveonetworks.com.com (115.113.156.2) by SN6PR07MB4910.namprd07.prod.outlook.com (2603:10b6:805:39::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.21; Fri, 5 Oct 2018 13:02:22 +0000 From: Anoob Joseph To: Akhil Goyal , Pablo de Lara , Thomas Monjalon Cc: Tejasree Kondoj , Jerin Jacob , Narayana Prasad , dev@dpdk.org, Ankur Dwivedi , Anoob Joseph , Murthy NSSR , Nithin Dabilpuram , Ragothaman Jayaraman , Srisivasubramanian S Date: Fri, 5 Oct 2018 18:29:18 +0530 Message-Id: <1538744363-30340-28-git-send-email-anoob.joseph@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1538744363-30340-1-git-send-email-anoob.joseph@caviumnetworks.com> References: <1536033560-21541-1-git-send-email-ajoseph@caviumnetworks.com> <1538744363-30340-1-git-send-email-anoob.joseph@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [115.113.156.2] X-ClientProxiedBy: MA1PR0101CA0036.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::22) To SN6PR07MB4910.namprd07.prod.outlook.com (2603:10b6:805:39::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b862bbe5-6289-4aa7-d359-08d62ac2ccc0 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:SN6PR07MB4910; X-Microsoft-Exchange-Diagnostics: 1; SN6PR07MB4910; 3:I2fqD8cPF61yCsd7wU7AtS1dvWkZMYTmSF4wnxvjf6oqQ47uAIT4nWoYc1/1mR4O3MCQ+otx0ja1yIy9HbdFZ1jjYy3s8r6biDitWA7aSluwc+PYQjy+VKI1dBOVU9P1zOdCPM8I4PZEc+ZyKx8byht8so8SC1/ZsMkaAlMYUzuqXJwIAlg9h/teGNvuOAdNynZSPwJ9L4Udeo2vlXj2zakP0pdzgYy7B1R6VN6UPiZs5aQfXVIMCm9apW3XCUx7; 25:ekvxqSiXDWr9U3CBW1HpdWuC30ltrdD1OeSgrWpwpNQvnlhmm7Kp3srf6trq/KFNwgg4k4TXMl+BWnvoAtXWV7amARFCX2s3XtGHhinMmTWy55AKQ8yjFbXmmQxit3X4AInyJGw8T/CUDrEdilcHl1CwKdx9rkKcPscMrtWkiC4NffrMpMjCT+/xfY9mkSWm6dkpxD8OxNFDqvw65nELKPPnSbsxzuEcPNHBIM5Ss9kkuQGOVQQWf9oFg9IidZDb68Qpx/2hpuUvXnxJyIuc5RnFc8xbBIBqNcNd3643XjjWgAgXHtnanQnB7kdnRB01oBKaswIEAA2y/Q4d6cOF8g==; 31:3tSO4urNftIcHJYchkl7VLuojsTbyB7XegikRIMyopZg1GMbIHweFxGaPHuL/9ASPYrss1l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J+8CKo/P2NKxhUykabvD/xIOyo2LzpkI5vj2jKru1eA21xSja1gN43l0eviJwYLeX5qw8BP5+w== 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)(3002001)(3231355)(944501410)(52105095)(10201501046)(93006095)(149066)(150057)(6041310)(20161123564045)(20161123558120)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051); SRVR:SN6PR07MB4910; BCL:0; PCL:0; RULEID:; SRVR:SN6PR07MB4910; X-Forefront-PRVS: 0816F1D86E X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(39860400002)(346002)(136003)(396003)(366004)(199004)(189003)(51416003)(76176011)(11346002)(50226002)(25786009)(8936002)(48376002)(305945005)(186003)(16526019)(110136005)(6486002)(3846002)(446003)(52116002)(6116002)(81156014)(8676002)(97736004)(5660300001)(50466002)(4326008)(956004)(42882007)(2616005)(68736007)(478600001)(54906003)(7736002)(81166006)(6666003)(16586007)(107886003)(26005)(55236004)(66066001)(386003)(47776003)(6512007)(72206003)(44832011)(476003)(316002)(14444005)(36756003)(105586002)(106356001)(486006)(6506007)(2906002)(53936002); DIR:OUT; SFP:1101; SCL:1; SRVR:SN6PR07MB4910; 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; SN6PR07MB4910; 23:k/WwLDiyqS3QZiDqP+I7o52/8eFda/txfxhlypZor?= =?us-ascii?Q?ToZ4f7xcyKjsT+VnuuJp1Rx4dunDi9naDxsISHDMy5tJS3Y0eoApgP5y3jjP?= =?us-ascii?Q?d75w1WuPEW29soQu/AOZGGpiL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ascii?Q?IX3LaZNnsd3XZhJRESHkDnuofF8TABf1WSdVtGFalYW06fj/x0VXBLvL/l5I?= =?us-ascii?Q?cDRoMZEUfCZ2Qa/2vFz3AUpZHOu6t5HT4EIASGpxvjQfbOXSlZgxSZRc+1SA?= =?us-ascii?Q?e+BcawCPSy8YxLHQEiZGYExKxGd3OAALOfQOZEkvWbVqkGtHWIbMyY3yn2pn?= =?us-ascii?Q?kc7garcUoGJycEOePE1NyLdXNZKcobUX2x+IwaAB3K4leFZ1YJYLDFX/wprS?= =?us-ascii?Q?fUBlIcM78WeVo8vTxUHKih5ytFTq4RIbil3TprvUXOYuEa7M6kBi+TFsD5FU?= =?us-ascii?B?Zz09?= X-Microsoft-Antispam-Message-Info: jNFY+VbG+MP7QCuvuNfhPubJcwZ8IhVR+C+OjdN4aFK++75VK9LVPJJy8jTNoZVhX9faEOguHy386LzLOXWt9bh8hGb3Ramc9eQg1rRBcW2HjE7hLrDwFoBhEErEjLiOaddrbONp0rV5UwatH/EhJ7bg50YnIHdQG5sdW68URT5n/JrgusohgdfWm9JW49HONPIBBIpX9P8V2WNgTCpPRME2689ebLPs+st14gu44z+sIoJqz4vPEevq0VzL/JGmB0/6rqOR1S+3anMIQulHyuyIbMdizY3EjSSdneFvf3euI03r+W1Man5nCXmRa4kJxzBaLzX0AVje4D+adwzcWwS5TCW2ZRd1K4rH9QuRwug= X-Microsoft-Exchange-Diagnostics: 1; SN6PR07MB4910; 6:A5CWWv2+i+riNxwaob5ySknCjdOy52KkxfU2kWoGnJmk/Sl3Wc0XMn6MzPTQVglXlB1gYY9JQ2cTyJMVFCIqRGf7bQg60e53JLNKW/yGJhfkek2v2kDlbS0nPTip9ezm2fGYEsHAcpOvg+TB2JUNvXIKfwkqS0DL88HdThyQflWfUu+mDkCyhUYYAptoYFDfcvjyKVkTYtL4HMUq/VDebp2PiTKasJcBxVeXm+BrtfJJYRwG16l5J4JOqTWGimnwOY4fGvYannX6OLsyRREazKRe2o9wvuDtdAy+wrS2qk9FLtBYK34FCCPHKIPnqF3rutBvzt9oSM/rvbEba6LrgLfKeLUD+zlUPDV9+sJK9GCiQvJBXWoKTwKcR4DooN8+GXBcPEFQtW8l1xV1aTuVBNE+M1WmGE8siuBaI2pqcg9mE6NZIWjf6lBsEUBqj6m7cn4iiSy3Mt1Qcom51N6XDQ==; 5:IC8QHqSN94gsKE7VV+xS1ReelPaaryiXxzOOu2dQ6OP1+xria6p5uiFHTDOva44YUNwqJOh3e3byScXtg2DsQh61xT/7YFHg5tN0XtuYoaWi0c2rvNmMmaatdNqS1ks6ALq2ikpsWGvQrL20eApbq3rJx9tlXKuWtQyavhYYPdE=; 7:8VeZ4DfpAM9vvnh+npwQaolA8Iz7bdHxPS6FWhQVvtkUi+eghR7r1woohQq79OmVynbt3ied5z6fEnQRthift+Y/atrPHCZ0c/YN0b+2XRmo7FVbJhEi2Qv2MHLp7DNIwc3ZLbEGR/cooeZAwEHeS+ZZw47c0Cq8e9z7Nyo3/LjTtIrQTt8PLXTkUyCvAHUDxvezoOnaDP5UDNBq4RB3PxxPHdgDauK7pnFfYYt8wC9V5AjlCe89O4h/4vb8Cr8P SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Oct 2018 13:02:22.3924 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b862bbe5-6289-4aa7-d359-08d62ac2ccc0 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR07MB4910 Subject: [dpdk-dev] [PATCH v3 27/32] 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: Fri, 05 Oct 2018 13:02:28 -0000 From: Tejasree Kondoj 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 | 3 +++ drivers/common/cpt/cpt_request_mgr.h | 46 +++++++++++++++++++++++++++++++++++- 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/drivers/common/cpt/cpt_common.h b/drivers/common/cpt/cpt_common.h index 7333c13..1823939 100644 --- a/drivers/common/cpt/cpt_common.h +++ b/drivers/common/cpt/cpt_common.h @@ -15,6 +15,9 @@ */ #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 4d21f46..dea89f8 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,45 @@ 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 ", req, user_req->op); + + /* 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", 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 +87,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 +124,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