DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>
To: "Trahe, Fiona" <fiona.trahe@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: "De Lara Guarch, Pablo" <pablo.de.lara.guarch@intel.com>,
	Akhil Goyal <akhil.goyal@nxp.com>,
	"Doherty, Declan" <declan.doherty@intel.com>,
	"Ravi Kumar" <ravi1.kumar@amd.com>,
	Jerin Jacob <jerin.jacob@caviumnetworks.com>,
	"Zhang, Roy Fan" <roy.fan.zhang@intel.com>,
	Tomasz Duszynski <tdu@semihalf.com>,
	Hemant Agrawal <hemant.agrawal@nxp.com>,
	Natalie Samsonov <nsamsono@marvell.com>,
	Dmitri Epshtein <dima@marvell.com>,
	Jay Zhou <jianjay.zhou@huawei.com>,
	"Zhang, Roy Fan" <roy.fan.zhang@intel.com>
Subject: Re: [dpdk-dev] [RFC] cryptodev: proposed changes in rte_cryptodev_sym_session
Date: Wed, 14 Nov 2018 08:35:17 +0000	[thread overview]
Message-ID: <2601191342CEEE43887BDE71AB977258010CEB62FB@IRSMSX106.ger.corp.intel.com> (raw)
In-Reply-To: <348A99DA5F5B7549AA880327E580B43589677E12@IRSMSX101.ger.corp.intel.com>


> > > > @@ -1301,8 +1346,7 @@ rte_cryptodev_sym_session_free(struct rte_cryptodev_sym_session *sess)
> > > >
> > > >  	/* Check that all device private data has been freed */
> > > >  	for (i = 0; i < nb_drivers; i++) {
> > > [Fiona] Use the sess.nb_drivers rather than the global.
> >
> > Ok, though doesn't really matter here.
> > get_sym_session_private_data() will return NULL for invalid index anyway.
> [Fiona] Except that you removed the NULL check below and are using that
> invalid index to deref the array.

Ah yes, you right - have to use sess.nb_drivers here.

> 
> > > Actually maybe name slightly differently to reduce the chance of that mistake happening, e.g.
> > > rename sess.nb_drivers to sess.num_drivers?
> > >
> > > > -		sess_priv = get_sym_session_private_data(sess, i);
> > > > -		if (sess_priv != NULL)
> > > > +		if (sess->sess_data[i].refcnt != 0)
> > > >  			return -EBUSY;
> > > >  	}
> > > >
> > > > @@ -1313,6 +1357,23 @@ rte_cryptodev_sym_session_free(struct rte_cryptodev_sym_session *sess)
> > > >  	return 0;
> > > >  }
> > > >
> > > > +unsigned int
> > > > +rte_cryptodev_sym_session_max_data_size(void)
> > > [Fiona] Suggest renaming this
> > > rte_cryptodev_sym_session_max_array_size()
> >
> > I usually don't care much about names, but that seems just confusing:
> > totally unclear which array we are talking about.
> > Any better naming ideas?
> [Fiona] Isn't it returning the size of the array of structs in the session hdr?
> Seems a bit more informative than "data".

Yes, but user doesn't have to know it is an array of pointers or
something different.

> Can't think of anything better, if you find array confusing then I
> don't feel that strongly about it, stick with data.
> Or just get rid of the function altogether and put inside
> rte_cryptodev_sym_session_max_size()
> Unless it's called elsewhere.

Sounds like a good option.
Konstantin

  reply	other threads:[~2018-11-14  8:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-24 17:48 Konstantin Ananyev
2018-10-05 11:05 ` Ananyev, Konstantin
2018-11-12 21:01 ` Trahe, Fiona
2018-11-12 23:16   ` Trahe, Fiona
2018-11-12 23:24     ` Trahe, Fiona
2018-11-13 18:56       ` Ananyev, Konstantin
2018-11-13 18:56   ` Ananyev, Konstantin
2018-11-14  0:46     ` Trahe, Fiona
2018-11-14  8:35       ` Ananyev, Konstantin [this message]
2018-11-14 10:14       ` Zhang, Roy Fan

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=2601191342CEEE43887BDE71AB977258010CEB62FB@IRSMSX106.ger.corp.intel.com \
    --to=konstantin.ananyev@intel.com \
    --cc=akhil.goyal@nxp.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    --cc=dima@marvell.com \
    --cc=fiona.trahe@intel.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=jerin.jacob@caviumnetworks.com \
    --cc=jianjay.zhou@huawei.com \
    --cc=nsamsono@marvell.com \
    --cc=pablo.de.lara.guarch@intel.com \
    --cc=ravi1.kumar@amd.com \
    --cc=roy.fan.zhang@intel.com \
    --cc=tdu@semihalf.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).