[U-Boot] [PATCH v7 0/27] Add Driver Model support to network stack

Joe Hershberger joe.hershberger at ni.com
Sun Mar 22 23:08:57 CET 2015


Add support for the Ethernet MAC controllers.  Phy support will come later.

Switching from RFC to a patch series to be applied to dm/master as a staging
area for this series to make it happen more quickly when the window opens.

If desired, let me know which of the non-DM related prerequisite patches are
wanted for this release.

I've added unit tests to verify functionality.

There is an additional driver for sandbox that bridges to the RAW
Ethernet API in Linux which lets you test with real traffic. It now
supports localhost as well (the 'lo' interface).

Changes in v7:
-Fixed compile error in 4xx_enet.c

Changes in v6:
-Add function comments
-Addressed nits
-Check array index bounds
-Fix compile error on boards with CONFIG_API enabled
-Fix compile errors for other boards due to removed parameters
-Swallow -EAGAIN error in eth_rx()
-Updated function documentation

Changes in v5:
-Add a note to doc/README.drivers.eth about its obsolescence
-Add details about lo support to the README
-Added a comment about devname
-Added a test for skipping un-probe-able devices
-Added comments about test cases
-Added fallback for setting promiscuous mode
-Added help to Kconfig
-Added help to the sandbox eth mock driver Kconfig entry
-Added more details and examples in the README
-Check for NULL when reading fdt for host interface
-Check for malloc failure
-Expanded the Kconfig help
-Fix compile error on !DM_ETH
-Fixed warning from missing declaration
-Include new mapmem.h header
-Moved dm/ header
-Moved to a separate header mapmem.h
-New to v5
-Only check for alias if the name is long enough
-Remove cast of pointer passed to free
-Remove socket timeout
-Remove the empty sb_eth_raw_remove function
-Return -errno in from send and recv
-Return errno from recv
-Separate init to 2 helper static functions
-Set the socket to non-blocking
-Simplify sandbox eth driver by switching from int array to byte array
-Switch priv from packet buffer to a pointer to net_rx_packets[0]
-Switched to function to control state of mock driver
-Unmap memory for consistency
-Use INADDR_LOOPBACK
-Use a function call to change mock driver behavior
-Use local var for priv in eth_get_dev()
-Use more verbose comments
-Use net_rx_packets instead of a stack buffer

Changes in v4:
--Don't prevent eth_initialize on driver model
--If current == NULL, always check if there is a device available in eth_get_dev
--Include ethprime handling in eth_initialize
--Look up MAC address in post-probe
--Move env init call from uclass init to eth_initialize
--Print the alias in eth_initialize
--Use eth_initialize to probe all devices and write_hwaddr
-Add a helper function for eth_uclass_priv
-Add ability to disable ping reply in sandbox eth driver
-Add comments to priv struct definition
-Add documentation to the structures
-Add eth_get_ops helper
-Added comments to README.sandbox
-Added support for the 'lo' network interface
-Added testing for ethrotate
-Change -1 returns to error constants
-Change puts to printf
-Clean up the interface to sandbox's eth-raw-os by passing priv to raw-os
-Cleaned up sandbox EXTRA_ENV define
-Cleanup var definition order
-Fix compile regression in !DM_ETH case
-Fixed the MAC address limitation (now all traffic uses MAC address from env)
-Load from ethprime on eth_initialize()
-Move os file to arch
-Moved config to Kconfig
-New to v4
-Redo the seq / probe implementation
-Remove bd_t *bis from dm eth_ops init function
-Remove checks for driver==NULL
-Remove priv pointer in per-device priv struct (drivers already get their own directly from DM)
-Removed checks on priv != NULL and added protection in uclass instead
-Rename halt() to stop() in ops
-Rename init() to start() in ops
-Stop handling selecting a new "current" in pre-unbind as it will now work itself out by clearing the pointer
-Updated expected behavior based on changes to the NetLoop
-Use accessors for platdata and priv
-Use only the seq from DM to find aliases

