DPDK patches and discussions
 help / color / mirror / Atom feed
From: Akhil Goyal <akhil.goyal@nxp.com>
To: Declan Doherty <declan.doherty@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>,
	 "De Lara Guarch, Pablo" <pablo.de.lara.guarch@intel.com>,
	<deepak.k.jain@intel.com>
Cc: "hemant.agrawal@nxp.com" <hemant.agrawal@nxp.com>,
	"Trahe, Fiona" <fiona.trahe@intel.com>
Subject: Re: [dpdk-dev] cryptodev - Session and queue pair relationship
Date: Mon, 13 Feb 2017 20:08:57 +0530	[thread overview]
Message-ID: <ae911a68-af2f-320c-e351-f327031e26f2@nxp.com> (raw)
In-Reply-To: <2d48b97f-bb39-09e9-5ea2-1fc265459a87@intel.com>

On 2/8/2017 2:22 AM, Declan Doherty wrote:
> On 06/02/17 13:35, Akhil Goyal wrote:
>> Hi,
>>
> Hey Akhil, see my thoughts inline
>
>> I have some issues w.r.t the mapping sessions and queue pairs.
>>
>> As per my understanding:
>> - Number of sessions may be large – they are independent of number of
>> queue pairs
>
> Yes, cryptodev assumes no implicit connection between sessions and
> queue pairs, the current PMDs just use the crypto session to store the
> immutable data (keys etc) for a particular crypto transform or chain of
> transforms in a format specific to that PMD with no statefull information.
>
>> - Queue pairs are L-core specific
>
> Not exactly, queue pairs like ethdev queues are not thread safe, so we
> assume that only a single l-core will be using a queue pair at any time
> unless the application layer has introduce a locking mechanism to
> provide thread safety.
>
>> - Depending on the implementation, one queue pair can be mapped to many
>> sessions. Or, Only one queue pair for every session- especially in the
>> systems having large number of queues (hw).
>
> Currently none of the software crypto PMDs or Intel QuickAssist hardware
> accelerated PMD make any assumptions regarding coupling/mapping of
> sessions to queue pairs, so today a users could freely change the queue
> pair which a session is processed on, or even go as far using the  ame
> session for processing on different queue simultaneously as the sessions
> are stateless, obviously this could introduce issues for statefull
> higher level protocol using the cryptodev PMD service but the cryptodev
> API doesn't prohibit this usage model.
>
>
>> - Sessions can be created on the fly – typical rekeying use-cases.
>> Generally done by the control threads.
>>
>
> Sure, there is no restriction on session creation other than an element
> being free in the mempool which the session is being created on.
>
>> There seems to be no straight way for the underlying driver
>> implementation to know, what all sessions are mapped to a particular
>> queue pair. The session and queue pair information is first time exposed
>> in the enqueue command.
>>
>> One of the NXP Crypto Hardware drivers uses per session data structures
>> (descriptors) which need to be configured for hardware queues.  Though
>> this information can be extracted from the first enqueue command for a
>> particular session, it will add checks in the data path. Also, it will
>> bring down the connection setup rate.
>
> We haven't had to support this model of coupling sessions to queue pairs
> in any PMDs before. If I understand correctly, in the hardware model you
> need to support a queue pair can only be configured to support the
> processing of a single session at any one time and it only supports that
> session until it is reconfigured, is this correct? So if a session needs
> to be re-keyed the queue pair would need to be reconfigured?
yes it is correct.
>
>>
>> In the API rte_cryptodev_sym_session_create(), we create session on a
>> particular device, but there is no information of queue pair being
>> shared.
>>
>> 1. We want to propose to change the session create/config API to also
>> take queue pair id as argument.
>> struct rte_cryptodev_sym_session *
>> rte_cryptodev_sym_session_create(uint8_t dev_id,
>>                               struct rte_crypto_sym_xform *xform) to
>> also take “uint16_t qp;”
>>
>> This will also return “in-use” error, if the underlying hardware only
>> support 1 session/descriptor per qp.
>
> I my mind the idea of coupling the session_create function to the queue
> pair of a device doesn't feel right as it would certainly put
> unnecessary constraint on all existing PMDs queue pairs.
>
> One possible approach would be to extend the the queue_pair_setup
> function to take an opaque parameter which would allow you to pass a
> session through and would be  an approach more in keeping with the
> cryptodev current model, but you would then still need to verify that
> the operations being enqueued have the same session as the configured
> device, assuming that the packet are being enqueued from the host.
>
> If you need to re-key or change the session you could re-initialize the
> queue pair while the device is still active, but stopping the queue pair.
>
> Following a sequence something like:
> stop_qp()
> setup_qp()
> start_qp()
>
>
> Another option Fiona suggested would be to add 2 new APIs
>
> rte_cryptodev_queue_pair_attach_sym_session/queue_pair_detach_sym_session this
> would allow dynamic attaching of one or more sessions to device if it
> supported this sort of static mapping of sessions to queue pairs.
>
>
>>
>> 2. Currently the application configures the *nb_descriptors* in the
>> *rte_cryptodev_queue_pair_setup*. Should we add the queue pair
>> capability API?
>>
>
> Regarding capabilities, I think this should be just propagated through
> the device capabilities, something like a max number of session mapped
> per queue pair, which would be zero for all/most current devices, and
> could be 1 or greater for your device. This is assuming that all queue
> pairs can all support the same crypto transforms capabilities and that
> different queue pairs have different capabilities which could get very
> messy to discover.
>
>>
>> Please share your feedback, I will submit the patch accordingly.
>>
>> Regards,
>> Akhil
>>
>>
>>
>
>
Thanks for your feedback Declan,
The suggestion from Fiona looks good. Should I send the patch for this 
or is it already in discussion in some different thread?

Also, if this new API is added, there would be corresponding change in 
the ipsec-secgw application as well.
This API should be optional and underlying implementation may or may not 
implement this API.

Regards,
Akhil

  reply	other threads:[~2017-02-13 14:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-06 13:35 Akhil Goyal
2017-02-07 20:52 ` Declan Doherty
2017-02-13 14:38   ` Akhil Goyal [this message]
2017-02-13 14:44     ` Trahe, Fiona
2017-02-13 15:09       ` Trahe, Fiona
2017-02-14 11:43     ` Sergio Gonzalez Monroy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ae911a68-af2f-320c-e351-f327031e26f2@nxp.com \
    --to=akhil.goyal@nxp.com \
    --cc=declan.doherty@intel.com \
    --cc=deepak.k.jain@intel.com \
    --cc=dev@dpdk.org \
    --cc=fiona.trahe@intel.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=pablo.de.lara.guarch@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).