2021-08-19 17:08:48 -07:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
/* Copyright (C) 2019-2021, Intel Corporation. */
|
|
|
|
|
|
|
|
#ifndef _ICE_ESWITCH_H_
|
|
|
|
#define _ICE_ESWITCH_H_
|
|
|
|
|
|
|
|
#include <net/devlink.h>
|
|
|
|
|
|
|
|
#ifdef CONFIG_ICE_SWITCHDEV
|
2023-10-24 13:09:27 +02:00
|
|
|
void ice_eswitch_detach(struct ice_pf *pf, struct ice_vf *vf);
|
|
|
|
int
|
|
|
|
ice_eswitch_attach(struct ice_pf *pf, struct ice_vf *vf);
|
2024-03-01 12:54:11 +01:00
|
|
|
void ice_eswitch_rebuild(struct ice_pf *pf);
|
2021-08-19 17:08:54 -07:00
|
|
|
|
2021-08-19 17:08:48 -07:00
|
|
|
int ice_eswitch_mode_get(struct devlink *devlink, u16 *mode);
|
|
|
|
int
|
|
|
|
ice_eswitch_mode_set(struct devlink *devlink, u16 mode,
|
|
|
|
struct netlink_ext_ack *extack);
|
|
|
|
bool ice_is_eswitch_mode_switchdev(struct ice_pf *pf);
|
2021-08-19 17:08:56 -07:00
|
|
|
|
2023-10-24 13:09:22 +02:00
|
|
|
void ice_eswitch_update_repr(unsigned long repr_id, struct ice_vsi *vsi);
|
2021-08-19 17:08:57 -07:00
|
|
|
|
|
|
|
void ice_eswitch_stop_all_tx_queues(struct ice_pf *pf);
|
2021-08-19 17:08:58 -07:00
|
|
|
|
|
|
|
void ice_eswitch_set_target_vsi(struct sk_buff *skb,
|
|
|
|
struct ice_tx_offload_params *off);
|
|
|
|
netdev_tx_t
|
|
|
|
ice_eswitch_port_start_xmit(struct sk_buff *skb, struct net_device *netdev);
|
2024-03-01 12:54:13 +01:00
|
|
|
struct net_device *ice_eswitch_get_target(struct ice_rx_ring *rx_ring,
|
|
|
|
union ice_32b_rx_flex_desc *rx_desc);
|
2021-08-19 17:08:48 -07:00
|
|
|
#else /* CONFIG_ICE_SWITCHDEV */
|
2023-10-24 13:09:27 +02:00
|
|
|
static inline void ice_eswitch_detach(struct ice_pf *pf, struct ice_vf *vf) { }
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
ice_eswitch_attach(struct ice_pf *pf, struct ice_vf *vf)
|
|
|
|
{
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
}
|
2021-08-19 17:08:54 -07:00
|
|
|
|
2021-08-19 17:08:57 -07:00
|
|
|
static inline void ice_eswitch_stop_all_tx_queues(struct ice_pf *pf) { }
|
|
|
|
|
2021-08-19 17:08:58 -07:00
|
|
|
static inline void
|
|
|
|
ice_eswitch_set_target_vsi(struct sk_buff *skb,
|
|
|
|
struct ice_tx_offload_params *off) { }
|
|
|
|
|
2023-10-24 13:09:21 +02:00
|
|
|
static inline void
|
2023-10-24 13:09:22 +02:00
|
|
|
ice_eswitch_update_repr(unsigned long repr_id, struct ice_vsi *vsi) { }
|
2021-08-19 17:08:56 -07:00
|
|
|
|
2021-08-19 17:08:54 -07:00
|
|
|
static inline int ice_eswitch_configure(struct ice_pf *pf)
|
|
|
|
{
|
2022-04-01 14:54:38 +02:00
|
|
|
return 0;
|
2021-08-19 17:08:54 -07:00
|
|
|
}
|
|
|
|
|
2021-08-19 17:08:57 -07:00
|
|
|
static inline int ice_eswitch_rebuild(struct ice_pf *pf)
|
|
|
|
{
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
}
|
|
|
|
|
2021-08-19 17:08:54 -07:00
|
|
|
static inline int ice_eswitch_mode_get(struct devlink *devlink, u16 *mode)
|
2021-08-19 17:08:48 -07:00
|
|
|
{
|
|
|
|
return DEVLINK_ESWITCH_MODE_LEGACY;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
ice_eswitch_mode_set(struct devlink *devlink, u16 mode,
|
|
|
|
struct netlink_ext_ack *extack)
|
|
|
|
{
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
}
|
|
|
|
|
2021-08-19 17:08:54 -07:00
|
|
|
static inline bool ice_is_eswitch_mode_switchdev(struct ice_pf *pf)
|
2021-08-19 17:08:48 -07:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2021-08-19 17:08:58 -07:00
|
|
|
|
|
|
|
static inline netdev_tx_t
|
|
|
|
ice_eswitch_port_start_xmit(struct sk_buff *skb, struct net_device *netdev)
|
|
|
|
{
|
|
|
|
return NETDEV_TX_BUSY;
|
|
|
|
}
|
2024-03-01 12:54:13 +01:00
|
|
|
|
|
|
|
static inline struct net_device *
|
|
|
|
ice_eswitch_get_target(struct ice_rx_ring *rx_ring,
|
|
|
|
union ice_32b_rx_flex_desc *rx_desc)
|
|
|
|
{
|
|
|
|
return rx_ring->netdev;
|
|
|
|
}
|
2021-08-19 17:08:48 -07:00
|
|
|
#endif /* CONFIG_ICE_SWITCHDEV */
|
|
|
|
#endif /* _ICE_ESWITCH_H_ */
|