From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id 921F11B5E9 for ; Sat, 24 Nov 2018 19:08:04 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 13F0621CFC; Sat, 24 Nov 2018 13:08:04 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Sat, 24 Nov 2018 13:08:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=mesmtp; bh=Lmkv2O/6gRFGka0hecQ4H6sNM05vSqSFA2C9DqRwRl8=; b=ZnUTnA4RE+CM t6hca1pF9mhqnKAeh+kPHW136r/gCvhRokOM+qLZYxsEggWNCwXD4fncHVovoDqi 2nVmhNm+GGZnhbq++fJzRaktEq0u66lcHOf7gVR6yP/UzxPBxWF1i03hTMdX/cBV g2mOSUTJvP+AeOpdjxWu2xvd1SziHU4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=Lmkv2O/6gRFGka0hecQ4H6sNM05vSqSFA2C9DqRwR l8=; b=Jmr2TXYB8BbrF39DwjQqiDYPymTq8ShKSXiKOcgpdBMK7hby/2t1iquXc qP71DcHy0J1q51c5XmNtRjPC3r/8KI/E8prUXl3fKKEm/LPbSj8xbuVrXB62iv7o rmTyjvikhXq/ee0KxIRN1wa/4vJdqaEqWDi2E3apkS1xNa48iJ6Nwr/3OUt4Na4Q zutEoOQoFpwOrXcP3tC8y9DbThXhD1bpghBkss+G3YVTqNLmgFshYHGxZnKSywLB ZCaQ89v4jJNq1f8XBvYLQkMvaTMg36NSZQRZ5wBnLr2fCw4YF8Bo/zSMQ8K1tEZ8 wZpqGWG1WcvtNK3hmrCpa+ZquYmKA== X-ME-Sender: X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 2398F102DE; Sat, 24 Nov 2018 13:08:00 -0500 (EST) From: Thomas Monjalon To: "Ananyev, Konstantin" Cc: dev@dpdk.org, "Joseph, Anoob" , Akhil Goyal , Ravi Kumar , "Jacob, Jerin" , "Doherty, Declan" , "Trahe, Fiona" , Tomasz Duszynski , Dmitri Epshtein , Natalie Samsonov , Jay Zhou , "Athreya, Narayana Prasad" , "Verma, Shally" , "Dwivedi, Ankur" Date: Sat, 24 Nov 2018 19:07:57 +0100 Message-ID: <6921091.9xEsaLRtPN@xps> In-Reply-To: References: <1539267624-31373-1-git-send-email-konstantin.ananyev@intel.com> <2601191342CEEE43887BDE71AB977258010CEB7477@IRSMSX106.ger.corp.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH] doc: cryptodev deprecation notice for sym session changes X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Nov 2018 18:08:04 -0000 14/11/2018 11:12, Joseph, Anoob: > From: Ananyev, Konstantin > > > > Hi Anoob, > > > > > > > > Hi Akhil, Konstantin, > > > > > > Wouldn't the new element, userdata, conflict with the one referred by > > > > > > rte_cryptodev_sym_session_set_user_data() > > > rte_cryptodev_sym_session_get_user_data() > > > > > > Do you mind a name change for either? Or do you have a clear picture of when > > one should be used over the other? > > > > Yes, Fiona also pointed to that naming collision. > > Current suggestion is to name this new element 'opaque_data' or so. > > Konstantin > > > > > > > > Thanks, > > > Anoob > > > > > > From: Akhil Goyal > > > > On 10/11/2018 7:50 PM, Konstantin Ananyev wrote: > > > > > Below are details and reasoning for proposed changes. > > > > > > > > > > 1.rte_cryptodev_sym_session_init()/ rte_cryptodev_sym_session_clear() > > > > > operate based on cytpodev device id, though inside > > > > > rte_cryptodev_sym_session device specific data is addressed > > > > > by driver id (not device id). > > > > > That creates a problem with current implementation when we have > > > > > two or more devices with the same driver used by the same session. > > > > > Consider the following example: > > > > > > > > > > struct rte_cryptodev_sym_session *sess; > > > > > rte_cryptodev_sym_session_init(dev_id=X, sess, ...); > > > > > rte_cryptodev_sym_session_init(dev_id=Y, sess, ...); > > > > > rte_cryptodev_sym_session_clear(dev_id=X, sess); > > > > > > > > > > After that point if X and Y uses the same driver, > > > > > then sess can't be used by device Y any more. > > > > > The reason for that - driver specific (not device specific) > > > > > data per session, plus there is no information > > > > > how many device instances use that data. > > > > > Probably the simplest way to deal with that issue - > > > > > add a reference counter per each driver data. > > > > > > > > > > 2.rte_cryptodev_sym_session_set_user_data() and > > > > > rte_cryptodev_sym_session_get_user_data() - > > > > > with current implementation there is no defined way for the user to > > > > > determine what is the max allowed size of the private data. > > > > > rte_cryptodev_sym_session_set_user_data() just blindly copies > > > > > user provided data without checking memory boundaries violation. > > > > > To overcome that issue propose to add 'uint16_t priv_size' into > > > > > rte_cryptodev_sym_session structure. > > > > > > > > > > 3.rte_cryptodev_sym_session contains an array of variable size for > > > > > driver specific data. > > > > > Though number of elements in that array is determined by static > > > > > variable nb_drivers, that could be modified by > > > > > rte_cryptodev_allocate_driver(). > > > > > That construction seems to work ok so far, as right now users register > > > > > all their PMDs at startup, though it doesn't mean that it would always > > > > > remain like that. > > > > > To make it less error prone propose to add 'uint16_t nb_drivers' > > > > > into the rte_cryptodev_sym_session structure. > > > > > At least that allows related functions to check that provided > > > > > driver id wouldn't overrun variable array boundaries, > > > > > again it allows to determine size of already allocated session > > > > > without accessing global variable. > > > > > > > > > > 4.#2 and #3 above implies that now each struct > > rte_cryptodev_sym_session > > > > > would have sort of readonly type data (init once at allocation time, > > > > > keep unmodified through session life-time). > > > > > That requires more changes in current cryptodev implementation: > > > > > Right now inside cryptodev framework both rte_cryptodev_sym_session > > > > > and driver specific session data are two completely different sctrucures > > > > > (e.g. struct cryptodev_sym_session and struct null_crypto_session). > > > > > Though current cryptodev implementation implicitly assumes that driver > > > > > will allocate both of them from within the same mempool. > > > > > Plus this is done in a manner that they override each other fields > > > > > (reuse the same space - sort of implicit C union). > > > > > That's probably not the best programming practice, > > > > > plus make impossible to have readonly fields inside both of them. > > > > > To overcome that situation propose to changed an API a bit, to allow > > > > > to use two different mempools for these two distinct data structures. > > > > > > > > > > 5. Add 'uint64_t userdata' inside struct rte_cryptodev_sym_session. > > > > > I suppose that self-explanatory, and might be used in a lot of places > > > > > (would be quite useful for ipsec library we develop). > > > > > > > > > > The new proposed layout for rte_cryptodev_sym_session: > > > > > struct rte_cryptodev_sym_session { > > > > > uint64_t userdata; > > > > > /**< Can be used for external metadata */ > > > > > uint16_t nb_drivers; > > > > > /**< number of elements in sess_data array */ > > > > > uint16_t priv_size; > > > > > /**< session private data will be placed after sess_data */ > > > > > __extension__ struct { > > > > > void *data; > > > > > uint16_t refcnt; > > > > > } sess_data[0]; > > > > > /**< Driver specific session material, variable size */ > > > > > }; > > > > > > > > > > Signed-off-by: Konstantin Ananyev > > > > > > > > Adding maintainers to ack this deprecation notice. These changes > > > > will impact all the PMDs and everyone should agree to these changes. > > > > > > > > from NXP dpaa_sec, dpaa2_sec, caam_jr PMDs: > > > > > > > > Acked-by: Akhil Goyal > > With the naming changes, > Acked-by: Anoob Joseph Applied