162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/* Copyright (C) 2019-2021, Intel Corporation. */
362306a36Sopenharmony_ci
462306a36Sopenharmony_ci#ifndef _ICE_ESWITCH_H_
562306a36Sopenharmony_ci#define _ICE_ESWITCH_H_
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci#include <net/devlink.h>
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#ifdef CONFIG_ICE_SWITCHDEV
1062306a36Sopenharmony_civoid ice_eswitch_release(struct ice_pf *pf);
1162306a36Sopenharmony_ciint ice_eswitch_configure(struct ice_pf *pf);
1262306a36Sopenharmony_ciint ice_eswitch_rebuild(struct ice_pf *pf);
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ciint ice_eswitch_mode_get(struct devlink *devlink, u16 *mode);
1562306a36Sopenharmony_ciint
1662306a36Sopenharmony_ciice_eswitch_mode_set(struct devlink *devlink, u16 mode,
1762306a36Sopenharmony_ci		     struct netlink_ext_ack *extack);
1862306a36Sopenharmony_cibool ice_is_eswitch_mode_switchdev(struct ice_pf *pf);
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_civoid ice_eswitch_update_repr(struct ice_vsi *vsi);
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_civoid ice_eswitch_stop_all_tx_queues(struct ice_pf *pf);
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_civoid ice_eswitch_set_target_vsi(struct sk_buff *skb,
2562306a36Sopenharmony_ci				struct ice_tx_offload_params *off);
2662306a36Sopenharmony_cinetdev_tx_t
2762306a36Sopenharmony_ciice_eswitch_port_start_xmit(struct sk_buff *skb, struct net_device *netdev);
2862306a36Sopenharmony_ci#else /* CONFIG_ICE_SWITCHDEV */
2962306a36Sopenharmony_cistatic inline void ice_eswitch_release(struct ice_pf *pf) { }
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_cistatic inline void ice_eswitch_stop_all_tx_queues(struct ice_pf *pf) { }
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_cistatic inline void
3462306a36Sopenharmony_ciice_eswitch_set_target_vsi(struct sk_buff *skb,
3562306a36Sopenharmony_ci			   struct ice_tx_offload_params *off) { }
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_cistatic inline void ice_eswitch_update_repr(struct ice_vsi *vsi) { }
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_cistatic inline int ice_eswitch_configure(struct ice_pf *pf)
4062306a36Sopenharmony_ci{
4162306a36Sopenharmony_ci	return 0;
4262306a36Sopenharmony_ci}
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_cistatic inline int ice_eswitch_rebuild(struct ice_pf *pf)
4562306a36Sopenharmony_ci{
4662306a36Sopenharmony_ci	return -EOPNOTSUPP;
4762306a36Sopenharmony_ci}
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_cistatic inline int ice_eswitch_mode_get(struct devlink *devlink, u16 *mode)
5062306a36Sopenharmony_ci{
5162306a36Sopenharmony_ci	return DEVLINK_ESWITCH_MODE_LEGACY;
5262306a36Sopenharmony_ci}
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_cistatic inline int
5562306a36Sopenharmony_ciice_eswitch_mode_set(struct devlink *devlink, u16 mode,
5662306a36Sopenharmony_ci		     struct netlink_ext_ack *extack)
5762306a36Sopenharmony_ci{
5862306a36Sopenharmony_ci	return -EOPNOTSUPP;
5962306a36Sopenharmony_ci}
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_cistatic inline bool ice_is_eswitch_mode_switchdev(struct ice_pf *pf)
6262306a36Sopenharmony_ci{
6362306a36Sopenharmony_ci	return false;
6462306a36Sopenharmony_ci}
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_cistatic inline netdev_tx_t
6762306a36Sopenharmony_ciice_eswitch_port_start_xmit(struct sk_buff *skb, struct net_device *netdev)
6862306a36Sopenharmony_ci{
6962306a36Sopenharmony_ci	return NETDEV_TX_BUSY;
7062306a36Sopenharmony_ci}
7162306a36Sopenharmony_ci#endif /* CONFIG_ICE_SWITCHDEV */
7262306a36Sopenharmony_ci#endif /* _ICE_ESWITCH_H_ */
73