mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <sha@pengutronix.de>
To: Antony Pavlov <antonynpavlov@gmail.com>
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>,
	Dan Shelton <dan.f.shelton@gmail.com>,
	barebox@lists.infradead.org
Subject: Re: NFSv4 boot support?
Date: Wed, 28 Feb 2024 13:27:29 +0100	[thread overview]
Message-ID: <Zd8msfj8-L4Y9YZL@pengutronix.de> (raw)
In-Reply-To: <20240228145058.1df54e06780cdb4060fce1d7@gmail.com>

On Wed, Feb 28, 2024 at 02:50:58PM +0300, Antony Pavlov wrote:
> On Wed, 28 Feb 2024 10:20:27 +0100
> Sascha Hauer <sha@pengutronix.de> wrote:
> 
> 
> Hi Sascha!
> 
> > On Wed, Feb 28, 2024 at 10:26:15AM +0300, Antony Pavlov wrote:
> > > On Sat, 17 Feb 2024 09:51:02 +0100
> > > Ahmad Fatoum <a.fatoum@pengutronix.de> wrote:
> > > 
> > > Hi All!
> > > 
> > > > Hello Antony,
> > > > 
> > > > On 05.02.24 10:59, Antony Pavlov wrote:
> > > > > On Wed, 31 Jan 2024 22:37:50 +0100
> > > > > Ahmad Fatoum <a.fatoum@pengutronix.de> wrote:
> > > > > 
> > > > > Hi All!
> > > > > 
> > > > >> Hello Dan,
> > > > >>
> > > > >> On 31.01.24 22:03, Dan Shelton wrote:
> > > > >>> Hello!
> > > > >>>
> > > > >>> Does barebox support booting from a NFSv4 filesystem, e.g. boot from
> > > > >>> NFSv4 filesystem into a Linux NFSv4 netroot (diskless machine)?
> > > > >>
> > > > >> The barebox network stack only does UDP/IP. There have been attempts to
> > > > >> bring a TCP stack into barebox, but none have so far succeeded to
> > > > >> make it mainline. This is a hard requirement before we can consider
> > > > >> supporting NFSv4. I hope that lwIP could fill this gap in the future,
> > > > >> but no one is actively continuing this work as far as I am aware[1].
> > > > > 
> > > > > I have started integration on picotcp into barebox in 2015, see
> > > > >   https://lore.barebox.org/barebox/1436991230-14251-10-git-send-email-antonynpavlov@gmail.com/T/
> > > 
> > > Actually I made the first attempt to integrate picotcp into barebox in 2014,
> > > see http://lists.infradead.org/pipermail/barebox/2014-May/019243.html
> > > 
> > > 10 years is too long for this task :)
> > > 
> > > In the message http://lists.infradead.org/pipermail/barebox/2015-July/024244.html
> > > if I understand correctly Sascha asked me to keep network stuff
> > > users (tftp, nfs, netconsole) as intact as possible.
> > > 
> > > At the moment I understand that this task is too hard.
> > > 
> > > The problem is: the network stuff users don't rely on "a network stack"
> > > in the true sense. E.g. tftp_handler() takes an ETHERNET PACKET on
> > > it's input, tftp_handler() skips Ethernet and IP stuff by itself
> > > and modifies UDP fields directly!
> > > 
> > > This week I have connected picotcp code to the existing network code
> > > in the way that makes it possible to keep dhcp_handler() and
> > > ftp_handler() intact. The result is ugly: barebox netdevice driver
> > > receives frame from network, pass it to picotcp, picotcp parses
> > > network protocol headers and extracts udp payload, next
> > > picotcp passes udp payload back to my picotcp-to-barebox adapter,
> > > the adapter RECONSTRUCTS ETHERNET PACKET and give it to tftp/dhcp_handler()!
> > > This horrible approach creates more problems than it solves!
> 
> > So if I understand correctly you tried passing *all* incoming packets to
> > picotcp and route some of them back to the barebox network stack.
> 
> for every barebox network device I create picotcp network device
> which can send packets by picotcp initiative.
> net_receive() just calls pico_stack_recv() with corresponding
> picotcp network device as an argument, so no code change in drivers/net/.
> net_poll() just calls pico_stack_tick().
> So all incoming packets go to picotcp only.
> Picotcp can send packet if necessary without barebox interraction.
> 
> UDP datagrams processed by picotcp routed to corresponding dhcp/tftp_handler().
> Are dhcp/tftp_handlers parts of barebox network stack?
> 
> > Instead of passing all packets to picotcp, can't we just dispatch the
> > incoming packets on a per-port basis in barebox and only pass the ones
> > picotcp shall handle to picotcp?
> 
> Good idea. I have to try. We can reroute IPv6 traffic to picotcp in net_receive()
> and reroute TCP/IPv4 traffic to picotcp in net_handle_ip().

You could route all TCP to picotcp. Also everything that falls through
net_handle_udp() can be routed to picotctp as well.

> 
> > So basically a struct net_connection with the handler set to the picotcp
> > receive function?
> 
> net_connection handler is set to the normal unamended dhcp/tftp_handlers.
> 
> > That way it might be possible to have the barebox network stack and
> > picotcp in parallel and port the handlers over to pictotcp one by one.
> 
> But I see a problem here. If there is a ARP respond in the incoming traffic
> I have no idea there to send it. Both barebox network code and picotcp
> can make ARP request. I suppose can just route ARP respond to the both stacks.

Yes, sending it to both stacks should be fine. When a response is coming
in and nobody wait for it then both barebox and picotctp should just
discard it.

> 
> But what I have to do if an ARP or ICMP echo __request__ is received?

Should go to only one of both stacks, otherwise we would get duplicate
ping responses.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



  reply	other threads:[~2024-02-28 12:28 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-31 21:03 Dan Shelton
2024-01-31 21:37 ` Ahmad Fatoum
2024-02-05  9:59   ` Antony Pavlov
2024-02-17  8:51     ` Ahmad Fatoum
2024-02-19  2:17       ` Dan Shelton
2024-02-20 14:17         ` Ahmad Fatoum
2024-02-20 15:28           ` Uwe Kleine-König
2024-02-19 21:43       ` Antony Pavlov
2024-02-20 13:53       ` Alessandro Rubini
2024-02-26 12:17         ` Ahmad Fatoum
2024-03-08 10:23         ` Sascha Hauer
2024-03-09 10:01         ` Alessandro Rubini
2024-02-28  7:26       ` Antony Pavlov
2024-02-28  9:20         ` Sascha Hauer
2024-02-28 11:50           ` Antony Pavlov
2024-02-28 12:27             ` Sascha Hauer [this message]
2024-02-05 18:41   ` Antony Pavlov
2024-02-06  4:40     ` Dan Shelton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zd8msfj8-L4Y9YZL@pengutronix.de \
    --to=sha@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=antonynpavlov@gmail.com \
    --cc=barebox@lists.infradead.org \
    --cc=dan.f.shelton@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox