netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Petr Machata <petrm@nvidia.com>
To: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	<netdev@vger.kernel.org>
Cc: Ido Schimmel <idosch@nvidia.com>, Petr Machata <petrm@nvidia.com>,
	<mlxsw@nvidia.com>
Subject: [PATCH net-next 07/11] mlxsw: pci: Permit toggling LAG mode
Date: Thu, 19 Oct 2023 12:27:16 +0200	[thread overview]
Message-ID: <8ecead4979d95abbbfc69be4e80c0514fdbc024f.1697710282.git.petrm@nvidia.com> (raw)
In-Reply-To: <cover.1697710282.git.petrm@nvidia.com>

Add to struct mlxsw_config_profile a field lag_mode_prefer_sw for the
driver to indicate that SW LAG mode should be configured if possible. Add
to the PCI module code to set lag_mode as appropriate.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlxsw/core.h |  1 +
 drivers/net/ethernet/mellanox/mlxsw/pci.c  | 16 ++++++++++++----
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.h b/drivers/net/ethernet/mellanox/mlxsw/core.h
index 5692f34b2a63..764d14bd5bc0 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/core.h
@@ -337,6 +337,7 @@ struct mlxsw_config_profile {
 	u8	kvd_hash_single_parts;
 	u8	kvd_hash_double_parts;
 	u8	cqe_time_stamp_type;
+	bool	lag_mode_prefer_sw;
 	struct mlxsw_swid_config swid_config[MLXSW_CONFIG_PROFILE_SWID_COUNT];
 };
 
diff --git a/drivers/net/ethernet/mellanox/mlxsw/pci.c b/drivers/net/ethernet/mellanox/mlxsw/pci.c
index 3e8347585e42..5b1f2483a3cc 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/pci.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/pci.c
@@ -1315,7 +1315,16 @@ static int mlxsw_pci_config_profile(struct mlxsw_pci *mlxsw_pci, char *mbox,
 					profile->cqe_time_stamp_type);
 	}
 
-	mlxsw_pci->lag_mode = MLXSW_CMD_MBOX_CONFIG_PROFILE_LAG_MODE_FW;
+	if (profile->lag_mode_prefer_sw && mlxsw_pci->lag_mode_support) {
+		enum mlxsw_cmd_mbox_config_profile_lag_mode lag_mode =
+			MLXSW_CMD_MBOX_CONFIG_PROFILE_LAG_MODE_SW;
+
+		mlxsw_cmd_mbox_config_profile_set_lag_mode_set(mbox, 1);
+		mlxsw_cmd_mbox_config_profile_lag_mode_set(mbox, lag_mode);
+		mlxsw_pci->lag_mode = lag_mode;
+	} else {
+		mlxsw_pci->lag_mode = MLXSW_CMD_MBOX_CONFIG_PROFILE_LAG_MODE_FW;
+	}
 	return mlxsw_cmd_config_profile_set(mlxsw_pci->core, mbox);
 }
 
@@ -1677,9 +1686,8 @@ static int mlxsw_pci_init(void *bus_priv, struct mlxsw_core *mlxsw_core,
 	if (err)
 		goto err_config_profile;
 
-	/* Some resources depend on unified bridge model, which is configured
-	 * as part of config_profile. Query the resources again to get correct
-	 * values.
+	/* Some resources depend on details of config_profile, such as unified
+	 * bridge model. Query the resources again to get correct values.
 	 */
 	err = mlxsw_core_resources_query(mlxsw_core, mbox, res);
 	if (err)
-- 
2.41.0


  parent reply	other threads:[~2023-10-19 10:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-19 10:27 [PATCH net-next 00/11] mlxsw: Move allocation of LAG table to the driver Petr Machata
2023-10-19 10:27 ` [PATCH net-next 01/11] mlxsw: reg: Drop SGCR.llb Petr Machata
2023-10-19 10:27 ` [PATCH net-next 02/11] mlxsw: reg: Add SGCR.lag_lookup_pgt_base Petr Machata
2023-10-19 10:27 ` [PATCH net-next 03/11] mlxsw: cmd: Fix omissions in CONFIG_PROFILE field names in comments Petr Machata
2023-10-19 10:27 ` [PATCH net-next 04/11] mlxsw: cmd: Add CONFIG_PROFILE.{set_, }lag_mode Petr Machata
2023-10-19 10:27 ` [PATCH net-next 05/11] mlxsw: cmd: Add QUERY_FW.lag_mode_support Petr Machata
2023-10-19 10:27 ` [PATCH net-next 06/11] mlxsw: core, pci: Add plumbing related to LAG mode Petr Machata
2023-10-19 10:27 ` Petr Machata [this message]
2023-10-19 10:27 ` [PATCH net-next 08/11] mlxsw: spectrum_fid: Allocate PGT for the whole FID family in one go Petr Machata
2023-10-19 10:27 ` [PATCH net-next 09/11] mlxsw: spectrum_pgt: Generalize PGT allocation Petr Machata
2023-10-19 10:27 ` [PATCH net-next 10/11] mlxsw: spectrum: Allocate LAG table when in SW LAG mode Petr Machata
2023-10-19 10:27 ` [PATCH net-next 11/11] mlxsw: spectrum: Set SW LAG mode on Spectrum>1 Petr Machata
2023-10-20 10:50 ` [PATCH net-next 00/11] mlxsw: Move allocation of LAG table to the driver 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=8ecead4979d95abbbfc69be4e80c0514fdbc024f.1697710282.git.petrm@nvidia.com \
    --to=petrm@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=mlxsw@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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).