From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0068.outbound.protection.outlook.com [104.47.42.68]) by dpdk.org (Postfix) with ESMTP id 674521EAA5 for ; Thu, 14 Jun 2018 05:14:00 +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=zlCHSVBDQTydOveqfwsnIGuqcaFQm9Gpo3kz3hOylzQ=; b=jUdJLo8HjnT/GjoGtwIUUSqZEoSW+JCIJoMqXTSMaC8MpNPlZUZSrpkSmkT2HEv4esN+Xm4V4vsnDJsEZQXdTQCtotkhubASMITP9pUKTnNFlFv0jWqWl0TKPgmNK+xIvYnF8bYno6e2UZLfzOSnkYOhoL692bOrdSs8utM2C+w= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.JacobKollanukkaran@cavium.com; Received: from jerin (223.226.32.255) by CY1PR07MB2521.namprd07.prod.outlook.com (2a01:111:e400:c636::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.841.17; Thu, 14 Jun 2018 03:13:53 +0000 Date: Thu, 14 Jun 2018 08:43:37 +0530 From: Jerin Jacob To: Anoob Joseph Cc: Akhil Goyal , Pablo de Lara , Thomas Monjalon , Nithin Dabilpuram , Ankur Dwivedi , Murthy NSSR , Narayana Prasad , Ragothaman Jayaraman , Srisivasubramanian Srinivasan , dev@dpdk.org Message-ID: <20180614031336.GC16602@jerin> References: <1528476325-15585-1-git-send-email-anoob.joseph@caviumnetworks.com> <1528476325-15585-4-git-send-email-anoob.joseph@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1528476325-15585-4-git-send-email-anoob.joseph@caviumnetworks.com> User-Agent: Mutt/1.10.0 (2018-05-17) X-Originating-IP: [223.226.32.255] X-ClientProxiedBy: MA1PR01CA0075.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00::15) To CY1PR07MB2521.namprd07.prod.outlook.com (2a01:111:e400:c636::12) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a7f6d348-7206-4d02-5625-08d5d1a4de20 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(711020)(2017052603328)(7153060)(7193020); SRVR:CY1PR07MB2521; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2521; 3:c/64rlqTKJGcE7HL/b0BsRhltstsq7XdELJCFJJzQGMPDmwD8gl8rOzAO57+J2F9N1hutcg0yTmrugbU7cYHD8U34Ug0lHgFofmneiXirWTGphKMWtcxP/Mu6LH6y2Gx+rCaQ8G6Nvit1KBMKAY2lojWbBOGG0qxO8QVtNMro2kDswTFV+xzfCyHAprICpqXq6S2EaXB7lK1+tTYenFaGfe3702bSQ2ye6NhpxCGKvbZS90b+R36O4DVgpP4IAIb; 25:O8ePiUSEXRFAcg5txfKGyM92iR/b2c2qPxh0cHQgyawEbcT0yGaF2Y5W79cnoBZSg1+LuS6lOkmLUFaULMR4UHxHFA5OZifq6AVRDcf/6Kw9dH++/4xIJmS9c+LjlnIGv7x0ExR4mvBllQk6G2R3by6ooV51GJ1ednfZz3yedhPuiM2fBYlCjIcKHSgJ/K3s4LZRozV44ubLhyQh3oM12fy93AJ9GEphjhagDsqcSWcOuAvTygwo7KYCgFNjqMJMUY6KOTcS7X9ddh/O/Vcaayhl1Rk2/4lmXy2oHTnQ2R3dPmlMQ97t/3kYjG+Rsi3y5BzITFAOQpfFGvZuj++c7g==; 31:saj4Ro+3kr4Pc+D4+ChKpECSPnPpff01A2MU77RCNhCBGWmafKUPttyGmIfZIm/4LePyTrZwvlJ4BwslYzK20CKXhfmUYGYoUcLe/9JXfByLmcrBbdTJVlL6vSdANbUMgytYQ8FPOKgiWyCINb9cIKdmUpqchK2/LFsxnN5X44bmurEnhIucBNctK04vynOtJepxuWsTfDP56txWzA1gSrbhhDxrvcS7fu0Zoh9Gh+4= X-MS-TrafficTypeDiagnostic: CY1PR07MB2521: X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2521; 20:ZKw0uCagHz27ji/KyOEHIY7kk7cWjXQELhUj1wVy55IOyUX+u4SdHNyr8f2ifK68ax/rCMeW4qt9hccCYLE+yPfEqSi4Jczd1NoSvU6lduMDjc5jKPJi5MFpw8h9xLtNNZpEMViraBQpso3/GykbFusb0pZnr3JAsgb6ZqCVaostVwwpqrswUqBrhpQDtpIiaMK4iqs+cDmQjAkXrhmEAyO829WOsVtH7rw+bkB0vaAsmo8s1WoJz3o6QiulsuQn+vCmA6oalP+Yh1ebU5JvkQqLaLpUsdeqIT0aeEVOCCIcYDibXIVGm+4MPaMEbiok1wurbUXevi0Tcr5AkM6eZpa6kyI6odU4qSD7UNeZ8pMDAjYOhW83OWzEx5bhTNOQfESUDbNOr+SYLZeNp7yk/4e4GV8ika6YS5V/LDgdrlRTws8YsKe0fepDwbf9sYRjC3XQjuFtKO3UKZeBBORCKRF23hjPXoHrLxLjmoqNnM92cP+35Y5Tl46LDIh0WXu3JqNKDkuN5HOLN5zYZHyp0WYz3G/o6CAFJpYA7qa51pStHXdNJZj9JSXUJzxIBNy6VxJ/Y748y0nUszvpt1v9Gx4tkCOMnzGy3n7OtfBms/g= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(228905959029699); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231254)(944501410)(52105095)(10201501046)(3002001)(93006095)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:CY1PR07MB2521; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2521; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2521; 4:9+XxOJ+nGzQg+oMTyJCgoVbPfoKv5Z7YbXuOozyzgr8FysTNrDr9ec4wj9aUGTwrjDdRjcTGQN4OAmhGQBppz8L+i0hmG1ArpD/C7AzDU/ZTGnctCyCct1ezp4DDb6vpEIe7kZIxSek13Fi4Ud6TCNlSWPtSXPVEhS2qdEHjmbMjdXpszDHFDn4UCxsf/MfsTCbDDck1B8fhng7/WVohmZmdh7ymcwi2dOH81b82CxuQVGkKSeX9O2PJaSd1Lnu754mHo6OjRdoZeOovxRyl0Q2XXMl26vGsOQgC+wQCdyzm3LktvF2DRQ2pStyta2FTaYWMLXGic+PQtgvO934uYxFNtlGHz2ZLeIU7FEz3ZAE= X-Forefront-PRVS: 0703B549E4 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(39380400002)(39860400002)(366004)(376002)(346002)(13464003)(189003)(199004)(26005)(229853002)(3846002)(11346002)(33896004)(59450400001)(386003)(6116002)(1076002)(25786009)(76176011)(106356001)(6496006)(486006)(44832011)(2906002)(52116002)(33656002)(956004)(66066001)(446003)(105586002)(8936002)(50466002)(476003)(47776003)(42882007)(305945005)(23726003)(33716001)(6666003)(316002)(68736007)(6636002)(5660300001)(8676002)(9686003)(6246003)(7736002)(53936002)(8656006)(4326008)(81156014)(16526019)(16586007)(6862004)(81166006)(478600001)(55016002)(54906003)(58126008)(72206003)(97736004)(18370500001)(7756004); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR07MB2521; H:jerin; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR07MB2521; 23:fa/WH4HvxKYSt18hvtMSYsuU06h9z5gU3GdEgMLgN?= =?us-ascii?Q?v/qXr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+EBcZ6wpna/fjVg/JYk6iKYUKk0kjTAhOaieVh4nPuhSAAPxkXBMWtR7WN7CmnLCvYrebEfi4olVDmjDm1wuYisCf243YNjtqFcveszLyvpWBS46BFwB26Q/XGkOq3ipgL3tMZt9gT4eqQqUL5VGp0VSAEerRdiTUq6Xvg2CoxaRP1Ia2zN+XCXh8ZISX1wMlrp7weufFpfHPViMqx8sheZlouAg9HSpFkfUynEVsyRBq6Y8hnxwnsx+Kz+2W8aI/bZQe90qlkp4OjWv0GLNbU+r4YMEtnQ==; 5:D9+5HmKEcNyHc4ffrxKKVrOQCafxlswMzlwMr0OtfM3+N2GcuqcUNS5DsoX4f6v1kocB99IqgJv2ps6EU8RJ/BjHs0B/TS/KzNX698xPUDJPFne2SJUtt5Q9tuVxLX3i4uLomYnCab70Te2lCbKLaNFXhN60pdkddfU/oKevgOk=; 24:oqBvXJf7177u4qFKwlrrzPk0tXq7/4OFjsj07qAiM0pOz33vpt5uo63F6XA8q37aai89DqqKnbWWuYaLY9uVDt2iZI97Ro67JNrwlupDwJc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2521; 7:sgTYJQfNVrdSQRTWn+6ZrbDSQqoLbMiaa+5f7tOmGCPFoI47Z4AkvnabAaQhWMBFDmwkhg5ZiMHrAXaxPdUd+7XQ8B7REL9TAAkroSR7/eLGLodYhlnol/cvxRmTI3/NtIRsg9hc2GqPJDGNNLLjRr9m8SMzFzn38kHpYROmshsBsJEoLmjB8JEOBG5dEbKqb5X0NpCWbvBqK+7aIMblUiw6PTfxh+kCKdB0vwE98aJCMbnpMbYYXVahPXkaLhdC X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2018 03:13:53.3531 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a7f6d348-7206-4d02-5625-08d5d1a4de20 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2521 Subject: Re: [dpdk-dev] [PATCH 03/16] crypto/cpt/base: add hardware initialization API for CPT 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: Thu, 14 Jun 2018 03:14:01 -0000 -----Original Message----- > Date: Fri, 8 Jun 2018 22:15:12 +0530 > From: Anoob Joseph > To: Akhil Goyal , Pablo de Lara > , Thomas Monjalon > Cc: Nithin Dabilpuram , Ankur Dwivedi > , Jerin Jacob , > Murthy NSSR , Narayana Prasad > , Ragothaman Jayaraman > , Srisivasubramanian Srinivasan > , dev@dpdk.org > Subject: [PATCH 03/16] crypto/cpt/base: add hardware initialization API for > CPT > X-Mailer: git-send-email 2.7.4 > > From: Nithin Dabilpuram > > Adds hardware device initialization specific api for Cavium CPT device. > > Signed-off-by: Ankur Dwivedi > Signed-off-by: Murthy NSSR > Signed-off-by: Nithin Dabilpuram > Signed-off-by: Ragothaman Jayaraman > Signed-off-by: Srisivasubramanian Srinivasan > --- > drivers/crypto/cpt/base/cpt8xxx_device.c | 200 ++++++++++++++++ > drivers/crypto/cpt/base/cpt8xxx_device.h | 85 +++++++ > drivers/crypto/cpt/base/cpt_debug.h | 231 +++++++++++++++++++ > drivers/crypto/cpt/base/cpt_device.c | 383 +++++++++++++++++++++++++++++++ > drivers/crypto/cpt/base/cpt_device.h | 162 +++++++++++++ > drivers/crypto/cpt/base/cpt_vf_mbox.c | 176 ++++++++++++++ > drivers/crypto/cpt/base/cpt_vf_mbox.h | 60 +++++ > 7 files changed, 1297 insertions(+) > create mode 100644 drivers/crypto/cpt/base/cpt8xxx_device.c > create mode 100644 drivers/crypto/cpt/base/cpt8xxx_device.h > create mode 100644 drivers/crypto/cpt/base/cpt_debug.h > create mode 100644 drivers/crypto/cpt/base/cpt_device.c > create mode 100644 drivers/crypto/cpt/base/cpt_device.h > create mode 100644 drivers/crypto/cpt/base/cpt_vf_mbox.c > create mode 100644 drivers/crypto/cpt/base/cpt_vf_mbox.h > > +#include > +#include "cpt_request_mgr.h" > +#include > + > +#ifdef CPT_DEBUG Remove CPT_DEBUG. No harming in compiling these definitions either case. It will avoid the chance of build breakage. > +static inline void * > +os_iova2va(phys_addr_t physaddr) > +{ > + return rte_mem_iova2virt(physaddr); > +} > + > +static inline void __cpt_dump_buffer(const char *prefix_str, > + void *buf, size_t len, int rowsize) > +{ > + size_t i = 0; > + unsigned char *ptr = (unsigned char *)buf; > + > + PRINT("\n%s[%p]", prefix_str, buf); Something cpt_log() makes more sense than PRINT > + PRINT("\n%.8lx: ", i); > + > + if (buf == NULL) { > + PRINT("\n!!!NULL ptr\n"); > + abort(); > + } > + > + for (i = 0; i < len; i++) { > + if (i && !(i % rowsize)) > + PRINT("\n%.8lx: ", i); > + PRINT("%02x ", ptr[i]); > + } > + PRINT("\n\n"); > +} > + > +static inline void cpt_dump_buffer(const char *prefix_str, > + void *buf, size_t len) > +{ > + __cpt_dump_buffer(prefix_str, buf, len, 8); > +} > + > +#define cpt_fn_trace(fmt, ...) \ > + do { \ > + if (msg_req_trace(debug)) \ > + cpt_info(fmt, ##__VA_ARGS__); \ > + } while (0) > + > +static inline void dump_cpt_request_info(struct cpt_request_info *req, > + cpt_inst_s_t *inst) > +{ > + vq_cmd_word0_t vq_cmd_w0; > + vq_cmd_word3_t vq_cmd_w3; > + uint16_t opcode, param1, param2, dlen; > + > + vq_cmd_w0.u64 = be64toh(inst->s.ei0); > + opcode = be16toh(vq_cmd_w0.s.opcode); > + param1 = be16toh(vq_cmd_w0.s.param1); > + param2 = be16toh(vq_cmd_w0.s.param2); > + dlen = be16toh(vq_cmd_w0.s.dlen); > + vq_cmd_w3.u64 = inst->s.ei3; > + > + PRINT("\ncpt Request Info...\n"); > + PRINT("\tdma_mode: %u\n", req->dma_mode); > + PRINT("\tis_se : %u\n", req->se_req); > + PRINT("\tgrp : 0\n"); > + > + PRINT("\nRequest Info...\n"); > + PRINT("\topcode: 0x%0x\n", opcode); > + PRINT("\tparam1: 0x%0x\n", param1); > + PRINT("\tparam2: 0x%0x\n", param2); > + PRINT("\tdlen: %u\n", dlen); > + PRINT("\tctx_handle vaddr %p, dma 0x%lx\n", > + os_iova2va((uint64_t)vq_cmd_w3.s.cptr), > + (uint64_t)vq_cmd_w3.s.cptr); > +} > + > + list_ptr[i*4+0].dma_addr = be64toh(sg_ptr->ptr[0]); > + list_ptr[i*4+1].dma_addr = be64toh(sg_ptr->ptr[1]); > + list_ptr[i*4+2].dma_addr = be64toh(sg_ptr->ptr[2]); > + list_ptr[i*4+3].dma_addr = be64toh(sg_ptr->ptr[3]); use dpdk primitives for be64toh if possible. > + > + list_ptr[i*4+0].vaddr = > + os_iova2va(list_ptr[i*4+0].dma_addr); > + list_ptr[i*4+1].vaddr = > + os_iova2va(list_ptr[i*4+1].dma_addr); > + list_ptr[i*4+2].vaddr = > + os_iova2va(list_ptr[i*4+2].dma_addr); > + list_ptr[i*4+3].vaddr = > + os_iova2va(list_ptr[i*4+3].dma_addr); > + sg_ptr++; > + } > + components = list_cnt % 4; > + > + switch (components) { > + case 3: > + list_ptr[i*4+2].size = be16toh(sg_ptr->u.s.len[2]); > + list_ptr[i*4+2].dma_addr = be64toh(sg_ptr->ptr[2]); > + list_ptr[i*4+2].vaddr = > + os_iova2va(list_ptr[i*4+2].dma_addr); > + /* fall through */ > + case 2: > + list_ptr[i*4+1].size = be16toh(sg_ptr->u.s.len[1]); > + list_ptr[i*4+1].dma_addr = be64toh(sg_ptr->ptr[1]); > + list_ptr[i*4+1].vaddr = > + os_iova2va(list_ptr[i*4+1].dma_addr); > + /* fall through */ > + case 1: > + list_ptr[i*4+0].size = be16toh(sg_ptr->u.s.len[0]); > + list_ptr[i*4+0].dma_addr = be64toh(sg_ptr->ptr[0]); > + list_ptr[i*4+0].vaddr = > + os_iova2va(list_ptr[i*4+0].dma_addr); > + break; > + default: > + break; > + } > + > + for (i = 0; i < list_cnt; i++) { > + snprintf(suffix, sizeof(suffix), > + "%s[%d]: vaddr %p, dma 0x%lx len %u: ", > + list, i, list_ptr[i].vaddr, > + list_ptr[i].dma_addr, > + list_ptr[i].size); > + if (data) > + cpt_dump_buffer(suffix, > + list_ptr[i].vaddr, > + list_ptr[i].size); > + else > + PRINT("%s\n", suffix); > + } > + } else { > + PRINT("%s: Direct Mode\n", header); > + > + if (glist) { > + snprintf(suffix, sizeof(suffix), > + "DPTR: vaddr %p, dma 0x%lx len %u: ", > + os_iova2va(inst->s.ei1), > + inst->s.ei1, dlen); > + if (data) > + cpt_dump_buffer(suffix, > + os_iova2va(inst->s.ei1), > + dlen); > + else > + PRINT("%s\n", suffix); > + } else { > + snprintf(suffix, sizeof(suffix), > + "RPTR: vaddr %p, dma 0x%lx len %u+..: ", > + os_iova2va(inst->s.ei2), > + inst->s.ei2, dlen); > + /* > + * In direct mode, we don't have rlen > + * to dump exactly, so dump dlen + 32 > + */ > + if (data) > + cpt_dump_buffer(suffix, > + os_iova2va(inst->s.ei2), > + dlen + 32); > + else > + PRINT("%s\n", suffix); > + } > + } > +} > + > + > +#else > + > + > +int cptvf_deinit_device(struct cpt_vf *dev) > +{ > + struct cpt_vf *cptvf = (struct cpt_vf *)dev; > + > + /* Do misc work one last time */ > + cptvf_poll_misc(cptvf); > + > + /* TODO anything else ?? */ Remove unclear TODOs > + > + return 0; > +} > + > +int cptvf_init_device(struct cpt_vf *cptvf, > + void *pdev, > + void *reg_base, > + char *name, > + uint32_t flags) > +{ > + (void) flags; RTE_SET_USED > + > + memset(cptvf, 0, sizeof(struct cpt_vf)); > + > + /* Bar0 base address */ > + cptvf->reg_base = reg_base; > + strncpy(cptvf->dev_name, name, 32); > + > + cptvf->nr_queues = 1; > + cptvf->max_queues = 1; > + cptvf->pdev = pdev; > + > + /* To clear if there are any pending mbox msgs */ > + cptvf_poll_misc(cptvf); > + > + if (cpt_vf_init(cptvf)) { > + PMD_DRV_LOG(ERR, "Failed to initialize CPT VF device\n"); > + return -1; > + } > + > + return 0; > +} > + > + > + uint16_t flags; > + /**< Flags to hold device status bits */ > + uint8_t vfid; > + /**< Device Index (0...CPT_MAX_VQ_NUM */ > + uint8_t vftype; > + /**< VF type of cpt_vf_type_t (SE_TYPE(2) or AE_TYPE(1) */ > + uint8_t vfgrp; > + /**< VF group (0 - 8) */ > + uint8_t node; > + /**< Operating node: Bits (46:44) in BAR0 address */ > + > + /* VF-PF mailbox communication */ > + bool pf_acked; > + bool pf_nacked; > + char dev_name[32]; > +} ____cacheline_aligned_in_smp; Use DPDK primitive if possible. > + > +#define CPT_CSR_REG_BASE(cpt) ((cpt)->reg_base) > +