Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2641025pxj; Mon, 31 May 2021 07:11:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznnMrMOWSDl9Vb6MKwE1JynNdzE5KzSYNpgAsV7bQHhzUxR0GLKV0eQKtrEF1kMlb3v6uw X-Received: by 2002:a5d:804f:: with SMTP id b15mr17166911ior.187.1622470311075; Mon, 31 May 2021 07:11:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622470311; cv=none; d=google.com; s=arc-20160816; b=ztEqma7kjGB9mekX89kd0zoee3Uh28s6xNeu1M0p8Z162iTEy6rO0UzuNcAQ1fJF7f k8SEpHwgzH0886RtdKq3vchLg8iKdzfbhZwQs68bSKCa0Kq61Zha+HHa6HZZRAVY/slv 1wjv8/I8EA/5waGdpPePZIFuMT55mM/5PNlmRzkn+Kr/aGhU8DDkQQZNq4WacXe6K04v mlVXs5J7aSdNXQTl76cWBPXNOVEky3JjEeVrM6GeHlFvBQfPAihwLdNRmFrWIlzt6t7m yABiA02avZZu2ggPqSzHp0dgzt2rRrm2k/Dgq5hs6EJIAn2m0429jx6xvGeMOIZiMx9h rBWA== 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=weviMQvhLMvim56Xg85pFcP6On95DAWRwlNbv7gOqF4=; b=xJmr6kwXQvosaq/sVXvzHLvFON7pwQ6Ginnw8lLKhBhFSEwplfx76mVqKABuyhdySg 8R3y03RM4K6ea2pVP1/+/X5w/RlQPiZMNRmsLYl1hzAK6WnjnVpyXFNwl+ZNQuBHkD9A mSZ7DeBM8Fb71s7qo6aYVjS9p5I3Eb53HLzv+r9JoqYrbowbTlVekUVIFiDimj4FBIW0 ZgoxTiW7f7vDleCVdeN5z78q6XIoU5Q0VMJNKeTe3+5YD8WbHn09LPFQL2diDQN0xMmI LyCyI6+4Pid3SIhMhhHDLpODReYdussbuLTwn2dxFekIwSjHbsXeSJyZdqrkxS53ZhfR /LbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lgpL0a1N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h21si14018986jav.99.2021.05.31.07.11.37; Mon, 31 May 2021 07:11:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lgpL0a1N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S233299AbhEaOLA (ORCPT + 99 others); Mon, 31 May 2021 10:11:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:50924 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233040AbhEaNoc (ORCPT ); Mon, 31 May 2021 09:44:32 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 80AAE6157F; Mon, 31 May 2021 13:29:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622467766; bh=bCfVaSBRe4cJuB7KNIBXF7u/s95vfQ3MHXErI8CWNf8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lgpL0a1NUKUpgbThMqNTjFWwuR20vaANwbIeVHwFpj3mEciDwABHKY5TjBhgw0ANK 9RJEYzA2X4qMtfNnzzigAHKA2rnJ79m4yfWN0np+2i2M0GdGgvy5hKVGs86molttW0 rAxuEktYlRYgNA5giZrQqGGkVgmFSqRT8xW9Jd5E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Piotr Skajewski , Jesse Brandeburg , Mateusz Palczewski , Konrad Jankowski , Tony Nguyen , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 71/79] ixgbe: fix large MTU request from VF Date: Mon, 31 May 2021 15:14:56 +0200 Message-Id: <20210531130638.268043495@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130636.002722319@linuxfoundation.org> References: <20210531130636.002722319@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jesse Brandeburg [ Upstream commit 63e39d29b3da02e901349f6cd71159818a4737a6 ] Check that the MTU value requested by the VF is in the supported range of MTUs before attempting to set the VF large packet enable, otherwise reject the request. This also avoids unnecessary register updates in the case of the 82599 controller. Fixes: 872844ddb9e4 ("ixgbe: Enable jumbo frames support w/ SR-IOV") Co-developed-by: Piotr Skajewski Signed-off-by: Piotr Skajewski Signed-off-by: Jesse Brandeburg Co-developed-by: Mateusz Palczewski Signed-off-by: Mateusz Palczewski Tested-by: Konrad Jankowski Signed-off-by: Tony Nguyen Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c index 4904a63b83ef..7f3941752aa0 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c @@ -511,12 +511,16 @@ static int ixgbe_set_vf_vlan(struct ixgbe_adapter *adapter, int add, int vid, return err; } -static s32 ixgbe_set_vf_lpe(struct ixgbe_adapter *adapter, u32 *msgbuf, u32 vf) +static int ixgbe_set_vf_lpe(struct ixgbe_adapter *adapter, u32 max_frame, u32 vf) { struct ixgbe_hw *hw = &adapter->hw; - int max_frame = msgbuf[1]; u32 max_frs; + if (max_frame < ETH_MIN_MTU || max_frame > IXGBE_MAX_JUMBO_FRAME_SIZE) { + e_err(drv, "VF max_frame %d out of range\n", max_frame); + return -EINVAL; + } + /* * For 82599EB we have to keep all PFs and VFs operating with * the same max_frame value in order to avoid sending an oversize @@ -576,12 +580,6 @@ static s32 ixgbe_set_vf_lpe(struct ixgbe_adapter *adapter, u32 *msgbuf, u32 vf) } } - /* MTU < 68 is an error and causes problems on some kernels */ - if (max_frame > IXGBE_MAX_JUMBO_FRAME_SIZE) { - e_err(drv, "VF max_frame %d out of range\n", max_frame); - return -EINVAL; - } - /* pull current max frame size from hardware */ max_frs = IXGBE_READ_REG(hw, IXGBE_MAXFRS); max_frs &= IXGBE_MHADD_MFS_MASK; @@ -1248,7 +1246,7 @@ static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf) retval = ixgbe_set_vf_vlan_msg(adapter, msgbuf, vf); break; case IXGBE_VF_SET_LPE: - retval = ixgbe_set_vf_lpe(adapter, msgbuf, vf); + retval = ixgbe_set_vf_lpe(adapter, msgbuf[1], vf); break; case IXGBE_VF_SET_MACVLAN: retval = ixgbe_set_vf_macvlan_msg(adapter, msgbuf, vf); -- 2.30.2