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

crypto: chelsio - Read rxchannel-id from firmware

The rxchannel id is updated by the driver using the
port no value, but this does not ensure that the value
is correct. So now rx channel value is obtained from
etoc channel map value.

Fixes: 567be3a5d227 ("crypto: chelsio - Use multiple txq/rxq per...")
Signed-off-by: Ayush Sawal <ayush.sawal@chelsio.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Ayush Sawal and committed by
Herbert Xu
16a9874f f7cae626

+17 -2
+17 -2
drivers/crypto/chelsio/chcr_algo.c
··· 769 769 struct uld_ctx *u_ctx = ULD_CTX(ctx); 770 770 unsigned int tx_channel_id, rx_channel_id; 771 771 unsigned int txqidx = 0, rxqidx = 0; 772 - unsigned int qid, fid; 772 + unsigned int qid, fid, portno; 773 773 774 774 get_qidxs(req, &txqidx, &rxqidx); 775 775 qid = u_ctx->lldi.rxq_ids[rxqidx]; 776 776 fid = u_ctx->lldi.rxq_ids[0]; 777 + portno = rxqidx / ctx->rxq_perchan; 777 778 tx_channel_id = txqidx / ctx->txq_perchan; 778 - rx_channel_id = rxqidx / ctx->rxq_perchan; 779 + rx_channel_id = cxgb4_port_e2cchan(u_ctx->lldi.ports[portno]); 779 780 780 781 781 782 chcr_req->wreq.op_to_cctx_size = FILL_WR_OP_CCTX_SIZE; ··· 804 803 { 805 804 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(wrparam->req); 806 805 struct chcr_context *ctx = c_ctx(tfm); 806 + struct uld_ctx *u_ctx = ULD_CTX(ctx); 807 807 struct ablk_ctx *ablkctx = ABLK_CTX(ctx); 808 808 struct sk_buff *skb = NULL; 809 809 struct chcr_wr *chcr_req; ··· 821 819 struct adapter *adap = padap(ctx->dev); 822 820 unsigned int rx_channel_id = reqctx->rxqidx / ctx->rxq_perchan; 823 821 822 + rx_channel_id = cxgb4_port_e2cchan(u_ctx->lldi.ports[rx_channel_id]); 824 823 nents = sg_nents_xlen(reqctx->dstsg, wrparam->bytes, CHCR_DST_SG_SIZE, 825 824 reqctx->dst_ofst); 826 825 dst_size = get_space_for_phys_dsgl(nents); ··· 1581 1578 int error = 0; 1582 1579 unsigned int rx_channel_id = req_ctx->rxqidx / ctx->rxq_perchan; 1583 1580 1581 + rx_channel_id = cxgb4_port_e2cchan(u_ctx->lldi.ports[rx_channel_id]); 1584 1582 transhdr_len = HASH_TRANSHDR_SIZE(param->kctx_len); 1585 1583 req_ctx->hctx_wr.imm = (transhdr_len + param->bfr_len + 1586 1584 param->sg_len) <= SGE_MAX_WR_LEN; ··· 2440 2436 { 2441 2437 struct crypto_aead *tfm = crypto_aead_reqtfm(req); 2442 2438 struct chcr_context *ctx = a_ctx(tfm); 2439 + struct uld_ctx *u_ctx = ULD_CTX(ctx); 2443 2440 struct chcr_aead_ctx *aeadctx = AEAD_CTX(ctx); 2444 2441 struct chcr_authenc_ctx *actx = AUTHENC_CTX(aeadctx); 2445 2442 struct chcr_aead_reqctx *reqctx = aead_request_ctx(req); ··· 2460 2455 struct adapter *adap = padap(ctx->dev); 2461 2456 unsigned int rx_channel_id = reqctx->rxqidx / ctx->rxq_perchan; 2462 2457 2458 + rx_channel_id = cxgb4_port_e2cchan(u_ctx->lldi.ports[rx_channel_id]); 2463 2459 if (req->cryptlen == 0) 2464 2460 return NULL; 2465 2461 ··· 2714 2708 struct dsgl_walk dsgl_walk; 2715 2709 unsigned int authsize = crypto_aead_authsize(tfm); 2716 2710 struct chcr_context *ctx = a_ctx(tfm); 2711 + struct uld_ctx *u_ctx = ULD_CTX(ctx); 2717 2712 u32 temp; 2718 2713 unsigned int rx_channel_id = reqctx->rxqidx / ctx->rxq_perchan; 2719 2714 2715 + rx_channel_id = cxgb4_port_e2cchan(u_ctx->lldi.ports[rx_channel_id]); 2720 2716 dsgl_walk_init(&dsgl_walk, phys_cpl); 2721 2717 dsgl_walk_add_page(&dsgl_walk, IV + reqctx->b0_len, reqctx->iv_dma); 2722 2718 temp = req->assoclen + req->cryptlen + ··· 2758 2750 struct chcr_skcipher_req_ctx *reqctx = skcipher_request_ctx(req); 2759 2751 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(wrparam->req); 2760 2752 struct chcr_context *ctx = c_ctx(tfm); 2753 + struct uld_ctx *u_ctx = ULD_CTX(ctx); 2761 2754 struct dsgl_walk dsgl_walk; 2762 2755 unsigned int rx_channel_id = reqctx->rxqidx / ctx->rxq_perchan; 2763 2756 2757 + rx_channel_id = cxgb4_port_e2cchan(u_ctx->lldi.ports[rx_channel_id]); 2764 2758 dsgl_walk_init(&dsgl_walk, phys_cpl); 2765 2759 dsgl_walk_add_sg(&dsgl_walk, reqctx->dstsg, wrparam->bytes, 2766 2760 reqctx->dst_ofst); ··· 2966 2956 { 2967 2957 struct crypto_aead *tfm = crypto_aead_reqtfm(req); 2968 2958 struct chcr_context *ctx = a_ctx(tfm); 2959 + struct uld_ctx *u_ctx = ULD_CTX(ctx); 2969 2960 struct chcr_aead_ctx *aeadctx = AEAD_CTX(ctx); 2970 2961 struct chcr_aead_reqctx *reqctx = aead_request_ctx(req); 2971 2962 unsigned int cipher_mode = CHCR_SCMD_CIPHER_MODE_AES_CCM; ··· 2975 2964 unsigned int ccm_xtra; 2976 2965 unsigned int tag_offset = 0, auth_offset = 0; 2977 2966 unsigned int assoclen; 2967 + 2968 + rx_channel_id = cxgb4_port_e2cchan(u_ctx->lldi.ports[rx_channel_id]); 2978 2969 2979 2970 if (get_aead_subtype(tfm) == CRYPTO_ALG_SUB_TYPE_AEAD_RFC4309) 2980 2971 assoclen = req->assoclen - 8; ··· 3138 3125 { 3139 3126 struct crypto_aead *tfm = crypto_aead_reqtfm(req); 3140 3127 struct chcr_context *ctx = a_ctx(tfm); 3128 + struct uld_ctx *u_ctx = ULD_CTX(ctx); 3141 3129 struct chcr_aead_ctx *aeadctx = AEAD_CTX(ctx); 3142 3130 struct chcr_aead_reqctx *reqctx = aead_request_ctx(req); 3143 3131 struct sk_buff *skb = NULL; ··· 3155 3141 struct adapter *adap = padap(ctx->dev); 3156 3142 unsigned int rx_channel_id = reqctx->rxqidx / ctx->rxq_perchan; 3157 3143 3144 + rx_channel_id = cxgb4_port_e2cchan(u_ctx->lldi.ports[rx_channel_id]); 3158 3145 if (get_aead_subtype(tfm) == CRYPTO_ALG_SUB_TYPE_AEAD_RFC4106) 3159 3146 assoclen = req->assoclen - 8; 3160 3147