The SmartNIC can be configured to modify source/destination IP addresses and source/destination layer 4 port numbers.
Modifying IP addresses and layer 4 port numbers
For network address translation (NAT) on uplink, the IPv4 source address and layer 4 source port can be overridden to a new IPv4 address and a new layer 4 port number. On downlink, the IPv4 destination address and layer 4 destination port can be overridden to a new IPv4 address and a new layer 4 port number.
NAT is enabled using the RTE_FLOW_ACTION_TYPE_MODIFY_FIELD action type. A
flow rule can be created to match on the received frames and modify the source and
destination IP addresses in the rte_flow_action_modify_data structure. The
following field IDs are supported to specify the IPv4 source and destination addresses.
- RTE_FLOW_FIELD_IPV4_SRC
- RTE_FLOW_FIELD_IPV4_DST
Note: RTE_FLOW_FIELD_IPV6_SRC and
RTE_FLOW_FIELD_IPV6_DST cannot be used as NAT on IPv6 is not
supported.