Re: [PATCH 17/21] fastboot net: implement fastboot over UDP

2020-06-29 Thread Daniel Glöckner
pr_err("Cannot register poller: %s\n", strerror(-ret)); > + return; It is not obvious that a second FASTBOOT_INIT will _not_ cause this error because fastboot_net_abort unregistered the previous poller. I would at least add a comment to the fastboot_net_abo

Re: [PATCH 14/19] fastboot: remove double print

2020-06-18 Thread Daniel Glöckner
for the command execution is queued, as you implemented it, when a new command arrives. Best regards, Daniel -- Dipl.-Math. Daniel Glöckner, emlix GmbH, http://www.emlix.com Fon +49 551 30664-0, Fax +49 551 30664-11, Gothaer Platz 3, 37083 Göttingen, Germany Sitz der Gesellschaft: Göttin

Re: [PATCH 15/19] fastboot net: implement fastboot over UDP

2020-06-18 Thread Daniel Glöckner
Hello Sascha, Am 18.06.20 um 13:59 schrieb Sascha Hauer: > On Wed, Jun 17, 2020 at 09:32:45PM +0200, Daniel Glöckner wrote: >>> +static void fastboot_start_download_net(struct fastboot *fb) >>> +{ >>> + struct fastboot_net *fbn = contai

Re: [PATCH 16/19] usb: fastboot: execute commands in command context

2020-06-17 Thread Daniel Glöckner
p_queue(ep, req); > + w = xzalloc(sizeof(*w)); > + w->f_fb = f_fb; > + > + memcpy(w->command, req->buf, req->actual); > + > + wq_queue_work(&f_fb->wq, &w->work); Do we need to check if req->actual < sizeof(w->command)? Best

Re: [PATCH 15/19] fastboot net: implement fastboot over UDP

2020-06-17 Thread Daniel Glöckner
PER_SEC)) > + return; > + > + if (!fbn->may_send) > + return; > + > + fastboot_tx_print(&fbn->fastboot, FASTBOOT_MSG_INFO, "still busy"); > + > + fbn->host_waits_since = get_time_ns(); Why do we need this line? host_wa

Re: [PATCH 02/19] Add workqueues

2020-06-17 Thread Daniel Glöckner
ist); > + wq->cancel(work); > + } > +} Why is this function in the header? So far it is called only from wq_unregister. Best regards, Daniel -- Dipl.-Math. Daniel Glöckner, emlix GmbH, http://www.emlix.com Fon +49 551 30664-0, Fax +49 551 30664-11, Gothaer Platz 3, 37

Re: [PATCH 14/19] fastboot: remove double print

2020-06-17 Thread Daniel Glöckner
t? The fastboot UDP code in U-Boot was designed to send only a single message for every executed command because it doesn't have code that waits for a packet from the host when necessary. I think we should be proud that Barebox can handle that case. Best regards, Daniel -- Dipl.-Mat

[PATCH v3 14/14] fastboot net: implement fastboot over UDP

2020-06-15 Thread Daniel Glöckner
restart is necessary since contrary to USB the host will not notice when a UDP server disappears. Signed-off-by: Edmund Henniges Signed-off-by: Daniel Glöckner Signed-off-by: Sascha Hauer --- common/fastboot.c | 3 + include/fastboot.h | 1 + include/fastboot_net.h | 12 + net

[PATCH v3 13/14] fastboot: rename usbgadget.fastboot_* variables to fastboot.*

2020-06-15 Thread Daniel Glöckner
term from the USB specification and the Fastboot specification uses the term "partition", we rename that variable to "fastboot.partitions". Signed-off-by: Daniel Glöckner Signed-off-by: Sascha Hauer --- Documentation/user/usb.rst | 4 ++-- commands/usbgadget.c

[PATCH v3 11/14] defconfigs: update renamed fastboot options

2020-06-15 Thread Daniel Glöckner
The split of the generic Fastboot code from the Fastboot USB gadget included renaming the CONFIG_USB_GADGET_FASTBOOT_* options to CONFIG_FASTBOOT_*. Update all defconfigs to use the new names. Signed-off-by: Daniel Glöckner Signed-off-by: Sascha Hauer --- arch/arm/configs/imx23_defconfig

