9
0
Fork 0
Commit Graph

90 Commits

Author SHA1 Message Date
Antony Pavlov c0808d7b69 net.h: add ETH_ALEN constant; fix whitespaces
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-07-02 07:47:58 +02:00
Sascha Hauer be0404c21f net: Allow to use multiple network interfaces at once
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>
2014-05-15 08:16:30 +02:00
Sascha Hauer 22b878d251 net: Pass eth_device to net_receive
So that barebox has the information which interface a packet
came from.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-15 08:15:21 +02:00
Sascha Hauer a162dfe503 net: Add ifup support
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>
2014-03-07 07:41:36 +01:00
Sascha Hauer 72dfc499c8 net: constify eth_get_byname argument
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-03-07 07:41:31 +01:00
Uwe Kleine-König b104688cbb net: new function net_read_uint64
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>
2014-02-10 09:02:20 +01:00
Uwe Kleine-König 47eb6b50bb net: net_read_uint32: assert that only 32 bit are read
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>
2014-02-10 09:02:20 +01:00
Sascha Hauer f696692b87 net: Set mac-address property
Linux normally has no idea how to retrieve MAC Addresses, but instead
expects the MAC address in the devicetree. This patch adds the MAC
address to the devicetree for Linux if we find a valid one in barebox.
This mechanism is limited of course to devices barebox has a driver for
and which are probed themselves from the devicetree.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-05 08:53:43 +02:00
Sascha Hauer 064fdcec9f Merge branch 'for-next/imx-oftree'
Conflicts:
	arch/arm/boards/freescale-mx51-pdk/board.c
2013-06-02 12:36:38 +02:00
Sascha Hauer b381e781bf treewide include/: Add missing includes
This adds several missing includes to files under include/ which
we relied on being included implicitly.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-31 08:32:59 +02:00
Sascha Hauer 2995752d75 net: Add of_register_ethaddr
We already have a possibility to register a MAC address provider
based on a ethernet device id. This adds a similar functionality
for devices probed from devicetree. Code can register itself to
be a MAC address provider for a certain devicetree node.

This helps on i.MX to let the IIM unit provide a MAC address for
the FEC.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-21 09:36:27 +02:00
Sascha Hauer 6d0161d02a net: store ethernet device parameters in device
Rather than storing the parameters globally and trying to keep them
in sync with the device parameters, store the parameters in the ethernet
device directly. Also, update to dev_add_param_ip().

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-11 11:48:34 +02:00
Sascha Hauer b5f4213be6 net: remove unused prototypes for eth_[open|halt]
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-27 23:55:16 +02:00
Jean-Christophe PLAGNIOL-VILLARD 2263e27814 net: introduce phylib
Adapt phylib from linux

switch all the driver to it
reimplement mii bus

This will allow to have
 - phy drivers
 - to only connect the phy at then opening of the device
 - if the phy is not ready or not up fail on open

Same behaviour as in linux and will allow to share code and simplify porting.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-09-25 08:18:58 +02:00
Johannes Stezenbach 69e07e2afb eth: eth MAC addresses are six bytes
Reduce confusion by making clear six bytes are passed,
not a string.

Signed-off-by: Johannes Stezenbach <js@sig21.net>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-06-30 13:58:18 +02:00
Eric Bénard b63352f38a iim: fix compilation when NET is not selected
Signed-off-by: Eric Bénard <eric@eukrea.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-05-18 11:25:05 +02:00
Sascha Hauer 158294a49a net: remove unused getenv_ip_dns
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-15 16:26:07 +02:00
Sascha Hauer 9d699b790c net: use static string in string_to_ip
Simplify usage of ip_to_string by using a static string.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-15 15:05:38 +02:00
Wolfram Sang 56f6bfb820 net: arp_request: do not retry endlessly
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-05 08:56:03 +02:00
Jean-Christophe PLAGNIOL-VILLARD 9c29dab5aa net: env: getenv_ip use resolv
Introduce getenv_ip_dns to be able to do not do the resolv when using it in
resolv for the nameserver (Do not loop).

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-04-03 11:39:29 +08:00
Sascha Hauer 67d938b2ea net: use container_of instead of dev->type_data
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-02-25 15:16:22 +01:00
Sascha Hauer 31078e0839 net: let net_udp_get_payload return void *
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-02-19 18:51:03 +01:00
Sascha Hauer 6d16fbdcd4 net: make the ethernet device a child of the hardware device
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-08-15 09:48:03 +02:00
Sascha Hauer c46b04542f net: Add a possibility for boards to give network devices a MAC address
MAC addresses are sometimes stored at unusual places. This
patch makes it possible to give a MAC address to a ethernet
device id. This is independent of the device actually being
present.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-07-29 12:05:26 +02:00
Sascha Hauer 9a4abe67ff net: remove unused fields from struct eth_device
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-07-29 12:03:07 +02:00
Sascha Hauer c75ab78763 net: add a context to the packet handler
This is not yet used, but with this the different network
commands can get rid of their global data.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-12 09:54:56 +02:00
Krzysztof Halasa c5baa0edc4 Fix error handling with malloc, memalign etc. Introduce xmemalign().
The idea is to panic() when there is no memory available for normal
operation. Exception: code which can consume arbitrary amount of RAM
(example: files allocated in ramfs) must report error instead of panic().

