From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0082.outbound.protection.outlook.com [104.47.41.82]) by dpdk.org (Postfix) with ESMTP id D444A1B3AC for ; Tue, 9 Oct 2018 11:10:02 +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=kR6bLZdHJs6diJtPoaJAtl1Hn1MFge8cmfUq6H3ZXcU=; b=lbWs1Xp6pbkT91pYVhKYn2f9LM6dij/PzlCXwR8X3DVxn3UxNQK2m8E9j0gR8WWak4ggwa00utMAAsk08rCPOov905IB5/qHEdSKIvGYZI+i6GfXYt5qvC3elHxxFXBjCQigkJB94MmEOuW6FRXCEQImChRSXGyMboMu1u4JlOo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Anoob.Joseph@cavium.com; Received: from ajoseph83.caveonetworks.com.com (115.113.156.2) by BN7PR07MB4897.namprd07.prod.outlook.com (2603:10b6:406:ef::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.28; Tue, 9 Oct 2018 09:09:58 +0000 From: Anoob Joseph To: Akhil Goyal , Pablo de Lara , Thomas Monjalon Cc: Tejasree Kondoj , Jerin Jacob , Narayana Prasad , Ankur Dwivedi , Anoob Joseph , Murthy NSSR , Nithin Dabilpuram , Ragothaman Jayaraman , Srisivasubramanian S , dev@dpdk.org Date: Tue, 9 Oct 2018 14:37:53 +0530 Message-Id: <1539076076-19786-21-git-send-email-anoob.joseph@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1539076076-19786-1-git-send-email-anoob.joseph@caviumnetworks.com> References: <1538744363-30340-1-git-send-email-anoob.joseph@caviumnetworks.com> <1539076076-19786-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: PN1PR0101CA0004.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:e::14) To BN7PR07MB4897.namprd07.prod.outlook.com (2603:10b6:406:ef::26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9bd135a5-786f-4f8f-664c-08d62dc6fe53 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BN7PR07MB4897; X-Microsoft-Exchange-Diagnostics: 1; BN7PR07MB4897; 3:+GZ7M8IF2cM8y1z6ScUTsxXQdf3VJexB5MNvQMqRb2h9JVPkhHv6RONnknaKOC1UugUUHv+DYsZpzVIO+tljfeicm7ZPEW03cSnKK0lxpUgZinePyqfeQxJN+o/zEdVhUTnhQr8PPwINdw/Db4LHSJ2DkhyDJXM2XB8ekGGXWSiW4jZb91uM0ZiVKUfdIyJca1ZHMZw3k704veFBMaYOlnK1NhAU1reIlQvBHmK7vs1DLzzGphLalOSJGl3niB2y; 25:K6aeBbqUBs39z/4c3Oh7G9tqWOAKaXf0eCZjAd+D3MLugTXotIhWOdodn6AuGpR+nA163KRlIucGOAcgFxWRo9ssqfNIA+z6vbI/rpMNm0ilQ4mgW/IRcKGGSVAhcHJNz6QEFH61Bc8STT1MN04fr+DGIqAiiTMMj5el326CJcQvXswn4WRo66EuR1KKtfvUi1xK5q56TvueLTgnCszA0iKyupRjGn2vP4DDHbLwXuElW7TV1bW5EIAu6qYIJvnfYI8XujMIqNpvYAmCqObnmZ7NdrsbIn6jK72mW9+cN4CV5RlXejt6h9VslxwhHWPsxIDXUc4ReQ2MDP9QSk8HiA==; 31:lPGhabFJJLi/pf5tZQFrY5eOsgLEKI2MpEn794DdVT7mdsjlUkcZAOqQ7plv2vJ5KRFeHtz/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viPZotDIHaJSirzFrWao4DlZcKkTFmyqdqqwVxXy1BJWu947dJkL1bg== 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)(5005006)(8121501046)(3002001)(93006095)(10201501046)(3231355)(944501410)(52105095)(149066)(150057)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123558120)(201708071742011)(7699051); SRVR:BN7PR07MB4897; BCL:0; PCL:0; RULEID:; SRVR:BN7PR07MB4897; X-Forefront-PRVS: 08200063E9 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(366004)(376002)(136003)(346002)(39860400002)(199004)(189003)(42882007)(47776003)(106356001)(6666003)(186003)(5660300001)(26005)(68736007)(16526019)(8936002)(25786009)(6116002)(2906002)(81156014)(50226002)(305945005)(81166006)(7736002)(3846002)(105586002)(478600001)(8676002)(54906003)(110136005)(48376002)(16586007)(14444005)(6486002)(6506007)(50466002)(316002)(53936002)(386003)(51416003)(52116002)(76176011)(11346002)(6512007)(44832011)(446003)(36756003)(55236004)(956004)(2616005)(486006)(4326008)(66066001)(97736004)(72206003)(476003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN7PR07MB4897; 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; BN7PR07MB4897; 23:9aufJZptz45SXwRujwGyAy0EzMjXeT3/Irho94ct0?= =?us-ascii?Q?FEI1tUeYDXsXeAMN/qFOKSGXfRcvF/Y+Nb+qgZQY/JLka8siUpnE8FGEpDrB?= =?us-ascii?Q?JdBk5kS14voVHhNt6aHzFjgQ4OHS/02nL1qxns/sNMbl8G1SqA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TKVyaHeAGzauNgndvYOU/oCEtgdG5teqYrtbsRsUa9Qf4VVJBnvUg4Cn6+LgVfL5AmeGbq93/ZKT/KvJq3+dSQ5R7lFd36jXb/GkRKgeDd7Bv8on6PCbCcOw==; 5:OarxZgG4dh6ueC7TViITEArUWINvaOzaXgAMwQGuXiszXOvr1KUsiApJnq5keBam1cTF9h+WSBSrno8a5gMqJurbWUvoB3QLMEcsVGWe7o+WSrT9NHtLNd8stcNI62vVEcW2n0I010JWsBmMPjEXZn0BUS6gh7IMW2huJ1Z0pbA=; 7:m9z5waiobUr1dKDBnIBrqClCn43c6s5zCK91gBTi2PNxLeTQoHO9t3EBDayqzQbnxuo/w5kQ+74KTtJpEYu1NMAh56IO2PgHlMDcbVesKvYnkaUfstzanvmoZ8yyk8icB2vQQ+qdPc5+kZEPEFgpCk1p2DlhIBNqbjRpnD/OaMjDofyRvDukwpX7fXL4gCREzbu55fCxSJC8GM2+KKWjQrKSS/89rXu+yn/vNFlmhTCskzGuV1sRbfeoIRA3fdCv SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Oct 2018 09:09:58.0113 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9bd135a5-786f-4f8f-664c-08d62dc6fe53 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR07MB4897 Subject: [dpdk-dev] [PATCH v4 20/23] crypto/octeontx: add enqueue burst op 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, 09 Oct 2018 09:10:03 -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 ++++++++++++++++++++++- drivers/crypto/octeontx/otx_cryptodev_hw_access.h | 18 +++++++++ drivers/crypto/octeontx/otx_cryptodev_ops.c | 27 ++++++++++++- 4 files changed, 92 insertions(+), 2 deletions(-) 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; diff --git a/drivers/crypto/octeontx/otx_cryptodev_hw_access.h b/drivers/crypto/octeontx/otx_cryptodev_hw_access.h index affbba1..6f4d6e1 100644 --- a/drivers/crypto/octeontx/otx_cryptodev_hw_access.h +++ b/drivers/crypto/octeontx/otx_cryptodev_hw_access.h @@ -187,6 +187,15 @@ otx_cpt_read_vq_doorbell(struct cpt_vf *cptvf) return vqx_dbell.s.dbell_cnt; } +static __rte_always_inline void +otx_cpt_ring_dbell(struct cpt_instance *instance, uint16_t count) +{ + struct cpt_vf *cptvf = (struct cpt_vf *)instance; + /* Memory barrier to flush pending writes */ + rte_smp_wmb(); + otx_cpt_write_vq_doorbell(cptvf, count); +} + static __rte_always_inline void * get_cpt_inst(struct command_queue *cqueue) { @@ -237,7 +246,16 @@ mark_cpt_inst(struct cpt_instance *instance) queue->idx = 0; queue->cchunk = cchunk; } +} +static __rte_always_inline uint8_t +check_nb_command_id(struct cpt_request_info *user_req, + struct cpt_instance *instance) +{ + /* Required for dequeue operation. Adding a dummy routine for now */ + RTE_SET_USED(user_req); + RTE_SET_USED(instance); + return 0; } #endif /* _OTX_CRYPTODEV_HW_ACCESS_H_ */ diff --git a/drivers/crypto/octeontx/otx_cryptodev_ops.c b/drivers/crypto/octeontx/otx_cryptodev_ops.c index 16fad49..4240051 100644 --- a/drivers/crypto/octeontx/otx_cryptodev_ops.c +++ b/drivers/crypto/octeontx/otx_cryptodev_ops.c @@ -341,6 +341,31 @@ otx_cpt_session_clear(struct rte_cryptodev *dev, } } +static uint16_t +otx_cpt_pkt_enqueue(void *qptr, struct rte_crypto_op **ops, uint16_t nb_ops) +{ + struct cpt_instance *instance = (struct cpt_instance *)qptr; + uint16_t count = 0; + int ret; + struct cpt_vf *cptvf = (struct cpt_vf *)instance; + struct pending_queue *pqueue = &cptvf->pqueue; + + count = DEFAULT_CMD_QLEN - pqueue->pending_count; + if (nb_ops > count) + nb_ops = count; + + count = 0; + while (likely(count < nb_ops)) { + ret = cpt_pmd_crypto_operation(instance, ops[count], pqueue, + otx_cryptodev_driver_id); + if (unlikely(ret)) + break; + count++; + } + otx_cpt_ring_dbell(instance, count); + return count; +} + static struct rte_cryptodev_ops cptvf_ops = { /* Device related operations */ .dev_configure = otx_cpt_dev_config, @@ -432,7 +457,7 @@ otx_cpt_dev_create(struct rte_cryptodev *c_dev) c_dev->dev_ops = &cptvf_ops; - c_dev->enqueue_burst = NULL; + c_dev->enqueue_burst = otx_cpt_pkt_enqueue; c_dev->dequeue_burst = NULL; c_dev->feature_flags = RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO | -- 2.7.4