[PATCH v3 04/14] net: mdiobus: Add slice

2020-06-15 Thread Daniel Glöckner
From: Sascha Hauer By adding a slice to the mdio bus we make the mdio code safe for being called in a poller. Signed-off-by: Sascha Hauer --- drivers/net/phy/mdio_bus.c | 43 ++ include/linux/phy.h| 38 + 2 files chang

[PATCH v3 03/14] net: Add a slice to struct eth_device

2020-06-15 Thread Daniel Glöckner
From: Sascha Hauer Add ethernet code safe for being called from a poller. Signed-off-by: Sascha Hauer --- include/net.h | 8 net/eth.c | 21 ++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/include/net.h b/include/net.h index 54db8a179..8d2b49

[PATCH v3 10/14] poller: Allow to run pollers inside of pollers

2020-06-15 Thread Daniel Glöckner
From: Sascha Hauer This adds a slice to each poller which is acquired before the poller is executed. This allows us to run pollers inside of other pollers. Signed-off-by: Sascha Hauer --- common/poller.c | 19 ++- include/poller.h | 2 ++ 2 files changed, 12 insertions(+), 9

[PATCH v3 08/14] net: reply to ping requests

2020-06-15 Thread Daniel Glöckner
From: Sascha Hauer Now that we have the network receive function running in a poller we can reasonably well answer to ping requests. Implement this feature. Signed-off-by: Sascha Hauer --- net/net.c | 46 -- 1 file changed, 44 insertions(+), 2 deleti

[PATCH v3 07/14] net: Call net_poll() in a poller

2020-06-15 Thread Daniel Glöckner
From: Sascha Hauer This patch moves the ethernet receive loop into a poller. With this network protocols no longer have to call net_loop() explicitly but can do it implicitly by calling is_timeout() when waiting for packets. Having the network receive loop running in a poller has the advantage t

[PATCH v3 09/14] usbnet: Be more friendly in the receive path

2020-06-15 Thread Daniel Glöckner
From: Sascha Hauer To recognize if we have a receive packet pending we must set up a USB bulk transfer. When there's no incoming packet we must wait until the transfer times out. We do this with every poller call which can considerably slow down the system. With this patch we do two things agains

[PATCH v3 06/14] usbnet: Add slice

2020-06-15 Thread Daniel Glöckner
From: Sascha Hauer Both the ethernet device and the mdio bus of a USB network controller need the USB bus. Add dependencies to it. Signed-off-by: Sascha Hauer --- drivers/net/usb/usbnet.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c

[PATCH v3 02/14] Introduce idle slice

2020-06-15 Thread Daniel Glöckner
it is doing that outside of any command. Code that wants to depend on the idle slice must select CONFIG_IDLE_SLICE to make it available. Signed-off-by: Daniel Glöckner Signed-off-by: Sascha Hauer --- common/hush.c | 5 + common/ratp/ratp.c | 7 ++- common/slice.c

[PATCH v3 01/14] Introduce slices

2020-06-15 Thread Daniel Glöckner
From: Sascha Hauer slices, the barebox idea of locking barebox has pollers which execute code in the background whenever one of the delay functions (udelay, mdelay, ...) or is_timeout() are called. This introduces resource problems when some device triggers a poller by calling a delay function a

[PATCH v3 05/14] usb: Add a slice to usb host controllers

2020-06-15 Thread Daniel Glöckner
From: Sascha Hauer Signed-off-by: Sascha Hauer --- drivers/usb/core/usb.c | 7 +++ include/usb/usb.h | 7 +++ 2 files changed, 14 insertions(+) diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 30c251f40..847529526 100644 --- a/drivers/usb/core/usb.c +++ b/drivers

[PATCH v3 00/14] Slices and fastboot over UDP

