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

crypto: iaa - Use acomp stack fallback

Use ACOMP_REQUEST_ON_STACK instead of allocating legacy fallback
compression transform.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

+6 -22
+6 -22
drivers/crypto/intel/iaa/iaa_crypto_main.c
··· 33 33 /* Number of physical cpus sharing each iaa instance */ 34 34 static unsigned int cpus_per_iaa; 35 35 36 - static struct crypto_comp *deflate_generic_tfm; 37 - 38 36 /* Per-cpu lookup table for balanced wqs */ 39 37 static struct wq_table_entry __percpu *wq_table; 40 38 ··· 999 1001 1000 1002 static int deflate_generic_decompress(struct acomp_req *req) 1001 1003 { 1002 - void *src, *dst; 1004 + ACOMP_REQUEST_ON_STACK(fbreq, crypto_acomp_reqtfm(req)); 1003 1005 int ret; 1004 1006 1005 - src = kmap_local_page(sg_page(req->src)) + req->src->offset; 1006 - dst = kmap_local_page(sg_page(req->dst)) + req->dst->offset; 1007 - 1008 - ret = crypto_comp_decompress(deflate_generic_tfm, 1009 - src, req->slen, dst, &req->dlen); 1010 - 1011 - kunmap_local(src); 1012 - kunmap_local(dst); 1007 + acomp_request_set_callback(fbreq, 0, NULL, NULL); 1008 + acomp_request_set_params(fbreq, req->src, req->dst, req->slen, 1009 + req->dlen); 1010 + ret = crypto_acomp_decompress(fbreq); 1011 + req->dlen = fbreq->dlen; 1013 1012 1014 1013 update_total_sw_decomp_calls(); 1015 1014 ··· 1893 1898 } 1894 1899 nr_cpus_per_node = nr_cpus / nr_nodes; 1895 1900 1896 - if (crypto_has_comp("deflate-generic", 0, 0)) 1897 - deflate_generic_tfm = crypto_alloc_comp("deflate-generic", 0, 0); 1898 - 1899 - if (IS_ERR_OR_NULL(deflate_generic_tfm)) { 1900 - pr_err("IAA could not alloc %s tfm: errcode = %ld\n", 1901 - "deflate-generic", PTR_ERR(deflate_generic_tfm)); 1902 - return -ENOMEM; 1903 - } 1904 - 1905 1901 ret = iaa_aecs_init_fixed(); 1906 1902 if (ret < 0) { 1907 1903 pr_debug("IAA fixed compression mode init failed\n"); ··· 1934 1948 err_driver_reg: 1935 1949 iaa_aecs_cleanup_fixed(); 1936 1950 err_aecs_init: 1937 - crypto_free_comp(deflate_generic_tfm); 1938 1951 1939 1952 goto out; 1940 1953 } ··· 1950 1965 &driver_attr_verify_compress); 1951 1966 idxd_driver_unregister(&iaa_crypto_driver); 1952 1967 iaa_aecs_cleanup_fixed(); 1953 - crypto_free_comp(deflate_generic_tfm); 1954 1968 1955 1969 pr_debug("cleaned up\n"); 1956 1970 }