summaryrefslogtreecommitdiff
path: root/net
AgeCommit message (Collapse)Author
2011-11-17BACKPORT: net: tftpput: implement tftp logicSimon Glass
This adds logic to tftp.c to implement the tftp 'put' command, and updates the README. (cherry-picked from 1fb7cd4) Change-Id: I01fc2ca4d974416083e913597791676bbd0934ae Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/11801
2011-11-17BACKPORT: net: tftpput: Support selecting get/put for tftpSimon Glass
TftpStart should support starting either a get or a put. (cherry-picked from 58f317d) Change-Id: Ic221520a1c7cb00536a42d3ab531efbcaba35bf6 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/11799
2011-11-17UPSTREAM: net: tftpput: Factor out start, restart and next block functionsSimon Glass
This code is required for tftpput, so move it into separate functions. Signed-off-by: Simon Glass <sjg@chromium.org> (cherry picked from commit e4cde2f70d2377fdf484cbbc1729b188f81b8ec8) Change-Id: Ie0398e05b13ea56dea70b270a812fe6dbbbe4bb4 Reviewed-on: https://gerrit.chromium.org/gerrit/11798 Commit-Ready: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
2011-11-17BACKPORT: net: tftpput: move common code into separate functionsSimon Glass
We want to show block markers on completion of get and put, so move this common code into separate functions. (cherry-picked from f5329bb) Change-Id: I579a0db0e088ecd947bdfbf3049ec94a930fbed6 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/11797
2011-11-17BACKPORT: net: tftpput: Rename TFTP to TFTPGETSimon Glass
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. (cherry-picked from e4bf0c5) Change-Id: I90d03045de0231553a693f7119bdcc67a908e3c9 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/11796
2011-11-17UPSTREAM: net: tftpput: Add support for receiving ICMP packetsSimon Glass
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> (cherry picked from commit 4793ee6522f10a3d108de7e47adbcf5f15eb3f46) Change-Id: I02bbd41b3852b92b06210db160a06c62f5bf414f Reviewed-on: https://gerrit.chromium.org/gerrit/11795 Commit-Ready: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
2011-11-17UPSTREAM: Put common autoload code into auto_load() functionSimon Glass
This is a small clean-up patch. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Eric BĂ©nard <eric@eukrea.com> (cherry picked from commit 093498669e77597635a24f326f11efeab213d394) Change-Id: Ib052e50e7e520c9d5c8c5344e94a4404b2ba0d30 Reviewed-on: https://gerrit.chromium.org/gerrit/11793 Commit-Ready: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
2011-11-17UPSTREAM: net: tftpput: Move ICMP code into its own functionSimon Glass
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> (cherry picked from commit 8f79bb17a4251ec096a7184d1eaf6f5dea3d2623) Change-Id: Ic5599c5c7eedc7f00fc5d5aecdd051418e5c2e40 Reviewed-on: https://gerrit.chromium.org/gerrit/11794 Commit-Ready: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
2011-08-29eth: remove usb-ethernet devices before re-enumerating themVincent Palatin
Fix the crash when running several times usb_init() with a USB ethernet device plugged. BUG=chromium-os:15206 TEST=run several "usb start" commands and having inserted/removed all possible combinations of 0 to 3 USB Ethernet devices. Change-Id: I23109ad8774daeb07eeba5de615700fec643dfdb Reviewed-on: http://gerrit.chromium.org/gerrit/5026 Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Doug Anderson <dianders@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2011-08-24Add tftp speed indicationSimon Glass
This prints a tftp speed indication after the download completes. This is the 3.6 MiB/s indicator below. Tegra2 (SeaBoard) # tftp ... Using asx0 device TFTP from server 172.22.72.144; our IP address is 172.22.73.81 Filename '/tftpboot/uImage-user-seaboard-1'. Load address: 0x408000 Loading: ################################################# 3.6 MiB/s done BUG=chromium-os:13228 TEST=Boot on Seaboard, make sure message appears. Use 'time tftp ...' to make sure that speed reported is approximately right. Change-Id: I5e96e2ef6aa196a6fd8486f2dae0fe11f7464f20 Reviewed-on: http://gerrit.chromium.org/gerrit/225 Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
2011-08-24Add microsecond boot time measurementSimon Glass
This defines the basics of a new boot time measurement feature. This allows logging of very accurate time measurements as the boot proceeds, by using an available microsecond counter. To enable the feature, define CONFIG_BOOTSTAGE in your board config file. Also available is CONFIG_BOOTSTAGE_REPORT which will cause a report to be printed just before handing off to the OS. BUG=chromium-os:13875 TEST=build and boot, check that progress is reported before running Linux: Timer summary in microseconds: Mark Elapsed Stage 0 0 awake 2,181,078 2,181,078 usb_start 11,861,817 9,680,739 bootp_start 11,884,610 22,793 bootp_stop 11,884,689 79 tftp start 15,271,536 3,386,847 tftp done 15,271,568 32 bootm_start 15,406,551 134,983 start_kernel Change-Id: I71b89c8402dc5dec75e68333bd24a6bab7500a1b Reviewed-on: http://gerrit.chromium.org/gerrit/197 Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
2011-06-01net/net.c: Update ipaddr if the environment has changedEnric Balletbo i Serra
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>
2011-05-19net/tftp.c: fix typoLuca Ceresoli
Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de> Acked-by: Detlev Zundel <dzu@denx.de>
2011-05-19TFTP: add tftpsrv commandLuca Ceresoli
Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de> Acked-by: Detlev Zundel <dzu@denx.de>
2011-05-19TFTP: net/tftp.c: add server mode receiveLuca Ceresoli
Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de> Acked-by: Detlev Zundel <dzu@denx.de>
2011-05-19TFTP: rename STATE_RRQ to STATE_SEND_RRQLuca Ceresoli
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>
2011-05-19TFTP: replace "server" with "remote" in local variable namesLuca Ceresoli
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>
2011-05-19net/tftp.c: cosmetic: do not initialise statics to 0 or NULLLuca Ceresoli
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>
2011-05-19net/tftp.c: cosmetic: fix indentationLuca Ceresoli
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>
2011-05-19net/tftp.c: cosmetic: trailing statements should be on next lineLuca Ceresoli
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>
2011-05-19net/tftp.c: cosmetic: fix brace issuesLuca Ceresoli
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>
2011-05-19net/tftp.c: cosmetic: do not use assignment in if conditionLuca Ceresoli
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>
2011-05-19net/tftp.c: cosmetic: fix pointer syntax issuesLuca Ceresoli
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>
2011-05-19net/tftp.c: cosmetic: fix whitespace issuesLuca Ceresoli
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>
2011-05-19net/tftp.c: cosmetic: fix lines over 80 charactersLuca Ceresoli
Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it> Cc: Wolfgang Denk <wd@denx.de>
2011-05-12net/net.c: cosmetic: do not use assignment in if conditionLuca Ceresoli
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>
2011-05-12net/net.c: cosmetic: fix indentationLuca Ceresoli
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>
2011-05-12net/net.c: cosmetic: parentheses not required for returnLuca Ceresoli
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>
2011-05-12net/net.c: cosmetic: fix pointer syntax issuesLuca Ceresoli
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>
2011-05-12net/net.c: cosmetic: fix brace issuesLuca Ceresoli
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>
2011-05-12net/net.c: cosmetic: fix whitespace issuesLuca Ceresoli
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>
2011-05-12net/net.c: cosmetic: variable initializationsLuca Ceresoli
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>
2011-05-12net/net.c: cosmetic: fix lines over 80 charactersLuca Ceresoli
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>
2011-05-12NET: pass source IP address to packet handlersLuca Ceresoli
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>
2011-05-12netconsole: remove `serverip' checkSimon Guinot
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>
2011-04-28NET: Correct potential missing goto label in case statement.Gray Remlin
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>
2011-04-20Create PHY Lib for U-BootAndy Fleming
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>
2011-04-13Fix bad padding of bootp request packetSimon Glass
This seems to pad to one byte longer than required Signed-off-by: Simon Glass <sjg@chromium.org>
2011-02-19Fix compile warning in net/eth.cRemy Bohmer
Signed-off-by: Remy Bohmer <linux@bohmer.net>
2011-02-19Add USB host ethernet adapter supportSimon Glass
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>
2010-11-28string_to_VLAN: constify "var" argMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-11-28copy_filename: constify "src" argMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-11-17Switch from archive libraries to partial linkingSebastien Carlier
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>
2010-11-15Net: clarify board/cpu_eth_init callsBen Warren
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>
2010-11-14net: Fix potential empty DHCP Parameter Request ListJason Liu
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>
2010-10-11rarp: Condtionally compile rarp supportPeter Tyser
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>
2010-10-11Net: Remove redundant CONFIG_NET_MULTI directivesBen Warren
All are within an #ifdef CONFIG_NET_MULTI block already Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2010-08-09Fix compile warnings for const correctnessBen Warren
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>
2010-07-12net: warn about spaces in device namesMike Frysinger
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>
2010-06-20net/eth.c: eth_mac_skip() is only needed when CONFIG_NET_MULTI is setWolfgang Denk
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>