2020-06-15 Thread Daniel Glöckner
hanges since v2: - rebased to the current master branch where some of the patches from v2 have already been merged - timeout when waiting for host in fastboot_write_net - reworked and unified code for aborting sessions Daniel Glöckner (3): Introduce idle slice defconfigs: update renamed f

Re: [PATCH 20/20] fastboot net: remove may_send

2020-06-15 Thread Daniel Glöckner
Hello Sascha, Am 26.05.20 um 08:02 schrieb Sascha Hauer: > On Mon, May 25, 2020 at 09:45:49PM +0200, Daniel Glöckner wrote: >> I know that Barebox will get stuck when the host stops talking to us >> before we had the opportunity to send the final OKAY, but that is not >> what

Re: [RFC] inkscape 1.0 issue

2020-06-03 Thread Daniel Glöckner
but what would be the advantage? We could fall back to rsvg-convert. Best regards, Daniel -- Dipl.-Math. Daniel Glöckner, emlix GmbH, http://www.emlix.com Fon +49 551 30664-0, Fax +49 551 30664-11, Gothaer Platz 3, 37083 Göttingen, Germany Sitz der Gesellschaft: Göttingen, Amtsgericht Göttingen HR B

Re: [PATCH 20/20] fastboot net: remove may_send

2020-05-25 Thread Daniel Glöckner
t reinit to true, which discards all messages the old session wants to send. If this is not acceptable, I suggest adding a timeout >= 60 seconds to that loop in fastboot_write_net and setting reinit when it expires. We can make the timeout a kconfig option which defaults to 60 if you prefer. Best

Re: [PATCH 07/19] Introduce idle slice

2020-05-22 Thread Daniel Glöckner
e.c > +++ b/lib/readline.c > @@ -3,7 +3,7 @@ > #include > #include > #include > -#include > +#include > #include > #include > #include Again, with your changes no include for slice.h needed. Best regards, Daniel -- Dipl.-Math. Daniel Glöckner, emlix G

Re: [PATCH v2 09/10] fastboot net: implement fastboot over UDP

2020-05-19 Thread Daniel Glöckner
Hello Sascha, On Wed, May 20, 2020 at 07:52:32AM +0200, Sascha Hauer wrote: > On Thu, May 14, 2020 at 08:21:57PM +0200, Daniel Glöckner wrote: > > From: Edmund Henniges > > > > This implements the UDP variant of the fastboot protocol. The only way to > > start the se

[PATCH v2 08/10] fastboot: rename usbgadget.fastboot_* variables to fastboot.*

2020-05-14 Thread Daniel Glöckner
term from the USB specification and the Fastboot specification uses the term "partition", we rename that variable to "fastboot.partitions". Signed-off-by: Daniel Glöckner --- Documentation/user/usb.rst | 4 ++-- commands/usbgadget.c | 2 +- common/fastboot.c

[PATCH v2 05/10] ratp: use poller to run ratp commands

2020-05-14 Thread Daniel Glöckner
With the new idle slice there is no longer a need to have a dedicated hook for RATP inside readline. Switch to a poller that depends on the idle slice to execute the commands received over RATP. Signed-off-by: Daniel Glöckner --- common/ratp/ratp.c | 12 +++- include/ratp_bb.h | 1

[PATCH v2 07/10] defconfigs: update renamed fastboot options

2020-05-14 Thread Daniel Glöckner
The split of the generic Fastboot code from the Fastboot USB gadget included renaming the CONFIG_USB_GADGET_FASTBOOT_* options to CONFIG_FASTBOOT_*. Update all defconfigs to use the new names. Signed-off-by: Daniel Glöckner --- arch/arm/configs/imx23_defconfig | 2 +- arch/arm/configs

[PATCH v2 00/10] Support for Fastboot over UDP

2020-05-14 Thread Daniel Glöckner
barebox is idle - Use second poller to send keep-alive messages - Share all settings in global variables with USB gadget and move them to a protocol agnostic variable namespace - Use eth_open function added recently - Minor cleanups Daniel Glöckner (8): Remove CONFIG_SLICE net: fixed-link phys are

[PATCH v2 06/10] fastboot: split generic code from USB gadget

