MCUSW
Eth Virtual Mac User Guide

Introduction

This document details AUTOSAR BSW ETH module implementation when ETH driver is configured to operate in virtual mac mode

  • Supported AUTOSAR Release : 4.3.1
  • Supported Configuration Variants : Pre-Compile
  • Vendor ID : ETH_VENDOR_ID (44)
  • Module ID : ETH_MODULE_ID (88)

The ETH module is documented in the ETH module user guide.[3] This user guide complements the ETH module user guide and documents the virtual mac mode operation of the ETH module. The ETH module user guide should be read in its entirety before reading this user guide

Following section provides background info on the virtual mac mode


Virtual MAC basics

J721E and J7200 Integrated Ethernet Switch Overview

The J721E and J7200 SoC includes an integrated Ethernet switch called Common Platform Switch (CPSW). CPSW supports multiple external MAC ports and one host port. CPSW in J721E has 8 MAC ports and CPSW in J7200 has 4 MAC ports.

Applications running on different cores in the Jacinto 7 SoC send and receive Ethernet frames via the host port. Applications running on different cores can simultaneously transmit to / receive from host port. In order to transmit and receive frames, an application on a core requires the following:

  • Dedicated Tx DMA channel to transmit frames
  • Dedicated Rx Flow DMA channel to receive frames
  • Dedicated MAC address allocated to the application. All frames sent by the application will have this as source MAC address.
  • Configuration of switch classifier to direct received frames to the Rx Flow DMA queues.
    • The CPSW allows classification based on different L2/L3 header fields like destination MAC address, source MAC address, EtherType, IP address, etc.
      eth_virtualmac_ug_cpsw.png
      CPSW 9 port

Back To Top


J7 Multi core data path

eth_virtualmac_ug_multicore_data_path.png
CPSW 9G port

As illustrated above there exits direct data path to CPSW switch host port from all cores

  • Dedicated Tx channels per application
  • Rx Flow classification in HW based on L2/L3 headers
  • Configuration register access limited to master core

Back To Top


Master Core and Virtual MAC concept

As illustrated previously, there is designated master core. All CPSW configuration is exclusively done from this master core. The master core (called switch R5) is responsible for managing the pool of free Tx DMA channels Rx flows, destination MAC addresses.

Any application running on remote core that wants to establish a data path must send an IPC message to the master core to allocate resources such as Tx channel, Rx flow, destination MAC address. Application running on remote must also send IPC message to master core for the following:

  • Adding classifier entries to associate L2/L3 header with the specified Rx Flow.
  • Any switch configuration like adding unicast/multicast address to the switch address resolution table.

The master core runs a TI RTOS application called Ethernet Firmware.

Ethernet Firmware (ethfw) functionality:

  • Ethernet Firmware manages the resource pool
  • Remote core applications can allocate resources/ configure the switch by sending messages to the remote device server running on Ethernet Firmware.

The application running on remote core is said to operate in virtual MAC mode configuration.

Back To Top


AUTOSAR software stack < -> Ethernet Firmware Interaction

eth_virtualmac_ug_asr_ethfw_interaction.png
AUTOSAR Eth interaction with Ethernet Firmware

The Ethernet Remote Device RPC Client is layer under the Ethernet Driver which uses CddIpc to send RPC msgs to the Ethernet Firmware and process the response. The Ethernet Firmware hosts a Ethernet Remote Device RPC Server service for servicing remote cores.

Back To Top


RPC msg exchange between Eth Driver and Ethernet Firmware

The Eth Driver uses the CddIpc MCAL to send msg to and recv msg from Ethernet Firmware.

Typical Eth Rpc sequence is illustrated below.

eth_virtualmac_ug_msgexchange.png
RPC msg exchange EthDriver <-> EthFw

The rpcCmdComplete callback is a function pointer populated in Eth_ConfigType structure.

Application may choose to configure the Eth Driver to check for msgs to be processed in Eth_MainFunction(). In this case, it will regularly schedule calls to Eth_MainFunction() instead of invoking Eth_NotifyVirtmacMsgReceived() from CddIpcNewMessageNotify.

Ethernet MCAL APIs Eth_DispatchVirtmacXXX are asynchronous APIs that dispatch RPC msg to Ethernet Firmware. The application needs to wait for rpcCmdComplete callback as shown to determine completion of API and the status (SUCCESS/FAIL)

Back To Top


Remote Core Data Path setup illustration

The data path setup sequence of the Ethernet Virtual MAC driver is as below.

eth_virtualmac_ug_datapathsetup.png
Data Path Setup sequence of Autosar Ethernet Driver in Virtual MAC mode

Functional Description

