Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp390512rdb; Thu, 8 Feb 2024 08:44:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IEjp6r0w9LhnSHy03OEOGN9i7uMObKgUqQ6BgczfvPQlg2/AEu+cV6rGY+PHg/13nzCRmF4 X-Received: by 2002:a05:6214:319d:b0:68c:a8df:37e1 with SMTP id lb29-20020a056214319d00b0068ca8df37e1mr5458090qvb.4.1707410673995; Thu, 08 Feb 2024 08:44:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707410673; cv=pass; d=google.com; s=arc-20160816; b=PAx8LX3wM9VzSAAgckeS/BKSSo+oPDMIBeNN7E4M+VOAoTtf8vvguVQwQdGGj2AFza jVU4RrkNboGm14/x7rLakpM6dned4mPGxXV0UbCnZtWGknjSJMOlMZz8usXV3q2KJHLt CXb7Qp+eiqk1x0kUF9vBT0zSgSKafawRtWWLaYLw8DzalatvsjFBb2BdGz4Q5uXBYLLF qo9RfXqTILXHO3JXChcuUOmEr2gDUT17YB5Ia1qwQ9nizt7SykPmFhjdh1b0uu3OdYs5 FZPdOtw2dvJmHnUEIzX9KLvDroe4hRnJfpd4fb/NrpupC1SZjoX9U55pEfdb5TjHoGbz caEQ== 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=Wn502LoD7F1dpmNi/WtQ8XvykfQEkruqXGCXd0h/vWc=; fh=MtV2+4ISmMSO37l7LDI+vLWWBsQTSDX6BpXkGKMi1ig=; b=e9vS6y4UlrNV1A5l/NCB2wtlJKKY+V/9E69myxzbvRLySdv3MfL9IXn731yvzk2X/h qnn1ils5GVsw0AP0F9/xRYNNO8QhXFZX7coeh9BvChDM5CqqIqB/bUTt+Y3CZotzwAtK Yu4WsmhBfYT/S2t0kQEM2OfaPS/vQB0swi4uLckJlzHB4YUhioumMUNVuiEdN8GLoOTG y0IlEeg6B25Dl2yqiHTdlmFgNjV9yvWAZ0p7qov0fwF6yAtEN+Iro1SxCysl/nVnUu1a rJY555D5baVWnJRV/GUJ2Cq3qyOce4JcAf065+EVjPcW1t1m/6JUvL3QIZxVGfCEkdvS gglQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=davidv.dev); spf=pass (google.com: domain of linux-kernel+bounces-58364-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58364-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCWybhklJqq2vsbjX4/hscDCjKqvMYoQFy995BFwRO5yq2sCp0Whz3eX+XYIOXcee9tKXHNc21Kgj9EgcPqYGoeOiAiRXwW+z6a73tl6bA== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id vr7-20020a05620a55a700b007859c72c927si325173qkn.777.2024.02.08.08.44.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 08:44:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58364-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=davidv.dev); spf=pass (google.com: domain of linux-kernel+bounces-58364-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58364-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id B68F11C252C5 for ; Thu, 8 Feb 2024 16:44:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DF46885C72; Thu, 8 Feb 2024 16:43:03 +0000 (UTC) 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 44D3D82D74 for ; Thu, 8 Feb 2024 16:43:00 +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=1707410583; cv=none; b=OwfRtgkgOjaquaLagUJkRUr/OxgSVCyWg3hONglxlk+hoCKTdIzXhReEL3vLF0cqLfKcqNyuap1aqDWD+HzTmWFejfd+DGD5h6N0bvUcjX/d2mi0hZ+yIaEscYyUL+piCKfg7vWVDfOUL+u74FJETEtytJqT4v7SjPQcTwjuUck= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707410583; c=relaxed/simple; bh=e9gx7ysf5nDVQcKyRIhMrUuZqIvSokXKGgA3mBX6IGE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=u/PT+K2MMUiJcri2/a14pW556Iyoa+OLjMxqyBNhFc47U6K6Tpsh1OIQlSGhzWHb9VUZkb/g8wF5d46dyVW1aPcOQPlcWh6efyy++QqCmCMw6+ouVTm6DMPYt2mL3U+1nA/egm/qBtru5BSKxJHgVNU+xZWjdbqnJv1YuggKuiU= 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 [192.168.2.131] by mail.davidv.dev (chasquid) with ESMTPSA tls TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 (over submission+TLS, TLS-1.2, envelope from "david@davidv.dev") ; Thu, 08 Feb 2024 17:42:59 +0100 Message-ID: Date: Thu, 8 Feb 2024 17:42:58 +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: [PATCH v2 1/2] net: make driver settling time configurable Content-Language: en-US To: Denis Kirjanov Cc: Jonathan Corbet , "David S. Miller" , David Ahern , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Greg Kroah-Hartman , "Paul E. McKenney" , Randy Dunlap , Xiongwei Song , "open list:DOCUMENTATION" , open list , "open list:NETWORKING [IPv4/IPv6]" References: <20240208093722.246930-1-david@davidv.dev> <20240208095358.251381-1-david@davidv.dev> <0e129417-53c8-4931-af76-a37762472fb0@suse.de> From: David In-Reply-To: <0e129417-53c8-4931-af76-a37762472fb0@suse.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2/8/24 11:26, Denis Kirjanov wrote: > > On 2/8/24 12:52, David Ventura wrote: >> 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/Documentation/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 @@ >> >> ip= [IP_PNP] >> See Documentation/admin-guide/nfs/nfsroot.rst. >> + ip.dev_wait_ms= >> + [IP_PNP] >> + See Documentation/admin-guide/nfs/nfsroot.rst. >> + >> >> 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/admin-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=:::::::> /proc/net/ipconfig/ntp_servers to an NTP client before mounting the real >> root filesystem if it is on NFS). >> >> +ip.dev_wait_ms= >> + Set the number of milliseconds to delay after opening the network device >> + which will be autoconfigured. Defaults to 10 milliseconds. >> >> 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 >> >> -/* Define the friendly delay before and after opening net devices */ >> -#define CONF_POST_OPEN 10 /* After opening: 10 msecs */ >> >> /* Define the timeout for waiting for a DHCP/BOOTP/RARP reply */ >> #define CONF_OPEN_RETRIES 2 /* (Re)open devices twice */ >> @@ -101,6 +99,7 @@ >> >> /* Wait for carrier timeout default in seconds */ >> static unsigned int carrier_timeout = 120; >> +static unsigned int dev_wait_ms = 10; >> >> /* >> * Public IP configuration >> @@ -1516,7 +1515,8 @@ static int __init ip_auto_config(void) >> return err; >> >> /* Give drivers a chance to settle */ >> - msleep(CONF_POST_OPEN); >> + if(dev_wait_ms > 0) >> + msleep(dev_wait_ms); > What's the point to wait more than CONF_POST_OPEN with the change? I didn't have anything specificin mind - shall I change this to only enable/disable the 10ms wait instead of allowing a configurable value? >> >> /* >> * 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=", set_carrier_timeout); >> + >> + >> +static int __init set_dev_wait_ms(char *str) >> +{ >> + ssize_t ret; >> + >> + if (!str) >> + return 0; >> + >> + ret = kstrtouint(str, 0, &dev_wait_ms); >> + if (ret) >> + return 0; >> + >> + return 1; >> +} >> + >> +__setup("ip.dev_wait_ms=", set_dev_wait_ms);