im ok with the workq -> task change.

im not objecting to an IPL_HIGH to IPL_VM change, i just think it should be 
done separately.

dlg

On 31 Oct 2013, at 12:32 am, Mike Belopuhov <m...@belopuhov.com> wrote:

> On Wed, Oct 30, 2013 at 14:58 +0100, Mike Belopuhov wrote:
>> Tested on amd64 SP and MP, i386 SP so far.  sparc64 MP test
>> is in progress.  I've also tested the crypto(4) interface
>> (doesn't use queue) so softraid should work as well.
>> 
> 
> sparc64 test is done.
> 
> on a side note, that IPL_HIGH can be safely converted to
> IPL_VM since crypto code itself uses splvm (which is also
> rather pointless because hw crypto uses IPL_NET and mbuf
> allocation code will bump IPL itself anyways).  i have
> just tested IPL_VM taskq on the aforementioned machines.
> 
>> ok?
>> 
>> diff --git sys/crypto/crypto.c sys/crypto/crypto.c
>> index 7df0c435..fbdcd97 100644
>> --- sys/crypto/crypto.c
>> +++ sys/crypto/crypto.c
>> @@ -34,11 +34,11 @@ struct cryptocap *crypto_drivers = NULL;
>> int crypto_drivers_num = 0;
>> 
>> struct pool cryptop_pool;
>> struct pool cryptodesc_pool;
>> 
>> -struct workq *crypto_workq;
>> +struct taskq *crypto_taskq;
>> 
>> /*
>>  * Create a new session.
>>  */
>> int
>> @@ -414,26 +414,26 @@ crypto_dispatch(struct cryptop *crp)
>>      hid = (crp->crp_sid >> 32) & 0xffffffff;
>>      if (hid < crypto_drivers_num)
>>              crypto_drivers[hid].cc_queued++;
>>      splx(s);
>> 
>> -    if (crypto_workq) {
>> -            workq_queue_task(crypto_workq, &crp->crp_wqt, 0,
>> -                (workq_fn)crypto_invoke, crp, NULL);
>> +    if (crypto_taskq) {
>> +            task_set(&crp->crp_task, (void (*))crypto_invoke, crp, NULL);
>> +            task_add(crypto_taskq, &crp->crp_task);
>>      } else {
>>              crypto_invoke(crp);
>>      }
>> 
>>      return 0;
>> }
>> 
>> int
>> crypto_kdispatch(struct cryptkop *krp)
>> {
>> -    if (crypto_workq) {
>> -            workq_queue_task(crypto_workq, &krp->krp_wqt, 0,
>> -                (workq_fn)crypto_kinvoke, krp, NULL);
>> +    if (crypto_taskq) {
>> +            task_set(&krp->krp_task, (void (*))crypto_kinvoke, krp, NULL);
>> +            task_add(crypto_taskq, &krp->krp_task);
>>      } else {
>>              crypto_kinvoke(krp);
>>      }
>> 
>>      return 0;
>> @@ -616,11 +616,11 @@ crypto_getreq(int num)
>> }
>> 
>> void
>> crypto_init(void)
>> {
>> -    crypto_workq = workq_create("crypto", 1, IPL_HIGH);
>> +    crypto_taskq = taskq_create("crypto", 1, IPL_HIGH);
>> 
>>      pool_init(&cryptop_pool, sizeof(struct cryptop), 0, 0,
>>          0, "cryptop", NULL);
>>      pool_init(&cryptodesc_pool, sizeof(struct cryptodesc), 0, 0,
>>          0, "cryptodesc", NULL);
>> @@ -635,23 +635,24 @@ crypto_done(struct cryptop *crp)
>>      crp->crp_flags |= CRYPTO_F_DONE;
>>      if (crp->crp_flags & CRYPTO_F_NOQUEUE) {
>>              /* not from the crypto queue, wakeup the userland process */
>>              crp->crp_callback(crp);
>>      } else {
>> -            workq_queue_task(crypto_workq, &crp->crp_wqt, 0,
>> -                (workq_fn)crp->crp_callback, crp, NULL);
>> +            task_set(&crp->crp_task, (void (*))crp->crp_callback,
>> +                crp, NULL);
>> +            task_add(crypto_taskq, &crp->crp_task);
>>      }
>> }
>> 
>> /*
>>  * Invoke the callback on behalf of the driver.
>>  */
>> void
>> crypto_kdone(struct cryptkop *krp)
>> {
>> -    workq_queue_task(crypto_workq, &krp->krp_wqt, 0,
>> -        (workq_fn)krp->krp_callback, krp, NULL);
>> +    task_set(&krp->krp_task, (void (*))krp->krp_callback, krp, NULL);
>> +    task_add(crypto_taskq, &krp->krp_task);
>> }
>> 
>> int
>> crypto_getfeat(int *featp)
>> {
>> diff --git sys/crypto/cryptodev.h sys/crypto/cryptodev.h
>> index 4f87046..4f732f9 100644
>> --- sys/crypto/cryptodev.h
>> +++ sys/crypto/cryptodev.h
>> @@ -51,11 +51,11 @@
>> 
>> #ifndef _CRYPTO_CRYPTO_H_
>> #define _CRYPTO_CRYPTO_H_
>> 
>> #include <sys/ioccom.h>
>> -#include <sys/workq.h>
>> +#include <sys/task.h>
>> 
>> /* Some initial values */
>> #define CRYPTO_DRIVERS_INITIAL       4
>> #define CRYPTO_DRIVERS_MAX   128
>> #define CRYPTO_SW_SESSIONS   32
>> @@ -158,11 +158,11 @@ struct cryptodesc {
>>      struct cryptodesc *crd_next;
>> };
>> 
>> /* Structure describing complete operation */
>> struct cryptop {
>> -    struct workq_task crp_wqt;
>> +    struct task     crp_task;
>> 
>>      u_int64_t       crp_sid;        /* Session ID */
>>      int             crp_ilen;       /* Input data total length */
>>      int             crp_olen;       /* Result total length */
>>      int             crp_alloctype;  /* Type of buf to allocate if needed */
>> @@ -228,11 +228,11 @@ struct crypt_kop {
>> #define CRF_DSA_SIGN         (1 << CRK_DSA_SIGN)
>> #define CRF_DSA_VERIFY               (1 << CRK_DSA_VERIFY)
>> #define CRF_DH_COMPUTE_KEY   (1 << CRK_DH_COMPUTE_KEY)
>> 
>> struct cryptkop {
>> -    struct workq_task krp_wqt;
>> +    struct task     krp_task;
>> 
>>      u_int           krp_op;         /* ie. CRK_MOD_EXP or other */
>>      u_int           krp_status;     /* return status */
>>      u_short         krp_iparams;    /* # of input parameters */
>>      u_short         krp_oparams;    /* # of output parameters */
> 


Reply via email to