netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tariq Toukan <ttoukan.linux@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>, davem@davemloft.net
Cc: netdev@vger.kernel.org, kernel-team@fb.com, tariqt@mellanox.com,
	ogerlitz@mellanox.com, yishaih@mellanox.com, saeedm@mellanox.com,
	leonro@nvidia.com
Subject: Re: [PATCH net-next v2 2/2] mlx4: make sure to always set the port type
Date: Wed, 9 Sep 2020 10:21:39 +0300	[thread overview]
Message-ID: <db239d72-e4f7-b8d3-a50d-254311281dcd@gmail.com> (raw)
In-Reply-To: <20200908222114.190718-3-kuba@kernel.org>



On 9/9/2020 1:21 AM, Jakub Kicinski wrote:
> Even tho mlx4_core registers the devlink ports, it's mlx4_en
> and mlx4_ib which set their type. In situations where one of
> the two is not built yet the machine has ports of given type
> we see the devlink warning from devlink_port_type_warn() trigger.
> 
> Having ports of a type not supported by the kernel may seem
> surprising, but it does occur in practice - when the unsupported
> port is not plugged in to a switch anyway users are more than happy
> not to see it (and potentially allocate any resources to it).
> 
> Set the type in mlx4_core if type-specific driver is not built.
> 
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
>   drivers/net/ethernet/mellanox/mlx4/main.c | 11 +++++++++++
>   1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
> index 258c7a96f269..70cf24ba71e4 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/main.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/main.c
> @@ -3031,6 +3031,17 @@ static int mlx4_init_port_info(struct mlx4_dev *dev, int port)
>   	if (err)
>   		return err;
>   
> +	/* Ethernet and IB drivers will normally set the port type,
> +	 * but if they are not built set the type now to prevent
> +	 * devlink_port_type_warn() from firing.
> +	 */
> +	if (!IS_ENABLED(CONFIG_MLX4_EN) &&
> +	    dev->caps.port_type[port] == MLX4_PORT_TYPE_ETH)
> +		devlink_port_type_eth_set(&info->devlink_port, NULL);
> +	else if (!IS_ENABLED(CONFIG_MLX4_INFINIBAND) &&
> +		 dev->caps.port_type[port] == MLX4_PORT_TYPE_IB)
> +		devlink_port_type_ib_set(&info->devlink_port, NULL);
> +
>   	info->dev = dev;
>   	info->port = port;
>   	if (!mlx4_is_slave(dev)) {
> 

Reviewed-by: Tariq Toukan <tariqt@mellanox.com>

  reply	other threads:[~2020-09-09  7:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-08 22:21 [PATCH net-next v2 0/2] mlx4: avoid devlink port type not set warnings Jakub Kicinski
2020-09-08 22:21 ` [PATCH net-next v2 1/2] devlink: don't crash if netdev is NULL Jakub Kicinski
2020-09-08 22:21 ` [PATCH net-next v2 2/2] mlx4: make sure to always set the port type Jakub Kicinski
2020-09-09  7:21   ` Tariq Toukan [this message]
2020-09-10 19:49 ` [PATCH net-next v2 0/2] mlx4: avoid devlink port type not set warnings David Miller

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=db239d72-e4f7-b8d3-a50d-254311281dcd@gmail.com \
    --to=ttoukan.linux@gmail.com \
    --cc=davem@davemloft.net \
    --cc=kernel-team@fb.com \
    --cc=kuba@kernel.org \
    --cc=leonro@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=ogerlitz@mellanox.com \
    --cc=saeedm@mellanox.com \
    --cc=tariqt@mellanox.com \
    --cc=yishaih@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).