The ETH driver in virtual MAC mode does not control any of the CPSW submodules like MAC/MDIO/ALE/STATS unlike the standard ETH driver.

The ETH driver in virtual MAC mode supports transmission and reception of packets like the ETH driver in non-virtual MAC mode. The ETH driver uses the UDMA driver APIs to setup data transfers to/from the host port.

The ETH driver implements single UDMA channel for data transmission and single rx flow for data reception. Interrupts can be enabled for DMA transmit and receive completion events.

The DMA transfers are based on descriptors called Host Mode Packet Descriptors (HMPD). The descriptors are given to and retrieved from the UDMA via Ring Accelerators. There are three rings used per data direction in this implementation:

  • Transmit
    • Free Queue Ring - Descriptors with the address and length of the buffers to be transmitted are queued into this ring. In normal conditions, only CPSW will dequeue descriptors from this queue.
    • Completion Queue Ring - Descriptors that correspond to Ethernet frames which have already been consumed by the CPSW are placed in this queue. CPSW is the producer and host is the consumer of this ring.
    • Tear-down Completion Queue Ring - This ring is used only when the UDMA channel is torn down.
  • Receive
    • Free Queue Ring - Descriptors with the address and length of free buffers to be filled with incoming Ethernet frames are queued into this ring. In normal conditions, only the CPSW will dequeue descriptors from this queue.
    • Completion Queue Ring - Descriptors that correspond to buffers filled with new data from incoming Ethernet frames are placed in this queue. CPSW is the producer and host is the consumer of this ring.
    • Tear-down Completion Queue Ring is not used in virtual MAC mode for Rx. This is because there is a single UDMA Rx channel with upto 64 flows The single Udma Rx channel open/close is managed by the Ethernet Firmware.

The depth of each ring as well as its associated memory is configurable. The ring memories can be any memory in the system, but it's recommended that they are placed in a fast memory (i.e. OCMRAM or MSMC3). The depth of these rings is determined by the number of TX and RX buffers set in the driver configuration (EthTxBufTotal and EthRxBufTotal).

Similarly, the HMPDs can be placed in any memory of the system, but it's recommended that they are placed in OCMRAM or MSMC3 as well.

Back To Top


Ethernet interrupt to ISR mapping

The following table lists the mapping between Ethernet interrupts and the corresponding interrupt service routines.

Interrupt Number Description Associated ISR
Configurable DMA RX Completion Eth_RxIrqHdlr_0
Configurable DMA TX Completion Eth_TxIrqHdlr_0

The DMA interrupt numbers can be set via the Ethernet driver configuration parameters dmaTxChIntrNum and dmaRxChIntrNum.

The interrupt numbers passed to the Ethernet driver configuration must be within the range allocated for the core by the Udma LLD resource manager, otherwise the interrupt allocation will fail while enabling the Ethernet controller.

Please refer to the UDMA Driver Resource Manager allocation for further details.

In virtual MAC mode, the ETHTRCV module should not be used as the PHY management is under ownership of Ethernet Firmware.

Back To Top


Configuration

The Eth Driver implementation in this release only supports the Pre-Compile variant. The driver expects generated Eth_Cfg.h and Eth_Cfg.c to be present at the locations specified in the Eth File Structure section.

Back To Top


Variance / Deviation from the specification

Ethernet APIs Not Supported

APIs not support by the Eth Drvier in non-virtual MAC mode mentioned in Eth Driver user guide [3] are not supported in virtual MAC mode as well. Additionally the following APIs are not supported in virtual MAC mode

  • Eth_GetEtherStats(): Statistics module cannot be accessed by the Eth Driver operating in virtual MAC mode. In the current release getting the statistics from Ethernet Firmware core via RPC msgs is not supported.
  • Eth_GetDropCount(): Statistics module cannot be accessed by the Eth Driver working in virtual MAC mode. In the current release getting the statistics from Ethernet Firmware core via RPC msgs is not supported.
  • Eth_ReadMii(): In Virtual MAC mode the PHY is not managed by the Eth Transceiver driver. Hence the MII access APIs are also not supported by the Ethernet Driver.
  • Eth_WriteMii(): In Virtual MAC mode the PHY is not managed by the Eth Transceiver driver. Hence the MII access APIs are also not supported by the Ethernet Driver.
  • Eth_UpdatePhysAddrFilter(): The ALE module which requires configuration to update the address filter cannot be accessed by the Eth Driver operating in virtual MAC mode. The driver supports RPC APIs to add/remove unicast/multicast/vlan in the switch by means of Eth_DispatchVirtmacXXX APIs. Refer the Ethernet driver API guide for details [1].

