From nobody Sat Feb 7 20:44:06 2026 Received: from davidv.dev (mail.davidv.dev [78.46.233.60]) (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 4AB4E6BFD7 for ; Thu, 8 Feb 2024 09:54:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.46.233.60 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707386051; cv=none; b=i768Mq3mZhJXO14F2kgNT8ElG6zRO8+moJ+X9p9kiaAZL0swQE9QSF0Kz369y+I+5IGTuHCn7a9qFIt63o3QDiV+84h8HF9p8GDm5zYMPZxhWFh09RhmQ4jdCcReAk7uUG3eIFOBKI7VcZYrpySIv0xAll+/6fBa4CLfiGfCO+8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707386051; c=relaxed/simple; bh=zquoTPDiDMopq79YAJN8pFBJInmPfdGsBn+pPQU1BdE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=f7LdLmtyj97PvMJGMQHqnnYM1w1wClRH0H3t0V/TcpRmPSPir6ZNzql6LPZAaxmdIriTjFRdmr+Y7wg+VcrTxCsjbJeshgioN9Y8ANeg1CpRfGy8kFi9wpDYbF5SN8zc9yN6n2hkdtiICCzpoo1KzfKKwUxQV5PtsJnLiHMO1Es= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=davidv.dev; spf=pass smtp.mailfrom=davidv.dev; arc=none smtp.client-ip=78.46.233.60 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=davidv.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=davidv.dev Received: from framework.labs by mail.davidv.dev (chasquid) with ESMTPSA tls TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 (over submission+TLS, TLS-1.2, envelope from "david@davidv.dev") ; Thu, 08 Feb 2024 10:54:06 +0100 From: David Ventura To: david@davidv.dev Cc: Jonathan Corbet , "David S. Miller" , David Ahern , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Greg Kroah-Hartman , "Paul E. McKenney" , Randy Dunlap , Xiongwei Song , linux-doc@vger.kernel.org (open list:DOCUMENTATION), linux-kernel@vger.kernel.org (open list), netdev@vger.kernel.org (open list:NETWORKING [IPv4/IPv6]) Subject: [PATCH v2 1/2] net: make driver settling time configurable Date: Thu, 8 Feb 2024 10:52:29 +0100 Message-Id: <20240208095358.251381-1-david@davidv.dev> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240208093722.246930-1-david@davidv.dev> References: <20240208093722.246930-1-david@davidv.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" During IP auto configuration, some drivers apparently need to wait a certain length of time to settle; as this is not true for all drivers, make this length of time configurable. Signed-off-by: David Ventura --- .../admin-guide/kernel-parameters.txt | 4 ++++ Documentation/admin-guide/nfs/nfsroot.rst | 3 +++ net/ipv4/ipconfig.c | 23 ++++++++++++++++--- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentatio= n/admin-guide/kernel-parameters.txt index b47940577c10..b07a035642fa 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -2291,6 +2291,10 @@ =20 ip=3D [IP_PNP] See Documentation/admin-guide/nfs/nfsroot.rst. + ip.dev_wait_ms=3D + [IP_PNP] + See Documentation/admin-guide/nfs/nfsroot.rst. + =20 ipcmni_extend [KNL,EARLY] Extend the maximum number of unique System V IPC identifiers from 32,768 to 16,777,216. diff --git a/Documentation/admin-guide/nfs/nfsroot.rst b/Documentation/admi= n-guide/nfs/nfsroot.rst index 135218f33394..f26f7a342af6 100644 --- a/Documentation/admin-guide/nfs/nfsroot.rst +++ b/Documentation/admin-guide/nfs/nfsroot.rst @@ -223,6 +223,9 @@ ip=3D::::::: + Set the number of milliseconds to delay after opening the network device + which will be autoconfigured. Defaults to 10 milliseconds. =20 nfsrootdebug This parameter enables debugging messages to appear in the kernel diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c index c56b6fe6f0d7..cbf35163b973 100644 --- a/net/ipv4/ipconfig.c +++ b/net/ipv4/ipconfig.c @@ -82,8 +82,6 @@ #define IPCONFIG_DYNAMIC #endif =20 -/* Define the friendly delay before and after opening net devices */ -#define CONF_POST_OPEN 10 /* After opening: 10 msecs */ =20 /* Define the timeout for waiting for a DHCP/BOOTP/RARP reply */ #define CONF_OPEN_RETRIES 2 /* (Re)open devices twice */ @@ -101,6 +99,7 @@ =20 /* Wait for carrier timeout default in seconds */ static unsigned int carrier_timeout =3D 120; +static unsigned int dev_wait_ms =3D 10; =20 /* * Public IP configuration @@ -1516,7 +1515,8 @@ static int __init ip_auto_config(void) return err; =20 /* Give drivers a chance to settle */ - msleep(CONF_POST_OPEN); + if(dev_wait_ms > 0) + msleep(dev_wait_ms); =20 /* * If the config information is insufficient (e.g., our IP address or @@ -1849,3 +1849,20 @@ static int __init set_carrier_timeout(char *str) return 1; } __setup("carrier_timeout=3D", set_carrier_timeout); + + +static int __init set_dev_wait_ms(char *str) +{ + ssize_t ret; + + if (!str) + return 0; + + ret =3D kstrtouint(str, 0, &dev_wait_ms); + if (ret) + return 0; + + return 1; +} + +__setup("ip.dev_wait_ms=3D", set_dev_wait_ms); --=20 2.39.2 From nobody Sat Feb 7 20:44:06 2026 Received: from davidv.dev (mail.davidv.dev [78.46.233.60]) (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 85CD56DCEA for ; Thu, 8 Feb 2024 10:03:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.46.233.60 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707386595; cv=none; b=S2hCSOB/FRrlRGmWSc6dyZ32VV3zu5bgLTL+AV4PByTOWWoqcf7ew/8noh/3P2O83WCwbc4F1UTnJkKfp6HNmUTxnyQcgAETyzpfTjgvheOwlbeaOOyGFs8sxNL1YuDFRbiHE/+uVquu+XKs3J3giGk0ytIPvhcfGdM8O0cn648= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707386595; c=relaxed/simple; bh=WTA+UDK0EaxEUPjb7YY9WTShoJNOU9Pzb4SP9T7Km8k=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=S6pDFM1RD9aF/WMJQjXqaTRjEihujuJvLqnhvRFUkuSxoXsOiQ1AskNp46FV2IK0UuUqgpQa8Ji3fgi7mKZ4IvSFvZn0naAiPIMsDhnsdxnEb8hCa7pxgGkutnLlK+bzGvJSzawnKuhNZYc6gyzx4QrTtRWqsh6k3A7UzedTtBg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=davidv.dev; spf=pass smtp.mailfrom=davidv.dev; arc=none smtp.client-ip=78.46.233.60 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=davidv.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=davidv.dev Received: from framework.labs by mail.davidv.dev (chasquid) with ESMTPSA tls TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 (over submission+TLS, TLS-1.2, envelope from "david@davidv.dev") ; Thu, 08 Feb 2024 11:03:11 +0100 From: David Ventura To: david@davidv.dev Cc: Jonathan Corbet , "David S. Miller" , David Ahern , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v2 2/2] net: Change default delay on IP autoconfig to 0ms Date: Thu, 8 Feb 2024 11:03:04 +0100 Message-Id: <20240208100304.253337-1-david@davidv.dev> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240208093722.246930-1-david@davidv.dev> References: <20240208093722.246930-1-david@davidv.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Reduce the default settle time from 10ms to 0ms, based on previous discussi= ons ( https://lore.kernel.org/netdev/1305696161-18277-1-git-send-email-micha@neli= .hopto.org/t/ https://lore.kernel.org/netdev/580001e3-17ef-4f24-8fd8-bc14110e874e@lunn.ch/ ) ARP and DHCP retries are expected to handle any lost transmissions. This patch depends on 1f0aa0c947eeb4edb60add141a5bc2309f2dc8dd (" net: make driver settling time configurable"). Signed-off-by: David Ventura --- Documentation/admin-guide/nfs/nfsroot.rst | 2 +- net/ipv4/ipconfig.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/admin-guide/nfs/nfsroot.rst b/Documentation/admi= n-guide/nfs/nfsroot.rst index f26f7a342af6..fce610a4ec54 100644 --- a/Documentation/admin-guide/nfs/nfsroot.rst +++ b/Documentation/admin-guide/nfs/nfsroot.rst @@ -225,7 +225,7 @@ ip=3D::::::: Set the number of milliseconds to delay after opening the network device - which will be autoconfigured. Defaults to 10 milliseconds. + which will be autoconfigured. Defaults to 0 milliseconds. =20 nfsrootdebug This parameter enables debugging messages to appear in the kernel diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c index cbf35163b973..8b7d08649b09 100644 --- a/net/ipv4/ipconfig.c +++ b/net/ipv4/ipconfig.c @@ -99,7 +99,7 @@ =20 /* Wait for carrier timeout default in seconds */ static unsigned int carrier_timeout =3D 120; -static unsigned int dev_wait_ms =3D 10; +static unsigned int dev_wait_ms =3D 0; =20 /* * Public IP configuration --=20 2.39.2