Changes in v3:
--Fail init if not activated
--Fail probe if ethaddr not set
-Added 2 more ethaddr to sandbox
-Added dm eth testing
-Added support for aliases
-Added support for ethprime
-Added testing for netretry
-Allow current eth dev to be NULL
-Correct failure chaining from bind to probe to init
-Correct the pre_unbind logic
-Fixed blank line formatting for variable declaration
-Made the os raw packet support for sandbox eth build and work.
-Move the get_dev_by_* protos to also be !DM_ETH like the impl
-Prevent a crash if memory is not allocated
-Print which device in the debug write hwaddr
-Reorder dm test makefile
-Update ethaddr from env unconditionally on init
-Use set current to select the current device regardless of the previous selection

Changes in v2:
-Added the raw packet proof-of-concept patch.
-Cause an invalid name to fail binding
-Change printfs to debug in sandbox driver
-Changed eth_uclass_priv local var names to be uc_priv
-Move fake hwaddr to the device tree
-Move static data to priv
-Move the hwaddr to platdata so that its memory is allocated at bind when we need it
-Prevent device from being probed before used by a command (i.e. before eth_init()).
-Rebase on top of dm/master
-Remove unused priv struct for sandbox driver
-Removed extra parentheses
-Stop maintaining our own index and use DM seq now that it works for our needs
-Update error codes
-Updated comments