The reason for having a new set of Eth_DispatchVirtmacXXX instead of invoking the RPC APIs inside the existing Eth_UpdatePhysAddrFilter API is as follows:

As the RPC APIs are asynchronous dispatch APIs it is not possible to abstract their calls from the Eth Driver Client by invoking the APIs within an existing API, such as Eth_UpdatePhysAddrFilter(). It would require blocking in the API until response from Ethernet Firmware is received. Blocking would abstract the Ethernet Client from virtual MAC / native MAC mode operation but would pose problems with error handling, hence a new set of APIs which must be explicitly invoked by the Ethernet Driver Client have been implemented.

Back To Top


Ethernet Configuration variance

As explained in the section Functional Description, the depth of Rx and Tx DMA queues is determined by the number of TX and RX buffers set in the driver configuration (EthTxBufTotal and EthRxBufTotal).

As per AUTOSAR spec [1] the maximum value of EthTxBufTotal and EthRxBufTotal is 255. However the UDMA supports a buffer depth of upto 1048575 entries (2^20 - 1) To support usecases that require queue depth greater that 255 buffers, the MCAL configurator for ETH module allows greater than 255 buffers for EthTxBufTotal and EthRxBufTotal.

Back To Top


Ethernet Transceiver

Ethernet Transceiver should not be used in virtual MAC mode of the Ethernet Driver Hence none of the API of Ethernet Transceiver are supported.

Back To Top


Non Standard Service APIs

The following vendor specific extension APIs are supported in virtual MAC mode

  • Eth_DispatchVirtmacInit()
  • Eth_DispatchVirtmacDeinit()
  • Eth_NotifyVirtmacMsgReceived()
  • Eth_DispatchVirtmacSubscribeAllTraffic()
  • Eth_DispatchVirtmacUnsubscribeAllTraffic()
  • Eth_DispatchVirtmacSubscribeDstMac()
  • Eth_DispatchVirtmacUnsubscribeDstMac()
  • Eth_DispatchVirtmacAssociateIPv4Macaddr()
  • Eth_DispatchVirtmacDisassociateIPv4Macaddr()
  • Eth_DispatchVirtmacAddUnicastAddr()
  • Eth_DispatchVirtmacAddMcastAddr()
  • Eth_DispatchVirtmacDelAddr()
  • Eth_DispatchVirtmacAddVlan()
  • Eth_DispatchVirtmacDelVlan()
  • Eth_SendCustomNotify()

Refer the Ethernet driver API guide for details of these APIs

Back To Top


Interrupt Configuration

The Ethernet driver doesn't register any interrupt handlers (ISR), it is expected that consumer of this driver registers the required interrupt handler.

The Ethernet interrupts are:

  • TX DMA Completion - Asserted when a packet has been consumed by CPSW for transmission. The interrupt number is configurable and is passed via Ethernet configuration parameters. Please refer to the resource partitioning information for further details about what interrupt numbers are allocated for the MCU
  • RX DMA Completion - Asserted when a packet has been received. The interrupt number is configurable and is passed via Ethernet configuration parameters. Please refer to the resource partitioning information for further details about what interrupt numbers are allocated for the MCU

Other CPSW interrupts (like the Statistics Pending interrupt, MDIO interrupt) are not handled by the driver.

Please refer to the EthApp_InterruptConfig() function in Eth virtual MAC demo application for the implementation details of the interrupt registration.

Back To Top


Power-up

The driver doesn't configure the functional clock and power for the Ethernet module. It is expected that the Secondary Bootloader (SBL) powers up the required modules. Please refer SBL documentation.

Back To Top


Build and Running the Application

Example application to illustrate use of Eth Driver in virtual MAC mode is included in mcal examples.

Example app name: eth_virtmac_app Source code : ${MCUSW}/mcal_drv/mcal/examples/Eth/eth_app/target/EthVirtmacApp.c

** J721E ** Eth Driver Configuration: mcal_drv/mcal/examples_config/Eth_Demo_Cfg/output/generated/soc/j721e/mcu2_1 CddIpc Driver Configuration: mcal_drv/mcal/examples_config/CddIpc_Demo_Cfg/output/generated/soc/j721e/mcu2_1

** J7200 ** Eth Driver Configuration: mcal_drv/mcal/examples_config/Eth_Demo_Cfg/output/generated/soc/j7200/mcu2_1 CddIpc Driver Configuration: mcal_drv/mcal/examples_config/CddIpc_Demo_Cfg/output/generated/soc/j7200/mcu2_1

The steps to build the virtual MAC mode application:

** J721E **

$ cd mcusw/build/
$ make eth_virtmac_app CORE:=mcu2_1 BOARD:=j721e_evm

** J7200 **

