Re: [dpdk-dev] [PATCH 07/11] ethdev: add lock to port allocation check

2018-05-10 Thread Thomas Monjalon
11/05/2018 00:13, Thomas Monjalon: > 10/05/2018 22:35, Stephen Hemminger: > > On Wed, 9 May 2018 14:21:17 +0200 > > Gaëtan Rivet wrote: > > > > > A suggestion about the naming here. > > > Reading subsequent patches, we can see this function being used during > > > ethdev allocation routines. The

Re: [dpdk-dev] [PATCH 07/11] ethdev: add lock to port allocation check

2018-05-10 Thread Stephen Hemminger
On Fri, 11 May 2018 00:10:19 +0200 Thomas Monjalon wrote: > 10/05/2018 22:33, Stephen Hemminger: > > On Wed, 9 May 2018 11:43:33 +0200 > > Thomas Monjalon wrote: > > > > > > > > +struct rte_eth_dev * > > > +rte_eth_dev_allocated(const char *name) > > > +{ > > > + struct rte_eth_dev *ethdev

Re: [dpdk-dev] [PATCH 07/11] ethdev: add lock to port allocation check

2018-05-10 Thread Thomas Monjalon
10/05/2018 22:35, Stephen Hemminger: > On Wed, 9 May 2018 14:21:17 +0200 > Gaëtan Rivet wrote: > > > A suggestion about the naming here. > > Reading subsequent patches, we can see this function being used during > > ethdev allocation routines. The _lock_free suffix is a little > > misleading, as

Re: [dpdk-dev] [PATCH 07/11] ethdev: add lock to port allocation check

2018-05-10 Thread Thomas Monjalon
10/05/2018 22:33, Stephen Hemminger: > On Wed, 9 May 2018 11:43:33 +0200 > Thomas Monjalon wrote: > > > > > +struct rte_eth_dev * > > +rte_eth_dev_allocated(const char *name) > > +{ > > + struct rte_eth_dev *ethdev; > > + > > + rte_eth_dev_shared_data_prepare(); > > + > > + rte_spinlock_

Re: [dpdk-dev] [PATCH 07/11] ethdev: add lock to port allocation check

2018-05-10 Thread Stephen Hemminger
On Wed, 9 May 2018 14:21:17 +0200 Gaëtan Rivet wrote: > A suggestion about the naming here. > Reading subsequent patches, we can see this function being used during > ethdev allocation routines. The _lock_free suffix is a little > misleading, as for an instant one can think that there is somethin

Re: [dpdk-dev] [PATCH 07/11] ethdev: add lock to port allocation check

2018-05-10 Thread Stephen Hemminger
On Wed, 9 May 2018 11:43:33 +0200 Thomas Monjalon wrote: > > +struct rte_eth_dev * > +rte_eth_dev_allocated(const char *name) > +{ > + struct rte_eth_dev *ethdev; > + > + rte_eth_dev_shared_data_prepare(); > + > + rte_spinlock_lock(&rte_eth_dev_shared_data->ownership_lock); > + > +

Re: [dpdk-dev] [PATCH 07/11] ethdev: add lock to port allocation check

2018-05-09 Thread Thomas Monjalon
09/05/2018 14:21, Gaëtan Rivet: > Hi, > > On Wed, May 09, 2018 at 11:43:33AM +0200, Thomas Monjalon wrote: > > From: Matan Azrad > > > > When comparing the port name, there can be a race condition with > > a thread allocating a new port and writing the name at the same time. > > It can lead to m

Re: [dpdk-dev] [PATCH 07/11] ethdev: add lock to port allocation check

2018-05-09 Thread Gaëtan Rivet
Hi, On Wed, May 09, 2018 at 11:43:33AM +0200, Thomas Monjalon wrote: > From: Matan Azrad > > When comparing the port name, there can be a race condition with > a thread allocating a new port and writing the name at the same time. > It can lead to match with a partial name by error. > > The chec

[dpdk-dev] [PATCH 07/11] ethdev: add lock to port allocation check

2018-05-09 Thread Thomas Monjalon
From: Matan Azrad When comparing the port name, there can be a race condition with a thread allocating a new port and writing the name at the same time. It can lead to match with a partial name by error. The check of the port is now considered as a critical section protected with locks. This fi