Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /* Copyright (C) 2019-2021, Intel Corporation. */
0003 
0004 #ifndef _ICE_ESWITCH_H_
0005 #define _ICE_ESWITCH_H_
0006 
0007 #include <net/devlink.h>
0008 
0009 #ifdef CONFIG_ICE_SWITCHDEV
0010 void ice_eswitch_release(struct ice_pf *pf);
0011 int ice_eswitch_configure(struct ice_pf *pf);
0012 int ice_eswitch_rebuild(struct ice_pf *pf);
0013 
0014 int ice_eswitch_mode_get(struct devlink *devlink, u16 *mode);
0015 int
0016 ice_eswitch_mode_set(struct devlink *devlink, u16 mode,
0017              struct netlink_ext_ack *extack);
0018 bool ice_is_eswitch_mode_switchdev(struct ice_pf *pf);
0019 
0020 void ice_eswitch_update_repr(struct ice_vsi *vsi);
0021 
0022 void ice_eswitch_stop_all_tx_queues(struct ice_pf *pf);
0023 int
0024 ice_eswitch_add_vf_mac_rule(struct ice_pf *pf, struct ice_vf *vf,
0025                 const u8 *mac);
0026 void ice_eswitch_replay_vf_mac_rule(struct ice_vf *vf);
0027 void ice_eswitch_del_vf_mac_rule(struct ice_vf *vf);
0028 
0029 void ice_eswitch_set_target_vsi(struct sk_buff *skb,
0030                 struct ice_tx_offload_params *off);
0031 netdev_tx_t
0032 ice_eswitch_port_start_xmit(struct sk_buff *skb, struct net_device *netdev);
0033 #else /* CONFIG_ICE_SWITCHDEV */
0034 static inline void ice_eswitch_release(struct ice_pf *pf) { }
0035 
0036 static inline void ice_eswitch_stop_all_tx_queues(struct ice_pf *pf) { }
0037 static inline void ice_eswitch_replay_vf_mac_rule(struct ice_vf *vf) { }
0038 static inline void ice_eswitch_del_vf_mac_rule(struct ice_vf *vf) { }
0039 
0040 static inline int
0041 ice_eswitch_add_vf_mac_rule(struct ice_pf *pf, struct ice_vf *vf,
0042                 const u8 *mac)
0043 {
0044     return -EOPNOTSUPP;
0045 }
0046 
0047 static inline void
0048 ice_eswitch_set_target_vsi(struct sk_buff *skb,
0049                struct ice_tx_offload_params *off) { }
0050 
0051 static inline void ice_eswitch_update_repr(struct ice_vsi *vsi) { }
0052 
0053 static inline int ice_eswitch_configure(struct ice_pf *pf)
0054 {
0055     return 0;
0056 }
0057 
0058 static inline int ice_eswitch_rebuild(struct ice_pf *pf)
0059 {
0060     return -EOPNOTSUPP;
0061 }
0062 
0063 static inline int ice_eswitch_mode_get(struct devlink *devlink, u16 *mode)
0064 {
0065     return DEVLINK_ESWITCH_MODE_LEGACY;
0066 }
0067 
0068 static inline int
0069 ice_eswitch_mode_set(struct devlink *devlink, u16 mode,
0070              struct netlink_ext_ack *extack)
0071 {
0072     return -EOPNOTSUPP;
0073 }
0074 
0075 static inline bool ice_is_eswitch_mode_switchdev(struct ice_pf *pf)
0076 {
0077     return false;
0078 }
0079 
0080 static inline netdev_tx_t
0081 ice_eswitch_port_start_xmit(struct sk_buff *skb, struct net_device *netdev)
0082 {
0083     return NETDEV_TX_BUSY;
0084 }
0085 #endif /* CONFIG_ICE_SWITCHDEV */
0086 #endif /* _ICE_ESWITCH_H_ */