10 Oct, 2014

1 commit

  • A number of network related files were imported from the LiMon
    project; these contain a somewhat unclear license statement:

    Copyright 1994 - 2000 Neil Russell.
    (See License)

    I analyzed the source code of LiMon v1.4.2 which was used for this
    import. It does not contain any "License" file, but the top level
    directory contains a file "COPYING", which turns out to be GPL v2
    of June 1991. So it is legitimate to conclude that the LiMon derived
    files are also to be released under GPLv2. Mark them as such.

    Signed-off-by: Wolfgang Denk

    Wolfgang Denk
     

25 Sep, 2014

1 commit


17 Sep, 2014

1 commit

  • When a DNS query is sent out, the ethernet packet can get directed to
    the MAC address of a server that was communicated to before. This is
    wrong when the previously stored MAC address corresponds to a different
    server's IP address, i.e. when the IP address of the previous and the
    current communication are different.

    The error can get reproduced by running a sequence of e.g. a TFTP
    download and a DNS query, where the TFTP and DNS servers reside on
    individual machines.

    The fix is to clear the server's MAC address that might be left from a
    previous operation, and to fetch the peer's MAC address in a new ARP
    lookup, before the DNS query is sent. This is the approach taken in
    other network services, like 8e52533d1095 ("net: tftpsrv: Get correct
    client MAC address").

    Reported-by: Dirk Zimoch
    Signed-off-by: Gerhard Sittig

    Gerhard Sittig
     

22 Aug, 2014

1 commit

  • It's not unusual for DHCP servers to take a couple hundred milliseconds
    to respond to DHCP discover messages. One possible reason for the delay
    can be that the server checks (typically using an ARP request) that the
    IP it's about to hand out isn't in use yet. To make matters worse, some
    servers may also queue up requests and process them sequentially, which
    can cause excessively long delays if clients retry too fast.

    Commit f59be6e850b3 ("net: BOOTP retry timeout improvements") shortened
    the retry timeouts significantly, but the BOOTP/DHCP implementation in
    U-Boot doesn't handle that well because it will ignore incoming replies
    to earlier requests. In one particular setup this increases the time it
    takes to obtain a DHCP lease from 630 ms to 8313 ms.

    This commit attempts to fix this in two ways. First it increases the
    initial retry timeout from 10 ms to 250 ms to give DHCP servers some
    more time to respond. At the same time a cache of outstanding DHCP
    request IDs is kept so that the implementation will know to continue
    transactions even after a retransmission of the DISCOVER message. The
    maximum retry timeout is also increased from 1 second to 2 seconds. An
    ID cache of size 4 will keep DHCP requests around for 8 seconds (once
    the maximum retry timeout has been reached) before dropping them. This
    should give servers plenty of time to respond. If it ever turns out
    that this isn't enough, the size of the cache can easily be increased.

    With this commit the DHCP lease on the above-mentioned setup still takes
    longer (1230 ms) than originally, but that's an acceptable compromise to
    improve DHCP lease acquisition time for a broader range of setups.

    To make it easier to benchmark DHCP in the future, this commit also adds
    the time it took to obtain a lease to the final "DHCP client bound to
    address x.x.x.x" message.

    Tested-by: Stephen Warren
    Signed-off-by: Thierry Reding

    Thierry Reding
     

09 Aug, 2014

1 commit

  • Currently, the BOOTP code sends out its initial request as soon as the
    Ethernet driver indicates "link up". If this packet is lost or not
    replied to for some reason, the code waits for a 1s timeout before
    retrying. For some reason, such early packets are often lost on my
    system, so this causes an annoying delay.

    To optimize this, modify the BOOTP code to have very short timeouts for
    the first packet transmitted, but gradually increase the timeout each
    time a timeout occurs. This way, if the first packet is lost, the second
    packet is transmitted quite quickly and hence the overall delay is low.
    However, if there's still no response, we don't keep spewing out packets
    at an insane speed.

    It's arguably more correct to try and find out why the first packet is
    lost. However, it seems to disappear inside my Ethenet chip; the TX chip
    indicates no error during TX (not that it has much in the way of
    reporting...), yet wireshark on the RX side doesn't see any packet.
    FWIW, I'm using an ASIX USB Ethernet adapter. Perhaps "link up" is
    reported too early or based on the wrong condition in HW, and we should
    add some fixed extra delay into the driver. However, this would slow down
    every link up event even if it ends up not being needed in some cases.
    Having BOOTP retry quickly applies the fix/WAR to every possible
    Ethernet device, and is quite simple to implement, so seems a better
    solution.

    Signed-off-by: Stephen Warren
    Acked-by: Joe Hershberger

    Stephen Warren
     

22 Jul, 2014

2 commits


19 Jun, 2014

1 commit


13 May, 2014

1 commit

  • Some functions in include/net.h are ported from
    include/linux/etherdevice.h of Linux Kernel.

    For ex.
    is_zero_ether_addr()
    is_multicast_ether_addr()
    is_broadcast_ether_addr()
    is_valid_ether_addr();

    So, we should use the same function name as that of Linux Kernel,
    eth_rand_addr(), for consistency.

    Besides, eth_rand_addr() has been implemented as an inline function.
    So it should not be surrounded by #ifdef CONFIG_RANDOM_MACADDR.

    Signed-off-by: Masahiro Yamada
    Acked-by: Joe Hershberger

    Masahiro Yamada
     

03 Apr, 2014

1 commit

  • Changes in lib/uuid.c to:
    - uuid_str_to_bin()
    - uuid_bin_to_str()

    New parameter is added to specify input/output string format in listed functions
    This change allows easy recognize which UUID type is or should be stored in given
    string array. Binary data of UUID and GUID is always stored in big endian, only
    string representations are different as follows.

    String byte: 0 36
    String char: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
    string UUID: be be be be be
    string GUID: le le le be be

    This patch also updates functions calls and declarations in a whole code.

    Signed-off-by: Przemyslaw Marczak
    Cc: Stephen Warren
    Cc: Lukasz Majewski
    Cc: trini@ti.com

    Przemyslaw Marczak
     

20 Feb, 2014

1 commit

  • Now we are ready to switch over to real Kbuild.

    This commit disables temporary scripts:
    scripts/{Makefile.build.tmp, Makefile.host.tmp}
    and enables real Kbuild scripts:
    scripts/{Makefile.build,Makefile.host,Makefile.lib}.

    This switch is triggered by the line in scripts/Kbuild.include
    -build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build.tmp obj
    +build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj

    We need to adjust some build scripts for U-Boot.
    But smaller amount of modification is preferable.

    Additionally, we need to fix compiler flags which are
    locally added or removed.

    In Kbuild, it is not allowed to change CFLAGS locally.
    Instead, ccflags-y, asflags-y, cppflags-y,
    CFLAGS_$(basetarget).o, CFLAGS_REMOVE_$(basetarget).o
    are prepared for that purpose.

    Signed-off-by: Masahiro Yamada
    Tested-by: Gerhard Sittig

    Masahiro Yamada
     

07 Feb, 2014

1 commit

  • In "common/Makefile" "miiphyutil.o" gets built if any of the following
    items enabled:
    * CONFIG_PHYLIB
    * CONFIG_MII
    * CONFIG_CMD_MII

    So it's possible to not define CONFIG_MII or CONFIG_CMD_MII and still
    use functions like "miiphy_get_dev_by_name".

    In its turn "miiphy_get_dev_by_name" traverses "mii_devs" list which is
    not initialized because "miiphy_init" never got called.

    Cc: Rob Herring
    Cc: Simon Glass
    Cc: Wolfgang Denk
    Acked-by: Joe Hershberger
    Signed-off-by: Alexey Brodkin

    Alexey Brodkin
     

23 Nov, 2013

2 commits

  • NetServerEther was not being cleared in the tftp server code, so the
    destination MAC address would be whatever the last destination MAC
    address was.

    Scenario:
    U-Boot:
    dhcp
    tftpsrv
    Host:
    Send device WRQ
    Device:
    Responds with ACK to dhcp server mac address with
    host ip address

    By clearing NetServerEther, we force a lookup of the host MAC address
    to go with the associated host IP.

    Signed-off-by: Andrew Ruder

    Andrew Ruder
     
  • When the block 0 store to the memory of client and timeout at this
    moment. Because of no ACK packet, the server will send block 0 again,
    if this client reconnect to the server at this time,
    TftpBlockWrapOffset will become larger than it should be.

    Signed-off-by: Rockly
    Patch: 264417

    rockly
     

01 Nov, 2013

1 commit


27 Aug, 2013

1 commit


24 Jul, 2013

1 commit


25 Jun, 2013

3 commits

  • Make the link-local code conform more completely with the RFC.

    This will prevent ARP queries for the target (such as while it is
    rebooting) from causing the device to choose a different link-local
    address, thinking that its address is in use by another machine.

    Signed-off-by: Joe Hershberger

    Joe Hershberger
     
  • tftp.c:464:17: warning: cast to restricted __be16
    tftp.c:552:29: warning: cast to restricted __be16
    tftp.c:640:33: warning: cast to restricted __be16
    tftp.c:642:25: warning: cast to restricted __be16

    Signed-off-by: Kim Phillips
    Cc: Joe Hershberger

    Kim Phillips
     
  • This patch tackles the time out problem which leads to break the
    boot process, when loading file over nfs. The patch does two things.

    First of all, we just ignore messages that arrive with a rpc_id smaller
    then the client id. We just interpret this messages as answers to
    formaly timed out messages.

    Second, when a time out occurs we double the time to wait, so that we
    do not stress the server resending the last message.

    Signed-off-by: Matthias Brugger
    Tested-by: Enric Balletbo i Serra

    Matthias Brugger
     

19 Jun, 2013

1 commit

  • If we try to boot from NET device, NetInitLoop in net.c will be invoked.
    If NET device is not installed, eth_get_dev() function will return
    eth_current value, which is NULL.
    When NetInitLoop is called, "eth_get_dev->enetaddr" will access
    restricted memory area and therefore cause hanging.
    This issue is found on Tegra30 Cardhu platform after adding
    CONFIG_CMD_NET and CONFIG_CMD_DHCP in config header file.

    Signed-off-by: Jim Lin
    Tested-by: Stephen Warren

    Jim Lin
     

01 Mar, 2013

1 commit


16 Dec, 2012

2 commits

  • The ip is stored in network order, so we can't test it in host order.

    Signed-off-by: Joe Hershberger
    Reviewed-by: Kim Phillips

    Joe Hershberger
     
  • This prints a tftp speed indication after the download completes. This
    is the 3.6 MiB/s indicator below.

    Tegra2 (SeaBoard) # tftp ...
    Using asx0 device
    TFTP from server 172.22.72.144; our IP address is 172.22.73.81
    Filename '/tftpboot/uImage-user-seaboard-1'.
    Load address: 0x408000
    Loading: #################################################
    3.6 MiB/s
    done

    Signed-off-by: Simon Glass
    Acked-by: Igor Grinberg

    Simon Glass
     

14 Dec, 2012

2 commits


05 Nov, 2012

1 commit

  • bootp.c:44:14: warning: symbol 'dhcp_state' was not declared. Should it be static?
    bootp.c:45:15: warning: symbol 'dhcp_leasetime' was not declared. Should it be static?
    bootp.c:46:10: warning: symbol 'NetDHCPServerIP' was not declared. Should it be static?
    arp.c:30:17: warning: symbol 'NetArpWaitReplyIP' was not declared. Should it be static?
    arp.c:37:16: warning: symbol 'NetArpTxPacket' was not declared. Should it be static?
    arp.c:38:17: warning: symbol 'NetArpPacketBuf' was not declared. Should it be static?
    atheros.c:33:19: warning: symbol 'AR8021_driver' was not declared. Should it be static?
    net.c:183:7: warning: symbol 'PktBuf' was not declared. Should it be static?
    net.c:159:21: warning: symbol 'net_state' was not declared. Should it be static?
    ping.c:73:6: warning: symbol 'ping_start' was not declared. Should it be static?
    ping.c:82:13: warning: symbol 'ping_receive' was not declared. Should it be static?
    tftp.c:53:7: warning: symbol 'TftpRRQTimeoutMSecs' was not declared. Should it be static?
    tftp.c:54:5: warning: symbol 'TftpRRQTimeoutCountMax' was not declared. Should it be static?
    eth.c:125:19: warning: symbol 'eth_current' was not declared. Should it be static?

    Note: in the ping.c fix, commit a36b12f95a29647a06b5459198684fc142482020
    "net: Move PING out of net.c" mistakenly carried the ifdef CMD_PING
    clause from when it was necessary to avoid warnings when it was embedded
    in net.c.

    Signed-off-by: Kim Phillips

    Kim Phillips
     

05 Oct, 2012

1 commit


04 Oct, 2012

1 commit

  • Adjustment of Michael Walle's fix patch

    Commit 8a0eccb1056b313b45ab62e3aac400f339aa71b4 breaks netconsole. src_ip
    must not be converted to host byte order, because nc_ip is already stored
    in network byte order (see string_to_ip(), called by getenv_IPaddr()).

    Signed-off-by: Joe Hershberger

    Joe Hershberger
     

02 Oct, 2012

2 commits

  • 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
    Acked-by: Joe Hershberger
    Signed-off-by: Tom Rini

    Ilya Yanok
     
  • 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
    Signed-off-by: Tom Rini

    Ilya Yanok
     

28 Sep, 2012

2 commits

  • 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

    Brian Rzycki
     
  • 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
    Cc: Joe Hershberger
    Acked-by: Mike Frysinger

    Benoît Thébaudeau
     

25 Sep, 2012

4 commits

  • 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
     
  • 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
    Cc: Stefano Babic
    Acked-by: Stefano Babic

    Joe Hershberger
     
  • NetSetTimeout sets incorrect value to timeDelta when CONFIG_SYS_HZ != 1000.

    Signed-off-by: Tetsuyuki Kobayashi

    Tetsuyuki Kobayashi
     
  • 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
    Cc: Joe Hershberger
    Cc: Rafal Jaworowski
    Cc: Piotr Kruszynski

    Michael Walle
     

31 Jul, 2012

1 commit

  • * '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

    Wolfgang Denk
     

25 Jul, 2012

1 commit

  • 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
    Reported-by: Michael Walle
    Acked-by: Michael Walle

    Joe Hershberger
     

20 Jul, 2012

1 commit