This patch also fixes code which didn't check for NULL from malloc() etc.

Usage: malloc(), memalign() return NULL when out of RAM.
xmalloc(), xmemalign() always return non-NULL or panic().

Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-01-07 10:21:22 +01:00
Krzysztof Halasa 8f0daf3a7d Remove unused eth_get_name() prototype.
Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-12-21 09:02:40 +01:00
Sascha Hauer 32558d1ae5 LED: Add LED trigger support
This patch allows to associate LEDs with certain triggers, such
as heartbeat or network activity.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-12-20 09:57:35 +01:00
Sascha Hauer 7867ceb8dc net: implement random_ether_addr
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-06-22 15:44:44 +02:00
Sascha Hauer 738d70e430 include support for a simple pseudo number generator
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-06-22 15:44:44 +02:00
Sascha Hauer cd81aa6e3b net: add dns support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-06-17 08:28:29 +02:00
Sascha Hauer c3789cd49b rework device parameters
Change device parameters so that the memory management is in generic
code. This also removes the need of storing statically initialized
parameters as they are stored in a struct list_head for each device.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-06-17 08:28:25 +02:00
Sascha Hauer 57e1fc33bd net: remove old network stack
All network commands now use the new stack, so remove the old one.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-06-17 08:28:25 +02:00
Sascha Hauer 97070487fa net: Implement a new network stack
The old network stack has some bad limitations:

- network commands are required to call NetLoop() which only returns when
  the network layer wants to. Instead we now use a net_poll() function which
  returns after handling one packet (or immediately if no packet is
  available).
- There can be only one packet handler which makes it impossible to handle
  multiple connections
- CamelCaseMakesItHardToRead

The new network stack is implemented as a parallel universe. Currently all
commands still use the old stack. They are converted in subsequent patches.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-06-17 08:28:16 +02:00
Sascha Hauer 994f95c073 net: remove need for eth_halt/eth_open
We used to eth_open/eth_halt the network devices during NetLoopInit
which is called whenever the user enters a network command.
Change this behaviour so that the current network device gets opened
when making it the current one.
With this change it's always possible to send packages and we are able
to implement a new network stack in the next step.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-06-17 08:28:16 +02:00
Sascha Hauer d2a58c2173 remove unused cdp code
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-01-25 08:30:53 +01:00
Sascha Hauer 2dc2132f0e remove global variable BootFile
Signed-off-by: Sascha Hauer <sha@pengutronix.de>
2009-10-19 10:18:51 +02:00
Sascha Hauer a5f301fb7a remove unused variable NetBootFileSize
Signed-off-by: Sascha Hauer <sha@pengutronix.de>
2009-10-17 08:54:57 +02:00
Sascha Hauer 146f9b6e5b remove sntp support. Has been broken for long enough
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-10-13 11:19:28 +02:00
Sascha Hauer faa61661cf only the ping code is interested in the ping ip
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-10-13 11:02:15 +02:00
Sascha Hauer 8c17c465d6 make netboot_common a global function
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-10-13 10:57:41 +02:00
Sascha Hauer a3a5927110 net: remove switch/case in NetLoop()
Instead of having a big switch/case for every protocol, do
the right things in the individual functions before callong
NetLoop().

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-10-13 10:57:40 +02:00
Sascha Hauer 9296260a78 net: split NetLoop in NetLoop and NetLoopInit
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-10-13 10:49:21 +02:00
Sascha Hauer 3487f1ee8e net: remove unused state NETLOOP_RESTART
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-10-13 10:48:56 +02:00
Sascha Hauer 2f8df2a003 add a device_d to ethernet devices
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-07-21 16:41:46 +02:00
Sascha Hauer bac65c6cde net: Get rid of DEVICE_TYPE_ETHER usage
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-07-21 16:41:45 +02:00
Sascha Hauer 2230eea29b net: add eth_unregister function
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-04-07 10:42:33 +02:00
Sascha Hauer c0d02ffc3d Fix string_to_ip
Use a pointer to an ip address instead of the return value in string_to_ip
and use the return value for error indication only. 0.0.0.0 can be a valid
ip address

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2008-08-20 17:46:47 +02:00
Sascha Hauer 33c488f8c1 net: remove unused function declarations
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2008-08-20 13:16:03 +02:00