Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

i40iw: Replace the obsolete crypto hash interface with shash

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

Removing CRYPTO_ALG_ASYNC from crypto_alloc_shash(),
because it is by definition sync only

Signed-off-by: Mustafa Ismail <mustafa.ismail@intel.com>
Signed-off-by: Tatyana Nikolova <tatyana.e.nikolova@intel.com>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Doug Ledford <dledford@redhat.com>

authored by

Tatyana Nikolova and committed by
Doug Ledford
34abf9ed 6e4de866

+37 -21
+1
drivers/infiniband/hw/i40iw/i40iw.h
··· 52 52 #include <rdma/iw_cm.h> 53 53 #include <rdma/iw_portmap.h> 54 54 #include <rdma/rdma_netlink.h> 55 + #include <crypto/hash.h> 55 56 56 57 #include "i40iw_status.h" 57 58 #include "i40iw_osdep.h"
+4 -3
drivers/infiniband/hw/i40iw/i40iw_osdep.h
··· 39 39 #include <linux/string.h> 40 40 #include <linux/bitops.h> 41 41 #include <net/tcp.h> 42 + #include <crypto/hash.h> 42 43 /* get readq/writeq support for 32 bit kernels, use the low-first version */ 43 44 #include <linux/io-64-nonatomic-lo-hi.h> 44 45 ··· 172 171 u8 __iomem *i40iw_get_hw_addr(void *dev); 173 172 void i40iw_ieq_mpa_crc_ae(struct i40iw_sc_dev *dev, struct i40iw_sc_qp *qp); 174 173 enum i40iw_status_code i40iw_vf_wait_vchnl_resp(struct i40iw_sc_dev *dev); 175 - enum i40iw_status_code i40iw_ieq_check_mpacrc(struct hash_desc *desc, void *addr, 174 + enum i40iw_status_code i40iw_ieq_check_mpacrc(struct shash_desc *desc, void *addr, 176 175 u32 length, u32 value); 177 176 struct i40iw_sc_qp *i40iw_ieq_get_qp(struct i40iw_sc_dev *dev, struct i40iw_puda_buf *buf); 178 177 void i40iw_ieq_update_tcpip_info(struct i40iw_puda_buf *buf, u16 length, u32 seqnum); 179 - void i40iw_free_hash_desc(struct hash_desc *); 180 - enum i40iw_status_code i40iw_init_hash_desc(struct hash_desc *); 178 + void i40iw_free_hash_desc(struct shash_desc *); 179 + enum i40iw_status_code i40iw_init_hash_desc(struct shash_desc **); 181 180 enum i40iw_status_code i40iw_puda_get_tcpip_info(struct i40iw_puda_completion_info *info, 182 181 struct i40iw_puda_buf *buf); 183 182 enum i40iw_status_code i40iw_cqp_sds_cmd(struct i40iw_sc_dev *dev,
+3 -3
drivers/infiniband/hw/i40iw/i40iw_puda.c
··· 729 729 730 730 switch (rsrc->completion) { 731 731 case PUDA_HASH_CRC_COMPLETE: 732 - i40iw_free_hash_desc(&rsrc->hash_desc); 732 + i40iw_free_hash_desc(rsrc->hash_desc); 733 733 case PUDA_QP_CREATED: 734 734 do { 735 735 if (reset) ··· 1142 1142 crcptr = txbuf->data + fpdu_len - 4; 1143 1143 mpacrc = *(u32 *)crcptr; 1144 1144 if (ieq->check_crc) { 1145 - status = i40iw_ieq_check_mpacrc(&ieq->hash_desc, txbuf->data, 1145 + status = i40iw_ieq_check_mpacrc(ieq->hash_desc, txbuf->data, 1146 1146 (fpdu_len - 4), mpacrc); 1147 1147 if (status) { 1148 1148 i40iw_debug(ieq->dev, I40IW_DEBUG_IEQ, ··· 1210 1210 crcptr = datap + fpdu_len - 4; 1211 1211 mpacrc = *(u32 *)crcptr; 1212 1212 if (ieq->check_crc) 1213 - ret = i40iw_ieq_check_mpacrc(&ieq->hash_desc, 1213 + ret = i40iw_ieq_check_mpacrc(ieq->hash_desc, 1214 1214 datap, fpdu_len - 4, mpacrc); 1215 1215 if (ret) { 1216 1216 status = I40IW_ERR_MPA_CRC;
+4 -4
drivers/infiniband/hw/i40iw/i40iw_puda.h
··· 135 135 u32 rxq_invalid_cnt; 136 136 u32 tx_wqe_avail_cnt; 137 137 bool check_crc; 138 - struct hash_desc hash_desc; 138 + struct shash_desc *hash_desc; 139 139 struct list_head txpend; 140 140 struct list_head bufpool; /* free buffers pool list for recv and xmit */ 141 141 u32 alloc_buf_count; ··· 173 173 struct i40iw_puda_buf *buf); 174 174 enum i40iw_status_code i40iw_puda_get_tcpip_info(struct i40iw_puda_completion_info *info, 175 175 struct i40iw_puda_buf *buf); 176 - enum i40iw_status_code i40iw_ieq_check_mpacrc(struct hash_desc *desc, 176 + enum i40iw_status_code i40iw_ieq_check_mpacrc(struct shash_desc *desc, 177 177 void *addr, u32 length, u32 value); 178 - enum i40iw_status_code i40iw_init_hash_desc(struct hash_desc *desc); 178 + enum i40iw_status_code i40iw_init_hash_desc(struct shash_desc **desc); 179 179 void i40iw_ieq_mpa_crc_ae(struct i40iw_sc_dev *dev, struct i40iw_sc_qp *qp); 180 - void i40iw_free_hash_desc(struct hash_desc *desc); 180 + void i40iw_free_hash_desc(struct shash_desc *desc); 181 181 void i40iw_ieq_update_tcpip_info(struct i40iw_puda_buf *buf, u16 length, 182 182 u32 seqnum); 183 183 #endif
+25 -11
drivers/infiniband/hw/i40iw/i40iw_utils.c
··· 1024 1024 * i40iw_init_hash_desc - initialize hash for crc calculation 1025 1025 * @desc: cryption type 1026 1026 */ 1027 - enum i40iw_status_code i40iw_init_hash_desc(struct hash_desc *desc) 1027 + enum i40iw_status_code i40iw_init_hash_desc(struct shash_desc **desc) 1028 1028 { 1029 - desc->tfm = crypto_alloc_hash("crc32c", 0, CRYPTO_ALG_ASYNC); 1030 - if (IS_ERR(desc->tfm)) 1029 + struct crypto_shash *tfm; 1030 + struct shash_desc *tdesc; 1031 + 1032 + tfm = crypto_alloc_shash("crc32c", 0, 0); 1033 + if (IS_ERR(tfm)) 1031 1034 return I40IW_ERR_MPA_CRC; 1035 + 1036 + tdesc = kzalloc(sizeof(*tdesc) + crypto_shash_descsize(tfm), 1037 + GFP_KERNEL); 1038 + if (!tdesc) { 1039 + crypto_free_shash(tfm); 1040 + return I40IW_ERR_MPA_CRC; 1041 + } 1042 + tdesc->tfm = tfm; 1043 + *desc = tdesc; 1044 + 1032 1045 return 0; 1033 1046 } 1034 1047 ··· 1049 1036 * i40iw_free_hash_desc - free hash desc 1050 1037 * @desc: to be freed 1051 1038 */ 1052 - void i40iw_free_hash_desc(struct hash_desc *desc) 1039 + void i40iw_free_hash_desc(struct shash_desc *desc) 1053 1040 { 1054 - crypto_free_hash(desc->tfm); 1041 + if (desc) { 1042 + crypto_free_shash(desc->tfm); 1043 + kfree(desc); 1044 + } 1055 1045 } 1056 1046 1057 1047 /** ··· 1081 1065 * @length: length of buffer 1082 1066 * @value: value to be compared 1083 1067 */ 1084 - enum i40iw_status_code i40iw_ieq_check_mpacrc(struct hash_desc *desc, 1068 + enum i40iw_status_code i40iw_ieq_check_mpacrc(struct shash_desc *desc, 1085 1069 void *addr, 1086 1070 u32 length, 1087 1071 u32 value) 1088 1072 { 1089 - struct scatterlist sg; 1090 1073 u32 crc = 0; 1091 1074 int ret; 1092 1075 enum i40iw_status_code ret_code = 0; 1093 1076 1094 - crypto_hash_init(desc); 1095 - sg_init_one(&sg, addr, length); 1096 - ret = crypto_hash_update(desc, &sg, length); 1077 + crypto_shash_init(desc); 1078 + ret = crypto_shash_update(desc, addr, length); 1097 1079 if (!ret) 1098 - crypto_hash_final(desc, (u8 *)&crc); 1080 + crypto_shash_final(desc, (u8 *)&crc); 1099 1081 if (crc != value) { 1100 1082 i40iw_pr_err("mpa crc check fail\n"); 1101 1083 ret_code = I40IW_ERR_MPA_CRC;