18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/* Copyright (c) 2018, Intel Corporation. */
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci#ifndef _NET_FAILOVER_H
58c2ecf20Sopenharmony_ci#define _NET_FAILOVER_H
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#include <net/failover.h>
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci/* failover state */
108c2ecf20Sopenharmony_cistruct net_failover_info {
118c2ecf20Sopenharmony_ci	/* primary netdev with same MAC */
128c2ecf20Sopenharmony_ci	struct net_device __rcu *primary_dev;
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci	/* standby netdev */
158c2ecf20Sopenharmony_ci	struct net_device __rcu *standby_dev;
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci	/* primary netdev stats */
188c2ecf20Sopenharmony_ci	struct rtnl_link_stats64 primary_stats;
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci	/* standby netdev stats */
218c2ecf20Sopenharmony_ci	struct rtnl_link_stats64 standby_stats;
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci	/* aggregated stats */
248c2ecf20Sopenharmony_ci	struct rtnl_link_stats64 failover_stats;
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci	/* spinlock while updating stats */
278c2ecf20Sopenharmony_ci	spinlock_t stats_lock;
288c2ecf20Sopenharmony_ci};
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_cistruct failover *net_failover_create(struct net_device *standby_dev);
318c2ecf20Sopenharmony_civoid net_failover_destroy(struct failover *failover);
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci#define FAILOVER_VLAN_FEATURES	(NETIF_F_HW_CSUM | NETIF_F_SG | \
348c2ecf20Sopenharmony_ci				 NETIF_F_FRAGLIST | NETIF_F_ALL_TSO | \
358c2ecf20Sopenharmony_ci				 NETIF_F_HIGHDMA | NETIF_F_LRO)
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci#define FAILOVER_ENC_FEATURES	(NETIF_F_HW_CSUM | NETIF_F_SG | \
388c2ecf20Sopenharmony_ci				 NETIF_F_RXCSUM | NETIF_F_ALL_TSO)
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci#endif /* _NET_FAILOVER_H */
41