diff mbox series

[net-next,2/6] mlxsw: spectrum: Remove mlxsw_sp_lag_get()

Message ID 60abbc61e47cce691121e761340d6cc5d7f06f4e.1706293430.git.petrm@nvidia.com (mailing list archive)
State Accepted
Commit 5a448905e37ecf121ede090495540230b5d03946
Delegated to: Netdev Maintainers
Headers show
Series mlxsw: Refactor reference counting code | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next, async
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1064 this patch: 1064
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 0 of 0 maintainers
netdev/build_clang success Errors and warnings before: 1081 this patch: 1081
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1081 this patch: 1081
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 36 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-01-29--21-00 (tests: 623)

Commit Message

Petr Machata Jan. 26, 2024, 6:58 p.m. UTC
From: Amit Cohen <amcohen@nvidia.com>

A next patch will add mlxsw_sp_lag_{get,put}() functions to handle LAG
reference counting and create/destroy it only for first user/last user.
Remove mlxsw_sp_lag_get() function and access LAG array directly.

Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

Comments

Simon Horman Jan. 29, 2024, 7:52 p.m. UTC | #1
On Fri, Jan 26, 2024 at 07:58:27PM +0100, Petr Machata wrote:
> From: Amit Cohen <amcohen@nvidia.com>
> 
> A next patch will add mlxsw_sp_lag_{get,put}() functions to handle LAG
> reference counting and create/destroy it only for first user/last user.
> Remove mlxsw_sp_lag_get() function and access LAG array directly.
> 
> Signed-off-by: Amit Cohen <amcohen@nvidia.com>
> Reviewed-by: Ido Schimmel <idosch@nvidia.com>
> Signed-off-by: Ido Schimmel <idosch@nvidia.com>
> Signed-off-by: Petr Machata <petrm@nvidia.com>

Reviewed-by: Simon Horman <horms@kernel.org>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index 38428d2ef0e2..ff52028a957b 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -4334,12 +4334,6 @@  static int mlxsw_sp_lag_col_port_disable(struct mlxsw_sp_port *mlxsw_sp_port,
 	return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(slcor), slcor_pl);
 }
 
-static struct mlxsw_sp_lag *
-mlxsw_sp_lag_get(struct mlxsw_sp *mlxsw_sp, u16 lag_id)
-{
-	return &mlxsw_sp->lags[lag_id];
-}
-
 static int mlxsw_sp_lag_index_get(struct mlxsw_sp *mlxsw_sp,
 				  struct net_device *lag_dev,
 				  u16 *p_lag_id)
@@ -4354,7 +4348,7 @@  static int mlxsw_sp_lag_index_get(struct mlxsw_sp *mlxsw_sp,
 		return err;
 
 	for (i = 0; i < max_lag; i++) {
-		lag = mlxsw_sp_lag_get(mlxsw_sp, i);
+		lag = &mlxsw_sp->lags[i];
 		if (lag->ref_count) {
 			if (lag->dev == lag_dev) {
 				*p_lag_id = i;
@@ -4501,7 +4495,7 @@  static int mlxsw_sp_port_lag_join(struct mlxsw_sp_port *mlxsw_sp_port,
 	err = mlxsw_sp_lag_index_get(mlxsw_sp, lag_dev, &lag_id);
 	if (err)
 		return err;
-	lag = mlxsw_sp_lag_get(mlxsw_sp, lag_id);
+	lag = &mlxsw_sp->lags[lag_id];
 	if (!lag->ref_count) {
 		err = mlxsw_sp_lag_create(mlxsw_sp, lag_id);
 		if (err)
@@ -4575,7 +4569,7 @@  static void mlxsw_sp_port_lag_leave(struct mlxsw_sp_port *mlxsw_sp_port,
 
 	if (!mlxsw_sp_port->lagged)
 		return;
-	lag = mlxsw_sp_lag_get(mlxsw_sp, lag_id);
+	lag = &mlxsw_sp->lags[lag_id];
 	WARN_ON(lag->ref_count == 0);
 
 	mlxsw_sp_lag_col_port_remove(mlxsw_sp_port, lag_id);