Skip to content

Commit

Permalink
Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/tnguy/net-queue

Tony Nguyen says:

====================
Intel Wired LAN Driver Updates 2022-08-17 (ice)

This series contains updates to ice driver only.

Grzegorz prevents modifications to VLAN 0 when setting VLAN promiscuous
as it will already be set. He also ignores -EEXIST error when attempting
to set promiscuous and ensures promiscuous mode is properly cleared from
the hardware when being removed.

Benjamin ignores additional -EEXIST errors when setting promiscuous mode
since the existing mode is the desired mode.

Sylwester fixes VFs to allow sending of tagged traffic when no VLAN filters
exist.

* '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue:
  ice: Fix VF not able to send tagged traffic with no VLAN filters
  ice: Ignore error message when setting same promiscuous mode
  ice: Fix clearing of promisc mode with bridge over bond
  ice: Ignore EEXIST when setting promisc mode
  ice: Fix double VLAN error when entering promisc mode
====================

Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
kuba-moo committed Aug 18, 2022
2 parents 8aa48ad + 664d464 commit 138d186
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 18 deletions.
8 changes: 4 additions & 4 deletions drivers/net/ethernet/intel/ice/ice_fltr.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ ice_fltr_set_vlan_vsi_promisc(struct ice_hw *hw, struct ice_vsi *vsi,
int result;

result = ice_set_vlan_vsi_promisc(hw, vsi->idx, promisc_mask, false);
if (result)
if (result && result != -EEXIST)
dev_err(ice_pf_to_dev(pf),
"Error setting promisc mode on VSI %i (rc=%d)\n",
vsi->vsi_num, result);
Expand All @@ -86,7 +86,7 @@ ice_fltr_clear_vlan_vsi_promisc(struct ice_hw *hw, struct ice_vsi *vsi,
int result;

result = ice_set_vlan_vsi_promisc(hw, vsi->idx, promisc_mask, true);
if (result)
if (result && result != -EEXIST)
dev_err(ice_pf_to_dev(pf),
"Error clearing promisc mode on VSI %i (rc=%d)\n",
vsi->vsi_num, result);
Expand All @@ -109,7 +109,7 @@ ice_fltr_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
int result;

result = ice_clear_vsi_promisc(hw, vsi_handle, promisc_mask, vid);
if (result)
if (result && result != -EEXIST)
dev_err(ice_pf_to_dev(pf),
"Error clearing promisc mode on VSI %i for VID %u (rc=%d)\n",
ice_get_hw_vsi_num(hw, vsi_handle), vid, result);
Expand All @@ -132,7 +132,7 @@ ice_fltr_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
int result;

result = ice_set_vsi_promisc(hw, vsi_handle, promisc_mask, vid);
if (result)
if (result && result != -EEXIST)
dev_err(ice_pf_to_dev(pf),
"Error setting promisc mode on VSI %i for VID %u (rc=%d)\n",
ice_get_hw_vsi_num(hw, vsi_handle), vid, result);
Expand Down
6 changes: 5 additions & 1 deletion drivers/net/ethernet/intel/ice/ice_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -4062,7 +4062,11 @@ int ice_vsi_del_vlan_zero(struct ice_vsi *vsi)
if (err && err != -EEXIST)
return err;

return 0;
/* when deleting the last VLAN filter, make sure to disable the VLAN
* promisc mode so the filter isn't left by accident
*/
return ice_clear_vsi_promisc(&vsi->back->hw, vsi->idx,
ICE_MCAST_VLAN_PROMISC_BITS, 0);
}

/**
Expand Down
12 changes: 11 additions & 1 deletion drivers/net/ethernet/intel/ice/ice_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,10 @@ static int ice_set_promisc(struct ice_vsi *vsi, u8 promisc_m)
status = ice_fltr_set_vsi_promisc(&vsi->back->hw, vsi->idx,
promisc_m, 0);
}
if (status && status != -EEXIST)
return status;

return status;
return 0;
}

/**
Expand Down Expand Up @@ -3573,6 +3575,14 @@ ice_vlan_rx_kill_vid(struct net_device *netdev, __be16 proto, u16 vid)
while (test_and_set_bit(ICE_CFG_BUSY, vsi->state))
usleep_range(1000, 2000);

ret = ice_clear_vsi_promisc(&vsi->back->hw, vsi->idx,
ICE_MCAST_VLAN_PROMISC_BITS, vid);
if (ret) {
netdev_err(netdev, "Error clearing multicast promiscuous mode on VSI %i\n",
vsi->vsi_num);
vsi->current_netdev_flags |= IFF_ALLMULTI;
}

vlan_ops = ice_get_compat_vsi_vlan_ops(vsi);

/* Make sure VLAN delete is successful before updating VLAN
Expand Down
9 changes: 8 additions & 1 deletion drivers/net/ethernet/intel/ice/ice_switch.c
Original file line number Diff line number Diff line change
Expand Up @@ -4445,14 +4445,21 @@ ice_set_vlan_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
goto free_fltr_list;

list_for_each_entry(list_itr, &vsi_list_head, list_entry) {
/* Avoid enabling or disabling VLAN zero twice when in double
* VLAN mode
*/
if (ice_is_dvm_ena(hw) &&
list_itr->fltr_info.l_data.vlan.tpid == 0)
continue;

vlan_id = list_itr->fltr_info.l_data.vlan.vlan_id;
if (rm_vlan_promisc)
status = ice_clear_vsi_promisc(hw, vsi_handle,
promisc_mask, vlan_id);
else
status = ice_set_vsi_promisc(hw, vsi_handle,
promisc_mask, vlan_id);
if (status)
if (status && status != -EEXIST)
break;
}

