When SmartNICs are used in the inline mode, TX port can be configured either by an NTPL expression or by an application. This article describes how to configure TX port using NTPL.
In the 3GA inline mode, the following NTPL configuration enables receiving packets on one RX port and transmitting them on another TX port without running any application, if Profile in ntservce.ini is set to Inline.
Assign[StreamId=0; TxPort=1] = Port == 0
Assign[StreamId=0; TxPort=0] = Port == 1
In 4GA, it can be done by the following NTPL configuration. In addition, NT_NetRxRelease() must be called in an app for RX packets to be transmitted on the specified TX port.
Setup[TxDescriptor=NT; TxPorts=(0..1); TxPortPos=112] = StreamId == 0
Assign[StreamId=0; Descriptor=NT; TxPort=1] = Port == 0
Assign[StreamId=0; Descriptor=NT; TxPort=0] = Port == 1
In the above NTPL example, TxPortPos=112 indicates the TxPort field location in NT descriptor.
If the descriptor is Dyn3, TxPortPos=28 should be used, which is the color_lo field in Dyn3. The TX port configuration will be done in the field from bit 28 of Dyn3. Please see the following NTPL example.
Setup[TxDescriptor=Dyn; TxPorts=(0..1); TxPortPos=28] = StreamId == 0
Assign[StreamId=0; Descriptor=Dyn3; Color=1] = Port == 0
Assign[StreamId=0; Descriptor=Dyn3; Color=0] = Port == 1
After NTPL is applied, It is possible to test the above use case using the capture tool.
Note: The TxDescriptor value in the Setup command must match Descriptor in the Assign command.
If Descriptor in the Assign command is specified, the PacketDescriptor value in ntservice.ini will not be applicable to RX packets in the corresponding stream, i.e. the specified descriptor in the Assign command will be used.
If Descriptor in the Assign command is not specified, the RX descriptor will be the specified descriptor in ntservice.ini. Please also note that Ext9 descriptor is not supported in the inline mode.
Note: The txPort field selects which port to transmit the packet on. In the NT descriptor (where the txPort field is 5-bits), you can specify an inline port number from 0 - 31. Using Dyn descriptors in the inline mode, you must reserve some of the color bits to use as a "txPort" field. The number of bits to reserve depend on the highest port number, which you would like to transmit on. If you for example would like to transmit on ports 0-3, you would need 2 bits in the color field. Port 0-7 requires 3 bits and so on. The user application is free to change the port number, before releasing the packet so it has full control of which port the packets get transmitted to.