$ cd mcusw/build/
$ make eth_virtmac_app CORE:=mcu2_1 BOARD:=j7200_evm

The example binary will be available at:

** J721E **

mcusw/binary/eth_virtmac_app/bin/j721e_evm/eth_virtmac_app_mcu2_1_${build_profile}.xer5f

** J7200 **

mcusw/binary/eth_virtmac_app/bin/j7200_evm/eth_virtmac_app_mcu2_1_${build_profile}.xer5f

Note on the CddIpc Driver Configuration:

  • The channel CddIpcConf_IpcComChanId_Cdd_IpcMcu20_EthDevice is the configuration to communicate with the Ethernet Firmware endpoint.
  • The .remoteEp = 28U is fixed for the Ethernet Firmware and should not be modified.

In this release, the application demonstrating virtual MAC mode of operation of the Eth Driver is supported only on mcu2_1 core.

Building the host-side example application

The GCC compiler is required to build the host-side application.

The steps to build the host-side application in Linux are listed below:

$ cd mcal_drv/mcal/examples/Eth/eth_app/host/
$ make

Building the target-side example application in loopback mode

Unlike the Eth example, virtual MAC mode application does not support internal loopback test. This is because the MAC needs to be configured for loopback mode and the MAC configuration is under control of Ethernet Firmware and cannot be configured from Ethernet driver in virtual MAC mode.

Back To Top


Steps to run example application

Running the test

This test consists of two applications: host-side application that runs on a Linux machine, and a target-side application that is loaded to the device (DUT).

Please refer to the Building the host-side example application section for instructions to build the host-side application.

  1. Connect a CAT5e/CAT6 Ethernet cable to the MCU ETHERNET connector of the J721E or J7200 EVM and to the PC's Ethernet port
  2. Don't setup the Network Connection in Linux, disable automatic connection if needed. The intention is to avoid any frames going to the DUT, other than those sent by the test application
  3. Find the interface name on the host PC side by running the following command:
$ ifconfig -s
  1. Run the host-side application with root privileges (needed for raw sockets) and specify the interface name to be used, for instance:
    $ cd mcal_drv/mcal/examples/Eth/eth_app/host/
    $ sudo ./EthHostApp -i eth2
    
  2. At this point, the host-side application will be waiting for the DUT
  3. On target Load Ethernet Firmware on MAIN_Cortex_R5_0_0.
    • ${ETHFW}/out/${soc}/R5F/SYSBIOS/${build_profile}/app_remoteswitchcfg_server.xer5f
  4. Run MAIN_Cortex_R5_0_0
  5. Load the target-side application eth_virtmac_app_mcu2_1_${build_profile}.xer5f on MAIN_Cortex_R5_0_1
  6. Run MAIN_Cortex_R5_0_1
  7. The host-side application should detect that the device is now ready and all tests will be run (including frame transmission with and without confirmation, frame reception, filtering MAC addresses, transmission and reception of VLAN tagged packets, transmit throughput, etc)
  8. Check the logs printed in the Linux terminal and verify that the host-side application didn't report any errors
  9. Check the logs printed in the serial console (or CCS console if UART is not enabled) and verify that the target-side application didn't report any errors

The example applications on either side (host or target) will report a fail status if any test Ethernet frames is lost. So even frames which are lost due to physical link will cause the example application to report as a failure.

Back To Top



Dependencies on SW Modules


DET

This implementation depends on the DET in order to report development errors and can be turned OFF. Refer to the Development Error Reporting section for detailed error codes.

Back To Top


SchM

This implementation requires 1 level of exclusive access to guard critical sections. Invokes SchM_Enter_Eth_ETH_EXCLUSIVE_AREA_0(), SchM_Exit_Eth_ETH_EXCLUSIVE_AREA_0() to enter critical section and exit.

In the example implementation (SchM_Eth.c), all the interrupts on CPU are disabled. However, disabling of the enabled Ethernet related interrupts should suffice.

Back To Top


CddIpc

Inorder to send Rpc messages to the Ethernet Firmware core, the CddIpc module is used by the Ethernet driver in virtual MAC mode. The IPC channel configuration to communicate with Ethernet Firmware is given below

    {
        .id = CddIpcConf_IpcComChanId_Cdd_IpcMcu20_EthDevice,
        /**< Unique identifiers for a channel */
        .localEp = 11U,
        /**< Local End Point identifier, on which MCAL/AUTOSAR is hosted */
        .remoteEp = 28U,
        /**< Remote End Point identifier, on remote cores */
        .remoteProcId = CDD_IPC_CORE_MCU2_0,
        /**< Remote Processor Identifier */
        .numMsgQueued = 256U,
        /**< Number of buffer allocated to this communication channel */
        .maxMsgSize = 512,
        /**< Defines the pointer to memory */
        .reserved = 0U,
        /**< Future use if any */
    },