Expand Down
11 changes: 7 additions & 4 deletions drivers/net/ethernet/intel/ice/ice_vf_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -764,13 +764,16 @@ static int ice_cfg_mac_antispoof(struct ice_vsi *vsi, bool enable)
static int ice_vsi_ena_spoofchk(struct ice_vsi *vsi)
{
struct ice_vsi_vlan_ops *vlan_ops;
int err;
int err = 0;

vlan_ops = ice_get_compat_vsi_vlan_ops(vsi);

err = vlan_ops->ena_tx_filtering(vsi);
if (err)
return err;
/* Allow VF with VLAN 0 only to send all tagged traffic */
if (vsi->type != ICE_VSI_VF || ice_vsi_has_non_zero_vlans(vsi)) {
err = vlan_ops->ena_tx_filtering(vsi);
if (err)
return err;
}

return ice_cfg_mac_antispoof(vsi, true);
}
Expand Down
57 changes: 50 additions & 7 deletions drivers/net/ethernet/intel/ice/ice_virtchnl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2288,6 +2288,15 @@ static int ice_vc_process_vlan_msg(struct ice_vf *vf, u8 *msg, bool add_v)

/* Enable VLAN filtering on first non-zero VLAN */
if (!vlan_promisc && vid && !ice_is_dvm_ena(&pf->hw)) {
if (vf->spoofchk) {
status = vsi->inner_vlan_ops.ena_tx_filtering(vsi);
if (status) {
v_ret = VIRTCHNL_STATUS_ERR_PARAM;
dev_err(dev, "Enable VLAN anti-spoofing on VLAN ID: %d failed error-%d\n",
vid, status);
goto error_param;
}
}
if (vsi->inner_vlan_ops.ena_rx_filtering(vsi)) {
v_ret = VIRTCHNL_STATUS_ERR_PARAM;
dev_err(dev, "Enable VLAN pruning on VLAN ID: %d failed error-%d\n",
Expand Down Expand Up @@ -2333,8 +2342,10 @@ static int ice_vc_process_vlan_msg(struct ice_vf *vf, u8 *msg, bool add_v)
}

/* Disable VLAN filtering when only VLAN 0 is left */
if (!ice_vsi_has_non_zero_vlans(vsi))
if (!ice_vsi_has_non_zero_vlans(vsi)) {
vsi->inner_vlan_ops.dis_tx_filtering(vsi);
vsi->inner_vlan_ops.dis_rx_filtering(vsi);
}

if (vlan_promisc)
ice_vf_dis_vlan_promisc(vsi, &vlan);
Expand Down Expand Up @@ -2838,6 +2849,13 @@ ice_vc_del_vlans(struct ice_vf *vf, struct ice_vsi *vsi,

if (vlan_promisc)
ice_vf_dis_vlan_promisc(vsi, &vlan);

/* Disable VLAN filtering when only VLAN 0 is left */
if (!ice_vsi_has_non_zero_vlans(vsi) && ice_is_dvm_ena(&vsi->back->hw)) {
err = vsi->outer_vlan_ops.dis_tx_filtering(vsi);
if (err)
return err;
}
}

vc_vlan = &vlan_fltr->inner;
Expand All @@ -2853,8 +2871,17 @@ ice_vc_del_vlans(struct ice_vf *vf, struct ice_vsi *vsi,
/* no support for VLAN promiscuous on inner VLAN unless
* we are in Single VLAN Mode (SVM)
*/
if (!ice_is_dvm_ena(&vsi->back->hw) && vlan_promisc)
ice_vf_dis_vlan_promisc(vsi, &vlan);
if (!ice_is_dvm_ena(&vsi->back->hw)) {
if (vlan_promisc)
ice_vf_dis_vlan_promisc(vsi, &vlan);

/* Disable VLAN filtering when only VLAN 0 is left */
if (!ice_vsi_has_non_zero_vlans(vsi)) {
err = vsi->inner_vlan_ops.dis_tx_filtering(vsi);
if (err)
return err;
}
}
}
}

Expand Down Expand Up @@ -2931,6 +2958,13 @@ ice_vc_add_vlans(struct ice_vf *vf, struct ice_vsi *vsi,
if (err)
return err;
}

/* Enable VLAN filtering on first non-zero VLAN */
if (vf->spoofchk && vlan.vid && ice_is_dvm_ena(&vsi->back->hw)) {
err = vsi->outer_vlan_ops.ena_tx_filtering(vsi);
if (err)
return err;
}
}

vc_vlan = &vlan_fltr->inner;
Expand All @@ -2946,10 +2980,19 @@ ice_vc_add_vlans(struct ice_vf *vf, struct ice_vsi *vsi,
/* no support for VLAN promiscuous on inner VLAN unless
* we are in Single VLAN Mode (SVM)
*/
if (!ice_is_dvm_ena(&vsi->back->hw) && vlan_promisc) {
err = ice_vf_ena_vlan_promisc(vsi, &vlan);
if (err)
return err;
if (!ice_is_dvm_ena(&vsi->back->hw)) {
if (vlan_promisc) {
err = ice_vf_ena_vlan_promisc(vsi, &vlan);
if (err)
return err;
}

/* Enable VLAN filtering on first non-zero VLAN */
if (vf->spoofchk && vlan.vid) {
err = vsi->inner_vlan_ops.ena_tx_filtering(vsi);
if (err)
return err;
}
}
}
}
Expand Down

0 comments on commit 138d186

Please sign in to comment.