summaryrefslogtreecommitdiff
path: root/net
Commit message (Collapse)AuthorAgeLines
* net/eth.c: fix eth_write_hwaddr() to use dev->enetaddr as fall backEric Miao2012-04-03-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ignore the return value of eth_getenv_enetaddr_by_index(), and if it fails, fall back to use dev->enetaddr, which could be filled up by the ethernet device driver: With the current code, introduced with below commit, eth_write_hwaddr() will fail immediately if there is no eth<n>addr in the environment variables. However, e.g. for an overo based product that uses the SMSC911x ethernet chip (with the MAC address set via EEPROM connected to the SMSC911x chip), the MAC address is still OK. On mx28 boards that are depending on the OCOTP bits to set the MAC address (like the Denx m28 board), the OCOTP bits should be used instead of failing on the environment variables. Actually, this was the original behavior, and was later changed by commit 7616e7850804c7c69e0a22c179dfcba9e8f3f587. Signed-off-by: Eric Miao <eric.miao@linaro.org> Acked-by: Simon Glass <sjg@chromium.org> Acked-by: Dirk Behme <dirk.behme@de.bosch.com> CC: Stefan Roese <sr@denx.de> CC: Eric Miao <eric.miao@linaro.org> CC: Wolfgang Denk <wd@denx.de> CC: Philip Balister <philip@balister.org> CC: Zach Sadecki <zach@itwatchdogs.com>
* bootstage: Plumb in bootstage calls for basic operationsSimon Glass2012-03-18-0/+5
| | | | | | | | This inserts bootstage calls into tftp, usb start and bootm. We could go further, but this is a reasonable start to illustrate the concept. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootstage: Replace show_boot_progress/error() with bootstage_...()Simon Glass2012-03-18-3/+3
| | | | | | | These calls should not be made directly any more, since bootstage will call the show_boot_...() functions as needed. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootstage: Convert net progress numbers to enumsSimon Glass2012-03-18-3/+3
| | | | | | | This changes over the network-related progress numbers to use enums from bootstage.h. Signed-off-by: Simon Glass <sjg@chromium.org>
* bootstage: Use show_boot_error() for -ve progress numbersSimon Glass2012-03-18-1/+1
| | | | | | | | Rather than the caller negating our progress numbers to indicate an error has occurred, which seems hacky, add a function to indicate this. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Mike Frysinger <vapier@gentoo.org>
* net/miiphy/serial: drop duplicate "NAMESIZE" defineMike Frysinger2012-03-18-1/+1
| | | | | | | | | | A few subsystems are using the same define "NAMESIZE". This has been working so far because they define it to the same number. However, I want to change the size of eth_device's NAMESIZE, so rather than tweak the define names, simply drop references to it. Almost no one does, and the handful that do can easily be changed to a sizeof(). Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* PPC: Drop mv6446x_eth_initialize() from net/eth.cMarek Vasut2012-03-06-5/+0
| | | | | | | | This function was defined as an extern in net/eth.c, drop that and use standard means of calling it. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Stefan Roese <sr@denx.de>
* PPC: Drop mv6436x_eth_initialize() from net/eth.cMarek Vasut2012-03-06-4/+0
| | | | | | | | This function was defined as an extern in net/eth.c, drop that and use standard means of calling it. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Reinhard Arlt <reinhard.arlt@esd-electronics.com>
* eth: remove usb-ethernet devices before re-enumerating themVincent Palatin2012-03-03-0/+29
| | | | | | | | Fix the crash when running several times usb_init() with a USB ethernet device plugged. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> Tested-by: Wolfgang Grandegger <wg@denx.de>
* net: introduce per device indexMichael Walle2011-12-20-29/+12
| | | | | | | | | | | | | | | | Instead of counting the device index everytime a functions needs it, store it in the eth_device struct. eth_register() keeps track of the indices and updates the device's index number. This simplifies some functions in net/eth.c. Additionally, a network driver can now query its index, eg. to get the correct environment ethaddr name. Signed-off-by: Michael Walle <michael@walle.cc> Cc: Prafulla Wadaskar <prafulla@marvell.com> Cc: Mike Frysinger <vapier@gentoo.com> Cc: Wolfgang Denk <wd@denx.de> Acked-by: Mike Frysinger <vapier@gentoo.org>
* net: Make sure IPaddr_t is 32 bits in sizeMatthias Weisser2011-12-06-5/+5
| | | | | | | | | | | When building u-boot as 64 bit application (e.g. sandbox) ulong might be 64 bits in size. This breaks network code as IPaddr_t is 64 bytes in size then and an IPv4 address is 32 bits in size. This patch makes sure that IPaddr_t is always 32 bits in size. Also some warnings introduced by this patch are fixed. Signed-off-by: Matthias Weisser <weisserm@arcor.de> Acked-by: Mike Frysinger <vapier@gentoo.org>
* net/bootp.c: Fix GCC 4.6 warningAnatolij Gustschin2011-11-23-1/+2
| | | | | | | | Fix: bootp.c: In function 'BootpCopyNetParams': bootp.c:108:11: warning: unused variable 'tmp_ip' [-Wunused-variable] Signed-off-by: Anatolij Gustschin <agust@denx.de>
* net/net.c: Fix GCC 4.6 build warningWolfgang Denk2011-11-07-3/+1
| | | | | | | | | Fix: net.c: In function 'CDPHandler': net.c:1083:8: warning: variable 'applid' set but not used [-Wunused-but-set-variable] Signed-off-by: Wolfgang Denk <wd@denx.de>
* net: Export auto_load, use it in rarpSimon Glass2011-10-27-49/+33
| | | | | | | | | | | The rarp code includes another instance of the auto_load logic, so call what is now net_auto_load() instead. This also fixes an incorrect call to TftpStart() which was never seen since apparently no boards enable rarp. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Mike Frysinger <vapier@gentoo.org>
* net: Change for loop to memset()Simon Glass2011-10-27-6/+2
| | | | | | This is intended purely as a code size reduction. Signed-off-by: Simon Glass <sjg@chromium.org>
* net: Add more #ifdefs for tftpput to reduce code sizeSimon Glass2011-10-27-1/+10
| | | | | | | If CONFIG_CMD_TFTPPUT is not enabled, we want minimal code size impact on the tftp code. This introduces a few more #ifdefs. Signed-off-by: Simon Glass <sjg@chromium.org>
* net: Make net_transfer() a static functionSimon Glass2011-10-27-1/+1
| | | | | | | This should be a static function so it can be inlined. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Mike Frysinger <vapier@gentoo.org>
* net: Hide more code behind CONFIG_CMD_TFTPPUTSimon Glass2011-10-27-2/+12
| | | | | | | | This commit reduces code size a little by making the ICMP handler only available to tftpput. This is reasonable since it is the only user at present (ping just uses the normal handler). Signed-off-by: Simon Glass <sjg@chromium.org>
* net: tftpput: implement tftp logicSimon Glass2011-10-26-21/+117
| | | | | | | This adds logic to tftp.c to implement the tftp 'put' command, and updates the README. Signed-off-by: Simon Glass <sjg@chromium.org>
* net: tftpput: Support selecting get/put for tftpSimon Glass2011-10-26-4/+3
| | | | | | TftpStart should support starting either a get or a put. Signed-off-by: Simon Glass <sjg@chromium.org>
* net: tftpput: Factor out start, restart and next block functionsSimon Glass2011-10-26-26/+51
| | | | | | This code is required for tftpput, so move it into separate functions. Signed-off-by: Simon Glass <sjg@chromium.org>
* net: tftpput: move common code into separate functionsSimon Glass2011-10-26-30/+38
| | | | | | | We want to show block markers on completion of get and put, so move this common code into separate functions. Signed-off-by: Simon Glass <sjg@chromium.org>
* net: tftpput: Rename TFTP to TFTPGETSimon Glass2011-10-26-10/+8
| | | | | | | | This is a better name for this protocol. Also remove the typedef to keep checkpatch happy, and move zeroing of NetBootFileXferSize a little earlier since TFTPPUT will need to change this. Signed-off-by: Simon Glass <sjg@chromium.org>
* net: tftpput: Add support for receiving ICMP packetsSimon Glass2011-10-26-3/+24
| | | | | | | | | | ICMP packets can tell you when there is no server at the other end. It is useful for tftp to figure this out, so that a quick error can be displayed, rather than pointlessly retrying. This adds an ICMP packet handler to the net interface. Signed-off-by: Simon Glass <sjg@chromium.org>
* net: tftpput: Move ICMP code into its own functionSimon Glass2011-10-26-43/+58
| | | | | | | NetReceive() is a very long function with a lot of indent. Before adding code to the ICMP bit, split it out. Signed-off-by: Simon Glass <sjg@chromium.org>
* net/dns.c: Fix endian conversion for big-endian in dns commandBernhard Kaindl2011-10-23-12/+8
| | | | | | | | | | | | | | | | | net/dns.c used endian conversion macros wrongly (shorts in reply were put swapped into CPU, and then ntohs() was used to swap it back, which broke on big-endian). Fix this by using the correct linux conversion macro for reading a unaligned short in network byte order: get_unaligned_be16() Thanks to Mike Frysinger pointing at the best macro to use. Tested on big and little endian qemu boards (mips and versatile) Signed-off-by: Bernhard Kaindl <bernhard.kaindl@thalesgroup.com> Cc: Pieter Voorthuijsen <pieter.voorthuijsen@prodrive.nl> Cc: Robin Getz <rgetz@blackfin.uclinux.org> Acked-by: Mike Frysinger <vapier@gentoo.org>
* net: bootp: add PXE/RFC 4578 DHCP options supportJason Hobbs2011-10-17-0/+40
| | | | | | | | | | These options are required to be present in RFC 4578 compliant DHCP requests. They give more information to DHCP servers to allow serving different DHCP responses to different systems based on client architecture, client capabilities, UUID, or vendor. Signed-off-by: Jason Hobbs <jason.hobbs@calxeda.com>
* net: drop !NET_MULTI codeMike Frysinger2011-10-05-74/+11
| | | | | | | | | | | This is long over due. All but two net drivers have been converted, but those have now been dropped. The only thing left to do is actually delete all references to NET_MULTI and code that is compiled when that is not defined. So here we scrub the core code. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* net: drop !NET_MULTI ns7520 driverMike Frysinger2011-10-05-4/+0
| | | | | | | This driver was never converted to NET_MULTI, and no board uses it. So punt it and be done. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* net: Add \n before warning message so it prints on a new line.Philip Balister2011-10-01-1/+1
| | | | Signed-off-by: Philip Balister <philip@opensdr.com>
* net: turn name len check into an assertMike Frysinger2011-09-21-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-19-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-09-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-05-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-04-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-08-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-08-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-03-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-27-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-01-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-19-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-19-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-19-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-19-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-19-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-19-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-19-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-19-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-19-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-19-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>