VPPInterface CR
VPPInterface Custom Resource (CR) is applied on the Core Cluster and can be created manually, by the FPP-CNI or by the VPP switch pod, the latter being used for VXLAN meshing.
The name of the VPP interface is generated by VPP itself by default, e.g. memif1/100. If spec.ifName is set, that value is used instead of the name of the interface. The special case is the spec.ifName beginning with a dash (-). In this case, spec.ifName is updated using its value as a suffix for the VPP device name, so that -mydev as spec.ifName becomes memif1/100-mydev, and this name is also used as the VPP interface name. This suffix mechanism is used by FPP-CNI on the VPP switch pod side to provide meaningful names for the network interfaces corresponding to pods. There are several types of VPPInterface resources supported.
VPPInterface: uplink/bond
This corresponds to VFs or NICs that VPP switch pod owns, e.g. DPDK interfaces. DPDK interfaces are available upon startup in VPP, so no extra NIC details are specified there. The ifName must match the name of the interface that is created upon VPP startup. The name itseft is based on MAPPING_... environment variable value.
Caution
Uplinks are generated automatically by VPP Operator. Manual modification are overriden.
It's also possible to bond the uplink interfaces. If, for example, there are several uplinks configured like this:
they can be bonded together in a single uplink like this:
You can find more about bonding in the dedicated section.
VPPInterface: loopback
The loopback interface is useful when a VPP instance must create a local interface. One of the possible use cases is to expose a network gateway on the FPP node. This incorporates a CGW use case on FPP daemonset. You must specify on which node to create the gateway. Regular properties of a VPP interface can be defined as well: VPP interface name (ifName), IPs, MTU, routing table to use, FPPNetwork, or bridge domain to connect to.
If the MAC address is not specified, it is generated to be unique. The loopback interface is set as a Bridge Virtual Interface (BVI) to be able to respond to the ping.
VPPInterface: external network
When VPPConfig has the spec.externalNetworkConfig section specified, each physical interface that matches the interface name prefix will be configured as an external network after FPP instance is setup by VPP Operator. External interfaces are marked with VPPInterface.Spec attribute Type set to extnet. The name of the VPPInterface object is constructed using the node name, externalNetworkConfig.Name and a number: <node-name>-<ext-net-name>-<id>.
When the type is not set, the VPPInterface object is considered to be an uplink interface.
It's also possible to create a bond interface consisting of external interfaces. Prefix name defined in the externalNetworkConfig.name needs to match multiple physical interfaces mappings in FPP pod's MAPPING_... environment variable value.
VPPInterface: VXLAN endpoint
This corresponds to a VXLAN tunnel endpoint. The endpoints are created internally by the VPP switch instances based on VPPInterface objects corresponding to uplinks, and VXLAN objects, so, most of the time, you don't need to create any vxlanTunnel type objects by hand, and they're reserved for possible special cases.
VPPInterface: GRE tunnel
This corresponds to a GRE tunnel endpoint. FPP supports only L3 GRE tunnels at the moment. Another GRE tunnel endpoint is expected to be present at the destIP, not necessarily provided by FPP. The sourceIP must correspond to an address of an interface belonging to this VPP instance. The traffic destined for the GRE interface will be encapsulated and sent from sourceIP towards the destIP using GRE datagrams. Conversely, the traffic arriving at sourceIP from the destIP will be decapsulated. It's possible to use another table ID for the encapsulated traffic by specifying encapVRFID inside the greTunnel section of the spec. GRE tunnel may have a key configured like it's defined in RFC 2890. If present, should match similar configuration parameters on another GRE tunnel endpoint.
Note
You cannot set spec.ifName for the GRE interface to values like gre0 or gre1 because of possible collision with the internal VPP interface name.
VPPInterface: memif
Memifs are used to attach FPP pods or other tools that use memifs, such as Cisco TRexOpens in a new tab to VPP switch FPP pod. A pair of memif VPPInterface objects is created by FPP-CNI for each such network attachment.
Note that many of the fpp-manager.cennso.com/... labels below are used internally by FPP CNI which has generated the VPPInterface objects below.
Master memif:
Slave (client) memif. ifName is set to the name of NetworkAttachmentDefinition below. It is used as the VPP interface name in the VPP app:
Sample NetworkAttachmentDefinition with the CNI config from which FPP-CNI has derived the above VPPInterface:
The following additional tunable settings are available for memifs in the CNI config:
- numRxQueues (goes into spec.memif.numRxQueues on the slave memif interfaces): number of RX queues, defaults to
1 - numTxQueues (goes into spec.memif.numTxQueues on the slave memif interfaces): number of TX queues, defaults to
1 - memifRingSize (goes into spec.memif.ringSize): number of entries of the RX and TX rings, defaults to
4096 - memifBufferSize (goes into spec.memif.bufferSize): size of the buffer for each ring entry, defaults to
2048 - txPlacement (goes into spec.txPlacement on the master memif interfaces): TX queue placement on the VPP switch pod side
- clientTxPlacement (goes into spec.txPlacement on the slave memif interfaces): TX queue placement on the client side
Both placements have one comma-separated list of VPP thread indices for each TX queue on their side. txPlacement contains thread indices of the VPP switch pod, and clientTxPlacement contains thread indices of the client. Each TX queue of the VPP switch pod is an RX queue of the client, so txPlacement has numRxQueues lists. clientTxPlacement has numTxQueues lists. On both sides, thread 0 is the VPP main thread, and threads 1 and higher are the worker threads. On a VPP instance without worker threads, use "0" for every queue.
Important
In txPlacement, put every thread of the VPP switch pod in at least one list. In clientTxPlacement, put every thread of the client in at least one list. This rule includes thread 0, the VPP main thread. By convention, add thread 0 to the list of queue 0, for example "0,1". If a thread is in no list, VPP discards the packets that this thread sends on the interface. For thread 0, these packets include Address Resolution Protocol (ARP) and IPv6 neighbor discovery requests. VPP counts the discarded packets in the no tx queue available error counter. To see the counter, run vppctl show error.
VPPInterface: memif without CNI
A newer way to connect a memif-based workload to VPP L2 switch was developed to omit the use of CNI. The user creates just the client (slave) interface, and VPP Operator creates a matching ephemeral master memif. Ephemeral means that the VPPInterface CR is not actually stored in the Kubernetes API Server.
The VPPInterface has to have:
plumbing-instancelabelattachToNetworkparameter which must be a valid FPPNetwork- Role
slave - IP address/mask
To configure the TX queue placement of the master memif, set serverTxPlacement in the VPPInterface object of the slave memif. Both txPlacement and serverTxPlacement have one comma-separated list of VPP thread indices for each TX queue on their side. txPlacement contains thread indices of the client, and serverTxPlacement contains thread indices of the VPP switch pod.
Important
In txPlacement, put every thread of the client in at least one list. In serverTxPlacement, put every thread of the VPP switch pod in at least one list. This rule includes thread 0, the VPP main thread. By convention, add thread 0 to the list of queue 0. If a thread is in no list, VPP discards the packets that this thread sends on the interface.
If the targeted instance of UPG is v2.x, an additional fpp-manager.cennso.com/legacy-instance=true label is required.
Automatic queue negotiation
For CNI-less memif interfaces, you can enable automatic queue negotiation using the fpp-manager.cennso.com/perf-hint: fast annotation on the slave memif interface. When enabled, the operator automatically:
- Detects the number of worker threads on both master and slave VPP instances
- Calculates optimal TX/RX queue counts based on the worker counts
- Sets the queue placements on both sides of the memif connection
The queue negotiation algorithm aims to:
- Assign each TX queue to one worker thread, so that worker threads do not share TX queues.
- Add the main thread (thread 0) to TX queue 0, so that VPP does not discard packets from the main thread.
- Distribute RX queues evenly across worker threads.
Caution
If the two worker counts have no common factor, the memif gets 2 × N × M queues in total, for N and M worker threads. For example, four and five worker threads give 40 queues. More queues use more memory.
Example:
When queue negotiation is active, the operator adds these annotations automatically:
fpp-manager.cennso.com/master-worker-count- Number of worker threads on master VPPfpp-manager.cennso.com/slave-worker-count- Number of worker threads on slave VPP
The interface sync will wait until both worker counts are detected before creating the memif interface, ensuring proper queue configuration from the start.
The operator writes the calculated values into the VPPInterface object of the slave memif. On a side without worker threads, the operator assigns every TX queue to thread 0. For example, with two worker threads on the master side and three on the slave side, the operator writes the following values:
In both placements, thread 0 and thread 1 share queue 0. Each of the other queues has one worker thread.
VPPInterface: tap
VPPInterface of type tap is used to connect pods that use Linux networking to the VPP switch pod. Note that in the example below, the IP address information is not included as it's handled by the CNI plugin itself in this case.
Below is the sample NetworkAttachmentDefinition with the CNI config from which FPP-CNI has derived the above VPPInterface.
It is also possible to specify multiple IP addresses for an interface:
The following additional tunable settings are available for taps in the CNI config:
numRxQueues(goes intospec.tap.numRxQueues): number of rx queues, defaults to 1tapRxRingSize(goes intospec.tap.txRingSize) - the number of entries of TX ring, defaults to 4096tapTxRingSize(goes intospec.tap.txRingSize) - the number of entries of RX ring, defaults to 4096
VPPInterface: VLAN
VPPInterface of the VLAN type is used to create a sub-interface that processes packets with the 802.1q VLAN ID tag attached.
Creating this sub-interface requires another interface on the same VPP that serves as a parent.
Every VPPInterface of the VLAN type corresponds with one sub-interface.
Due to limitations in VPP, the ifName parameter always changes to <parentIfName>.<VLAN ID>.
See the example of the VPPInterface of the VLAN type:
VPPInterface: IPsec tunnel
Important
IPsec support is an alpha feature and is not suitable for production deployments.
A VPPInterface with spec.ipsecTunnel set creates a VPP IPsec tunnel interface for route-based IPsec.
The charon VPPTool attaches the Security Associations of a CHILD_SA to the interface whose spec.ipsecTunnel.instance equals the if_id of the CHILD_SA.
Routes through the interface select which traffic goes into the tunnel.
The spec.ipsecTunnel.instance parameter is required and must be from 1 to 16383.
If more than one VPPInterface requests the same instance in one VPP instance, the oldest one uses it.
The others stay not ready and get a Warning event.
When you delete the interface, VPP removes its tunnel protection, but the Security Associations stay, because charon owns them.
The following example creates an IPsec tunnel interface with instance 1:
See Set up IPsec for the full configuration.