From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0067.outbound.protection.outlook.com [104.47.42.67]) by dpdk.org (Postfix) with ESMTP id 632ED1B1E0 for ; Wed, 10 Jan 2018 10:43:27 +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=vbdUvLZPQxiiHzRk2/8/EJK5fhTfIvs2+PuK2ins/BE=; b=KN4AmN/RfKj5eY3VRVqNmrkA0ElE/BQbQVc3bXUR/hw+DUItNoNbMV1z8ZVeZIcGtq8rM3x5d1qnOHG6AAQ5d9CnZfjVwKiG8MJ1/jMbuRYVhsl8aBGp7za0DAMW6DHvvKx8bTF4hAkSPBoh2yggipBsxmbG2D5TyUZDzDHfRxo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Ravi1.Kumar@amd.com; Received: from wallaby-smavila.amd.com (202.56.249.162) by CY4PR12MB1509.namprd12.prod.outlook.com (10.172.68.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.386.5; Wed, 10 Jan 2018 09:43:24 +0000 From: Ravi Kumar To: dev@dpdk.org Cc: pablo.de.lara.guarch@intel.com Date: Wed, 10 Jan 2018 04:42:43 -0500 Message-Id: <1515577379-18453-3-git-send-email-Ravi1.kumar@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515577379-18453-1-git-send-email-Ravi1.kumar@amd.com> References: <1515145198-97367-1-git-send-email-Ravi1.kumar@amd.com> <1515577379-18453-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: MAXPR0101CA0024.INDPRD01.PROD.OUTLOOK.COM (10.174.62.34) To CY4PR12MB1509.namprd12.prod.outlook.com (10.172.68.22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: a8d9ee5f-6e98-40bf-d19f-08d5580e9889 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020049)(4652020)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:CY4PR12MB1509; X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1509; 3:xeOZVw+SV07suSH81Bb5rY2Q3uFKrcNqxzaCiVLpDQ7VSSSQIJbEcC2J+/K0FUcLBou+CT0UHA/0AUnbSFbyMzgSmowe+5xQ2ZLSTC7ZkrKsjU4wI7+nN7P6lGX5NT12v7jQK46SaAY5mz8Ompy59QOSHvpmwrilUMmh7aq/oB44m6OoqbrrX64uG0O4s/1efLCmjCx1uFQYH2E2gF+DfKxtod9N10vbVrIoUE7GAkZx0PqWVNPc0V8P1evmlnUx; 25:NIg9VvZywHtfNL58XZlpb1DU4+Pb+xF//KckjWhWlOhynnIzwjYjS9k0GRG8NjnvJ7SNfvzeZoKZr9rxVPvl0Vpd9nNFkhA7VjNTAlVKWPaMOor8dBF9ZAK553c1YsieiY4ME4hvdu/QKPpjI9fIcAW+l/kR7Ir18svmQQNskk1lkLZY3ybEN0Wq7wAoODQ0wXcNCHZgfAlQq/2wia0/DHIEvbz9SX9tqHgmRjSMAWoyVE1N6jNDaBnC1z1YNATOVSdKW3I4Pp963TWIae6TNyU2fAKBuk3NJZY+fqrHZ2Jw2S+qwouVGZdYST+iuIPI49klngd1wjyIXMpFRJx5YA==; 31:WU8WXKSuLrjrrd4mBXv68oYnVEkeN3wnv7A8mXWgi5/4LOE17wWYG/mRR3OLrvXfdpbUJVRmluD71MkwCXmUYvmB2tdpMg0DJy49MK48v8BivD6KzV8af3pOXNb5dmXgu241rJaTvRdeVoGExwYu3YYp8lsJL+Y4qo3jHvXicdxohGiuq0pVO+gEmsuqW9uEPfDKcuad9rFtacBnHD6kxdK0qE3MeZnyqUpvEqiLHWU= X-MS-TrafficTypeDiagnostic: CY4PR12MB1509: X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1509; 20:Ud1mxyKIcRw5XeDaXDqXnAESwMTRBS+mlpgf+82OllnRoF22X+9sgxtDyIDkxN7+rlhNe51OfDPJNFF8cifdq2svblXL8U5Jo9Rj2CtRKdRJgiEziujJmZAL/YR97l0gEd1Ua4hHq5aFNwME2YBDSB7S5CwxFAr7f1Ag02HqBISJozprgK/ZVxQPRv6dK8M80y/uHypD1qMI5sFONQ22mzNvk2EjDTxMXBasiNbcO9hakR32B0H7v/sJK4c6c2tLi/pCR9ZinA4Y3jE39Rfb1WWXriN5oxRRNwr5c2eOyM00hrDpUDp/Oe75Thzi/Y+AOclghqQUXBjTO2W64wsE57ytTSLnPT0JrYN0xqjg17IyVlAlHGQMl0kv6NgOeIBuCuzQNDQFd2/5cPWc8f7UiuEbQuC8L1ixZjRb8+uPACqogaRswvl9o4wOjiQ3W5Adbh8Ei2mrhNzu6QNCRpOlcHPQFqweVhY48WaZtN4woGEZ9tQRTDX3SIRsq1piYXiS; 4:Gq9ZMqJ7/MkwhoVq4BlMOLm0BF+HEZ0dl7iaOScJ7b5FzDjS7xKNEpWsUur8vfJ84usdXr3ViWS6PYlthd/t8moRb7ty0JlJmq49u4+SzLoBfSq4Vvh2AqQ8F/qrXQHVeSrjhVfDUveksAH489QkcwCP4J6z3mHPPj7oxEFIBbXnV9V8gnFI1MmYId/IrpKUZfLgPkb95hR6v9KG1yhisUWc9SO61CA/v34saUdFvFDifo+CP0y1+stOWJvM2VM3d671XuhEYOv+ueVR1kSEla0s7PHXtYfVDELGCt9tulNvkKIRvYgYP8bZMoTsS0w9 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231023)(944501119)(6055026)(6041268)(20161123562045)(20161123558120)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:CY4PR12MB1509; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:CY4PR12MB1509; X-Forefront-PRVS: 0548586081 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(39860400002)(396003)(346002)(376002)(39380400002)(189003)(199004)(25786009)(8676002)(81166006)(47776003)(48376002)(6666003)(2950100002)(81156014)(6916009)(66066001)(50226002)(68736007)(36756003)(8936002)(16586007)(72206003)(50466002)(16526018)(316002)(53936002)(478600001)(5660300001)(86362001)(4326008)(386003)(2361001)(2351001)(6486002)(53416004)(97736004)(51416003)(76176011)(106356001)(105586002)(7736002)(6116002)(3846002)(2906002)(59450400001)(305945005)(7696005)(52116002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR12MB1509; H:wallaby-smavila.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A: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; CY4PR12MB1509; 23:gGoBhssgDERm/reSBz/C9jpNV6lOnDLCCaMqJOguT?= =?us-ascii?Q?vdx0jclLNS3dZ0RBZ7MBGUuoekG5CNIkintzkjMKv/MHc3wiRa+ymWsDnn8q?= =?us-ascii?Q?iellezmSH5TxdnTs4mB99qI9/C/l/LkkcE9pxAGjtaSnc36S4JWLZgLxkJQ7?= =?us-ascii?Q?Z6cpqilkJVkWc5MUKGrnt6ymkbbqNyyN9H53BSw/qCUmd6uIWGCakJa5ch9w?= =?us-ascii?Q?eHe42L4hr+iFIWAqRs3dRuasZkb6GRWTrnh14jpOjJIteP+nAUVRGiFI4hwP?= =?us-ascii?Q?wq4cODF4T0tsEb6RnY2+6REsB0+yg90O1mi4wYTH6S0IxtiEV9LQM3TAtGCi?= =?us-ascii?Q?n7q1lVc6eP1rpxSYx4m80PYMU3FDqXtqVLHfukmewahYqRhe2K/ESJD2TgKs?= =?us-ascii?Q?S+tskWZMii0H5iIF8mK6kiFhKV5fBkLT16uoHE7+vTJ0aB3tIzeEpZLGvMkx?= =?us-ascii?Q?tJX3YFH8Q4lEjQO9wnyTX/KtILER0anc6gKPzsjuE875P6nZTCrv9hfyMAiE?= =?us-ascii?Q?NKeNOHnhGUdHHZP6CEN69RYjLul2TUj2kF5+meEwcf8E3pW93/0TdQBWMNHS?= =?us-ascii?Q?vapEyp3y2kEDXIGrV+HxINQKA8GNh90k+DX6krz4P/5K0plMGoesOdLJ2GdZ?= =?us-ascii?Q?TVr3PBRSG0SEz5Hu+BpjsQBIyolSbwPDzAghZUkMg+oRTBn8QCQsOYnv5LCO?= =?us-ascii?Q?O+ev1dZozFiCozDoLcCNYNp1med/oVTuhocbaflWtdMyuf7i4RO06LQy2Yka?= =?us-ascii?Q?NbfWvcugYftqgcQQct3tl3BSxpwwPwU9DORP8nPb6cvyNy2voL90gEAYOkpy?= =?us-ascii?Q?NXP7XKnTszE7l8N/6YG1rVF0BfTgPPxYh3a/aKREx6ZTxRPirspob4BTy+Vj?= =?us-ascii?Q?wV7cEP/EJC5lviyw+j3grA3jK6pc/HDj1mgPeI2kfQ95JwMTDn9WYGNxdzDV?= =?us-ascii?Q?V/te57Vbq8v85uusmgEjUxXTUo3VkQPXQtWwr+ZX0l4MW9vCtWb1idSIP3eC?= =?us-ascii?Q?R6q0Hal2P5wO35IOzc4TNFRQdJkKawScmKF0ioZleXdAQxOD6bEtR7dA+VHA?= =?us-ascii?Q?MPRBz5kjOa6642++VvujfptA8rJHZMnxEQK8FvjJygZq0V+P73RyKSaHDQLJ?= =?us-ascii?Q?7DkeCFe/kFEq4M7Xz+6J/jPK9izNSl+hP6G6yp3D4WkLUrmqj//bQ=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1509; 6:7q5WxWOHB0g+LQj3W5hoN0fq+dNJ6EmMVMifHfJT++4x1ois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ZdGMOLSudwWowuoUhNEAK274ec8VMY54ME1QUsEZmi4GOojUtlEQDKBB7RqjUTULRcwD/32wxPF0plaFPX0l2BT2O3/T5MtuRkocCRkdLoI X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2018 09:43:24.5529 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a8d9ee5f-6e98-40bf-d19f-08d5580e9889 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1509 Subject: [dpdk-dev] [PATCH v3 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: Wed, 10 Jan 2018 09:43:28 -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..d2283e8 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_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