Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp396803lqt; Mon, 18 Mar 2024 10:52:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUY74L9C9kcL8XIiDCnGqk4JRorZHeqlC1ttisPiRsRlprFT6SkT6Hynd3k2exF8Xtd7imTlrGjgLHUOKKQp6el9jMnhrXTqVDTro2ASw== X-Google-Smtp-Source: AGHT+IG5b3YSxHtJWqccQ0MTdvHXSheo8hrA0zboC1pUSQRlTdy7UObUpDSBrk5ZB0V6h4/PanSt X-Received: by 2002:a2e:9e43:0:b0:2d4:a20f:299f with SMTP id g3-20020a2e9e43000000b002d4a20f299fmr4093409ljk.35.1710784319996; Mon, 18 Mar 2024 10:51:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710784319; cv=pass; d=google.com; s=arc-20160816; b=l0BxvoJXJ4SqVCYXb6xMEZMPvZJikSgm56qer160uNbPfOpjRb2WH6dS5AfDHUZkq2 e9bAa70Ecv/K0DOOVOx4KHPIvFnOZI03HPcfXp0+brllctrAgIbGgyQgpbAc5p2fa+A9 C4YDce53CQ+INuFEmMFcxbzGdS0W1sUo/kwL+zBh2UjPGPismYZJQLDI41eFVouXQCkk kQhP3smrODFTbytjnWgewCs/Tngcom3CvOHyRPUrHmqJ5ghWU8asoP1hYJrHgBam5f8z Hw3CJCYX6G8fJ4ekMCnU2hPtsm4SXotgxf9obPPQMhvOLmTNjQQ16kJpquv+yZgP2Aoj g0sw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=SDubdJQb9S5xrG6JQ6lzVQjoThoj9QRF2ZFHFATteFg=; fh=KzhvT+l9yRMS4Gi5u/Zy0nV126wPeziFZ/NaUz2xAh0=; b=dlg6C1CGo0HjEtScLJ7VJwPFw43uew2EQzJCoscd17cWDSa2OFpL/9lmKngpFnO/eJ PCdEeCLcR5f2izsoX819qun221dqZL966AGRUjs8H32XjqHzj3SATOq+x7cSZ04lfnOr btm2YTjbubRf00AF/V2hIh22+wlN9VPnzY/EC4obYwsIQdqoOvwFfwZyCpKG6jcT+Nn6 wynQ57VpYpDpGXHoRBtXcQzoK/8kaOxPdxzfxLlH6hUqLe/zecVerlBrZiBZVyOKlxQI mvViV8u+ijQ1q0+QjVlBBDIH8Aqu2uYiVQpVUBVF9lgLLJnifLeop4tbV+I+oqX2lL1f uNIg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WWaNDbWT; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-106477-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106477-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id hg15-20020a170906f34f00b00a45fefe5915si612414ejb.899.2024.03.18.10.51.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 10:51:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-106477-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WWaNDbWT; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-106477-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106477-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 2774C1F218D7 for ; Mon, 18 Mar 2024 17:45:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 00DE055C3C; Mon, 18 Mar 2024 17:45:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WWaNDbWT" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2270D55C14; Mon, 18 Mar 2024 17:45:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710783909; cv=none; b=PXAUB3C5X5uxHSdK7qWU8uaIsLu2ZZjrsih98upGw21BPAzfDngPsgtYSvdjWmSNva43tfvExIfMTWv/m6uV4ilTt/SejXQJznWYIar+WWhYXaQfsYu1u9f6eBjPNmbaDhV1w5w3/hp/FmFB4YlrZ1q96PeJuZHWTX63WQvzsU8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710783909; c=relaxed/simple; bh=Rv/2CA5wPLokC7VCqSey3DSFL6DXzXxuAMNj1og1Kh8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=htG0RGqTwPjeT1VPB8uWvApYDKrkj47FD134YOuHyH/6DJAQ9PJwhKITacf/ZVXI6VHKIlw4NupePjbPVFPNcLKucN5Z90xx0Pbp4UEE30uK3lTrLIHpgl9smWNVXxDf4m+tiTyodHZsLnswJ9pXfcfMKmKHpZuMCfrpS9nsJjY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WWaNDbWT; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5570FC433C7; Mon, 18 Mar 2024 17:45:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710783908; bh=Rv/2CA5wPLokC7VCqSey3DSFL6DXzXxuAMNj1og1Kh8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WWaNDbWTEAAmKf9IeOXu65Mq96lSZxdoIzl57Yufwp7sGduxsN9HEXIrYzX7xVFRB Hy1mtA1Are4jKEG2IACOEirgKrPxv9Zs1dp7fdnMC0bfOtcyEQQneb+Sq2IR+LNeuJ Qm4PaSYyJSYzEW1PyUQ3GA1oW4uCUo9cP2Kl9ZFUVbePgoZjMoBtm4yIL6lG3iI5Y6 Ap2yMBGMzoB+Ep1+VDrr0mYHjUf9hszzwqUb9eC2syA33HpPQrMK2u0+nfb9oVk6BT M0dwO4pTylvIrS88SdlZVkZ9B3ZjCplzmiIWt/w24KRM8YTMndNRvb32gsfsIG37Lt rRb95s82iaBfg== Date: Mon, 18 Mar 2024 17:45:03 +0000 From: Simon Horman To: Erwan Velu Cc: Erwan Velu , Jesse Brandeburg , Tony Nguyen , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 iwl-net] i40e: Prevent setting MTU if greater than MFS Message-ID: <20240318174503.GE1623@kernel.org> References: <20240313090719.33627-2-e.velu@criteo.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240313090719.33627-2-e.velu@criteo.com> On Wed, Mar 13, 2024 at 10:07:16AM +0100, Erwan Velu wrote: > Commit 6871a7de705 ("[intelxl] Use admin queue to set port MAC address > and maximum frame size") from iPXE project set the MFS to 0x600 = 1536. > See https://github.com/ipxe/ipxe/commit/6871a7de705 > > At boot time the i40e driver complains about it with > the following message but continues. > > MFS for port 1 has been set below the default: 600 > > If the MTU size is increased, the driver accepts it but large packets will > not be processed by the firmware generating tx_errors. The issue is pretty > silent for users. i.e doing TCP in such context will generates lots of > retransmissions until the proper window size (below 1500) will be used. > > To fix this case, it would have been ideal to increase the MFS, > via i40e_aqc_opc_set_mac_config, incoming patch will take care of it. > > At least, commit prevents setting up an MTU greater than the current MFS. > It will avoid being in the position of having an MTU set to 9000 on the > netdev with a firmware refusing packets larger than 1536. > > A typical trace looks like: > [ 377.548696] i40e 0000:5d:00.0 eno5: Error changing mtu to 9000, Max is 1500. MFS is too small. > Hi Erwan, all, As a fix, I think this patch warrants a fixes tag. Perhaps this one is appropriate? Fixes: 41c445ff0f48 ("i40e: main driver core") > Signed-off-by: Erwan Velu > --- > drivers/net/ethernet/intel/i40e/i40e_main.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c > index f86578857e8a..85ecf2f3de18 100644 > --- a/drivers/net/ethernet/intel/i40e/i40e_main.c > +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c > @@ -2946,7 +2946,7 @@ static int i40e_change_mtu(struct net_device *netdev, int new_mtu) > struct i40e_netdev_priv *np = netdev_priv(netdev); > struct i40e_vsi *vsi = np->vsi; > struct i40e_pf *pf = vsi->back; > - int frame_size; > + int frame_size, mfs, max_mtu; > > frame_size = i40e_max_vsi_frame_size(vsi, vsi->xdp_prog); > if (new_mtu > frame_size - I40E_PACKET_HDR_PAD) { I am fine with this patch, so please take what follows as a suggestion for improvement, possibly as a follow-up. Not as a hard requirement from my side. The part of this function between the two hunks of this patch is: netdev_err(netdev, "Error changing mtu to %d, Max is %d\n", new_mtu, frame_size - I40E_PACKET_HDR_PAD); My reading is that with this patch two different limits are checked wrt maximum MTU size: 1. A VSI level limit, which relates to RX buffer size 2. A PHY level limit that relates to the MFS That seems fine to me. But the log message for 1 (above) does not seem particularly informative wrt which limit has been exceeded. > @@ -2955,6 +2955,14 @@ static int i40e_change_mtu(struct net_device *netdev, int new_mtu) > return -EINVAL; > } > > + mfs = pf->hw.phy.link_info.max_frame_size; > + max_mtu = mfs - I40E_PACKET_HDR_PAD; > + if (new_mtu > max_mtu) { > + netdev_err(netdev, "Error changing mtu to %d, Max is %d. MFS is too small.\n", > + new_mtu, max_mtu); > + return -EINVAL; > + } > + > netdev_dbg(netdev, "changing MTU from %d to %d\n", > netdev->mtu, new_mtu); > netdev->mtu = new_mtu; > -- > 2.44.0 > >