It is required to initialize IPC (Cdd_IpcInit()) before Eth_init() is invoked.

Back To Top


File Structure

Eth File Structure

eth_ug_dir_detailed.png
Ethernet Detailed Directory Structure
  • Ethernet driver
    • Driver implemented by: Eth.c, Eth_Irq.c, Eth_Priv.c, Eth_Rpc.c, Eth.h, Eth_Irq.h, Eth_Priv.h, Eth_RpcPriv.h, Eth_Rpc.h and CPSW core driver files
    • Example Configuration by: Eth_Cfg.c and Eth_Cfg.h
    • Example Application by: EthVirtmacApp.c, EthUtils.c, EthUtils.h and EthUtils_Patterns.h

Error Handling


Development Error Reporting

Development errors are reported to the DET using the service Det_ReportError(), when enabled. The driver interface files Eth.h lists the service IDs.

Back To Top


Error codes

Production error are reported to DET via Det_ReportError(). Only the error codes in the Ethernet and Ethernet Transceiver driver specifications are reported which are listed below. There are no implementation specific error codes being reported.

Ethernet driver error codes

Type of Error Related Error code Value (Hex)
Invalid controller index ETH_E_INV_CTRL_IDX 0x01
Eth module was not initialized ETH_E_UNINIT 0x02
Invalid pointer in parameter list ETH_E_PARAM_POINTER 0x03
Invalid parameter ETH_E_INV_PARAM 0x04
Initialization failure ETH_E_INIT_FAILED 0x05
Invalid mode ETH_E_INV_MODE 0x06
Mismatch in API version supported by Ethernet Firmware and Autosar Ethernet Driver ETH_E_VIRTMAC_APIMISMATCH 0x07
Dispatch of Virtual MAC RPC command failed ETH_E_VIRTMAC_RPCCMDFAILED 0x08
Ethernet MCAL RPC client received unhandled notify from Ethernet Firmware server ETH_E_VIRTMAC_UNSUPPORTECLIENTNOTIFY 0x09
Rpc Command sent by client not supported by server ETH_E_VIRTMAC_UNSUPPORTEDSRVCMD 0x0A

Back To Top


Production Code Error Reporting

Production error are reported to DEM via the service DEM_ReportErrorStatus(). There are no implementation specific error codes being reported. Only the error codes in the Ethernet and Ethernet Transceiver driver specifications are reported which are listed below.

Type of Error Related Error code
Ethernet Controller Access Failure ETH_E_ACCESS
Ethernet Frames Lost ETH_E_RX_FRAMES_LOST
CRC Failure ETH_E_CRC
Frame Size Underflow ETH_E_UNDERSIZEFRAME
Frame Size Overflow ETH_E_OVERSIZEFRAME
Frame Alignment Error ETH_E_ALIGNMENT
Single Frame Collision ETH_E_SINGLECOLLISION
Multiple Frame Collision ETH_E_MULTIPLECOLLISION
Late Frame Collision ETH_E_LATECOLLISION


Back To Top


API Description

The AUTOSAR BSW Eth Driver specification details the APIs [1].

The additional vendor specific APIs for virtual MAC mode are documented in the API guide The APIs not supported in virtual MAC mode are documented at Ethernet APIs Not Supported

Back To Top


Example Application

The example application demonstrate use of Eth module in virtual MAC mode.

The example consists of an application that runs on the J721E or J7200 device (DUT) and an application that runs on a Linux PC (host). The host and target (DUT) applications communicate with each other to start the different stages of the example tests.

The Eth example relies on shared utils which provide helper functions (i.e. filling an Ethernet frame with test data, verifying frame contents, etc) which are useful on the DUT and host sides.

The following table summarizes the different tests implemented by the example application.

