Wednesday, June 27, 2018 4:31 PM, Adrien Mazarguil: > Subject: Re: [PATCH v2 2/7] net/mlx5: remove redundant objects in probe > code > > Hey Shahaf, > > I couldn't reply earlier, sorry for that. See below. > > On Sun, Jun 17, 2018 at 10:14:01AM +0000, Shahaf Shuler wrote: > > Hi Adrien, > > > > Small nit, > > > > Thursday, June 14, 2018 11:35 AM, Adrien Mazarguil: > > > Subject: [PATCH v2 2/7] net/mlx5: remove redundant objects in probe > > > code > > > > > > This patch gets rid of redundant calls to open the device and query > > > its attributes in order to simplify the code. > > > > > > Signed-off-by: Adrien Mazarguil <adrien.mazarg...@6wind.com> > > > -- > > > v2 changes: > > > > > > - Minor indent fix on existing code. > > > --- > > > drivers/net/mlx5/mlx5.c | 64 > > > +++++++++++++++++++++----------------------- > > > 1 file changed, 30 insertions(+), 34 deletions(-) > > > > > > diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index > <snip> > > > @@ -907,7 +904,8 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv > > > __rte_unused, > > > continue; > > > } > > > DRV_LOG(DEBUG, "using port %u", port); > > > - ctx = mlx5_glue->open_device(ibv_dev); > > > + if (!ctx) > > > > Is it really possible for ctx to be NULL on this stage? > > Maybe assert is preferable? > > See below, ctx is only inherited (non-NULL) during the first iteration. It is > reset and reopened for each instance since they need their own dedicated > Verbs context. > > In any case, this patch focuses on removing redundant calls in preparation for > subsequent patches in the series. This code disappears entirely later. > > <snip> > > > + /* > > > + * Each eth_dev instance is assigned its own Verbs context, > > > + * since this one is consumed, let the next iteration open > > > + * another. > > > + */ > > > + ctx = NULL; > > > continue; > > No problem if I leave it that way?
Sure. > > -- > Adrien Mazarguil > 6WIND