Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp802098rwb; Mon, 26 Sep 2022 06:08:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4QVIYxA/1tenOwqiQkvnJYNz/XG3ODzg0pPV5IdUMIZ3sTvic5nNr0gPcxtFc/WUYmGVSB X-Received: by 2002:a63:188:0:b0:43c:22e9:2d10 with SMTP id 130-20020a630188000000b0043c22e92d10mr17832937pgb.12.1664197701682; Mon, 26 Sep 2022 06:08:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664197701; cv=none; d=google.com; s=arc-20160816; b=s7ptwLSUY0sLVIe7gVaA/II1x63hmbkNYYh+h+o4VrJp+mMcTfUfqjI5RfSwjElGYS tvKhj0dmQvMyFINto9vTYeEuGDKl/xRowQRlKJndgRLR5HL0lc4en1aLZUSFo0Z4/Gt3 m6xzbpKAjRjCOmUOeFsMdVDk5ed/I+r0Or9yELsAVF0d0/rSl8iVY04XwIyjJgkp9RPE 2q2bVWqq7Uh7oPhGwr0FL8D7gVBiuhA0mJrhufn7M1gHlWcsCX7w8q+8eHUxhz/fw8UV Zwc6B3siXB8pxBtSlUVGjwO/sytDaQrCDWX3EqER0n3gUzQ/mBgBXlJuaSIwd0vxMR1l ZM6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=r/PN5rUwd0xEsQZV67Y2AcJxqTNDn/4OnG6ywZJR1IM=; b=GTe97C87z9DuGbE+u1/Mf0UDcy4BDjjuI0HQrZX/8u0JvUtgfS4Ui2vSGx2yijV51f lf8NiZOhqJy0J4bphPAkOd+ti42ePAxKrKmIXNxlbJUjo3YbB4RbgL6L/p6UDbl1G3GP ZFENoMyhzLe69yFt4rOq5fJTIuLzwVoJtDj8nqWEzpYVKDsycuBxi0rmPzefCfEGq2Uq dTguOLrxKMKxJzu8gjSHBCKQ5+EW+evndHimElF0MroHXc6i+V40cuEMgdvmEu0L6Nvl 6YllJ9cETp8GYskKTR9/9LZdSDrCGkWmTiR2reD4oYbHWR1MptuXhu6Z0y/X2K7HvqRy d8iA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gYrrODSQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r124-20020a632b82000000b0043c700ff7f6si8770150pgr.721.2022.09.26.06.07.53; Mon, 26 Sep 2022 06:08:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gYrrODSQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235814AbiIZKax (ORCPT + 99 others); Mon, 26 Sep 2022 06:30:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235696AbiIZK2x (ORCPT ); Mon, 26 Sep 2022 06:28:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B12914E844; Mon, 26 Sep 2022 03:19:07 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 4119A60B7E; Mon, 26 Sep 2022 10:19:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 333B4C433D7; Mon, 26 Sep 2022 10:19:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187546; bh=Bj2v3nwe6fdlLQ3qvbwTokg5tL8tDF3wlKOTFLUxep0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gYrrODSQWwCuVTp0DSfBpgpg3nsc90Y5dEJJ9B14e+r/bCe98sm1ZF5Dzvyqe9z+a FJAREayE6QyShdd4ABNfHhx7Rpr5mlciPAf1UFQDsVdUXRqmgnIEt81nr47J4UvR4z lXRCv9ZDxE9yBu/l2K2MLCuVaOv/tfMc5mk6MquE= 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 4.19 42/58] i40e: Fix VF set max MTU size Date: Mon, 26 Sep 2022 12:12:01 +0200 Message-Id: <20220926100742.992724603@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100741.430882406@linuxfoundation.org> References: <20220926100741.430882406@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 frame 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/net/ethernet/intel/i40e/i40e_virtchnl_pf.c index a39a8fe073ca..973350b34e08 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c @@ -1712,6 +1712,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 @@ -1814,6 +1833,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; -- 2.35.1