xref: /OK3568_Linux_fs/kernel/include/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 _FAILOVER_H
5*4882a593Smuzhiyun #define _FAILOVER_H
6*4882a593Smuzhiyun 
7*4882a593Smuzhiyun #include <linux/netdevice.h>
8*4882a593Smuzhiyun 
9*4882a593Smuzhiyun struct failover_ops {
10*4882a593Smuzhiyun 	int (*slave_pre_register)(struct net_device *slave_dev,
11*4882a593Smuzhiyun 				  struct net_device *failover_dev);
12*4882a593Smuzhiyun 	int (*slave_register)(struct net_device *slave_dev,
13*4882a593Smuzhiyun 			      struct net_device *failover_dev);
14*4882a593Smuzhiyun 	int (*slave_pre_unregister)(struct net_device *slave_dev,
15*4882a593Smuzhiyun 				    struct net_device *failover_dev);
16*4882a593Smuzhiyun 	int (*slave_unregister)(struct net_device *slave_dev,
17*4882a593Smuzhiyun 				struct net_device *failover_dev);
18*4882a593Smuzhiyun 	int (*slave_link_change)(struct net_device *slave_dev,
19*4882a593Smuzhiyun 				 struct net_device *failover_dev);
20*4882a593Smuzhiyun 	int (*slave_name_change)(struct net_device *slave_dev,
21*4882a593Smuzhiyun 				 struct net_device *failover_dev);
22*4882a593Smuzhiyun 	rx_handler_result_t (*slave_handle_frame)(struct sk_buff **pskb);
23*4882a593Smuzhiyun };
24*4882a593Smuzhiyun 
25*4882a593Smuzhiyun struct failover {
26*4882a593Smuzhiyun 	struct list_head list;
27*4882a593Smuzhiyun 	struct net_device __rcu *failover_dev;
28*4882a593Smuzhiyun 	struct failover_ops __rcu *ops;
29*4882a593Smuzhiyun };
30*4882a593Smuzhiyun 
31*4882a593Smuzhiyun struct failover *failover_register(struct net_device *dev,
32*4882a593Smuzhiyun 				   struct failover_ops *ops);
33*4882a593Smuzhiyun void failover_unregister(struct failover *failover);
34*4882a593Smuzhiyun int failover_slave_unregister(struct net_device *slave_dev);
35*4882a593Smuzhiyun 
36*4882a593Smuzhiyun #endif /* _FAILOVER_H */
37