Commit a914a841 authored by David S. Miller's avatar David S. Miller

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

Jeff Kirsher says:

====================
100GbE Intel Wired LAN Driver Updates 2019-08-23

This series contains updates to ice driver only.

Dave adds logic for the necessary bits to be set in the VSI context for
the PF_VSI and the TX_descriptors for control packets egressing the
PF_VSI.  Updated the logic to detect both DCBx and LLDP states in the
firmware engine to account for situations where DCBx is enabled and LLDP
is disabled.  Fixed the driver to treat the DCBx state of "NOT_STARTED"
as a valid state and should not assume "is_fw_lldp" true automatically.
Since "enable-fw-lldp" flag was confusing and cumbersome, change the
flag to "fw-lldp-agent" with a value of on or off to help clarify
whether the LLDP agent is running or not.

Brett fixes an issue where synchronize_irq() was being called from the
host of VF's, which should not be done.

Michal fixed an issue when rebuilding the DCBx configuration while in
IEEE mode versus CEE mode, so add a check before copying the
configuration value to ensure we are only in CEE mode.

Jake fixes the PF to reject any VF request to setup head writeback since
the support has been deprecated.

Mitch adds an additional check to ensure the VF is active before sending
out an error message that a message was unable to be sent to a
particular VF.

Chinh updates the driver to use "topology" mode when checking the PHY
for status, since this mode provides us the current module type that is
available.  Fixes the driver from clearing the auto_fec_enable bit which
was blocking a user from forcing non-spec compliant FEC configurations.

Amruth does a refactor on the code to first check, then assign in the
virtual channel space.

Bruce updates the driver to actually update the stats when a user runs
the ethtool command 'ethtool -S <iface>' instead of providing a snapshot
of the stats that maybe from a second ago.

