Skip to content

Commit 372539d

Browse files
michalx-jaronanguy11
authored andcommitted
i40e: Fix VF set max MTU size
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: dab86af ("i40e/i40evf: Change the way we limit the maximum frame size for Rx") Signed-off-by: Michal Jaron <[email protected]> Signed-off-by: Mateusz Palczewski <[email protected]> Tested-by: Konrad Jankowski <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent 399c98c commit 372539d

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2038,6 +2038,25 @@ static void i40e_del_qch(struct i40e_vf *vf)
20382038
}
20392039
}
20402040

2041+
/**
2042+
* i40e_vc_get_max_frame_size
2043+
* @vf: pointer to the VF
2044+
*
2045+
* Max frame size is determined based on the current port's max frame size and
2046+
* whether a port VLAN is configured on this VF. The VF is not aware whether
2047+
* it's in a port VLAN so the PF needs to account for this in max frame size
2048+
* checks and sending the max frame size to the VF.
2049+
**/
2050+
static u16 i40e_vc_get_max_frame_size(struct i40e_vf *vf)
2051+
{
2052+
u16 max_frame_size = vf->pf->hw.phy.link_info.max_frame_size;
2053+
2054+
if (vf->port_vlan_id)
2055+
max_frame_size -= VLAN_HLEN;
2056+
2057+
return max_frame_size;
2058+
}
2059+
20412060
/**
20422061
* i40e_vc_get_vf_resources_msg
20432062
* @vf: pointer to the VF info
@@ -2139,6 +2158,7 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg)
21392158
vfres->max_vectors = pf->hw.func_caps.num_msix_vectors_vf;
21402159
vfres->rss_key_size = I40E_HKEY_ARRAY_SIZE;
21412160
vfres->rss_lut_size = I40E_VF_HLUT_ARRAY_SIZE;
2161+
vfres->max_mtu = i40e_vc_get_max_frame_size(vf);
21422162

21432163
if (vf->lan_vsi_idx) {
21442164
vfres->vsi_res[0].vsi_id = vf->lan_vsi_id;

0 commit comments

Comments
 (0)