Sample Application

Note: This is sample development utility code and reference for development and must not be used in production.

802.1Qbu + 802.3br

IEEE 802.1 Qbu stops the transmission of long, non-critical frames to prioritize time-sensitive traffic, addressing the problem of transmission hogging. A major challenge for the timely transfer of critical messages is the presence of legacy traffic sharing the same network. Once a packet travels down a wire, it will block the wire from other packets until the end of the packet is reached.

To counter this issue, IEEE defined two standards- IEEE 802.1Qbu and IEEE802.3br, to support preemption. These standards, which build upon the TAS feature in 802.1Qbv, allow devices to preempt the transmission of non-TSN Ethernet frames (often legacy traffic) to prioritize high priority frames, while allowing the remainder of the interrupted frame to be sent later.

Syntax
nvethernet_sample <interface name> fpe <TC preemption mask> <RQ>
Parameters
  • TC preemption mask : preemption-bit corresponding to TC should have value 1 else express/default bit value 0.

  • RQ : Residual/default queue for unfiltered preemptable packets.This value can be any enabled Rx queue except rx queue 0.

Stats: ethtool -S <interface name>

  • mmc_tx_fpe_frag_cnt - Tx fragment count

  • mmc_tx_fpe_hold_req_cnt - Tx set-hold count

  • mmc_rx_packet_reass_err_cnt - Rx reassembly error

  • mmc_rx_packet_smd_err_cnt - Rx SMD error

  • mmc_rx_packet_asm_ok_cnt - Rx assembly ok

  • mmc_rx_fpe_fragment_cnt - Rx fragment count.

Note:
  • Rx Queue 0 can't be RQ

  • Please use nvethernet_sample <interface name> mmc_stats to get stats related to FPE

  • Use the primary interface i.e eqos_0, mgbe2_0, etc. for configuration

  • FPE and MACSEC don’t coexist incase of MGBE HW due to HW limitation.

  • FPE get configured when peer device supports FPE and responds to verify packet(SMD-V).

For example:
  • To set preemption for TC 1 and TC 2 - (bit value representation rep 0x6), and RQ 2:
    nvether_sample_app  <interface name> fpe 0x6 2
  • To disable TX preemption:
    nvether_sample_app  <interface name> fpe 0x0 2

802.1Qbv

Traffic scheduling allows for different traffic classes to coexist with competing priorities on the same network. IEEE 802.1Qbv and IEEE 802.1Qbu work together to help manage this coexistence. IEEE 802.1 Qbv and IEEE 802.1Qbu can prioritize different traffic classes and enable time-sensitive data.

Devices/systems with IEEE 802.1Qbv can prioritize TSN Ethernet frames on a schedule, while non-TSN Ethernet frames to be transmitted on a best-effort basis around the TSN frames. The 802.1Qbv standard defines up to eight queues per port for forwarding traffic where each frame is assigned to a queue based on a QoS priority. To control the flow of queued traffic to a TSN enabled switch, this standard defines a time-aware shaper (TAS) mechanism that moderates queue traffic, preventing delays during scheduled transmission. Put simply, a gate in front of each queue opens at a specific point in time for time-sensitive traffic over standard (non-TSN) Ethernet packets. PTP should be initialized to make TSN working on DUT.

Syntax
nvether_sample_app  <interface name> est <enable/disable> <base-time> <base-time offset>
 <cycle time> <number of GCL entry> <GCL-entries>
Parameters
    • enable - 1 and disable - 0

    • base-time <nsec> <sec> put 0 0 if not sure - Value in decimal. If both values are 0 Driver will get PTP current time from MAC HW registers and add the base time offset into it.

    • base-time offset <nsec> <sec> - Value decimal. This offset is given to start a new GCL from base time value + offset.

    • cycle time <nsec> <sec> - Value in HEX. - ONE GCL full cycle time.

    • number of GCL entry max index 255 - value in decimal

    • GCL entries:
      • [0x<8 bit gate mask> <24 bit interval - value in ns>]

      • [0x<8 bit gate mask> <24 bit interval - value in ns>]

      • :

      • :

      • [0x<8 bit gate mask> <24 bit interval in ns>]

Note:
  • When EST and FPE are enabled, bit 0 of the gate mask represents set-and-hold. In this case preemption is enabled for TC 0.

  • When only EST is enabled, all bits of the gate mask represent open-and-close. In this case all TC are expressed TC.

  • Disable Tx flow control from device tree.

  • Use the primary interface i.e eqos_0, mgbe2_0, etc. for configuration.

