Fix vf set max mtu size with port vlan and jumbo frames
Subsystems (2)
v2 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 .
---
v2: Fixed one check regarding !max_frame
---
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.25.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v2 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 missmatch 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.
---
v2: Fixed one check regarding !max_frame
--- 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
@@ -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) + 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.25.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Re: [Intel-wired-lan] [PATCH net v2 1/2] iavf: Fix vf set max mtu size with port vlan and jumbo frames
Quoted 44 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Mateusz Palczewski
Sent: Tuesday, September 13, 2022 3:39 PM
To: [email protected]
Cc: Jaron, MichalX <[email protected]>
Subject: [Intel-wired-lan] [PATCH net v2 1/2] iavf: Fix vf set max mtu size with port vlan and jumbo framesFrom: 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 toIAVF_MAX_RXBUFFERbut on ice max frame size was smaller byVLAN_HLENdue to making some space for port vlan as VF is not aware whether it's in a port VLAN. This missmatch in sizes caused that ice rejects queues configuration withERR_PARAMerror.
Propermax_mtuis send from ice pf to vf withGET_VF_RESOURCESmsg but vf does not look at this.In iavf change
max_framefromIAVF_MAX_RXBUFFERtomax_mtureceived from pf withGET_VF_RESOURCESmsg to make vf'smax_frame_sizedependent from pf. Add check if receivedmax_mtuis not in eligible range then set it toIAVF_MAX_RXBUFFER.Fixes dab86afdbbd1 ("i40e/i40evf: Change the way we limit the maximumframe size for Rx")
Signed-off-by Michal Jaron <[email protected]>Signed-off-by Mateusz Palczewski <[email protected]>---
v2: Fixed one check regarding !max_frame--- drivers/net/ethernet/intel/iavf/iavf_virtchnl.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)drivers/net/ethernet/intel/iavf/iavf_virtchnl.c +0
-0
drivers/net/ethernet/intel/iavf/iavf_virtchnl.c int iavf_get_vf_vlan_v2_caps(struct iavf_adapter · line 269
Quoted 1 line
drivers/net/ethernet/intel/iavf/iavf_virtchnl.c +0
-0@@ -269,11 +269,14 @@ int iavf_get_vf_vlan_v2_caps(struct iavf_adapter *adapter) void iavf_configure_queues(struct iavf_adapter *adapter) {
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v2 2/2 i40e: Fix vf set max mtu size
In reply to Mateusz PalczewskiFrom: 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.
---
v2: Fixed one check regarding !max_frame
--- .../ethernet/intel/i40e/i40e_virtchnl_pf.c | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +20 -0
@@ -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.25.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Re: [Intel-wired-lan] [PATCH net v2 2/2] i40e: Fix vf set max mtu size
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
Quoted 34 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Mateusz Palczewski
Sent: Tuesday, September 13, 2022 3:39 PM
To: [email protected]
Cc: Jaron, MichalX <[email protected]>
Subject: [Intel-wired-lan] [PATCH net v2 2/2] i40e: Fix vf set max mtu sizeFrom: 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_RXBUFFERand does not depend on data from hw.Set
max_mtufield invirtchnl_vf_resourcestruct to inform vf inGET_VF_RESOURCESmsg what size should be max frame.Fixes dab86afdbbd1 ("i40e/i40evf: Change the way we limit the maximumframe size for Rx")
Signed-off-by Michal Jaron <[email protected]>Signed-off-by Mateusz Palczewski <[email protected]>---
v2: Fixed one check regarding !max_frame--- .../ethernet/intel/i40e/i40e_virtchnl_pf.c | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+)drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +0
-0
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan