Commit 09ca9940 authored by Jakub Kicinski's avatar Jakub Kicinski

Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue

Tony Nguyen says:

====================
Intel Wired LAN Driver Updates 2024-05-06 (ice)

This series contains updates to ice driver only.

Paul adds support for additional E830 devices and adjusts naming for
existing E830 devices.

Marcin commonizes a couple of TC setup calls to reduce duplicated code.

Mateusz adds ice_vsi_cfg_params into ice_vsi to consolidate info.

* '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue:
  ice: refactor struct ice_vsi_cfg_params to be inside of struct ice_vsi
  ice: Deduplicate tc action setup
  ice: update E830 device ids and comments
  ice: add additional E830 device ids
====================

Link: https://lore.kernel.org/r/20240506170827.948682-1-anthony.l.nguyen@intel.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 05417aa9 deea427f
...@@ -1193,18 +1193,16 @@ static int ice_devlink_set_parent(struct devlink_rate *devlink_rate, ...@@ -1193,18 +1193,16 @@ static int ice_devlink_set_parent(struct devlink_rate *devlink_rate,
static int ice_devlink_reinit_up(struct ice_pf *pf) static int ice_devlink_reinit_up(struct ice_pf *pf)
{ {
struct ice_vsi *vsi = ice_get_main_vsi(pf); struct ice_vsi *vsi = ice_get_main_vsi(pf);
struct ice_vsi_cfg_params params;
int err; int err;
err = ice_init_dev(pf); err = ice_init_dev(pf);
if (err) if (err)
return err; return err;
params = ice_vsi_to_params(vsi); vsi->flags = ICE_VSI_FLAG_INIT;
params.flags = ICE_VSI_FLAG_INIT;
rtnl_lock(); rtnl_lock();
err = ice_vsi_cfg(vsi, &params); err = ice_vsi_cfg(vsi);
rtnl_unlock(); rtnl_unlock();
if (err) if (err)
goto err_vsi_cfg; goto err_vsi_cfg;
......
...@@ -331,7 +331,6 @@ struct ice_vsi { ...@@ -331,7 +331,6 @@ struct ice_vsi {
struct net_device *netdev; struct net_device *netdev;
struct ice_sw *vsw; /* switch this VSI is on */ struct ice_sw *vsw; /* switch this VSI is on */
struct ice_pf *back; /* back pointer to PF */ struct ice_pf *back; /* back pointer to PF */
struct ice_port_info *port_info; /* back pointer to port_info */
struct ice_rx_ring **rx_rings; /* Rx ring array */ struct ice_rx_ring **rx_rings; /* Rx ring array */
struct ice_tx_ring **tx_rings; /* Tx ring array */ struct ice_tx_ring **tx_rings; /* Tx ring array */
struct ice_q_vector **q_vectors; /* q_vector array */ struct ice_q_vector **q_vectors; /* q_vector array */
...@@ -349,12 +348,9 @@ struct ice_vsi { ...@@ -349,12 +348,9 @@ struct ice_vsi {
/* tell if only dynamic irq allocation is allowed */ /* tell if only dynamic irq allocation is allowed */
bool irq_dyn_alloc; bool irq_dyn_alloc;
enum ice_vsi_type type;
u16 vsi_num; /* HW (absolute) index of this VSI */ u16 vsi_num; /* HW (absolute) index of this VSI */
u16 idx; /* software index in pf->vsi[] */ u16 idx; /* software index in pf->vsi[] */
struct ice_vf *vf; /* VF associated with this VSI */
u16 num_gfltr; u16 num_gfltr;
u16 num_bfltr; u16 num_bfltr;
...@@ -446,12 +442,18 @@ struct ice_vsi { ...@@ -446,12 +442,18 @@ struct ice_vsi {
u8 old_numtc; u8 old_numtc;
u16 old_ena_tc; u16 old_ena_tc;
struct ice_channel *ch;
/* setup back reference, to which aggregator node this VSI /* setup back reference, to which aggregator node this VSI
* corresponds to * corresponds to
*/ */
struct ice_agg_node *agg_node; struct ice_agg_node *agg_node;
struct_group_tagged(ice_vsi_cfg_params, params,
struct ice_port_info *port_info; /* back pointer to port_info */
struct ice_channel *ch; /* VSI's channel structure, may be NULL */
struct ice_vf *vf; /* VF associated with this VSI, may be NULL */
u32 flags; /* VSI flags used for rebuild and configuration */
enum ice_vsi_type type; /* the type of the VSI */
);
} ____cacheline_internodealigned_in_smp; } ____cacheline_internodealigned_in_smp;
/* struct that defines an interrupt vector */ /* struct that defines an interrupt vector */
......
...@@ -160,10 +160,16 @@ static int ice_set_mac_type(struct ice_hw *hw) ...@@ -160,10 +160,16 @@ static int ice_set_mac_type(struct ice_hw *hw)
case ICE_DEV_ID_E825C_SGMII: case ICE_DEV_ID_E825C_SGMII:
hw->mac_type = ICE_MAC_GENERIC_3K_E825; hw->mac_type = ICE_MAC_GENERIC_3K_E825;
break; break;
case ICE_DEV_ID_E830_BACKPLANE: case ICE_DEV_ID_E830CC_BACKPLANE:
case ICE_DEV_ID_E830_QSFP56: case ICE_DEV_ID_E830CC_QSFP56:
case ICE_DEV_ID_E830_SFP: case ICE_DEV_ID_E830CC_SFP:
case ICE_DEV_ID_E830_SFP_DD: case ICE_DEV_ID_E830CC_SFP_DD:
case ICE_DEV_ID_E830C_BACKPLANE:
case ICE_DEV_ID_E830_XXV_BACKPLANE:
case ICE_DEV_ID_E830C_QSFP:
case ICE_DEV_ID_E830_XXV_QSFP:
case ICE_DEV_ID_E830C_SFP:
case ICE_DEV_ID_E830_XXV_SFP:
hw->mac_type = ICE_MAC_E830; hw->mac_type = ICE_MAC_E830;
break; break;
default: default:
......
...@@ -16,14 +16,26 @@ ...@@ -16,14 +16,26 @@
#define ICE_DEV_ID_E823L_1GBE 0x124F #define ICE_DEV_ID_E823L_1GBE 0x124F
/* Intel(R) Ethernet Connection E823-L for QSFP */ /* Intel(R) Ethernet Connection E823-L for QSFP */
#define ICE_DEV_ID_E823L_QSFP 0x151D #define ICE_DEV_ID_E823L_QSFP 0x151D
/* Intel(R) Ethernet Controller E830-CC for backplane */
#define ICE_DEV_ID_E830CC_BACKPLANE 0x12D1
/* Intel(R) Ethernet Controller E830-CC for QSFP */
#define ICE_DEV_ID_E830CC_QSFP56 0x12D2
/* Intel(R) Ethernet Controller E830-CC for SFP */
#define ICE_DEV_ID_E830CC_SFP 0x12D3
/* Intel(R) Ethernet Controller E830-CC for SFP-DD */
#define ICE_DEV_ID_E830CC_SFP_DD 0x12D4
/* Intel(R) Ethernet Controller E830-C for backplane */ /* Intel(R) Ethernet Controller E830-C for backplane */
#define ICE_DEV_ID_E830_BACKPLANE 0x12D1 #define ICE_DEV_ID_E830C_BACKPLANE 0x12D5
/* Intel(R) Ethernet Controller E830-C for QSFP */ /* Intel(R) Ethernet Controller E830-C for QSFP */
#define ICE_DEV_ID_E830_QSFP56 0x12D2 #define ICE_DEV_ID_E830C_QSFP 0x12D8
/* Intel(R) Ethernet Controller E830-C for SFP */ /* Intel(R) Ethernet Controller E830-C for SFP */
#define ICE_DEV_ID_E830_SFP 0x12D3 #define ICE_DEV_ID_E830C_SFP 0x12DA
/* Intel(R) Ethernet Controller E830-C for SFP-DD */ /* Intel(R) Ethernet Controller E830-XXV for backplane */
#define ICE_DEV_ID_E830_SFP_DD 0x12D4 #define ICE_DEV_ID_E830_XXV_BACKPLANE 0x12DC
/* Intel(R) Ethernet Controller E830-XXV for QSFP */
#define ICE_DEV_ID_E830_XXV_QSFP 0x12DD
/* Intel(R) Ethernet Controller E830-XXV for SFP */
#define ICE_DEV_ID_E830_XXV_SFP 0x12DE
/* Intel(R) Ethernet Controller E810-C for backplane */ /* Intel(R) Ethernet Controller E810-C for backplane */
#define ICE_DEV_ID_E810C_BACKPLANE 0x1591 #define ICE_DEV_ID_E810C_BACKPLANE 0x1591
/* Intel(R) Ethernet Controller E810-C for QSFP */ /* Intel(R) Ethernet Controller E810-C for QSFP */
......
...@@ -2227,10 +2227,8 @@ static int ice_vsi_cfg_tc_lan(struct ice_pf *pf, struct ice_vsi *vsi) ...@@ -2227,10 +2227,8 @@ static int ice_vsi_cfg_tc_lan(struct ice_pf *pf, struct ice_vsi *vsi)
/** /**
* ice_vsi_cfg_def - configure default VSI based on the type * ice_vsi_cfg_def - configure default VSI based on the type
* @vsi: pointer to VSI * @vsi: pointer to VSI
* @params: the parameters to configure this VSI with
*/ */
static int static int ice_vsi_cfg_def(struct ice_vsi *vsi)
ice_vsi_cfg_def(struct ice_vsi *vsi, struct ice_vsi_cfg_params *params)
{ {
struct device *dev = ice_pf_to_dev(vsi->back); struct device *dev = ice_pf_to_dev(vsi->back);
struct ice_pf *pf = vsi->back; struct ice_pf *pf = vsi->back;
...@@ -2238,7 +2236,7 @@ ice_vsi_cfg_def(struct ice_vsi *vsi, struct ice_vsi_cfg_params *params) ...@@ -2238,7 +2236,7 @@ ice_vsi_cfg_def(struct ice_vsi *vsi, struct ice_vsi_cfg_params *params)
vsi->vsw = pf->first_sw; vsi->vsw = pf->first_sw;
ret = ice_vsi_alloc_def(vsi, params->ch); ret = ice_vsi_alloc_def(vsi, vsi->ch);
if (ret) if (ret)
return ret; return ret;
...@@ -2263,7 +2261,7 @@ ice_vsi_cfg_def(struct ice_vsi *vsi, struct ice_vsi_cfg_params *params) ...@@ -2263,7 +2261,7 @@ ice_vsi_cfg_def(struct ice_vsi *vsi, struct ice_vsi_cfg_params *params)
ice_vsi_set_tc_cfg(vsi); ice_vsi_set_tc_cfg(vsi);
/* create the VSI */ /* create the VSI */
ret = ice_vsi_init(vsi, params->flags); ret = ice_vsi_init(vsi, vsi->flags);
if (ret) if (ret)
goto unroll_get_qs; goto unroll_get_qs;
...@@ -2383,23 +2381,16 @@ ice_vsi_cfg_def(struct ice_vsi *vsi, struct ice_vsi_cfg_params *params) ...@@ -2383,23 +2381,16 @@ ice_vsi_cfg_def(struct ice_vsi *vsi, struct ice_vsi_cfg_params *params)
/** /**
* ice_vsi_cfg - configure a previously allocated VSI * ice_vsi_cfg - configure a previously allocated VSI
* @vsi: pointer to VSI * @vsi: pointer to VSI
* @params: parameters used to configure this VSI
*/ */
int ice_vsi_cfg(struct ice_vsi *vsi, struct ice_vsi_cfg_params *params) int ice_vsi_cfg(struct ice_vsi *vsi)
{ {
struct ice_pf *pf = vsi->back; struct ice_pf *pf = vsi->back;
int ret; int ret;
if (WARN_ON(params->type == ICE_VSI_VF && !params->vf)) if (WARN_ON(vsi->type == ICE_VSI_VF && !vsi->vf))
return -EINVAL; return -EINVAL;
vsi->type = params->type; ret = ice_vsi_cfg_def(vsi);
vsi->port_info = params->pi;
/* For VSIs which don't have a connected VF, this will be NULL */
vsi->vf = params->vf;
ret = ice_vsi_cfg_def(vsi, params);
if (ret) if (ret)
return ret; return ret;
...@@ -2485,7 +2476,7 @@ ice_vsi_setup(struct ice_pf *pf, struct ice_vsi_cfg_params *params) ...@@ -2485,7 +2476,7 @@ ice_vsi_setup(struct ice_pf *pf, struct ice_vsi_cfg_params *params)
* a port_info structure for it. * a port_info structure for it.
*/ */
if (WARN_ON(!(params->flags & ICE_VSI_FLAG_INIT)) || if (WARN_ON(!(params->flags & ICE_VSI_FLAG_INIT)) ||
WARN_ON(!params->pi)) WARN_ON(!params->port_info))
return NULL; return NULL;
vsi = ice_vsi_alloc(pf); vsi = ice_vsi_alloc(pf);
...@@ -2494,7 +2485,8 @@ ice_vsi_setup(struct ice_pf *pf, struct ice_vsi_cfg_params *params) ...@@ -2494,7 +2485,8 @@ ice_vsi_setup(struct ice_pf *pf, struct ice_vsi_cfg_params *params)
return NULL; return NULL;
} }
ret = ice_vsi_cfg(vsi, params); vsi->params = *params;
ret = ice_vsi_cfg(vsi);
if (ret) if (ret)
goto err_vsi_cfg; goto err_vsi_cfg;
...@@ -3041,7 +3033,6 @@ ice_vsi_realloc_stat_arrays(struct ice_vsi *vsi) ...@@ -3041,7 +3033,6 @@ ice_vsi_realloc_stat_arrays(struct ice_vsi *vsi)
*/ */
int ice_vsi_rebuild(struct ice_vsi *vsi, u32 vsi_flags) int ice_vsi_rebuild(struct ice_vsi *vsi, u32 vsi_flags)
{ {
struct ice_vsi_cfg_params params = {};
struct ice_coalesce_stored *coalesce; struct ice_coalesce_stored *coalesce;
int prev_num_q_vectors; int prev_num_q_vectors;
struct ice_pf *pf; struct ice_pf *pf;
...@@ -3050,9 +3041,7 @@ int ice_vsi_rebuild(struct ice_vsi *vsi, u32 vsi_flags) ...@@ -3050,9 +3041,7 @@ int ice_vsi_rebuild(struct ice_vsi *vsi, u32 vsi_flags)
if (!vsi) if (!vsi)
return -EINVAL; return -EINVAL;
params = ice_vsi_to_params(vsi); vsi->flags = vsi_flags;
params.flags = vsi_flags;
pf = vsi->back; pf = vsi->back;
if (WARN_ON(vsi->type == ICE_VSI_VF && !vsi->vf)) if (WARN_ON(vsi->type == ICE_VSI_VF && !vsi->vf))
return -EINVAL; return -EINVAL;
...@@ -3062,7 +3051,7 @@ int ice_vsi_rebuild(struct ice_vsi *vsi, u32 vsi_flags) ...@@ -3062,7 +3051,7 @@ int ice_vsi_rebuild(struct ice_vsi *vsi, u32 vsi_flags)
goto err_vsi_cfg; goto err_vsi_cfg;
ice_vsi_decfg(vsi); ice_vsi_decfg(vsi);
ret = ice_vsi_cfg_def(vsi, &params); ret = ice_vsi_cfg_def(vsi);
if (ret) if (ret)
goto err_vsi_cfg; goto err_vsi_cfg;
......
...@@ -11,43 +11,6 @@ ...@@ -11,43 +11,6 @@
#define ICE_VSI_FLAG_INIT BIT(0) #define ICE_VSI_FLAG_INIT BIT(0)
#define ICE_VSI_FLAG_NO_INIT 0 #define ICE_VSI_FLAG_NO_INIT 0
/**
* struct ice_vsi_cfg_params - VSI configuration parameters
* @pi: pointer to the port_info instance for the VSI
* @ch: pointer to the channel structure for the VSI, may be NULL
* @vf: pointer to the VF associated with this VSI, may be NULL
* @type: the type of VSI to configure
* @flags: VSI flags used for rebuild and configuration
*
* Parameter structure used when configuring a new VSI.
*/
struct ice_vsi_cfg_params {
struct ice_port_info *pi;
struct ice_channel *ch;
struct ice_vf *vf;
enum ice_vsi_type type;
u32 flags;
};
/**
* ice_vsi_to_params - Get parameters for an existing VSI
* @vsi: the VSI to get parameters for
*
* Fill a parameter structure for reconfiguring a VSI with its current
* parameters, such as during a rebuild operation.
*/
static inline struct ice_vsi_cfg_params ice_vsi_to_params(struct ice_vsi *vsi)
{
struct ice_vsi_cfg_params params = {};
params.pi = vsi->port_info;
params.ch = vsi->ch;
params.vf = vsi->vf;
params.type = vsi->type;
return params;
}
const char *ice_vsi_type_str(enum ice_vsi_type vsi_type); const char *ice_vsi_type_str(enum ice_vsi_type vsi_type);
bool ice_pf_state_is_nominal(struct ice_pf *pf); bool ice_pf_state_is_nominal(struct ice_pf *pf);
...@@ -101,7 +64,7 @@ void ice_vsi_decfg(struct ice_vsi *vsi); ...@@ -101,7 +64,7 @@ void ice_vsi_decfg(struct ice_vsi *vsi);
void ice_dis_vsi(struct ice_vsi *vsi, bool locked); void ice_dis_vsi(struct ice_vsi *vsi, bool locked);
int ice_vsi_rebuild(struct ice_vsi *vsi, u32 vsi_flags); int ice_vsi_rebuild(struct ice_vsi *vsi, u32 vsi_flags);
int ice_vsi_cfg(struct ice_vsi *vsi, struct ice_vsi_cfg_params *params); int ice_vsi_cfg(struct ice_vsi *vsi);
bool ice_is_reset_in_progress(unsigned long *state); bool ice_is_reset_in_progress(unsigned long *state);
int ice_wait_for_reset(struct ice_pf *pf, unsigned long timeout); int ice_wait_for_reset(struct ice_pf *pf, unsigned long timeout);
......
...@@ -3685,7 +3685,7 @@ ice_pf_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi) ...@@ -3685,7 +3685,7 @@ ice_pf_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi)
struct ice_vsi_cfg_params params = {}; struct ice_vsi_cfg_params params = {};
params.type = ICE_VSI_PF; params.type = ICE_VSI_PF;
params.pi = pi; params.port_info = pi;
params.flags = ICE_VSI_FLAG_INIT; params.flags = ICE_VSI_FLAG_INIT;
return ice_vsi_setup(pf, &params); return ice_vsi_setup(pf, &params);
...@@ -3698,7 +3698,7 @@ ice_chnl_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi, ...@@ -3698,7 +3698,7 @@ ice_chnl_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi,
struct ice_vsi_cfg_params params = {}; struct ice_vsi_cfg_params params = {};
params.type = ICE_VSI_CHNL; params.type = ICE_VSI_CHNL;
params.pi = pi; params.port_info = pi;
params.ch = ch; params.ch = ch;
params.flags = ICE_VSI_FLAG_INIT; params.flags = ICE_VSI_FLAG_INIT;
...@@ -3719,7 +3719,7 @@ ice_ctrl_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi) ...@@ -3719,7 +3719,7 @@ ice_ctrl_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi)
struct ice_vsi_cfg_params params = {}; struct ice_vsi_cfg_params params = {};
params.type = ICE_VSI_CTRL; params.type = ICE_VSI_CTRL;
params.pi = pi; params.port_info = pi;
params.flags = ICE_VSI_FLAG_INIT; params.flags = ICE_VSI_FLAG_INIT;
return ice_vsi_setup(pf, &params); return ice_vsi_setup(pf, &params);
...@@ -3739,7 +3739,7 @@ ice_lb_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi) ...@@ -3739,7 +3739,7 @@ ice_lb_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi)
struct ice_vsi_cfg_params params = {}; struct ice_vsi_cfg_params params = {};
params.type = ICE_VSI_LB; params.type = ICE_VSI_LB;
params.pi = pi; params.port_info = pi;
params.flags = ICE_VSI_FLAG_INIT; params.flags = ICE_VSI_FLAG_INIT;
return ice_vsi_setup(pf, &params); return ice_vsi_setup(pf, &params);
...@@ -5805,10 +5805,16 @@ static const struct pci_device_id ice_pci_tbl[] = { ...@@ -5805,10 +5805,16 @@ static const struct pci_device_id ice_pci_tbl[] = {
{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E825C_QSFP), }, { PCI_VDEVICE(INTEL, ICE_DEV_ID_E825C_QSFP), },
{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E825C_SFP), }, { PCI_VDEVICE(INTEL, ICE_DEV_ID_E825C_SFP), },
{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E825C_SGMII), }, { PCI_VDEVICE(INTEL, ICE_DEV_ID_E825C_SGMII), },
{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E830_BACKPLANE) }, { PCI_VDEVICE(INTEL, ICE_DEV_ID_E830CC_BACKPLANE) },
{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E830_QSFP56) }, { PCI_VDEVICE(INTEL, ICE_DEV_ID_E830CC_QSFP56) },
{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E830_SFP) }, { PCI_VDEVICE(INTEL, ICE_DEV_ID_E830CC_SFP) },
{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E830_SFP_DD) }, { PCI_VDEVICE(INTEL, ICE_DEV_ID_E830CC_SFP_DD) },
{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E830C_BACKPLANE), },
{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E830_XXV_BACKPLANE), },
{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E830C_QSFP), },
{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E830_XXV_QSFP), },
{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E830C_SFP), },
{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E830_XXV_SFP), },
/* required last entry */ /* required last entry */
{} {}
}; };
......
...@@ -225,7 +225,7 @@ static struct ice_vsi *ice_vf_vsi_setup(struct ice_vf *vf) ...@@ -225,7 +225,7 @@ static struct ice_vsi *ice_vf_vsi_setup(struct ice_vf *vf)
struct ice_vsi *vsi; struct ice_vsi *vsi;
params.type = ICE_VSI_VF; params.type = ICE_VSI_VF;
params.pi = ice_vf_get_port_info(vf); params.port_info = ice_vf_get_port_info(vf);
params.vf = vf; params.vf = vf;
params.flags = ICE_VSI_FLAG_INIT; params.flags = ICE_VSI_FLAG_INIT;
......
...@@ -669,13 +669,19 @@ static bool ice_tc_is_dev_uplink(struct net_device *dev) ...@@ -669,13 +669,19 @@ static bool ice_tc_is_dev_uplink(struct net_device *dev)
return netif_is_ice(dev) || ice_is_tunnel_supported(dev); return netif_is_ice(dev) || ice_is_tunnel_supported(dev);
} }
static int ice_tc_setup_redirect_action(struct net_device *filter_dev, static int ice_tc_setup_action(struct net_device *filter_dev,
struct ice_tc_flower_fltr *fltr, struct ice_tc_flower_fltr *fltr,
struct net_device *target_dev) struct net_device *target_dev,
enum ice_sw_fwd_act_type action)
{ {
struct ice_repr *repr; struct ice_repr *repr;
fltr->action.fltr_act = ICE_FWD_TO_VSI; if (action != ICE_FWD_TO_VSI && action != ICE_MIRROR_PACKET) {
NL_SET_ERR_MSG_MOD(fltr->extack, "Unsupported action to setup provided");
return -EINVAL;
}
fltr->action.fltr_act = action;
if (ice_is_port_repr_netdev(filter_dev) && if (ice_is_port_repr_netdev(filter_dev) &&
ice_is_port_repr_netdev(target_dev)) { ice_is_port_repr_netdev(target_dev)) {
...@@ -723,41 +729,6 @@ ice_tc_setup_drop_action(struct net_device *filter_dev, ...@@ -723,41 +729,6 @@ ice_tc_setup_drop_action(struct net_device *filter_dev,
return 0; return 0;
} }
static int ice_tc_setup_mirror_action(struct net_device *filter_dev,
struct ice_tc_flower_fltr *fltr,
struct net_device *target_dev)
{
struct ice_repr *repr;
fltr->action.fltr_act = ICE_MIRROR_PACKET;
if (ice_is_port_repr_netdev(filter_dev) &&
ice_is_port_repr_netdev(target_dev)) {
repr = ice_netdev_to_repr(target_dev);
fltr->dest_vsi = repr->src_vsi;
fltr->direction = ICE_ESWITCH_FLTR_EGRESS;
} else if (ice_is_port_repr_netdev(filter_dev) &&
ice_tc_is_dev_uplink(target_dev)) {
repr = ice_netdev_to_repr(filter_dev);
fltr->dest_vsi = repr->src_vsi->back->eswitch.uplink_vsi;
fltr->direction = ICE_ESWITCH_FLTR_EGRESS;
} else if (ice_tc_is_dev_uplink(filter_dev) &&
ice_is_port_repr_netdev(target_dev)) {
repr = ice_netdev_to_repr(target_dev);
fltr->dest_vsi = repr->src_vsi;
fltr->direction = ICE_ESWITCH_FLTR_INGRESS;
} else {
NL_SET_ERR_MSG_MOD(fltr->extack,
"Unsupported netdevice in switchdev mode");
return -EINVAL;
}
return 0;
}
static int ice_eswitch_tc_parse_action(struct net_device *filter_dev, static int ice_eswitch_tc_parse_action(struct net_device *filter_dev,
struct ice_tc_flower_fltr *fltr, struct ice_tc_flower_fltr *fltr,
struct flow_action_entry *act) struct flow_action_entry *act)
...@@ -773,16 +744,19 @@ static int ice_eswitch_tc_parse_action(struct net_device *filter_dev, ...@@ -773,16 +744,19 @@ static int ice_eswitch_tc_parse_action(struct net_device *filter_dev,
break; break;
case FLOW_ACTION_REDIRECT: case FLOW_ACTION_REDIRECT:
err = ice_tc_setup_redirect_action(filter_dev, fltr, act->dev); err = ice_tc_setup_action(filter_dev, fltr,
act->dev, ICE_FWD_TO_VSI);
if (err) if (err)
return err; return err;
break; break;
case FLOW_ACTION_MIRRED: case FLOW_ACTION_MIRRED:
err = ice_tc_setup_mirror_action(filter_dev, fltr, act->dev); err = ice_tc_setup_action(filter_dev, fltr,
act->dev, ICE_MIRROR_PACKET);
if (err) if (err)
return err; return err;
break; break;
default: default:
......
...@@ -259,20 +259,18 @@ static void ice_vf_pre_vsi_rebuild(struct ice_vf *vf) ...@@ -259,20 +259,18 @@ static void ice_vf_pre_vsi_rebuild(struct ice_vf *vf)
int ice_vf_reconfig_vsi(struct ice_vf *vf) int ice_vf_reconfig_vsi(struct ice_vf *vf)
{ {
struct ice_vsi *vsi = ice_get_vf_vsi(vf); struct ice_vsi *vsi = ice_get_vf_vsi(vf);
struct ice_vsi_cfg_params params = {};
struct ice_pf *pf = vf->pf; struct ice_pf *pf = vf->pf;
int err; int err;
if (WARN_ON(!vsi)) if (WARN_ON(!vsi))
return -EINVAL; return -EINVAL;
params = ice_vsi_to_params(vsi); vsi->flags = ICE_VSI_FLAG_NO_INIT;
params.flags = ICE_VSI_FLAG_NO_INIT;
ice_vsi_decfg(vsi); ice_vsi_decfg(vsi);
ice_fltr_remove_all(vsi); ice_fltr_remove_all(vsi);
err = ice_vsi_cfg(vsi, &params); err = ice_vsi_cfg(vsi);
if (err) { if (err) {
dev_err(ice_pf_to_dev(pf), dev_err(ice_pf_to_dev(pf),
"Failed to reconfigure the VF%u's VSI, error %d\n", "Failed to reconfigure the VF%u's VSI, error %d\n",
...@@ -1243,7 +1241,7 @@ struct ice_vsi *ice_vf_ctrl_vsi_setup(struct ice_vf *vf) ...@@ -1243,7 +1241,7 @@ struct ice_vsi *ice_vf_ctrl_vsi_setup(struct ice_vf *vf)
struct ice_vsi *vsi; struct ice_vsi *vsi;
params.type = ICE_VSI_CTRL; params.type = ICE_VSI_CTRL;
params.pi = ice_vf_get_port_info(vf); params.port_info = ice_vf_get_port_info(vf);
params.vf = vf; params.vf = vf;
params.flags = ICE_VSI_FLAG_INIT; params.flags = ICE_VSI_FLAG_INIT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment