Netdev Archive on lore.kernel.org help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us> To: Jakub Kicinski <kuba@kernel.org> Cc: Leon Romanovsky <leon@kernel.org>, davem@davemloft.net, netdev@vger.kernel.org, kernel-team@fb.com, tariqt@mellanox.com, yishaih@mellanox.com, linux-rdma@vger.kernel.org Subject: Re: [PATCH net-next] mlx4: make sure to always set the port type Date: Mon, 7 Sep 2020 08:21:35 +0200 [thread overview] Message-ID: <20200907062135.GJ2997@nanopsycho.orion> (raw) In-Reply-To: <20200906093305.5c901cc5@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> Sun, Sep 06, 2020 at 06:33:05PM CEST, kuba@kernel.org wrote: >On Sun, 6 Sep 2020 10:27:59 +0300 Leon Romanovsky wrote: >> On Fri, Sep 04, 2020 at 01:06:21PM -0700, 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); >> ^^^^^ >> >> Won't it crash in devlink_port_type_eth_set()? >> The first line there dereferences pointer. >> 7612 const struct net_device_ops *ops = netdev->netdev_ops; > >Damn, good catch. It's not supposed to be required. I'll patch devlink. When you set the port type to ethernet, you should have the net_device instance. Why wouldn't you? > >> And can we call to devlink_port_type_*_set() without IS_ENABLED() check? > >It'll generate two netlink notifications - not the end of the world but >also doesn't feel super clean.
next prev parent reply other threads:[~2020-09-07 6:21 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-09-04 20:06 [PATCH net-next] mlx4: make sure to always set the port type Jakub Kicinski 2020-09-06 7:27 ` Leon Romanovsky 2020-09-06 16:33 ` Jakub Kicinski 2020-09-07 6:21 ` Jiri Pirko [this message] 2020-09-07 6:48 ` Leon Romanovsky 2020-09-07 7:19 ` Jiri Pirko 2020-09-07 9:10 ` Leon Romanovsky 2020-09-07 16:34 ` Jakub Kicinski 2020-09-07 16:55 ` Jiri Pirko 2020-09-07 16:36 ` Jakub Kicinski 2020-09-07 17:51 ` Leon Romanovsky
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=20200907062135.GJ2997@nanopsycho.orion \ --to=jiri@resnulli.us \ --cc=davem@davemloft.net \ --cc=kernel-team@fb.com \ --cc=kuba@kernel.org \ --cc=leon@kernel.org \ --cc=linux-rdma@vger.kernel.org \ --cc=netdev@vger.kernel.org \ --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: linkBe 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).