mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-27 04:54:41 +08:00
c1e5da5dd4
In current switchdev implementation, every VF PR is assigned to individual ring on switchdev ctrl VSI. For slow-path traffic, there is a mapping VF->ring done in software based on src_vsi value (by calling ice_eswitch_get_target_netdev function). With this change, HW solution is introduced which is more efficient. For each VF, src MAC (VF's MAC) filter will be created, which forwards packets to the corresponding switchdev ctrl VSI queue based on src MAC address. This filter has to be removed and then replayed in case of resetting one VF. Keep information about this rule in repr->mac_rule, thanks to that we know which rule has to be removed and replayed for a given VF. In case of CORE/GLOBAL all rules are removed automatically. We have to take care of readding them. This is done by ice_replay_vsi_adv_rule. When driver leaves switchdev mode, remove all advanced rules from switchdev ctrl VSI. This is done by ice_rem_adv_rule_for_vsi. Flag repr->rule_added is needed because in some cases reset might be triggered before VF sends request to add MAC. Co-developed-by: Grzegorz Nitka <grzegorz.nitka@intel.com> Signed-off-by: Grzegorz Nitka <grzegorz.nitka@intel.com> Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com> Tested-by: Sandeep Penigalapati <sandeep.penigalapati@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
87 lines
2.3 KiB
C
87 lines
2.3 KiB
C
/* 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
|
|
void ice_eswitch_release(struct ice_pf *pf);
|
|
int ice_eswitch_configure(struct ice_pf *pf);
|
|
int ice_eswitch_rebuild(struct ice_pf *pf);
|
|
|
|
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);
|
|
|
|
void ice_eswitch_update_repr(struct ice_vsi *vsi);
|
|
|
|
void ice_eswitch_stop_all_tx_queues(struct ice_pf *pf);
|
|
int
|
|
ice_eswitch_add_vf_mac_rule(struct ice_pf *pf, struct ice_vf *vf,
|
|
const u8 *mac);
|
|
void ice_eswitch_replay_vf_mac_rule(struct ice_vf *vf);
|
|
void ice_eswitch_del_vf_mac_rule(struct ice_vf *vf);
|
|
|
|
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);
|
|
#else /* CONFIG_ICE_SWITCHDEV */
|
|
static inline void ice_eswitch_release(struct ice_pf *pf) { }
|
|
|
|
static inline void ice_eswitch_stop_all_tx_queues(struct ice_pf *pf) { }
|
|
static inline void ice_eswitch_replay_vf_mac_rule(struct ice_vf *vf) { }
|
|
static inline void ice_eswitch_del_vf_mac_rule(struct ice_vf *vf) { }
|
|
|
|
static inline int
|
|
ice_eswitch_add_vf_mac_rule(struct ice_pf *pf, struct ice_vf *vf,
|
|
const u8 *mac)
|
|
{
|
|
return -EOPNOTSUPP;
|
|
}
|
|
|
|
static inline void
|
|
ice_eswitch_set_target_vsi(struct sk_buff *skb,
|
|
struct ice_tx_offload_params *off) { }
|
|
|
|
static inline void ice_eswitch_update_repr(struct ice_vsi *vsi) { }
|
|
|
|
static inline int ice_eswitch_configure(struct ice_pf *pf)
|
|
{
|
|
return -EOPNOTSUPP;
|
|
}
|
|
|
|
static inline int ice_eswitch_rebuild(struct ice_pf *pf)
|
|
{
|
|
return -EOPNOTSUPP;
|
|
}
|
|
|
|
static inline int ice_eswitch_mode_get(struct devlink *devlink, u16 *mode)
|
|
{
|
|
return DEVLINK_ESWITCH_MODE_LEGACY;
|
|
}
|
|
|
|
static inline int
|
|
ice_eswitch_mode_set(struct devlink *devlink, u16 mode,
|
|
struct netlink_ext_ack *extack)
|
|
{
|
|
return -EOPNOTSUPP;
|
|
}
|
|
|
|
static inline bool ice_is_eswitch_mode_switchdev(struct ice_pf *pf)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
static inline netdev_tx_t
|
|
ice_eswitch_port_start_xmit(struct sk_buff *skb, struct net_device *netdev)
|
|
{
|
|
return NETDEV_TX_BUSY;
|
|
}
|
|
#endif /* CONFIG_ICE_SWITCHDEV */
|
|
#endif /* _ICE_ESWITCH_H_ */
|