]>
Commit | Line | Data |
---|---|---|
df006dd4 DE |
1 | /* SPDX-License-Identifier: GPL-2.0 */ |
2 | /* Copyright (C) 2018-2021, Intel Corporation. */ | |
3 | ||
4 | #ifndef _ICE_LAG_H_ | |
5 | #define _ICE_LAG_H_ | |
6 | ||
7 | #include <linux/netdevice.h> | |
8 | ||
9 | /* LAG roles for netdev */ | |
10 | enum ice_lag_role { | |
11 | ICE_LAG_NONE, | |
12 | ICE_LAG_PRIMARY, | |
13 | ICE_LAG_BACKUP, | |
14 | ICE_LAG_UNSET | |
15 | }; | |
16 | ||
41ccedf5 DE |
17 | #define ICE_LAG_INVALID_PORT 0xFF |
18 | ||
3579aa86 DE |
19 | #define ICE_LAG_RESET_RETRIES 5 |
20 | ||
df006dd4 | 21 | struct ice_pf; |
41ccedf5 DE |
22 | struct ice_vf; |
23 | ||
24 | struct ice_lag_netdev_list { | |
25 | struct list_head node; | |
26 | struct net_device *netdev; | |
27 | }; | |
df006dd4 DE |
28 | |
29 | /* LAG info struct */ | |
30 | struct ice_lag { | |
31 | struct ice_pf *pf; /* backlink to PF struct */ | |
32 | struct net_device *netdev; /* this PF's netdev */ | |
df006dd4 | 33 | struct net_device *upper_netdev; /* upper bonding netdev */ |
41ccedf5 | 34 | struct list_head *netdev_head; |
df006dd4 | 35 | struct notifier_block notif_block; |
41ccedf5 DE |
36 | s32 bond_mode; |
37 | u16 bond_swid; /* swid for primary interface */ | |
38 | u8 active_port; /* lport value for the current active port */ | |
df006dd4 | 39 | u8 bonded:1; /* currently bonded */ |
5c603001 | 40 | u8 primary:1; /* this is primary */ |
41ccedf5 DE |
41 | u16 pf_recipe; |
42 | u16 pf_rule_id; | |
43 | u16 cp_rule_idx; | |
df006dd4 DE |
44 | u8 role; |
45 | }; | |
46 | ||
41ccedf5 DE |
47 | /* LAG workqueue struct */ |
48 | struct ice_lag_work { | |
49 | struct work_struct lag_task; | |
50 | struct ice_lag_netdev_list netdev_list; | |
51 | struct ice_lag *lag; | |
52 | unsigned long event; | |
53 | struct net_device *event_netdev; | |
54 | union { | |
55 | struct netdev_notifier_changeupper_info changeupper_info; | |
56 | struct netdev_notifier_bonding_info bonding_info; | |
57 | struct netdev_notifier_info notifier_info; | |
58 | } info; | |
59 | }; | |
60 | ||
ec5a6c5f | 61 | void ice_lag_move_new_vf_nodes(struct ice_vf *vf); |
df006dd4 DE |
62 | int ice_init_lag(struct ice_pf *pf); |
63 | void ice_deinit_lag(struct ice_pf *pf); | |
3579aa86 | 64 | void ice_lag_rebuild(struct ice_pf *pf); |
776fe199 | 65 | bool ice_lag_is_switchdev_running(struct ice_pf *pf); |
df006dd4 | 66 | #endif /* _ICE_LAG_H_ */ |