[dpdk-dev] [dpdk-dev v10 2/4] cryptodev: add raw crypto data-path APIs

Akhil Goyal akhil.goyal at nxp.com
Thu Oct 8 18:07:43 CEST 2020


> > > +During the enqueue, the cryptodev driver only sets the enqueued
> > descriptors
> > > +into the device queue but not initiates the device to start processing them.
> > > +The temporary queue pair data changes in relation to the enqueued
> > descriptors
> > > +may be recorded in the ``struct rte_crypto_raw_dp_ctx`` buffer as the
> > > reference
> > > +to the next enqueue function call. When
> > ``rte_cryptodev_raw_enqueue_done``
> > > is
> > > +called, the driver will initiate the processing of all enqueued descriptors
> > and
> > > +merge the temporary queue pair data changes into the driver's private
> > queue
> > > +pair data. Calling ``rte_cryptodev_raw_configure_dp_context`` twice
> > without
> > > +``rte_cryptodev_dp_enqueue_done`` call in between will invalidate the
> > > temporary
> > > +data stored in ``struct rte_crypto_raw_dp_ctx`` buffer. This feature is
> > useful
> > > +when the user wants to abandon partially enqueued data for a failed
> > enqueue
> > > +burst operation and try enqueuing in a whole later.
> >
> > This feature may not be supported by all the HW PMDs, Can there be a way
> > to bypass
> > this done API?
> 
> We can add another feature flag
> "RTE_CRYPTODEV_FF_SYM_HW_RAW_DP_ALLOW_CACHE". The PMDs who
> do not support this feature can simply return "- ENOTSUP" when calling
> enqueue_done and dequeue_done function. What do you think?

Can the enqueue/dequeue API return a flag which decide whether
to call done API or not?
Returning ENOTSUP will break the execution.


> > > +int
> > > +rte_cryptodev_raw_configure_dp_context(uint8_t dev_id, uint16_t
> > qp_id,
> > > +	struct rte_crypto_raw_dp_ctx *ctx)
> >
> > rte_cryptodev_configure_raw_dp_ctx
> >
> > > +{
> > > +	struct rte_cryptodev *dev;
> > > +	union rte_cryptodev_session_ctx sess_ctx = {NULL};
> > > +
> > > +	if (!rte_cryptodev_get_qp_status(dev_id, qp_id))
> > > +		return -EINVAL;
> > > +
> > > +	dev = rte_cryptodev_pmd_get_dev(dev_id);
> > > +	if (!(dev->feature_flags & RTE_CRYPTODEV_FF_SYM_HW_RAW_DP)
> > > +			|| dev->dev_ops->configure_dp_ctx == NULL)
> > > +		return -ENOTSUP;
> > > +
> > > +	return (*dev->dev_ops->configure_dp_ctx)(dev, qp_id,
> > > +			RTE_CRYPTO_OP_WITH_SESSION, sess_ctx, ctx);
> > > +}
> > > +
> > > +int
> > > +rte_cryptodev_raw_attach_session(uint8_t dev_id, uint16_t qp_id,
> > > +	struct rte_crypto_raw_dp_ctx *ctx,
> > > +	enum rte_crypto_op_sess_type sess_type,
> > > +	union rte_cryptodev_session_ctx session_ctx)
> > > +{
> > > +	struct rte_cryptodev *dev;
> > > +
> > > +	if (!rte_cryptodev_get_qp_status(dev_id, qp_id))
> > > +		return -EINVAL;
> > > +
> > > +	dev = rte_cryptodev_pmd_get_dev(dev_id);
> > > +	if (!(dev->feature_flags & RTE_CRYPTODEV_FF_SYM_HW_RAW_DP)
> > > +			|| dev->dev_ops->configure_dp_ctx == NULL)
> > > +		return -ENOTSUP;
> > > +	return (*dev->dev_ops->configure_dp_ctx)(dev, qp_id, sess_type,
> > > +			session_ctx, ctx);
> >
> > What is the difference between rte_cryptodev_raw_configure_dp_context
> > and
> > rte_cryptodev_raw_attach_session?
> > And if at all it is needed, then it should be
> > rte_cryptodev_attach_raw_dp_session.
> > IMO attach is not needed, I am not clear about it.
> >
> > You are calling the same dev_ops for both - one with explicit session time
> > and other
> > From an argument.
> 
> rte_cryptodev_raw_configure_dp_context creates a shadow copy of the queue
> pair data with in ctx, where rte_cryptodev_raw_attach_session sets the function
> handler based on the session data. Using of the same PMD callback function is
> to
> save one function pointer stored in the dev_ops. If you don't like it I can create
> 2 callback functions no problem.

I don't like the idea of having 2 APIs.

Why do you need to create a shadow copy of the queue data? Why it can't be
Done in the attach API by the driver? In v9 it was doing that, why is it changed?




More information about the dev mailing list