Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2073323/?format=api
{ "id": 2073323, "url": "http://patchwork.ozlabs.org/api/patches/2073323/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20250415211819.1254435-2-jerome.forissier@linaro.org/", "project": { "id": 18, "url": "http://patchwork.ozlabs.org/api/projects/18/?format=api", "name": "U-Boot", "link_name": "uboot", "list_id": "u-boot.lists.denx.de", "list_email": "u-boot@lists.denx.de", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20250415211819.1254435-2-jerome.forissier@linaro.org>", "list_archive_url": null, "date": "2025-04-15T21:17:36", "name": "[v2,01/11] net: lwip: fix initialization sequence before a command", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "e1c5e57d24401b4a7ce18030694a2743e5f73fb6", "submitter": { "id": 69192, "url": "http://patchwork.ozlabs.org/api/people/69192/?format=api", "name": "Jerome Forissier", "email": "jerome.forissier@linaro.org" }, "delegate": { "id": 157425, "url": "http://patchwork.ozlabs.org/api/users/157425/?format=api", "username": "jforissier", "first_name": "Jerome", "last_name": "Forissier", "email": "jerome.forissier@linaro.org" }, "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20250415211819.1254435-2-jerome.forissier@linaro.org/mbox/", "series": [ { "id": 452941, "url": "http://patchwork.ozlabs.org/api/series/452941/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=452941", "date": "2025-04-15T21:17:35", "name": "lwIP sandbox tests", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/452941/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2073323/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2073323/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<u-boot-bounces@lists.denx.de>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256\n header.s=google header.b=hk1M+gzp;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)", "phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=linaro.org", "phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de", "phobos.denx.de;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=linaro.org header.i=@linaro.org header.b=\"hk1M+gzp\";\n\tdkim-atps=neutral", "phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=linaro.org", "phobos.denx.de;\n spf=pass smtp.mailfrom=jerome.forissier@linaro.org" ], "Received": [ "from phobos.denx.de (phobos.denx.de\n [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature ECDSA (secp384r1))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4ZccTJ2Tdjz1yJ9\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 16 Apr 2025 07:18:28 +1000 (AEST)", "from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 32B7482B7E;\n\tTue, 15 Apr 2025 23:18:34 +0200 (CEST)", "by phobos.denx.de (Postfix, from userid 109)\n id 2E41682A27; Tue, 15 Apr 2025 23:18:33 +0200 (CEST)", "from mail-wr1-x436.google.com (mail-wr1-x436.google.com\n [IPv6:2a00:1450:4864:20::436])\n (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id 0E7DD81F0D\n for <u-boot@lists.denx.de>; Tue, 15 Apr 2025 23:18:31 +0200 (CEST)", "by mail-wr1-x436.google.com with SMTP id\n ffacd0b85a97d-391342fc1f6so5213563f8f.1\n for <u-boot@lists.denx.de>; Tue, 15 Apr 2025 14:18:31 -0700 (PDT)", "from builder.. ([2a01:e0a:3cb:7bb0:6ebc:6ce:770e:95f9])\n by smtp.gmail.com with ESMTPSA id\n ffacd0b85a97d-39eaf43cce3sm15530917f8f.74.2025.04.15.14.18.29\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Tue, 15 Apr 2025 14:18:30 -0700 (PDT)" ], "X-Spam-Checker-Version": "SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de", "X-Spam-Level": "", "X-Spam-Status": "No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,\n DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED,\n SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=linaro.org; s=google; t=1744751910; x=1745356710; darn=lists.denx.de;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=N/dxSILVFVpJWcH0rtldlJyOod0yJDJ8NWl9T9tlmrE=;\n b=hk1M+gzpaBq/hJv1T29BQlTT5GuRbElM/Fiu1Qe0qaTi9EKh9I3TT4+8rYVe19s2yy\n aRp0bZYG8bgOVaZq9mwLjXrCg2cs9PHhjZbF7LCxqm4fX9gDlcV2KAEFrA9hOGWEUWyC\n 2ICUXyFwywuD8cd/Xh6EQMGjDa+++Q8wvgnlAstHA5py0W1IBiMGp/W7oTy7lh2Cj9jC\n b22eRsFOhuAcE4Ktff8DArc2NLtWOpybaxpMDxRG0YWC+1MEKhPu9aZtZkxjiHyCaOrd\n OrHqYxQScAf/6tJ783v9bLVuBHnNJXBDXQD/w6F7Rrew1VMESi0En/HRZTh/C90wfruv\n XFJA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1744751910; x=1745356710;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n :subject:date:message-id:reply-to;\n bh=N/dxSILVFVpJWcH0rtldlJyOod0yJDJ8NWl9T9tlmrE=;\n b=uzvZlnjj34VkJ9F3CZq/LsWNmMrUt1TEMkPDpK7+BkV4GHDRP/KaBi2kEMPANVaxFg\n evqMff4Xx64h2sU6ZNsODVL6mIERSGsrgUybbdSJLh/2mf7yJwrgEhqItORGlAtNLo5n\n 8ODEcDfpaH0NeHCZtLV4iZVlQ+lSxdMuM/6vsPqdP1YYOLFgDn+LvdeP3KqZ1JbxsQPG\n d0p1gGsDgz9IOsQZo1HmnF+/V1v6V+9wgv39eHhxw+GvHM5RL3Oj9fDp0MBqNVtCzUJk\n URpwq2f89QiPgUebZxtznWeUAuelkyG0v8+AKiwTWKhz9KYmZtc8YtuvOjD6yQdNXQnG\n EymA==", "X-Gm-Message-State": "AOJu0YzZ7bEyXV9GBFmDmkkZ+V0WSCtpUxu10CXdPPW7vNQAaLb7aWUk\n mPfThOKOHroY0LU7kfjAONv23SCREmm0AAIPfV0hvGMzVJBLdTOqSIT0wRtaDUc3agHTrI5SDv4\n wkw4=", "X-Gm-Gg": "ASbGncut8vQGIK05KqOFXUXsW6vMPHA6JoVQ1Cnicmja+EXTjr1aFCj/Mtb7hc8mFrl\n d7KRZDoyplIJezGb91/7gWK8e0YNRLP6aCMKi2iXXWKuLmP35FeO1OntCbQVlCW0HhVFemF5nR4\n xMweG06DQ67QpI1WiQ2yJJrI+KblEKfJ0MfreKZ5xsHBKeTCpNB2hp80fUl8LAPf5SY4r4LUTBG\n nBEj+1GaptI1kDN1EFsKRDsCmilh+G39MLZzu2ABnIKv99RV4CILuMwyHaDw4HSrQwB/PC1Da8O\n nf0LYoNI81RpH7FMufGBPrCZ3RPq27F5duOWNBFXxWefu0eQuDSQoKSkeNY=", "X-Google-Smtp-Source": "\n AGHT+IEkEU42nyGG8MjK2aI8poMRMgtGyF1hT1EHDT4MhujXy76zuCv2TkcUpH1BJ23JHbTTsYJCmA==", "X-Received": "by 2002:a5d:5985:0:b0:39e:cbd2:986b with SMTP id\n ffacd0b85a97d-39ee2729edcmr716674f8f.7.1744751910300;\n Tue, 15 Apr 2025 14:18:30 -0700 (PDT)", "From": "Jerome Forissier <jerome.forissier@linaro.org>", "To": "U-Boot mailing list <u-boot@lists.denx.de>", "Cc": "Jerome Forissier <jerome.forissier@linaro.org>,\n Simon Glass <sjg@chromium.org>, Adriano Cordova <adrianox@gmail.com>,\n Heinrich Schuchardt <xypron.glpk@gmx.de>,\n Ilias Apalodimas <ilias.apalodimas@linaro.org>,\n Joe Hershberger <joe.hershberger@ni.com>,\n Ramon Fried <rfried.dev@gmail.com>, Tom Rini <trini@konsulko.com>", "Subject": "[PATCH v2 01/11] net: lwip: fix initialization sequence before a\n command", "Date": "Tue, 15 Apr 2025 23:17:36 +0200", "Message-ID": "<20250415211819.1254435-2-jerome.forissier@linaro.org>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20250415211819.1254435-1-jerome.forissier@linaro.org>", "References": "<20250415211819.1254435-1-jerome.forissier@linaro.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-BeenThere": "u-boot@lists.denx.de", "X-Mailman-Version": "2.1.39", "Precedence": "list", "List-Id": "U-Boot discussion <u-boot.lists.denx.de>", "List-Unsubscribe": "<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>", "List-Archive": "<https://lists.denx.de/pipermail/u-boot/>", "List-Post": "<mailto:u-boot@lists.denx.de>", "List-Help": "<mailto:u-boot-request@lists.denx.de?subject=help>", "List-Subscribe": "<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>", "Errors-To": "u-boot-bounces@lists.denx.de", "Sender": "\"U-Boot\" <u-boot-bounces@lists.denx.de>", "X-Virus-Scanned": "clamav-milter 0.103.8 at phobos.denx.de", "X-Virus-Status": "Clean" }, "content": "The things that are done prior to executing a network command with\nNET_LWIP are not consistent with what is done with NET. It impacts the\nselection of the current device, and more precisely if the active device\nis invalid NET would return an error while NET_LWIP would try to pick a\nnew device. This incorrect behavior was detected thanks to the eth_rotate\nsandbox test (dm_test_eth_rotate()).\n\nFix it by re-using a sequence similar to what NET has in net_loop().\nThis piece of code is inserted in a function called net_lwip_eth_start()\nrenamed from net_lwip_eth_set_current().\n\nSigned-off-by: Jerome Forissier <jerome.forissier@linaro.org>\nReviewed-by: Simon Glass <sjg@chromium.org>\n---\n\n(no changes since v1)\n\n include/net-lwip.h | 9 ++++++++-\n net/lwip/dhcp.c | 3 ++-\n net/lwip/dns.c | 3 ++-\n net/lwip/net-lwip.c | 40 +++++++++++++++++++++++++++++-----------\n net/lwip/ping.c | 3 ++-\n net/lwip/tftp.c | 5 ++++-\n net/lwip/wget.c | 6 +++++-\n 7 files changed, 52 insertions(+), 17 deletions(-)", "diff": "diff --git a/include/net-lwip.h b/include/net-lwip.h\nindex 64e5c720560..0d3bb8a8bd8 100644\n--- a/include/net-lwip.h\n+++ b/include/net-lwip.h\n@@ -10,7 +10,14 @@ enum proto_t {\n \tTFTPGET\n };\n \n-void net_lwip_set_current(void);\n+static inline int eth_is_on_demand_init(void)\n+{\n+\treturn 1;\n+}\n+\n+int eth_init_state_only(void); /* Set active state */\n+\n+int net_lwip_eth_start(void);\n struct netif *net_lwip_new_netif(struct udevice *udev);\n struct netif *net_lwip_new_netif_noip(struct udevice *udev);\n void net_lwip_remove_netif(struct netif *netif);\ndiff --git a/net/lwip/dhcp.c b/net/lwip/dhcp.c\nindex 3b7e4700c6e..92bd7067a7f 100644\n--- a/net/lwip/dhcp.c\n+++ b/net/lwip/dhcp.c\n@@ -115,7 +115,8 @@ int do_dhcp(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])\n \tint ret;\n \tstruct udevice *dev;\n \n-\tnet_lwip_set_current();\n+\tif (net_lwip_eth_start() < 0)\n+\t\treturn CMD_RET_FAILURE;\n \n \tdev = eth_get_dev();\n \tif (!dev) {\ndiff --git a/net/lwip/dns.c b/net/lwip/dns.c\nindex 149bdb784dc..19172ac959a 100644\n--- a/net/lwip/dns.c\n+++ b/net/lwip/dns.c\n@@ -121,7 +121,8 @@ int do_dns(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])\n \tif (argc == 3)\n \t\tvar = argv[2];\n \n-\tnet_lwip_set_current();\n+\tif (net_lwip_eth_start() < 0)\n+\t\treturn CMD_RET_FAILURE;\n \n \treturn dns_loop(eth_get_dev(), name, var);\n }\ndiff --git a/net/lwip/net-lwip.c b/net/lwip/net-lwip.c\nindex 6b7b696dbf0..6748008736b 100644\n--- a/net/lwip/net-lwip.c\n+++ b/net/lwip/net-lwip.c\n@@ -134,18 +134,27 @@ static int get_udev_ipv4_info(struct udevice *dev, ip4_addr_t *ip,\n \treturn 0;\n }\n \n-/* Initialize the lwIP stack and the ethernet devices and set current device */\n-void net_lwip_set_current(void)\n+/*\n+ * Initialize the network stack if needed and start the current device if valid\n+ */\n+int net_lwip_eth_start(void)\n {\n-\tstatic bool init_done;\n+\tint ret;\n \n-\tif (!init_done) {\n-\t\teth_init_rings();\n-\t\teth_init();\n-\t\tlwip_init();\n-\t\tinit_done = true;\n+\tnet_init();\n+\tif (eth_is_on_demand_init()) {\n+\t\teth_halt();\n+\t\teth_set_current();\n+\t\tret = eth_init();\n+\t\tif (ret < 0) {\n+\t\t\teth_halt();\n+\t\t\treturn ret;\n+\t\t}\n+\t} else {\n+\t\teth_init_state_only();\n \t}\n-\teth_set_current();\n+\n+\treturn 0;\n }\n \n static struct netif *new_netif(struct udevice *udev, bool with_ip)\n@@ -224,11 +233,20 @@ void net_lwip_remove_netif(struct netif *netif)\n \tfree(netif);\n }\n \n+/*\n+ * Initialize the network buffers, an ethernet device, and the lwIP stack\n+ * (once).\n+ */\n int net_init(void)\n {\n-\teth_set_current();\n+\tstatic bool init_done;\n \n-\tnet_lwip_new_netif(eth_get_dev());\n+\tif (!init_done) {\n+\t\teth_init_rings();\n+\t\teth_init();\n+\t\tlwip_init();\n+\t\tinit_done = true;\n+\t}\n \n \treturn 0;\n }\ndiff --git a/net/lwip/ping.c b/net/lwip/ping.c\nindex c586a96806d..542ef2cb148 100644\n--- a/net/lwip/ping.c\n+++ b/net/lwip/ping.c\n@@ -168,7 +168,8 @@ int do_ping(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])\n \tif (!ipaddr_aton(argv[1], &addr))\n \t\treturn CMD_RET_USAGE;\n \n-\tnet_lwip_set_current();\n+\tif (net_lwip_eth_start() < 0)\n+\t\treturn CMD_RET_FAILURE;\n \n \tif (ping_loop(eth_get_dev(), &addr) < 0)\n \t\treturn CMD_RET_FAILURE;\ndiff --git a/net/lwip/tftp.c b/net/lwip/tftp.c\nindex 123d66b5dba..4f9b2049187 100644\n--- a/net/lwip/tftp.c\n+++ b/net/lwip/tftp.c\n@@ -280,7 +280,10 @@ int do_tftpb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])\n \t\tgoto out;\n \t}\n \n-\tnet_lwip_set_current();\n+\tif (net_lwip_eth_start() < 0) {\n+\t\tret = CMD_RET_FAILURE;\n+\t\tgoto out;\n+\t}\n \n \tif (tftp_loop(eth_get_dev(), laddr, fname, srvip, port) < 0)\n \t\tret = CMD_RET_FAILURE;\ndiff --git a/net/lwip/wget.c b/net/lwip/wget.c\nindex ec098148835..a3b82908877 100644\n--- a/net/lwip/wget.c\n+++ b/net/lwip/wget.c\n@@ -471,7 +471,11 @@ static int wget_loop(struct udevice *udev, ulong dst_addr, char *uri)\n \n int wget_do_request(ulong dst_addr, char *uri)\n {\n-\tnet_lwip_set_current();\n+\tint ret;\n+\n+\tret = net_lwip_eth_start();\n+\tif (ret < 0)\n+\t\treturn ret;\n \n \tif (!wget_info)\n \t\twget_info = &default_wget_info;\n", "prefixes": [ "v2", "01/11" ] }