summaryrefslogtreecommitdiff
path: root/net
Commit message (Collapse)AuthorAgeFilesLines
* Remove unnecessary instances of DECLARE_GLOBAL_DATA_PTRTom Rini2018-04-271-2/+0
| | | | | | | | We have a large number of places where while we historically referenced gd in the code we no longer do, as well as cases where the code added that line "just in case" during development and never dropped it. Signed-off-by: Tom Rini <trini@konsulko.com>
* net: Make core net code depend on NET instead of CMD_NETJoe Hershberger2018-04-131-5/+5
| | | | | | | | No commands are necessary to have a network stack. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Duncan Hare <dh@synoia.com>
* net: Move net command options to the cmd menuJoe Hershberger2018-04-131-50/+0
| | | | | | | | | | Options that controlled the tftp and bootp commands depended on their commands, but lived in the net menu. Move them so they are in a consistent location. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Chris Packham <judge.packham@gmail.com>
* net: Make CMD_NET a menuconfigJoe Hershberger2018-04-132-12/+11
| | | | | | | | | | | Previously, CMD_NET was an alias for 2 commands (bootp and tftpboot) and they we not able to be disabled. Separate out those 2 commands and move CMD_NET up to the menu level, which more accurately represents the code. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Chris Packham <judge.packham@gmail.com> Reviewed-by: Duncan Hare <dh@synoia.com>
* net: Move enetaddr env access code to env config instead of net configAlex Kiernan2018-04-081-30/+1
| | | | | | | | | | | | | | | | | | | | In order that we can use eth_env_* even when CONFIG_NET isn't set, move these functions to environment code from net code. This fixes failures such as: board/ti/am335x/built-in.o: In function `board_late_init': board/ti/am335x/board.c:752: undefined reference to `eth_env_set_enetaddr' u-boot/board/ti/am335x/board.c:766: undefined reference to `eth_env_set_enetaddr' which caters for use cases such as: commit f411b5cca48f ("board: am335x: Always set eth/eth1addr environment variable") when Ethernet is required in Linux, but not U-Boot. Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
* net: Only access network devices after initAlexander Graf2018-03-221-2/+2
| | | | | | | | | | | | In the efi_loader main loop we call eth_rx() occasionally. This rx function might end up calling into devices that haven't been initialized yet, potentially resulting in a lot of transfer timeouts. Instead, let's make sure the ethernet device is actually initialized before reading from or writing to it. Signed-off-by: Alexander Graf <agraf@suse.de> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* net: Fix netretry conditionLeonid Iziumtsev2018-03-221-1/+1
| | | | | | | | | | | | | | | The "net_try_count" counter starts from "1". And the "retrycnt" contains requested amount of retries. With current logic, that means that the actual retry amount will be one time less then what we set in "netretry" env. For example setting "netretry" to "once" will make "retrycnt" equal "1", so no retries will be triggered at all. Fix the logic by changing the statement of "if" condition. Signed-off-by: Leonid Iziumtsev <leonid.iziumtsev@se.atlascopco.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* Kconfig: cmd: Make networking command dependent on NETMichal Simek2018-02-271-0/+11
| | | | | | | | Enable networking command only when NET is enabled. And remove selecting NET for CMD_NET Signed-off-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Tom Rini <trini@konsulko.com>
* Convert CONFIG_BOOTP_BOOTPATH et al to KconfigAdam Ford2018-02-231-0/+18
| | | | | | | | | | | | | | | | | | | This converts the following to Kconfig: CONFIG_BOOTP_BOOTPATH CONFIG_BOOTP_DNS CONFIG_BOOTP_GATEWAY CONFIG_BOOTP_HOSTNAME CONFIG_BOOTP_PXE CONFIG_BOOTP_SUBNETMASK CONFIG_CMDLINE_EDITING CONFIG_AUTO_COMPLETE CONFIG_SYS_LONGHELP CONFIG_SUPPORT_RAW_INITRD CONFIG_ENV_VARS_UBOOT_CONFIG Signed-off-by: Adam Ford <aford173@gmail.com> [trini: Re-run the migration] Signed-off-by: Tom Rini <trini@konsulko.com>
* Convert CONFIG LIB_HW_RAND to KconfigAdam Ford2018-02-081-1/+0
| | | | | | | | | | | | config_fallbacks.h had some logic to automatically select LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't already selected. By migrating LIB_HW_RAND to Kconfig, we can remove this check from config_fallbacks.h and put it into Kconfig Signed-off-by: Adam Ford <aford173@gmail.com> Reviewed-by: Lukasz Majewski <lukma@denx.de> [trini: Turn into a choice, add NET_RANDOM_ETHADDR] Signed-off-by: Tom Rini <trini@konsulko.com>
* net: dhcp: Allow "MAY_FAIL" to still try each adapterJoe Hershberger2018-01-151-5/+12
| | | | | | | | | | | This change allows the "MAY_FAIL" DHCP option to still attempt to contact a DHCP server on each adapter and only give up once each adapter has failed once. To get the existing behavior, set the already-existing ethrotate=no variable. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Cc: Keng Soon Cheah <keng.soon.cheah@ni.com> Cc: Chen Yee Chew <chen.yee.chew@ni.com>
* net: Remove nfs.h include from bootp.cJoe Hershberger2018-01-151-1/+0
| | | | | | Nothing from this header is used there, so remove it. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* net/tftp: fix build if CMD_BOOTEFI is not setJörg Krause2017-09-221-0/+2
| | | | | | | | Fixes: net/tftp.c:811: undefined reference to `efi_set_bootdev' Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* net: nfs: Drop CONFIG_NFS_READ_SIZETom Rini2017-09-071-8/+5
| | | | | | | | | | | In the general case, CONFIG_NFS_READ_SIZE is unchanged from the default of 1024. There are in fact no in-tree users that increase this size. Adjust the comment to reflect what could be done in the future in conjunction with CONFIG_IP_DEFRAG. Cc: Joe Hershberger <joe.hershberger@ni.com> Signed-off-by: Tom Rini <trini@konsulko.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* env: Rename some other getenv()-related functionsSimon Glass2017-08-162-2/+2
| | | | | | | | | | | | | | We are now using an env_ prefix for environment functions. Rename these other functions as well, for consistency: getenv_vlan() getenv_bootm_size() getenv_bootm_low() getenv_bootm_mapsize() env_get_default() Suggested-by: Wolfgang Denk <wd@denx.de> Signed-off-by: Simon Glass <sjg@chromium.org>
* env: Rename eth_getenv_enetaddr() to eth_env_get_enetaddr()Simon Glass2017-08-163-6/+6
| | | | | | Rename this function for consistency with env_get(). Signed-off-by: Simon Glass <sjg@chromium.org>
* env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()Simon Glass2017-08-162-2/+2
| | | | | | | | We are now using an env_ prefix for environment functions. Rename these for consistency. Also add function comments in common.h. Suggested-by: Wolfgang Denk <wd@denx.de> Signed-off-by: Simon Glass <sjg@chromium.org>
* env: Rename getenv/_f() to env_get()Simon Glass2017-08-166-24/+24
| | | | | | | | | | | We are now using an env_ prefix for environment functions. Rename these two functions for consistency. Also add function comments in common.h. Quite a few places use getenv() in a condition context, provoking a warning from checkpatch. These are fixed up in this patch also. Suggested-by: Wolfgang Denk <wd@denx.de> Signed-off-by: Simon Glass <sjg@chromium.org>
* env: Rename eth_setenv_enetaddr() to eth_env_set_enetaddr()Simon Glass2017-08-164-8/+8
| | | | | | Rename this function for consistency with env_set(). Signed-off-by: Simon Glass <sjg@chromium.org>
* env: Rename common functions related to setenv()Simon Glass2017-08-161-2/+2
| | | | | | | | | We are now using an env_ prefix for environment functions. Rename these commonly used functions, for consistency. Also add function comments in common.h. Suggested-by: Wolfgang Denk <wd@denx.de> Signed-off-by: Simon Glass <sjg@chromium.org>
* env: Rename setenv() to env_set()Simon Glass2017-08-164-6/+6
| | | | | | | | We are now using an env_ prefix for environment functions. Rename setenv() for consistency. Also add function comments in common.h. Suggested-by: Wolfgang Denk <wd@denx.de> Signed-off-by: Simon Glass <sjg@chromium.org>
* net: Use packed structures for networkingDenis Pynkin2017-08-074-4/+4
| | | | | | | | | | | | | | | | | | | | | | | PXE boot is broken with GCC 7.1 due option '-fstore-merging' enabled by default for '-O2': BOOTP broadcast 1 data abort pc : [<8ff8bb30>] lr : [<00004f1f>] reloc pc : [<17832b30>] lr : [<878abf1f>] sp : 8f558bc0 ip : 00000000 fp : 8ffef5a4 r10: 8ffed248 r9 : 8f558ee0 r8 : 8ffef594 r7 : 0000000e r6 : 8ffed700 r5 : 00000000 r4 : 8ffed74e r3 : 00060101 r2 : 8ffed230 r1 : 8ffed706 r0 : 00000ddd Flags: nzcv IRQs off FIQs off Mode SVC_32 Resetting CPU ... Core reason is usage of structures for network headers without packed attribute. Reviewed-by: Yauheni Kaliuta <yauheni.kaliuta@redhat.com> Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* net: Fix compile failure in net.cHolger Dengler2017-08-071-2/+2
| | | | | | | Add missing "defined" statement to fix the compile failures. Signed-off-by: Holger Dengler <dengler@linutronix.de> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* net: tftp: silence a subscript above array bounds compile time warningVladimir Zapolskiy2017-08-071-2/+2
| | | | | | | | | | | | | | | | | | | | For strncpy() select a minimal string length of destination and source strings, here DEFAULT_NAME_LEN is preferable to MAX_LEN. Due to the NUL-terminated contents of default_string the change is a noop, however it removes a compilation warning if SH2/3/4 platform specific strncpy() function is used: In file included from include/linux/string.h:21:0, from include/common.h:28, from net/tftp.c:9: net/tftp.c: In function 'tftp_start': arch/sh/include/asm/string.h:52:42: warning: array subscript is above array bounds [-Warray-bounds] : "0" (__dest), "1" (__src), "r" (__src+__n) Signed-off-by: Vladimir Zapolskiy <vz@mleia.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* net: Get mac address from driver as seedJimmy Du2017-08-071-2/+2
| | | | | | | | | Previously seeded by obtaining mac addr from env. If mac addr was never set, rand would output 0. This fix obtains the mac addr from driver instead. Signed-off-by: Jimmy Du <jimmy.du@ni.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* net: core: avoid possible NULL pointer dereferencexypron.glpk@gmx.de2017-06-021-1/+2
| | | | | | | Checking if dev is NULL after dereferencing it does not make sense. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* net: Disable the format-extra-args warningTom Rini2017-05-121-0/+5
| | | | | | | | | | | | We will see warnings such as: net/eth_common.c:57:61: warning: data argument not used by format string [-Wformat-extra-args] sprintf(enetvar, index ? "%s%daddr" : "%saddr", base_name, index); ~~~~~~~~ ^ With clang. In this case we do not want to re-write our code to be less compact as the above is intentional and readable. Add a comment above the disabling so that it's clear why we want that warning off. Signed-off-by: Tom Rini <trini@konsulko.com>
* net/arp: remove superfluous assignmentsxypron.glpk@gmx.de2017-05-121-3/+0
| | | | | | | | The value of variable pkt is never used. The problem was indicated by clang scan-build. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* net: link_local: Fix netmask endianness bugAlexandre Messier2017-03-261-1/+1
| | | | | | | | | | | | The network mask must be stored in network order when in a 'struct in_addr'. This fix removes the "gatewayip needed but not set" message on the console when using a link-local IP setup. Signed-off-by: Alexandre Messier <amessier@tycoint.com> Signed-off-by: Sylvain Lemieux <slemieux@tycoint.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* net: don't override ethernet address environmentRoger Quadros2017-03-201-0/+3
| | | | | | | | | | If the ethernet address environment is set with a valid ethernet address prevent overriding it as it is most likely set by the user and he/she doesn't want board code to automatically override it whatsoever. Signed-off-by: Roger Quadros <rogerq@ti.com> Reviewed-by: Tom Rini <trini@konsulko.com>
* net: core: cosmetic: A MAC address is not limited to SROMoliver@schinagl.nl2017-02-071-1/+1
| | | | | | | | Currently, we print that the MAC from the SROM does not match. It can be many forms of ROM, so lets drop the S. Signed-off-by: Olliver Schinagl <oliver@schinagl.nl> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* net: cosmetic: Make the MAC address string less magicaloliver@schinagl.nl2017-02-071-1/+1
| | | | | | | | | | In u-boot printf has been extended with the %pM formatter to allow printing of MAC addresses. However buffers that want to store a MAC address cannot safely get the size. Add a define for this case so the string of a MAC address can be reliably obtained. Signed-off-by: Olliver Schinagl <oliver@schinagl.nl> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* net: cosmetic: Do not use magic values for ARP_HLENoliver@schinagl.nl2017-02-072-10/+10
| | | | | | | | | | | Commit 674bb249825a ("net: cosmetic: Replace magic numbers in arp.c with constants") introduced a nice define to replace the magic value 6 for the ethernet hardware address. Replace more hardcoded instances of 6 which really reference the ARP_HLEN (iow the MAC/Hardware/Ethernet address). Signed-off-by: Olliver Schinagl <oliver@schinagl.nl> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* status_led: Kconfig migrationUri Mashiach2017-01-212-12/+14
| | | | | | | | | | | | | Move all of the status LED feature to drivers/led/Kconfig. The LED status definitions were moved from the board configuration files to the defconfig files. TBD: Move all of the definitions in the include/status_led.h to the relevant board's defconfig files. Tested boards: CL-SOM-AM57x, CM-T335 Signed-off-by: Uri Mashiach <uri.mashiach@compulab.co.il>
* net: write enetaddr down to hardware on env_callbackMarek Vasut2016-11-131-0/+1
| | | | | | | | | | | | If mac-address is changed using "setenv ethaddr ...." command the new mac-adress also must be written into the responsible ethernet driver. This fixes the legacy ethernet handling. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Hannes Schmelzer <oe5hpm@oevsv.at> Cc: Joe Hershberger <joe.hershberger@ni.com> Cc: Tom Rini <trini@konsulko.com> Reviewed-by: Hannes Schmelzer <oe5hpm@oevsv.at>
* net: use random ethernet address if invalid and not zeroSiva Durga Prasad Paladugu2016-11-071-1/+2
| | | | | | | | | | Use random ethernet address if the ethernet address found is invalid, not zero and config for random address is defined. Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* net: write enetaddr down to hardware on env_callbackHannes Schmelzer2016-10-131-0/+1
| | | | | | | | If mac-address is changed using "setenv ethaddr ...." command the new mac-adress also must be written into the responsible ethernet driver. Signed-off-by: Hannes Schmelzer <oe5hpm@oevsv.at> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* treewide: replace #include <asm/errno.h> with <linux/errno.h>Masahiro Yamada2016-09-231-1/+1
| | | | | | | | | | | Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have the same content. (both just wrap <asm-generic/errno.h>) Replace all include directives for <asm/errno.h> with <linux/errno.h>. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> [trini: Fixup include/clk.] Signed-off-by: Tom Rini <trini@konsulko.com>
* Kconfig: spl: Add SPL support options to KconfigSimon Glass2016-09-161-3/+0
| | | | | | | | There are a lot of SPL options in U-Boot to enable various features and drivers. Currently these do not use Kconfig. Add them to Kconfig along with suitable help, and drop them from the README. Signed-off-by: Simon Glass <sjg@chromium.org>
* Revert "net: nfs: Correct the reply data buffer size"Joe Hershberger2016-09-091-1/+1
| | | | | | | | | This reverts commit 6279b49e6c2fdaf8665355d1777bc90cd41fcf90. This caused a bad data crc. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reported-by: Guillaume GARDET <guillaume.gardet@free.fr>
* Revert "net: nfs: Use the tx buffer to construct rpc msgs"Joe Hershberger2016-09-091-45/+43
| | | | | | | | | This reverts commit 998372b4798fd7ebb666f571950df925b8d80f69. This caused a data abort on some platform. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reported-by: Guillaume GARDET <guillaume.gardet@free.fr>
* net: nfs: Simplify rpc_add_credentials()Joe Hershberger2016-08-221-16/+3
| | | | | | | We use an empty hostname, so remove all the "processing" of the known-to-be-empty hostname and just write 0's where needed. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* net: nfs: Use the tx buffer to construct rpc msgsJoe Hershberger2016-08-221-43/+45
| | | | | | | | | Instead of always allocating a huge temporary buffer on the stack and then memcpy()ing the result into the transmit buffer, simply figure out where in the transmit buffer the bytes will belong and write them there directly as each message is built. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* net: nfs: Move some prints to debug statementsJoe Hershberger2016-08-221-21/+22
| | | | | | | | Much of the information is verbose and derived directly from the environment. Only output in debug mode. This also saves about 300 bytes from the code size. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* net: nfs: Use consistent names for the rpc_pktJoe Hershberger2016-08-221-17/+17
| | | | | | | Use the same name throughout the nfs code and use the same member of the union to avoid casts. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* net: nfs: Correct a commentJoe Hershberger2016-08-221-1/+1
| | | | | | The buffer is of 32-bit elements, not bytes. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* net: nfs: Consolidate handling of NFSv3 attributesJoe Hershberger2016-08-221-92/+59
| | | | | | | Instead of repeating the same large snippet for dealing with attributes it should be shared with a helper function. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* net: nfs: Fix lines that are too longJoe Hershberger2016-08-221-3/+6
| | | | | | Fix complaints from checkpatch.pl. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* net: nfs: Correct the reply data buffer sizeJoe Hershberger2016-08-221-1/+1
| | | | | | | | | | The type of the buffer is uint32_t, but the parameter used to size it is referring to bytes. Divide by the size of the array elements. Strictly speaking, this shouldn't be needed at all... It could just be 1 just like the request. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* net: nfs: Share the file handle buffer for v2 / v3Joe Hershberger2016-08-221-7/+5
| | | | | | | The v3 handles can be larger than v2, but that doesn't mean we need a separate buffer. Reuse the same (larger) buffer for both. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>