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

2020-03-12 Thread Daniel Glöckner
Hello Sascha, 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 > executed. This allows us to run pollers inside of other pollers. ok, so in the UDP fastboot case there is now a poller that receives packets and

[RFC] serial: ns16550: select default pinctrl state

2020-03-12 Thread Peter Mamonov
Signed-off-by: Peter Mamonov --- drivers/serial/serial_ns16550.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c index 3edeb0dcb..6b5e92c13 100644 --- a/drivers/serial/serial_ns16550.c +++ b/drivers/serial/serial_ns16550.c @

[PATCH] pinctrl-single: fix parsing of `pinctrl-single, bits` property

2020-03-12 Thread Peter Mamonov
According to dts/Bindings/pinctrl/pinctrl-single.txt:113 the correct order of parameters is . Fixes: f7e0cae43 ('pinctrl-single: Handle "pinctrl-single,function-mask" dt property') Signed-off-by: Peter Mamonov --- drivers/pinctrl/pinctrl-single.c | 2 +- 1 file changed, 1 insertion(+), 1 deleti

Re: [PATCH 05/16] Introduce slices

2020-03-12 Thread Sascha Hauer
On Thu, Mar 12, 2020 at 10:18:10AM +0100, Daniel Glöckner wrote: > 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: > > >

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: > > > +/** > > > + * slice_acquired: test if a slice is acquired > > > + * @slice

[PATCH 01/19] net: fec_imx: Do not clear MII interrupt during receive

2020-03-12 Thread Sascha Hauer
fec_recv() can be triggered during a MDIO access. so we may not clear the FEC_IEVENT_MII interrupt the MDIO access is waiting for. Clearing it in that moment causes the MDIO access to timeout. Signed-off-by: Sascha Hauer --- drivers/net/fec_imx.c | 1 + 1 file changed, 1 insertion(+) diff --git

[PATCH 15/19] net: phy: Also print link down messages

2020-03-12 Thread Sascha Hauer
Not only print when the link comes up, but also when it goes down. Signed-off-by: Sascha Hauer --- drivers/net/phy/phy.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index ccdc9f3716..a440edffd6 100644 --- a/drivers/net/ph

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

2020-03-12 Thread 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 against this: - lower the

[PATCH v3 00/19] Protect code from pollers

2020-03-12 Thread Sascha Hauer
Changes since v2: - Use a const char * as name argument and not a struct device_d. A name is more universally available - Also give pollers names for better debugability - Add a poller command to show information about registered pollers - Add Kconfig entries for both poller and slice commands -

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

2020-03-12 Thread 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 | 15 +++ include/poller.h | 2 ++ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a

[PATCH 09/19] net: mdiobus: Add slice

2020-03-12 Thread 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 | 41 ++ include/linux/phy.h| 38 ++- 2 files changed, 56 insertions(+

[PATCH 06/19] poller: Add a poller command

2020-03-12 Thread Sascha Hauer
The poller command allows to print which pollers are registered and also how many times we can run the registered pollers in one second. Signed-off-by: Sascha Hauer --- commands/Kconfig | 9 ++ common/poller.c | 71 2 files changed, 80 inser

[PATCH 17/19] net: phy: Do not claim the link is up initially

2020-03-12 Thread Sascha Hauer
A freshly created phy device doesn't have the link up, so drop setting phydev->link to one initially. Signed-off-by: Sascha Hauer --- drivers/net/phy/phy.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index a440edffd6..57c2f8044f 100644 --- a/d

[PATCH 16/19] net: ifup command: add ethernet device completion

2020-03-12 Thread Sascha Hauer
ifup usually takes an ethernet device, so use ethernet device completion for the command. Signed-off-by: Sascha Hauer --- net/ifup.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/ifup.c b/net/ifup.c index e5e8ef2346..fa2c52ff8b 100644 --- a/net/ifup.c +++ b/net/ifup.c @@ -21,6 +21,7

[PATCH 08/19] net: Add a slice to struct eth_device

2020-03-12 Thread Sascha Hauer
Add ethernet code safe for being called from a poller. Signed-off-by: Sascha Hauer --- include/net.h | 8 net/eth.c | 20 +--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/include/net.h b/include/net.h index 509d1b38a1..70d3ce2849 100644 --- a/inc

[PATCH 10/19] usb: Add a slice to usb host controllers

2020-03-12 Thread Sascha Hauer
Signed-off-by: Sascha Hauer --- drivers/usb/core/usb.c | 6 ++ include/usb/usb.h | 7 +++ 2 files changed, 13 insertions(+) diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 1c3dcb79a8..bc122f7d7a 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c @@ -

[PATCH 04/19] net: Open ethernet devices explicitly

2020-03-12 Thread Sascha Hauer
Open ethernet devices explicitly rather than implicitly when sending packets. This allows us to not only enable, but in the next step to also disable ethernet devices. Signed-off-by: Sascha Hauer --- include/net.h | 3 ++- net/dhcp.c| 4 net/eth.c | 55 ++--

[PATCH 02/19] miitool: Use mdiobus_read()

2020-03-12 Thread Sascha Hauer
Use mdiobus_read() to read from the mii bus. Accessing the read hook directly bypasses the acquiring the slice. Signed-off-by: Sascha Hauer --- commands/miitool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/commands/miitool.c b/commands/miitool.c index a87d567ace..074

[PATCH 05/19] poller: Give pollers a name

2020-03-12 Thread Sascha Hauer
It helps debugging when pollers have a name, so give them one. Signed-off-by: Sascha Hauer --- common/poller.c| 8 +--- common/ratp/ratp.c | 2 +- drivers/input/gpio_keys.c | 2 +- drivers/input/imx_keypad.c | 2 +- drivers/input/input.c | 2 +-

[PATCH 12/19] net: Call net_poll() in a poller

2020-03-12 Thread 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 that we have it runnin

[PATCH 18/19] net: Add ifdown support and command

2020-03-12 Thread Sascha Hauer
ifdown is the counterpart to ifup and disables one or all ethernet interfaces. Signed-off-by: Sascha Hauer --- include/net.h | 4 +++ net/ifup.c| 69 +++ 2 files changed, 73 insertions(+) diff --git a/include/net.h b/include/net.h index 23e37

[PATCH 03/19] net: phy: mdio-mux: Use mdiobus_read/write()

2020-03-12 Thread Sascha Hauer
Using the callbacks directly bypasses acquiring the slice. Signed-off-by: Sascha Hauer --- drivers/net/phy/mdio-mux.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/phy/mdio-mux.c b/drivers/net/phy/mdio-mux.c index aa63cbde97..1e6278ef35 100644 --- a/drivers

[PATCH 13/19] net: reply to ping requests

2020-03-12 Thread 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 deletions(-) diff --git a/

[PATCH 11/19] usbnet: Add slice

2020-03-12 Thread 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 index 60e67ff1a2..f1

[PATCH 07/19] Introduce slices

2020-03-12 Thread 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 and then the poller co

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

2020-03-12 Thread Sascha Hauer
On Mon, Mar 09, 2020 at 04:38:05PM +0100, Daniel Glöckner wrote: > 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

Re: [PATCH 05/16] Introduce slices

2020-03-12 Thread Sascha Hauer
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: > > +/** > > + * slice_acquired: test if a slice is acquired > > + * @slice: The slice to test > > + * > > + * This tests if a slice is acquired. Retur