P_LOOPBACK

code: 122

# set
<module-index>/<port-index> P_LOOPBACK <mode>

# get
<module-index>/<port-index> P_LOOPBACK ?

Description

The loopback mode for a port. Ports can be configured to perform two different kinds of loopback:

  1. Off: Traffic flows naturally out of the port (illustrated in Fig. 3.2)

  2. External RX-to-TX loopback (illustrated in Fig. 3.4), where the received packets are re-transmitted immediately. The packets are still processed by the receive logic, and can be captured and analyzed.

  • L1 RX-to-TX: Any received packet is bounced back through TX

  • L2 RX-to-TX: Same as L1 RX-to-TX yet it also swaps SRC MAC address with DST MAC address

  • L3 RX-to-TX: Same as L1 RX-to-TX yet it also swaps SRC IP address with DST IP address

  1. Internal TX-to-RX loopback (illustrated in Fig. 3.3), where the transmitted packets are received directly by the port itself. This is mainly useful for testing the generated traffic patterns before actual use.

  • TX(on)-to-RX: Packet goes out of TX but also internally direct to RX

  • TX(off)-to-TX: Packet goes directly to RX (No link sync needed)

  1. Port-to-port: Any received packet goes out through the neighbor port (illustrated in Fig. 3.5)

Actions

set, get

Parameters

  1. mode: byte, the loop back mode of the port

  • NONE = 0

  • L1RX2TX = 1

  • L2RX2TX = 2

  • L3RX2TX = 3

  • TXON2RX = 4

  • TXOFF2RX = 5

  • PORT2PORT = 6

Example

# set
input:  0/1 P_LOOPBACK NONE
output: <OK>

# get
input:  0/1 P_LOOPBACK ?
output: 0/1 P_LOOPBACK NONE

Illustrations

../../../../_images/loopback_normal.png

Fig. 3.2 Loopback Mode - Normal

../../../../_images/loopback_txrx.png

Fig. 3.3 Loopback Mode - TX-to-RX

../../../../_images/loopback_rxtx.png

Fig. 3.4 Loopback Mode - RX-to-TX

../../../../_images/loopback_port2port.png

Fig. 3.5 Loopback Mode - Port-to-Port