03 Jun, 2020

1 commit

  • DSA stands for Distributed Switch Architecture and it covers switches that
    are connected to the CPU through an Ethernet link and generally use frame
    tags to pass information about the source/destination ports to/from CPU.
    Front panel ports are presented as regular ethernet devices in U-Boot and
    they are expected to support the typical networking commands.
    DSA switches may be cascaded, DSA class code does not currently support
    this.

    Signed-off-by: Alex Marginean
    Signed-off-by: Vladimir Oltean
    Signed-off-by: Claudiu Manoil

    Alex Marginean
     

10 Mar, 2020

1 commit


13 Feb, 2020

1 commit


06 Feb, 2020

1 commit

  • At present dm/device.h includes the linux-compatible features. This
    requires including linux/compat.h which in turn includes a lot of headers.
    One of these is malloc.h which we thus end up including in every file in
    U-Boot. Apart from the inefficiency of this, it is problematic for sandbox
    which needs to use the system malloc() in some files.

    Move the compatibility features into a separate header file.

    Signed-off-by: Simon Glass

    Simon Glass
     

18 Jan, 2020

3 commits


15 Dec, 2019

1 commit

  • These functions are used by code outside the network support, so move them
    to lib/ to be more accessible.

    Without this, the functions are only accessible in SPL/TPL only if
    CONFIG_SPL/TPL_NET are defined. Many boards do not enable those option but
    still want to do checksums in this format.

    Fix up a few code-style nits while we are here.

    Signed-off-by: Simon Glass
    Acked-by: Joe Hershberger
    Reviewed-by: Bin Meng

    Simon Glass
     

09 Dec, 2019

8 commits

  • The function connects an ethernet device to a PHY using DT information.
    This API is only available for eth devices with an associated device tree
    node.

    Signed-off-by: Alex Marginean
    Acked-by: Joe Hershberger

    Alex Marginean
     
  • Renamed dm_mdio_phy_connect arguments dev to mdiodev and addr to phyaddr
    for a bit more clarity and consistency with the following patches.
    Also use NULL instead of 0 on error return path.

    Signed-off-by: Alex Marginean
    Acked-by: Joe Hershberger

    Alex Marginean
     
  • Commit b618b3707633 ("net: Convert CONFIG_TFTP_BLOCKSIZE to Kconfig")
    accidentally set the default *option* TFTP block size to 512 bytes, even
    though the comment in the code says that this is a terrible choice. Most
    boards didn't define the symbol before, so they got the default block size
    of 1468 bytes before, but now use 512 bytes, which is also the fallback.
    This leads to both abysmal performance and a lot of hashes printed
    on the screen (one character for every 5K), which is both annoying and
    slow over serial links.

    Set the default block size in Kconfig back to the value it had before.

    This improves TFTP performance from 2.8 MB/s to 6.9 MB/s on a Pine64.

    Fixes: b618b3707633 ("net: Convert CONFIG_TFTP_BLOCKSIZE to Kconfig")
    Signed-off-by: Andre Przywara
    Acked-by: Joe Hershberger

    Andre Przywara
     
  • device_probe() may fail in which case the seq_id will be -1. Don't
    display these devices during startup. While this is only a cosmetic
    change, the return value of eth_initialize() will also change to the
    actual number of available devices. The return value is only used in
    spl_net to decide whether there are any devices to boot from. So
    returning only available devices is also more correct in that case.

    Signed-off-by: Michael Walle
    Acked-by: Joe Hershberger

    Michael Walle
     
  • During testing of qemu-riscv32 with a 2GiB memory configuration,
    tftp always fails with a error message:

    Load address: 0x84000000
    Loading: #
    TFTP error: trying to overwrite reserved memory...

    It turns out the result of 'tftp_load_addr + tftp_load_size' just
    overflows (0x100000000) and the test logic in store_block() fails.
    Fix this by adjusting the end address to ULONG_MAX when overflow
    is detected.

    Fixes: a156c47e39ad ("tftp: prevent overwriting reserved memory")
    Signed-off-by: Bin Meng
    Acked-by: Joe Hershberger

    Bin Meng
     
  • sandbox_defconfig does not compile using GCC 9.2.1:

    net/net.c: In function ‘net_process_received_packet’:
    net/net.c:1288:23: error: taking address of packed member of ‘struct
    ip_udp_hdr’ may result in an unaligned pointer value
    [-Werror=address-of-packed-member]
    1288 | sumptr = (ushort *)&(ip->udp_src);
    | ^~~~~~~~~~~~~~

    Avoid the error by using a u8 pointer instead of an u16 pointer and
    in-lining ntohs().

    Simplify the checksumming of the last message byte.

    Signed-off-by: Heinrich Schuchardt
    Reviewed-by: Simon Goldschmidt
    Acked-by: Joe Hershberger

    Heinrich Schuchardt
     
  • While we have networking use cases within SPL we do not support loading
    files via NFS at this point in time. Disable calling nfs_start() so
    that the NFS related code can be garbage collected at link time.

    Signed-off-by: Tom Rini
    Acked-by: Joe Hershberger

    Tom Rini
     
  • Part of the env cleanup moved this out of the environment code and into
    the net code. However, this helper is sometimes needed even when the net
    stack isn't included.

    Move the helper to lib/net_utils.c like it's similarly-purposed
    string_to_ip(). Also rename the moved function to similar naming.

    Signed-off-by: Joe Hershberger
    Reported-by: Ondrej Jirman

    Joe Hershberger
     

03 Dec, 2019

3 commits


05 Sep, 2019