Joe Hershberger (27):
  test: dm: Reorder the objects to build
  common: Make sure arch-specific map_sysmem() is defined
  net: Provide a function to get the current MAC address
  net: Rename helper function to be more clear
  net: Remove unneeded "extern" in net.h
  net: Refactor in preparation for driver model
  net: Change return codes from net/eth.c to use errorno constants
  net: Use int instead of u8 for boolean flag
  net: Remove the bd* parameter from net stack functions
  net: Make netretry actually do something
  net: Access mapped physmem in net functions
  cmd: net: Clean up return codes
  dm: eth: Add basic driver model support to Ethernet stack
  net: Clean up network stack names used in DM drivers
  dm: eth: Pass the packet pointer as a parameter to recv
  sandbox: eth: Add network support to sandbox
  sandbox: eth: Add ARP and PING response to sandbox driver
  test: dm: eth: Add tests for the eth dm implementation
  dm: eth: Add support for aliases
  dm: eth: Add support for ethprime env var
  test: dm: eth: Add testing for ethrotate env var
  sandbox: eth: Add ability to disable ping reply in sandbox eth driver
  test: dm: net: Add a test of the netretry behavior
  sandbox: eth: Add a bridge to a real network for sandbox
  sandbox: Enable DHCP and IP defrag
  sandbox: eth: Add support for using the 'lo' interface
  net: Improve error handling

 api/api_net.c                             |   2 +-
 arch/arm/lib/board.c                      |   2 +-
 arch/arm/lib/bootm.c                      |   1 +
 arch/avr32/lib/board.c                    |   2 +-
 arch/m68k/lib/board.c                     |   4 +-
 arch/mips/mach-au1x00/au1x00_eth.c        |   2 +-
 arch/nds32/lib/board.c                    |   2 +-
 arch/openrisc/lib/board.c                 |   2 +-
 arch/powerpc/cpu/mpc8260/ether_fcc.c      |   2 +-
 arch/powerpc/cpu/mpc85xx/ether_fcc.c      |   2 +-
 arch/powerpc/cpu/mpc8xx/scc.c             |   2 +-
 arch/powerpc/lib/board.c                  |   2 +-
 arch/sandbox/Kconfig                      |  12 +
 arch/sandbox/cpu/Makefile                 |  10 +
 arch/sandbox/cpu/eth-raw-os.c             | 249 +++++++++++++
 arch/sandbox/dts/sandbox.dts              |  21 ++
 arch/sandbox/include/asm/eth-raw-os.h     |  40 +++
 arch/sandbox/include/asm/eth.h            |  15 +
 arch/sh/lib/board.c                       |   2 +-
 arch/sparc/lib/board.c                    |   2 +-
 board/BuS/eb_cpux9k2/cpux9k2.c            |   2 +-
 board/BuS/vl_ma2sc/vl_ma2sc.c             |   2 +-
 board/atmel/at91sam9261ek/at91sam9261ek.c |   2 +-
 board/egnite/ethernut5/ethernut5.c        |   2 +-
 board/ronetix/pm9261/pm9261.c             |   2 +-
 board/ronetix/pm9g45/pm9g45.c             |   2 +-
 board/sandbox/README.sandbox              |  78 +++-
 common/board_f.c                          |   1 +
 common/board_r.c                          |   3 +-
 common/bootm.c                            |   1 +
 common/cmd_bdinfo.c                       |   2 +
 common/cmd_bootm.c                        |   1 +
 common/cmd_demo.c                         |   1 +
 common/cmd_fat.c                          |   1 +
 common/cmd_fdt.c                          |   1 +
 common/cmd_lzmadec.c                      |   1 +
 common/cmd_md5sum.c                       |   1 +
 common/cmd_mem.c                          |   1 +
 common/cmd_net.c                          |  45 ++-
 common/cmd_nvedit.c                       |   1 +
 common/cmd_pxe.c                          |   1 +
 common/cmd_sf.c                           |   1 +
 common/cmd_source.c                       |   1 +
 common/cmd_trace.c                        |   1 +
 common/cmd_ximg.c                         |   1 +
 common/hash.c                             |   1 +
 common/image-fdt.c                        |   1 +
 common/image-fit.c                        |   1 +
 common/image.c                            |   1 +
 common/iotrace.c                          |   1 +
 common/lcd.c                              |   1 +
 common/malloc_simple.c                    |   1 +
 common/spl/spl_net.c                      |   2 +-
 doc/README.drivers.eth                    |   6 +
 drivers/demo/demo-simple.c                |   1 +
 drivers/i2c/i2c-uniphier-f.c              |   1 +
 drivers/i2c/i2c-uniphier.c                |   1 +
 drivers/mtd/spi/sf_probe.c                |   1 +
 drivers/net/4xx_enet.c                    |   5 +-
 drivers/net/Kconfig                       |  42 +++
 drivers/net/Makefile                      |   2 +
 drivers/net/netconsole.c                  |   4 +-
 drivers/net/sandbox-raw.c                 | 165 +++++++++
 drivers/net/sandbox.c                     | 208 +++++++++++
 drivers/serial/ns16550.c                  |   1 +
 drivers/serial/serial_uniphier.c          |   1 +
 fs/fs.c                                   |   1 +
 include/common.h                          |  17 -
 include/configs/sandbox.h                 |  25 +-
 include/dm/uclass-id.h                    |   1 +
 include/mapmem.h                          |  32 ++
 include/net.h                             | 201 +++++++----
 lib/trace.c                               |   1 +
 net/eth.c                                 | 580 ++++++++++++++++++++++++++----
 net/net.c                                 |  67 ++--
 net/nfs.c                                 |   6 +-
 net/tftp.c                                |   6 +-
 test/compression.c                        |   1 +
 test/dm/Makefile                          |   5 +-
 test/dm/cmd_dm.c                          |   1 +
 test/dm/eth.c                             | 156 ++++++++
 test/dm/test.dts                          |  20 ++
 82 files changed, 1869 insertions(+), 229 deletions(-)
 create mode 100644 arch/sandbox/cpu/eth-raw-os.c
 create mode 100644 arch/sandbox/include/asm/eth-raw-os.h
 create mode 100644 arch/sandbox/include/asm/eth.h
 create mode 100644 drivers/net/sandbox-raw.c
 create mode 100644 drivers/net/sandbox.c
 create mode 100644 include/mapmem.h
 create mode 100644 test/dm/eth.c

-- 
1.7.11.5



More information about the U-Boot mailing list