For simplicity's sake, this is a per-fd option, and therefore applies to all sessions opened over it. --- cryptodev.h | 1 + cryptodev_main.c | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/cryptodev.h b/cryptodev.h index db4697c..8126bfc 100644 --- a/cryptodev.h +++ b/cryptodev.h @@ -177,6 +177,7 @@ enum cryptodev_crk_op_t { #define CIOCKEY _IOWR('c', 105, struct crypt_kop) #define CIOCASYMFEAT _IOR('c', 106, __u32) #define CIOCGSESSINFO _IOWR('c', 107, struct session_info_op) +#define CIOCSCPU _IOW('c', 108, __s32) /* to indicate that CRIOGET is not required in linux */ diff --git a/cryptodev_main.c b/cryptodev_main.c index efd08c8..3ef8c9f 100644 --- a/cryptodev_main.c +++ b/cryptodev_main.c @@ -95,6 +95,7 @@ struct crypt_priv { int itemcount; struct work_struct cryptask; wait_queue_head_t user_waiter; + int cpu; /* number of CPU to bind to (cpuid + 1) */ }; #define FILL_SG(sg, ptr, len) \ @@ -933,7 +934,8 @@ static int crypto_async_run(struct crypt_priv *pcr, struct kernel_crypt_op *kcop list_add_tail(&item->__hook, &pcr->todo.list); mutex_unlock(&pcr->todo.lock); - queue_work(cryptodev_wq, &pcr->cryptask); + queue_work_on(pcr->cpu ? pcr->cpu - 1 : smp_processor_id(), + cryptodev_wq, &pcr->cryptask); return 0; } @@ -1157,6 +1159,15 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_) return ret; return kcop_to_user(&kcop, fcr, arg); + case CIOCSCPU: + if (unlikely(get_user(ret, p))) + return -EFAULT; + + if (unlikely(ret > nr_cpu_ids)) + return -EINVAL; + + pcr->cpu = ret < 0 ? 0 : ret + 1; + return 0; default: return -EINVAL; } @@ -1268,6 +1279,7 @@ cryptodev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg_) case CRIOGET: case CIOCFSESSION: case CIOCGSESSINFO: + case CIOCSCPU: return cryptodev_ioctl(file, cmd, arg_); case COMPAT_CIOCGSESSION: -- 1.7.3.4 _______________________________________________ Cryptodev-linux-devel mailing list Cryptodev-linux-devel@gna.org https://mail.gna.org/listinfo/cryptodev-linux-devel