2. Ethernet Operation Guide

2.1. Operation Example

The Ethernet module is built-in in the kernel by default, and there is no need to perform additional insmod operation.

The operation steps of using ethernet port under kernel are as follows :

  • Configure ip address and netmask

    ifconfig eth0 xxx.xxx.xxx.xxx netmask xxx.xxx.xxx.xxx up
    
  • Set default gateway

    route add default gw xxx.xxx.xxx.xxx
    
  • Mount nfs

    mount -t nfs -o nolock xxx.xxx.xxx.xxx:/your/path /mount-dir
    
  • Using tftp to upload and download files in shell

    Be sure that there is tftp service software running on the server side

    − download document: tftp –g -r [remote file name] [server ip]

    Note: remote file name is the name of the file to be downloaded, and server IP is the IP address of the server where the file download from (ex: tftp -g -r test.txt 192.168.0.11)

    − upload document: tftp –p -l [local file name] [server ip]

    Note: local file name is the name of the file to be uploaded locally, and server IP is the IP address of the target server where to upload (ex: tftp -l -p test.txt 192.168.0.11)

    Note: cv180x/cv181x Ethernet module don’t support TSO function.

    Note: The nfs tool will not be built into the file system by default. The user needs to add the tool by themselves when necessary.

2.2. IPv6 Description

The IPv6 functionality is disabled by default in the SDK package. To enable IPv6, kernel options need to be modified. The specific steps are as follows:

  1. Cv180x series

Modify

build/boards/cv180x/{board_name}/linux/cvitek_{board_name}_defconfig

Ex: build/boards/cv180x/cv1801c_wevb_0009a_spinor/linux/

cvitek_cv1801c_wevb_0009a_spinor_defconfig add or modify to CONFIG_IPV6=y. Then recompile the kernel software.

  1. Cv181x series

Modify

build/boards/cv181x/{board_name}/linux/cvitek_{board_name}_defconfig

Ex: build/boards/cv181x/ cv1811c_wevb_0006a_spinor/linux/

cvitek_cv1811c_wevb_0006a_spinor_defconfig add or modify to CONFIG_IPV6=y. Then recompile the kernel software.

The method for configuring an IPv6 environment is as follows:

  • To configure an IPv6 address and gateway, use the following command:

    #ip -6 addr add <IPv6 address>/IPv6 prefixlen dev <port name>

    Ex: ip -6 addr add 2020:abc:102::8888/24 dev eth0

  • IPv6 address specified by Ping

    #ping -6 <ipv6 address>

    Ex: ping -6 2020:abc:102::6666

2.3. IEEE 802.3x Flow Control Function

2.3.1. Flow Control Function Description

CV180x/CV181x Ethernet supports the flow control function defined by IEEE 802.3x. It achieves the purpose of flow control by sending flow control frames and receiving the flow control frames sent by the opposite end.

  • Send flow control frame:

    In the process of receiving the packets sent by the opposite site, if it is found that the current receiving queue of the receiving site may not be able to receive the subsequent packets, the local site will send the flow control frame to the opposite site, requiring the opposite site to suspend sending packets for a period of time, so as to control the flow.

  • Receive flow control frame:

    When the local site receives the flow control frame sent by the opposite site, the local site will delay sending packets to the opposite site according to the flow control time description within the frame, and then start sending after the flow control delay time. If the flow control frame sent by the opposite site is received in the waiting process and the flow control time described is 0, the transmission will be started directly.

2.3.2. Flow Control Function Configuration

The function of receiving flow control frame is off by default, and no software interface configuration is provided.

Send flow control frame function related configuration file in linux/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

static int flow_ctrl = FLOW_OFF;
module_param(flow_ctrl, int, 0644);
MODULE_PARM_DESC(flow_ctrl, "Flow control ability [on/off]");

static int pause = PAUSE_TIME;
module_param(pause, int, 0644);
MODULE_PARM_DESC(pause, "Flow Control Pause Time");

To enable the flow control function by default, you can modify the flow_ctrl = FLOW_AUTO.

If you want to modify the default pause time, you can configure “pause” to the target time.

2.3.3. Ethtool Configuration Interface Flow Control Function

Users can enable the flow control function through the standard ethtool tool interface.

ethtool – a eth0 command to view the flow control function status of eth0 port; the print is as follows

# ethtool -a eth0
Pause parameters for eth0:
Autonegotiate: on
RX: off
TX: off

Among them, RX flow control is off, TX flow control is off; the user can open or close TX flow control through the following command:

# ethtool -A eth0 tx off(turn off TX flow control)
# ethtool -A eth0 tx on(turn on TX flow control)

Note: The ethtool will not be built into the file system by default. The user needs to add the tool by themselves when necessary.