From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0070.outbound.protection.outlook.com [104.47.34.70]) by dpdk.org (Postfix) with ESMTP id 450914CA6 for ; Fri, 9 Mar 2018 09:35:48 +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=rcZl0fWL82Kd9F1pBrbJiNfyNkwKyouVYwpnUI1RsO4=; b=0GhbiaowZEzXwk6odEWe+gjY6bxmw4sSPy8lfAUCxuVJLUYtBjAwqgCGdtv+kjitIxchiyQwn5g4L/VOo8f1KrJQXpBV2kQ5QDsi70U3ybKMWVazvIc1T9vQ7tkRFRUEfd9CcuOaWe8vX7OBM2QWEfnVFZhw/NOaOC1YUEZTA+s= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Ravi1.Kumar@amd.com; Received: from wallaby-smavila.amd.com (202.56.249.162) by MWHPR12MB1518.namprd12.prod.outlook.com (2603:10b6:301:b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.548.14; Fri, 9 Mar 2018 08:35:45 +0000 From: Ravi Kumar To: dev@dpdk.org Cc: pablo.de.lara.guarch@intel.com Date: Fri, 9 Mar 2018 03:35:03 -0500 Message-Id: <1520584520-130522-3-git-send-email-Ravi1.kumar@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520584520-130522-1-git-send-email-Ravi1.kumar@amd.com> References: <1515577379-18453-1-git-send-email-Ravi1.kumar@amd.com> <1520584520-130522-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: MA1PR0101CA0050.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:20::12) To MWHPR12MB1518.namprd12.prod.outlook.com (2603:10b6:301:b::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 9ce7ca61-ff06-4f46-85d3-08d58598c0e9 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:MWHPR12MB1518; X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1518; 3:oE7x8mCv43M+A5HdCiNQUt5f4dcI6lmRzYGIiLJzR6zt3PERV9S/caeI0QvX8uFmWS4X4ocsr4LDaB4iXdQt9YXrwxsGfe2hH6na3OIbHUbILDBB2YlIBrIAphK1g79gGJ4noKLY2ZK/mZWch+Kjy+j0ZVvkuwHHI7xG0IM1gzjbrqvr7voAr+X02Mc/f6PwbZVX2cewfqyyIMcVpHYkzOXEzlpAELIxX6U9e8PhNbUSlfwAWyDlHrQJzHAeJ1JO; 25:4fv5Ebf/ptg1z/+vmx6Rvg99S6CJHx929KhMFO0DDNnN8Whe9xgJ0rD+6t3WxzTUeiQQIjXWfbpgSSS2/NElktLqwfokYO3MS5YDaQ0WvI/Il5LNBPorzLu394A36WttCNuFYpeYzjEQcTmvuTK+kV3RzNwVoDKY/jUDCZVve7eD5vNK2VvDbD2kQtc2/SUnPxwH8cJ1iBC0mE+9coyf5bQtJRkvQsdAFPHit6rlCInmNp42t6jfn6GkFZH/8hfODoTCIDFeeJSe1jiP46j6hvg3qRjP2zK/9N8XndW/1c+dOkSBroKIDRnC6ceLN2RzaTLbr8rf3HWloN8x1BiL+w==; 31:CyvIbowrdcH5iywhcamDXzUvGkzuXUcvM6UJFs/eRc9PpipqBadJqI/fD5qABVoBPiGfOL2CmMpiyfZVvFNQHr5Eb6pb/CDJWHeq5zR5KdtdFBgU30PIERUG6cjvQ08K1g+7dlQJ9QT22UV0iiuQ0V8PcSCP82JVdw8Vnb+SdDKAeRvjK8XwHR8q+8bJx9CPLY7F4PaRSCmSu5G+ccdfpsdk4yubPfonIs1lhFjqKu0= X-MS-TrafficTypeDiagnostic: MWHPR12MB1518: X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1518; 20:iDXkS/bM/39TyRUTAdWUr9I18IuZQloX9RF5OTMMjBOfCU4aNrbl19pQm7o3XAn8yY9L0MtUD6AAuXe9M2w34Q+NVkhpk55NehEYB7KOYh3ZBtTlKL3MnZ/n9fq8l197uvgI6fWvZSZAYY8JLISwY5n8BIi6QjdCghu0VnkXoHrfcWlVetzkHEIvDFvvgx1lKtdjUZWlziSlMfbVYIGQRbkxN/Zb/RQCdpBucGP/p+sdlqIM0owSsS/oDPDyn4KsFXexpMlzcg15YkmvA5C8Qr4PToylzNsW4CNJsxa+HPuCR14FlbxLdqdb0eAZps7GkOCNbxsFax29gYPnn8JQgr/xfC6FQ6vVrv3HfzPaKkZxDBcPTrvazATMPm13fuxzkHhqhwqxHupmvF59nenyJ0ZTCUfxkp9hvUcpdGV4QGgrTQnkGG5VN26p37IwAu4ZGWm9pbCW5CqPyluspYD89RkTFk9VKElNOG6YpHQtlskLvg9cihyB7Y1gE6FcLzlq; 4:DmFLutceDrIqDsT6Q9lyjrW6963dEXwlrfBJMjIiI80es0Lq3lhzKhIk7FZdOlUMxZgaMLS9jW9sk5vVnFUjp2js+7M0lpGLAglyPNZz1bWjZU7izMgaQ81dRoGbBIQn2ClLggDv87tXPUOmo6DcApo9JRsboWTQLuRF39NEzjOYuJN4b9oE+BgSNdJG2T8aAeUyOtBJ+6g/YdFQCmoN/BY1UrTZg+h1lSud6KfchWO59JmcsWZHgTTWGicDFnEqNld6EY81hddY7YZoWirtIM1tSTvybImmJ43LMl1x0tEXCc6giFOcxSDVwFHkuznN 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)(3002001)(3231220)(944501244)(52105095)(10201501046)(93006095)(93001095)(6055026)(6041310)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:MWHPR12MB1518; BCL:0; PCL:0; RULEID:; SRVR:MWHPR12MB1518; X-Forefront-PRVS: 0606BBEB39 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(39380400002)(396003)(366004)(376002)(346002)(199004)(189003)(16586007)(26005)(81156014)(16526019)(8676002)(186003)(81166006)(25786009)(7736002)(3846002)(386003)(305945005)(4326008)(6116002)(6666003)(316002)(86362001)(76176011)(52116002)(8936002)(51416003)(50226002)(5660300001)(2906002)(2950100002)(6916009)(59450400001)(7696005)(36756003)(106356001)(105586002)(6486002)(68736007)(48376002)(97736004)(53416004)(2361001)(2351001)(53936002)(50466002)(478600001)(47776003)(66066001)(72206003); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR12MB1518; 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; MWHPR12MB1518; 23:Nyfr7IJdE4mHNuHx/JB1skD73vPkny3Ur2BJKSwhD?= =?us-ascii?Q?V3MMmQ8fEe0rqzmtM1JvZH5U+TD4L/c2Ix1h602Xhi4vC4SpiopheL0EiwUA?= =?us-ascii?Q?Tb5X0ZeT9olF1ftYbEIKhGU9P3dy/ivsp4xfa0272MWGVV5chItMUm0JCt52?= =?us-ascii?Q?AD5hXTes0E2ug6ikkYghjQzNST3e8hiWU66zOOUQKaVa8UP/d/iUIIbP/uUi?= =?us-ascii?Q?96pYVXW4CwodFs/dN0eW4Eg9fww2qv4AfspuREQrcP5wnF7GdgkVZmIx2Z19?= =?us-ascii?Q?MnlR/mu/2puJAiZ3Cb0fcQaIC8X+wCMPJCkH8FRpY2m+C6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JXDePkAkgzzeKu/o6PpOWjUzCs8oydsDpOqQxBj5rd1tW42h7fuw0ZcD8rrdttgPjeqN8 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1518; 20:XCO0TKJ6GpXeFB9GrPbbeZDgdD5PcC8zIacWB4CyhZ8GIKHvpyAbXuKFYRwVRxypXIVnPTKRkgAd3gUc8QNzCNrz0DGxBPdJYUFV0V6q5WbV6ukqSjqpAkf1kyfO5gLY0WbegNfccfTXV4SxYhg11cJh3NRbG20z/GRmQRO/gYTqcpOYGw/HugAQ8pS1cQSn43tosqZSMsThw+cKN0xeL09PhILnG6tFgIMscd74ekqbIBvITOa12e+7LJlMfZOU X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2018 08:35:45.2408 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9ce7ca61-ff06-4f46-85d3-08d58598c0e9 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1518 Subject: [dpdk-dev] [PATCH v4 03/20] 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: Fri, 09 Mar 2018 08:35:48 -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 5af2b49..57bccf4 100644 --- a/drivers/crypto/ccp/ccp_dev.c +++ b/drivers/crypto/ccp/ccp_dev.c @@ -52,6 +52,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 fe05bf0..b321530 100644 --- a/drivers/crypto/ccp/ccp_dev.h +++ b/drivers/crypto/ccp/ccp_dev.h @@ -104,6 +104,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 @@ -299,6 +303,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 bc4120b..b6f8c48 100644 --- a/drivers/crypto/ccp/ccp_pmd_ops.c +++ b/drivers/crypto/ccp/ccp_pmd_ops.c @@ -28,18 +28,69 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#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 f5b6061..d278a8c 100644 --- a/drivers/crypto/ccp/ccp_pmd_private.h +++ b/drivers/crypto/ccp/ccp_pmd_private.h @@ -60,13 +60,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