From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0047.outbound.protection.outlook.com [104.47.33.47]) by dpdk.org (Postfix) with ESMTP id 634E3A48F for ; Mon, 19 Mar 2018 13:24:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=tYQV7DNmVtSK54Jy/xHnzBxXVaS6xUHJd9soTKwpQos=; b=rjbZ+RGbUMljBBLHQEJ+miAOr6ybIf+8he2zKd/ysfo/n5/bbqX5UBYpe0BaaX4wpScqyWAIlQnfZKZBKGxAw0W6kirS97EpGBzqTKcCrV+fRS5MIFzArq0RvwEvezW2bReJcmJR46KCfvjeZF6pWzDXJKTt2ePijddL7yxZdzk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Ravi1.Kumar@amd.com; Received: from wallaby-smavila.amd.com (202.56.249.162) by BN6PR12MB1505.namprd12.prod.outlook.com (10.172.24.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.588.14; Mon, 19 Mar 2018 12:24:20 +0000 From: Ravi Kumar To: dev@dpdk.org Cc: pablo.de.lara.guarch@intel.com, hemant.agrawal@nxp.com Date: Mon, 19 Mar 2018 08:23:37 -0400 Message-Id: <1521462233-13590-3-git-send-email-Ravi1.kumar@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521462233-13590-1-git-send-email-Ravi1.kumar@amd.com> References: <1520584520-130522-1-git-send-email-Ravi1.kumar@amd.com> <1521462233-13590-1-git-send-email-Ravi1.kumar@amd.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [202.56.249.162] X-ClientProxiedBy: MAXPR0101CA0025.INDPRD01.PROD.OUTLOOK.COM (10.174.62.139) To BN6PR12MB1505.namprd12.prod.outlook.com (10.172.24.146) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 5941251d-8866-4785-8887-08d58d945842 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:BN6PR12MB1505; X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1505; 3:ueMUp3G44nR0pFlj8dxEYa7B2WSc4o5sU4WawpFwbU8qtTu/g7vz1Ki6ZGqfj6zlNRN0h9FvMgzrPvOH9LcfKb8rD0I6xkTnvaAgEEGDb9ZVuP5eQrZjgDrhd9ZOiA+uDjog6JQYz1kjPHFqBjysSomuZ/bIVXMZyyMnxFrCnrNhxWSp6H9Gnyfs9fm4OzO4AMDAoaSxIpzzsYPjTitk9fouIYtPFEO3MkRP+enEQVK5leXBdlIJfYLHDSrYd5/m; 25:gak7YvBQjltZRNcgJCRtBsKrBBNG4CKvAO63tBACOjOKnAQgQeXv2FyQvqc4tu0qq1Jazn74Ng8sr26Rn1ArHWJCzKLMkVnlMEBjVX8nXs/ERXS7IPRg3IbKtZChc1uwP2epC1WyBjWmV1JAH9+1QJ0Pd5aaHJCIzmCF+8sXHNm7Nk+T0pPqJbpXG+RpcZweTOl883rFLCMFVjKt6jiy1M94Jk1zKHE2xtvzzNL20KAJOKpGp6F1DPf2gwv+EJCvLJLKbXxMS2Eeh9B7mbv9gSTxtI6uqdSTVcleBT6418mT3gvpMlffe5Hw5L/9EivMlirY0l41YQJlS7ZRM4eY9A==; 31:7BtLKmb54n0iIu5SHRZMan6QKnzntmiSbVqBxK+iSB/2EfykKlHRQTIL9cNaN15CFyI8ZtNmkPxCz70zdm+tDt/7OE4kdsWTkHINphT61DJ4lYhEDU5mzLJ4WUvIf3PNscvq+qHCZib6LBthnqOtAs3ySyhQULRpQHXg/Jh3EGpCC/V6EU9XAUPWfJoulfLbzA/K9L+VVeCJutr/fbhSw6S6sLUhDAI54w0CAlDaJdk= X-MS-TrafficTypeDiagnostic: BN6PR12MB1505: X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1505; 20:6D36x53dbm5TiWMDgxBffAKzahL26oIuRa650k++iRGXODJNXRccRKBQYz1WOqVBX+3BNE5rAYdGjsXPpXxh1kM0YOa3Dvk3tUYT9FPnKi74eJx2GHayIWvb4kpHbme9MGTpEp2QItaCXXFuhdWWooOpE7/TPnPwEDqgG7bFAanKI7d0lWyOlQwtdp5hAa0Qu3dZXrbZAQf9ovHapjkMm1r77mVXapRTBrYrLz4Cj++eKNo5ZDeQZQkFGRhGZHs2mc8TTUNFmgE/xMvZwuNswLBlJEq7rGCNplgsumPr9g1RdCLsWy1PqmoiQNymOPHIN3O8sEbkXR3fMA2+GlZIJvqea0aLOzZnyopyELTKgN9jtJ8peP7KummFQAIh7UJy1I/9wK8lz7xDFu8LBDrKBfHNzewgeWUrAdZCyVvoVwaZdmCsULCZuuEO3H6a8rTN1TxQabwMzfBrjmzZQ5H2EaZX8xhYyDx3UjSYpyOsrdyWpiV/OwNy/qzG3Mi5b6Bw; 4:xw/Tu01OFktsW6EYK9GV37bZ9lk/Ep7uNRkDdWv+DT2ayeDZd0klteOq4RUITveji3/SjjHG9t6k0L7IdPOWhYMvzYR/800Rhy469I8M9Qoi7yz000RMCkyr1M07sw0pD+bn3Zotj/38reQQz0Zl/RpTyB85hQ20+jb6WxSBoGkgyKY/O33kuTjw2YVfSUS9//yBzdZOhMekwc9k8HkQiSW8yYm3/6xSsawZS25K/bEk9/amfj1jJDK7aojS17IVq8Us2HroifnblliFCa1VbnTug7y660UcCQsCZMbsTP9oZjl8PDqlB38bQ5oR2LWT X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231221)(944501300)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123558120)(6072148)(201708071742011); SRVR:BN6PR12MB1505; BCL:0; PCL:0; RULEID:; SRVR:BN6PR12MB1505; X-Forefront-PRVS: 06167FAD59 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(39380400002)(39860400002)(346002)(376002)(366004)(199004)(189003)(97736004)(105586002)(2361001)(2351001)(72206003)(48376002)(4326008)(50226002)(76176011)(59450400001)(8676002)(26005)(316002)(8936002)(53936002)(106356001)(16586007)(186003)(7696005)(51416003)(16526019)(52116002)(386003)(81166006)(81156014)(8656006)(25786009)(575784001)(66066001)(68736007)(86362001)(47776003)(6486002)(5660300001)(6666003)(7736002)(53416004)(6116002)(305945005)(3846002)(478600001)(2950100002)(36756003)(6916009)(2906002)(50466002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR12MB1505; H:wallaby-smavila.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR12MB1505; 23:NzURz2g4KsOoOrsTwCT0q06FWvnlnuTV2mMFbfy6v?= =?us-ascii?Q?U5SX6QaYm2/fDbsI2Taf77Dbr22enFSGyYtTLU6QrBiAscbeaSJiz29wycVT?= =?us-ascii?Q?9hl4XAYWnVbT3vsxgiwfs8zP+RaGNYTMZqZHCs/GKt1n6/CZVpsyWtHnM/lb?= =?us-ascii?Q?3qlAq+WMc8hdJpbnZ6d7S3NTIg3sv/twv+9swuqXQNw+zEHP9Yn5NRrEGVUB?= =?us-ascii?Q?lr9lBp4jtszZRSTmN8aHH6V+wSNvqoiF1+jQ9SvuMG/LsQDCZot+Fl9BY2AH?= =?us-ascii?Q?f9g6veOAPleefHzaCJUrQFVEeXLmXG/Jq1/FndUPaqsJ6qf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kpLQ3+4jwzSoCcC4bhJ9u0Rk7jUGGF2mmiD1jrRXHG1MqkGkyuRJRAqzaKIJCL81kc87Papdh3o4UqusiQOhiqwP4SeaVHBNoOznTgrfAjs2fENgJWAq8baL2zsBVRqoXZgiRhFfrzNj9Z6n SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1505; 20:YBQZad540WCt6RWTl6AwlthmqIgWPFA2m4CZk2f+SiVEJB4aSmGiTgwrwzVYmQlBvzRG7jwCqTRibS1yyVcVTO4Ftt66w3P6eBPe982Wa1+Bx0zSYk3kBDLGQGn3ESyWvYg2hCpNiHH0MdGiZQZwtuT2qQLS4Apnab5Gvcx3S4GwSTDhHHWckK9T98OcBRlqlIEWrd3Vafsh2gMW78+RYTE+ZvCo6FoE/Bfqkiz70+i+WFL54QbW2w1nZAyTjN8D X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Mar 2018 12:24:20.5323 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5941251d-8866-4785-8887-08d58d945842 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1505 Subject: [dpdk-dev] [PATCH v5 03/19] crypto/ccp: support basic pmd ops 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: Mon, 19 Mar 2018 12:24:23 -0000 Signed-off-by: Ravi Kumar --- drivers/crypto/ccp/ccp_dev.c | 9 ++++++ drivers/crypto/ccp/ccp_dev.h | 9 ++++++ drivers/crypto/ccp/ccp_pmd_ops.c | 61 +++++++++++++++++++++++++++++++++--- drivers/crypto/ccp/ccp_pmd_private.h | 43 +++++++++++++++++++++++++ 4 files changed, 117 insertions(+), 5 deletions(-) diff --git a/drivers/crypto/ccp/ccp_dev.c b/drivers/crypto/ccp/ccp_dev.c index 42cff75..546f0a7 100644 --- a/drivers/crypto/ccp/ccp_dev.c +++ b/drivers/crypto/ccp/ccp_dev.c @@ -26,6 +26,15 @@ struct ccp_list ccp_list = TAILQ_HEAD_INITIALIZER(ccp_list); static int ccp_dev_id; +int +ccp_dev_start(struct rte_cryptodev *dev) +{ + struct ccp_private *priv = dev->data->dev_private; + + priv->last_dev = TAILQ_FIRST(&ccp_list); + return 0; +} + static const struct rte_memzone * ccp_queue_dma_zone_reserve(const char *queue_name, uint32_t queue_size, diff --git a/drivers/crypto/ccp/ccp_dev.h b/drivers/crypto/ccp/ccp_dev.h index f594e91..c360fe0 100644 --- a/drivers/crypto/ccp/ccp_dev.h +++ b/drivers/crypto/ccp/ccp_dev.h @@ -78,6 +78,10 @@ #define LSB_ITEM_SIZE 32 #define SLSB_MAP_SIZE (MAX_LSB_CNT * LSB_SIZE) +/* General CCP Defines */ + +#define CCP_SB_BYTES 32 + /* bitmap */ enum { BITS_PER_WORD = sizeof(unsigned long) * CHAR_BIT @@ -273,6 +277,11 @@ high32_value(unsigned long addr) return ((uint64_t)addr >> 32) & 0x00000ffff; } +/* + * Start CCP device + */ +int ccp_dev_start(struct rte_cryptodev *dev); + /** * Detect ccp platform and initialize all ccp devices * diff --git a/drivers/crypto/ccp/ccp_pmd_ops.c b/drivers/crypto/ccp/ccp_pmd_ops.c index 099eb21..99b8ca5 100644 --- a/drivers/crypto/ccp/ccp_pmd_ops.c +++ b/drivers/crypto/ccp/ccp_pmd_ops.c @@ -2,18 +2,69 @@ * Copyright(c) 2018 Advanced Micro Devices, Inc. All rights reserved. */ +#include + +#include #include +#include + +#include "ccp_pmd_private.h" +#include "ccp_dev.h" + +static const struct rte_cryptodev_capabilities ccp_pmd_capabilities[] = { + RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST() +}; + +static int +ccp_pmd_config(struct rte_cryptodev *dev __rte_unused, + struct rte_cryptodev_config *config __rte_unused) +{ + return 0; +} + +static int +ccp_pmd_start(struct rte_cryptodev *dev) +{ + return ccp_dev_start(dev); +} + +static void +ccp_pmd_stop(struct rte_cryptodev *dev __rte_unused) +{ + +} + +static int +ccp_pmd_close(struct rte_cryptodev *dev __rte_unused) +{ + return 0; +} + +static void +ccp_pmd_info_get(struct rte_cryptodev *dev, + struct rte_cryptodev_info *dev_info) +{ + struct ccp_private *internals = dev->data->dev_private; + + if (dev_info != NULL) { + dev_info->driver_id = dev->driver_id; + dev_info->feature_flags = dev->feature_flags; + dev_info->capabilities = ccp_pmd_capabilities; + dev_info->max_nb_queue_pairs = internals->max_nb_qpairs; + dev_info->sym.max_nb_sessions = internals->max_nb_sessions; + } +} struct rte_cryptodev_ops ccp_ops = { - .dev_configure = NULL, - .dev_start = NULL, - .dev_stop = NULL, - .dev_close = NULL, + .dev_configure = ccp_pmd_config, + .dev_start = ccp_pmd_start, + .dev_stop = ccp_pmd_stop, + .dev_close = ccp_pmd_close, .stats_get = NULL, .stats_reset = NULL, - .dev_infos_get = NULL, + .dev_infos_get = ccp_pmd_info_get, .queue_pair_setup = NULL, .queue_pair_release = NULL, diff --git a/drivers/crypto/ccp/ccp_pmd_private.h b/drivers/crypto/ccp/ccp_pmd_private.h index 0da9b92..47c4fb2 100644 --- a/drivers/crypto/ccp/ccp_pmd_private.h +++ b/drivers/crypto/ccp/ccp_pmd_private.h @@ -34,13 +34,56 @@ #define CCP_NB_MAX_DESCRIPTORS 1024 #define CCP_MAX_BURST 64 +#include "ccp_dev.h" + /* private data structure for each CCP crypto device */ struct ccp_private { unsigned int max_nb_qpairs; /**< Max number of queue pairs */ unsigned int max_nb_sessions; /**< Max number of sessions */ uint8_t crypto_num_dev; /**< Number of working crypto devices */ + struct ccp_device *last_dev; /**< Last working crypto device */ }; +/* CCP batch info */ +struct ccp_batch_info { + struct rte_crypto_op *op[CCP_MAX_BURST]; + /**< optable populated at enque time from app*/ + int op_idx; + struct ccp_queue *cmd_q; + uint16_t opcnt; + /**< no. of crypto ops in batch*/ + int desccnt; + /**< no. of ccp queue descriptors*/ + uint32_t head_offset; + /**< ccp queue head tail offsets time of enqueue*/ + uint32_t tail_offset; + uint8_t lsb_buf[CCP_SB_BYTES * CCP_MAX_BURST]; + phys_addr_t lsb_buf_phys; + /**< LSB intermediate buf for passthru */ + int lsb_buf_idx; +} __rte_cache_aligned; + +/**< CCP crypto queue pair */ +struct ccp_qp { + uint16_t id; + /**< Queue Pair Identifier */ + char name[RTE_CRYPTODEV_NAME_MAX_LEN]; + /**< Unique Queue Pair Name */ + struct rte_ring *processed_pkts; + /**< Ring for placing process packets */ + struct rte_mempool *sess_mp; + /**< Session Mempool */ + struct rte_mempool *batch_mp; + /**< Session Mempool for batch info */ + struct rte_cryptodev_stats qp_stats; + /**< Queue pair statistics */ + struct ccp_batch_info *b_info; + /**< Store ops pulled out of queue */ + struct rte_cryptodev *dev; + /**< rte crypto device to which this qp belongs */ +} __rte_cache_aligned; + + /**< device specific operations function pointer structure */ extern struct rte_cryptodev_ops *ccp_pmd_ops; -- 2.7.4