From nobody Wed Dec 17 04:09:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34C75C32771 for ; Mon, 26 Sep 2022 11:51:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238669AbiIZLvC (ORCPT ); Mon, 26 Sep 2022 07:51:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238654AbiIZLt3 (ORCPT ); Mon, 26 Sep 2022 07:49:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4AE2753BE; Mon, 26 Sep 2022 03:48:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C6FD1B80782; Mon, 26 Sep 2022 10:47:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C8E6C433C1; Mon, 26 Sep 2022 10:47:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189227; bh=JPaDt2jOgKHg1AcO/GhZXdMVpJycjDBqY17J3Th7bP4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MidLz36vArzNXgGvDWQYtO77Ty/ZpmXQBcpDMy0i/j/jYgbGxef6mS0igWe6k5V8v Pa6bjDkSt2lu8+VwPXtpjnL75A0SEyzMRFXpQNWjmj1bMmu1vyaOf+kqxSXLiWuj4+ KffQzquTL672oSUyzUMoA5waXTON4PIhMkUMEKcA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michal Jaron , Mateusz Palczewski , Konrad Jankowski , Tony Nguyen , Sasha Levin Subject: [PATCH 5.19 116/207] i40e: Fix VF set max MTU size Date: Mon, 26 Sep 2022 12:11:45 +0200 Message-Id: <20220926100811.759453439@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michal Jaron [ Upstream commit 372539def2824c43b6afe2403045b140f65c5acc ] 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 fram= e size for Rx") Signed-off-by: Michal Jaron Signed-off-by: Mateusz Palczewski Tested-by: Konrad Jankowski Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- .../ethernet/intel/i40e/i40e_virtchnl_pf.c | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/n= et/ethernet/intel/i40e/i40e_virtchnl_pf.c index 86b0f21287dc..67fbaaad3985 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c @@ -2038,6 +2038,25 @@ static void i40e_del_qch(struct i40e_vf *vf) } } =20 +/** + * 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 wheth= er + * it's in a port VLAN so the PF needs to account for this in max frame si= ze + * 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 =3D vf->pf->hw.phy.link_info.max_frame_size; + + if (vf->port_vlan_id) + max_frame_size -=3D 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_v= f *vf, u8 *msg) vfres->max_vectors =3D pf->hw.func_caps.num_msix_vectors_vf; vfres->rss_key_size =3D I40E_HKEY_ARRAY_SIZE; vfres->rss_lut_size =3D I40E_VF_HLUT_ARRAY_SIZE; + vfres->max_mtu =3D i40e_vc_get_max_frame_size(vf); =20 if (vf->lan_vsi_idx) { vfres->vsi_res[0].vsi_id =3D vf->lan_vsi_id; --=20 2.35.1