Test ID Summary Description
test_0001 Basic DUT frame reception Host will send 1000 Ethernet frames, the DUT will receive and verify that the frame content matches the expected patterns
test_0002 Basic DUT frame transmission The DUT will send 1000 non-VLAN tagged frames without TX confirmation. The host PC will check that all frames are received and that the frame content matches the expected patterns
test_0003 External loopback The DUT will send frames to the host, the host will receive the frames and will send them back to the DUT
test_0004 Default filter operation Host will send 500 frames with DUT's MAC address and 500 frames with other MAC address. The DUT will reject the 500 frames that don't matches DUT's address
test_0005 Different filter configurations This test is split in different stages that will exercise different filter operations like adding/removing unicast address. The virtual MAC mode does not support promiscouse mode as that would involve changing the switch configuration affection other clients.
test_0006 DUT frame transmission with confirmation The DUT will send 1000 non-VLAN tagged frames and will request TX confirmation. The host PC will check that all frames are received and that the frame content matches the expected patterns.
test_0007 Transmission of VLAN tagged frames The DUT will send 1000 VLAN tagged frames and will request TX confirmation. The host PC will check that all frames are received and that the frame content matches the expected patterns
test_0008 Transmission of different frame lengths The DUT will send non-VLAN tagged frames of different lengths, including short frames. The host PC will check that all frames are received and that the frame content matches the expected patterns
test_0009 VLAN tagged frame reception Host will send 1000 VLAN tagged Ethernet frames, the DUT will receive and verify that the frame content matches the expected patterns
test_0010 Controller mode changes The application will set the controller to DOWN mode and then back to ACTIVE mode. Ethernet frame transmission and reception tests will be run afterwards. 10 iterations of these steps will be executed.
test_0100 Transmit throughput DUT transmit throughput is measured over 150,000 Ethernet frames sent from the host PC.

The following list identifies key steps performed by the DUT side application:

  • EthVirtmacApp_ethStartup()
    • Interrupt controller initialization and ISR registration for the following interrupts:
      • TX DMA completion
    • RX DMA completion
    • Initialize counters required for timed operations
  • EthVirtmacApp_ipcStartup()
    • Register for the following CddIpc Interrupt:
      • Mailbox receive interrupt for mailbox msgs received from MCU2_0.
      • MCU2_0 is the core on which Ethernet Firmware runs.
  • EthVirtmacApp_ipcInit()
  • EthVirtmacApp_init()
    • Ethernet driver
      • Ethernet driver initialization (Eth_Init())
      • Wait for Ethernet Firmware to connect with the Ethernet Driver.
        • Pend on a semaphore posted by EthVirtmacApp_rpcFwRegistered()
      • Allocate resources from Ethernet Firmware required to establish data path (EthVirtmacApp_virtmacInit())
        • Eth_DispatchVirtmacInit() and wait for Rpc Command completion with succes status
          • Pend on a semaphore posted by EthVirtmacApp_rpcCmdComplete()
            • EthVirtmacApp_rpcCmdComplete posts semaphore when it received a Cmd Complete callback with the expected SID {Eth_DispatchVirtmacInit()} and status is SUCCESS
      • Put controller to active mode (Eth_SetControllerMode())
      • Get and print the physical address (Eth_GetPhysAddr())
      • Subscribe to default addresses.
        • Configure the switch to direct the default addresses to the Receive Flow owned by the Ethernet Driver. Subscribing to the flow is required for the EThernet Driver to receive the packets
          • Subscribe to the unicast MAC address allocated to the Ethernet Driver (returned by Eth_GetPhysAddr())
          • Subscribe to the special multicast address used by the host app to send control commands
          • Add broadcast address to switch address resolution table. Add MAC_PORT_2 and MAC_PORT_3 to broadbcast address membership.
            • Host port is not added to broadcast address membsership to prevent random broadcast packets from being received by the Ethernet Driver
  • Loop through all tests
    • EthApp_test_0001: Basic DUT frame reception test:
      • Send test START command
      • Receive frames until the STOP is detected
    • EthApp_test_0002: Basic DUT frame transmission test:
      • Send test START command
      • Transmit 1000 non-VLAN tagged frames without confirmation
    • EthApp_test_0003: External loopback test. The DUT sends frames to the host, the host receives the frames and sends them back to the DUT. The following operations are performed on the DUT side:
      • Send START command
      • Send and receive 1000 frames, for each of them:
        • A different payload is set
        • EtherType and payload are verified on the received frame
    • EthApp_test_0004: Default filter operation. Test the operation of the default DUT's filter configuration (only frames with DUT's MAC address are accepted, all others are rejected). The DUT performs these operations:
      • Send START command
      • Receive frames until the STOP is detected
      • The number of frames expected to be received is 500 as only one half of the total frames sent by the host (1000) have the DUT's MAC address
    • EthApp_test_0005: Different filter configurations test. Test the different modes of the DUT's filter configuration. The DUT performs these operations:
      • Send START command
      • Part 1
        • Filter is reset to accept only frames with DUT's MAC address
        • Host side transmits 1000 frames and then transmits the STOP command
        • Receive frames until STOP is detected
          • Frame 1: Source MAC address is DUT's. It should be accepted
          • Frame 2: Source MAC address is not DUT's. It should be rejected
          • Expected to receive 500 frames
      • Part 2
        • A second unicast MAC address is added to the DUT's filter
        • Host side transmits 1000 frames and then transmits the STOP command
        • Receive frames until STOP is detected
          • Frame 1: Source MAC address is DUT's. It should be accepted
          • Frame 2: Source MAC address is second valid MAC address. It should be accepted
          • Expected to receive 1000 frames
      • Part 3
        • A multicast address is added to the DUT's filter
        • Host side transmits 1000 frames and then transmits the STOP command
        • Receive frames until STOP is detected
          • Frame 1: Source MAC address is DUT's. It should be accepted
          • Frame 2: Source MAC address is multicast address. It should be accepted
          • Expected to receive 1000 frames
      • Part 4
        • The multicast address is removed from the DUT's filter
        • Host side transmits 1000 frames and then transmits the STOP command
        • Receive frames until STOP is detected
          • Frame 1: Source MAC address is DUT's. It should be accepted
          • Frame 2: Source MAC address is multicast address. It should be rejected
          • Expected to receive 500 frames
      • Part 5
        • Another unicast address is added to the DUTs switch address resolution table
        • Host side transmits 1000 frames and then transmits the STOP command
        • Receive frames until STOP is detected
          • Frame 1: Source MAC address is DUT's. It should be accepted
          • Frame 2: Source MAC address is the newly added unicast address. It should be accepted
          • Expected to receive 1000 frames
      • Part 6
        • The filter is reset back to accept only DUT's unicast address
        • Host side transmits 1000 frames and then transmits the STOP command
        • Receive frames until STOP is detected
          • Frame 1: Source MAC address is DUT's. It should be accepted
          • Frame 2: Source MAC address is not DUT's. It should be rejected
          • Expected to receive 500 frames
    • EthApp_test_0006: Transmission with confirmation test. DUT frame transmission test with TX confirmation. The DUT performs these operations:
      • Send START command
      • Transmit 1000 non-VLAN tagged frames with confirmation
    • EthApp_test_0007: Transmission of VLAN tagged frames test. DUT frame transmission test of VLAN tagged frames. The DUT performs these operations:
      • Send START command
      • Transmit 1000 VLAN tagged frames with confirmation
    • EthApp_test_0008: Transmission of different frame lengths. DUT frame transmission test of different frame lengths, including short frames (less than 64 octets). The DUT performs these operations:
      • Send START command
      • Transmit 10 frames for lengths starting at 10 octets in increments of 10 octets until 1500 octets
    • EthApp_test_0009: VLAN tagged frame reception test
      • Host side transmits 1000 frames and then transmits the STOP command
      • The DUT performs these operations:
        • Send START command
        • Receive frames until the STOP is detected
      • The number of frames expected to be received is 1000
    • EthApp_test_0010: Controller mode change test. The DUT performs the following operations:
      • Send START command
      • Run 10 iterations of:
        • Unsubscribe all destination MAC address from the Rx flow owned by the Ethernet Driver
        • Set controller mode to DOWN state
        • Set controller mode to ACTIVE state
        • Subscribe to unicast address owned by the Ethernet Driver and subscribe to special multicast address used by test app.
        • Transmit frames (run test 0002)
        • Receive frames (run test 0001)
    • EthApp_test_0100: DUT transmit throughput test. Measure DUT transmit throughput over 150000 frames
      • Host side transmits 150000 frames and then transmits the STOP command
      • The DUT performs the following operations:
        • Get the initial timestamp corresponding to the first frame received
        • Receive frames until the STOP is detected and get the final timestamp
        • Compute the transmit throughput from the number of received frames and the time difference between the two captured timestamps
  • EthApp_deinit()
  • Check for error status and print the result

