netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@nvidia.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, petrm@nvidia.com,
	danieller@nvidia.com, vadimp@nvidia.com, mlxsw@nvidia.com,
	Ido Schimmel <idosch@nvidia.com>
Subject: [PATCH net-next 3/9] mlxsw: Add netdev argument to mlxsw_env_get_module_info()
Date: Wed, 26 Jan 2022 12:30:31 +0200	[thread overview]
Message-ID: <20220126103037.234986-4-idosch@nvidia.com> (raw)
In-Reply-To: <20220126103037.234986-1-idosch@nvidia.com>

From: Danielle Ratson <danieller@nvidia.com>

The next patches will forbid querying the port module's EEPROM info when
its type is RJ45 as in this case no transceiver module can ever be
connected to the port.

Add netdev argument to mlxsw_env_get_module_info() so it could be used
to print an error to the kernel log via netdev_err().

Signed-off-by: Danielle Ratson <danieller@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlxsw/core_env.c         | 3 ++-
 drivers/net/ethernet/mellanox/mlxsw/core_env.h         | 3 ++-
 drivers/net/ethernet/mellanox/mlxsw/minimal.c          | 3 ++-
 drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c | 2 +-
 4 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_env.c b/drivers/net/ethernet/mellanox/mlxsw/core_env.c
index e84453d70355..06b6acc028e0 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core_env.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/core_env.c
@@ -206,7 +206,8 @@ int mlxsw_env_module_temp_thresholds_get(struct mlxsw_core *core, int module,
 	return 0;
 }
 
-int mlxsw_env_get_module_info(struct mlxsw_core *mlxsw_core, int module,
+int mlxsw_env_get_module_info(struct net_device *netdev,
+			      struct mlxsw_core *mlxsw_core, int module,
 			      struct ethtool_modinfo *modinfo)
 {
 	u8 module_info[MLXSW_REG_MCIA_EEPROM_MODULE_INFO_SIZE];
diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_env.h b/drivers/net/ethernet/mellanox/mlxsw/core_env.h
index da121b1a84b4..ec6564e5d2ee 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core_env.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/core_env.h
@@ -12,7 +12,8 @@ struct ethtool_eeprom;
 int mlxsw_env_module_temp_thresholds_get(struct mlxsw_core *core, int module,
 					 int off, int *temp);
 
-int mlxsw_env_get_module_info(struct mlxsw_core *mlxsw_core, int module,
+int mlxsw_env_get_module_info(struct net_device *netdev,
+			      struct mlxsw_core *mlxsw_core, int module,
 			      struct ethtool_modinfo *modinfo);
 
 int mlxsw_env_get_module_eeprom(struct net_device *netdev,
diff --git a/drivers/net/ethernet/mellanox/mlxsw/minimal.c b/drivers/net/ethernet/mellanox/mlxsw/minimal.c
index 10d13f5f9c7d..9ac8ce01c061 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/minimal.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/minimal.c
@@ -110,7 +110,8 @@ static int mlxsw_m_get_module_info(struct net_device *netdev,
 	struct mlxsw_m_port *mlxsw_m_port = netdev_priv(netdev);
 	struct mlxsw_core *core = mlxsw_m_port->mlxsw_m->core;
 
-	return mlxsw_env_get_module_info(core, mlxsw_m_port->module, modinfo);
+	return mlxsw_env_get_module_info(netdev, core, mlxsw_m_port->module,
+					 modinfo);
 }
 
 static int
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c
index 68c0ddf3b6c1..055f857931b2 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c
@@ -1035,7 +1035,7 @@ static int mlxsw_sp_get_module_info(struct net_device *netdev,
 	struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(netdev);
 	struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
 
-	return mlxsw_env_get_module_info(mlxsw_sp->core,
+	return mlxsw_env_get_module_info(netdev, mlxsw_sp->core,
 					 mlxsw_sp_port->mapping.module,
 					 modinfo);
 }
-- 
2.33.1


  parent reply	other threads:[~2022-01-26 10:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-26 10:30 [PATCH net-next 0/9] mlxsw: Add RJ45 ports support Ido Schimmel
2022-01-26 10:30 ` [PATCH net-next 1/9] mlxsw: spectrum_ethtool: Remove redundant variable Ido Schimmel
2022-01-26 10:30 ` [PATCH net-next 2/9] mlxsw: core_env: Do not pass number of modules as argument Ido Schimmel
2022-01-26 10:30 ` Ido Schimmel [this message]
2022-01-26 10:30 ` [PATCH net-next 4/9] mlxsw: spectrum_ethtool: Add support for two new link modes Ido Schimmel
2022-01-26 13:43   ` Andrew Lunn
2022-01-26 15:37     ` Ido Schimmel
2022-01-26 10:30 ` [PATCH net-next 5/9] mlxsw: reg: Add Port Module Type Mapping register Ido Schimmel
2022-01-26 10:30 ` [PATCH net-next 6/9] mlxsw: core_env: Query and store port module's type during initialization Ido Schimmel
2022-01-26 10:30 ` [PATCH net-next 7/9] mlxsw: core_env: Forbid getting module EEPROM on RJ45 ports Ido Schimmel
2022-01-26 10:30 ` [PATCH net-next 8/9] mlxsw: core_env: Forbid power mode set and get " Ido Schimmel
2022-01-26 10:30 ` [PATCH net-next 9/9] mlxsw: core_env: Forbid module reset " Ido Schimmel
2022-01-26 11:20 ` [PATCH net-next 0/9] mlxsw: Add RJ45 ports support patchwork-bot+netdevbpf

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=20220126103037.234986-4-idosch@nvidia.com \
    --to=idosch@nvidia.com \
    --cc=danieller@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=mlxsw@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=petrm@nvidia.com \
    --cc=vadimp@nvidia.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).