1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (C) 2018-2021, Intel Corporation. */
7 #include <linux/netdevice.h>
9 /* LAG roles for netdev */
21 struct ice_pf *pf; /* backlink to PF struct */
22 struct net_device *netdev; /* this PF's netdev */
23 struct net_device *peer_netdev;
24 struct net_device *upper_netdev; /* upper bonding netdev */
25 struct notifier_block notif_block;
26 u8 bonded:1; /* currently bonded */
27 u8 master:1; /* this is a master */
28 u8 handler:1; /* did we register a rx_netdev_handler */
29 /* each thing blocking bonding will increment this value by one.
30 * If this value is zero, then bonding is allowed.
36 int ice_init_lag(struct ice_pf *pf);
37 void ice_deinit_lag(struct ice_pf *pf);
38 rx_handler_result_t ice_lag_nop_handler(struct sk_buff **pskb);
41 * ice_disable_lag - increment LAG disable count
44 static inline void ice_disable_lag(struct ice_lag *lag)
46 /* If LAG this PF is not already disabled, disable it */
48 if (!netdev_is_rx_handler_busy(lag->netdev)) {
49 if (!netdev_rx_handler_register(lag->netdev,
59 * ice_enable_lag - decrement disable count for a PF
62 * Decrement the disable counter for a port, and if that count reaches
63 * zero, then remove the no-op Rx handler from that netdev
65 static inline void ice_enable_lag(struct ice_lag *lag)
69 if (!lag->dis_lag && lag->handler) {
71 netdev_rx_handler_unregister(lag->netdev);
78 * ice_is_lag_dis - is LAG disabled
81 * Return true if bonding is disabled
83 static inline bool ice_is_lag_dis(struct ice_lag *lag)
85 return !!(lag->dis_lag);
87 #endif /* _ICE_LAG_H_ */