summaryrefslogtreecommitdiff
path: root/net
AgeCommit message (Collapse)Author
2017-08-31net: Use packed structures for networkingDenis Pynkin
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> (cherry picked from commit 704f3acfcf55343043bbed01c5fb0a0094a68e8a) Conflicts: include/net.h upstream changed magic numbers with define Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2016-11-13net: write enetaddr down to hardware on env_callbackMarek Vasut
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>
2016-11-07net: use random ethernet address if invalid and not zeroSiva Durga Prasad Paladugu
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>
2016-10-13net: write enetaddr down to hardware on env_callbackHannes Schmelzer
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>
2016-09-23treewide: replace #include <asm/errno.h> with <linux/errno.h>Masahiro Yamada
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>
2016-09-16Kconfig: spl: Add SPL support options to KconfigSimon Glass
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>
2016-09-09Revert "net: nfs: Correct the reply data buffer size"Joe Hershberger
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>
2016-09-09Revert "net: nfs: Use the tx buffer to construct rpc msgs"Joe Hershberger
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>
2016-08-22net: nfs: Simplify rpc_add_credentials()Joe Hershberger
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>
2016-08-22net: nfs: Use the tx buffer to construct rpc msgsJoe Hershberger
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>
2016-08-22net: nfs: Move some prints to debug statementsJoe Hershberger
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>
2016-08-22net: nfs: Use consistent names for the rpc_pktJoe Hershberger
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>
2016-08-22net: nfs: Correct a commentJoe Hershberger
The buffer is of 32-bit elements, not bytes. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2016-08-22net: nfs: Consolidate handling of NFSv3 attributesJoe Hershberger
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>
2016-08-22net: nfs: Fix lines that are too longJoe Hershberger
Fix complaints from checkpatch.pl. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2016-08-22net: nfs: Correct the reply data buffer sizeJoe Hershberger
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>
2016-08-22net: nfs: Share the file handle buffer for v2 / v3Joe Hershberger
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>
2016-08-22net: NFS: Add NFSv3 supportGuillaume GARDET
This patch enables NFSv3 support. If NFSv2 is available use it as usual. If NFSv2 is not available, but NFSv3 is available, use NFSv3. If NFSv2 and NFSv3 are not available, print an error message since NFSv4 is not supported. Tested on iMX6 sabrelite with 4 Linux NFS servers: * NFSv2 + NFSv3 + NFSv4 server: use NFSv2 protocol * NFSv2 + NFSv3 server: use NFSv2 protocol * NFSv3 + NFSv4 server: use NFSv3 protocol * NFSv3 server: use NFSv3 protocol Signed-off-by: Guillaume GARDET <guillaume.gardet@free.fr> Cc: Tom Rini <trini@konsulko.com> Cc: joe.hershberger@ni.com Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2016-08-22net: nfs: Remove unused defineJoe Hershberger
Unreferenced, so remove the noise. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2016-08-22net: nfs: Remove separate buffer for default nameJoe Hershberger
There is no reason to store the default filename in a separate buffer only to immediately copy it to the main name buffer. Just write it there directly and remove the other buffer. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2016-08-22net: Stop including NFS overhead in defragment maxJoe Hershberger
At least on bfin, this "specimen" is actually allocated in the BSS and wastes lots of memory in already tight memory conditions. Also, with the introduction of NFSv3 support, this waste got substantially larger. Just remove it. If a board needs a specific different defragment size, that board can override this setting. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2016-07-16Various, unrelated tree-wide typo fixes.Robert P. J. Day
Fix a number of typos, including: * "compatble" -> "compatible" * "eanbeld" -> "enabled" * "envrionment" -> "environment" * "FTD" -> "FDT" (for "flattened device tree") * "ommitted" -> "omitted" * "overriden" -> "overridden" * "partiton" -> "partition" * "propogate" -> "propagate" * "resourse" -> "resource" * "rest in piece" -> "rest in peace" * "suport" -> "support" * "varible" -> "variable" Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
2016-07-06net: Fix incorrect RPC packets on 64-bit systemsRalf Hubert
This patch fixes incorrect RPC packet layout caused by 'long' type size difference on 64 and 32-bit architectures. Signed-off-by: Ralf Hubert <r.hubert@technisat.de> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2016-06-21NFS: Add error message when U-Boot NFS version (V2) is not supported by NFS ↵Guillaume GARDET
server Signed-off-by: Guillaume GARDET <guillaume.gardet@free.fr> Cc: joe.hershberger@ni.com Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2016-06-12net: Handle an empty bootp extension sectionAndre Renaud
Avoid generating this section if there is nothing in it. Signed-off-by: Andre Renaud <andre@designa-electronics.com> Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2016-05-27net: Optionally use pxe client arch from variableAlexander Graf
The client architecture that we pass to a dhcp server depends on the target payload that we want to execute. An EFI binary has a different client arch than a legacy binary or a u-boot binary. So let's parameterize the pxe client arch field to allow an override via the distro script, so that our efi boot path can tell the dhcp server that it's actually an efi firmware. Signed-off-by: Alexander Graf <agraf@suse.de>
2016-05-27distro: Add efi pxe boot codeAlexander Graf
Now that we can expose network functionality to EFI applications, the logical next step is to load them via pxe to execute them as well. This patch adds the necessary bits to the distro script to automatically load and execute EFI payloads. It identifies the dhcp client as a uEFI capable PXE client, hoping the server returns a tftp path to a workable EFI binary that we can then execute. To enable boards that don't come with a working device tree preloaded, this patch also adds support to load a device tree from the /dtb directory on the remote tftp server. Signed-off-by: Alexander Graf <agraf@suse.de> Reviewed-by: Tom Rini <trini@konsulko.com>
2016-05-27net: Move CONFIG_SPL_NET_VCI_STRING into KconfigAlexander Graf
This patch also adds the SPL time VCI string into Kconfig. Signed-off-by: Alexander Graf <agraf@suse.de> Reviewed-by: Tom Rini <trini@konsulko.com>
2016-05-27net: Fix client identifiers for ARMAlexander Graf
There are client identifiers specifically reserved for ARM U-Boot according to http://www.ietf.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xml#processor-architecture. So let's actually make use of them rather than the bogus 0x100 that we emitted so far. Signed-off-by: Alexander Graf <agraf@suse.de> Reviewed-by: Tom Rini <trini@konsulko.com> [trini: Drop the Xilinx define to 0x100 as it's not the correct value to use]. Signed-off-by: Tom Rini <trini@konsulko.com>
2016-05-27net: Move the VCI and client arch values to KconfigAlexander Graf
We have a bunch of boards that define their vendor class identifier and client archs in the board files or in the distro config. Move everything to the generic Kconfig options. We're missing the distinction between i386 and x86_64, as I couldn't find any config variable that would tell us the difference. Is that really important to people? I guess not, so I left it out. Signed-off-by: Alexander Graf <agraf@suse.de> Reviewed-by: Tom Rini <trini@konsulko.com>
2016-05-27bootp: Move vendor class identifier set to functionAlexander Graf
Both the dhcp as well as the bootp case add vendor class identifier parameters into their packets. Let's move that into a separate function to make overlaying easier. Signed-off-by: Alexander Graf <agraf@suse.de> Reviewed-by: Tom Rini <trini@konsulko.com>
2016-05-27efi_loader: Add network access supportAlexander Graf
We can now successfully boot EFI applications from disk, but users may want to also run them from a PXE setup. This patch implements rudimentary network support, allowing a payload to send and receive network packets. With this patch, I was able to successfully run grub2 with network access inside of QEMU's -M xlnx-ep108. Signed-off-by: Alexander Graf <agraf@suse.de>
2016-03-27bootp: Prevent u-boot from using others responses.Anton Persson
In rare circumstances two dhcp clients may generate the same bootp ID. If this happens it is vital that the client also checks the hw address in the received response to prevent IP address conflicts. Signed-off-by: Anton Persson <don.juanton@gmail.com>
2016-02-26net: bootp: Add environment variable for timeout periodAlexandre Messier
There is currently one config option (CONFIG_NET_RETRY_COUNT) that is available to tune the retries of the network stack. Unfortunately, it is global to all protocols, and the value is interpreted differently in all of them. Add a new environment variable that directly sets the retry period for BOOTP timeouts. If this new value is not set, the period is still derived from the default number of retries, or from CONFIG_NET_RETRY_COUNT if defined. When both the new variable is set and CONFIG_NET_RETRY_COUNT is defined, the variable has precedence. Signed-off-by: Alexandre Messier <amessier@tycoint.com>
2016-02-06microblaze: Correct build error in eth-uclass.cSimon Glass
This fixes the following error when building microblaze-generic: net/eth-uclass.c: In function 'eth_post_probe': net/eth-uclass.c:466:18: error: 'gd' undeclared (first use in this function) ops->start += gd->reloc_off; Fixes: db9391e1 ("net: Move driver-model code into its own file") Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2016-01-28net: Add bootfile in DHCP RequestAlexandre Messier
Add the bootfile name in the DHCP Request packet, in addition to it already being sent in the DHCP Discover. This is needed by some DHCP servers so that the bootfile name is properly returned by the server to the client in the DHCP Ack, as expected by U-Boot. Signed-off-by: Alexandre Messier <amessier@tycoint.com>
2016-01-28net: Rename eth.c to eth_lecacy.cSimon Glass
Rename this file to make it clear it is for the old networking drivers and not for use with driver model. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2016-01-28net: Move driver-model code into its own fileSimon Glass
Every other uclass is in its own file. Create a new eth-uclass.c file and move the driver-model code into it, so that networking is consistent. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2016-01-28net: Move remaining common functions to eth_common.cSimon Glass
Move eth_current_changed(), eth_set_current(), eth_mac_skip() and eth_get_name() into the common file. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2016-01-28net: Move environment functions to the common fileSimon Glass
Move the functions which set ethernet environment variables to the common file. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2016-01-28net: Move common init into a new eth_common.c fileSimon Glass
Only half of the init is actually common. Move that part into a new common file and call it from driver-model and legacy code. More common functions will be added in future patches. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2016-01-28net: Don't call board/cpu_eth_init() with driver modelSimon Glass
We should avoid weak functions with driver model. Existing boards that use driver model don't need them, so let's kill them off. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2016-01-28net: bootp: Ignore packets whose yiaddr is 0Peng Fan
When doing `dhcp`, there is a bad dhcp server in my network which always reply dhcp request with yiaddr 0, which cause uboot can not successfully get ipaddr from the good dhcp server. But the Linux PC can get the ip address even if there is a bad dhcp server. This patch is to fix that even if there is a bad dhcp server, uboot can still get ipaddr and tftp work ok. The way is to ignore the packets from the bad dhcp server by filtering out the yiaddr whose value is 0. Signed-off-by: Peng Fan <peng.fan@nxp.com> Cc: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Wolfgang Denk <wd@denx.de> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2016-01-08net: remove scary warning about EEPROM provided MAC addressAndre Przywara
In many parts of the computing world having a unique MAC address sitting in some on-NIC storage is considered the normal case. Remove the warning to not scare the user unnecessarily. This applies to Highbank/Midway and ARM's Juno, for instance. Besides that this fixes the formatting on Midway, for instance, which currently looks like: ... Net: xgmac0 Warning: xgmac0 using MAC address from net device , xgmac1 Warning: xgmac1 using MAC address from net device ... Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2016-01-07net: Fix delay in net_retry testJoe Hershberger
Introduced in 45b4773 (net/arp: account for ARP delay, avoid duplicate packets on timeout) Check the arp timeout and adjust the timeout start time before the call to eth_recv() so that the sandbox driver has the opportunity to adjust the sandbox timer after the new start time has been recorded. Also, change the adjustment amount by 11 seconds instead of exactly the 10 seconds that the ping timout is expecting since the timeout check is looking for the time elapsed to be greater than but not equal to the specified delay. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Acked-by: Simon Glass <sjg@chromium.org>
2016-01-07dm: eth: Stick to 'ethact' when 'ethrotate' is 'no' in eth_init()Bin Meng
When 'ethrotate' variable is set to 'no' and 'ethact' variable is already set to an ethernet device, we should stick to 'ethact'. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
2016-01-07dm: eth: Test 'ethrotate' before changing current ethernet deviceBin Meng
In eth_current_changed(), the call to eth_get_dev() below has a side effect of rotating ethernet device if uc_priv->current == NULL. This is not what we want when 'ethrotate' variable is 'no'. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
2015-12-18dm: net: Fix DM for targets which use MANUAL_RELOCMichal Simek
All ethernet operation needs to be updated for architectures which requires MANUAL_RELOC. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2015-11-19Move console definitions into a new console.h fileSimon Glass
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>
2015-10-29net: eth: Check return value in various placesBin Meng
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>