summaryrefslogtreecommitdiff
path: root/net
Commit message (Collapse)AuthorAgeLines
* OMAP: networking support for SPLIlya Yanok2012-10-01-1/+6
| | | | | | | | | | | | | | This patch adds support for networking in SPL. Some devices are capable of loading SPL via network so it makes sense to load the main U-Boot binary via network too. This patch tries to use existing network code as much as possible. Unfortunately, it depends on environment which in turn depends on other code so SPL size is increased significantly. No effort was done to decouple network code and environment so far. Signed-off-by: Ilya Yanok <ilya.yanok@cogentembedded.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com> Signed-off-by: Tom Rini <trini@ti.com>
* net/bootp: add VCI support for BOOTP alsoIlya Yanok2012-10-01-6/+16
| | | | | | | | | Vendor Class Identifier option is common to BOOTP and DHCP and can be useful without PXE. So send VCI in both BOOTP and DHCP requests if CONFIG_BOOTP_VCI_STRING is defined. Signed-off-by: Ilya Yanok <ilya.yanok@cogentembedded.com> Signed-off-by: Tom Rini <trini@ti.com>
* net: Quietly ignore DHCP Option 28 (Broadcast Address)Brian Rzycki2012-09-27-0/+2
| | | | | | | | | | | | | | Some DHCP servers (notably dnsmasq) always transmit DHCP Option 28, Broadcast Address as specified in RFC 2132. Without this patch u-boot displays the warning: *** Unhandled DHCP Option in OFFER/ACK: 28 The patch suppresses the warning and ignores DHCP Option 28. There is no environment variable to set the broadcast address into and if for some reason u-boot needs the broadcast it can be calculated from ipaddr and netmask. Signed-off-by: Brian Rzycki <bmr@freescale.com>
* net: eth_write_hwaddr: Return error for invalid MACsBenoît Thébaudeau2012-09-27-2/+5
| | | | | | | | | If dev->enetaddr was supposed to be set with dev->write_hwaddr() but the MAC address was not valid, return an error. Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com> Cc: Joe Hershberger <joe.hershberger@gmail.com> Acked-by: Mike Frysinger <vapier@gentoo.org>
* net: Filter incoming netconsole packets by IPJoe Hershberger2012-09-24-0/+1
| | | | | | | Check the incoming packets' source IP address... if ncip isn't set to a broadcast address, only listen to the client at ncip. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* net: Improve the speed of netconsoleJoe Hershberger2012-09-24-12/+22
| | | | | | | | | | | | | | | | | | | Previously u-boot would initialize the network interface for every network operation and then shut it down again. This makes sense for most operations where the network in not known to be needed soon after the operation is complete. In the case of netconsole, it will use the network for every interaction with the shell or every printf. This means that the network is being reinitialized very often. On many devices, this intialization is very slow. This patch checks for consecutive netconsole actions and leaves the ethernet hardware initialized between them. It will still behave the same old way for all other network operations and any time another network operation happens between netconsole operations. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Cc: Stefano Babic <sbabic@denx.de> Acked-by: Stefano Babic <sbabic@denx.de>
* net: bugfix: NetSetTimeout assumes CONFIG_SYS_HZ=1000Tetsuyuki Kobayashi2012-09-24-1/+1
| | | | | | NetSetTimeout sets incorrect value to timeDelta when CONFIG_SYS_HZ != 1000. Signed-off-by: Tetsuyuki Kobayashi <koba@kmckk.co.jp>
* api: net: fix length check in eth_receive()Michael Walle2012-09-24-4/+1
| | | | | | | | | | | | | | | If the requested length is too small to hold the received packet, eth_receive() will return -1 and will leave the packet in the receive buffers. Instead of returning an error in this case, we return the first portion of the received packet and remove it from the receive buffers. This fixes FreeBSD's ubldr. Without this patch it will just stop receiving packets if the NIC receives more than PKTBUFSRX too large packets. Signed-off-by: Michael Walle <michael@walle.cc> Cc: Joe Hershberger <joe.hershberger@gmail.com> Cc: Rafal Jaworowski <raj@semihalf.com> Cc: Piotr Kruszynski <ppk@semihalf.com>
* Merge branch 'next' of git://git.denx.de/u-bootWolfgang Denk2012-07-30-2/+20
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'next' of git://git.denx.de/u-boot: MPC8xx: Fixup warning in arch/powerpc/cpu/mpc8xx/cpu.c doc: cleanup - move board READMEs into respective board directories net: sh_eth: add support for SH7757's GETHER net: sh_eth: modify the definitions of regsiter net: sh_eth: add SH_ETH_TYPE_ condition net: sh_eth: clean up for the SH7757's code net: fec_mxc: Fix MDC for xMII net: fec_mxc: Fix setting of RCR for xMII net: nfs: make NFS_TIMEOUT configurable net: Inline the new eth_setenv_enetaddr_by_index function net: allow setting env enetaddr from net device setting net/designware: Consecutive writes to the same register to be avoided CACHE: net: asix: Fix asix driver to work with data cache on net: phy: micrel: make ksz9021 phy accessible net: abort network initialization if the PHY driver fails phylib: phy_startup() should return an error code on failure net: tftp: fix type of block arg to store_block Signed-off-by: Wolfgang Denk <wd@denx.de>
| * net: nfs: make NFS_TIMEOUT configurableTetsuyuki Kobayashi2012-07-12-1/+5
| | | | | | | | | | | | | | NFS_TIMEOUT is constant value defined in net/nfs.c. But sometimes it needs to adjust. This patch enables to override NFS_TIMEOUT by defining CONFIG_NFS_TIMEOUT in a board specific config file. Signed-off-by: Tetsuyuki Kobayashi <koba@kmckk.co.jp>
| * Merge branch 'next' of git://git.denx.de/u-boot-net into nextWolfgang Denk2012-07-12-1/+15
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'next' of git://git.denx.de/u-boot-net: net: Inline the new eth_setenv_enetaddr_by_index function net: allow setting env enetaddr from net device setting net/designware: Consecutive writes to the same register to be avoided CACHE: net: asix: Fix asix driver to work with data cache on net: phy: micrel: make ksz9021 phy accessible net: abort network initialization if the PHY driver fails phylib: phy_startup() should return an error code on failure net: tftp: fix type of block arg to store_block Signed-off-by: Wolfgang Denk <wd@denx.de>
| | * net: Inline the new eth_setenv_enetaddr_by_index functionJoe Hershberger2012-07-11-1/+1
| | | | | | | | | | | | | | | | | | This function is currently only used in one case. Inline for now. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
| | * net: allow setting env enetaddr from net device settingRob Herring2012-07-11-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the net driver has setup a valid ethernet address and an ethernet address is not set in the environment already, then set the environment variables from the net driver setting. This enables pxe booting on boards which don't set ethaddr env variable. Signed-off-by: Rob Herring <rob.herring@calxeda.com>
| | * net: tftp: fix type of block arg to store_blockJayachandran Chandrasekharan Nair2012-07-11-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The block argument for store_block can be -1 when the tftp sequence number rolls over (i.e TftpBlock == 0), so the first argument to store_block has to be of type 'int' instead of 'unsigned'. In our environment (gcc 4.4.5 mips toolchain), this causes incorrect 'offset' to be generated for storing the block, and the tftp block with number 0 will be written elsewhere, resulting in a bad block in the downloaded file and a memory corruption. Signed-off-by: Jayachandran Chandrasekharan Nair <jayachandranc@netlogicmicro.com>
* | | net: Make sure the ethaddr is updated in net_init()Joe Hershberger2012-07-24-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NetConsole may call NetSendUDPPacket before NetLoop is called. This will cause the source MAC address (NetOurEther) to be wrong. Instead of only changing it in NetLoop, move it to NetLoopInit so that it is also updated when net_init() is called (especially by nc_start()). Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reported-by: Michael Walle <michael@walle.cc> Acked-by: Michael Walle <michael@walle.cc>
* | | net: link_local: fix buildbenoit.thebaudeau@advans2012-07-19-3/+3
| | | | | | | | | | | | | | | | | | | | | Fix comment within comment build error. Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com> Cc: Joe Hershberger <joe.hershberger@gmail.com>
* | | net: bootp: fix buildbenoit.thebaudeau@advans2012-07-19-1/+1
|/ / | | | | | | | | | | | | Fix NetSetState function name used with CONFIG_BOOTP_MAY_FAIL. Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com> Cc: Joe Hershberger <joe.hershberger@gmail.com>
* | net: fix typo in arp clean upMike Frysinger2012-07-10-1/+1
|/ | | | | | | | | | The clean up patch missed an &, so we end up passing an int rather than a pointer to the sprintf function. arp.c: In function 'ArpReceive': arp.c:197: warning: format '%p' expects type 'void *', but argument 3 has type 'int' Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* Minor Coding Style cleanupWolfgang Denk2012-07-10-2/+3
| | | | Signed-off-by: Wolfgang Denk <wd@denx.de>
* net: make net_rand.h inclusion depend on BOOTP_RANDOM_DELAYKim Phillips2012-07-08-1/+3
| | | | | | | | | | | | | | | | | | | | commit "net: use common rand()/srand() functions" introduced the following build warning on the current u-boot-arm tree: $ ./MAKEALL MPC8313ERDB_66 Configuring for MPC8313ERDB_66 - Board: MPC8313ERDB, Options: SYS_66MHZ text data bss dec hex filename 271988 13976 41768 327732 50034 ./u-boot In file included from bootp.c:15:0: net_rand.h: In function 'srand_mac': net_rand.h:40:2: warning: implicit declaration of function 'srand' [-Wimplicit-function-declaration] adding this dependency fixes it. Cc: Michael Walle <michael@walle.cc> Cc: Joe Hershberger <joe.hershberger@ni.com> Signed-off-by: Kim Phillips <kim.phillips@freescale.com> Acked-by: Michael Walle <michael@walle.cc>
* net: add helper to generate random mac addressMichael Walle2012-07-07-0/+22
| | | | | | | | Add new function eth_random_enetaddr() to generate a locally administered ethernet address. Signed-off-by: Michael Walle <michael@walle.cc> Acked-by: Joe Hershberger <joe.hershberger@gmail.com>
* net: use common rand()/srand() functionsMichael Walle2012-07-07-80/+28
| | | | | | | | | Replace rand() with the functions from lib/. The link-local network code stores its own seed, derived from the MAC address. Thus making it independent from calls to srand() in other modules. Signed-off-by: Michael Walle <michael@walle.cc> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* net: Allow filtering on debug traces in the net subsystemJoe Hershberger2012-05-23-31/+52
| | | | | | | | | | | | Add several levels of DEBUG prints so that you can limit the noise to the severety of your problem. DEBUG_LL_STATE = Link local state machine changes DEBUG_DEV_PKT = Packets or info directed to the device DEBUG_NET_PKT = Packets on info on the network at large DEBUG_INT_STATE = Internal network state changes Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* net: Work-around for brain-damaged Cisco equipment with arp-proxyJoe Hershberger2012-05-23-0/+14
| | | | | | | | | | | | | | | | | | Cisco's arp-proxy feature fails to ignore the link-local address range This means that a link-local device on a network with this Cisco equipment will reply to ARP requests for our device (in addition to our reply). If we happen to reply first, the requester's ARP table will be populated with our MAC address, and one packet will be sent to us... shortly following this, the requester will get an ARP reply from the Cisco equipment telling the requester to send packets their way instead of to our device from now on. This work-around detects this link-local condition and will delay replying to the ARP request for 5ms so that the first packet is sent to the Cisco equipment and all following packets are sent to our device. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* net: Add link-local addressing supportJoe Hershberger2012-05-23-1/+372
| | | | | | | Code based on networking/zcip.c in busybox commit 8531d76a15890c2c535908ce888b2e2aed35b172 Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* net: Separate ArpRequest() into lower-level funcJoe Hershberger2012-05-23-9/+15
| | | | | | | | Link-local support will need to send ARP packets, but needs more fine-grained control over the contents. Split the implementation into 2 parts so link-local can share the code. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* net: Don't copy every packet that waits for an ARPJoe Hershberger2012-05-23-35/+20
| | | | | | | | | Use the NetArpTxPacket for the ARP packet, not to hold what used to be in NetTxPacket. This saves a copy and makes the code easier to understand. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* net: Fix net buffer initializationJoe Hershberger2012-05-23-14/+31
| | | | | | | | | A new non-static function net_init() will initialize buffers and read from the environment. Only update from the env on each entry to NetLoop(). Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* net: Remove unused parameter from NetInitLoop()Joe Hershberger2012-05-23-2/+2
| | | | | | | Noone uses it. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* net: Remove static allocation for MAC address in PingSend()Joe Hershberger2012-05-23-11/+8
| | | | | | | | Don't force ARP clients to return the MAC address if they don't care (such as ping) Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Mike Frysinger <vapier@gentoo.org>
* net: Add option CONFIG_BOOTP_MAY_FAILJoe Hershberger2012-05-23-0/+5
| | | | | | | | This is useful if you want to look for a DHCP server, but try some other settings if not available. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* net: Fix unused variable compile warningJoe Hershberger2012-05-23-4/+3
| | | | | | | | | | If CONFIG_BOOTP_SERVERIP is not defined, unused variable warning is reported. This was fixed upstream using a compiler feature instead of a simple reorder of the statements. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org> Acked-by: Mike Frysinger <vapier@gentoo.org>
* net: Add net_update_ether() to handle ARP and Ping repliesJoe Hershberger2012-05-23-6/+29
| | | | | | | | | When the network is VLAN or SNAP, net_update_ether() will preserve the original Ethernet packet header and simply replace the src and dest MACs and the protocol Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* net: Refactor to separate the UDP handler from the ARP handlerJoe Hershberger2012-05-23-51/+72
| | | | | | | | | | | Call a built-in dummy if none is registered... don't require protocols to register a handler (eliminating dummies) NetConsole now uses the ARP handler when waiting on arp (instead of needing a #define hack in arp.c) Clear handlers at the end of net loop Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* net: Refactor to protect access to the NetState variableJoe Hershberger2012-05-23-28/+31
| | | | | | | Changes to NetState now go through an accessor function called net_set_state() Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* net: Refactor to use NetSendPacket instead of eth_send directlyJoe Hershberger2012-05-23-14/+6
| | | | | | | | Use this entry-point consistently across the net/ code Use a static inline function to preserve code size Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* net: Refactor ping receive handlerJoe Hershberger2012-05-23-16/+2
| | | | | | | | There is no need to call through the handler... inline it Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org> Acked-by: Mike Frysinger <vapier@gentoo.org>
* net: Move debug trace to point of actionJoe Hershberger2012-05-23-1/+1
| | | | | Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* net: Refactor bootp packet length computationsJoe Hershberger2012-05-23-11/+13
| | | | | | | Eliminate pointer subtraction that recovers values computed earlier Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* net: Refactor packet length computationsJoe Hershberger2012-05-23-10/+16
| | | | | | | | | Save the length when it is computed instead of forgetting it and subtracting pointers to figure it out again. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org> Acked-by: Mike Frysinger <vapier@gentoo.org>
* net: Refactor NetSendUDPPacket to share more codeJoe Hershberger2012-05-23-19/+25
| | | | | | | Share more of the code that is common between ARP vs not. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* net: Refactor IP, UPD, and ICMP header writing functionsJoe Hershberger2012-05-23-52/+55
| | | | | | | | ICMP (ping) was reimplementing IP header code... it now shares code. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org> Acked-by: Mike Frysinger <vapier@gentoo.org>
* net: cosmetic: Replace magic numbers in arp.c with constantsJoe Hershberger2012-05-23-17/+17
| | | | | | Use field names and sizes when accessing ARP packets Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* net: cosmetic: Rename tmp to reply_ip_addr in arp.cJoe Hershberger2012-05-23-3/+3
| | | | | | | Renamed for clarity Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* net: cosmetic: Alphabetize includes in net.cJoe Hershberger2012-05-23-12/+12
| | | | | | Easier to find when alphabetized Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* net: cosmetic: Rename OPT_SIZE to OPT_FIELD_SIZEJoe Hershberger2012-05-23-9/+8
| | | | | | | | Clearer constant name. Also remove related BOOTP_SIZE which was unused and doesn't take into account VLAN packets. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* net: cosmetic: Rename CDPHandler to cdp_receiveJoe Hershberger2012-05-23-4/+4
| | | | | | This is not called as a handler, so don't name it that way Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* net: cosmetic: Rename "x" to "eth_proto"Joe Hershberger2012-05-23-12/+12
| | | | | | | x is a poor variable name Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* net: cosmetic: Add a more explicit comment about 802.2Joe Hershberger2012-05-23-1/+2
| | | | | | | Make the comment more accurate about the header including SNAP Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* net: cosmetic: Rename parameter len to payload_lenJoe Hershberger2012-05-23-7/+8
| | | | | | | | This name more explicitly claims that it does not include the header size Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>