Skip to contentSkip to conversation

ice: Fix max VLANs available for VF

PATCH Superseded Palczewski, Mateusz 2 participants 3 messages Jun 28, 2022

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ice: Fix max VLANs available for VF

Legacy VLAN implementation allows for untrusted VF to have 8 VLAN filters, not counting VLAN 0 filters. Current VLAN_V2 implementation lowers available filters for VF, by counting in VLAN 0 filter for both TPIDs.
Fix this by counting only non zero VLAN filters.
Without this patch, untrusted VF would not be able to access 8 VLAN filters.

Fixes cc71de8fa133 ("ice: Add support for VIRTCHNL_VF_OFFLOAD_VLAN_V2")

---
v2: Changed fixes tag

---
 drivers/net/ethernet/intel/ice/ice_virtchnl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_virtchnl.c +2 -1
index 4547bc1f7cee..24188ec594d5 100644
@@ -2948,7 +2948,8 @@ ice_vc_validate_add_vlan_filter_list(struct ice_vsi *vsi,
 				     struct virtchnl_vlan_filtering_caps *vfc,
 				     struct virtchnl_vlan_filter_list_v2 *vfl)
 {
-	u16 num_requested_filters = vsi->num_vlan + vfl->num_elements;
+	u16 num_requested_filters = ice_vsi_num_non_zero_vlans(vsi) +
+		vfl->num_elements;
 
 	if (num_requested_filters > vfc->max_filters)
 		return false;
Signature · 6 lines
2.27.0

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
maintainer
#1 lore raw
Quoted 11 lines · Mateusz

Legacy VLAN implementation allows for untrusted VF to have 8 VLAN filters, not counting VLAN 0 filters. Current VLAN_V2 implementation lowers available filters for VF, by counting in VLAN 0 filter for both TPIDs.
Fix this by counting only non zero VLAN filters.
Without this patch, untrusted VF would not be able to access 8 VLAN filters.

Fixes cc71de8fa133 ("ice: Add support for VIRTCHNL_VF_OFFLOAD_VLAN_V2")

As Olek pointed out, please fix your email settings [1].

From:/Signed-off-by: email name mismatch: 'From: "Palczewski, Mateusz" <[email protected]>' != 'Signed-off-by: Mateusz Palczewski <[email protected]>'

However, based on ordering, shouldn't the author be Przemyslaw?

[1] https://lore.kernel.org/intel-wired-lan/[email protected]/T/#m20c8d8eb342f31bdbf88f1976a484a04bf049554

Quoted 11 lines

---
v2: Changed fixes tag

---
  drivers/net/ethernet/intel/ice/ice_virtchnl.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_virtchnl.c +0 -0
index 4547bc1f7cee..24188ec594d5 100644

drivers/net/ethernet/intel/ice/ice_virtchnl.c ice_vc_validate_add_vlan_filter_list(struct ice_vsi *vsi, · line 2955

Quoted 9 lines
drivers/net/ethernet/intel/ice/ice_virtchnl.c +2 -1
@@ -2948,7 +2948,8 @@ ice_vc_validate_add_vlan_filter_list(struct ice_vsi *vsi,
  				     struct virtchnl_vlan_filtering_caps *vfc,
  				     struct virtchnl_vlan_filter_list_v2 *vfl)
  {
-	u16 num_requested_filters = vsi->num_vlan + vfl->num_elements;
+	u16 num_requested_filters = ice_vsi_num_non_zero_vlans(vsi) +
+		vfl->num_elements;
 
  	if (num_requested_filters > vfc->max_filters)
  		return false;

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

#2 lore raw
In reply to Palczewski, Mateusz
Quoted 11 lines · Mateusz

Legacy VLAN implementation allows for untrusted VF to have 8 VLAN filters, not counting VLAN 0 filters. Current VLAN_V2 implementation lowers available filters for VF, by counting in VLAN 0 filter for both TPIDs.
Fix this by counting only non zero VLAN filters.
Without this patch, untrusted VF would not be able to access 8 VLAN filters.

Fixes cc71de8fa133 ("ice: Add support for VIRTCHNL_VF_OFFLOAD_VLAN_V2")

As Olek pointed out, please fix your email settings [1].

From:/Signed-off-by: email name mismatch: 'From: "Palczewski, Mateusz" <[email protected]>' != 'Signed-off-by: Mateusz Palczewski <[email protected]>'

However, based on ordering, shouldn't the author be Przemyslaw?

[1]
https://lore.kernel.org/intel-wired-lan/[email protected]/T/#m20c8d8eb342f31bdbf88f1976a484a04bf049554

Quoted 11 lines

---
v2: Changed fixes tag

---
  drivers/net/ethernet/intel/ice/ice_virtchnl.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_virtchnl.c +0 -0
index 4547bc1f7cee..24188ec594d5 100644

drivers/net/ethernet/intel/ice/ice_virtchnl.c ice_vc_validate_add_vlan_filter_list(struct ice_vsi *vsi, · line 2955

Quoted 9 lines
drivers/net/ethernet/intel/ice/ice_virtchnl.c +2 -1
@@ -2948,7 +2948,8 @@ ice_vc_validate_add_vlan_filter_list(struct ice_vsi *vsi,
  				     struct virtchnl_vlan_filtering_caps *vfc,
  				     struct virtchnl_vlan_filter_list_v2 *vfl)
  {
-	u16 num_requested_filters = vsi->num_vlan + vfl->num_elements;
+	u16 num_requested_filters = ice_vsi_num_non_zero_vlans(vsi) +
+		vfl->num_elements;
 
  	if (num_requested_filters > vfc->max_filters)
  		return false;

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan