-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net/mlx5: Expose lag operations in header file
The change is a refactoring step towards a multipath use case. Signed-off-by: Roi Dayan <roid@mellanox.com> Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
- Loading branch information
Roi Dayan
authored and
Saeed Mahameed
committed
Mar 1, 2019
1 parent
bb19ad0
commit 10a193e
Showing
2 changed files
with
68 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ | ||
/* Copyright (c) 2019 Mellanox Technologies. */ | ||
|
||
#ifndef __MLX5_LAG_H__ | ||
#define __MLX5_LAG_H__ | ||
|
||
#include "mlx5_core.h" | ||
|
||
enum { | ||
MLX5_LAG_FLAG_ROCE = 1 << 0, | ||
MLX5_LAG_FLAG_SRIOV = 1 << 1, | ||
}; | ||
|
||
#define MLX5_LAG_MODE_FLAGS (MLX5_LAG_FLAG_ROCE | MLX5_LAG_FLAG_SRIOV) | ||
|
||
struct lag_func { | ||
struct mlx5_core_dev *dev; | ||
struct net_device *netdev; | ||
}; | ||
|
||
/* Used for collection of netdev event info. */ | ||
struct lag_tracker { | ||
enum netdev_lag_tx_type tx_type; | ||
struct netdev_lag_lower_state_info netdev_state[MLX5_MAX_PORTS]; | ||
unsigned int is_bonded:1; | ||
}; | ||
|
||
/* LAG data of a ConnectX card. | ||
* It serves both its phys functions. | ||
*/ | ||
struct mlx5_lag { | ||
u8 flags; | ||
u8 v2p_map[MLX5_MAX_PORTS]; | ||
struct lag_func pf[MLX5_MAX_PORTS]; | ||
struct lag_tracker tracker; | ||
struct delayed_work bond_work; | ||
struct notifier_block nb; | ||
}; | ||
|
||
static inline struct mlx5_lag * | ||
mlx5_lag_dev_get(struct mlx5_core_dev *dev) | ||
{ | ||
return dev->priv.lag; | ||
} | ||
|
||
static inline bool | ||
__mlx5_lag_is_active(struct mlx5_lag *ldev) | ||
{ | ||
return !!(ldev->flags & MLX5_LAG_MODE_FLAGS); | ||
} | ||
|
||
void mlx5_modify_lag(struct mlx5_lag *ldev, | ||
struct lag_tracker *tracker); | ||
int mlx5_activate_lag(struct mlx5_lag *ldev, | ||
struct lag_tracker *tracker, | ||
u8 flags); | ||
int mlx5_lag_dev_get_netdev_idx(struct mlx5_lag *ldev, | ||
struct net_device *ndev); | ||
|
||
#endif /* __MLX5_LAG_H__ */ |