Linux Audio

Check our new training course

Loading...
v6.13.7
  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#include "devlink/devlink_port.h"
  9
 10#ifdef CONFIG_ICE_SWITCHDEV
 11void ice_eswitch_detach_vf(struct ice_pf *pf, struct ice_vf *vf);
 12void ice_eswitch_detach_sf(struct ice_pf *pf, struct ice_dynamic_port *sf);
 13int ice_eswitch_attach_vf(struct ice_pf *pf, struct ice_vf *vf);
 14int ice_eswitch_attach_sf(struct ice_pf *pf, struct ice_dynamic_port *sf);
 15
 16int ice_eswitch_mode_get(struct devlink *devlink, u16 *mode);
 17int
 18ice_eswitch_mode_set(struct devlink *devlink, u16 mode,
 19		     struct netlink_ext_ack *extack);
 20bool ice_is_eswitch_mode_switchdev(struct ice_pf *pf);
 21
 22void ice_eswitch_update_repr(unsigned long *repr_id, struct ice_vsi *vsi);
 23
 24void ice_eswitch_stop_all_tx_queues(struct ice_pf *pf);
 
 
 
 
 
 25
 26void ice_eswitch_set_target_vsi(struct sk_buff *skb,
 27				struct ice_tx_offload_params *off);
 28netdev_tx_t
 29ice_eswitch_port_start_xmit(struct sk_buff *skb, struct net_device *netdev);
 30struct net_device *ice_eswitch_get_target(struct ice_rx_ring *rx_ring,
 31					  union ice_32b_rx_flex_desc *rx_desc);
 32
 33int ice_eswitch_cfg_vsi(struct ice_vsi *vsi, const u8 *mac);
 34void ice_eswitch_decfg_vsi(struct ice_vsi *vsi, const u8 *mac);
 35#else /* CONFIG_ICE_SWITCHDEV */
 36static inline void
 37ice_eswitch_detach_vf(struct ice_pf *pf, struct ice_vf *vf) { }
 38
 39static inline void
 40ice_eswitch_detach_sf(struct ice_pf *pf, struct ice_dynamic_port *sf) { }
 41
 42static inline int
 43ice_eswitch_attach_vf(struct ice_pf *pf, struct ice_vf *vf)
 44{
 45	return -EOPNOTSUPP;
 46}
 47
 48static inline int
 49ice_eswitch_attach_sf(struct ice_pf *pf, struct ice_dynamic_port *sf)
 
 50{
 51	return -EOPNOTSUPP;
 52}
 53
 54static inline void ice_eswitch_stop_all_tx_queues(struct ice_pf *pf) { }
 55
 56static inline void
 57ice_eswitch_set_target_vsi(struct sk_buff *skb,
 58			   struct ice_tx_offload_params *off) { }
 59
 60static inline void
 61ice_eswitch_update_repr(unsigned long *repr_id, struct ice_vsi *vsi) { }
 
 
 
 
 
 
 
 
 
 62
 63static inline int ice_eswitch_mode_get(struct devlink *devlink, u16 *mode)
 64{
 65	return DEVLINK_ESWITCH_MODE_LEGACY;
 66}
 67
 68static inline int
 69ice_eswitch_mode_set(struct devlink *devlink, u16 mode,
 70		     struct netlink_ext_ack *extack)
 71{
 72	return -EOPNOTSUPP;
 73}
 74
 75static inline bool ice_is_eswitch_mode_switchdev(struct ice_pf *pf)
 76{
 77	return false;
 78}
 79
 80static inline netdev_tx_t
 81ice_eswitch_port_start_xmit(struct sk_buff *skb, struct net_device *netdev)
 82{
 83	return NETDEV_TX_BUSY;
 84}
 85
 86static inline struct net_device *
 87ice_eswitch_get_target(struct ice_rx_ring *rx_ring,
 88		       union ice_32b_rx_flex_desc *rx_desc)
 89{
 90	return rx_ring->netdev;
 91}
 92
 93static inline int ice_eswitch_cfg_vsi(struct ice_vsi *vsi, const u8 *mac)
 94{
 95	return -EOPNOTSUPP;
 96}
 97
 98static inline void ice_eswitch_decfg_vsi(struct ice_vsi *vsi, const u8 *mac) { }
 99#endif /* CONFIG_ICE_SWITCHDEV */
100#endif /* _ICE_ESWITCH_H_ */
v6.2
 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);
23int
24ice_eswitch_add_vf_mac_rule(struct ice_pf *pf, struct ice_vf *vf,
25			    const u8 *mac);
26void ice_eswitch_replay_vf_mac_rule(struct ice_vf *vf);
27void ice_eswitch_del_vf_mac_rule(struct ice_vf *vf);
28
29void ice_eswitch_set_target_vsi(struct sk_buff *skb,
30				struct ice_tx_offload_params *off);
31netdev_tx_t
32ice_eswitch_port_start_xmit(struct sk_buff *skb, struct net_device *netdev);
 
 
 
 
 
33#else /* CONFIG_ICE_SWITCHDEV */
34static inline void ice_eswitch_release(struct ice_pf *pf) { }
 
35
36static inline void ice_eswitch_stop_all_tx_queues(struct ice_pf *pf) { }
37static inline void ice_eswitch_replay_vf_mac_rule(struct ice_vf *vf) { }
38static inline void ice_eswitch_del_vf_mac_rule(struct ice_vf *vf) { }
 
 
 
 
 
39
40static inline int
41ice_eswitch_add_vf_mac_rule(struct ice_pf *pf, struct ice_vf *vf,
42			    const u8 *mac)
43{
44	return -EOPNOTSUPP;
45}
46
 
 
47static inline void
48ice_eswitch_set_target_vsi(struct sk_buff *skb,
49			   struct ice_tx_offload_params *off) { }
50
51static inline void ice_eswitch_update_repr(struct ice_vsi *vsi) { }
52
53static inline int ice_eswitch_configure(struct ice_pf *pf)
54{
55	return 0;
56}
57
58static inline int ice_eswitch_rebuild(struct ice_pf *pf)
59{
60	return -EOPNOTSUPP;
61}
62
63static inline int ice_eswitch_mode_get(struct devlink *devlink, u16 *mode)
64{
65	return DEVLINK_ESWITCH_MODE_LEGACY;
66}
67
68static inline int
69ice_eswitch_mode_set(struct devlink *devlink, u16 mode,
70		     struct netlink_ext_ack *extack)
71{
72	return -EOPNOTSUPP;
73}
74
75static inline bool ice_is_eswitch_mode_switchdev(struct ice_pf *pf)
76{
77	return false;
78}
79
80static inline netdev_tx_t
81ice_eswitch_port_start_xmit(struct sk_buff *skb, struct net_device *netdev)
82{
83	return NETDEV_TX_BUSY;
84}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85#endif /* CONFIG_ICE_SWITCHDEV */
86#endif /* _ICE_ESWITCH_H_ */