The use of a source MAC to direct packets from the VF to the corresponding port representor is only ok if there is only one MAC on a VF. To support this functionality when the number of MACs on a VF is greater, it is necessary to match a source VSI instead of a source MAC. Let's use the new switch API that allows matching on metadata. If MAC isn't used in match criteria there is no need to handle adding rule after virtchnl command. Instead add new rule while port representor is being configured. Remove rule_added field, checking for sp_rule can be used instead. Remove also checking for switchdev running in deleting rule as it can be called from unroll context when running flag isn't set. Checking for sp_rule covers both context (with and without running flag). Rules are added in eswitch configuration flow, so there is no need to have replay function. Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com> Reviewed-by: Piotr Raczynski <piotr.raczynski@intel.com> Reviewed-by: Simon Horman <simon.horman@corigine.com> Reviewed-by: Leon Romanovsky <leonro@nvidia.com> Tested-by: Sujai Buvaneswaran <sujai.buvaneswaran@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
72 lines
1.8 KiB
C
72 lines
1.8 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);
|
|
|
|
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_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 0;
|
|
}
|
|
|
|
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_ */
|