Message ID | 20240227192704.376176-1-e.velu@criteo.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-83927-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2934985dyb; Tue, 27 Feb 2024 12:03:08 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVA27ONziTSW9Eo9K7ebAR/ikO1K0H2cy/VdpCVhCi2LjZ91kXLWlQ8zJ8R0WJPNc6v+wXvOQzyrlC0Gzd4eq2VhDZF7g== X-Google-Smtp-Source: AGHT+IFTpxBPpeWXNbe+Xmyj6fFQ2PQz2COAQqlcCR6lKxEbV7b8Kk8TMKij6gVxCBcduCvsJYoO X-Received: by 2002:a17:90a:7e18:b0:299:e9ca:c497 with SMTP id i24-20020a17090a7e1800b00299e9cac497mr9343259pjl.4.1709064188391; Tue, 27 Feb 2024 12:03:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709064188; cv=pass; d=google.com; s=arc-20160816; b=TOGzPHT49Q63VaYKEueyMHZvJohbs1Ynep5NsSKowup+tKR+6HyVN1mKeDLD3+e/rl kNGouS/3J/sD+qxEqLouWnvViOpaRiZe24xD63i67QQJNp1yYKu5lzDS6ijpn42vJHZt mMU79z0LLhT6aifejncMZhapk5VqM7yDhUAZogRHrFR+47PuKLstOjyMGPyuRy6TXNgL AQC5yVqO+H15NJcJb+LlTKpt61Kz5To9jKVRM0WHbcyP65F4Bh2ovGs+QJWTGCSmBRsU WkwobanRrKib4Y4D7smV8uJJg3HCISb5MpY2odhnAXt8HPHDJb/TghfNirGvF9PDa3HN R9IA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=TtO7eARrOzPr4vplwQY3fP3qCNMybXHa66yqZyCEb6A=; fh=/BJ63ygO1CFNc415VD5VtKZxMn0+G4R57X2diGUQR+A=; b=Uiz0qmqqs0Kj/OdIuBFOBbiiMxkgfNiGA4l6tHvTNOJEKQNlVibn5JtrTjDRvcOw93 mmiuEtKW/r+GWAGqrxgtG9Kb/Xk/p33CT7G1yMqoiOfDGcF38fd+9eyvzQUun3lXQXt4 ug7klqt+SRfzF5MuhWfx0Q6gvj2D0QY2VrfsQ3f7fFbHDmt8Fv2/fBnYBI/x+H37BBtl OhzOHkrM2HSXqPEUXvKC1Cb3l4zvJUyOXoxB0rkZAyQvrY0b9pVTkZYaqrEaUsI/Eq/f 9uCFgo/6kcbwF//BIq33+2emu1lqF6d5btB0H/Gr2JnsSym0ty47MsFumYlf4betB8En UZvg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=dDQ5mKyR; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-83927-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83927-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id z1-20020a17090a6d0100b00296a76aa707si7767014pjj.185.2024.02.27.12.03.07 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 12:03:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-83927-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=dDQ5mKyR; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-83927-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83927-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 79F6CB3504F for <ouuuleilei@gmail.com>; Tue, 27 Feb 2024 19:28:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F19E9524B2; Tue, 27 Feb 2024 19:27:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dDQ5mKyR" Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AE2A550A68; Tue, 27 Feb 2024 19:27:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709062049; cv=none; b=fqaz4cEnDwvR/Z6saQb/gqlVI386QQEGIk0XowBdGYmX6Ys2TvXTrtdvUZr8RsUg96MqSzI9sxrOvErz94lT77c9qrp7V8hNzWiwlIczgcu3frno5qVQ/00R4RV5sKnwayORZriSID/1CzU2bKCGxV8VrJDdgIm4d2O8EUooIfs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709062049; c=relaxed/simple; bh=EqsLvIImce7QGWkPVEQZAZcNWfJbExoKdrSW+vror8c=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=e2DYb0To+T/+xdctYkj5vZa1Ppn2edKhGXvQ11px2OF9I8/0q7fmifgqgGya6g54EdfSM2MkciUJwpgI/tZjZA9ZRioEA0ok28EwJArFB+rTlrQOrR+YkGuhZdisHOdt+fROdSxb0G5ywaaWHLFp+S7YkhUULqEPF/Q5nmFhLPU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=dDQ5mKyR; arc=none smtp.client-ip=209.85.208.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-f181.google.com with SMTP id 38308e7fff4ca-2d24a727f78so65338721fa.0; Tue, 27 Feb 2024 11:27:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709062046; x=1709666846; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=TtO7eARrOzPr4vplwQY3fP3qCNMybXHa66yqZyCEb6A=; b=dDQ5mKyRHvcyuxVTS8EFyP0R4e7CBDNndQY6vylahFARkJ5BNG8TrV1AufUD+JOg0w 3Lk02g84xvq+Q3wREeKIdpL/nzYAeYKItNpvtvSCdObpQBy7q1Aq6WNL/BBVQbfhRSWu 0DyxiwsDKvm5vlpmkcnFBPuHtqFxEikA+nsWISDpaSWC9odYaRaTyzMI+/LW0yojZ6AJ X+YXS2ugsVDlIu0hinZZ5hWotMq2WOMmD3o0jQ+hW0hURxIiPH2A5GKz0rYZ7lD+xPh2 tdP7hl4PgS24L8MOhVAPHg7AfD6evTprkuKBxYgl5DQg7UppnurAJAo8Of5sBEUeH4OC ZyRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709062046; x=1709666846; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=TtO7eARrOzPr4vplwQY3fP3qCNMybXHa66yqZyCEb6A=; b=ll3Ctk14q0MPDBPLxPbnpbErHn4COBsggNUSLOkIGCpCHpKHEkHciRaDPLbKjS2pgb F59b09Q2dz+O8llPMinPC7OVXUhVt/UNZuTC9qi9movt0GA/3KOMVp9u7M7F/JeGLV9K JzdQD01tq8xTHe/U3/EXS23PyoU1STwdaOBZ1abxLDmIt+f/KLBb+NWsjg07MCl9Ne8g n/wL81f/4XZFdIC6FdHk2UeDbL2V0gOPovlketYZI9OvoG2Kc1I2uZGRq1XXXj9RFtop DsJlQh1CRIJpf5vdMEQ4wmKR9K4oYRPsTnZpQpYVUfwkFyI53YfK75pW2ygyxVQFsTVx 1Maw== X-Forwarded-Encrypted: i=1; AJvYcCX2b0AyPoQe60LBnxAzT+XhH34XMv0LTLDGZRqQDoDZXJOKU0M6RLEpksG46CWgXCWFpeOGdbZ7Z1hj4xOPMIFGpXSpM3XIfrx9F6Q16ntT7TmdeiewkSaCp/UJ2HV3e1FbrX/u X-Gm-Message-State: AOJu0YxkT76gVq1EqCV3HLQmI3U/em1IlYeXP5USxHwYb+aiY6CRWiCR XvGWIp+falbboM4xYRl0RJvLNCbmRrMDC/OMqYZQJDTjoDIK2FhC2XKE4qKAxqM= X-Received: by 2002:a2e:7315:0:b0:2d2:2eb7:9ab3 with SMTP id o21-20020a2e7315000000b002d22eb79ab3mr6912091ljc.32.1709062045563; Tue, 27 Feb 2024 11:27:25 -0800 (PST) Received: from macminim1.retailmedia.com ([2a01:e0a:b14:c1f0:617b:c61e:d65f:861e]) by smtp.googlemail.com with ESMTPSA id 18-20020a05600c025200b00412abfb0ed0sm2915784wmj.0.2024.02.27.11.27.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 11:27:24 -0800 (PST) From: Erwan Velu <erwanaliasr1@gmail.com> X-Google-Original-From: Erwan Velu <e.velu@criteo.com> To: Cc: erwanaliasr1@gmail.com, Erwan Velu <e.velu@criteo.com>, Jesse Brandeburg <jesse.brandeburg@intel.com>, Tony Nguyen <anthony.l.nguyen@intel.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] i40e: Prevent setting MTU if greater than MFS Date: Tue, 27 Feb 2024 20:27:03 +0100 Message-ID: <20240227192704.376176-1-e.velu@criteo.com> X-Mailer: git-send-email 2.43.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792083689925357292 X-GMAIL-MSGID: 1792083689925357292 |
Series |
i40e: Prevent setting MTU if greater than MFS
|
|
Commit Message
Erwan Velu
Feb. 27, 2024, 7:27 p.m. UTC
Commit 6871a7de705b6f6a4046f0d19da9bcd689c3bc8e from iPXE project is
setting the MFS to 0x600 = 1536.
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 accept 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, but I didn't found a reliable way to do 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.
A typical trace looks like the following :
[ 377.548696] i40e 0000:5d:00.0 eno5: Error changing mtu to 9000 which is greater than the current mfs: 1536
Signed-off-by: Erwan Velu <e.velu@criteo.com>
---
drivers/net/ethernet/intel/i40e/i40e_main.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
Comments
Tue, Feb 27, 2024 at 08:27:03PM CET, erwanaliasr1@gmail.com wrote: >Commit 6871a7de705b6f6a4046f0d19da9bcd689c3bc8e from iPXE project is >setting the MFS to 0x600 = 1536. > >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 accept 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, but I didn't found a reliable way to do 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. > >A typical trace looks like the following : >[ 377.548696] i40e 0000:5d:00.0 eno5: Error changing mtu to 9000 which is greater than the current mfs: 1536 > >Signed-off-by: Erwan Velu <e.velu@criteo.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Next time, could you please indicate the target tree in the patch subject prefix, like this: "[patch net-next] xxx" ? >--- > drivers/net/ethernet/intel/i40e/i40e_main.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > >diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c >index 54eb55464e31..14fc70d854d3 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; > > frame_size = i40e_max_vsi_frame_size(vsi, vsi->xdp_prog); > if (new_mtu > frame_size - I40E_PACKET_HDR_PAD) { >@@ -2959,6 +2959,13 @@ static int i40e_change_mtu(struct net_device *netdev, int new_mtu) > return -EINVAL; > } > >+ mfs = pf->hw.phy.link_info.max_frame_size; >+ if (new_mtu > mfs) { >+ netdev_err(netdev, "Error changing mtu to %d which is greater than the current mfs: %d\n", >+ new_mtu, mfs); >+ return -EINVAL; >+ } >+ > netdev_dbg(netdev, "changing MTU from %d to %d\n", > netdev->mtu, new_mtu); > netdev->mtu = new_mtu; >-- >2.43.2 > >
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index 54eb55464e31..14fc70d854d3 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; frame_size = i40e_max_vsi_frame_size(vsi, vsi->xdp_prog); if (new_mtu > frame_size - I40E_PACKET_HDR_PAD) { @@ -2959,6 +2959,13 @@ static int i40e_change_mtu(struct net_device *netdev, int new_mtu) return -EINVAL; } + mfs = pf->hw.phy.link_info.max_frame_size; + if (new_mtu > mfs) { + netdev_err(netdev, "Error changing mtu to %d which is greater than the current mfs: %d\n", + new_mtu, mfs); + return -EINVAL; + } + netdev_dbg(netdev, "changing MTU from %d to %d\n", netdev->mtu, new_mtu); netdev->mtu = new_mtu;