2020-05-14 Thread Daniel Glöckner
*fb. Signed-off-by: Edmund Henniges Signed-off-by: Daniel Glöckner --- common/Kconfig | 40 ++ common/Makefile | 1 + common/fastboot.c | 957 +++ drivers/usb/gadget/Kconfig | 36 +- drivers/usb/gadget

[PATCH v2 09/10] fastboot net: implement fastboot over UDP

2020-05-14 Thread Daniel Glöckner
restart is necessary since contrary to USB the host will not notice when a UDP server disappears. Signed-off-by: Edmund Henniges Signed-off-by: Daniel Glöckner --- common/fastboot.c | 3 + include/fastboot.h | 1 + include/fastboot_net.h | 12 + net/Kconfig| 18 ++ net

[PATCH v2 10/10] fastboot: don't close fd 0 when downloading to ram

2020-05-14 Thread Daniel Glöckner
When downloading to a buffer, download_fd is never assigned a valid file descriptor. We should therefore avoid calling close on the value found in that variable. Signed-off-by: Daniel Glöckner --- common/fastboot.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common

[PATCH v2 03/10] poller: adapt remaining users to API change

2020-05-14 Thread Daniel Glöckner
poller_register now has a second parameter. Signed-off-by: Daniel Glöckner --- arch/arm/boards/mioa701/gpio0_poweroff.c | 2 +- arch/arm/boards/sama5d3xek/init.c| 2 +- drivers/net/usb/ax88179_178a.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch

[PATCH v2 04/10] Introduce idle slice

2020-05-14 Thread Daniel Glöckner
it is doing that outside of any command. Code that wants to depend on the idle slice must select CONFIG_IDLE_SLICE to make it available. Signed-off-by: Daniel Glöckner --- common/Kconfig | 4 common/binfmt.c| 3 +++ common/command.c | 3 +++ c

[PATCH v2 02/10] net: fixed-link phys are never acquired

2020-05-14 Thread Daniel Glöckner
Fixed-link phys have their bus field set to NULL. This causes a crash when phy_acquired tries to check the slice of the bus. Signed-off-by: Daniel Glöckner --- include/linux/phy.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/phy.h b/include/linux/phy.h index

[PATCH v2 01/10] Remove CONFIG_SLICE

2020-05-14 Thread Daniel Glöckner
Since we are unconditionally compiling and linking the slice code, it does not make sense to have a config option that depends on CONFIG_POLLER. The CONFIG_SLICE option was also broken because it was missing the "bool" line to denote its type. Signed-off-by: Daniel Glöckner --- comman

Re: [PATCH 03/11] Introduce slices

2020-05-08 Thread Daniel Glöckner
t; obj-$(CONFIG_AUTO_COMPLETE) += complete.o > obj-y+= version.o the Kconfig logic doesn't make sense to me. slice.o gets built regardless of CONFIG_SLICE and it will still compile and link when CONFIG_POLLER is disabled. On the other hand poller.o will fai

Re: [PATCH 19/19] poller: Allow to run pollers inside of pollers

2020-05-08 Thread Daniel Glöckner
't have time back then, but I'm looking into it right now. Best regards, Daniel -- Dipl.-Math. Daniel Glöckner, emlix GmbH, http://www.emlix.com Fon +49 551 30664-0, Fax +49 551 30664-11, Gothaer Platz 3, 37083 Göttingen, Germany Sitz der Gesellschaft: Göttingen, Amts

Re: [PATCH 19/19] poller: Allow to run pollers inside of pollers

2020-04-07 Thread Daniel Glöckner
Hello Sascha, Am 03/16/20 um 09:04 schrieb Sascha Hauer: > On Thu, Mar 12, 2020 at 11:36:15PM +0100, Daniel Glöckner wrote: >> On Thu, Mar 12, 2020 at 09:35:55AM +0100, Sascha Hauer wrote: >>> This adds a slice to each poller which is acquired before the poller is >>>

Re: [PATCH 19/19] poller: Allow to run pollers inside of pollers