10 commits

  • With GCC 9.2.1 net/nfs.c leads to multiple errors of type
    address-of-packed-member.

    net/nfs.c: In function ‘rpc_req’:
    net/nfs.c:199:18: error: taking address of packed member of
    ‘struct rpc_t’ may result in an unaligned pointer value
    [-Werror=address-of-packed-member]
    199 | p = (uint32_t *)&(rpc_pkt.u.call.data);
    | ^~~~~~~~~~~~~~~~~~~~~~
    net/nfs.c: In function ‘nfs_readlink_reply’:
    net/nfs.c:631:46: error: taking address of packed member of
    ‘struct rpc_t’ may result in an unaligned pointer value
    [-Werror=address-of-packed-member]
    631 | nfs3_get_attributes_offset(rpc_pkt.u.reply.data);
    | ~~~~~~~~~~~~~~~^~~~~
    LD drivers/block/built-in.o
    net/nfs.c: In function ‘nfs_read_reply’:
    net/nfs.c:692:46: error: taking address of packed member of
    ‘struct rpc_t’ may result in an unaligned pointer value
    [-Werror=address-of-packed-member]
    692 | nfs3_get_attributes_offset(rpc_pkt.u.reply.data);
    | ~~~~~~~~~~~~~~~^~~~~

    struct rpc_t is only used as local variable. It is naturally packed. So
    there is no need for the attribute packed.

    Signed-off-by: Heinrich Schuchardt
    Reviewed-by: Bin Meng
    Acked-by: Joe Hershberger

    Heinrich Schuchardt
     
  • rpc_pkt.u.call.data is an array of uint32_t. There is no need to convert
    it to uint32_t *.

    memcpy() expects void * as it 1st and 2nd argument. There is no point in
    converting pointers to char * before passing them to memcpy().

    In ntohl(data[1]) != 0 calling ntohl() is superfluous. If the value is
    zero, does not depend on the byte order.

    Signed-off-by: Heinrich Schuchardt
    Reviewed-by: Bin Meng
    Acked-by: Joe Hershberger

    Heinrich Schuchardt
     
  • This patch adds a check to rpc_pkt.u.reply.data at nfs_lookup_reply.

    Signed-off-by: Cheng Liu
    Reported-by: Fermín Serna
    Acked-by: Joe Hershberger

    liucheng (G)
     
  • This patch adds a check to rpc_pkt.u.reply.data at nfs_readlink_reply.

    Signed-off-by: Cheng Liu
    Reported-by: Fermín Serna
    Acked-by: Joe Hershberger

    liucheng (G)
     
  • …eck at nfs_read_reply

    This patch adds a check to rpc_pkt.u.reply.data at nfs_read_reply.

    Signed-off-by: Cheng Liu <liucheng32@huawei.com>
    Reported-by: Fermín Serna <fermin@semmle.com>
    Acked-by: Joe Hershberger <joe.hershberger@ni.com>

    liucheng (G)
     
  • This patch adds a check to nfs_handler to fix buffer overflow for CVE-2019-14197,
    CVE-2019-14200, CVE-2019-14201, CVE-2019-14202, CVE-2019-14203 and CVE-2019-14204.

    Signed-off-by: Cheng Liu
    Reported-by: Fermín Serna
    Acked-by: Joe Hershberger

    liucheng (G)
     
  • This patch adds a check to udp_len to fix unbounded memcpy for
    CVE-2019-14192, CVE-2019-14193 and CVE-2019-14199.

    Signed-off-by: Cheng Liu
    Reviewed-by: Simon Goldschmidt
    Reported-by: Fermín Serna
    Acked-by: Joe Hershberger

    liucheng (G)
     
  • Use the optional property device-name to name the MDIO bus. This works
    around limitations with using the DT node name on devices such as
    Armada-8040, which integrates two cp100 cores, both featuring MDIOs at the
    same relative offsets and with the same DT node names.
    The concept was originally proposed by Marvell as a custom property called
    mdio-name specific to Marvell driver. This patch uses the more generic
    property device-name and moves this into MDIO class code so other can use
    it as well.

    Signed-off-by: Alex Marginean
    Acked-by: Joe Hershberger
    Reviewed-by: Bin Meng

    Alex Marginean
     
  • Add support for capturing ethernet packets and storing
    them in memory in PCAP(2.4) format, later to be analyzed by
    any PCAP viewer software (IE. Wireshark)

    This feature greatly assist debugging network issues such
    as detecting dropped packets, packet corruption etc.

    Signed-off-by: Ramon Fried
    Reviewed-by: Alex Marginean
    Tested-by: Alex Marginean
    Acked-by: Joe Hershberger

    Ramon Fried
     
  • Don't allow unterminated strings

    Signed-off-by: Joe Hershberger

    Joe Hershberger
     

12 Aug, 2019

8 commits


19 Jul, 2019

1 commit

  • Adds a class for MDIO MUXes, which control access to a series of
    downstream child MDIOs.
    MDIO MUX drivers are required to implement a select function used to switch
    between child buses.
    MUX children are registered as MDIO buses and they can be used just like
    regular MDIOs.

    Signed-off-by: Alex Marginean
    Reviewed-by: Bin Meng
    Acked-by: Joe Hershberger

    Alex Marginean
     

16 Jul, 2019

1 commit

  • Adds UCLASS_MDIO DM class supporting MDIO buses that are probed as
    stand-alone devices. Useful in particular for systems that support
    DM_ETH and have a stand-alone MDIO hardware block shared by multiple
    Ethernet interfaces.

    Signed-off-by: Alex Marginean
    Reviewed-by: Bin Meng
    Acked-by: Joe Hershberger

    Alex Marginean
     

15 Jun, 2019

1 commit