Hi, > -----Original Message----- > From: Kusztal, ArkadiuszX <arkadiuszx.kusz...@intel.com> > Sent: Thursday, February 13, 2020 2:51 PM > To: Trahe, Fiona <fiona.tr...@intel.com>; Thomas Monjalon > <tho...@monjalon.net> > Cc: David Marchand <david.march...@redhat.com>; nhor...@tuxdriver.com; > bl...@debian.org; > ktray...@redhat.com; Ray Kinsella <m...@ashroe.eu>; dev@dpdk.org; Akhil Goyal > <akhil.go...@nxp.com>; Yigit, Ferruh <ferruh.yi...@intel.com>; Ananyev, > Konstantin > <konstantin.anan...@intel.com>; dev@dpdk.org; Anoob Joseph > <ano...@marvell.com>; > Richardson, Bruce <bruce.richard...@intel.com>; Mcnamara, John > <john.mcnam...@intel.com>; > do...@seketeli.net; Andrew Rybchenko <arybche...@solarflare.com>; > acon...@redhat.com > Subject: RE: [dpdk-dev] [PATCH v2 4/4] add ABI checks > > Hi, > > Two comments from me, > > > > > The patch we're working on will provide two versions of > > > > rte_cryptodev_info_get(), both call the same PMD function from the > > dev_ops info_get fn ptr. > > > > The default version operates s as normal, the 19.11 version searches > > > > through the list returned by the PMD, looking for sym.aead.algo = > > > > ChaChaPoly, it needs to strip it from > > > the list. > > > > As PMDs just pass a ptr to their capabilities list ( it isn't a > > > > linked list, but an array with an end marker = > > > > RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST) if the API layer detects > > > > Chacha it must allocate some space and store a local copy of the trimmed > > list. This must be stored only once per device. > [Arek] The problem with this solution is that we need to allocate memory. > So the question is how to handle unlikely case of malloc error when we > operate inside void function > rte_cryptodev_info_get? > And even if we would pass somehow error condition to the caller then what to > do is another question. [Fiona] Quick recap: To avoid breaking ABI, we must return a set of capabilities with/without ChaChaPoly depending on the appl version. To resolve this, within the rte_cryptodev layer, we propose to inspect the capabilities returned by PMD and strip ChaCha if it exists. In that case memory for the new trimmed capabilities array has to be malloced by the lib. All good, except how to handle a malloc fail is yet another API breakage as rte_cryptodev_get_info() returns void. We propose to return an empty capability list, i.e. a list with only the END element (which can be done without malloc) in this corner case of a corner case. Anyone see any issue with this?
> > > > > > > I don't understand what you have to store. > > > Can't you just set the algo to 0 if it is ChaCha? > > [Fiona] it returns a pointer to data in the PMD domain, which the API > > couldn't > > and shouldn't overwrite, e.g. > > static const struct rte_cryptodev_capabilities qat_gen3_sym_capabilities[] > Should we print user some information > > > > > > > > > This versioning will apply to any PMD which wants to take advantage > > > > of the new API between now and > > > 20.11. > > > > > > > > Note, I expect the ABI checker tools will still complain of ABI > > > > breakage as the LIST_END value will still > > > change. > > > > > > Right, you need to update the ignore list for the tool. > > > > > > > We are also reviewing all other cryptodev APIs in case there is any > > > > other > > API which needs versioning. > > > > > > > > Anyone see any problem with this approach? > > > > > > The other issue is with all other functions accepting this enum as input. > > > We should continue returning an error if getting Chacha as input with > > > 19.11 version of these functions. > > > But I would tend to consider this small ABI breakage can be ignored as > > > it is in the error path. > > [Fiona] The QAT PMD tests for and handles this error. I expect other PMDs > > do too. > [Arek] - Yes, it is error path but on the other hand we explicitly specify > what value we will return when > calling > rte_cryptodev_sym_session_init so caller may expect EINVAL when wrong > algorithm value selected > (usually it probably will be ENOTSUP). > In this case when setting 3 (LIST_END) on 19.11 app and linking against 20.02 > (assuming with Chacha) > shared build, caller would get success on return and fully set chacha session, > which will probably result in undefined behavior. > So shouldn't this function be versioned as well then? [Fiona] I would agree with Tomas to ignore this small ABI break, as it is already an error case if a appl is passing in a bad value for the algorithm. Even if it does return SUCCESS, instead of ENOTSUP, what behaviour could the application be expecting with a session using LIST_END as an algo? > > Regards, > Arek > >