From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0055.outbound.protection.outlook.com [104.47.32.55]) by dpdk.org (Postfix) with ESMTP id 79D001B01D for ; Fri, 5 Jan 2018 10:40:29 +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=1t8bA5ECv0xlwgoWR4nIxOFaeUiGXgNTNvo6nGkIgWlUEqzkXPJutM/nHh0iMnSoRvVx0sZB4e29UsHYsrh3iSdZaQkir+5QtkiA+AdlehCro08HXyOaWP991e9CnzQeX62d8Wzp82mHAqBzi4ysQ5w5IOiSSu/UKxc8zq1cUY4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Ravi1.Kumar@amd.com; Received: from wallaby-smavila.amd.com (202.56.249.162) by BN6PR12MB1508.namprd12.prod.outlook.com (10.172.24.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.386.5; Fri, 5 Jan 2018 09:40:26 +0000 From: Ravi Kumar To: dev@dpdk.org Cc: pablo.de.lara.guarch@intel.com Date: Fri, 5 Jan 2018 04:39:41 -0500 Message-Id: <1515145198-97367-3-git-send-email-Ravi1.kumar@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515145198-97367-1-git-send-email-Ravi1.kumar@amd.com> References: <1512047553-118101-1-git-send-email-Ravi1.kumar@amd.com> <1515145198-97367-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: PN1PR01CA0084.INDPRD01.PROD.OUTLOOK.COM (10.174.144.152) To BN6PR12MB1508.namprd12.prod.outlook.com (10.172.24.149) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 9e737d47-3747-4f6d-d4d3-08d554205a82 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(48565401081)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:BN6PR12MB1508; X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1508; 3:xc7179lPE1cv8v0/IosfHRokqr/KyWBrJwiD7vsa2WifzYnYr0Dr+Z7JrgE3g3FrRA4KkvHuzreYk5E5W4aXw09MGYuiq9doFo0sNg9d1L90cQ7cvBqTERXVVHvoFQ8DGcbtiSzJrM9LrBzlWSsIdeWcdibObfX3manJPDk+PviBcKkEdd9S5pE1ovkVBzd9GNzvRIb330jfz3yLtHoyRPcbT9Rez9amJyHpYwNlSViZUynApErLcI/sBzh0typg; 25:Zk4hRefUlCuDpzqQjOL1Ee+Pwo1/c9ZvNZlCJ+Hd3yK3v6qCy+4vtUPHBzA4GXr2BPjLByBvwwWA4UDGht/y0bFbAvrhmxRHyBo6d6Q1GWfrsEW6iM64RljhXDTveM0o842xIeMXcZyW0V2tZusqrieZf6Y64vFPxVs5bi25PbAG8UXh1d8NDOJzwCcl7GhOMg9U7sq2iSJsh7K7sGDUrX+MQAyGUgr1OCaHq6IhQCtCfkc/4K3f9zXI+zSUasDY+olIWPzI8ZobcILyXfFRrUron7qlMLz1p4Jx/RD6tdvLc8cuth0U9c1g4kmwzRMcQwHeQoFzvX+X3sdghT5jIg==; 31:kvZWPu/rEzL/e/E7UpXRWnyzyT8I8xgLm9SDLKk4LMePLyyh0Jrdu5Ro4gxQHZLgUqoxIJPo66eFqPZrwbhAeohuCPM70jExLsD6qXUzn43C/vxXuXSO39dAiC5RhAXfKNibRjQ3R6xboSdq9p3GCz+EsarzcHrvJwce70cm3bWQ38JjmppMHdTgGA4GXsscaHFLru6eQAQYyfmFMHBVUexp/g/YSnlwbhfwrZncb+w= X-MS-TrafficTypeDiagnostic: BN6PR12MB1508: X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1508; 20:BLGNesdTnpsqPgSBwEBKEndUBdXvvQ51d4mwI8RvKnoVeuQuSpqdRBYwCE9KuAuc+BLek8d2LI8avCFDv9BJ+j7YmVLDoSTaggLpFfPcjs0uba2jhcbKwTq5HJKjQxaWIp9xHJro3VEWW7lHDzGzX0LeN6+2vT6PnCYqNhZd4G9b1DzqKxE1+VawQQUBL026nAiSXjPQ5E+05AQCuX/hEelL68rKjUUlDNko+SskSsJdV5kCmkDDM2Jwjt5iWbpGK/SC0A6z4Q57r4R169S6nybbeXpZR+3feEINNC1fANZEWdr8EjQ916rwev6b/to4IFWkQtKQoT1jOpTZPNcirdqUt6mPvQbZF9MZ0DS6UTsdl9l9Wd5LyV+djYXQaK2b0AiCOPeSdAbjnCrVn6fqrwxiNljFGZ3PIQWtV+BUPMmI9Jy6s2UpsqZLke1jOS1RCSxysAHJ/34EwDt+3kNu3sZGi/oRQVKGiP8zQXNf6Aek+4JffZ8wjhQg4PNzpuz/; 4:a+2ZoWZjMTw83lByH74avRzhdYzy7iZEPwjKn3KfFC4z7cFb+wam+uX8XgpNaVokPWLE3Lw6J8JWPfFcfc1ihHG/KVm4qgxSARK9RPP4F/UP6MlKr5pT9Z+H25VNJML69CMcpQukejWTF03GDyRguT99w4UUNrVRu7Zj1N16Cfzd6zBcSPFBKro1+0ZOMV3vJV46hKdeRTL3Fbt+c6ji/1osDo/EFa9qSstm5JyLh3afwg0YfH3s7Ph0iXJ5OGjgDCmch2T4UbqZKnVzDx7uecbC646PeNehKQvFUpy7PaUUTeNoUjHSEfmwgyuI0+Mk X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231023)(944501075)(6055026)(6041268)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011); SRVR:BN6PR12MB1508; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:BN6PR12MB1508; X-Forefront-PRVS: 05437568AA X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(39860400002)(366004)(346002)(39380400002)(376002)(199004)(189003)(6486002)(2361001)(6116002)(106356001)(386003)(105586002)(3846002)(6916009)(2950100002)(16586007)(6666003)(16526018)(36756003)(4326008)(2906002)(316002)(97736004)(25786009)(478600001)(86362001)(68736007)(8676002)(48376002)(51416003)(81166006)(2351001)(81156014)(52116002)(8936002)(53936002)(305945005)(50226002)(76176011)(72206003)(50466002)(53416004)(7696005)(47776003)(66066001)(59450400001)(5660300001)(7736002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR12MB1508; 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; BN6PR12MB1508; 23:PFLj4vwa6XbTMi6liOk89rLy2mUUXbS6IzIN9l3+o?= =?us-ascii?Q?YovobeZVWEGwfgn6eTSptgtHUOzvs8pBPMEJelKqVn26irZhVquEj7/z30xb?= =?us-ascii?Q?WOUIj5fHc+A/XOxsdi5qZUlz6SB8woReTwD413WJTYa4w+EYHAGcx/qVRvJy?= =?us-ascii?Q?QO9CXJewv/1pzKuuLfKlVFf7IGw9aoJdwJKKXImWN/iitoliA6e60Qs+enc1?= =?us-ascii?Q?7hOZ07SDAB6LxLIUmcMZyBDB56BfHKBt1DNzsY14KAoOxkRhqL/MMctNcuuH?= =?us-ascii?Q?j4wnO9kwwIj0bWhQA2ZG6LeP5t7KJJvP5jtmmnFC/nihnKGtODV6+ftcZgIs?= =?us-ascii?Q?tbpuDbYrBBpWEURT0FFiByzF/i0y3AED6u6FU7F84KWAhjo11b7GNZ5LwOXa?= =?us-ascii?Q?u3ef0iaDZ71WUk+F9oA6RNHZsymgktf8cbAkMRs/kLxN4aW1Y6UUlae1I7nZ?= =?us-ascii?Q?N09Gi2sA9zfW0HUTHs8mecSg/09O2JqaJB04qctvT+01qfSPgBbjX2PqCEYT?= =?us-ascii?Q?m/fBB4F/a2SXWesqHyxOc6pOLjOSgqWfd4oUZtXBZLV7v2iSP337dVSsPdvx?= =?us-ascii?Q?T4u1y5L8av7JILze5mDfUVoSp0UPmACImezZEJvb/4iqT36tQjtEKOFPnTbV?= =?us-ascii?Q?LLuNIOV4lespGPN65eyQJADh4hzXcKZUOkEYGRXdEvxOhfhHGtH6izYNlYTk?= =?us-ascii?Q?74sZPe8HVjxbPS+Xi/JSuBaGrCpNsjfD9yWoWQREvmpQEJJ2qam84OhsILNu?= =?us-ascii?Q?uwe09vz+EoTTJ7DgnBUkbBprPE28IJwcd92G5qeTdwG2RD4v4TR4ObI2ZHHF?= =?us-ascii?Q?l1Rth+av/6P9Teqpqbxn1pdl/xjfOGw4llygr/agVIi+8DQMjzhM79BSOzTl?= =?us-ascii?Q?8XVe7Q7fQaVf42CJJYmN+FUlldcrbMlBu8y0DdE41Trk2EDtCuST3dnCHiWb?= =?us-ascii?Q?QyqNQVZyp1T3u108LR8IIO/OLpXn54s+kDVOzI2YI9yxjuzBt0EEdDtn8x10?= =?us-ascii?Q?bhomgJRyllPVV9zoxChwsIq3W39aCdxCozzdcgE+AMcK/PozHEickcPRcTSm?= =?us-ascii?Q?/JYySf5MrxKW2AOroGWkRQ2HShknNS5XfgSW2F7Xq+CI8plUMC3TgJDnp87s?= =?us-ascii?Q?y7yVKWrRGymHHY1Xcx2DdCtXwEFirrKVZDLvCU2eYNC5tFi8i0++A=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1508; 6:gB2hMIuJkZlkK7N/u+gO2TYeouz7F7MYi4r9yujsuoyTdjbsTxtiQhTWaWHSbh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viFe+7uxcjcEqU86PCe2LvCdISNwWd2fmIZ4CQ+UBCi2aW47Zk48K+2bOBz8EMelN2hTOIa6p4+o43Uj9XGXfzV8o65RqhEhBfEDasLmUJAP X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2018 09:40:26.7783 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9e737d47-3747-4f6d-d4d3-08d554205a82 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1508 Subject: [dpdk-dev] [PATCH v2 03/20] crypto/ccp: add basic pmd ops support for start, stop, config etc 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 Jan 2018 09:40:29 -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