Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2149029rbb; Tue, 27 Feb 2024 12:09:32 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXBMvmBCBL1EOL9EL//o9Gnhj5bFwgj5bngffBTxnS6MoRefN/6UitFUA5fY11v5eHCdcE5+xMZ57zat0drl5Lsse3kSgr/+ye9kT3DcQ== X-Google-Smtp-Source: AGHT+IHaQqG9KcBpuW4O0nZZga0lg4sG6EVWqFVTeX0764qds63iCaI82k2oYCDiQfIcj6C91UNU X-Received: by 2002:a17:903:22ca:b0:1dc:b7d2:3fc3 with SMTP id y10-20020a17090322ca00b001dcb7d23fc3mr3789117plg.68.1709064572182; Tue, 27 Feb 2024 12:09:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709064572; cv=pass; d=google.com; s=arc-20160816; b=nfwH0hYpDckHJThLeA4MNpO/4HK1l1MEHa12fU5xhu8bdHUAVJbBAnoqECNLvyPHXL aBVK/Q7hPx+vVKEosBTef962XU+ag7LIWENy+Bet5bD58cIXXB4NqnKoxOjBfZi/vleB c+6KB4tfUaWXdcN2xJeOGr0Sofmj/ra8//7Uh4QMnSYwbUDXkol+ZwTvEt+fImpbmf5t Wr3s6jCIXmOLJneSlBP6Oo8FsdiOV4+/JKPEVDXJVdV/GuBXTNZrfE86NA/szIfXewig fC0WdSLtRXyUs2GzopvLsjm2JNA2R+K5VKyHe52gfjQjU4pRHTMlzuw9HsONYm2AKpTJ vc2w== 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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83927-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id p12-20020a1709028a8c00b001d9f4d7b31esi1770801plo.508.2024.02.27.12.09.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 12:09:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-83927-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83927-linux.lists.archive=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 2680DB34E5D for ; Tue, 27 Feb 2024 19:27:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2CD771487E2; Tue, 27 Feb 2024 19:27:30 +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 X-Google-Original-From: Erwan Velu To: Cc: erwanaliasr1@gmail.com, 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: [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: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- 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