DPDK patches and discussions
 help / color / mirror / Atom feed
From: Raslan Darawsheh <rasland@mellanox.com>
To: Stephen Hemminger <stephen@networkplumber.org>,
	Matan Azrad <matan@mellanox.com>,
	Shahaf Shuler <shahafs@mellanox.com>,
	Yongseok Koh <yskoh@mellanox.com>,
	Slava Ovsiienko <viacheslavo@mellanox.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	"sju@paloaltonetworks.com" <sju@paloaltonetworks.com>
Subject: Re: [dpdk-dev] [PATCH 2/2] net/mlx5: fix crash in dev_info_get in	secondary process
Date: Wed, 31 Jul 2019 07:36:26 +0000	[thread overview]
Message-ID: <DB3PR0502MB39648ABBBD04C1827B1E1A64C2DF0@DB3PR0502MB3964.eurprd05.prod.outlook.com> (raw)
In-Reply-To: <20190712205425.17781-3-stephen@networkplumber.org>

Hi Stephen,

Can you please confirm that Slava's patch fixed your issue and this patch is not needed anymore for MLX5?
So that I can take mlx4 patch only from this series?

Kindest regards,
Raslan Darawsheh

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Stephen Hemminger
> Sent: Friday, July 12, 2019 11:54 PM
> To: Matan Azrad <matan@mellanox.com>; Shahaf Shuler
> <shahafs@mellanox.com>; Yongseok Koh <yskoh@mellanox.com>; Slava
> Ovsiienko <viacheslavo@mellanox.com>
> Cc: dev@dpdk.org; sju@paloaltonetworks.com; Stephen Hemminger
> <stephen@networkplumber.org>
> Subject: [dpdk-dev] [PATCH 2/2] net/mlx5: fix crash in dev_info_get in
> secondary process
> 
> mlx5_dev_info_get calls mlx5_get_ifname, but mlx5_get_ifname
> uses priv->ctx which is not a valid pointer in a secondary
> process. The fix is to cache the value in primary.
> 
> In the primary process, get and store the interface index of
> the device so that secondary process can see it.
> 
> Fixes: e60fbd5b24fc ("mlx5: add device configure/start/stop")
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  drivers/net/mlx5/mlx5.c        | 17 ++++++++---------
>  drivers/net/mlx5/mlx5.h        |  1 +
>  drivers/net/mlx5/mlx5_ethdev.c |  4 +---
>  3 files changed, 10 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
> index d93f92db56b5..27c5ef9b1763 100644
> --- a/drivers/net/mlx5/mlx5.c
> +++ b/drivers/net/mlx5/mlx5.c
> @@ -1105,6 +1105,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
>  	int own_domain_id = 0;
>  	uint16_t port_id;
>  	unsigned int i;
> +	char ifname[IF_NAMESIZE];
> 
>  	/* Determine if this port representor is supposed to be spawned. */
>  	if (switch_info->representor && dpdk_dev->devargs) {
> @@ -1479,18 +1480,16 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
>  		mac.addr_bytes[0], mac.addr_bytes[1],
>  		mac.addr_bytes[2], mac.addr_bytes[3],
>  		mac.addr_bytes[4], mac.addr_bytes[5]);
> -#ifndef NDEBUG
> -	{
> -		char ifname[IF_NAMESIZE];
> 
> -		if (mlx5_get_ifname(eth_dev, &ifname) == 0)
> -			DRV_LOG(DEBUG, "port %u ifname is \"%s\"",
> +	if (mlx5_get_ifname(eth_dev, &ifname) == 0) {
> +		priv->if_index = if_nametoindex(ifname);
> +		DRV_LOG(DEBUG, "port %u ifname is \"%s\"",
>  				eth_dev->data->port_id, ifname);
> -		else
> -			DRV_LOG(DEBUG, "port %u ifname is unknown",
> -				eth_dev->data->port_id);
> +	} else {
> +		DRV_LOG(DEBUG, "port %u ifname is unknown",
> +			eth_dev->data->port_id);
>  	}
> -#endif
> +
>  	/* Get actual MTU if possible. */
>  	err = mlx5_get_mtu(eth_dev, &priv->mtu);
>  	if (err) {
> diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
> index 5af3f413cdcb..a06ffd444255 100644
> --- a/drivers/net/mlx5/mlx5.h
> +++ b/drivers/net/mlx5/mlx5.h
> @@ -342,6 +342,7 @@ struct mlx5_priv {
>  	uint16_t vlan_filter[MLX5_MAX_VLAN_IDS]; /* VLAN filters table. */
>  	unsigned int vlan_filter_n; /* Number of configured VLAN filters. */
>  	/* Device properties. */
> +	unsigned int if_index; /* Associated kernel network device index. */
>  	uint16_t mtu; /* Configured MTU. */
>  	unsigned int isolated:1; /* Whether isolated mode is enabled. */
>  	unsigned int representor:1; /* Device is a port representor. */
> diff --git a/drivers/net/mlx5/mlx5_ethdev.c
> b/drivers/net/mlx5/mlx5_ethdev.c
> index eeefe4df3cd4..41e58db5e573 100644
> --- a/drivers/net/mlx5/mlx5_ethdev.c
> +++ b/drivers/net/mlx5/mlx5_ethdev.c
> @@ -605,7 +605,6 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct
> rte_eth_dev_info *info)
>  	struct mlx5_priv *priv = dev->data->dev_private;
>  	struct mlx5_dev_config *config = &priv->config;
>  	unsigned int max;
> -	char ifname[IF_NAMESIZE];
> 
>  	/* FIXME: we should ask the device for these values. */
>  	info->min_rx_bufsize = 32;
> @@ -626,8 +625,7 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct
> rte_eth_dev_info *info)
>  	info->rx_offload_capa = (mlx5_get_rx_port_offloads() |
>  				 info->rx_queue_offload_capa);
>  	info->tx_offload_capa = mlx5_get_tx_port_offloads(dev);
> -	if (mlx5_get_ifname(dev, &ifname) == 0)
> -		info->if_index = if_nametoindex(ifname);
> +	info->if_index = priv->if_index;
>  	info->reta_size = priv->reta_idx_n ?
>  		priv->reta_idx_n : config->ind_table_max_size;
>  	info->hash_key_size = MLX5_RSS_HASH_KEY_LEN;
> --
> 2.20.1


  parent reply	other threads:[~2019-07-31  7:36 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 " 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
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   ` Raslan Darawsheh [this message]
2019-07-31 13:47     ` [dpdk-dev] [PATCH 2/2] net/mlx5: fix crash in dev_info_get in secondary process 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=DB3PR0502MB39648ABBBD04C1827B1E1A64C2DF0@DB3PR0502MB3964.eurprd05.prod.outlook.com \
    --to=rasland@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=matan@mellanox.com \
    --cc=shahafs@mellanox.com \
    --cc=sju@paloaltonetworks.com \
    --cc=stephen@networkplumber.org \
    --cc=viacheslavo@mellanox.com \
    --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).