The host application steps are not presented in this guide, but can be found documented in the host side code. Please refer to the File Structure section for the directory where the HostApp.c file can be found.

The configuration files are present can be found at the directories shown in the File Structure section.

Back To Top


Example Log

Target-side application log

J721E/J7200

Default (non-loopback) example application log

Target-side application log
[MAIN_Cortex_R5_0_1] Eth Application Starts
 
 CDD IPC MCAL Version Info
---------------------
 Vendor ID           : 44
 Module ID           : 255
 SW Major Version    : 1
 SW Minor Version    : 0
 SW Patch Version    : 0
 
MAC Port 1 Address: 70:ff:76:1d:93:6d


-----------------------------------------------------------
test_0001: START
test_0001: received 1000 of 1000 frames
test_0001: END
Test Result: Pass
-----------------------------------------------------------


-----------------------------------------------------------
test_0002: START
test_0002: END
Test Result: Pass
-----------------------------------------------------------


-----------------------------------------------------------
test_0003: START
test_0003: END
Test Result: Pass
-----------------------------------------------------------


-----------------------------------------------------------
test_0004: START
test_0004: received 500 of 500 frames
test_0004: END
Test Result: Pass
-----------------------------------------------------------


-----------------------------------------------------------
test_0005: START
test_0005:  Null: Exp1: exp 500, got 500
test_0005:  Null: Exp2: exp   0, got   0
test_0005: Ucast: Exp1: exp 500, got 500
test_0005: Ucast: Exp2: exp 500, got 500
test_0005: Mcast: Exp1: exp 500, got 500
test_0005: Mcast: Exp2: exp 500, got 500
test_0005: Mcast: Exp1: exp 500, got 500
test_0005: Mcast: Exp2: exp   0, got   0
test_0005: Bcast: Exp1: exp 500, got 500
test_0005: Bcast: Exp2: exp 500, got 500
test_0005:  Null: Exp1: exp 500, got 500
test_0005:  Null: Exp2: exp   0, got   0
test_0005: END
Test Result: Pass
-----------------------------------------------------------


