Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2751529pxj; Mon, 31 May 2021 09:50:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgX1ed/DcuI+IzgVL/7RcyFM4Jvf4cz196P4Rt604TH1tPTLp5H6htDeE+SCDuCXpiI3o+ X-Received: by 2002:a05:6402:1153:: with SMTP id g19mr26340344edw.179.1622479806145; Mon, 31 May 2021 09:50:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622479806; cv=none; d=google.com; s=arc-20160816; b=RWhPrfaXJ2fQq5KTYsitq6bEcy7x1Zs1em6aBVKbdGxv57TlWo8WQCyUUaAFqM3nRe aKoz5HUTJjmAq6iRC0HoqhtZhJhAkJT4FrAIWK6ffr1mrhNMuq+yJ9Q47KbRKqIEvtBB 2Ygn5xy6qptsa4ilkZ7bjZv+4RkicmYX361/6SdvYkjWzK9eN1+z2sJFL0/KVvDMcKvN CY+zwAlImwl5p0TnpWv3mn2iC4UPiSKt0YOYKSqE/iNlsV/y00lfPxCASAv+8G/goE7x vmlll4xD89XWhAniK3LZ1mJzRRCmPWdGgAE7Dgl1/QmJ6GjeMoEycIWpmHrx4XL/4Orh OFZw== 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=wOBKUpUy/kvU3NNyRJsWdpEt46qUuSWvX3SDfhQuh9Q=; b=inKpW9w5EfDzJVLAlhLmIgA0y/CNFAdyfNIyX9ytEXtrv7pHhhk9hG0eSUCPGj3EJq T3qabHKomckgFvZKLQ64Sz0G4cTSqwPGMcWb/Rnrd+XZ6xs/trkLmN6kME/p/OE2FXp8 hZiTZq7SJdj3dElvn6RdUs7hgUoBXoTb6L6vkarmtCzWyFxZWJYFUbf+vwP+O6eQVKCG r/6pf6b6CQdVGzcgNREbGDRYIhSLcPJpCFarSFS6IzQlJRlT1TeewZr88okUxAJNVy0x gK0LoPRho3VkEHezChB2R4yES2T1DgJTcAdTbk+kM6E/qOJlbJAU0ih+3M3kInWphcfN WnwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yC7Pi0Rj; 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 w11si6221793ejq.499.2021.05.31.09.49.43; Mon, 31 May 2021 09:50:06 -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=yC7Pi0Rj; 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 S232385AbhEaQuY (ORCPT + 99 others); Mon, 31 May 2021 12:50:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:51050 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233513AbhEaO5U (ORCPT ); Mon, 31 May 2021 10:57:20 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B829761CBE; Mon, 31 May 2021 14:00:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622469631; bh=gb0fZDAFLB83BRTjYZSk5VklBhYcGwo5BpT1E0lkT0Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yC7Pi0RjJkLQ/PnsY4M9GTUZ0wGgo100Twu3aBLNhvWT82IP9DLzw12mXzu/71gaD i9ZNoV43GTZ9Qf1bUBssVKeSK1VpkK6F3A0og06F9zao67foZ5z/KtLnfI+D+rhB1H 3oW9IeMPh0B+G6Mjki8lplLZPKeiJSwYtfqqz8u4= 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 5.12 271/296] ixgbe: fix large MTU request from VF Date: Mon, 31 May 2021 15:15:26 +0200 Message-Id: <20210531130712.857655325@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130703.762129381@linuxfoundation.org> References: <20210531130703.762129381@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 988db46bff0e..214a38de3f41 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c @@ -467,12 +467,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 @@ -533,12 +537,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; @@ -1249,7 +1247,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