crypto: hisilicon/zip - permit users to specify NUMA node
If users don't specify NUMA node, the driver will use the ZIP module near the CPU allocating acomp. Otherwise, it uses the ZIP module according to the requirement of users. Cc: Zhou Wang <wangzhou1@hisilicon.com> Signed-off-by: Barry Song <song.bao.hua@hisilicon.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
7bc13b5b60
commit
813ec3f1fe
|
@ -76,7 +76,7 @@ struct hisi_zip_sqe {
|
|||
u32 rsvd1[4];
|
||||
};
|
||||
|
||||
int zip_create_qps(struct hisi_qp **qps, int ctx_num);
|
||||
int zip_create_qps(struct hisi_qp **qps, int ctx_num, int node);
|
||||
int hisi_zip_register_to_crypto(void);
|
||||
void hisi_zip_unregister_from_crypto(void);
|
||||
#endif
|
||||
|
|
|
@ -158,13 +158,13 @@ static void hisi_zip_release_qp(struct hisi_zip_qp_ctx *ctx)
|
|||
hisi_qm_release_qp(ctx->qp);
|
||||
}
|
||||
|
||||
static int hisi_zip_ctx_init(struct hisi_zip_ctx *hisi_zip_ctx, u8 req_type)
|
||||
static int hisi_zip_ctx_init(struct hisi_zip_ctx *hisi_zip_ctx, u8 req_type, int node)
|
||||
{
|
||||
struct hisi_qp *qps[HZIP_CTX_Q_NUM] = { NULL };
|
||||
struct hisi_zip *hisi_zip;
|
||||
int ret, i, j;
|
||||
|
||||
ret = zip_create_qps(qps, HZIP_CTX_Q_NUM);
|
||||
ret = zip_create_qps(qps, HZIP_CTX_Q_NUM, node);
|
||||
if (ret) {
|
||||
pr_err("Can not create zip qps!\n");
|
||||
return -ENODEV;
|
||||
|
@ -379,7 +379,7 @@ static int hisi_zip_acomp_init(struct crypto_acomp *tfm)
|
|||
struct hisi_zip_ctx *ctx = crypto_tfm_ctx(&tfm->base);
|
||||
int ret;
|
||||
|
||||
ret = hisi_zip_ctx_init(ctx, COMP_NAME_TO_TYPE(alg_name));
|
||||
ret = hisi_zip_ctx_init(ctx, COMP_NAME_TO_TYPE(alg_name), tfm->base.node);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -234,9 +234,10 @@ static const struct pci_device_id hisi_zip_dev_ids[] = {
|
|||
};
|
||||
MODULE_DEVICE_TABLE(pci, hisi_zip_dev_ids);
|
||||
|
||||
int zip_create_qps(struct hisi_qp **qps, int qp_num)
|
||||
int zip_create_qps(struct hisi_qp **qps, int qp_num, int node)
|
||||
{
|
||||
int node = cpu_to_node(smp_processor_id());
|
||||
if (node == NUMA_NO_NODE)
|
||||
node = cpu_to_node(smp_processor_id());
|
||||
|
||||
return hisi_qm_alloc_qps_node(&zip_devices, qp_num, 0, node, qps);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue