summaryrefslogtreecommitdiffstats
path: root/net
Commit message (Collapse)AuthorAgeFilesLines
* net: turn name len check into an assertMike Frysinger2011-09-211-6/+1
| | | | | | | | | The new sanity check introduces a printf warning for some systems: eth.c:233: warning: format '%zu' expects type 'size_t', but argument 3 has type 'int' Rather than tweak the format string, use the new assert() helper instead. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* net/bootp.c: fix tftp load if autoload environment var isn't setPeter Korsgaard2011-09-191-1/+1
| | | | | | | | | | | | | Commit 093498669 (Put common autoload code into auto_load() function) broke handling of autoload environment variable not being set. The bootp/dhcp code will just keep on requesting IP address forever and never start TFTP download. Fix it by moving TftpStart() outside the conditional like it was before. Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk> Tested-by: Fabio Estevam <fabio.estevam@freescale.com> Acked-by: Simon Glass <sjg@chromium.org>
* net/eth.c: throw BUG for eth_get_dev_by_name(NULL)Helmut Raiger2011-09-091-0/+2
| | | | | | | | eth_get_dev_by_name() is not safe to use for devname being NULL as it uses strcmp. This patch makes it fail with a BUG(). Signed-off-by: Helmut Raiger <helmut.raiger@hale.at> Acked-by: Mike Frysinger <vapier@gentoo.org>
* Correct call to eth_write_hwaddr()Simon Glass2011-09-051-1/+1
| | | | | | | | | | | | | | This fixes "Warning: failed to set MAC address" on platforms which rely on an 'ethaddr' environment variable to set the MAC address. This bug was introduced by this commit: 7616e785 Add Ethernet hardware MAC address framework to usbnet Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Kumar Gala <galak@kernel.crashing.org> Tested-by: Michal Simek <monstr@monstr.eu> Tested-by: Heiko Schocher <hs@denx.de>
* net: Check network device driver nameMichal Simek2011-09-041-0/+8
| | | | | | | | | | | | | | | If name is longer than allocated space NAMESIZE mac address is rewritten which show error message like: Error message: Warning: Xlltemac.87000000 MAC addresses don't match: Address in SROM is 30:00:00:00:00:00 Address in environment is 00:0a:35:00:6a:04 NAMESIZE contains Driver name + zero terminated character. Signed-off-by: Michal Simek <monstr@monstr.eu>
* Put common autoload code into auto_load() functionSimon Glass2011-08-081-43/+33
| | | | | | | This is a small clean-up patch. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Eric Bénard <eric@eukrea.com>
* Add Ethernet hardware MAC address framework to usbnetSimon Glass2011-08-081-25/+39
| | | | | | | | | | | | Built-in Ethernet adapters support setting the mac address by means of a ethaddr environment variable for each interface (ethaddr, eth1addr, eth2addr). This adds similar support to the USB network side, using the names usbethaddr, usbeth1addr, etc. They are kept separate since we don't want a USB device taking the MAC address of a built-in device or vice versa. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Eric Bénard <eric@eukrea.com>
* net/eth.c: drop obsolete at91rm9200 supportAndreas Bießmann2011-08-031-4/+0
| | | | | | | | | All available at91rm9200 boards have migrated to ar920t/at91 and therefore to CONFIG_NET_MULTI. The obsolete at91rm9200_miiphy_initialize() was removed in "ARM: remove obsolete at91rm9200". Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
* bootp: add ntpserver option to bootp requestLuuk Paulussen2011-07-271-0/+15
| | | | | | Signed-off-by: Luuk Paulussen <luuk.paulussen@alliedtelesis.co.nz> Acked-by: Chris Packham <chris.packham@alliedtelesis.co.nz> Cc: Ben Warren <biggerbadderben@gmail.com>
* net/net.c: Update ipaddr if the environment has changedEnric Balletbo i Serra2011-06-011-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At least on ARM the ipaddr is only set in board_init_r function. The problem is if ipaddr is not defined in environment importing another environment defined don't update the ipaddr value. For example, suppose we've a default environment without net variables defined and we want to import an uEnv.txt environment from SD-card like this: ipaddr=192.168.2.240 netmask=255.255.255.0 gatewayip=192.168.2.1 serverip=192.168.2.114 Then if you try boot from NFS results in: Importing environment from mmc ... Running uenvcmd ... smc911x: detected LAN9221 controller smc911x: phy initialized smc911x: MAC ac:de:48:00:00:00 *** ERROR: `ipaddr' not set The ipaddr at this point is NULL beacause is only set at board_init_r function. This patch updates the ipaddr value if the environment has changed. Signed-off-by: Enric Balletbo i Serra <eballetbo@iseebcn.com> Acked-by: Mike Frysinger <vapier@gentoo.org>
* net/tftp.c: fix typoLuca Ceresoli2011-05-191-1/+1
| | | | | | Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de> Acked-by: Detlev Zundel <dzu@denx.de>
* TFTP: add tftpsrv commandLuca Ceresoli2011-05-191-1/+6
| | | | | | Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de> Acked-by: Detlev Zundel <dzu@denx.de>
* TFTP: net/tftp.c: add server mode receiveLuca Ceresoli2011-05-192-4/+64
| | | | | | Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de> Acked-by: Detlev Zundel <dzu@denx.de>
* TFTP: rename STATE_RRQ to STATE_SEND_RRQLuca Ceresoli2011-05-191-6/+6
| | | | | | | | | With the upcoming TFTP server implementation, requests can be either outgoing or incoming, so avoid ambiguities. Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de> Acked-by: Detlev Zundel <dzu@denx.de>
* TFTP: replace "server" with "remote" in local variable namesLuca Ceresoli2011-05-191-14/+14
| | | | | | | | | With the upcoming TFTP server implementation, the remote node can be either a client or a server, so avoid ambiguities. Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de> Acked-by: Detlev Zundel <dzu@denx.de>
* net/tftp.c: cosmetic: do not initialise statics to 0 or NULLLuca Ceresoli2011-05-191-2/+2
| | | | | | | | This removes the following checkpatch issue: - ERROR: do not initialise statics to 0 or NULL Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de>
* net/tftp.c: cosmetic: fix indentationLuca Ceresoli2011-05-191-5/+6
| | | | | | | | This removes the following checkpatch issue: - WARNING: suspect code indent for conditional statements Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de>
* net/tftp.c: cosmetic: trailing statements should be on next lineLuca Ceresoli2011-05-191-3/+6
| | | | | | | | This removes the following checkpatch issue: - ERROR: trailing statements should be on next line Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de>
* net/tftp.c: cosmetic: fix brace issuesLuca Ceresoli2011-05-191-11/+6
| | | | | | | | | This removes the following checkpatch issues: - WARNING: braces {} are not necessary for single statement blocks - WARNING: braces {} are not necessary for any arm of this statement Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de>
* net/tftp.c: cosmetic: do not use assignment in if conditionLuca Ceresoli2011-05-191-6/+12
| | | | | | | | | | | | | | | | | | | This removes the following checkpatch issue: - ERROR: do not use assignment in if condition. There is one such error left: ERROR: do not use assignment in if condition #239: FILE: tftp.c:239: + if (!ProhibitMcast + && (Bitmap = malloc(Mapsize)) + && eth_get_dev()->mcast) { which would require an additional nested if to be fixed, resulting in longer and less readable code. Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de>
* net/tftp.c: cosmetic: fix pointer syntax issuesLuca Ceresoli2011-05-191-10/+10
| | | | | | | | | This removes the following checkpatch issues: - ERROR: "foo * bar" should be "foo *bar" - ERROR: "(foo*)" should be "(foo *)" Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de>
* net/tftp.c: cosmetic: fix whitespace issuesLuca Ceresoli2011-05-191-95/+97
| | | | | | | | | | | | | | | | | | This removes the following checkpatch issues: - ERROR: space prohibited before that close parenthesis ')' - ERROR: space required after that ';' (ctx:BxV) - ERROR: space required after that ',' (ctx:VxV) - ERROR: space required after that ';' (ctx:VxV) - ERROR: spaces required around that '<<=' (ctx:VxV) - ERROR: spaces required around that '<' (ctx:VxV) - ERROR: spaces required around that '=' (ctx:VxV) - ERROR: spaces required around that '+=' (ctx:VxV) - ERROR: spaces required around that '=' (ctx:VxW) - WARNING: please, no spaces at the start of a line - WARNING: space prohibited between function name and open parenthesis '(' Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de>
* net/tftp.c: cosmetic: fix lines over 80 charactersLuca Ceresoli2011-05-191-24/+42
| | | | | Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de>
* net/net.c: cosmetic: do not use assignment in if conditionLuca Ceresoli2011-05-121-1/+2
| | | | | | | | | This removes the following checkpatch issue: - ERROR: do not use assignment in if condition Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de> Cc: Ben Warren <biggerbadderben@gmail.com>
* net/net.c: cosmetic: fix indentationLuca Ceresoli2011-05-121-42/+41
| | | | | | | | | | | This removes the following checkpatch issues: - ERROR: switch and case should be at the same indent - WARNING: suspect code indent for conditional statements - WARNING: labels should not be indented Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de> Cc: Ben Warren <biggerbadderben@gmail.com>
* net/net.c: cosmetic: parentheses not required for returnLuca Ceresoli2011-05-121-15/+15
| | | | | | | | | This removes the following checkpatch issue: - ERROR: return is not a function, parentheses are not required Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de> Cc: Ben Warren <biggerbadderben@gmail.com>
* net/net.c: cosmetic: fix pointer syntax issuesLuca Ceresoli2011-05-121-15/+15
| | | | | | | | | | This removes the following checkpatch issues: - ERROR: "foo * bar" should be "foo *bar" - ERROR: "(foo*)" should be "(foo *)" Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de> Cc: Ben Warren <biggerbadderben@gmail.com>
* net/net.c: cosmetic: fix brace issuesLuca Ceresoli2011-05-121-25/+13
| | | | | | | | | | This removes the following checkpatch issues: - WARNING: braces {} are not necessary for single statement blocks - WARNING: braces {} are not necessary for any arm of this statement Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de> Cc: Ben Warren <biggerbadderben@gmail.com>
* net/net.c: cosmetic: fix whitespace issuesLuca Ceresoli2011-05-121-93/+93
| | | | | | | | | | | | | | | | | | | | | This removes the following checkpatch issues: - ERROR: space prohibited after that open parenthesis '(' - ERROR: space prohibited before that close parenthesis ')' - ERROR: space prohibited after that open square bracket '[' - ERROR: space prohibited after that '&' (ctx:WxW) - ERROR: spaces required around that '=' (ctx:VxW) - ERROR: space required before the open parenthesis '(' - ERROR: space required after that ',' (ctx:VxV) - ERROR: need consistent spacing around '+' (ctx:WxV) - WARNING: unnecessary whitespace before a quoted newline - WARNING: please, no spaces at the start of a line - WARNING: space prohibited between function name and open parenthesis '(' Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de> Cc: Ben Warren <biggerbadderben@gmail.com> Cc: Mike Frysinger <vapier@gentoo.org>
* net/net.c: cosmetic: variable initializationsLuca Ceresoli2011-05-121-22/+18
| | | | | | | | | | | | This removes the following checkpatch errors: - ERROR: do not initialise globals to 0 or NULL - ERROR: spaces required around that '=' (ctx:VxV) - ERROR: that open brace { should be on the previous line Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de> Cc: Ben Warren <biggerbadderben@gmail.com> Cc: Mike Frysinger <vapier@gentoo.org>
* net/net.c: cosmetic: fix lines over 80 charactersLuca Ceresoli2011-05-121-77/+155
| | | | | | | | | | | | | | | | | | | | | This removes the following checkpatch warning: - WARNING: line over 80 characters There are three such warnings left. The first is hard to fix with cosmetic-only changes without compromising code readability, so I'm leaving it as it is for now: WARNING: line over 80 characters #1537: FILE: net.c:1537: + [4 tabs] memcpy(((Ethernet_t *)NetArpWaitTxPacket)->et_dest, ... The other two cannot be fixed without splitting string literals, so it is preferred to keep them longer than 80 characters. Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de> Cc: Ben Warren <biggerbadderben@gmail.com> Cc: Mike Frysinger <vapier@gentoo.org>
* NET: pass source IP address to packet handlersLuca Ceresoli2011-05-127-21/+31
| | | | | | | | | | This is needed for the upcoming TFTP server implementation. This also simplifies PingHandler() and fixes rxhand_f documentation. Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de> Acked-by: Detlev Zundel <dzu@denx.de>
* netconsole: remove `serverip' checkSimon Guinot2011-05-121-1/+2
| | | | | | | Netconsole use the environment variable `ncip' to configure the destination IP. `serverip' don't need to be defined. Signed-off-by: Simon Guinot <sguinot@lacie.com>
* NET: Correct potential missing goto label in case statement.Gray Remlin2011-04-281-1/+2
| | | | | | | | If neither CONFIG_CMD_PING or CONFIG_CMD_SNTP are defined but CONFIG_CMD_DNS is, a compile-time error will occur due to the absence of a goto label. Signed-off-by: Gray Remlin <gryrmln@gmail.com>
* Create PHY Lib for U-BootAndy Fleming2011-04-201-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Extends the mii_dev structure to participate in a full-blown MDIO and PHY driver scheme. The mii_dev structure and miiphy calls are modified in such a way to allow the original mii command and miiphy infrastructure to work as before, but also to support a new set of APIs which allow (among other things) sharing of PHY driver code and 10G support The mii command will continue to support normal PHY management functions (Clause 22 of 802.3), but will not be changed to support 10G (Clause 45). The basic design is similar to PHY Lib from Linux, but simplified for U-Boot's network and driver infrastructure. We now have MDIO drivers and PHY drivers An MDIO driver provides: read write reset A PHY driver provides: (optionally): probe config - initial setup, starting of auto-negotiation startup - waiting for AN, and reading link state shutdown - any cleanup needed The ethernet drivers interact with the PHY Lib using these functions: phy_connect() phy_config() phy_startup() phy_shutdown() Each PHY driver can be configured separately, or all at once using config_phylib_all_drivers.h (added in the patch which adds the drivers) We also provide generic drivers for Clause 22 (10/100/1000), and Clause 45 (10G) PHYs. We also implement phy_reset(), and call it in phy_connect(). Because phy_reset() is essentially the same as miiphy_reset, but: a) must support 10G PHYs, and b) should use the phylib primitives, we implement miiphy_reset, using phy_reset(), but only when CONFIG_PHYLIB is set. Otherwise, we just use the old version. In this way, we save on compile size, even if we don't manage to save code size. Pulled ethtool.h and mdio.h from: git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6 782d640afd15af7a1faf01cfe566ca4ac511319d With many, many deletions so as to enable compilation under u-boot Signed-off-by: Andy Fleming <afleming@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org> Acked-by: Detlev Zundel <dzu@denx.de>
* Fix bad padding of bootp request packetSimon Glass2011-04-131-1/+1
| | | | | | This seems to pad to one byte longer than required Signed-off-by: Simon Glass <sjg@chromium.org>
* Fix compile warning in net/eth.cRemy Bohmer2011-02-191-1/+1
| | | | Signed-off-by: Remy Bohmer <linux@bohmer.net>
* Add USB host ethernet adapter supportSimon Glass2011-02-191-19/+22
| | | | | | | | | | | | This adds support for using USB Ethernet dongles in host mode. This is just the framework - drivers will come later. A new config option called CONFIG_USB_HOST_ETHER can be defined in board config files to switch this on. The was originally written by NVIDIA and was cleaned up for release by the Chromium authors. Signed-off-by: Simon Glass <sjg@chromium.org>
* string_to_VLAN: constify "var" argMike Frysinger2010-11-281-1/+1
| | | | Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* copy_filename: constify "src" argMike Frysinger2010-11-281-1/+1
| | | | Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* Switch from archive libraries to partial linkingSebastien Carlier2010-11-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Before this commit, weak symbols were not overridden by non-weak symbols found in archive libraries when linking with recent versions of binutils. As stated in the System V ABI, "the link editor does not extract archive members to resolve undefined weak symbols". This commit changes all Makefiles to use partial linking (ld -r) instead of creating library archives, which forces all symbols to participate in linking, allowing non-weak symbols to override weak symbols as intended. This approach is also used by Linux, from which the gmake function cmd_link_o_target (defined in config.mk and used in all Makefiles) is inspired. The name of each former library archive is preserved except for extensions which change from ".a" to ".o". This commit updates references accordingly where needed, in particular in some linker scripts. This commit reveals board configurations that exclude some features but include source files that depend these disabled features in the build, resulting in undefined symbols. Known such cases include: - disabling CMD_NET but not CMD_NFS; - enabling CONFIG_OF_LIBFDT but not CONFIG_QE. Signed-off-by: Sebastien Carlier <sebastien.carlier@gmail.com>
* Net: clarify board/cpu_eth_init callsBen Warren2010-11-151-4/+12
| | | | | | | | | | | This has always been confusing, and the idea of these functions returning the number of interfaces initialized was half-baked and ultimately pointless. Instead, act more like regular functions and return < 0 on failure, >= 0 on success. This change shouldn't break anything. Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
* net: Fix potential empty DHCP Parameter Request ListJason Liu2010-11-141-0/+4
| | | | | | | | | | Can't get IP address with dhcp due to the dhcp server not allow the empty param list request under some network env This patch is based on Gray Remlin's initial patch. Signed-off-by: Jason Liu <r64343@freescale.com> Signed-off-by: Gray Remlin <g_remlin@rocketmail.com>
* rarp: Condtionally compile rarp supportPeter Tyser2010-10-112-3/+10
| | | | | | | | Most people don't use the 'rarpboot' command, so only enable it when CONFIG_CMD_RARP is defined. Signed-off-by: Peter Tyser <ptyser@xes-inc.com> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
* Net: Remove redundant CONFIG_NET_MULTI directivesBen Warren2010-10-111-12/+4
| | | | | | All are within an #ifdef CONFIG_NET_MULTI block already Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
* Fix compile warnings for const correctnessBen Warren2010-08-091-1/+1
| | | | | | | | | | | Commit 6e37b1a3a25004d3df5867de49fff6b3fc9c4f04 modifies several net calls to take a (const char *) parameter instead of (char *), but in some cases the modified functions call other functions taking (char *). The end result is warnings about discarding the const qualifier. This patch fixes these other function signatures. Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
* net: warn about spaces in device namesMike Frysinger2010-07-121-0/+3
| | | | | | | | | Some commands operate on eth device names (like 'mii'), but those cannot be passed on the command line as one argument. So detect devices like these and warn about them so someone will fix it. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
* net/eth.c: eth_mac_skip() is only needed when CONFIG_NET_MULTI is setWolfgang Denk2010-06-201-2/+2
| | | | | | | | | | | Move it inside the #ifdef CONFIG_NET_MULTI to avoid eth.c:64: warning: 'eth_mac_skip' defined but not used messages from a number of old, non-CONFIG_NET_MULTI boards. Signed-off-by: Wolfgang Denk <wd@denx.de> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
* ip/defrag: fix processing of last short fragmentFillod Stephane2010-06-201-1/+2
| | | | | | | | | | | TFTP'ing a file of size 1747851 bytes with CONFIG_IP_DEFRAG and CONFIG_TFTP_BLOCKSIZE set to 4096 fails with a timeout, because the last fragment is not taken into account. This patch fixes IP fragments having less than 8 bytes of payload. Signed-off-by: Stephane Fillod <stephane.fillod@grassvalley.com> Acked-by: Alessandro Rubini <rubini@gnudd.com> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
* Program net device MAC addresses after initializingBen Warren2010-05-031-0/+13
| | | | | | | | | | | | | | | | Add a new function to the eth_device struct for programming a network controller's hardware address. After all network devices have been initialized and the proper MAC address for each has been determined, make a device driver call to program the address into the device. Only device instances with valid unicast addresses will be programmed. Signed-off-by: Ben Warren <biggerbadderben@gmail.com> Acked-by: Detlev Zundel <dzu@denx.de> Tested-by: Prafulla Wadaskar <prafulla@marvell.com> Tested-by: Heiko Schocher <hs@denx.de> Tested-by: Thomas Chou <thomas@wytron.com.tw>
OpenPOWER on IntegriCloud