1/* SPDX-License-Identifier: GPL-2.0 */ 2/* Copyright (C) 2019-2021, Intel Corporation. */ 3 4#ifndef _ICE_ESWITCH_H_ 5#define _ICE_ESWITCH_H_ 6 7#include <net/devlink.h> 8 9#ifdef CONFIG_ICE_SWITCHDEV 10void ice_eswitch_release(struct ice_pf *pf); 11int ice_eswitch_configure(struct ice_pf *pf); 12int ice_eswitch_rebuild(struct ice_pf *pf); 13 14int ice_eswitch_mode_get(struct devlink *devlink, u16 *mode); 15int 16ice_eswitch_mode_set(struct devlink *devlink, u16 mode, 17 struct netlink_ext_ack *extack); 18bool ice_is_eswitch_mode_switchdev(struct ice_pf *pf); 19 20void ice_eswitch_update_repr(struct ice_vsi *vsi); 21 22void ice_eswitch_stop_all_tx_queues(struct ice_pf *pf); 23 24void ice_eswitch_set_target_vsi(struct sk_buff *skb, 25 struct ice_tx_offload_params *off); 26netdev_tx_t 27ice_eswitch_port_start_xmit(struct sk_buff *skb, struct net_device *netdev); 28#else /* CONFIG_ICE_SWITCHDEV */ 29static inline void ice_eswitch_release(struct ice_pf *pf) { } 30 31static inline void ice_eswitch_stop_all_tx_queues(struct ice_pf *pf) { } 32 33static inline void 34ice_eswitch_set_target_vsi(struct sk_buff *skb, 35 struct ice_tx_offload_params *off) { } 36 37static inline void ice_eswitch_update_repr(struct ice_vsi *vsi) { } 38 39static inline int ice_eswitch_configure(struct ice_pf *pf) 40{ 41 return 0; 42} 43 44static inline int ice_eswitch_rebuild(struct ice_pf *pf) 45{ 46 return -EOPNOTSUPP; 47} 48 49static inline int ice_eswitch_mode_get(struct devlink *devlink, u16 *mode) 50{ 51 return DEVLINK_ESWITCH_MODE_LEGACY; 52} 53 54static inline int 55ice_eswitch_mode_set(struct devlink *devlink, u16 mode, 56 struct netlink_ext_ack *extack) 57{ 58 return -EOPNOTSUPP; 59} 60 61static inline bool ice_is_eswitch_mode_switchdev(struct ice_pf *pf) 62{ 63 return false; 64} 65 66static inline netdev_tx_t 67ice_eswitch_port_start_xmit(struct sk_buff *skb, struct net_device *netdev) 68{ 69 return NETDEV_TX_BUSY; 70} 71#endif /* CONFIG_ICE_SWITCHDEV */ 72#endif /* _ICE_ESWITCH_H_ */ 73