| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
Now that no in-tree user of NetRxPackets remain, no one will miss this
remnant of simpler times.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20240313110704.1095554-8-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
| |
We have a number of drivers that call net_alloc_packet in a loop and
will gain some more in the quest to drop NetRxPackets.
Let's provide a helper that can be used for this and a function to free
the packets as well.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20240313110704.1095554-2-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
| |
Now that we can print MAC addresses using the %pM format specifier we
can get rid of ethaddr_to_string(). Do this treewide.
Link: https://lore.barebox.org/20240202151147.226876-2-s.hauer@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
| |
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
| |
PKTSIZE is used to allocate network packet storage.
Make it fill a cache line so drivers using it don't accidentally flush
adjacent packets.
Suggested-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Link: https://lore.barebox.org/20231201-v2023-08-0-topic-macb-v4-3-b4f5d64de1ad@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Especially during development, devices often lack a MAC address. While a
MAC address can be easily added to the environment:
nv dev.eth0.ethaddr="aa:bb:cc:dd:ee:ff"
It's easily lost when flashing complete new images, e.g. from CI.
Make the development experience neater by deriving a stable MAC address
if possible.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20231122094747.340825-3-uwe@kleine-koenig.org
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
| |
Linux has a number of helpers to do arithmetic on Ethernet addresses,
which are useful for generating sequential MAC addresses. Import them.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20230911155927.3786335-2-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The respective U-Boot commit was ported to Barebox in commit
0b5d36d77b6022bd1f40 (2023-07-27, Sascha Hauer: "Add SPDX License
identifier for files originating from LiMon"), but the U-Boot change was
already made in 2014, and the SPDX specification was updated since then
and deprecated the "GPL-2.0" identifier in favour of "GPL-2.0-only".
Update the license identifiers to SPDX 3.0 specification, which we also
use everywhere else in the Barebox code.
Signed-off-by: Roland Hieber <rhi@pengutronix.de>
Link: https://lore.barebox.org/20230804094650.2094025-1-rhi@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The header of some LiMon imported files reference a License file which
does not exist in barebox.
These files were originally licensed under GPLv2 as can be seen in this
U-Boot commit:
| commit 2ea9103924048637d28baf0f7b1dd410f6704c32
| Author: Wolfgang Denk <wd@denx.de>
| Date: Tue Sep 30 10:44:01 2014 +0200
|
| SPDX License cleanup for LiMon imported files
|
| A number of network related files were imported from the LiMon
| project; these contain a somewhat unclear license statement:
|
| Copyright 1994 - 2000 Neil Russell.
| (See License)
|
| I analyzed the source code of LiMon v1.4.2 which was used for this
| import. It does not contain any "License" file, but the top level
| directory contains a file "COPYING", which turns out to be GPL v2
| of June 1991. So it is legitimate to conclude that the LiMon derived
| files are also to be released under GPLv2. Mark them as such.
Based on this commit add the correct SPDX License identifier. While at it
drop the reference to the non-existing License file and also remove the
long unmaintained file history.
Reported-by: Oliver Fendt <ofendt@googlemail.com>
Link: https://lore.barebox.org/20230727101008.3350548-1-s.hauer@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The normal use case for ifup -a is to get *some* interface working and
not really wait for all interfaces to come up and then timeout waiting
for those without link up to never get a DHCP lease.
When using automounts with a previously empty $global.net.server, we
know this to be the case, because the first DHCP interface will set the
variable and all remaining ones won't affect this. Therefore, let's add
a ifup -a1 option, which would stop after $global.net.server was set via
DHCP. This is a special case of a possible future ifup -ar, which would
check after each ifup if $global.net.server was either newly set or
became resolvable, but that would be a bigger change, so we skip that
for now.
Times after eth_open_all has brought up CPU Ethernet and 4 DSA ports:
barebox$ time ifup -a
time: 10002ms
barebox$ time ifup -a1
time: 1072ms
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20230130072057.34349-3-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
DHCP is usually fairly quick, but link up check timeout is 10 seconds,
which adds up, especially on systems with bigger DSA switches.
The workaround is to set ethX.mode=disabled for other ports, but let's
improve the default a bit and have barebox poll link ups in parallel, so
instead of (number_of_ports_wihout_link * 10s), we just wait 10s at
most.
For setups where this is a problem, users may revert to ifup in sequence
by doing ifup -a -s.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20230130072057.34349-2-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
| |
This imports the Linux v6.1 state of the driver into barebox. This has
been tested with the RTL8365MB in (bitbanged) SMI mode.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20230116134501.2006391-10-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The '_d' suffix was originally introduced in case we want to import
Linux struct device as a separate struct into barebox. Over time it
became clear that this won't happen, instead barebox struct device_d
is basically the same as Linux struct device. Rename the struct name
accordingly to make porting Linux code easier.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
Link: https://lore.barebox.org/20221214123512.189688-3-s.hauer@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
| |
This configuration is mostly needed for controllers attached to switches
with different MAC address configurations or for debugging networking
issues.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://lore.barebox.org/20221108061009.4168735-1-o.rempel@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
So far we only bring up network interfaces when we actually need them.
This means we could be idling in the shell for long and once the user
decides to do networking he has to wait for the link to be established.
We can do better: Before going interactive bring up all known network
interfaces which makes the links established when the user needs them.
To implement this we have to rework carrier checking a bit, because
otherwise barebox would wait for the links to be established before
continuing.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
| |
network packets are often DMAed by the network drivers, so allocate
them with dma_alloc() rather than assuming that an arbitrarily chosen
alignment is sufficient
This fixes network transfers on a Rockchip RK3568 board which
occasionally sent out packets with corrupt data.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
| |
It is kind of tcpdump or tshark for barebox. Instead of starting
application it will let barebox dump everything to the console by still
allowing to use other application.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://lore.barebox.org/20220413082205.429509-15-o.rempel@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
| |
For DSA support we need to find MAC node by phandle from the switch port
node. So, provide of_find_eth_device_by_node() to solve this task.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://lore.barebox.org/20220413082205.429509-3-o.rempel@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
| |
Add callback for optional rx_preprocessor. This is needed to add DSA
switch support and demultiplex traffic received from different switch ports.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://lore.barebox.org/20220413082205.429509-2-o.rempel@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
| |
Add ethernet code safe for being called from a poller.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
| |
ifdown is the counterpart to ifup and disables one or all ethernet
interfaces.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
| |
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 <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The resolv() function used to return the IP address. When net_udp_new()
fails we return an error code though which the callers of resolv() take
as an IP address. This is wrong of course and we could return 0 in this
case. Instead we return an error code and pass the resolved IP as a
pointer which allows us to return proper error codes.
This patch also adds error messages and error returns to the various
callers of resolv() which used to just continue with a zero IP and
let the user figure out what went wrong.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When you have a static network environment but more than one network
device on your machine it is necessary to provide the <device> parameter
to the ip parameter at kernel cmd line.
The device name assigned by Linux cannot in general be predicted as it
depends on driver bind order.
This patch introduces a new property linux.devname to eth devices.
The value is added to bootargs per interface and can be changed in
env/network/INTF
Based on patch by Gavin Schenk <g.schenk@eckelmann.de>.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This provides a new way to configure network interfaces based
on nvvars. A network interface can now be configured with variables
in the nv.dev.<ethname>.* namespace. There is a new network device
parameter "mode" which specifies the mode used to obtain IP settings.
The mode can be "dhcp", "static" or "disabled":
nv.dev.eth0.mode=dhcp
(ipaddr, netmask are ignored in this setting)
nv.dev.eth0.mode=static
nv.dev.eth0.ipaddr=192.168.0.17
nv.dev.eth0.netmask=255.255.0.0
nv.dev.eth0.mode=disabled
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
| |
Now that we can do routing we no longer need a "current"
network device. Remove it.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
| |
The IP/netmask/gateway settings contain all informations
needed to pick the correct network device. This patch
adds support for that and makes specifying the "current"
network interface using the ethact command unnecessary.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
| |
Instead of allowing to DHCP only on the "current" network
device, allow to specify the desired network device. This
is a first step to get rid of the concept of a "current"
network device.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
| |
This allows the DHCP code to configure specific network
devices so that DHCP no longer depends on any "current"
network device.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There is not much point in having a network device specific
gateway. If barebox really is part of such a complicated network
in which it needs multiple gateways, then we probably need a
real routing table. Until this happens, a single gateway should
be enough.
This introduces global.net.gateway which holds the gateway ip. The
previously used device specific <ethx>.gateway variables still exist,
but are only aliases for the single gateway.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some DHCP servers provide the wrong serverip in which case
it is desired to specify it manually and won't let the dhcp
command overwrite it.
This has previously been done by setting the serverip again
to the desired value after dhcp has been executed. With this
patch we do not overwrite it in the first place if it is valid
already. This is necessary when the serverip is not set via
/env/network/eth* but via nv.net.server.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
| |
The server to use is independent of the network device, there is
not much point to make the server specific to a network device.
This introduces global.net.server as the serverip which is
used as standard NFS/tftp server. The previously used eth
device specific parameters still exist, but are only aliases
for the global single variable.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
| |
It's more convenient to have getter/setter functions for
variables rather than using the detour around global vars
which use string matching and all kinds of overhead in the
background.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
| |
Rather than using the hardcoded value 0xffffffff in several places
add a define for the broadcast IP.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This sets a `ip=dhcp` or
`ip=<clientip>:<serverip>:<gatewayip>:<netmaskip>::<iface>:` bootarg for
the network device upon execution of 'ifup'. This is the only point
where we can distinguish between a static ip and a dhcp-based network
setup and thus set a valid bootarg options as it will be required for
nfs boot, for example.
Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
| |
Convert users of ip_to_string() and print_IPaddr() to %pI4 and
remove the now unused functions.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
| |
Using dev_name often is not a good idea since it's a statically
allocated string which gets overwritten by later calls to dev_name.
Add a devname string to struct eth_device to have the name available
for later use.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
| |
for_each_netdev is nicer to read. Also export the list of network
devices since it will be used by code outside of net/eth.c in later
patches.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
| |
resolv() is not allowed to change the hostname argument, make it const.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
| |
commit d00db554 introduce ethaddr_param. But it is not initialized, so
devinfo fails to show the mac. Remove it and use edev->ethaddr.
Signed-off-by: Jan Remmet <j.remmet@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
| |
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
| |
register_preset_mac_address only works when CONFIG_PARAMETER
is enabled because otherwise dev_set_param is a no-op. Add a
function to set the MAC address explicitly without the need
of CONFIG_PARAMETER and use it where appropriate.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
| |
The set_ethaddr callback should not modify the MAC address passed to it, so
make it const.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
| |
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In barebox network packets always go out at the current ethernet
device and are expected to be received from the current interface.
This has some side effects. When for example an NFS is mounted when
one interface is active and the interface is changed afterwards the
NFS packets leave the new interface, but the NFS server won't be
reachable there.
Instead of changing the whole network traffic to the current ethernet
interface we now initialize a network connection with the current
network interface, but then the connection will continue to use that
interface even when the current interface is changed.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
| |
So that barebox has the information which interface a packet
came from.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
| |
The defaultenv-2 has ifup support as a shell script. This patch
replaces it with a command which is more robust, can be called
from C and now can also bring up all configured interfaces.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
| |
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
| |
This is needed for nfs3 support as some types became bigger compared to
nfs2.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On some architectures (e.g. alpha, amd64, arm64, ia64, s390x, mips64)
sizeof(ulong) is 8 which made net_read_uint32 actually read too much and
even returned the wrong value on big endian machines.
(Note the second issue isn't that critical though, because the only
architecture from the list above that uses big endian byte order is s390x
...)
Also change the argument to void * because the pointer is not necessarily
properly aligned.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|