From patchwork Thu Mar 17 21:22:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nikolova, Tatyana E" X-Patchwork-Id: 8614311 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 05A589F6E1 for ; Thu, 17 Mar 2016 21:22:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E6F8C201DD for ; Thu, 17 Mar 2016 21:22:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A7B5820172 for ; Thu, 17 Mar 2016 21:22:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756565AbcCQVWX (ORCPT ); Thu, 17 Mar 2016 17:22:23 -0400 Received: from mga01.intel.com ([192.55.52.88]:3259 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753028AbcCQVWX (ORCPT ); Thu, 17 Mar 2016 17:22:23 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP; 17 Mar 2016 14:22:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,351,1455004800"; d="scan'208";a="936325757" Received: from tenikolo-mobl2.amr.corp.intel.com (HELO tenikolo-mobl1) ([10.122.42.44]) by orsmga002.jf.intel.com with SMTP; 17 Mar 2016 14:22:20 -0700 Received: by tenikolo-mobl1 (sSMTP sendmail emulation); Thu, 17 Mar 2016 16:22:20 -0550 Date: Thu, 17 Mar 2016 16:22:20 -0500 From: Tatyana Nikolova To: Doug Ledford Cc: mustafa.ismail@intel.com, linux-rdma@vger.kernel.org, faisal.latif@intel.com, herbert@gondor.apana.org.au, sfr@canb.auug.org.au Subject: [PATCH] i40iw: Replace the obsolete crypto hash interface with shash Message-ID: <20160317212220.GA7292@TENIKOLO-MOBL2> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch replaces the obsolete crypto hash interface with shash and resolves a build failure after merge of the rdma tree which is caused by the removal of crypto hash interface Signed-off-by: Mustafa Ismail Signed-off-by: Tatyana Nikolova --- drivers/infiniband/hw/i40iw/i40iw.h | 1 + drivers/infiniband/hw/i40iw/i40iw_osdep.h | 7 +++--- drivers/infiniband/hw/i40iw/i40iw_puda.c | 6 +++--- drivers/infiniband/hw/i40iw/i40iw_puda.h | 8 +++---- drivers/infiniband/hw/i40iw/i40iw_utils.c | 36 +++++++++++++++++++++---------- 5 files changed, 37 insertions(+), 21 deletions(-) diff --git a/drivers/infiniband/hw/i40iw/i40iw.h b/drivers/infiniband/hw/i40iw/i40iw.h index 19f6651..8197676 100644 --- a/drivers/infiniband/hw/i40iw/i40iw.h +++ b/drivers/infiniband/hw/i40iw/i40iw.h @@ -52,6 +52,7 @@ #include #include #include +#include #include "i40iw_status.h" #include "i40iw_osdep.h" diff --git a/drivers/infiniband/hw/i40iw/i40iw_osdep.h b/drivers/infiniband/hw/i40iw/i40iw_osdep.h index 4d840a9..7e20493 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_osdep.h +++ b/drivers/infiniband/hw/i40iw/i40iw_osdep.h @@ -39,6 +39,7 @@ #include #include #include +#include /* get readq/writeq support for 32 bit kernels, use the low-first version */ #include @@ -171,12 +172,12 @@ struct i40iw_hw; u8 __iomem *i40iw_get_hw_addr(void *dev); void i40iw_ieq_mpa_crc_ae(struct i40iw_sc_dev *dev, struct i40iw_sc_qp *qp); enum i40iw_status_code i40iw_vf_wait_vchnl_resp(struct i40iw_sc_dev *dev); -enum i40iw_status_code i40iw_ieq_check_mpacrc(struct hash_desc *desc, void *addr, +enum i40iw_status_code i40iw_ieq_check_mpacrc(struct shash_desc *desc, void *addr, u32 length, u32 value); struct i40iw_sc_qp *i40iw_ieq_get_qp(struct i40iw_sc_dev *dev, struct i40iw_puda_buf *buf); void i40iw_ieq_update_tcpip_info(struct i40iw_puda_buf *buf, u16 length, u32 seqnum); -void i40iw_free_hash_desc(struct hash_desc *); -enum i40iw_status_code i40iw_init_hash_desc(struct hash_desc *); +void i40iw_free_hash_desc(struct shash_desc *); +enum i40iw_status_code i40iw_init_hash_desc(struct shash_desc **); enum i40iw_status_code i40iw_puda_get_tcpip_info(struct i40iw_puda_completion_info *info, struct i40iw_puda_buf *buf); enum i40iw_status_code i40iw_cqp_sds_cmd(struct i40iw_sc_dev *dev, diff --git a/drivers/infiniband/hw/i40iw/i40iw_puda.c b/drivers/infiniband/hw/i40iw/i40iw_puda.c index ae9971f..8eb400d8 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_puda.c +++ b/drivers/infiniband/hw/i40iw/i40iw_puda.c @@ -729,7 +729,7 @@ void i40iw_puda_dele_resources(struct i40iw_sc_dev *dev, switch (rsrc->completion) { case PUDA_HASH_CRC_COMPLETE: - i40iw_free_hash_desc(&rsrc->hash_desc); + i40iw_free_hash_desc(rsrc->hash_desc); case PUDA_QP_CREATED: do { if (reset) @@ -1142,7 +1142,7 @@ static enum i40iw_status_code i40iw_ieq_handle_partial(struct i40iw_puda_rsrc *i crcptr = txbuf->data + fpdu_len - 4; mpacrc = *(u32 *)crcptr; if (ieq->check_crc) { - status = i40iw_ieq_check_mpacrc(&ieq->hash_desc, txbuf->data, + status = i40iw_ieq_check_mpacrc(ieq->hash_desc, txbuf->data, (fpdu_len - 4), mpacrc); if (status) { i40iw_debug(ieq->dev, I40IW_DEBUG_IEQ, @@ -1210,7 +1210,7 @@ static enum i40iw_status_code i40iw_ieq_process_buf(struct i40iw_puda_rsrc *ieq, crcptr = datap + fpdu_len - 4; mpacrc = *(u32 *)crcptr; if (ieq->check_crc) - ret = i40iw_ieq_check_mpacrc(&ieq->hash_desc, + ret = i40iw_ieq_check_mpacrc(ieq->hash_desc, datap, fpdu_len - 4, mpacrc); if (ret) { status = I40IW_ERR_MPA_CRC; diff --git a/drivers/infiniband/hw/i40iw/i40iw_puda.h b/drivers/infiniband/hw/i40iw/i40iw_puda.h index b689aa4..52bf782 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_puda.h +++ b/drivers/infiniband/hw/i40iw/i40iw_puda.h @@ -135,7 +135,7 @@ struct i40iw_puda_rsrc { u32 rxq_invalid_cnt; u32 tx_wqe_avail_cnt; bool check_crc; - struct hash_desc hash_desc; + struct shash_desc *hash_desc; struct list_head txpend; struct list_head bufpool; /* free buffers pool list for recv and xmit */ u32 alloc_buf_count; @@ -173,11 +173,11 @@ struct i40iw_sc_qp *i40iw_ieq_get_qp(struct i40iw_sc_dev *dev, struct i40iw_puda_buf *buf); enum i40iw_status_code i40iw_puda_get_tcpip_info(struct i40iw_puda_completion_info *info, struct i40iw_puda_buf *buf); -enum i40iw_status_code i40iw_ieq_check_mpacrc(struct hash_desc *desc, +enum i40iw_status_code i40iw_ieq_check_mpacrc(struct shash_desc *desc, void *addr, u32 length, u32 value); -enum i40iw_status_code i40iw_init_hash_desc(struct hash_desc *desc); +enum i40iw_status_code i40iw_init_hash_desc(struct shash_desc **desc); void i40iw_ieq_mpa_crc_ae(struct i40iw_sc_dev *dev, struct i40iw_sc_qp *qp); -void i40iw_free_hash_desc(struct hash_desc *desc); +void i40iw_free_hash_desc(struct shash_desc *desc); void i40iw_ieq_update_tcpip_info(struct i40iw_puda_buf *buf, u16 length, u32 seqnum); #endif diff --git a/drivers/infiniband/hw/i40iw/i40iw_utils.c b/drivers/infiniband/hw/i40iw/i40iw_utils.c index 71ee01f..9ca2d34 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_utils.c +++ b/drivers/infiniband/hw/i40iw/i40iw_utils.c @@ -1024,11 +1024,24 @@ void i40iw_ieq_mpa_crc_ae(struct i40iw_sc_dev *dev, struct i40iw_sc_qp *qp) * i40iw_init_hash_desc - initialize hash for crc calculation * @desc: cryption type */ -enum i40iw_status_code i40iw_init_hash_desc(struct hash_desc *desc) +enum i40iw_status_code i40iw_init_hash_desc(struct shash_desc **desc) { - desc->tfm = crypto_alloc_hash("crc32c", 0, CRYPTO_ALG_ASYNC); - if (IS_ERR(desc->tfm)) + struct crypto_shash *tfm; + struct shash_desc *tdesc; + + tfm = crypto_alloc_shash("crc32c", 0, CRYPTO_ALG_ASYNC); + if (IS_ERR(tfm)) + return I40IW_ERR_MPA_CRC; + + tdesc = kzalloc(sizeof(*tdesc) + crypto_shash_descsize(tfm), + GFP_KERNEL); + if (!tdesc) { + crypto_free_shash(tfm); return I40IW_ERR_MPA_CRC; + } + tdesc->tfm = tfm; + *desc = tdesc; + return 0; } @@ -1036,9 +1049,12 @@ enum i40iw_status_code i40iw_init_hash_desc(struct hash_desc *desc) * i40iw_free_hash_desc - free hash desc * @desc: to be freed */ -void i40iw_free_hash_desc(struct hash_desc *desc) +void i40iw_free_hash_desc(struct shash_desc *desc) { - crypto_free_hash(desc->tfm); + if (desc) { + crypto_free_shash(desc->tfm); + kfree(desc); + } } /** @@ -1065,21 +1081,19 @@ enum i40iw_status_code i40iw_alloc_query_fpm_buf(struct i40iw_sc_dev *dev, * @length: length of buffer * @value: value to be compared */ -enum i40iw_status_code i40iw_ieq_check_mpacrc(struct hash_desc *desc, +enum i40iw_status_code i40iw_ieq_check_mpacrc(struct shash_desc *desc, void *addr, u32 length, u32 value) { - struct scatterlist sg; u32 crc = 0; int ret; enum i40iw_status_code ret_code = 0; - crypto_hash_init(desc); - sg_init_one(&sg, addr, length); - ret = crypto_hash_update(desc, &sg, length); + crypto_shash_init(desc); + ret = crypto_shash_update(desc, addr, length); if (!ret) - crypto_hash_final(desc, (u8 *)&crc); + crypto_shash_final(desc, (u8 *)&crc); if (crc != value) { i40iw_pr_err("mpa crc check fail\n"); ret_code = I40IW_ERR_MPA_CRC;