DPDK patches and discussions
 help / color / mirror / Atom feed
From: Slava Ovsiienko <viacheslavo@mellanox.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: "dev@dpdk.org" <dev@dpdk.org>, Yongseok Koh <yskoh@mellanox.com>,
	Shahaf Shuler <shahafs@mellanox.com>
Subject: Re: [dpdk-dev] [PATCH 1/2] net/mlx5: cache the associated network device ifindex
Date: Fri, 19 Jul 2019 16:41:38 +0000	[thread overview]
Message-ID: <AM4PR05MB326502D8DF4B6ECCB5710840D2CB0@AM4PR05MB3265.eurprd05.prod.outlook.com> (raw)
In-Reply-To: <20190719091544.40294c43@hermes.lan>

> -----Original Message-----
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: Friday, July 19, 2019 19:16
> To: Slava Ovsiienko <viacheslavo@mellanox.com>
> Cc: dev@dpdk.org; Yongseok Koh <yskoh@mellanox.com>; Shahaf Shuler
> <shahafs@mellanox.com>
> Subject: Re: [PATCH 1/2] net/mlx5: cache the associated network device
> ifindex
> 
> On Fri, 19 Jul 2019 05:31:44 +0000
> Viacheslav Ovsiienko <viacheslavo@mellanox.com> wrote:
> 
> > +	/*
> > +	 * Store associated network device interface index. This index
> > +	 * is permanent throughout the lifetime of device. We do not spawn
> > +	 * rte_eth_dev ports without associated network device, and if
> > +	 * network device is being unbound we get the remove notification
> > +	 * message and rte_eth_dev port is also detached. So, we may store
> > +	 * the ifindex here and use the cached value further. The network
> > +	 * device name can be changed dynamically and should not be
> cached.
> > +	 */
> > +	assert(spawn->ifindex);
> > +	priv->if_index = spawn->ifindex;
> 
> This correct, but overkill.
> 
> 1. The comment is way too wordy. Please stick to only a couple of lines.
>    If you feel more explanation is necessary put that in the commit log.

I'd prefer to see the issue description in the source,  not by searching the git log
for the appropriate commit. But OK, it does not matter.
 
> 2. It is perfectly okay to return 0 as a value in dev_info.
>    Therefore the assert is unnecessary.

Valid network interface index cannot be zero. For example, if_nametoindex()
returns zero in case of error. Also, in mlx5 we do not spawn ports without attached
network interfaces. Assert is not related to dev_info, it checks whether
the mlx5_dev_spawn() is called with valid ifindex for valid port (ifindex checked
against zero to validate infiniband port is active). We need this assert here.

> 3. Where is "Reported-by:"
It is in cover letter:
"Proposed-by: Stephen Hemminger <stephen@networkplumber.org>"
 Sorry, I forgot to add this one in commit message, will fix.

> 4. What was wrong with my simpler patch?
Please, see the cover letter. Your patch fixes only the part of problem -
the mlx5_dev_infos_get(). But it is just the case of unsafe mlx5_ifindex() usage.
mlx5_ifindex() itself must be fixed instead.

WBR, Slava

  reply	other threads:[~2019-07-19 16:41 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-12 20:54 [dpdk-dev] [PATCH 0/2] fix dev_info_get in mlx secondary process Stephen Hemminger
2019-07-12 20:54 ` [dpdk-dev] [PATCH 1/2] net/mlx4: fix crash in dev_info_get in " Stephen Hemminger
2019-07-30 13:48   ` Matan Azrad
2019-08-04  6:57   ` Raslan Darawsheh
2019-08-05  7:42     ` Raslan Darawsheh
2019-07-12 20:54 ` [dpdk-dev] [PATCH 2/2] net/mlx5: " Stephen Hemminger
2019-07-15  7:41   ` Slava Ovsiienko
2019-07-19  5:31   ` [dpdk-dev] [PATCH 0/2] net/mlx5: cache the associated network device ifindex Viacheslav Ovsiienko
2019-07-19  5:31     ` [dpdk-dev] [PATCH 1/2] " Viacheslav Ovsiienko
2019-07-19 16:15       ` Stephen Hemminger
2019-07-19 16:41         ` Slava Ovsiienko [this message]
2019-07-19 18:03           ` Stephen Hemminger
2019-07-19 18:31             ` Slava Ovsiienko
2019-07-19  5:31     ` [dpdk-dev] [PATCH 2/2] Revert "net/mlx5: fix master device Netlink socket sharing" Viacheslav Ovsiienko
2019-07-19 16:16       ` Stephen Hemminger
2019-07-19 16:21         ` Slava Ovsiienko
2019-07-19 16:23           ` Stephen Hemminger
2019-07-21 14:56     ` [dpdk-dev] [PATCH v2 0/2] net/mlx5: cache the associated network device ifindex Viacheslav Ovsiienko
2019-07-21 14:56       ` [dpdk-dev] [PATCH v2 1/2] " Viacheslav Ovsiienko
2019-07-22  5:52         ` Yongseok Koh
2019-07-21 14:56       ` [dpdk-dev] [PATCH v2 2/2] Revert "net/mlx5: fix master device Netlink socket sharing" Viacheslav Ovsiienko
2019-07-22  5:53         ` Yongseok Koh
2019-07-22  8:43       ` [dpdk-dev] [PATCH v2 0/2] net/mlx5: cache the associated network device ifindex Raslan Darawsheh
2019-07-31  7:36   ` [dpdk-dev] [PATCH 2/2] net/mlx5: fix crash in dev_info_get in secondary process Raslan Darawsheh
2019-07-31 13:47     ` Stephen Hemminger

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=AM4PR05MB326502D8DF4B6ECCB5710840D2CB0@AM4PR05MB3265.eurprd05.prod.outlook.com \
    --to=viacheslavo@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=shahafs@mellanox.com \
    --cc=stephen@networkplumber.org \
    --cc=yskoh@mellanox.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).