1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 /* Copyright (c) 2019 Mellanox Technologies. */
16 MLX5_LAG_FLAG_ROCE = 1 << 0,
17 MLX5_LAG_FLAG_SRIOV = 1 << 1,
18 MLX5_LAG_FLAG_MULTIPATH = 1 << 2,
21 #define MLX5_LAG_MODE_FLAGS (MLX5_LAG_FLAG_ROCE | MLX5_LAG_FLAG_SRIOV |\
22 MLX5_LAG_FLAG_MULTIPATH)
25 struct mlx5_core_dev *dev;
26 struct net_device *netdev;
29 /* Used for collection of netdev event info. */
31 enum netdev_lag_tx_type tx_type;
32 struct netdev_lag_lower_state_info netdev_state[MLX5_MAX_PORTS];
33 unsigned int is_bonded:1;
36 /* LAG data of a ConnectX card.
37 * It serves both its phys functions.
41 u8 v2p_map[MLX5_MAX_PORTS];
42 struct lag_func pf[MLX5_MAX_PORTS];
43 struct lag_tracker tracker;
44 struct workqueue_struct *wq;
45 struct delayed_work bond_work;
46 struct notifier_block nb;
50 static inline struct mlx5_lag *
51 mlx5_lag_dev_get(struct mlx5_core_dev *dev)
57 __mlx5_lag_is_active(struct mlx5_lag *ldev)
59 return !!(ldev->flags & MLX5_LAG_MODE_FLAGS);
62 void mlx5_modify_lag(struct mlx5_lag *ldev,
63 struct lag_tracker *tracker);
64 int mlx5_activate_lag(struct mlx5_lag *ldev,
65 struct lag_tracker *tracker,
67 int mlx5_lag_dev_get_netdev_idx(struct mlx5_lag *ldev,
68 struct net_device *ndev);
70 #endif /* __MLX5_LAG_H__ */