2020-03-12 Thread Daniel Glöckner
ommand executes. Best regards, Daniel -- Dipl.-Math. Daniel Glöckner, emlix GmbH, http://www.emlix.com Fon +49 551 30664-0, Fax +49 551 30664-11, Gothaer Platz 3, 37083 Göttingen, Germany Sitz der Gesellschaft: Göttingen, Amtsgericht Göttingen HR B 3160 Geschäftsführung: Heike Jordan, Dr. Uwe

Re: [PATCH 05/16] Introduce slices

2020-03-12 Thread Daniel Glöckner
On Thu, Mar 12, 2020 at 09:24:59AM +0100, Sascha Hauer wrote: > On Thu, Mar 12, 2020 at 12:51:54AM +0100, Daniel Glöckner wrote: > > Hello Sascha, > > > > On Wed, Mar 11, 2020 at 03:27:46PM +0100, Sascha Hauer wrote: > > > +/** > > > + * slic

Re: [PATCH 05/16] Introduce slices

2020-03-11 Thread Daniel Glöckner
; + if (slice_acquired(se->slice)) { > + ret = true; > + break; > + } > + > + slice->acquired = acquired; no need to restore slice->acquire from acquired since acquired must have been zero if we reach this line. Best regards, D

Re: [PATCH 0/3] Support for fastboot over UDP

2020-03-09 Thread Daniel Glöckner
Am 03/09/20 um 08:14 schrieb Sascha Hauer: > On Fri, Feb 28, 2020 at 09:48:20PM +0100, Daniel Glöckner wrote: >> Contrary to U-Boot it does not send keep alive messages every 30 >> seconds because everything is executed from a poller. > > How does that prevent you fro

Re: [PATCH 1/8] Introduce slices

2020-03-09 Thread Daniel Glöckner
if (slice_acquired(se->slice)) > + return true; > + > + return false; > +} It would be nice if this function was able to detect cyclic dependencies if DEBUG. This can be done by setting slice->acquired to INT_MIN while recursing and checking if any of th

Re: [PATCH 2/3] fastboot net: implement fastboot over UDP

2020-03-05 Thread Daniel Glöckner
nning. The keep alives would then be sent from another poller. Hm, I think I'll rewrite fastboot_poll to return while waiting for more download data. Then only the command execution can trigger a watchdog reset. Best regards, Daniel -- Dipl.-Math. Daniel Glöckner, emlix GmbH, http://www.emlix.com

[PATCH 3/3] fastboot net: workaround for receiving before sending

2020-02-28 Thread Daniel Glöckner
: Daniel Glöckner --- include/net.h | 1 + net/eth.c | 2 +- net/fastboot.c | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/net.h b/include/net.h index 6912a557b..b9b821c9a 100644 --- a/include/net.h +++ b/include/net.h @@ -83,6 +83,7 @@ int eth_set_ethaddr(struct

[PATCH 2/3] fastboot net: implement fastboot over UDP

2020-02-28 Thread Daniel Glöckner
restart is necessary since contrary to USB the host will not notice when a UDP server disappears. Signed-off-by: Edmund Henniges Signed-off-by: Daniel Glöckner --- common/fastboot.c | 3 + include/fastboot.h | 1 + include/fastboot_net.h | 12 ++ net/Kconfig| 17 ++ net

[PATCH 0/3] Support for fastboot over UDP

2020-02-28 Thread Daniel Glöckner
e everything is executed from a poller. The timeout of Google's fastboot tool is 60 seconds. The third patch was necessary to allow network interfaces to be activated without sending packets. The fastboot code sends packets only in reply to received packets. Daniel Glöckner (1): fastboot

[PATCH 1/3] fastboot: split generic code from USB gadget

2020-02-28 Thread Daniel Glöckner
*fb. Signed-off-by: Edmund Henniges Signed-off-by: Daniel Glöckner --- common/Kconfig | 35 ++ common/Makefile | 1 + common/fastboot.c | 955 +++ drivers/usb/gadget/Kconfig | 3 +- drivers/usb/gadget