9
0
Fork 0
Commit Graph

400 Commits

Author SHA1 Message Date
Holger Hans Peter Freyther 65cd4bea41 net: Initial frame to be able to send LLDP frames from barebox
Fixes: SYS#488
2014-11-20 21:08:16 +01:00
Sascha Hauer deef1e80f3 Do not use macros in command help
The help texts are parsed by sphinx which cannot handle macros, so
replace them with their values.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-07-08 07:52:36 +02:00
Sascha Hauer 98360be0fe Documentation: remove doxygen documentation
The doxygen documentation is long outdated. Remove it. It will
be replaced with sphinx based documentation later.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-06-26 10:09:52 +02:00
Sascha Hauer 40d89c4977 ifup: Add comment why xxx-discover files have to be skipped
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-06-23 10:05:40 +02:00
Sascha Hauer 096e5c856b net: ifup: skip *-discover files for ifup -a
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-06-23 09:14:31 +02:00
Sascha Hauer a3dfea9af8 Merge branch 'for-next/net'
Conflicts:
	drivers/net/dm9k.c
2014-06-04 21:03:45 +02:00
Holger Schurig 7158ac3f6e net: show enetaddr in lowercase
"ifconfig" and "ip" from normal Linux userspace shows ethernet addresses
normally in lowercase.  And the %pM format specifier in Linux does that,
too. Conform to this custom formatting.

Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-06-02 09:07:12 +02:00
Sascha Hauer 0cf4630cd2 net: take eth id from devicetree alias
If the devicetree has an alias for the ethernet device, then use
it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-15 10:04:51 +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 75482a0663 net: ifup: Set current ethernet device when doing ifup
When doing an ifup set the current interface to the one just
brought up so that it is actually used.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-15 08:15:13 +02:00
Holger Schurig fc0f7eec82 commands: move CMD_IFUP to commands/Kconfig
* this places the command into the "Network commands"
  section of Kconfig
* while at it, improve Kconfig documention

Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-14 10:03:49 +02:00
Holger Schurig c524f74d5b commands: NET_DHCP -> CMD_DHCP
* this compile option actually turns on a command, so name it
  accordingly
* also move the Kconfig definition into commands/Kconfig, thus
  placing getopt into the "Network commands" section
* while at it, improve Kconfig documention

Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-14 10:03:49 +02:00
Holger Schurig 5bd055b660 commands: NET_PING -> CMD_PING
* this compile option actually turns on a command, so name it
  accordingly
* also move the Kconfig definition into commands/Kconfig, thus
  placing getopt into the "Network commands" section
* while at it, improve Kconfig documention

Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-14 10:03:48 +02:00
Holger Schurig 86dda115a7 commands: introduce CMD_HOST
... because NET_RESOLV can be used alone to turn on the functionality
of resolv().

Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-14 10:03:48 +02:00
Holger Schurig f1f532084a commands: harmonize in-barebox documentation
This patch does probably too much, but it's hard (and very
cumbersome/time consuming) to break it out. What is does is this:

* each command has one short description, e.g. "list MUX configuration"
* made sure the short descriptions start lowercase
* each command has one usage. That string contains just the
  options, e.g. "[-npn]". It's not part of the long help text.
* that is, it doesn't say "[OPTIONS]" anymore, every usable option
  is listed by character in this (short) option string (the long
  description is in the long help text, as before)
* help texts have been reworked, to make them
  - sometimes smaller
  - sometimes describe the options better
  - more often present themselves in a nicer format
* all long help texts are now created with BUSYBOX_CMD_HELP_
  macros, no more 'static const __maybe_unused char cmd_foobar_help[]'
* made sure the long help texts starts uppercase
* because cmdtp->name and cmdtp->opts together provide the new usage,
  all "Usage: foobar" texts have been removed from the long help texts
* BUSYBOX_CMD_HELP_TEXT() provides the trailing newline by itself, this
  is nicer in the source code
