Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH net-next] mlx4: make sure to always set the port type
@ 2020-09-04 20:06 Jakub Kicinski
2020-09-06 7:27 ` Leon Romanovsky
0 siblings, 1 reply; 11+ messages in thread
From: Jakub Kicinski @ 2020-09-04 20:06 UTC (permalink / raw)
To: davem
Cc: netdev, kernel-team, tariqt, yishaih, linux-rdma, jiri, Jakub Kicinski
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)) {
--
2.26.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH net-next] mlx4: make sure to always set the port type
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
0 siblings, 1 reply; 11+ messages in thread
From: Leon Romanovsky @ 2020-09-06 7:27 UTC (permalink / raw)
To: Jakub Kicinski
Cc: davem, netdev, kernel-team, tariqt, yishaih, linux-rdma, jiri
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;
And can we call to devlink_port_type_*_set() without IS_ENABLED() check?
Thanks
> + 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)) {
> --
> 2.26.2
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net-next] mlx4: make sure to always set the port type
2020-09-06 7:27 ` Leon Romanovsky
@ 2020-09-06 16:33 ` Jakub Kicinski
2020-09-07 6:21 ` Jiri Pirko
0 siblings, 1 reply; 11+ messages in thread
From: Jakub Kicinski @ 2020-09-06 16:33 UTC (permalink / raw)
To: Leon Romanovsky
Cc: davem, netdev, kernel-team, tariqt, yishaih, linux-rdma, jiri
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.
> 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.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net-next] mlx4: make sure to always set the port type
2020-09-06 16:33 ` Jakub Kicinski
@ 2020-09-07 6:21 ` Jiri Pirko
2020-09-07 6:48 ` Leon Romanovsky
0 siblings, 1 reply; 11+ messages in thread
From: Jiri Pirko @ 2020-09-07 6:21 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Leon Romanovsky, davem, netdev, kernel-team, tariqt, yishaih, linux-rdma
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.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net-next] mlx4: make sure to always set the port type
2020-09-07 6:21 ` Jiri Pirko
@ 2020-09-07 6:48 ` Leon Romanovsky
2020-09-07 7:19 ` Jiri Pirko
2020-09-07 16:36 ` Jakub Kicinski
0 siblings, 2 replies; 11+ messages in thread
From: Leon Romanovsky @ 2020-09-07 6:48 UTC (permalink / raw)
To: Jiri Pirko
Cc: Jakub Kicinski, davem, netdev, kernel-team, tariqt, yishaih, linux-rdma
On Mon, Sep 07, 2020 at 08:21:35AM +0200, Jiri Pirko wrote:
> 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?
It is how mlx4 is implemented, see mlx4_dev_cap() function:
588 for (i = 1; i <= dev->caps.num_ports; ++i) {
589 dev->caps.port_type[i] = MLX4_PORT_TYPE_NONE;
....
The port type is being set to IB or ETH without relation to net_device,
fixing it will require very major code rewrite for the stable driver
that in maintenance mode.
>
>
> >
> >> 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.
I would say that such a situation is corner case during the driver init and
not an end of the world to see double netlink message.
Thanks
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net-next] mlx4: make sure to always set the port type
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:36 ` Jakub Kicinski
1 sibling, 2 replies; 11+ messages in thread
From: Jiri Pirko @ 2020-09-07 7:19 UTC (permalink / raw)
To: Leon Romanovsky
Cc: Jakub Kicinski, davem, netdev, kernel-team, tariqt, yishaih, linux-rdma
Mon, Sep 07, 2020 at 08:48:30AM CEST, leon@kernel.org wrote:
>On Mon, Sep 07, 2020 at 08:21:35AM +0200, Jiri Pirko wrote:
>> 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?
>
>It is how mlx4 is implemented, see mlx4_dev_cap() function:
>588 for (i = 1; i <= dev->caps.num_ports; ++i) {
>589 dev->caps.port_type[i] = MLX4_PORT_TYPE_NONE;
>....
>
>The port type is being set to IB or ETH without relation to net_device,
>fixing it will require very major code rewrite for the stable driver
>that in maintenance mode.
Because the eth driver is not loaded, I see. The purpose of the
WARN in devlink_port_type_eth_set is to prevent drivers from registering
particular port without netdev/ibdev. That is what was repeatedly
happening in the past as the driver developers didn't know they need to
do it or were just lazy to do so.
I wonder if there is any possibility to do both...
>
>>
>>
>> >
>> >> 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.
>
>I would say that such a situation is corner case during the driver init and
>not an end of the world to see double netlink message.
>
>Thanks
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net-next] mlx4: make sure to always set the port type
2020-09-07 7:19 ` Jiri Pirko
@ 2020-09-07 9:10 ` Leon Romanovsky
2020-09-07 16:34 ` Jakub Kicinski
1 sibling, 0 replies; 11+ messages in thread
From: Leon Romanovsky @ 2020-09-07 9:10 UTC (permalink / raw)
To: Jiri Pirko
Cc: Jakub Kicinski, davem, netdev, kernel-team, tariqt, yishaih, linux-rdma
On Mon, Sep 07, 2020 at 09:19:39AM +0200, Jiri Pirko wrote:
> Mon, Sep 07, 2020 at 08:48:30AM CEST, leon@kernel.org wrote:
> >On Mon, Sep 07, 2020 at 08:21:35AM +0200, Jiri Pirko wrote:
> >> 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?
> >
> >It is how mlx4 is implemented, see mlx4_dev_cap() function:
> >588 for (i = 1; i <= dev->caps.num_ports; ++i) {
> >589 dev->caps.port_type[i] = MLX4_PORT_TYPE_NONE;
> >....
> >
> >The port type is being set to IB or ETH without relation to net_device,
> >fixing it will require very major code rewrite for the stable driver
> >that in maintenance mode.
>
> Because the eth driver is not loaded, I see. The purpose of the
> WARN in devlink_port_type_eth_set is to prevent drivers from registering
> particular port without netdev/ibdev. That is what was repeatedly
> happening in the past as the driver developers didn't know they need to
> do it or were just lazy to do so.
>
> I wonder if there is any possibility to do both...
It is hard to say, hope that Jakub will take a look.
Thanks
>
> >
> >>
> >>
> >> >
> >> >> 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.
> >
> >I would say that such a situation is corner case during the driver init and
> >not an end of the world to see double netlink message.
> >
> >Thanks
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net-next] mlx4: make sure to always set the port type
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
1 sibling, 1 reply; 11+ messages in thread
From: Jakub Kicinski @ 2020-09-07 16:34 UTC (permalink / raw)
To: Jiri Pirko
Cc: Leon Romanovsky, davem, netdev, kernel-team, tariqt, yishaih, linux-rdma
On Mon, 7 Sep 2020 09:19:39 +0200 Jiri Pirko wrote:
> >The port type is being set to IB or ETH without relation to net_device,
> >fixing it will require very major code rewrite for the stable driver
> >that in maintenance mode.
>
> Because the eth driver is not loaded, I see. The purpose of the
> WARN in devlink_port_type_eth_set is to prevent drivers from registering
> particular port without netdev/ibdev. That is what was repeatedly
> happening in the past as the driver developers didn't know they need to
> do it or were just lazy to do so.
>
> I wonder if there is any possibility to do both...
I think we have two options in this case:
- set type to eth without the netdev
- selectively mute the warning
I think the former is better, because we still want to see what the
port type is. Perhaps we should add a:
dev_warn("devlink port type set without software interface
reference, device type not supported by the kernel?");
That way people won't just pass NULL out of laziness, hopefully.
WDYT?
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net-next] mlx4: make sure to always set the port type
2020-09-07 6:48 ` Leon Romanovsky
2020-09-07 7:19 ` Jiri Pirko
@ 2020-09-07 16:36 ` Jakub Kicinski
2020-09-07 17:51 ` Leon Romanovsky
1 sibling, 1 reply; 11+ messages in thread
From: Jakub Kicinski @ 2020-09-07 16:36 UTC (permalink / raw)
To: Leon Romanovsky
Cc: Jiri Pirko, davem, netdev, kernel-team, tariqt, yishaih, linux-rdma
On Mon, 7 Sep 2020 09:48:30 +0300 Leon Romanovsky wrote:
>>>> 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.
>
> I would say that such a situation is corner case during the driver init and
> not an end of the world to see double netlink message.
Could you spell out your reasoning here? Are you concerned about
out-of-tree drivers?
I don't see how adding IS_ENABLED() to the condition outweighs
the benefit of not having duplicated netlink notifications.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net-next] mlx4: make sure to always set the port type
2020-09-07 16:34 ` Jakub Kicinski
@ 2020-09-07 16:55 ` Jiri Pirko
0 siblings, 0 replies; 11+ messages in thread
From: Jiri Pirko @ 2020-09-07 16:55 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Leon Romanovsky, davem, netdev, kernel-team, tariqt, yishaih, linux-rdma
Mon, Sep 07, 2020 at 06:34:01PM CEST, kuba@kernel.org wrote:
>On Mon, 7 Sep 2020 09:19:39 +0200 Jiri Pirko wrote:
>> >The port type is being set to IB or ETH without relation to net_device,
>> >fixing it will require very major code rewrite for the stable driver
>> >that in maintenance mode.
>>
>> Because the eth driver is not loaded, I see. The purpose of the
>> WARN in devlink_port_type_eth_set is to prevent drivers from registering
>> particular port without netdev/ibdev. That is what was repeatedly
>> happening in the past as the driver developers didn't know they need to
>> do it or were just lazy to do so.
>>
>> I wonder if there is any possibility to do both...
>
>I think we have two options in this case:
> - set type to eth without the netdev
> - selectively mute the warning
>
>I think the former is better, because we still want to see what the
>port type is. Perhaps we should add a:
>
> dev_warn("devlink port type set without software interface
> reference, device type not supported by the kernel?");
>
>That way people won't just pass NULL out of laziness, hopefully.
>
>WDYT?
Okay. That sounds probably like the best option we have.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net-next] mlx4: make sure to always set the port type
2020-09-07 16:36 ` Jakub Kicinski
@ 2020-09-07 17:51 ` Leon Romanovsky
0 siblings, 0 replies; 11+ messages in thread
From: Leon Romanovsky @ 2020-09-07 17:51 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Jiri Pirko, davem, netdev, kernel-team, tariqt, yishaih, linux-rdma
On Mon, Sep 07, 2020 at 09:36:14AM -0700, Jakub Kicinski wrote:
> On Mon, 7 Sep 2020 09:48:30 +0300 Leon Romanovsky wrote:
> >>>> 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.
> >
> > I would say that such a situation is corner case during the driver init and
> > not an end of the world to see double netlink message.
>
> Could you spell out your reasoning here? Are you concerned about
> out-of-tree drivers?
Nothing fancy, I just didn't see users who compiled mlx4_core and used
it without eth/ib.
The corner case is because this double netlink can be seen only during
driver reload and only if port type wasn't set.
>
> I don't see how adding IS_ENABLED() to the condition outweighs
> the benefit of not having duplicated netlink notifications.
Readability?
Anyway, it doesn't matter.
Thanks
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2020-09-07 17:52 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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
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).