netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/2] nfp: fixes for v6.1
@ 2022-11-17 15:37 Simon Horman
  2022-11-17 15:37 ` [PATCH net 1/2] nfp: fill splittable of devlink_port_attrs correctly Simon Horman
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Simon Horman @ 2022-11-17 15:37 UTC (permalink / raw)
  To: David Miller, Jakub Kicinski, Paolo Abeni
  Cc: netdev, oss-drivers, Simon Horman

Hi,

this short series addresses two bugs in the NFP driver.

PATCH 1/2: Ensure that information displayed by "devlink port show"
           reflects the number of lanes available to be split.

PATCH 2/1: Avoid NULL dereference in ethtool test code.

Diana Wang (1):
  nfp: fill splittable of devlink_port_attrs correctly

Jaco Coetzee (1):
  nfp: add port from netdev validation for EEPROM access

 drivers/net/ethernet/netronome/nfp/nfp_devlink.c     | 2 +-
 drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net 1/2] nfp: fill splittable of devlink_port_attrs correctly
  2022-11-17 15:37 [PATCH net 0/2] nfp: fixes for v6.1 Simon Horman
@ 2022-11-17 15:37 ` Simon Horman
  2022-11-17 15:37 ` [PATCH net 2/2] nfp: add port from netdev validation for EEPROM access Simon Horman
  2022-11-19  3:50 ` [PATCH net 0/2] nfp: fixes for v6.1 patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2022-11-17 15:37 UTC (permalink / raw)
  To: David Miller, Jakub Kicinski, Paolo Abeni
  Cc: netdev, oss-drivers, Diana Wang, Louis Peens,
	Niklas Söderlund, Simon Horman

From: Diana Wang <na.wang@corigine.com>

The error is reflected in that it shows wrong splittable status of
port when executing "devlink port show".
The reason which leads the error is that the assigned operation of
splittable is just a simple negation operation of split and it does
not consider port lanes quantity. A splittable port should have
several lanes that can be split(lanes quantity > 1).
If without the judgement, it will show wrong message for some
firmware, such as 2x25G, 2x10G.

Fixes: a0f49b548652 ("devlink: Add a new devlink port split ability attribute and pass to netlink")
Signed-off-by: Diana Wang <na.wang@corigine.com>
Reviewed-by: Louis Peens <louis.peens@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
---
 drivers/net/ethernet/netronome/nfp/nfp_devlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/netronome/nfp/nfp_devlink.c b/drivers/net/ethernet/netronome/nfp/nfp_devlink.c
index 405786c00334..cb08d7bf9524 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_devlink.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_devlink.c
@@ -341,7 +341,7 @@ int nfp_devlink_port_register(struct nfp_app *app, struct nfp_port *port)
 		return ret;
 
 	attrs.split = eth_port.is_split;
-	attrs.splittable = !attrs.split;
+	attrs.splittable = eth_port.port_lanes > 1 && !attrs.split;
 	attrs.lanes = eth_port.port_lanes;
 	attrs.flavour = DEVLINK_PORT_FLAVOUR_PHYSICAL;
 	attrs.phys.port_number = eth_port.label_port;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net 2/2] nfp: add port from netdev validation for EEPROM access
  2022-11-17 15:37 [PATCH net 0/2] nfp: fixes for v6.1 Simon Horman
  2022-11-17 15:37 ` [PATCH net 1/2] nfp: fill splittable of devlink_port_attrs correctly Simon Horman
@ 2022-11-17 15:37 ` Simon Horman
  2022-11-19  3:50 ` [PATCH net 0/2] nfp: fixes for v6.1 patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2022-11-17 15:37 UTC (permalink / raw)
  To: David Miller, Jakub Kicinski, Paolo Abeni
  Cc: netdev, oss-drivers, Jaco Coetzee, Louis Peens, Simon Horman

From: Jaco Coetzee <jaco.coetzee@corigine.com>

Setting of the port flag `NFP_PORT_CHANGED`, introduced
to ensure the correct reading of EEPROM data, causes a
fatal kernel NULL pointer dereference in cases where
the target netdev type cannot be determined.

Add validation of port struct pointer before attempting
to set the `NFP_PORT_CHANGED` flag. Return that operation
is not supported if the netdev type cannot be determined.

Fixes: 4ae97cae07e1 ("nfp: ethtool: fix the display error of `ethtool -m DEVNAME`")
Signed-off-by: Jaco Coetzee <jaco.coetzee@corigine.com>
Reviewed-by: Louis Peens <louis.peens@corigine.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
---
 drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
index 1775997f9c69..991059d6cb32 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
@@ -1432,6 +1432,9 @@ nfp_port_get_module_info(struct net_device *netdev,
 	u8 data;
 
 	port = nfp_port_from_netdev(netdev);
+	if (!port)
+		return -EOPNOTSUPP;
+
 	/* update port state to get latest interface */
 	set_bit(NFP_PORT_CHANGED, &port->flags);
 	eth_port = nfp_port_get_eth_port(port);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net 0/2] nfp: fixes for v6.1
  2022-11-17 15:37 [PATCH net 0/2] nfp: fixes for v6.1 Simon Horman
  2022-11-17 15:37 ` [PATCH net 1/2] nfp: fill splittable of devlink_port_attrs correctly Simon Horman
  2022-11-17 15:37 ` [PATCH net 2/2] nfp: add port from netdev validation for EEPROM access Simon Horman
@ 2022-11-19  3:50 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-11-19  3:50 UTC (permalink / raw)
  To: Simon Horman; +Cc: davem, kuba, pabeni, netdev, oss-drivers

Hello:

This series was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Thu, 17 Nov 2022 16:37:42 +0100 you wrote:
> Hi,
> 
> this short series addresses two bugs in the NFP driver.
> 
> PATCH 1/2: Ensure that information displayed by "devlink port show"
>            reflects the number of lanes available to be split.
> 
> [...]

Here is the summary with links:
  - [net,1/2] nfp: fill splittable of devlink_port_attrs correctly
    https://git.kernel.org/netdev/net/c/4abd9600b9d1
  - [net,2/2] nfp: add port from netdev validation for EEPROM access
    https://git.kernel.org/netdev/net/c/0873016d46f6

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-11-19  3:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-17 15:37 [PATCH net 0/2] nfp: fixes for v6.1 Simon Horman
2022-11-17 15:37 ` [PATCH net 1/2] nfp: fill splittable of devlink_port_attrs correctly Simon Horman
2022-11-17 15:37 ` [PATCH net 2/2] nfp: add port from netdev validation for EEPROM access Simon Horman
2022-11-19  3:50 ` [PATCH net 0/2] nfp: fixes for v6.1 patchwork-bot+netdevbpf

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).