Re: [PATCH v5 1/3] crypto/scheduler: add packet size based mode code
From: De Lara Guarch, Pablo <hidden>
Date: 2017-03-29 20:10:17
Hi Fan,
-----Original Message----- From: Zhang, Roy Fan Sent: Wednesday, March 29, 2017 5:26 PM To: dev@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 <redacted> Series-acked-by: Pablo de Lara [off-list ref]
I haven't acked this patch yet :P. Actually, I have one comment below.
quoted hunk ↗ jump to hunk
--- .../crypto/scheduler/scheduler_pkt_size_distr.c | 410 +++++++++++++++++++++ 1 file changed, 410 insertions(+) create mode 100644 drivers/crypto/scheduler/scheduler_pkt_size_distr.cdiff --git a/drivers/crypto/scheduler/scheduler_pkt_size_distr.cb/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-quoted
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