Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp945425lql; Tue, 12 Mar 2024 02:50:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWBHq563WAoxhUwkYIBWwH2RFyEyaXCgHwy4zJ4Aj3ulSTieQhFf4JdJTpeOPVSwrfU2WnR1tAbJoQ5qPejwQZ1qN5e8fdN3sYSd8Mc0A== X-Google-Smtp-Source: AGHT+IHrNTSMyXlq6dsbdzO4EWnlK8Ckl9LlvSaCyB5toW1hwdzXUGnVN6GvpwwM9/B1noS7I03I X-Received: by 2002:a17:907:9454:b0:a46:28d4:d94e with SMTP id dl20-20020a170907945400b00a4628d4d94emr3858251ejc.52.1710237040089; Tue, 12 Mar 2024 02:50:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710237040; cv=pass; d=google.com; s=arc-20160816; b=oOXiQ1ZJpRnmgsk5R/Ro3OGK4Bcm/+vqJNyBqn4ofFYjSFiF5gh6wWPBH4MD57+K3i /8mAXars2plLkGEGxT5BxbXj2YtoVIJn/rh3T4lqXE42FlSNtMdUvrKxHtZzTjoVB3oD uLi5+ODGiWbGMzx235/BEnN0S0cfTICNcjqpOeA7m7nFxGj5z9Nmbzp2FDIfOHVA7DKE cMmxGsHKBbZ5NColCfqe5YxLGmgoe3XiQwM3UuBbPeBmyRR36IEEDXNI57I5wH6CKq3E hyw/w8lawvy9FOWd8BlZkKXlZu+Vwht4Ocoejt9nC9bSil/tic6JmAxr3B7pXXdAywam J1zw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=QF8rrlwvoyakQvzCc2tDUQMNvfXPsszRq9UKpEfDyVo=; fh=yXzmQ+WqmVkorIkONMwri+XRZIcnYNL7YQgUOsuMGYM=; b=BxY9nhMA6/SnFn69Q/ZwH1B+L4yZ7td1wSi1s3A+lZD+jItDGUtptKoHyZ4uXS3s7S 7W27tdVEaiTZDlZAwbxAPU5kskzkxIo305fLZkH+kOQETcObHCRsLkTZuFOaF7zhql9g flBk+yKa4fKujsfB4lC66DEjoLCMIwh3YGJVGYPa7RYlxZfGOii6jtvoo1C9EhJjwb4p bghnWuQhfObHeE9rpD/a/5/EZhyczeFGm2oC4RC7kaBMI5t1Z0Tt/E6vpBAFN+wRRKAP YLvWDWXdE7yTzMxpwH5a+m+cUw0kLLOF0VA/pbPagW8Aqlfe+Y0sStt6jXUb+fG/7R/B /BLQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=molgen.mpg.de); spf=pass (google.com: domain of linux-kernel+bounces-100068-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-100068-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id k7-20020a170906128700b00a43ffa272b2si3107822ejb.402.2024.03.12.02.50.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 02:50:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-100068-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=molgen.mpg.de); spf=pass (google.com: domain of linux-kernel+bounces-100068-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-100068-linux.lists.archive=gmail.com@vger.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 CD93A1F23137 for ; Tue, 12 Mar 2024 09:50:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 157D979B9B; Tue, 12 Mar 2024 09:49:10 +0000 (UTC) Received: from mx3.molgen.mpg.de (mx3.molgen.mpg.de [141.14.17.11]) (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 6583778662; Tue, 12 Mar 2024 09:49:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=141.14.17.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710236949; cv=none; b=Rtm8MPDJmfW07gq3mux8+iZuretpjyvuGlwsEat4Q7pcDnuuMW8P1FXT//4Kwf3e9OBNhgUpFCUR54UStfG79BDiUGfytytubc4LRWzy5MosWRKE3ZrkGS3AGmyrvcvAd4V+W271m9qu9jAPkOTSuUSKe5NBjSnQkvcP88wtmsM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710236949; c=relaxed/simple; bh=WP4DY2eQ60OFoSajZjswjdTowx4ulBVDMnVbWSofK3M=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=JIdfmXqC9go76fZKvsUibOFSMpaSR0RZZsAYvlvVDYOJhW4AChxS89SH9UwOQgMkbFksnK2hdi8I8wn8HfPjxu35IEsY5G3lBAIRmG+pk3VC0IBQGMIbdr0qA7XUJ/rFhUJWAjXPnaw+9TAI38iPK93fMeaHBvxCnSdZZYt8ZW8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=molgen.mpg.de; spf=pass smtp.mailfrom=molgen.mpg.de; arc=none smtp.client-ip=141.14.17.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=molgen.mpg.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=molgen.mpg.de Received: from [141.14.220.34] (g34.guest.molgen.mpg.de [141.14.220.34]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: pmenzel) by mx.molgen.mpg.de (Postfix) with ESMTPSA id CAA1261E5FE36; Tue, 12 Mar 2024 10:48:20 +0100 (CET) Message-ID: Date: Tue, 12 Mar 2024 10:48:19 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [Intel-wired-lan] [PATCH v3] i40e: Prevent setting MTU if greater than MFS Content-Language: en-US To: Erwan Velu Cc: Erwan Velu , linux-kernel@vger.kernel.org, Eric Dumazet , netdev@vger.kernel.org, Tony Nguyen , intel-wired-lan@lists.osuosl.org, Jakub Kicinski , Paolo Abeni , "David S. Miller" References: <20240312094259.770554-1-e.velu@criteo.com> From: Paul Menzel In-Reply-To: <20240312094259.770554-1-e.velu@criteo.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Dear Erwan, Thank you very umch for your patch. Am 12.03.24 um 10:42 schrieb Erwan Velu: > Commit 6871a7de705b6f6a4046f0d19da9bcd689c3bc8e from iPXE project is > setting the MFS to 0x600 = 1536. Please add a link, as most people do not have the iPXE archive checked out. Maybe also add the commit message summary. > 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 Hmm, but 1536 > 600. So the log message is incorrect? > If the MTU size is increased, the driver accept it but large packets will not accept*s* > 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, this 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. Maybe add the new log message. One last formal nit: Please use a line length limit of 75 characters per line. > 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 89a3401d20ab..225b2fd0449e 100644 > --- a/drivers/net/ethernet/intel/i40e/i40e_main.c > +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c > @@ -2950,7 +2950,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) { > @@ -2959,6 +2959,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); The other log messages capitalize MTU. > + return -EINVAL; > + } > + > netdev_dbg(netdev, "changing MTU from %d to %d\n", > netdev->mtu, new_mtu); > netdev->mtu = new_mtu; The rest looks reasonable. Kind regards, Paul