* BUSYBOX_CMD_HELP_OPT() provides the trailing newline by itself
* made sure no line gets longer than 77 characters
* delibertely renamed cmdtp->usage, so that we can get compile-time
  errors (e.g. in out-of-tree modules that use register_command()
* the 'help' command can now always emit the usage, even without
  compiled long help texts
* 'help -v' gives a list of commands with their short description, this
  is similar like the old "help" command before my patchset
* 'help -a' gives out help of all commands

Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-14 10:03:43 +02:00
Holger Schurig ab23d0bb3f commands: group 'help' output
The old output of "help" was just producing a long list, that usually
scrolled of the screen (even on a X11 terminal). This list is more
compact, and also sorted by groups.

The old output format (plus grouping) is now available with 'help -v'.

Example:

   Information commands:
     ?, devinfo, help, iomem, meminfo, version
   Boot commands:
     boot, bootm, go, loadb, loads, loadx, loady, saves, uimage
   ...

Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-14 07:59:55 +02:00
Juergen Borleis 3018f13670 net/ifup.c: avoid setting the MAC twice
The command always sets the MAC address of the interface in the code path.
For the static network configuration case it sets it again, due to the
environment variable keyword ("ethaddr") is listed again in the table.
Remove this keyword from the table, because the MAC is already set.

Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-04-24 09:03:31 +02:00
Juergen Borleis 4428de2aad net/ifup.c: don't fail silently
Since commit a162dfe503 the ifup command is
implemented in C and runs up to two external scripts.
If one of these scripts return with an error code, the command terminates
silently. This can confuse a user because there is no hint about the reason
why it fails. Add error messages to avoid this case.

Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-04-24 09:03:31 +02:00
Sascha Hauer 245bc10ca5 Merge branch 'for-next/misc' 2014-04-04 10:06:22 +02:00
Sascha Hauer 1273cc2d47 param: Add dev_add_param_mac
This adds a convenience function to register a MAC address device
parameter. The only current user is converted to use it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-04-04 09:04:31 +02:00
Sascha Hauer 33987e9600 netconsole: bail out when no connection is opened
When no connection is opened we should not call into
the networking stack. Otherwise it can happen that we
delay further execution until the network stack detected
a link (or timed out bringing the link up).

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-03-31 09:19:35 +02:00
Sascha Hauer 81b4c03a2b ifup: set serverip to provided value when doing dhcp
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-03-14 11:09:48 +01:00
Sascha Hauer 144358e0aa Merge branch 'for-next/nfs'
Conflicts:
	defaultenv/defaultenv-2-base/bin/ifup
2014-03-07 09:25:44 +01:00
Sascha Hauer e358922a74 Merge branch 'for-next/mtd'
Conflicts:
	drivers/mtd/core.c
	net/eth.c
2014-03-07 09:25:18 +01: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
Sascha Hauer d23af7a0a0 device: remove parameters when unregistering a device
Otherwise we loose memory on each device_unregister. The ethernet
code used to do this before calling unregister_device. This can
now be removed.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-13 19:39:11 +01:00
Lucas Stach aa6694b542 remove redundant NULL check on free
free() already checks the pointer to be non
NULL. No need to do it again.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-10 08:49:55 +01:00
Sascha Hauer 27d4fe7a08 net: Fix error return value for string_to_ethaddr
Return a proper error code instead of -1 which would be -EPERM.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-20 14:13:00 +01:00
Alexander Aring 32a5775125 barebox: remove double semicolons
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-18 10:13:35 +01:00
Sascha Hauer b67b2671c2 treewide: Add missing includes
A lot of files rely on include/driver.h including include/of.h (and
this including include/errno.h. include the files explicitly so we can
eventually get rid of including of.h from driver.h

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-08 15:42:04 +01:00
Sascha Hauer d7c1612d65 of: Add a context pointer to fixup functions
If drivers want to fixup their specific instance they need some context
to know which instance they have to fixup.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-06 10:24:46 +01:00
Sascha Hauer 574947ef76 Merge branch 'for-next/console' 2013-10-07 07:59:18 +02:00
Sascha Hauer d28c9bb55d dhcp: replace dhcp_getenv_int with getenv_uint
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-10-07 07:59:00 +02:00
Jean-Christophe PLAGNIOL-VILLARD e62d425517 console: drop f_caps and check the function pointer getc/putc instead
None of the driver make the difference between STDOUT and STDERR.
So we just need to check if putc or getc are filled in the console_device

save 32 bytes on versatilepb

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-21 09:59:16 +02:00
Sascha Hauer 91a68050e1 Merge branch 'for-next/powerpc' 2013-09-05 13:59:31 +02:00
Sascha Hauer 1729b1798e Merge branch 'for-next/boardinfo'
Conflicts:
	arch/mips/boards/qemu-malta/init.c
	commands/bootm.c
	drivers/of/base.c
2013-09-05 10:39:22 +02:00
Renaud Barbier a78431c7fc net, of: fixup MAC address by alias
If a network device has not been registered from the devicetree, we may
still find it by its alias in the devicetree. This way also platform based
network devices can obtain a valid MAC address in the devicetree.

Signed-off-by: Renaud Barbier <renaud.barbier@ge.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-05 10:28:04 +02:00
Sascha Hauer 774580c2bd Make hostname available to C Code
The boards often have a sane default for the hostname. Provide a C
function for setting/getting it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-08-16 08:40:37 +02:00
Sascha Hauer 016082f85e globalvar: Allow to set initial value
Calling globalvar_add_simple() and setting a value is more than common.
Add a parameter for the initial value.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-08-16 08:40:33 +02:00
Baruch Siach b5abbd8074 net: fix checksum verification
Checksum calculation on data including its own checksum (as is the case with
IP headers) should give 0xffff before bit flipping. Current code works well
for the correct checksum case, but fails to identify errors.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-08-12 07:58:50 +02:00
Sascha Hauer e72c88e71b of: net: Use correct devicetree in eth_of_fixup
eth_of_fixup() is passed a devicetree, so use this one instead
of the internal devicetree. This makes sure it also works when
the tree to fixup is not the internal one.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-27 07:40:31 +02:00
Sascha Hauer 8afe2cb4d4 Merge branch 'for-next-manual/oftree-linux-sync' 2013-07-02 07:08:46 +02: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 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 66691793b0 net: dhcp: Fix tftp servername handling
When the dhcp code discovered the tftp-server-name option it immediately
tries to resolve the name. This can't succeed since the we are somewhere
in the dhcp processing and the nameserver may not even be known.

Fix this by resolving the name when dhcp is completed. While at it, do
this in a way that net_set_serverip is only called when resolv() returns
something useful. Otherwise we may end up overwriting a previously
configured serverip which came from the bootp bp_siaddr field.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-14 11:51:24 +02:00
Sascha Hauer 37b0cce64d net: dhcp: Fix return value on ctrl-c
the dhcp command will return with 0 when ctrl-c is pressed. Fix this to
-EINTR instead.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-14 11:50:18 +02:00
Sascha Hauer 21a2691f06 netconsole: use dev_add_param_* helpers
For shorter code.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-11 11:48:34 +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