Akeem fixes up the adding/removing of VSI MAC filters for VFs, so that
VFs cannot add/remove a filter from another VSI.  We now track the
number of filters added right from when the VF resources get allocated
and won't get into MAC filter mis-match issue in the switch.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents ace4cede 8b2c8582
...@@ -329,7 +329,7 @@ enum ice_pf_flags { ...@@ -329,7 +329,7 @@ enum ice_pf_flags {
ICE_FLAG_DCB_ENA, ICE_FLAG_DCB_ENA,
ICE_FLAG_LINK_DOWN_ON_CLOSE_ENA, ICE_FLAG_LINK_DOWN_ON_CLOSE_ENA,
ICE_FLAG_NO_MEDIA, ICE_FLAG_NO_MEDIA,
ICE_FLAG_ENABLE_FW_LLDP, ICE_FLAG_FW_LLDP_AGENT,
ICE_FLAG_ETHTOOL_CTXT, /* set when ethtool holds RTNL lock */ ICE_FLAG_ETHTOOL_CTXT, /* set when ethtool holds RTNL lock */
ICE_PF_FLAGS_NBITS /* must be last */ ICE_PF_FLAGS_NBITS /* must be last */
}; };
...@@ -447,6 +447,8 @@ ice_find_vsi_by_type(struct ice_pf *pf, enum ice_vsi_type type) ...@@ -447,6 +447,8 @@ ice_find_vsi_by_type(struct ice_pf *pf, enum ice_vsi_type type)
int ice_vsi_setup_tx_rings(struct ice_vsi *vsi); int ice_vsi_setup_tx_rings(struct ice_vsi *vsi);
int ice_vsi_setup_rx_rings(struct ice_vsi *vsi); int ice_vsi_setup_rx_rings(struct ice_vsi *vsi);
void ice_set_ethtool_ops(struct net_device *netdev); void ice_set_ethtool_ops(struct net_device *netdev);
void ice_update_vsi_stats(struct ice_vsi *vsi);
void ice_update_pf_stats(struct ice_pf *pf);
int ice_up(struct ice_vsi *vsi); int ice_up(struct ice_vsi *vsi);
int ice_down(struct ice_vsi *vsi); int ice_down(struct ice_vsi *vsi);
int ice_vsi_cfg(struct ice_vsi *vsi); int ice_vsi_cfg(struct ice_vsi *vsi);
......
...@@ -1610,6 +1610,7 @@ enum ice_aq_err { ...@@ -1610,6 +1610,7 @@ enum ice_aq_err {
ICE_AQ_RC_EBUSY = 12, /* Device or resource busy */ ICE_AQ_RC_EBUSY = 12, /* Device or resource busy */
ICE_AQ_RC_EEXIST = 13, /* Object already exists */ ICE_AQ_RC_EEXIST = 13, /* Object already exists */
ICE_AQ_RC_ENOSPC = 16, /* No space left or allocation failure */ ICE_AQ_RC_ENOSPC = 16, /* No space left or allocation failure */
ICE_AQ_RC_ENOSYS = 17, /* Function not implemented */
}; };
/* Admin Queue command opcodes */ /* Admin Queue command opcodes */
......
...@@ -2031,7 +2031,7 @@ enum ice_status ice_update_link_info(struct ice_port_info *pi) ...@@ -2031,7 +2031,7 @@ enum ice_status ice_update_link_info(struct ice_port_info *pi)
if (!pcaps) if (!pcaps)
return ICE_ERR_NO_MEMORY; return ICE_ERR_NO_MEMORY;
status = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_SW_CFG, status = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_TOPO_CAP,
pcaps, NULL); pcaps, NULL);
if (!status) if (!status)
memcpy(li->module_type, &pcaps->module_type, memcpy(li->module_type, &pcaps->module_type,
...@@ -2181,27 +2181,24 @@ ice_cfg_phy_fec(struct ice_aqc_set_phy_cfg_data *cfg, enum ice_fec_mode fec) ...@@ -2181,27 +2181,24 @@ ice_cfg_phy_fec(struct ice_aqc_set_phy_cfg_data *cfg, enum ice_fec_mode fec)
{ {
switch (fec) { switch (fec) {
case ICE_FEC_BASER: case ICE_FEC_BASER:
/* Clear auto FEC and RS bits, and AND BASE-R ability /* Clear RS bits, and AND BASE-R ability
* bits and OR request bits. * bits and OR request bits.
*/ */
cfg->caps &= ~ICE_AQC_PHY_EN_AUTO_FEC;
cfg->link_fec_opt &= ICE_AQC_PHY_FEC_10G_KR_40G_KR4_EN | cfg->link_fec_opt &= ICE_AQC_PHY_FEC_10G_KR_40G_KR4_EN |
ICE_AQC_PHY_FEC_25G_KR_CLAUSE74_EN; ICE_AQC_PHY_FEC_25G_KR_CLAUSE74_EN;
cfg->link_fec_opt |= ICE_AQC_PHY_FEC_10G_KR_40G_KR4_REQ | cfg->link_fec_opt |= ICE_AQC_PHY_FEC_10G_KR_40G_KR4_REQ |
ICE_AQC_PHY_FEC_25G_KR_REQ; ICE_AQC_PHY_FEC_25G_KR_REQ;
break; break;
case ICE_FEC_RS: case ICE_FEC_RS:
/* Clear auto FEC and BASE-R bits, and AND RS ability /* Clear BASE-R bits, and AND RS ability
* bits and OR request bits. * bits and OR request bits.
*/ */
cfg->caps &= ~ICE_AQC_PHY_EN_AUTO_FEC;
cfg->link_fec_opt &= ICE_AQC_PHY_FEC_25G_RS_CLAUSE91_EN; cfg->link_fec_opt &= ICE_AQC_PHY_FEC_25G_RS_CLAUSE91_EN;
cfg->link_fec_opt |= ICE_AQC_PHY_FEC_25G_RS_528_REQ | cfg->link_fec_opt |= ICE_AQC_PHY_FEC_25G_RS_528_REQ |
ICE_AQC_PHY_FEC_25G_RS_544_REQ; ICE_AQC_PHY_FEC_25G_RS_544_REQ;
break; break;
case ICE_FEC_NONE: case ICE_FEC_NONE:
/* Clear auto FEC and all FEC option bits. */ /* Clear all FEC option bits. */
cfg->caps &= ~ICE_AQC_PHY_EN_AUTO_FEC;
cfg->link_fec_opt &= ~ICE_AQC_PHY_FEC_MASK; cfg->link_fec_opt &= ~ICE_AQC_PHY_FEC_MASK;
break; break;
case ICE_FEC_AUTO: case ICE_FEC_AUTO:
......
...@@ -954,7 +954,8 @@ enum ice_status ice_init_dcb(struct ice_hw *hw) ...@@ -954,7 +954,8 @@ enum ice_status ice_init_dcb(struct ice_hw *hw)
pi->dcbx_status = ice_get_dcbx_status(hw); pi->dcbx_status = ice_get_dcbx_status(hw);
if (pi->dcbx_status == ICE_DCBX_STATUS_DONE || if (pi->dcbx_status == ICE_DCBX_STATUS_DONE ||
pi->dcbx_status == ICE_DCBX_STATUS_IN_PROGRESS) { pi->dcbx_status == ICE_DCBX_STATUS_IN_PROGRESS ||
pi->dcbx_status == ICE_DCBX_STATUS_NOT_STARTED) {
/* Get current DCBX configuration */ /* Get current DCBX configuration */
ret = ice_get_dcb_cfg(pi); ret = ice_get_dcb_cfg(pi);
pi->is_sw_lldp = (hw->adminq.sq_last_status == ICE_AQ_RC_EPERM); pi->is_sw_lldp = (hw->adminq.sq_last_status == ICE_AQ_RC_EPERM);
......
...@@ -319,6 +319,11 @@ void ice_dcb_rebuild(struct ice_pf *pf) ...@@ -319,6 +319,11 @@ void ice_dcb_rebuild(struct ice_pf *pf)
} }
ice_init_dcb(&pf->hw); ice_init_dcb(&pf->hw);
if (pf->hw.port_info->dcbx_status == ICE_DCBX_STATUS_DIS)
pf->hw.port_info->is_sw_lldp = true;
else
pf->hw.port_info->is_sw_lldp = false;
if (ice_dcb_need_recfg(pf, prev_cfg, local_dcbx_cfg)) { if (ice_dcb_need_recfg(pf, prev_cfg, local_dcbx_cfg)) {
/* difference in cfg detected - disable DCB till next MIB */ /* difference in cfg detected - disable DCB till next MIB */
dev_err(&pf->pdev->dev, "Set local MIB not accurate\n"); dev_err(&pf->pdev->dev, "Set local MIB not accurate\n");
...@@ -329,8 +334,10 @@ void ice_dcb_rebuild(struct ice_pf *pf) ...@@ -329,8 +334,10 @@ void ice_dcb_rebuild(struct ice_pf *pf)
devm_kfree(&pf->pdev->dev, prev_cfg); devm_kfree(&pf->pdev->dev, prev_cfg);
/* Set the local desired config */ /* Set the local desired config */
memset(&pf->hw.port_info->local_dcbx_cfg, 0, sizeof(*local_dcbx_cfg)); if (local_dcbx_cfg->dcbx_mode == ICE_DCBX_MODE_CEE)
memcpy(local_dcbx_cfg, desired_dcbx_cfg, sizeof(*local_dcbx_cfg)); memcpy(local_dcbx_cfg, desired_dcbx_cfg,
sizeof(*local_dcbx_cfg));
ice_cfg_etsrec_defaults(pf->hw.port_info); ice_cfg_etsrec_defaults(pf->hw.port_info);
ret = ice_set_dcb_cfg(pf->hw.port_info); ret = ice_set_dcb_cfg(pf->hw.port_info);
if (ret) { if (ret) {
...@@ -440,35 +447,17 @@ int ice_init_pf_dcb(struct ice_pf *pf, bool locked) ...@@ -440,35 +447,17 @@ int ice_init_pf_dcb(struct ice_pf *pf, bool locked)
struct device *dev = &pf->pdev->dev; struct device *dev = &pf->pdev->dev;
struct ice_port_info *port_info; struct ice_port_info *port_info;
struct ice_hw *hw = &pf->hw; struct ice_hw *hw = &pf->hw;
int sw_default = 0;
int err; int err;
port_info = hw->port_info; port_info = hw->port_info;
err = ice_init_dcb(hw); err = ice_init_dcb(hw);
if (err) { if (err) {
/* FW LLDP is not active, default to SW DCBX/LLDP */ /* FW LLDP is disabled, activate SW DCBX/LLDP mode */
dev_info(&pf->pdev->dev, "FW LLDP is not active\n"); dev_info(&pf->pdev->dev,
hw->port_info->dcbx_status = ICE_DCBX_STATUS_NOT_STARTED; "FW LLDP is disabled, DCBx/LLDP in SW mode.\n");
hw->port_info->is_sw_lldp = true; port_info->is_sw_lldp = true;
} clear_bit(ICE_FLAG_FW_LLDP_AGENT, pf->flags);
if (port_info->dcbx_status == ICE_DCBX_STATUS_DIS)
dev_info(&pf->pdev->dev, "DCBX disabled\n");
/* LLDP disabled in FW */
if (port_info->is_sw_lldp) {
sw_default = 1;
dev_info(&pf->pdev->dev, "DCBx/LLDP in SW mode.\n");
clear_bit(ICE_FLAG_ENABLE_FW_LLDP, pf->flags);
} else {
set_bit(ICE_FLAG_ENABLE_FW_LLDP, pf->flags);
}
if (port_info->dcbx_status == ICE_DCBX_STATUS_NOT_STARTED)
dev_info(&pf->pdev->dev, "DCBX not started\n");
if (sw_default) {
err = ice_dcb_sw_dflt_cfg(pf, locked); err = ice_dcb_sw_dflt_cfg(pf, locked);
if (err) { if (err) {
dev_err(&pf->pdev->dev, dev_err(&pf->pdev->dev,
...@@ -483,6 +472,9 @@ int ice_init_pf_dcb(struct ice_pf *pf, bool locked) ...@@ -483,6 +472,9 @@ int ice_init_pf_dcb(struct ice_pf *pf, bool locked)
return 0; return 0;
} }
port_info->is_sw_lldp = false;
set_bit(ICE_FLAG_FW_LLDP_AGENT, pf->flags);
/* DCBX in FW and LLDP enabled in FW */ /* DCBX in FW and LLDP enabled in FW */
pf->dcbx_cap = DCB_CAP_DCBX_LLD_MANAGED | DCB_CAP_DCBX_VER_IEEE; pf->dcbx_cap = DCB_CAP_DCBX_LLD_MANAGED | DCB_CAP_DCBX_VER_IEEE;
......
...@@ -155,7 +155,7 @@ struct ice_priv_flag { ...@@ -155,7 +155,7 @@ struct ice_priv_flag {
static const struct ice_priv_flag ice_gstrings_priv_flags[] = { static const struct ice_priv_flag ice_gstrings_priv_flags[] = {
ICE_PRIV_FLAG("link-down-on-close", ICE_FLAG_LINK_DOWN_ON_CLOSE_ENA), ICE_PRIV_FLAG("link-down-on-close", ICE_FLAG_LINK_DOWN_ON_CLOSE_ENA),
ICE_PRIV_FLAG("enable-fw-lldp", ICE_FLAG_ENABLE_FW_LLDP), ICE_PRIV_FLAG("fw-lldp-agent", ICE_FLAG_FW_LLDP_AGENT),
}; };
#define ICE_PRIV_FLAG_ARRAY_SIZE ARRAY_SIZE(ice_gstrings_priv_flags) #define ICE_PRIV_FLAG_ARRAY_SIZE ARRAY_SIZE(ice_gstrings_priv_flags)
...@@ -1201,8 +1201,8 @@ static int ice_set_priv_flags(struct net_device *netdev, u32 flags) ...@@ -1201,8 +1201,8 @@ static int ice_set_priv_flags(struct net_device *netdev, u32 flags)
bitmap_xor(change_flags, pf->flags, orig_flags, ICE_PF_FLAGS_NBITS); bitmap_xor(change_flags, pf->flags, orig_flags, ICE_PF_FLAGS_NBITS);
if (test_bit(ICE_FLAG_ENABLE_FW_LLDP, change_flags)) { if (test_bit(ICE_FLAG_FW_LLDP_AGENT, change_flags)) {
if (!test_bit(ICE_FLAG_ENABLE_FW_LLDP, pf->flags)) { if (!test_bit(ICE_FLAG_FW_LLDP_AGENT, pf->flags)) {
enum ice_status status; enum ice_status status;
/* Disable FW LLDP engine */ /* Disable FW LLDP engine */
...@@ -1319,14 +1319,17 @@ ice_get_ethtool_stats(struct net_device *netdev, ...@@ -1319,14 +1319,17 @@ ice_get_ethtool_stats(struct net_device *netdev,
struct ice_vsi *vsi = np->vsi; struct ice_vsi *vsi = np->vsi;
struct ice_pf *pf = vsi->back; struct ice_pf *pf = vsi->back;
struct ice_ring *ring; struct ice_ring *ring;
unsigned int j = 0; unsigned int j;
int i = 0; int i = 0;
char *p; char *p;
ice_update_pf_stats(pf);
ice_update_vsi_stats(vsi);
for (j = 0; j < ICE_VSI_STATS_LEN; j++) { for (j = 0; j < ICE_VSI_STATS_LEN; j++) {
p = (char *)vsi + ice_gstrings_vsi_stats[j].stat_offset; p = (char *)vsi + ice_gstrings_vsi_stats[j].stat_offset;
data[i++] = (ice_gstrings_vsi_stats[j].sizeof_stat == data[i++] = (ice_gstrings_vsi_stats[j].sizeof_stat ==
sizeof(u64)) ? *(u64 *)p : *(u32 *)p; sizeof(u64)) ? *(u64 *)p : *(u32 *)p;
} }
/* populate per queue stats */ /* populate per queue stats */
......
...@@ -1010,6 +1010,13 @@ static int ice_vsi_init(struct ice_vsi *vsi) ...@@ -1010,6 +1010,13 @@ static int ice_vsi_init(struct ice_vsi *vsi)
ICE_AQ_VSI_SEC_FLAG_ENA_MAC_ANTI_SPOOF; ICE_AQ_VSI_SEC_FLAG_ENA_MAC_ANTI_SPOOF;
} }
/* Allow control frames out of main VSI */
if (vsi->type == ICE_VSI_PF) {
ctxt->info.sec_flags |= ICE_AQ_VSI_SEC_FLAG_ALLOW_DEST_OVRD;
ctxt->info.valid_sections |=
cpu_to_le16(ICE_AQ_VSI_PROP_SECURITY_VALID);
}
ret = ice_add_vsi(hw, vsi->idx, ctxt, NULL); ret = ice_add_vsi(hw, vsi->idx, ctxt, NULL);
if (ret) { if (ret) {
dev_err(&pf->pdev->dev, dev_err(&pf->pdev->dev,
...@@ -2534,7 +2541,7 @@ ice_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi, ...@@ -2534,7 +2541,7 @@ ice_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi,
ice_cfg_sw_lldp(vsi, true, true); ice_cfg_sw_lldp(vsi, true, true);
/* Rx LLDP packets */ /* Rx LLDP packets */
if (!test_bit(ICE_FLAG_ENABLE_FW_LLDP, pf->flags)) if (!test_bit(ICE_FLAG_FW_LLDP_AGENT, pf->flags))
ice_cfg_sw_lldp(vsi, false, true); ice_cfg_sw_lldp(vsi, false, true);
} }
...@@ -2810,6 +2817,10 @@ void ice_vsi_dis_irq(struct ice_vsi *vsi) ...@@ -2810,6 +2817,10 @@ void ice_vsi_dis_irq(struct ice_vsi *vsi)
ice_flush(hw); ice_flush(hw);
/* don't call synchronize_irq() for VF's from the host */
if (vsi->type == ICE_VSI_VF)
return;
ice_for_each_q_vector(vsi, i) ice_for_each_q_vector(vsi, i)
synchronize_irq(pf->msix_entries[i + base].vector); synchronize_irq(pf->msix_entries[i + base].vector);
} }
...@@ -2877,7 +2888,7 @@ int ice_vsi_release(struct ice_vsi *vsi) ...@@ -2877,7 +2888,7 @@ int ice_vsi_release(struct ice_vsi *vsi)
/* The Rx rule will only exist to remove if the LLDP FW /* The Rx rule will only exist to remove if the LLDP FW
* engine is currently stopped * engine is currently stopped
*/ */
if (!test_bit(ICE_FLAG_ENABLE_FW_LLDP, pf->flags)) if (!test_bit(ICE_FLAG_FW_LLDP_AGENT, pf->flags))
ice_cfg_sw_lldp(vsi, false, false); ice_cfg_sw_lldp(vsi, false, false);
} }
...@@ -3170,3 +3181,33 @@ int ice_vsi_cfg_tc(struct ice_vsi *vsi, u8 ena_tc) ...@@ -3170,3 +3181,33 @@ int ice_vsi_cfg_tc(struct ice_vsi *vsi, u8 ena_tc)
return ret; return ret;
} }
#endif /* CONFIG_DCB */ #endif /* CONFIG_DCB */
/**
* ice_vsi_cfg_mac_fltr - Add or remove a MAC address filter for a VSI
* @vsi: the VSI being configured MAC filter
* @macaddr: the MAC address to be added.
* @set: Add or delete a MAC filter
*
* Adds or removes MAC address filter entry for VF VSI
*/
enum ice_status
ice_vsi_cfg_mac_fltr(struct ice_vsi *vsi, const u8 *macaddr, bool set)
{
LIST_HEAD(tmp_add_list);
enum ice_status status;
/* Update MAC filter list to be added or removed for a VSI */
if (ice_add_mac_to_list(vsi, &tmp_add_list, macaddr)) {
status = ICE_ERR_NO_MEMORY;
goto cfg_mac_fltr_exit;
}
if (set)
status = ice_add_mac(&vsi->back->hw, &tmp_add_list);
else
status = ice_remove_mac(&vsi->back->hw, &tmp_add_list);
cfg_mac_fltr_exit:
ice_free_fltr_list(&vsi->back->pdev->dev, &tmp_add_list);
return status;
}
...@@ -95,4 +95,8 @@ void ice_vsi_free_tx_rings(struct ice_vsi *vsi); ...@@ -95,4 +95,8 @@ void ice_vsi_free_tx_rings(struct ice_vsi *vsi);
int ice_vsi_manage_rss_lut(struct ice_vsi *vsi, bool ena); int ice_vsi_manage_rss_lut(struct ice_vsi *vsi, bool ena);
u32 ice_intrl_usec_to_reg(u8 intrl, u8 gran); u32 ice_intrl_usec_to_reg(u8 intrl, u8 gran);
enum ice_status
ice_vsi_cfg_mac_fltr(struct ice_vsi *vsi, const u8 *macaddr, bool set);
#endif /* !_ICE_LIB_H_ */ #endif /* !_ICE_LIB_H_ */
...@@ -34,8 +34,6 @@ static const struct net_device_ops ice_netdev_ops; ...@@ -34,8 +34,6 @@ static const struct net_device_ops ice_netdev_ops;
static void ice_rebuild(struct ice_pf *pf); static void ice_rebuild(struct ice_pf *pf);
static void ice_vsi_release_all(struct ice_pf *pf); static void ice_vsi_release_all(struct ice_pf *pf);
static void ice_update_vsi_stats(struct ice_vsi *vsi);
static void ice_update_pf_stats(struct ice_pf *pf);
/** /**
* ice_get_tx_pending - returns number of Tx descriptors not processed * ice_get_tx_pending - returns number of Tx descriptors not processed
...@@ -118,10 +116,9 @@ static void ice_check_for_hang_subtask(struct ice_pf *pf) ...@@ -118,10 +116,9 @@ static void ice_check_for_hang_subtask(struct ice_pf *pf)
*/ */
static int ice_init_mac_fltr(struct ice_pf *pf) static int ice_init_mac_fltr(struct ice_pf *pf)
{ {
LIST_HEAD(tmp_add_list); enum ice_status status;
u8 broadcast[ETH_ALEN]; u8 broadcast[ETH_ALEN];
struct ice_vsi *vsi; struct ice_vsi *vsi;
int status;
vsi = ice_find_vsi_by_type(pf, ICE_VSI_PF); vsi = ice_find_vsi_by_type(pf, ICE_VSI_PF);
if (!vsi) if (!vsi)
...@@ -132,8 +129,7 @@ static int ice_init_mac_fltr(struct ice_pf *pf) ...@@ -132,8 +129,7 @@ static int ice_init_mac_fltr(struct ice_pf *pf)
*/ */
/* Add a unicast MAC filter so the VSI can get its packets */ /* Add a unicast MAC filter so the VSI can get its packets */
status = ice_add_mac_to_list(vsi, &tmp_add_list, status = ice_vsi_cfg_mac_fltr(vsi, vsi->port_info->mac.perm_addr, true);
vsi->port_info->mac.perm_addr);
if (status) if (status)
goto unregister; goto unregister;
...@@ -141,18 +137,11 @@ static int ice_init_mac_fltr(struct ice_pf *pf) ...@@ -141,18 +137,11 @@ static int ice_init_mac_fltr(struct ice_pf *pf)
* MAC address to the list as well. * MAC address to the list as well.
*/ */
eth_broadcast_addr(broadcast); eth_broadcast_addr(broadcast);
status = ice_add_mac_to_list(vsi, &tmp_add_list, broadcast); status = ice_vsi_cfg_mac_fltr(vsi, broadcast, true);
if (status)
goto free_mac_list;
/* Program MAC filters for entries in tmp_add_list */
status = ice_add_mac(&pf->hw, &tmp_add_list);
if (status) if (status)
status = -ENOMEM; goto unregister;
free_mac_list:
ice_free_fltr_list(&pf->pdev->dev, &tmp_add_list);
return 0;
unregister: unregister:
/* We aren't useful with no MAC filters, so unregister if we /* We aren't useful with no MAC filters, so unregister if we
* had an error * had an error
...@@ -166,7 +155,7 @@ static int ice_init_mac_fltr(struct ice_pf *pf) ...@@ -166,7 +155,7 @@ static int ice_init_mac_fltr(struct ice_pf *pf)
vsi->netdev = NULL; vsi->netdev = NULL;
} }
return status; return -EIO;
} }
/** /**
...@@ -2836,10 +2825,8 @@ static int ice_set_mac_address(struct net_device *netdev, void *pi) ...@@ -2836,10 +2825,8 @@ static int ice_set_mac_address(struct net_device *netdev, void *pi)
struct ice_hw *hw = &pf->hw; struct ice_hw *hw = &pf->hw;
struct sockaddr *addr = pi; struct sockaddr *addr = pi;
enum ice_status status; enum ice_status status;
LIST_HEAD(a_mac_list);
LIST_HEAD(r_mac_list);
u8 flags = 0; u8 flags = 0;
int err; int err = 0;
u8 *mac; u8 *mac;
mac = (u8 *)addr->sa_data; mac = (u8 *)addr->sa_data;
...@@ -2862,42 +2849,23 @@ static int ice_set_mac_address(struct net_device *netdev, void *pi) ...@@ -2862,42 +2849,23 @@ static int ice_set_mac_address(struct net_device *netdev, void *pi)
/* When we change the MAC address we also have to change the MAC address /* When we change the MAC address we also have to change the MAC address
* based filter rules that were created previously for the old MAC * based filter rules that were created previously for the old MAC
* address. So first, we remove the old filter rule using ice_remove_mac * address. So first, we remove the old filter rule using ice_remove_mac
* and then create a new filter rule using ice_add_mac. Note that for * and then create a new filter rule using ice_add_mac via
* both these operations, we first need to form a "list" of MAC * ice_vsi_cfg_mac_fltr function call for both add and/or remove
* addresses (even though in this case, we have only 1 MAC address to be * filters.
* added/removed) and this done using ice_add_mac_to_list. Depending on
* the ensuing operation this "list" of MAC addresses is either to be
* added or removed from the filter.
*/ */
err = ice_add_mac_to_list(vsi, &r_mac_list, netdev->dev_addr); status = ice_vsi_cfg_mac_fltr(vsi, netdev->dev_addr, false);
if (err) {
err = -EADDRNOTAVAIL;
goto free_lists;
}
status = ice_remove_mac(hw, &r_mac_list);
if (status) { if (status) {
err = -EADDRNOTAVAIL; err = -EADDRNOTAVAIL;
goto free_lists; goto err_update_filters;
}
err = ice_add_mac_to_list(vsi, &a_mac_list, mac);
if (err) {
err = -EADDRNOTAVAIL;
goto free_lists;
} }
status = ice_add_mac(hw, &a_mac_list); status = ice_vsi_cfg_mac_fltr(vsi, mac, true);
if (status) { if (status) {
err = -EADDRNOTAVAIL; err = -EADDRNOTAVAIL;
goto free_lists; goto err_update_filters;
} }
free_lists: err_update_filters:
/* free list entries */
ice_free_fltr_list(&pf->pdev->dev, &r_mac_list);
ice_free_fltr_list(&pf->pdev->dev, &a_mac_list);
if (err) { if (err) {
netdev_err(netdev, "can't set MAC %pM. filter update failed\n", netdev_err(netdev, "can't set MAC %pM. filter update failed\n",
mac); mac);
...@@ -2913,8 +2881,8 @@ static int ice_set_mac_address(struct net_device *netdev, void *pi) ...@@ -2913,8 +2881,8 @@ static int ice_set_mac_address(struct net_device *netdev, void *pi)
flags = ICE_AQC_MAN_MAC_UPDATE_LAA_WOL; flags = ICE_AQC_MAN_MAC_UPDATE_LAA_WOL;
status = ice_aq_manage_mac_write(hw, mac, flags, NULL); status = ice_aq_manage_mac_write(hw, mac, flags, NULL);
if (status) { if (status) {
netdev_err(netdev, "can't set MAC %pM. write to firmware failed.\n", netdev_err(netdev, "can't set MAC %pM. write to firmware failed error %d\n",
mac); mac, status);
} }
return 0; return 0;
} }
...@@ -3254,7 +3222,7 @@ static void ice_update_vsi_ring_stats(struct ice_vsi *vsi) ...@@ -3254,7 +3222,7 @@ static void ice_update_vsi_ring_stats(struct ice_vsi *vsi)
* ice_update_vsi_stats - Update VSI stats counters * ice_update_vsi_stats - Update VSI stats counters
* @vsi: the VSI to be updated * @vsi: the VSI to be updated
*/ */
static void ice_update_vsi_stats(struct ice_vsi *vsi) void ice_update_vsi_stats(struct ice_vsi *vsi)
{ {
struct rtnl_link_stats64 *cur_ns = &vsi->net_stats; struct rtnl_link_stats64 *cur_ns = &vsi->net_stats;
struct ice_eth_stats *cur_es = &vsi->eth_stats; struct ice_eth_stats *cur_es = &vsi->eth_stats;
...@@ -3290,7 +3258,7 @@ static void ice_update_vsi_stats(struct ice_vsi *vsi) ...@@ -3290,7 +3258,7 @@ static void ice_update_vsi_stats(struct ice_vsi *vsi)
* ice_update_pf_stats - Update PF port stats counters * ice_update_pf_stats - Update PF port stats counters
* @pf: PF whose stats needs to be updated * @pf: PF whose stats needs to be updated
*/ */
static void ice_update_pf_stats(struct ice_pf *pf) void ice_update_pf_stats(struct ice_pf *pf)
{ {
struct ice_hw_port_stats *prev_ps, *cur_ps; struct ice_hw_port_stats *prev_ps, *cur_ps;
struct ice_hw *hw = &pf->hw; struct ice_hw *hw = &pf->hw;
......
...@@ -2136,6 +2136,38 @@ ice_cfg_dflt_vsi(struct ice_hw *hw, u16 vsi_handle, bool set, u8 direction) ...@@ -2136,6 +2136,38 @@ ice_cfg_dflt_vsi(struct ice_hw *hw, u16 vsi_handle, bool set, u8 direction)
return status; return status;
} }
/**
* ice_find_ucast_rule_entry - Search for a unicast MAC filter rule entry
* @hw: pointer to the hardware structure
* @recp_id: lookup type for which the specified rule needs to be searched
* @f_info: rule information
*
* Helper function to search for a unicast rule entry - this is to be used
* to remove unicast MAC filter that is not shared with other VSIs on the
* PF switch.
*
* Returns pointer to entry storing the rule if found
*/
static struct ice_fltr_mgmt_list_entry *
ice_find_ucast_rule_entry(struct ice_hw *hw, u8 recp_id,
struct ice_fltr_info *f_info)
{
struct ice_switch_info *sw = hw->switch_info;
struct ice_fltr_mgmt_list_entry *list_itr;
struct list_head *list_head;
list_head = &sw->recp_list[recp_id].filt_rules;
list_for_each_entry(list_itr, list_head, list_entry) {
if (!memcmp(&f_info->l_data, &list_itr->fltr_info.l_data,
sizeof(f_info->l_data)) &&
f_info->fwd_id.hw_vsi_id ==
list_itr->fltr_info.fwd_id.hw_vsi_id &&
f_info->flag == list_itr->fltr_info.flag)
return list_itr;
}
return NULL;
}
/** /**
* ice_remove_mac - remove a MAC address based filter rule * ice_remove_mac - remove a MAC address based filter rule
* @hw: pointer to the hardware structure * @hw: pointer to the hardware structure
...@@ -2153,15 +2185,39 @@ enum ice_status ...@@ -2153,15 +2185,39 @@ enum ice_status
ice_remove_mac(struct ice_hw *hw, struct list_head *m_list) ice_remove_mac(struct ice_hw *hw, struct list_head *m_list)
{ {
struct ice_fltr_list_entry *list_itr, *tmp; struct ice_fltr_list_entry *list_itr, *tmp;
struct mutex *rule_lock; /* Lock to protect filter rule list */
if (!m_list) if (!m_list)
return ICE_ERR_PARAM; return ICE_ERR_PARAM;
rule_lock = &hw->switch_info->recp_list[ICE_SW_LKUP_MAC].filt_rule_lock;
list_for_each_entry_safe(list_itr, tmp, m_list, list_entry) { list_for_each_entry_safe(list_itr, tmp, m_list, list_entry) {
enum ice_sw_lkup_type l_type = list_itr->fltr_info.lkup_type; enum ice_sw_lkup_type l_type = list_itr->fltr_info.lkup_type;
u8 *add = &list_itr->fltr_info.l_data.mac.mac_addr[0];
u16 vsi_handle;
if (l_type != ICE_SW_LKUP_MAC) if (l_type != ICE_SW_LKUP_MAC)
return ICE_ERR_PARAM; return ICE_ERR_PARAM;
vsi_handle = list_itr->fltr_info.vsi_handle;
if (!ice_is_vsi_valid(hw, vsi_handle))
return ICE_ERR_PARAM;
list_itr->fltr_info.fwd_id.hw_vsi_id =
ice_get_hw_vsi_num(hw, vsi_handle);
if (is_unicast_ether_addr(add) && !hw->ucast_shared) {
/* Don't remove the unicast address that belongs to
* another VSI on the switch, since it is not being
* shared...
*/
mutex_lock(rule_lock);
if (!ice_find_ucast_rule_entry(hw, ICE_SW_LKUP_MAC,
&list_itr->fltr_info)) {
mutex_unlock(rule_lock);
return ICE_ERR_DOES_NOT_EXIST;
}
mutex_unlock(rule_lock);
}
list_itr->status = ice_remove_rule_internal(hw, list_itr->status = ice_remove_rule_internal(hw,
ICE_SW_LKUP_MAC, ICE_SW_LKUP_MAC,
list_itr); list_itr);
......
...@@ -2106,6 +2106,7 @@ static netdev_tx_t ...@@ -2106,6 +2106,7 @@ static netdev_tx_t
ice_xmit_frame_ring(struct sk_buff *skb, struct ice_ring *tx_ring) ice_xmit_frame_ring(struct sk_buff *skb, struct ice_ring *tx_ring)
{ {
struct ice_tx_offload_params offload = { 0 }; struct ice_tx_offload_params offload = { 0 };
struct ice_vsi *vsi = tx_ring->vsi;
struct ice_tx_buf *first; struct ice_tx_buf *first;
unsigned int count; unsigned int count;
int tso, csum; int tso, csum;
...@@ -2153,7 +2154,15 @@ ice_xmit_frame_ring(struct sk_buff *skb, struct ice_ring *tx_ring) ...@@ -2153,7 +2154,15 @@ ice_xmit_frame_ring(struct sk_buff *skb, struct ice_ring *tx_ring)
if (csum < 0) if (csum < 0)
goto out_drop; goto out_drop;
if (tso || offload.cd_tunnel_params) { /* allow CONTROL frames egress from main VSI if FW LLDP disabled */
if (unlikely(skb->priority == TC_PRIO_CONTROL &&
vsi->type == ICE_VSI_PF &&
vsi->port_info->is_sw_lldp))
offload.cd_qw1 |= (u64)(ICE_TX_DESC_DTYPE_CTX |
ICE_TX_CTX_DESC_SWTCH_UPLINK <<
ICE_TXD_CTX_QW1_CMD_S);
if (offload.cd_qw1 & ICE_TX_DESC_DTYPE_CTX) {
struct ice_tx_ctx_desc *cdesc; struct ice_tx_ctx_desc *cdesc;
int i = tx_ring->next_to_use; int i = tx_ring->next_to_use;
......
...@@ -540,7 +540,10 @@ static int ice_alloc_vsi_res(struct ice_vf *vf) ...@@ -540,7 +540,10 @@ static int ice_alloc_vsi_res(struct ice_vf *vf)
status = ice_add_mac(&pf->hw, &tmp_add_list); status = ice_add_mac(&pf->hw, &tmp_add_list);
if (status) if (status)
dev_err(&pf->pdev->dev, "could not add mac filters\n"); dev_err(&pf->pdev->dev,
"could not add mac filters error %d\n", status);
else
vf->num_mac = 1;
/* Clear this bit after VF initialization since we shouldn't reclaim /* Clear this bit after VF initialization since we shouldn't reclaim
* and reassign interrupts for synchronous or asynchronous VFR events. * and reassign interrupts for synchronous or asynchronous VFR events.
...@@ -1512,10 +1515,10 @@ ice_vc_send_msg_to_vf(struct ice_vf *vf, u32 v_opcode, ...@@ -1512,10 +1515,10 @@ ice_vc_send_msg_to_vf(struct ice_vf *vf, u32 v_opcode,
aq_ret = ice_aq_send_msg_to_vf(&pf->hw, vf->vf_id, v_opcode, v_retval, aq_ret = ice_aq_send_msg_to_vf(&pf->hw, vf->vf_id, v_opcode, v_retval,
msg, msglen, NULL); msg, msglen, NULL);
if (aq_ret) { if (aq_ret && pf->hw.mailboxq.sq_last_status != ICE_AQ_RC_ENOSYS) {
dev_info(&pf->pdev->dev, dev_info(&pf->pdev->dev,
"Unable to send the message to VF %d aq_err %d\n", "Unable to send the message to VF %d ret %d aq_err %d\n",
vf->vf_id, pf->hw.mailboxq.sq_last_status); vf->vf_id, aq_ret, pf->hw.mailboxq.sq_last_status);
return -EIO; return -EIO;
} }
...@@ -1734,18 +1737,18 @@ static int ice_vc_config_rss_key(struct ice_vf *vf, u8 *msg) ...@@ -1734,18 +1737,18 @@ static int ice_vc_config_rss_key(struct ice_vf *vf, u8 *msg)
goto error_param; goto error_param;
} }
vsi = pf->vsi[vf->lan_vsi_idx]; if (vrk->key_len != ICE_VSIQF_HKEY_ARRAY_SIZE) {
if (!vsi) {
v_ret = VIRTCHNL_STATUS_ERR_PARAM; v_ret = VIRTCHNL_STATUS_ERR_PARAM;
goto error_param; goto error_param;
} }
if (vrk->key_len != ICE_VSIQF_HKEY_ARRAY_SIZE) { if (!test_bit(ICE_FLAG_RSS_ENA, vf->pf->flags)) {
v_ret = VIRTCHNL_STATUS_ERR_PARAM; v_ret = VIRTCHNL_STATUS_ERR_PARAM;
goto error_param; goto error_param;
} }
if (!test_bit(ICE_FLAG_RSS_ENA, vf->pf->flags)) { vsi = pf->vsi[vf->lan_vsi_idx];
if (!vsi) {
v_ret = VIRTCHNL_STATUS_ERR_PARAM; v_ret = VIRTCHNL_STATUS_ERR_PARAM;
goto error_param; goto error_param;
} }
...@@ -1781,18 +1784,18 @@ static int ice_vc_config_rss_lut(struct ice_vf *vf, u8 *msg) ...@@ -1781,18 +1784,18 @@ static int ice_vc_config_rss_lut(struct ice_vf *vf, u8 *msg)
goto error_param; goto error_param;
} }
vsi = pf->vsi[vf->lan_vsi_idx]; if (vrl->lut_entries != ICE_VSIQF_HLUT_ARRAY_SIZE) {
if (!vsi) {
v_ret = VIRTCHNL_STATUS_ERR_PARAM; v_ret = VIRTCHNL_STATUS_ERR_PARAM;
goto error_param; goto error_param;
} }
if (vrl->lut_entries != ICE_VSIQF_HLUT_ARRAY_SIZE) { if (!test_bit(ICE_FLAG_RSS_ENA, vf->pf->flags)) {
v_ret = VIRTCHNL_STATUS_ERR_PARAM; v_ret = VIRTCHNL_STATUS_ERR_PARAM;
goto error_param; goto error_param;
} }
if (!test_bit(ICE_FLAG_RSS_ENA, vf->pf->flags)) { vsi = pf->vsi[vf->lan_vsi_idx];
if (!vsi) {
v_ret = VIRTCHNL_STATUS_ERR_PARAM; v_ret = VIRTCHNL_STATUS_ERR_PARAM;
goto error_param; goto error_param;
} }
...@@ -1877,6 +1880,12 @@ static int ice_vc_ena_qs_msg(struct ice_vf *vf, u8 *msg) ...@@ -1877,6 +1880,12 @@ static int ice_vc_ena_qs_msg(struct ice_vf *vf, u8 *msg)
goto error_param; goto error_param;
} }
if (vqs->rx_queues > ICE_MAX_BASE_QS_PER_VF ||
vqs->tx_queues > ICE_MAX_BASE_QS_PER_VF) {
v_ret = VIRTCHNL_STATUS_ERR_PARAM;
goto error_param;
}
vsi = pf->vsi[vf->lan_vsi_idx]; vsi = pf->vsi[vf->lan_vsi_idx];
if (!vsi) { if (!vsi) {
v_ret = VIRTCHNL_STATUS_ERR_PARAM; v_ret = VIRTCHNL_STATUS_ERR_PARAM;
...@@ -1932,6 +1941,12 @@ static int ice_vc_dis_qs_msg(struct ice_vf *vf, u8 *msg) ...@@ -1932,6 +1941,12 @@ static int ice_vc_dis_qs_msg(struct ice_vf *vf, u8 *msg)
goto error_param; goto error_param;
} }
if (vqs->rx_queues > ICE_MAX_BASE_QS_PER_VF ||
vqs->tx_queues > ICE_MAX_BASE_QS_PER_VF) {
v_ret = VIRTCHNL_STATUS_ERR_PARAM;
goto error_param;
}
vsi = pf->vsi[vf->lan_vsi_idx]; vsi = pf->vsi[vf->lan_vsi_idx];
if (!vsi) { if (!vsi) {
v_ret = VIRTCHNL_STATUS_ERR_PARAM; v_ret = VIRTCHNL_STATUS_ERR_PARAM;
...@@ -1984,12 +1999,6 @@ static int ice_vc_cfg_irq_map_msg(struct ice_vf *vf, u8 *msg) ...@@ -1984,12 +1999,6 @@ static int ice_vc_cfg_irq_map_msg(struct ice_vf *vf, u8 *msg)
irqmap_info = (struct virtchnl_irq_map_info *)msg; irqmap_info = (struct virtchnl_irq_map_info *)msg;
num_q_vectors_mapped = irqmap_info->num_vectors; num_q_vectors_mapped = irqmap_info->num_vectors;
vsi = pf->vsi[vf->lan_vsi_idx];
if (!vsi) {
v_ret = VIRTCHNL_STATUS_ERR_PARAM;
goto error_param;
}
/* Check to make sure number of VF vectors mapped is not greater than /* Check to make sure number of VF vectors mapped is not greater than
* number of VF vectors originally allocated, and check that * number of VF vectors originally allocated, and check that
* there is actually at least a single VF queue vector mapped * there is actually at least a single VF queue vector mapped
...@@ -2001,6 +2010,12 @@ static int ice_vc_cfg_irq_map_msg(struct ice_vf *vf, u8 *msg) ...@@ -2001,6 +2010,12 @@ static int ice_vc_cfg_irq_map_msg(struct ice_vf *vf, u8 *msg)
goto error_param; goto error_param;
} }
vsi = pf->vsi[vf->lan_vsi_idx];
if (!vsi) {
v_ret = VIRTCHNL_STATUS_ERR_PARAM;
goto error_param;
}
for (i = 0; i < num_q_vectors_mapped; i++) { for (i = 0; i < num_q_vectors_mapped; i++) {
struct ice_q_vector *q_vector; struct ice_q_vector *q_vector;
...@@ -2092,10 +2107,6 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg) ...@@ -2092,10 +2107,6 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg)
goto error_param; goto error_param;
} }
vsi = pf->vsi[vf->lan_vsi_idx];
if (!vsi)
goto error_param;
if (qci->num_queue_pairs > ICE_MAX_BASE_QS_PER_VF) { if (qci->num_queue_pairs > ICE_MAX_BASE_QS_PER_VF) {
dev_err(&pf->pdev->dev, dev_err(&pf->pdev->dev,
"VF-%d requesting more than supported number of queues: %d\n", "VF-%d requesting more than supported number of queues: %d\n",
...@@ -2104,11 +2115,18 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg) ...@@ -2104,11 +2115,18 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg)
goto error_param; goto error_param;
} }
vsi = pf->vsi[vf->lan_vsi_idx];
if (!vsi) {
v_ret = VIRTCHNL_STATUS_ERR_PARAM;
goto error_param;
}
for (i = 0; i < qci->num_queue_pairs; i++) { for (i = 0; i < qci->num_queue_pairs; i++) {
qpi = &qci->qpair[i]; qpi = &qci->qpair[i];
if (qpi->txq.vsi_id != qci->vsi_id || if (qpi->txq.vsi_id != qci->vsi_id ||
qpi->rxq.vsi_id != qci->vsi_id || qpi->rxq.vsi_id != qci->vsi_id ||
qpi->rxq.queue_id != qpi->txq.queue_id || qpi->rxq.queue_id != qpi->txq.queue_id ||
qpi->txq.headwb_enabled ||
!ice_vc_isvalid_q_id(vf, qci->vsi_id, qpi->txq.queue_id)) { !ice_vc_isvalid_q_id(vf, qci->vsi_id, qpi->txq.queue_id)) {
v_ret = VIRTCHNL_STATUS_ERR_PARAM; v_ret = VIRTCHNL_STATUS_ERR_PARAM;
goto error_param; goto error_param;
...@@ -2193,7 +2211,7 @@ ice_vc_handle_mac_addr_msg(struct ice_vf *vf, u8 *msg, bool set) ...@@ -2193,7 +2211,7 @@ ice_vc_handle_mac_addr_msg(struct ice_vf *vf, u8 *msg, bool set)
(struct virtchnl_ether_addr_list *)msg; (struct virtchnl_ether_addr_list *)msg;
struct ice_pf *pf = vf->pf; struct ice_pf *pf = vf->pf;
enum virtchnl_ops vc_op; enum virtchnl_ops vc_op;
LIST_HEAD(mac_list); enum ice_status status;
struct ice_vsi *vsi; struct ice_vsi *vsi;
int mac_count = 0; int mac_count = 0;
int i; int i;
...@@ -2267,33 +2285,32 @@ ice_vc_handle_mac_addr_msg(struct ice_vf *vf, u8 *msg, bool set) ...@@ -2267,33 +2285,32 @@ ice_vc_handle_mac_addr_msg(struct ice_vf *vf, u8 *msg, bool set)
goto handle_mac_exit; goto handle_mac_exit;
} }
/* get here if maddr is multicast or if VF can change MAC */ /* program the updated filter list */
if (ice_add_mac_to_list(vsi, &mac_list, al->list[i].addr)) { status = ice_vsi_cfg_mac_fltr(vsi, maddr, set);
v_ret = VIRTCHNL_STATUS_ERR_NO_MEMORY; if (status == ICE_ERR_DOES_NOT_EXIST ||
status == ICE_ERR_ALREADY_EXISTS) {
dev_info(&pf->pdev->dev,
"can't %s MAC filters %pM for VF %d, error %d\n",
set ? "add" : "remove", maddr, vf->vf_id,
status);
} else if (status) {
dev_err(&pf->pdev->dev,
"can't %s MAC filters for VF %d, error %d\n",
set ? "add" : "remove", vf->vf_id, status);
v_ret = ice_err_to_virt_err(status);
goto handle_mac_exit; goto handle_mac_exit;
} }
mac_count++; mac_count++;
} }
/* program the updated filter list */ /* Track number of MAC filters programmed for the VF VSI */
if (set) if (set)
v_ret = ice_err_to_virt_err(ice_add_mac(&pf->hw, &mac_list)); vf->num_mac += mac_count;
else else
v_ret = ice_err_to_virt_err(ice_remove_mac(&pf->hw, &mac_list)); vf->num_mac -= mac_count;
if (v_ret) {
dev_err(&pf->pdev->dev,
"can't %s MAC filters for VF %d, error %d\n",
set ? "add" : "remove", vf->vf_id, v_ret);
} else {
if (set)
vf->num_mac += mac_count;
else
vf->num_mac -= mac_count;
}
handle_mac_exit: handle_mac_exit:
ice_free_fltr_list(&pf->pdev->dev, &mac_list);
/* send the response to the VF */ /* send the response to the VF */
return ice_vc_send_msg_to_vf(vf, vc_op, v_ret, NULL, 0); return ice_vc_send_msg_to_vf(vf, vc_op, v_ret, NULL, 0);
} }
...@@ -2754,20 +2771,6 @@ void ice_vc_process_vf_msg(struct ice_pf *pf, struct ice_rq_event_info *event) ...@@ -2754,20 +2771,6 @@ void ice_vc_process_vf_msg(struct ice_pf *pf, struct ice_rq_event_info *event)
err = -EPERM; err = -EPERM;
else else
err = -EINVAL; err = -EINVAL;
goto error_handler;
}
/* Perform additional checks specific to RSS and Virtchnl */
if (v_opcode == VIRTCHNL_OP_CONFIG_RSS_KEY) {
struct virtchnl_rss_key *vrk = (struct virtchnl_rss_key *)msg;
if (vrk->key_len != ICE_VSIQF_HKEY_ARRAY_SIZE)
err = -EINVAL;
} else if (v_opcode == VIRTCHNL_OP_CONFIG_RSS_LUT) {
struct virtchnl_rss_lut *vrl = (struct virtchnl_rss_lut *)msg;
if (vrl->lut_entries != ICE_VSIQF_HLUT_ARRAY_SIZE)
err = -EINVAL;
} }
error_handler: error_handler:
......
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