Skip to contentSkip to conversation

Fix vf set max mtu size with port vlan and jumbo frames

PATCH Superseded Mateusz Palczewski 1 participant 3 messages Sep 6, 2022

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Fix vf set max mtu size with port vlan and jumbo frames

Fix "PF returned error -5 (IAVF_ERR_PARAM) to our request 6" error and possible page_frag_cache_drain crashes that is a result of this error when port vlan and jumbo frames are set on vf .

Michal Jaron (2):
iavf: Fix vf set max mtu size with port vlan and jumbo frames
i40e: Fix vf set max mtu size

 .../ethernet/intel/i40e/i40e_virtchnl_pf.c    | 20 +++++++++++++++++++
 .../net/ethernet/intel/iavf/iavf_virtchnl.c   |  7 +++++--
 2 files changed, 25 insertions(+), 2 deletions(-)
Signature · 6 lines
2.27.0

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

PATCH 1/2 iavf: Fix vf set max mtu size with port vlan and jumbo frames

From: Michal Jaron <[email protected]>

After setting port vlan and mtu 9000 on vf with ice driver there was an iavf error
"PF returned error -5 (IAVF_ERR_PARAM) to our request 6". It was caused by that during queues configuration vf's max packet size was set to IAVF_MAX_RXBUFFER but on ice max frame size was smaller by VLAN_HLEN due to making some space for port vlan as VF is not aware whether it's in a port VLAN. This mismatch in sizes caused that ice rejects queues configuration with ERR_PARAM error. Proper max_mtu is send from ice pf to vf with GET_VF_RESOURCES msg but vf does not look at this.

In iavf change max_frame from IAVF_MAX_RXBUFFER to max_mtu received from pf with GET_VF_RESOURCES msg to make vf's max_frame_size dependent from pf. Add check if received max_mtu is not in eligible range then set it to IAVF_MAX_RXBUFFER.

Fixes dab86afdbbd1 ("i40e/i40evf: Change the way we limit the maximum frame size for Rx")
---
 drivers/net/ethernet/intel/iavf/iavf_virtchnl.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/iavf/iavf_virtchnl.c +5 -2
index 15ee85dc33bd..e468f1324541 100644
@@ -269,11 +269,14 @@ int iavf_get_vf_vlan_v2_caps(struct iavf_adapter *adapter)
 void iavf_configure_queues(struct iavf_adapter *adapter)
 {
 	struct virtchnl_vsi_queue_config_info *vqci;
-	struct virtchnl_queue_pair_info *vqpi;
+	int i, max_frame = adapter->vf_res->max_mtu;
 	int pairs = adapter->num_active_queues;
-	int i, max_frame = IAVF_MAX_RXBUFFER;
+	struct virtchnl_queue_pair_info *vqpi;
 	size_t len;
 
+	if (max_frame > IAVF_MAX_RXBUFFER || max_frame < 64)
+		max_frame = IAVF_MAX_RXBUFFER;
+
 	if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) {
 		/* bail because we already have a command pending */
 		dev_err(&adapter->pdev->dev, "Cannot configure queues, command %d pending\n",
Signature · 6 lines
2.27.0

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

PATCH 2/2 i40e: Fix vf set max mtu size

In reply to Mateusz Palczewski

From: Michal Jaron <[email protected]>

Max mtu sent to vf is set to 0 during memory allocation. It cause that max mtu on VF is changed to IAVF_MAX_RXBUFFER and does not depend on data from hw.

Set max_mtu field in virtchnl_vf_resource struct to inform vf in GET_VF_RESOURCES msg what size should be max frame.

Fixes dab86afdbbd1 ("i40e/i40evf: Change the way we limit the maximum frame size for Rx")
---
 .../ethernet/intel/i40e/i40e_virtchnl_pf.c    | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +20 -0
index 4f184c50f6e8..7e9f6a69eb10 100644
@@ -2038,6 +2038,25 @@ static void i40e_del_qch(struct i40e_vf *vf)
 	}
 }
 
+/**
+ * i40e_vc_get_max_frame_size
+ * @vf: pointer to the VF
+ *
+ * Max frame size is determined based on the current port's max frame size and
+ * whether a port VLAN is configured on this VF. The VF is not aware whether
+ * it's in a port VLAN so the PF needs to account for this in max frame size
+ * checks and sending the max frame size to the VF.
+ **/
+static u16 i40e_vc_get_max_frame_size(struct i40e_vf *vf)
+{
+	u16 max_frame_size = vf->pf->hw.phy.link_info.max_frame_size;
+
+	if (vf->port_vlan_id)
+		max_frame_size -= VLAN_HLEN;
+
+	return max_frame_size;
+}
+
 /**
  * i40e_vc_get_vf_resources_msg
  * @vf: pointer to the VF info
@@ -2139,6 +2158,7 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg)
 	vfres->max_vectors = pf->hw.func_caps.num_msix_vectors_vf;
 	vfres->rss_key_size = I40E_HKEY_ARRAY_SIZE;
 	vfres->rss_lut_size = I40E_VF_HLUT_ARRAY_SIZE;
+	vfres->max_mtu = i40e_vc_get_max_frame_size(vf);
 
 	if (vf->lan_vsi_idx) {
 		vfres->vsi_res[0].vsi_id = vf->lan_vsi_id;
Signature · 6 lines
2.27.0

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