{"id":806180,"url":"http://patchwork.ozlabs.org/api/patches/806180/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/20170826225444.7608-1-xypron.glpk@gmx.de/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/projects/18/?format=json","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":"<20170826225444.7608-1-xypron.glpk@gmx.de>","list_archive_url":null,"date":"2017-08-26T22:54:41","name":"[U-Boot,20/23] efi_loader: use events for efi_net_receive","commit_ref":null,"pull_url":null,"state":"superseded","archived":true,"hash":"01acfb9d6cccc109b27fff1a2c168f7b021b2c96","submitter":{"id":61270,"url":"http://patchwork.ozlabs.org/api/people/61270/?format=json","name":"Heinrich Schuchardt","email":"xypron.glpk@gmx.de"},"delegate":{"id":3400,"url":"http://patchwork.ozlabs.org/api/users/3400/?format=json","username":"agraf","first_name":"Alexander","last_name":"Graf","email":"agraf@suse.de"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20170826225444.7608-1-xypron.glpk@gmx.de/mbox/","series":[],"comments":"http://patchwork.ozlabs.org/api/patches/806180/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/806180/checks/","tags":{},"related":[],"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xfttB39Tpz9s7g\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSun, 27 Aug 2017 09:05:38 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid EF0E7C21DB5; Sat, 26 Aug 2017 23:00:44 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 2D559C221E7;\n\tSat, 26 Aug 2017 23:00:38 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 13FF8C221E1; Sat, 26 Aug 2017 22:55:37 +0000 (UTC)","from mout.gmx.net (mout.gmx.net [212.227.17.22])\n\tby lists.denx.de (Postfix) with ESMTPS id B536DC221EF\n\tfor <u-boot@lists.denx.de>; Sat, 26 Aug 2017 22:55:36 +0000 (UTC)","from localhost.localdomain ([84.118.154.110]) by mail.gmx.com\n\t(mrgmx101 [212.227.17.168]) with ESMTPSA (Nemesis) id\n\t0LnkiR-1dKLzL0qJr-00hxNE; Sun, 27 Aug 2017 00:54:56 +0200"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-0.7 required=5.0 tests=FREEMAIL_FROM,\n\tRCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,\n\tRCVD_IN_MSPIKE_WL autolearn=unavailable\n\tautolearn_force=no version=3.4.0","From":"Heinrich Schuchardt <xypron.glpk@gmx.de>","To":"Alexander Graf <agraf@suse.de>","Date":"Sun, 27 Aug 2017 00:54:41 +0200","Message-Id":"<20170826225444.7608-1-xypron.glpk@gmx.de>","X-Mailer":"git-send-email 2.14.1","In-Reply-To":"<20170826225110.7381-1-xypron.glpk@gmx.de>","References":"<20170826225110.7381-1-xypron.glpk@gmx.de>","X-Provags-ID":"V03:K0:YsOk07m5rHO1Mf8hmmI39tYo8dSdh4vGR7Q1MAsCn44YDqe+nj+\n\t2i5aTJ/cFWkCsKwYsQQTPbVF6INKsOvCzKS51CJxluZGJlADDZwakzPks72Dzm3cXK9Mne0\n\tyJoRaYFJriKJvvQdJVbAqQyqvQUK3TisOcMQ+7IMV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efi_loader: use events for efi_net_receive","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://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\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"},"content":"A timer event is defined. The timer handler cares for receiving new\npackets.\n\nefi_timer_check is called both in efi_net_transmit and efi_net_receive\nto enable events during network communication.\n\nCalling efi_timer_check in efi_net_get_status is implemented in a\nseparate patch.\n\nSigned-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>\n---\n lib/efi_loader/efi_net.c | 35 ++++++++++++++++++++++++++++++++---\n 1 file changed, 32 insertions(+), 3 deletions(-)","diff":"diff --git a/lib/efi_loader/efi_net.c b/lib/efi_loader/efi_net.c\nindex 38a3a4fac4..7659109386 100644\n--- a/lib/efi_loader/efi_net.c\n+++ b/lib/efi_loader/efi_net.c\n@@ -146,6 +146,8 @@ static efi_status_t EFIAPI efi_net_transmit(struct efi_simple_network *this,\n \tEFI_ENTRY(\"%p, %lx, %lx, %p, %p, %p, %p\", this, header_size,\n \t\t  buffer_size, buffer, src_addr, dest_addr, protocol);\n \n+\tefi_timer_check();\n+\n \tif (header_size) {\n \t\t/* We would need to create the header if header_size != 0 */\n \t\treturn EFI_EXIT(EFI_INVALID_PARAMETER);\n@@ -177,9 +179,7 @@ static efi_status_t EFIAPI efi_net_receive(struct efi_simple_network *this,\n \tEFI_ENTRY(\"%p, %p, %p, %p, %p, %p, %p\", this, header_size,\n \t\t  buffer_size, buffer, src_addr, dest_addr, protocol);\n \n-\tpush_packet = efi_net_push;\n-\teth_rx();\n-\tpush_packet = NULL;\n+\tefi_timer_check();\n \n \tif (!new_rx_packet)\n \t\treturn EFI_EXIT(EFI_NOT_READY);\n@@ -207,6 +207,21 @@ void efi_net_set_dhcp_ack(void *pkt, int len)\n \tmemcpy(dhcp_ack, pkt, min(len, maxsize));\n }\n \n+static struct efi_event *network_timer_event;\n+\n+static void EFIAPI efi_network_timer_notify(struct efi_event *event,\n+\t\t\t\t\t    void *context)\n+{\n+\tEFI_ENTRY(\"%p, %p\", event, context);\n+\n+\tif (!new_rx_packet) {\n+\t\tpush_packet = efi_net_push;\n+\t\teth_rx();\n+\t\tpush_packet = NULL;\n+\t}\n+\tEFI_EXIT(EFI_SUCCESS);\n+}\n+\n /* This gets called from do_bootefi_exec(). */\n int efi_net_register(void **handle)\n {\n@@ -221,6 +236,7 @@ int efi_net_register(void **handle)\n \t\t.dp.sub_type = DEVICE_PATH_SUB_TYPE_END,\n \t\t.dp.length = sizeof(dp_end),\n \t};\n+\tefi_status_t r;\n \n \tif (!eth_get_dev()) {\n \t\t/* No eth device active, don't expose any */\n@@ -270,5 +286,18 @@ int efi_net_register(void **handle)\n \tif (handle)\n \t\t*handle = &netobj->net;\n \n+\tr = efi_create_event(EVT_TIMER | EVT_NOTIFY_SIGNAL, TPL_CALLBACK,\n+\t\t\t     efi_network_timer_notify, NULL,\n+\t\t\t     &network_timer_event);\n+\tif (r != EFI_SUCCESS) {\n+\t\tprintf(\"ERROR: Failed to register network event\\n\");\n+\t\treturn r;\n+\t}\n+\t/* Network is time critical, call in every timer cyle */\n+\tr = efi_set_timer(network_timer_event, EFI_TIMER_PERIODIC, 0);\n+\tif (r != EFI_SUCCESS)\n+\t\tprintf(\"ERROR: Failed to set network timer\\n\");\n+\treturn r;\n+\n \treturn 0;\n }\n","prefixes":["U-Boot","20/23"]}