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