All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@nvidia.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
	jiri@nvidia.com, vadimp@nvidia.com, petrm@nvidia.com,
	andrew@lunn.ch, dsahern@gmail.com, mlxsw@nvidia.com,
	Ido Schimmel <idosch@nvidia.com>
Subject: [PATCH net-next 05/17] mlxsw: spectrum: Allow lane to start from non-zero index
Date: Mon, 18 Apr 2022 09:42:29 +0300	[thread overview]
Message-ID: <20220418064241.2925668-6-idosch@nvidia.com> (raw)
In-Reply-To: <20220418064241.2925668-1-idosch@nvidia.com>

From: Jiri Pirko <jiri@nvidia.com>

So far, the lane index always started from zero. That is not true for
modular systems with gearbox-equipped linecards. Loose the check so the
lanes can start from non-zero index.

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index 684910ca7cf4..120880fad7f8 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -486,6 +486,7 @@ mlxsw_sp_port_module_info_get(struct mlxsw_sp *mlxsw_sp, u16 local_port,
 {
 	char pmlp_pl[MLXSW_REG_PMLP_LEN];
 	bool separate_rxtx;
+	u8 first_lane;
 	u8 module;
 	u8 width;
 	int err;
@@ -498,6 +499,7 @@ mlxsw_sp_port_module_info_get(struct mlxsw_sp *mlxsw_sp, u16 local_port,
 	module = mlxsw_reg_pmlp_module_get(pmlp_pl, 0);
 	width = mlxsw_reg_pmlp_width_get(pmlp_pl);
 	separate_rxtx = mlxsw_reg_pmlp_rxtx_get(pmlp_pl);
+	first_lane = mlxsw_reg_pmlp_tx_lane_get(pmlp_pl, 0);
 
 	if (width && !is_power_of_2(width)) {
 		dev_err(mlxsw_sp->bus_info->dev, "Port %d: Unsupported module config: width value is not power of 2\n",
@@ -518,7 +520,7 @@ mlxsw_sp_port_module_info_get(struct mlxsw_sp *mlxsw_sp, u16 local_port,
 				local_port);
 			return -EINVAL;
 		}
-		if (mlxsw_reg_pmlp_tx_lane_get(pmlp_pl, i) != i) {
+		if (mlxsw_reg_pmlp_tx_lane_get(pmlp_pl, i) != i + first_lane) {
 			dev_err(mlxsw_sp->bus_info->dev, "Port %d: Unsupported module config: TX and RX lane numbers are not sequential\n",
 				local_port);
 			return -EINVAL;
-- 
2.33.1


  parent reply	other threads:[~2022-04-18  6:44 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-18  6:42 [PATCH net-next 00/17] Introduce line card support for modular switch Ido Schimmel
2022-04-18  6:42 ` [PATCH net-next 01/17] devlink: add support to create line card and expose to user Ido Schimmel
2022-04-18  6:42 ` [PATCH net-next 02/17] devlink: implement line card provisioning Ido Schimmel
2022-04-18  6:42 ` [PATCH net-next 03/17] devlink: implement line card active state Ido Schimmel
2022-04-18  6:42 ` [PATCH net-next 04/17] devlink: add port to line card relationship set Ido Schimmel
2022-04-18  6:42 ` Ido Schimmel [this message]
2022-04-18  6:42 ` [PATCH net-next 06/17] mlxsw: spectrum: Allocate port mapping array of structs instead of pointers Ido Schimmel
2022-04-18  6:42 ` [PATCH net-next 07/17] mlxsw: reg: Add Ports Mapping Event Configuration Register Ido Schimmel
2022-04-18  6:42 ` [PATCH net-next 08/17] mlxsw: Narrow the critical section of devl_lock during ports creation/removal Ido Schimmel
2022-04-18  6:42 ` [PATCH net-next 09/17] mlxsw: spectrum: Introduce port mapping change event processing Ido Schimmel
2022-04-18  6:42 ` [PATCH net-next 10/17] mlxsw: reg: Add Management DownStream Device Query Register Ido Schimmel
2022-04-18  6:42 ` [PATCH net-next 11/17] mlxsw: reg: Add Management DownStream Device Control Register Ido Schimmel
2022-04-18  6:42 ` [PATCH net-next 12/17] mlxsw: reg: Add Management Binary Code Transfer Register Ido Schimmel
2022-04-18  6:42 ` [PATCH net-next 13/17] mlxsw: core_linecards: Add line card objects and implement provisioning Ido Schimmel
2022-04-18  6:42 ` [PATCH net-next 14/17] mlxsw: core_linecards: Implement line card activation process Ido Schimmel
2022-04-18  6:42 ` [PATCH net-next 15/17] mlxsw: core: Extend driver ops by remove selected ports op Ido Schimmel
2022-04-18  6:42 ` [PATCH net-next 16/17] mlxsw: spectrum: Add port to linecard mapping Ido Schimmel
2022-04-18  6:42 ` [PATCH net-next 17/17] selftests: mlxsw: Introduce devlink line card provision/unprovision/activation tests Ido Schimmel
2022-04-18 10:10 ` [PATCH net-next 00/17] Introduce line card support for modular switch patchwork-bot+netdevbpf
2022-04-18 14:31 ` David Ahern
2022-04-19 11:55   ` Jiri Pirko
2022-04-19 12:58     ` Ido Schimmel

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=20220418064241.2925668-6-idosch@nvidia.com \
    --to=idosch@nvidia.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dsahern@gmail.com \
    --cc=jiri@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=mlxsw@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.