summaryrefslogtreecommitdiffstats
path: root/net/eth-uclass.c
Commit message (Collapse)AuthorAgeFilesLines
* net: remove CONFIG_MCAST_TFTPChris Packham2019-01-241-2/+0
| | | | | | | | | | | | | | No mainline board enables CONFIG_MCAST_TFTP and there have been compilation issues with the code for some time. Additionally, it has a potential buffer underrun issue (reported as a side note in CVE-2018-18439). Remove the multicast TFTP code but keep the driver API for the future addition of IPv6. Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> Signed-off-by: Chris Packham <judge.packham@gmail.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* net: eth-uclass: Fix for DM USB ethernet supportJean-Jacques Hiblot2018-08-211-1/+2
| | | | | | | | | | | | When a USB ethernet device is halted, the device driver is removed. When this happens the uclass private memory is freed and uclass_priv is set to NULL. This causes a data abort when uclass_priv->state is then set to ETH_STATE_PASSIVE. Fix it by checking if uclass_priv is NULL before setting uclass_priv->state Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* net: Only call halt on a driver that has been init'edJoe Hershberger2018-07-261-1/+1
| | | | | | | | | | | | With driver model, we were not checking if the state of the device was marked as active before calling the halt function. Check that the device is probed and also marked as active. This avoids the case where we were calling halt on the first device in net_init() and the driver would operate on bogus data structures causing problems. In this case, the priv was all 0, so halt() would close STDIN. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* net: Initialize as many ethernet devices as possibleMario Six2018-06-131-2/+2
| | | | | | | | | | | | | On devices that have their first network interface provided by a FPGA, the initialization of further interfaces will fail if the FPGA is not yet programmed. This leads to problems during factory setup when the data is supposed to be loaded over secondary netowork interfaces. To avoid this, use the uclass_{first,next}_device_check functions to initialize as many ethernet devices as possible. Signed-off-by: Mario Six <mario.six@gdsys.cc> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini2018-05-071-2/+1
| | | | | | | | | | | | | | | | | | | | When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.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>
* env: Rename eth_getenv_enetaddr() to eth_env_get_enetaddr()Simon Glass2017-08-161-1/+1
| | | | | | Rename this function for consistency with env_get(). Signed-off-by: Simon Glass <sjg@chromium.org>
* env: Rename getenv/_f() to env_get()Simon Glass2017-08-161-3/+3
| | | | | | | | | | | 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-161-1/+1
| | | | | | Rename this function for consistency with env_set(). Signed-off-by: Simon Glass <sjg@chromium.org>
* 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: 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: Do not use magic values for ARP_HLENoliver@schinagl.nl2017-02-071-5/+5
| | | | | | | | | | | 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>
* 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>
* microblaze: Correct build error in eth-uclass.cSimon Glass2016-02-061-0/+2
| | | | | | | | | | | | | 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>
* net: Move driver-model code into its own fileSimon Glass2016-01-281-0/+549
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>