xref: /OK3568_Linux_fs/kernel/include/net/net_failover.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */
2*4882a593Smuzhiyun /* Copyright (c) 2018, Intel Corporation. */
3*4882a593Smuzhiyun 
4*4882a593Smuzhiyun #ifndef _NET_FAILOVER_H
5*4882a593Smuzhiyun #define _NET_FAILOVER_H
6*4882a593Smuzhiyun 
7*4882a593Smuzhiyun #include <net/failover.h>
8*4882a593Smuzhiyun 
9*4882a593Smuzhiyun /* failover state */
10*4882a593Smuzhiyun struct net_failover_info {
11*4882a593Smuzhiyun 	/* primary netdev with same MAC */
12*4882a593Smuzhiyun 	struct net_device __rcu *primary_dev;
13*4882a593Smuzhiyun 
14*4882a593Smuzhiyun 	/* standby netdev */
15*4882a593Smuzhiyun 	struct net_device __rcu *standby_dev;
16*4882a593Smuzhiyun 
17*4882a593Smuzhiyun 	/* primary netdev stats */
18*4882a593Smuzhiyun 	struct rtnl_link_stats64 primary_stats;
19*4882a593Smuzhiyun 
20*4882a593Smuzhiyun 	/* standby netdev stats */
21*4882a593Smuzhiyun 	struct rtnl_link_stats64 standby_stats;
22*4882a593Smuzhiyun 
23*4882a593Smuzhiyun 	/* aggregated stats */
24*4882a593Smuzhiyun 	struct rtnl_link_stats64 failover_stats;
25*4882a593Smuzhiyun 
26*4882a593Smuzhiyun 	/* spinlock while updating stats */
27*4882a593Smuzhiyun 	spinlock_t stats_lock;
28*4882a593Smuzhiyun };
29*4882a593Smuzhiyun 
30*4882a593Smuzhiyun struct failover *net_failover_create(struct net_device *standby_dev);
31*4882a593Smuzhiyun void net_failover_destroy(struct failover *failover);
32*4882a593Smuzhiyun 
33*4882a593Smuzhiyun #define FAILOVER_VLAN_FEATURES	(NETIF_F_HW_CSUM | NETIF_F_SG | \
34*4882a593Smuzhiyun 				 NETIF_F_FRAGLIST | NETIF_F_ALL_TSO | \
35*4882a593Smuzhiyun 				 NETIF_F_HIGHDMA | NETIF_F_LRO)
36*4882a593Smuzhiyun 
37*4882a593Smuzhiyun #define FAILOVER_ENC_FEATURES	(NETIF_F_HW_CSUM | NETIF_F_SG | \
38*4882a593Smuzhiyun 				 NETIF_F_RXCSUM | NETIF_F_ALL_TSO)
39*4882a593Smuzhiyun 
40*4882a593Smuzhiyun #endif /* _NET_FAILOVER_H */
41