summaryrefslogtreecommitdiffstats
path: root/net
Commit message (Collapse)AuthorAgeFilesLines
* Move console definitions into a new console.h fileSimon Glass2015-11-191-0/+1
| | | | | | | | The console includes a global variable and several functions that are only used by a small subset of U-Boot files. Before adding more functions, move the definitions into their own header file. Signed-off-by: Simon Glass <sjg@chromium.org>
* net: eth: Check return value in various placesBin Meng2015-10-291-18/+25
| | | | | | | | | | | eth_get_dev() can return NULL which means device_probe() fails for that ethernet device. Add return value check in various places or U-Boot will crash due to NULL pointer access. With this commit, 'dm_test_eth_act' test case passes. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* net: eth: Clear MAC address in eth_pre_remove()Bin Meng2015-10-291-0/+5
| | | | | | | | | | | platdata->enetaddr was assigned to a value in dev_probe() last time. If we don't clear it, for dev_probe() at the second time, dm eth will end up treating it as a MAC address from ROM no matter where it came from originally (maybe env, ROM, or even random). Fix this by clearing platdata->enetaddr when removing an Ethernet device. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* net: Increase the size of the net_boot_file_name bufferJacob Stiffler2015-10-291-1/+1
| | | | | | | | | | | The net_boot_file_name buffer is used as storage for the bootfilename command line argument to network boot commands such as tftp and nfs. Increase the size of this buffer to 1024 bytes as the current size of 128 bytes is restrictive for arbitrary paths on the server. Signed-off-by: Jacob Stiffler <j-stiffler@ti.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* net: parse DHCP options from overloaded file/sname fieldsStefan Brüns2015-10-291-10/+32
| | | | | | | | | | | If Option 52 in the vendor option field signals overloading of the file and/or sname fields, these field may contain additional options. Formatting of file/sname contained options is the same as in the vendor options field, but without the leading magic. Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* net: Do not overwrite options found in overloaded 'file' fieldStefan Brüns2015-10-291-26/+18
| | | | | | | | If 'file' is overloaded, it is wrong to get or put the bootfile name from it/to it. Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* net: change the env name to use constJosh Wu2015-10-281-2/+2
| | | | | | | | As we don't modify the 'name' parameter, so change it to const. Signed-off-by: Josh Wu <josh.wu@atmel.com> Reviewed-by: Simon Glass <sjg@chromium.org> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* net/eth: fix a bug in on_ethaddr()Gong Qianyu2015-10-281-0/+1
| | | | | | | | | The loop should check all ethenet devices, not only the first device, to set each specified ethaddr, or it'll cause failure when we use other devices. Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* net: cancel timeout handler after DHCPACKStefan Brüns2015-10-281-0/+1
| | | | | | | | | Timeout handler should be stopped after reception of DHCPACK. If "autoload" is not set, the handler is immediately replaced by the TFTP handler, otherwise it may trigger before the next boot stage begins. Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* net/arp: account for ARP delay, avoid duplicate packets on timeoutStefan Brüns2015-10-283-4/+7
| | | | | | | | | | | eth_rx() in the main reception loop may trigger sending a packet which is already timed out (or will immediately) upon reception of an ARP reply. As long as the ARP reply is pending, the timeout handler of a packet should be postponed. Happens on TFTP with bad network (e.g. WLAN). Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* net/arp: Do not run net_start_again() on timeoutStefan Brüns2015-10-281-1/+1
| | | | | | | net_start_again() will be called from net_loop() if state is NETLOOP_FAIL. Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* net: Fix parsing of Bootp/DHCP option 0 (Pad)Stefan Brüns2015-10-281-1/+10
| | | | | | | Pad has no len byte, so the normal parsing code fails. Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* net: send RFC1542 compliant value for bootp requestsStefan Brüns2015-10-281-2/+6
| | | | | | | | | | | RFC1542, 3.2: "The 'secs' field of a BOOTREQUEST message SHOULD represent the elapsed time, in seconds, since the client sent its first BOOTREQUEST message. Note that this implies that the 'secs' field of the first BOOTREQUEST message SHOULD be set to zero." Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* net: reject Bootp/DHCP packets with bad OP valueStefan Brüns2015-10-281-8/+5
| | | | | | | | | | | Rename check_packet to check_reply_packet to make its function more obvious. The check for DHCP_* values is completely off, as it should compare against DHCP option 53 (Message Type). Only valid value for any Bootp/DHCP reply is BOOTREPLY. Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* net: protect status led access in bootpThomas Chou2015-10-281-1/+1
| | | | | | | This fixes the error when STATUS_LED_BOOT is not defined. Signed-off-by: Thomas Chou <thomas@wytron.com.tw> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* net: bootp fix vci string on SPL-BootHannes Petermaier2015-10-281-1/+3
| | | | | | | | | | | | | | | | If CONFIG_CMD_DHCP is enabled, the vci (vendor-class-identifier) string isn't inserted into the bootp-packet during SPL stage because the CONFIG_BOOTP_VCI_STRING instead CONFIG_SPL_NET_VCI_STRING We fix this with testing for CONFIG_SPL_BUILD and testing for existing CONFIG_SPL_NET_VCI_STRING. Signed-off-by: Hannes Schmelzer <oe5hpm@oevsv.at> Acked-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Tom Rini <trini@konsulko.com>
* net: TFTP: variables cleanup and additionAlbert ARIBAUD \(3ADEV\)2015-10-282-2/+25
| | | | | | | | | | | | | | | | | | | TFTP source and destination port variable names are 'tftpsrcp' and 'tftpdstp' in the code, but 'tftpsrcport' and 'tftpdstport' in the README file. Fix the README. Add environment variable 'tftptimeoutcountmax'. As per the comments about the global variable tftp_timeout_count_max, make sure tftptimeoutcountmax is nonnegative. Introduce configuration option CONFIG_NET_TFTP_VARS, which controls whether environment variables tftpblocksize, tftptimeout, and tftptimoueoutcountmax are read by the TFTP client code. CONFIG_NET_TFTP_VARS defaults to y but can be set to n by targets with to tight size contraints. Make bf527-ezkit set CONFIG_NET_TFTP_VARS to n to keep the target size below limit.
* net: support NETCONSOLE option via KconfigBernhard Nortmann2015-09-291-0/+6
| | | | | | | | | | | | | | This patch introduces CONFIG_NETCONSOLE as an option to the Kconfig system. Joe Hershberger pointed out that it may not be entirely free of problems, as many boards predating the driver model define this symbol directly via include files. In case they're not properly migrated, their NetConsole might 'vanish' if they start to use CONFIG_NET or CONFIG_NETDEVICES. Signed-off-by: Bernhard Nortmann <bernhard.nortmann@web.de> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* net: expose eth_is_active() function to test network device stateBernhard Nortmann2015-09-291-1/+17
| | | | | | | | | | | | | | | | | | | | The previous eth_device struct returned by eth_get_dev() allowed code to directly query the state member field. However, with CONFIG_DM_ETH this data gets encapsulated (i.e. private), and eth_get_dev() returns a udevice struct 'abstraction' instead. This breaks legacy code relying on the former behaviour - e.g. netconsole. (see http://lists.denx.de/pipermail/u-boot/2015-June/216528.html) The patch introduces a method to retrieve the ethernet device state in a 'clean' and uniform way, supporting both legacy code and driver model. The new function eth_is_active() accepts a device struct pointer and tests it for ETH_STATE_ACTIVE. Signed-off-by: Bernhard Nortmann <bernhard.nortmann@web.de> Reviewed-by: Simon Glass <sjg@chromium.org> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* dm: eth: Correctly detect alias in eth_get_dev_by_name()Bin Meng2015-09-091-2/+3
| | | | | | | | When given a device name string, we should test to see if it is really an alias like "eth#". Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* dm: eth: Do not print misleading "Net Initialization Skipped"Bin Meng2015-09-091-0/+2
| | | | | | | | With driver model, board_eth_init() or cpu_eth_init() is not a must. Thus we don't need print a misleading "Net Initialization Skipped". Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* net: Revert "tftp: adjust settings to be suitable for 100Mbit ethernet"Bin Meng2015-09-091-5/+5
| | | | | | | | | | | | | | | | | | | | | Commit 620776d "tftp: adjust settings to be suitable for 100Mbit ethernet" causes the following error message when trying to load a file using 'tftp' command via a tftp server. TFTP error: 'Unsupported option(s) requested' (8) This is due to with commit 620776d changes, the tftp option 'timeout' value is now set to zero which is an invalid value as per RFC2349 [1]. Valid values range between "1" and "255" seconds, inclusive. With some tftp servers that strictly implement the RFC requirement, it reports such an error message. Revert commit 620776d for RFC compliance. [1] https://www.ietf.org/rfc/rfc2349.txt Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* net: tftp: Move tftp.h file from ./net to ./include/netLukasz Majewski2015-09-075-34/+4
| | | | | | | | | | This change gives the ability to reuse the <tftp.h> header file by other subsystems (like e.g. dfu). Without this change compilation error emerges for the legacy update.c file. Signed-off-by: Lukasz Majewski <l.majewski@majess.pl> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* net: Return -EINTR when ctrl+c is pressedMichal Simek2015-08-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Current behavior is that if CTRL+C is pressed command returns 0 that was successful which is not correct behavior. The easiest test case is "tftpboot 80000 uImage && echo yes" and press CTRL+C. Then the second command is called which is incorrect. Error log: zynq-uboot> tftpb 80000 uImage && echo yes Gem.e000b000:7 is connected to Gem.e000b000. Reconnecting to Gem.e000b000 Gem.e000b000 Waiting for PHY auto negotiation to complete....... done Using Gem.e000b000 device TFTP from server 192.168.0.102; our IP address is 192.168.0.101 Filename 'uImage'. Load address: 0x80000 Loading: ################ Abort yes zynq-uboot> This patch adds -EINTR return value when CTRL+C is pressed. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Tom Rini <trini@konsulko.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* tftp: adjust settings to be suitable for 100Mbit ethernetPavel Machek2015-08-211-5/+5
| | | | | | | | | | | | | | | | Adjust timouts and retry counts to be suitable for loaded ethernet network. With 5 seconds timeout, 10 retries maximum, tftp is impossible even on local network with single full-speed TCP connection. 100msec timeout should be suitable for most networks tftp is used on, that is local ethernets. Timeout count really needs to be way higher, as lost packets are normal when TCP is running over the same network. Enforce 10msec minimum. Signed-off-by: Pavel Machek <pavel@denx.de> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* tftp.c: fix CONFIG_TFTP_TSIZE for small filesMax Krummenacher2015-08-121-0/+2
| | | | | | | | | | | | | | | | | CONFIG_TFTP_TSIZE should limit a tftp downloads progress to 50 '#' chars. Make this work also for small files. If the file size is small, i.e. smaller than 2 tftp block sizes the number of '#' can get much larger. i.e. with a 1 byte file 65000 characters are printed, with a 512 byte file around 500. When using CONFIG TFTP BLOCKSIZE together with CONFIG_IP_DEFRAG the issue is more notable. Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> Reviewed-by: Marek Vasut <marex@denx.de> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* net: Allow drivers to return -ENOSYS with the write_hwaddr() methodSimon Glass2015-07-211-0/+6
| | | | | | | | | | | | Some drivers may want to implement this method for some of their devices but not for others. So it is not possible to just leave the operation out of the table. Drivers could get around this by masquerading as two separate drivers but that seems unpleasant. Allow the driver to return an error when it does not want to process the write_hwaddr() method. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: eth: Avoid blocking on packet receptionSimon Glass2015-07-211-1/+4
| | | | | | | | | | | | | | | | | | | | Some devices can take a long time to work out whether they have a new packet or now. For example the ASIX USB Ethernet dongle can take 5 seconds to do this, since it waits until it gets a new packet on the wire before allowing the USB bulk read packet to be submitted. At present with driver mode the Ethernet receive code reads 32 packets. This can take a very long time if we must wait for all 32 packets. The old code (before driver model) worked by reading a single set of packets from the USB device, then processing all the packets with in. It would be nice to use the same behaviour with driver model. Add a flag to the receive method which indicates that the driver should try to find a packet if available, by consulting the hardware. When the flag is not set, it should just return any packet data it has already received. If there is none, it should return -EAGAIN so that the loop will terminate. Signed-off-by: Simon Glass <sjg@chromium.org>
* Allow CONFIG_REGEX to be disabled when CONFIG_NETJoe Hershberger2015-07-081-1/+0
| | | | | | | | | | | Instead of selecting REGEX when NET is enabled, make it the default, but allow boards that are tiny to disable it and lose functionality on all but the first Ethernet adapter. cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have more than one Ethernet interface. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* net: Fix NET_RANDOM_ETHADDR dependenciesMichal Simek2015-06-011-0/+1
| | | | | | | | | | NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to Kconfig to ensure that library is also compiled. Remove the definitions from Blackfin boards' include/configs. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* net: Handle ethaddr changes as an env callbackJoe Hershberger2015-05-212-43/+61
| | | | | | | | | | | When the ethaddr is changed in the env, update the device pdata at the same time (only if it is probed for the DM case; only if registered for the non-DM case). Again this gets us closer to completely non-polled env needed to simplify the net_loop. This requires that the NET feature select the REGEX feature. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* net: Remove duplicate bootfile syncing functionalityJoe Hershberger2015-05-211-12/+0
| | | | | | | The bootfile env var is already kept up to date by the callback in net.c so there is no need to poll it too. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* net: Use env callbacks for net variablesJoe Hershberger2015-05-211-16/+89
| | | | | | | | | | Instead of checking for changes to the env each time we enter the net_loop, use the env callbacks to update the values of the variables. Don't update the variables when the source was programmatic, since the variables were the source of the new value. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* net: Implement random ethaddr fallback in eth.cJoe Hershberger2015-05-192-0/+20
| | | | | | | | | Implement the random ethaddr fallback in eth.c so it is in a common place and not reimplemented in each board or driver that wants this behavior. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* net: Update hardware MAC address if it changes in envJoe Hershberger2015-05-191-28/+48
| | | | | | | | | | | | When the ethaddr changes in the env, the hardware should also be updated so that MAC filtering will work properly without resetting U-Boot. Also remove the manual calls to set the hwaddr that was included in a few drivers as a result of the framework not doing it. Reported-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Tested-by: Michal Simek <michal.simek@xilinx.com>
* dm: net: rtc: Support using driver model for rtc in sntpSimon Glass2015-05-051-0/+12
| | | | | | | When setting the date, support driver model RTC also. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* dm: rtc: Rename to_tm() to rtc_to_tm() and add error codeSimon Glass2015-05-051-1/+1
| | | | | | | | | | Rename this function so that it is clear that it is provided by the RTC. Also return an error when it cannot function as expected. This is unlikely to occur since it works for dates since 1752 and many RTCs do not support such old dates. Still it is better to be accurate. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Heiko Schocher <hs@denx.de>
* dm: net: Use existing Ethernet init for driver modelSimon Glass2015-04-181-37/+42
| | | | | | | | | | | | | At present even with driver model is used there is still much manual init of related devices: PHY, environment and board init. Until these requirements are dealt with in another way we need to keep them around. Break out the init portion of the legacy eth_initialize() into a separate function and call it from both the legacy and driver model eth_initialize() functions. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* net: Fix compile errors when SNTP enabled and not DATEJoe Hershberger2015-04-181-1/+5
| | | | | | | | When SNTP is enabled and DATE is not, to_tm() is not built in. It could be defined when TIMESTAMP is defined, so check for that. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* net: Convert protocol structures to use explicit sizesSergey Temerkhanov2015-04-181-7/+7
| | | | | | | | | Convert uchar/ushort to u8/u16 respectively. Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com> Signed-off-by: Sergey Temerkhanov <s.temerkhanov@gmail.com> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* net: Fix incorrect DHCP/BOOTP packets on 64-bit systemsSergey Temerkhanov2015-04-182-19/+18
| | | | | | | | | | | | This commit fixes incorrect DHCP/BOOTP packet layout caused by 'ulong' type size difference on 64 and 32-bit architectures. It also renames NetReadLong()/NetCopyLong() to net_read_u32/net_copy_u32() accordingly. Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com> Signed-off-by: Sergey Temerkhanov <s.temerkhanov@gmail.com> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* net: cosmetic: Fix checkpatch.pl failures in net.cJoe Hershberger2015-04-1812-134/+135
| | | | | | | Finish eliminating CamelCase from net.c and other failures Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* net: cosmetic: Fix checkpatch.pl failures in eth.cJoe Hershberger2015-04-181-10/+16
| | | | | | | | There were still a few failures in net/eth.c, especially in the legacy part of the code. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* net: cosmetic: Fix checkpatch.pl failures in linklocalJoe Hershberger2015-04-181-19/+17
| | | | | | | A few new rules in checkpatch.pl since linklocal.c was added. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* net: cosmetic: Clean up cmd_net variables and functionsJoe Hershberger2015-04-181-13/+13
| | | | | | | | Make a thorough pass through all variables and function names contained within common/cmd_net.c and remove CamelCase and improve naming. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* net: cosmetic: Clean up netconsole variables and functionsJoe Hershberger2015-04-181-1/+1
| | | | | | | | Make a thorough pass through all variables and function names contained within netconsole.c and remove CamelCase and improve naming. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* net: cosmetic: Clean up DNS variables and functionsJoe Hershberger2015-04-183-30/+27
| | | | | | | | Make a thorough pass through all variables and function names contained within dns.c and remove CamelCase and improve naming. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* net: cosmetic: Clean up CDP variables and functionsJoe Hershberger2015-04-183-39/+35
| | | | | | | | Make a thorough pass through all variables and function names contained within cdp.c and remove CamelCase and improve naming. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* net: cosmetic: Clean up ping variables and functionsJoe Hershberger2015-04-181-6/+7
| | | | | | | | Make a thorough pass through all variables and function names contained within ping.c and remove CamelCase and improve naming. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* net: cosmetic: Clean up SNTP variables and functionsJoe Hershberger2015-04-183-16/+13
| | | | | | | | Make a thorough pass through all variables and function names contained within sntp.c and remove CamelCase and improve naming. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
OpenPOWER on IntegriCloud