-----------------------------------------------------------
test_0006: START
test_0006: END
Test Result: Pass
-----------------------------------------------------------


-----------------------------------------------------------
test_0007: START
test_0007: END
Test Result: Pass
-----------------------------------------------------------


-----------------------------------------------------------
test_0008: START
test_0008: END
Test Result: Pass
-----------------------------------------------------------


-----------------------------------------------------------
test_0009: START
test_0009: received 1000 of 1000 frames
test_0009: END
Test Result: Pass
-----------------------------------------------------------


-----------------------------------------------------------
test_0010: START
EthIf_CtrlModeIndication: DOWN
EthIf_CtrlModeIndication: ACTIVE
test_0002: START
test_0002: END
test_0001: START
test_0001: received 1000 of 1000 frames
test_0001: END
EthIf_CtrlModeIndication: DOWN
EthIf_CtrlModeIndication: ACTIVE
test_0002: START
test_0002: END
test_0001: START
test_0001: received 1000 of 1000 frames
test_0001: END
EthIf_CtrlModeIndication: DOWN
EthIf_CtrlModeIndication: ACTIVE
test_0002: START
test_0002: END
test_0001: START
test_0001: received 1000 of 1000 frames
test_0001: END
EthIf_CtrlModeIndication: DOWN
EthIf_CtrlModeIndication: ACTIVE
test_0002: START
test_0002: END
test_0001: START
test_0001: received 1000 of 1000 frames
test_0001: END
EthIf_CtrlModeIndication: DOWN
EthIf_CtrlModeIndication: ACTIVE
test_0002: START
test_0002: END
test_0001: START
test_0001: received 1000 of 1000 frames
test_0001: END
EthIf_CtrlModeIndication: DOWN
EthIf_CtrlModeIndication: ACTIVE
test_0002: START
test_0002: END
test_0001: START
test_0001: received 1000 of 1000 frames
test_0001: END
EthIf_CtrlModeIndication: DOWN
EthIf_CtrlModeIndication: ACTIVE
test_0002: START
test_0002: END
test_0001: START
test_0001: received 1000 of 1000 frames
test_0001: END
EthIf_CtrlModeIndication: DOWN
EthIf_CtrlModeIndication: ACTIVE
test_0002: START
test_0002: END
test_0001: START
test_0001: received 1000 of 1000 frames
test_0001: END
EthIf_CtrlModeIndication: DOWN
EthIf_CtrlModeIndication: ACTIVE
test_0002: START
test_0002: END
test_0001: START
test_0001: received 1000 of 1000 frames
test_0001: END
EthIf_CtrlModeIndication: DOWN
EthIf_CtrlModeIndication: ACTIVE
test_0002: START
test_0002: END
test_0001: START
test_0001: received 1000 of 1000 frames
test_0001: END
test_0010: completed 10 of 10 iterations
test_0010: END
Test Result: Pass
-----------------------------------------------------------


-----------------------------------------------------------
test_0100: START
test_0100: 150000 frames sent, 0 buffer underflows
test_0100: END
Test Result: Pass
-----------------------------------------------------------


ETH Stack Usage: 1856 bytes
Eth Application Completed

Back To Top


References

Sl No Specification Comment / Link
1 AUTOSAR 4.3.1 AUTOSAR Specification for Eth Driver Intranet Link
2 - Design Page (Eth Design Document)
3 - Eth User Guide (Eth & EthTrcv User Guide)

Back To Top


Document Revision History

Revision Date Author Description Status
0.1 14 Feb 2020 Badri S First version Pending Review
0.2 29 May 2020 Misael Lopez Updated for AUTOSAR 4.3.1 Approved
0.3 04 Nov 2020 Misael Lopez Updated for SDK 7.1 Approved