get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2040471/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2040471,
    "url": "http://patchwork.ozlabs.org/api/patches/2040471/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20250130082226.1572302-1-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": "<20250130082226.1572302-1-jerome.forissier@linaro.org>",
    "list_archive_url": null,
    "date": "2025-01-30T08:22:20",
    "name": "net: lwip: move eth_init() out of new_netif()",
    "commit_ref": "9f6b9f57fefa391018083c42bc3de9f33ea3bd90",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "57f2e89c97ad41c13917679373c8f4d25ad08f79",
    "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/20250130082226.1572302-1-jerome.forissier@linaro.org/mbox/",
    "series": [
        {
            "id": 442259,
            "url": "http://patchwork.ozlabs.org/api/series/442259/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=442259",
            "date": "2025-01-30T08:22:20",
            "name": "net: lwip: move eth_init() out of new_netif()",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/442259/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2040471/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2040471/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=YKJrnrcL;\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=\"YKJrnrcL\";\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) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4YkBpy3w6vz1ycb\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 30 Jan 2025 19:22:50 +1100 (AEDT)",
            "from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 94B6B80B9B;\n\tThu, 30 Jan 2025 09:22:48 +0100 (CET)",
            "by phobos.denx.de (Postfix, from userid 109)\n id C68BE80C99; Thu, 30 Jan 2025 09:22:47 +0100 (CET)",
            "from mail-wr1-x442.google.com (mail-wr1-x442.google.com\n [IPv6:2a00:1450:4864:20::442])\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 5F7CD80AE4\n for <u-boot@lists.denx.de>; Thu, 30 Jan 2025 09:22:45 +0100 (CET)",
            "by mail-wr1-x442.google.com with SMTP id\n ffacd0b85a97d-385dece873cso213593f8f.0\n for <u-boot@lists.denx.de>; Thu, 30 Jan 2025 00:22:45 -0800 (PST)",
            "from builder.. ([2a01:e0a:3cb:7bb0:623b:514b:a76b:ed40])\n by smtp.gmail.com with ESMTPSA id\n ffacd0b85a97d-38c5c1cfccasm1231091f8f.92.2025.01.30.00.22.43\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 30 Jan 2025 00:22:44 -0800 (PST)"
        ],
        "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=1738225364; x=1738830164; darn=lists.denx.de;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:from:to:cc:subject:date:message-id:reply-to;\n bh=nXrL+DNHXHbua5950sEuZlyBYY/SjpPfctmF8aNQCjI=;\n b=YKJrnrcL/EyJREVRaVi6kQk4DyP6JXARdfGDPExGnxrYY93yd8mkRSzkywgrB7TUx7\n wRm5iL2QZyMJHbog8qPoFWuCJDrY+OgToVPouJb1dQxqF4wNExHhN22IxKVZEKB81zBW\n 9GKams8SWJkDeYd9zBoWdfauPHmsTCHhgd121GBqef/9rPyjrvA1oZDOsFQeIsJmm2we\n UNCb7zz5fsFmTjglXKUTrcPp7pjMy2GziWkNKdVKO8bW8YoHUbf1F/tSjN66JJQwqdAT\n vMVaDo5uTpJoYEr8MK3diRpKeR7NLVMkNvW1sLRKJx5cFH5O1eSrF1Pw2JyYux+S9379\n FGVQ==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1738225364; x=1738830164;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:x-gm-message-state:from:to:cc:subject:date:message-id\n :reply-to;\n bh=nXrL+DNHXHbua5950sEuZlyBYY/SjpPfctmF8aNQCjI=;\n b=vhIlPUJz8Esbth375FSpwFkqlEO/00gAL/5MMabEFgFIxCeSs8DL+52mSY0TfygXj+\n Ll6lzK+9YPEJI+PqFxoOsyqZMcoN4U5hlAmKp8UeBN5m00fzDpZq+eIGJQa0S1mV2AgP\n x6/W2mnNkZLn/7APko7JqrnJ+rfmM0e1sFqbb6qg+oFlQTc8E/Vdf5cNAAfW0A36as2n\n yoE/5ZCm5r5MFU6cyzya84VVAClMaa/SDNP6IdlA93H4DNWTgLhITFuNKFk5/iDlDwzx\n AtHmsPJVa/AugaR7utDge42pggsAL9bNVkgCcfOZGzPxqq8bzS95/KPEK35YVZcuy71e\n 7FVA==",
        "X-Gm-Message-State": "AOJu0YwZB94XMEqVBIZ85Jke/hs+Yv7xeoCKhhl6PjLptvxVdcYSA0Vr\n Lgo1kYo+of0l4Cu6GhU88bfNxufF02Ep7nioSXb+RsBO+FpHjRSUupHiW5j1/2sOvjydA/A75dP\n eYh5vT1JHluQ=",
        "X-Gm-Gg": "ASbGncsmI+/JemAdJapW2KDm85KpNzUhFjtPqAgD+0ISCZzY6jQFo00G57JqUX3l7ix\n S44TgIKOb9lhmBHBmNcSsMbSVAbg8us9gO1tykUmOBVWPOCrawVf6guSnQQFCHBuBPsZcLiLmgL\n peoOtpcgcSOFSXchcvlp1i1k58xPrjSM9oOp21B538QVIGpoevaZ9Zwq1N/93tiyDdO6XXP9jgh\n xiu5LlD/UFI/2wkE6hJh5TjNpiQ+k1rTrZZNLAlKggZhwvvh7BDJb0AVRKMwUzZEoGHOo+suCvb\n yNHUn/dn5Eg9Dcw3hubtsreY",
        "X-Google-Smtp-Source": "\n AGHT+IGnWbSjaL0xdcBV1WYCX/riy+aaqzhL8W3cSkJe4Zv6b5FISwcT3xAj7KNmJIETAIso+6HlZQ==",
        "X-Received": "by 2002:a5d:4527:0:b0:385:e17a:ce61 with SMTP id\n ffacd0b85a97d-38c520b0990mr3753213f8f.53.1738225364544;\n Thu, 30 Jan 2025 00:22:44 -0800 (PST)",
        "From": "Jerome Forissier <jerome.forissier@linaro.org>",
        "To": "u-boot@lists.denx.de",
        "Cc": "Ilias Apalodimas <ilias.apalodimas@linaro.org>,\n E Shattow <e@freeshell.de>,\n Jerome Forissier <jerome.forissier@linaro.org>,\n Tom Rini <trini@konsulko.com>, Joe Hershberger <joe.hershberger@ni.com>,\n Ramon Fried <rfried.dev@gmail.com>, Adriano Cordova <adrianox@gmail.com>,\n Heinrich Schuchardt <xypron.glpk@gmx.de>, Simon Glass <sjg@chromium.org>",
        "Subject": "[PATCH] net: lwip: move eth_init() out of new_netif()",
        "Date": "Thu, 30 Jan 2025 09:22:20 +0100",
        "Message-ID": "<20250130082226.1572302-1-jerome.forissier@linaro.org>",
        "X-Mailer": "git-send-email 2.43.0",
        "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": "Move the initialization of the ethernet devices out of the new_netif()\nfunction. Indeed, new_netif() accepts a struct device argument, which\nis expected to be valid and active. The activation and selection of\nthis device are achieved by eth_init() (on first time the network\nstack is used) and eth_set_current(). This is what takes care of the\nethrotate and ethact environment variables. Therefore, move these calls\nto a new function: net_lwip_set_current(), and use it whenever a\nnet-lwip command is run.\n\nThis patch hopefully fixes the incorrect net-lwip behavior observed on\nboards with multiple ethernet interfaces [1].\n\nTested on an i.MX8MPlus EVK equipped wih two ethernet ports. The dhcp\ncommand succeeds whether the cable is plugged into the first or second\nport.\n\n[1] https://lists.denx.de/pipermail/u-boot/2025-January/576326.html\n\nSigned-off-by: Jerome Forissier <jerome.forissier@linaro.org>\nCC: E Shattow <e@freeshell.de>\n---\n include/net-lwip.h  |  1 +\n net/lwip/dhcp.c     |  2 +-\n net/lwip/dns.c      |  2 +-\n net/lwip/net-lwip.c | 23 ++++++++++++++---------\n net/lwip/ping.c     |  2 +-\n net/lwip/tftp.c     |  2 +-\n net/lwip/wget.c     |  2 +-\n 7 files changed, 20 insertions(+), 14 deletions(-)",
    "diff": "diff --git a/include/net-lwip.h b/include/net-lwip.h\nindex 4d7f9387d1d..64e5c720560 100644\n--- a/include/net-lwip.h\n+++ b/include/net-lwip.h\n@@ -10,6 +10,7 @@ enum proto_t {\n \tTFTPGET\n };\n \n+void net_lwip_set_current(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 e7d9147455c..3b7e4700c6e 100644\n--- a/net/lwip/dhcp.c\n+++ b/net/lwip/dhcp.c\n@@ -115,7 +115,7 @@ int do_dhcp(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])\n \tint ret;\n \tstruct udevice *dev;\n \n-\teth_set_current();\n+\tnet_lwip_set_current();\n \n \tdev = eth_get_dev();\n \tif (!dev) {\ndiff --git a/net/lwip/dns.c b/net/lwip/dns.c\nindex 1de63c9998b..149bdb784dc 100644\n--- a/net/lwip/dns.c\n+++ b/net/lwip/dns.c\n@@ -121,7 +121,7 @@ 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-\teth_set_current();\n+\tnet_lwip_set_current();\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 b863047f598..cab1dd7d483 100644\n--- a/net/lwip/net-lwip.c\n+++ b/net/lwip/net-lwip.c\n@@ -127,6 +127,20 @@ 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+\tstatic bool init_done;\n+\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+\teth_set_current();\n+}\n+\n static struct netif *new_netif(struct udevice *udev, bool with_ip)\n {\n \tunsigned char enetaddr[ARP_HLEN];\n@@ -134,19 +148,10 @@ static struct netif *new_netif(struct udevice *udev, bool with_ip)\n \tip4_addr_t ip, mask, gw;\n \tstruct netif *netif;\n \tint ret = 0;\n-\tstatic bool first_call = true;\n \n \tif (!udev)\n \t\treturn NULL;\n \n-\tif (first_call) {\n-\t\teth_init_rings();\n-\t\t/* Pick a valid active device, if any */\n-\t\teth_init();\n-\t\tlwip_init();\n-\t\tfirst_call = false;\n-\t}\n-\n \tif (eth_start_udev(udev) < 0) {\n \t\tlog_err(\"Could not start %s\\n\", udev->name);\n \t\treturn NULL;\ndiff --git a/net/lwip/ping.c b/net/lwip/ping.c\nindex aa617530749..200a702bbb5 100644\n--- a/net/lwip/ping.c\n+++ b/net/lwip/ping.c\n@@ -168,7 +168,7 @@ 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-\teth_set_current();\n+\tnet_lwip_set_current();\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 fc4aff5f2ba..123d66b5dba 100644\n--- a/net/lwip/tftp.c\n+++ b/net/lwip/tftp.c\n@@ -280,7 +280,7 @@ int do_tftpb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])\n \t\tgoto out;\n \t}\n \n-\teth_set_current();\n+\tnet_lwip_set_current();\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 b76f6c0f1d9..9aec75f9bed 100644\n--- a/net/lwip/wget.c\n+++ b/net/lwip/wget.c\n@@ -354,7 +354,7 @@ 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-\teth_set_current();\n+\tnet_lwip_set_current();\n \n \tif (!wget_info)\n \t\twget_info = &default_wget_info;\n",
    "prefixes": []
}