From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0041.outbound.protection.outlook.com [104.47.34.41]) by dpdk.org (Postfix) with ESMTP id CAD27A69 for ; Sun, 29 Apr 2018 18:23:16 +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; bh=oQHYW9hBP4oUxRBp4bGoH86i3w4u58unDHldB13u1E4=; b=L7ZU7RgIkdBmyFxNQs6EhCF3haH5rCkcnIXUb7CUXqKUOPUEqGIDczMBfp0YZ4P2M7dvl9TPleT4SUp+5pHrFH1KAoMyoVFTOSDIaKHAY92ZrV1Ae8/XaOgB0mjQ7qiKn+c4JRAUXbc6NdnTYJchYV2RSWYFDLTOi38OBc8U3bo= Received: from jerin (116.68.105.116) by CO2PR07MB2518.namprd07.prod.outlook.com (2603:10b6:102:12::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.696.15; Sun, 29 Apr 2018 16:23:10 +0000 Date: Sun, 29 Apr 2018 21:52:53 +0530 From: Jerin Jacob To: Abhinandan Gujjar Cc: hemant.agrawal@nxp.com, akhil.goyal@nxp.com, dev@dpdk.org, narender.vangati@intel.com, nikhil.rao@intel.com, gage.eads@intel.com Message-ID: <20180429162251.GC11546@jerin> References: <1524573807-168522-1-git-send-email-abhinandan.gujjar@intel.com> <1524573807-168522-4-git-send-email-abhinandan.gujjar@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1524573807-168522-4-git-send-email-abhinandan.gujjar@intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Originating-IP: [116.68.105.116] X-ClientProxiedBy: PN1PR0101CA0010.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:e::20) To CO2PR07MB2518.namprd07.prod.outlook.com (2603:10b6:102:12::24) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:CO2PR07MB2518; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2518; 3:m6brfq0CNf5Mh8js87kIl7WTaVO4FnnmZ4Uy5z2JPsaqXOxK5adzy4dUcE3/9mDK04y38OM5kjug+eqVNIi/HJbFNSysZysvEU52meJxIdWGAfQkGnBvoMI6n1+Bw01o4Te2GEzWm88N6Za3q9MdNK+lXN7t3Dtcd7y+kSoRKI70TdMVz0wvVQ/2jD/kLKyZIoezk8AlA+dZAuWT3iGtI9uNjfCpXLIlv3E7eALT2amiymVOXZwYjIurIkwg0Qem; 25:hnLycOxFH9D8i6yd2DC1VrT8bgCxQ8xUdozwgQgDswqcPHP9UGma3AGRHvTKCQbDKGH7mJkm1oO9MHwIa+CyZ8G+lCfMTqVwIsvzV9iAxnK4eFJU4L3mqkPXCNz3z10jo55YHOng7MTKzh0f+j22T+y2YLzgaC9utAxK18LmFvXFjZ0yAHeaX0NRqRlPo/+4Obr5r+E2ePCt+YoHfv01HI45q2IeHYcuH6qRb89wcRZeOLM/na/FOpKqpcLurl96G6BCBSt0Px1X5+RtHCRK7sBZ2MMZJOzy9ORdSIGKwKG5n5h69aoVeBZP4T8rm8/j2xpj6XItmyp6nqcxClpl5A==; 31:bmn6xcZPbSyYE19Svjs6G/2eMCG2p53lLSu2+IcykLzzk7IudIp5Wl3WAaSGYt8lFP2Mj+Nr3oKBYN5yx60DWLId6bGo3wojHtlr8t3EdWMymPxdplD3YIBTRnQ5A9u3Fm0hXl0cBWZ+xGc2TMy+iRlYK2RZYZuwjn+o/E0gJy3OSmIoRFyCqwjiSZMBTo6VkhxF8uz1fO90j80qxNhHz1muAS2lgsNcDQp9SrNqL0s= X-MS-TrafficTypeDiagnostic: CO2PR07MB2518: X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2518; 20:8S5zikFAtmo6NUOjQ6DiFHw+/zAGUN3ynxWzqHUmjMcSi534GNRFEUe3q8i+fg40XTBuHiMhcbZCH29GjMw0CCgYHi4ZBuToX9GxluNYjKt+a+vJbbzZjHZOHsisPxIyvwzW6pq2AMl3qtjdM1R2NBYO+oYcuoOEapxxc1nOH8boHfBIoG0wio1cs9hPT7NBoMhbzUE+5ouGVEnWsMyWF9vE9j8mLlbrjdf6ss89pkkm/IRC1Mmnhh1kVmcNcpczWtFbssT5jxosFnVeLdjuGWsNJI1jzQem1Bm3trGK4MMv0ij4R8EQ0IPVzQeJP2nq2lyXiy4Oll1ePaairJqQ0WeQxBnjy0D+EkwhrqakfjRHYjEAYTctdmy6fwDRS2SHxCL/ilmjOyxdg46mzaQdezK9gFzVwQfOv6gy07whezo52s2EhEPXiHD1AjxJtr1iBhWCAZw1uSd3zwl5co/MZGxOZDuzQUMtMffxQzAki2Vuf3MgS9YGN5zm4DoFSc40zgXvn1SKtKOJAcU5eE1F7ERrraRdwiZCqDCeIjHIkHXP4xN246KANVBeNr3MZ8IaiK78qP/prg4D9UT0tJ6bcBPV1zoi8PVzLrwfoi99f6o= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3002001)(93006095)(3231254)(944501410)(52105095)(6041310)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(6072148)(201708071742011); SRVR:CO2PR07MB2518; BCL:0; PCL:0; RULEID:; SRVR:CO2PR07MB2518; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2518; 4:xgOXi6i82B7XJ08I2WL5DiAjDTtPmS8XQJ0TxEcqYI0UgDfM4KxWl2HpW4fAxMoTy82gXknBy29rr7wz1BPRUndCAfLZHc8Y21ceN2byAG/WnxuiqAOh8twOjEPhYNm+IoxHz35RbORvadGUVDlHBJFQYZ535pg1hjbelJvPpmeTa2503ycqia9QtwXeuOaUVy4yUG79z3DGqQNU8EdvYjMTz0wbD0G8UAU533iv4FBIZhUwxl/UC521jerU4TF61MM5uwN0G7i8gAfDCV8rOQQjgabtusnWzQnrlgucg+r/Ef58TxRx7lVCUR/apKLtqqh26d/5YZxWRY5f1l3Nwq0O6NH/6R6zxUARa40nbgw= X-Forefront-PRVS: 0657D528EC X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(396003)(39380400002)(346002)(39850400004)(366004)(13464003)(199004)(189003)(50466002)(33896004)(55236004)(186003)(386003)(33656002)(33716001)(53936002)(66066001)(956004)(7736002)(4326008)(76176011)(47776003)(16586007)(6246003)(305945005)(105586002)(58126008)(59450400001)(97736004)(316002)(6346003)(8656006)(25786009)(5660300001)(1076002)(81166006)(2906002)(6916009)(72206003)(6666003)(55016002)(3846002)(11346002)(23726003)(8676002)(8936002)(52116002)(6116002)(44832011)(486006)(6496006)(26005)(446003)(229853002)(42882007)(106356001)(81156014)(476003)(9686003)(478600001)(16526019)(68736007)(18370500001); DIR:OUT; SFP:1101; SCL:1; SRVR:CO2PR07MB2518; H:jerin; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.JacobKollanukkaran@cavium.com; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CO2PR07MB2518; 23:XTzsfOaj/Yyr4ds/8g5DEQka3YORX5KTKkpmTBIWY?= =?us-ascii?Q?XmEQApnxgqK0wNbCvbBDTkE1FdMdoZJNFIw1WMUminfUoNLosfcW0roNXByf?= =?us-ascii?Q?ZiMqY/xmfhpWLN/4lEX06z1p7eAk0/6/bLeTrWHFhtkV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7g08UDdxVpZr2glYttPjK0J3ddTOAlqKvid9x7H8wc4VnOc4jfhie2hVwYO6YUjY5oygbb+nLXXFF0jnmX+gGERgCcmOOD/rbSlM8/Z/YQNaomWGWDI3k/7NrvBJwauJzVYUc9DBtWHK19yM5Meggw8CB+/Efbuvrn4mp1TdxZy2hWZSlA==; 5:CTNMeum4U0NebJ1XpaEtsvFdKoEvmXljcUjZVY6vn8TAGys84CMdjiN6SxR+rbcHDcGOZIx5335ZO8lo9brtU0nL/MOHulxHOih0lx6AONPLZ089hcZvNgGCqwYQzgXfE7uwxUv9Ayey/ecOgIKFgFeyOV9BPhF0wbOzC/JU4Uk=; 24:unnEUKQIBHbIUd4ZmbmGg3BEJJfooyIkio03vmlwqfq8Z3WAs1vHMY8BjL+MqxYuU8S2Ur3dKoPm2EM72rkZjtIdbJq3JX0oPNso5g7gBaw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2518; 7:TCBSTI7fbjWFYpZszo1yndqMafzfB/PcvaH/8CsQRMu0Vh1M9L2gVTkP4SNx6gw7I5XDGesdcNXqzvqKfyIgvEFLfze4SiofrOokvLOjGB80AD3lutLClRmZfalGTdObgCB7OcpzktqXa7dn0zfyvrYwQ2OTmGUdkrS9mGV8SJjNZjWOPrEPA5gbdV/j6BSvweWV71qEsevETZK9bR5C/3br35XiNEDtm0+OgubTXf/w0x5ofC1QyFikgBPQqOO+ X-MS-Office365-Filtering-Correlation-Id: 24db36ac-be6a-4e9f-37d4-08d5aded817c X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Apr 2018 16:23:10.5142 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 24db36ac-be6a-4e9f-37d4-08d5aded817c X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR07MB2518 Subject: Re: [dpdk-dev] [v2, 3/6] eventdev: add crypto adapter implementation 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: Sun, 29 Apr 2018 16:23:17 -0000 -----Original Message----- > Date: Tue, 24 Apr 2018 18:13:24 +0530 > From: Abhinandan Gujjar > To: jerin.jacob@caviumnetworks.com, hemant.agrawal@nxp.com, > akhil.goyal@nxp.com, dev@dpdk.org > CC: narender.vangati@intel.com, abhinandan.gujjar@intel.com, > nikhil.rao@intel.com, gage.eads@intel.com > Subject: [v2,3/6] eventdev: add crypto adapter implementation > X-Mailer: git-send-email 1.9.1 > > Signed-off-by: Abhinandan Gujjar > Signed-off-by: Nikhil Rao > Signed-off-by: Gage Eads > --- > + > +/* Per crypto device information */ > +struct crypto_device_info { > + /* Pointer to cryptodev */ > + struct rte_cryptodev *dev; > + /* Pointer to queue pair info */ > + struct crypto_queue_pair_info *qpairs; > + /* Next queue pair to be processed */ > + uint16_t next_queue_pair_id; > + /* Set to indicate cryptodev->eventdev packet > + * transfer uses a hardware mechanism > + */ > + uint8_t internal_event_port; > + /* Set to indicate processing has been started */ > + uint8_t dev_started; > + /* If num_qpairs > 0, the start callback will > + * be invoked if not already invoked > + */ > + uint16_t num_qpairs; > +}; Looks like it is used in fastpath, if so add the cache alignment. > + > +/* Per queue pair information */ > +struct crypto_queue_pair_info { > + /* Set to indicate queue pair is enabled */ > + bool qp_enabled; > + /* Pointer to hold rte_crypto_ops for batching */ > + struct rte_crypto_op **op_buffer; > + /* No of crypto ops accumulated */ > + uint8_t len; > +}; > + > +static struct rte_event_crypto_adapter **event_crypto_adapter; > + > +eca_enq_to_cryptodev(struct rte_event_crypto_adapter *adapter, > + struct rte_event *ev, unsigned int cnt) > +{ > + struct rte_event_crypto_adapter_stats *stats = &adapter->crypto_stats; > + union rte_event_crypto_metadata *m_data = NULL; > + struct crypto_queue_pair_info *qp_info = NULL; > + struct rte_crypto_op *crypto_op; > + unsigned int i, n = 0; > + uint16_t qp_id = 0, len = 0, ret = 0; Please review the explicit '0' assignment. > + uint8_t cdev_id = 0; > + > + stats->event_dequeue_count += cnt; > + > + for (i = 0; i < cnt; i++) { > + crypto_op = ev[i].event_ptr; > + if (crypto_op == NULL) > + continue; > + if (crypto_op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) { > + m_data = rte_cryptodev_sym_session_get_private_data( > + crypto_op->sym->session); > + if (m_data == NULL) { > + rte_pktmbuf_free(crypto_op->sym->m_src); > + rte_crypto_op_free(crypto_op); > + continue; > + } > + > + cdev_id = m_data->request_info.cdev_id; > + qp_id = m_data->request_info.queue_pair_id; > + qp_info = &adapter->cdevs[cdev_id].qpairs[qp_id]; > + if (qp_info == NULL) { > + rte_pktmbuf_free(crypto_op->sym->m_src); > + rte_crypto_op_free(crypto_op); > + continue; > + } > + len = qp_info->len; > + qp_info->op_buffer[len] = crypto_op; > + len++; > + > +int __rte_experimental > +rte_event_crypto_adapter_queue_pair_add(uint8_t id, > + uint8_t cdev_id, > + int32_t queue_pair_id, > + const struct rte_event_crypto_queue_pair_conf *conf) > +{ > + struct rte_event_crypto_adapter *adapter; > + struct rte_eventdev *dev; > + struct crypto_device_info *dev_info; > + uint32_t cap; > + int ret; > + > + RTE_EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL); > + > + if (!rte_cryptodev_pmd_is_valid_dev(cdev_id)) { > + RTE_EDEV_LOG_ERR("Invalid dev_id=%" PRIu8, cdev_id); > + return -EINVAL; > + } > + > + adapter = eca_id_to_adapter(id); > + if (adapter == NULL) > + return -EINVAL; > + > + dev = &rte_eventdevs[adapter->eventdev_id]; > + ret = rte_event_crypto_adapter_caps_get(adapter->eventdev_id, > + cdev_id, > + &cap); > + if (ret) { > + if ((cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW && > + adapter->mode == RTE_EVENT_CRYPTO_ADAPTER_ENQ_DEQ) || cap) { > + rte_spinlock_lock(&adapter->lock); > + ret = eca_init_service(adapter, id); > + if (ret == 0) > + ret = eca_add_queue_pair(adapter, cdev_id, > + queue_pair_id); > + rte_spinlock_unlock(&adapter->lock); > + } > + > + if (ret) > + return ret; > + > + rte_service_component_runstate_set(adapter->service_id, 1); I guess, it will be called in HW case, if so, please move to appropriate place. > + > + return 0; > +} > + > +int __rte_experimental > +rte_event_crypto_adapter_queue_pair_del(uint8_t id, uint8_t cdev_id, > + int32_t queue_pair_id) > +{ > + struct rte_event_crypto_adapter *adapter; > + struct crypto_device_info *dev_info; > + struct rte_eventdev *dev; > + int ret = 0; No need for explicit '0' assignment