Stats: ethtool -S <interface name>
  • const_gate_ctr_err - CGCE error count

  • head_of_line_blk_sch - Head of line block due to scheduling count

  • hlbs_q[0] - Head of line block due to scheduling count for TC 0

  • hlbs_q[1] - Head of line block due to scheduling count for TC 1

  • hlbs_q[2] - Head of line block due to scheduling count for TC 2

  • hlbs_q[3] - Head of line block due to scheduling count for TC 3

  • Hlbs_q[4] - Head of line block due to scheduling count for TC 4

  • hlbs_q[5] - Head of line block due to scheduling count for TC 5

  • hlbs_q[6] - Head of line block due to scheduling count for TC 6

  • hlbs_q[7] - Head of line block due to scheduling count for TC 7

  • head_of_line_blk_frm - Head of line block due to size count

  • hlbf_q[0] - Head of line block due to size count for TC0

  • hlbf_q[1] - Head of line block due to size count for TC1

  • hlbf_q[2] - Head of line block due to size count for TC2

  • hlbf_q[3] - Head of line block due to size count for TC3

  • hlbf_q[4] - Head of line block due to size count for TC4

  • hlbf_q[5] - Head of line block due to size count for TC5

  • hlbf_q[6] - Head of line block due to size count for TC6

  • hlbf_q[7] - Head of line block due to size count for TC7

  • base_time_reg_err - Base time wrongly programmed in the past.

  • sw_own_list_complete - GCL switch happens successfully. This will increase this counter by 1.

For example:
  • Enable EST with cycle time 16,777,685 ns, 2 GCL entries where in 1st entry for TC0 open for 470 ns and in 2nd entry no gate open for 16,777,685 ns.
    nvether_sample_app  eth1 est 1 0 0 0 10 0x10001d5 0 2 0x10001d6 0xffffff
  • Example for FPE and EST enable with set-and-hold feature:
    • Configure FPE as mentioned in 802.1Qbu + 802.3br

    • Configure EST with set-and-hold feature like for case “Enable EST with cycle time 16,777,685 ns, 2 GCL entries where in 1st entry for TC0 open for 470 ns with set-and-hold bit set and in 2nd entry no gate open for 16,777,215 ns”
      nvether_sample_app  eth1 est 1 0 0 0 10 0x10001d5 0 2 0x30001d6 0xfffff

To check whether the new GCL is activated

As GCL configuration and GCL activation are 2 different things, please note programmed GCL gets activated based on Base time programmed. Please check results of ethtool -S <interface name> to check sw_own_list_complete value updated from last value or any error counter increased.

802.1Qav (CBS)

Originally developed to meet the bandwidth requirements of audio/video streams while preserving bandwidth for best effort traffic, IEEE 802.1Qav, known as Forwarding and Queueing for Time-Sensitive Streams (FQTSS) and later integrated into 802.1Q, defines a credit-based traffic shaper for reserving bandwidth for A/V streams in a bridged network.

In bridges, reserved A/V stream traffic is prioritized over best effort traffic as long as sufficient credits are available to transmit the higher-priority A/V data. As with end stations sourcing stream data, the credit-based traffic shaper results in stream data distributed evenly across a bridged network over time.

Syntax

nvether_sample_app  <interface name> avb <qinx> <algorithm_value> <bw> <credit_control> <tcinx>
Parameters
  • qinx : Tx Queue index

  • algorithm value
    • 0 - default (strict priority for EQOS, ETS for MGBE)

    • 1 - cbs (credit based shaper)

  • bw : value in Mbits/sec of bw to be allocated

  • credit_control
    • 0 - disabled credit_control. The credit accumulates even when there is no packet waiting in TC<n> and another TC is transmitting.

    • 1 - enabled credit_control. When there is no packet waiting in TC<n> and other TC is transmitting, no credit is accumulated.

    • tcinx : TC mapping for <qinx>
Note:
  • credit_control is applicable for cbs only. CBS configuration is per TC.

  • Use the primary interface i.e., eqos_0, mgbe2_0 etc. for configuration.

For example:
  • Give 20% bandwidth to TxQ/TC 2:
    nvether_sample_app <interface name> avb 2 1 20 1 2
  • Reset to default tx selection algorithm for TxQ/TC 2:
    nvether_sample_app <interface name> avb 2 0 20 1 2

VLAN (802.1Q)

In Linux, to create VLAN and MAP, the ingress and/or egress priority to SKB priority following Linux standard tools/utilities can be used. Example commands are:
ip link add link eth0 name eth0.5 type vlan id 5
ip addr add 10.0.1.6/24 brd 10.0.1.255 dev eth0.5
ip link set dev eth0.5 up

ip link add link eth0 name eth0.5 type vlan id 5 egress 0:1 1:2 4:4

In the last command above, the internal skb prio 0 is mapped to VLAN prio 1, skb prio 1 to VLAN prio 2 and 4 to 4.

You can also use the built in application vconfig:
vconfig set_egress_map [vlan-name] [skb_priority] [vlan_qos]

PTP (802.1AS) : 2 Step PTP

Nodes in the TSN network communicate with each other in real time and need a shared understanding of time to agree on corrective actions, recognize each other’s state, and cooperate together.

The IEEE 802.1AS project created a profile of the IEEE 1588 PTP synchronization protocol for TSN. This profile will enable clock synchronization compatibility between different TSN devices. 802.1AS also addresses support for fault tolerance and multiple active synchronization masters.

Multiple profiles are supported.