[dpdk-dev] [PATCH v5 1/3] crypto/scheduler: add packet size based mode code

De Lara Guarch, Pablo pablo.de.lara.guarch at intel.com
Wed Mar 29 22:09:45 CEST 2017


Hi Fan,

> -----Original Message-----
> From: Zhang, Roy Fan
> Sent: Wednesday, March 29, 2017 5:26 PM
> To: dev at dpdk.org
> Cc: De Lara Guarch, Pablo; Gonzalez Monroy, Sergio; Doherty, Declan
> Subject: [PATCH v5 1/3] crypto/scheduler: add packet size based mode
> code
> 
> This patch adds the packet size based distribution mode main source
> file.
> 
> Packet-size based distribution mode is a scheduling mode works with 2
> slaves, primary slave and secondary slave, and distribute the enqueued
> crypto ops to them based on their data lengths. A crypto op will be
> distributed to the primary slave if its data length equals or bigger
> than the designated threshold, otherwise it will be handled by the
> secondary slave.
> 
> Signed-off-by: Fan Zhang <roy.fan.zhang at intel.com>
> Series-acked-by: Pablo de Lara <pablo.de.lara.guarch at intel.com>

I haven't acked this patch yet :P. Actually, I have one comment below.

> ---
>  .../crypto/scheduler/scheduler_pkt_size_distr.c    | 410
> +++++++++++++++++++++
>  1 file changed, 410 insertions(+)
>  create mode 100644 drivers/crypto/scheduler/scheduler_pkt_size_distr.c
> 
> diff --git a/drivers/crypto/scheduler/scheduler_pkt_size_distr.c
> b/drivers/crypto/scheduler/scheduler_pkt_size_distr.c
> new file mode 100644
> index 0000000..8da10c8
> --- /dev/null
> +++ b/drivers/crypto/scheduler/scheduler_pkt_size_distr.c

...

> +static uint16_t
> +schedule_enqueue(void *qp, struct rte_crypto_op **ops, uint16_t
> nb_ops)
> +{

...

> +		job_len = ops[i]->sym->cipher.data.length;
> +		job_len += (ops[i]->sym->cipher.data.length == 0) *
> +				ops[i]->sym->auth.data.length;
> +		/* decide the target op based on the job length */
> +		p_enq_op = &enq_ops[!(job_len & qp_ctx->threshold)];
> +		sched_ops[p_enq_op->slave_idx][p_enq_op->pos] = ops[i];
> +		ops[i]->sym->session = sess->sessions[p_enq_op-
> >slave_idx];
> +		p_enq_op->pos++;
> +
> +		/* stop schedule cops before the queue is full, this shall
> +		 * prevent the failed enqueue
> +		 */
> +		if (p_enq_op->pos + in_flight_ops[p_enq_op->slave_idx] >=
> +				qp_ctx->max_nb_objs) {
> +			i = nb_ops;
> +			break;
> +		}

If (in_flight_ops == qp_ctx->max_nb_objs), then you won't even be able to enqueue
a single crypto operation (as the device is completely full), but at this stage, 
you have already modified the session of the operation, so you need to avoid this situation.

Thanks,
Pablo


More information about the dev mailing list