> For the complete documentation index, see [llms.txt](https://docs.cennso.com/components/fpp/latest/llms.txt) (all documentation: [llms.txt](https://docs.cennso.com/llms.txt)). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cennso.com/components/fpp/latest/deployment-guides/multinode-direct-nic.md).

# Deploy Fast Path Provider on multiple nodes using direct NIC assignment

This document describes the prerequisites and steps for a multi-node deployment of Fast Path Provider (FPP) using direct NIC assignment. This guide utilizes the **fpp-generic** composition.

For alternative configurations, please refer to the tutorials on [a SRIOV Networks](https://docs.cennso.com/components/fpp/latest/deployment-guides/multinode-sriov.md) and the [**AF_XDP** driver](https://docs.cennso.com/components/fpp/latest/deployment-guides/multinode-xdp.md).

## Prerequisites

- [Requirements](https://docs.cennso.com/components/fpp/latest/requirements.md)
- [VPP Operator deployed](https://docs.cennso.com/components/fpp/latest/deployment-guides/vppoperator-deployment.md)
- NIC firmware updated to the latest version [in the case of Intel e810 cards](#intel-e810-support) for direct NIC assignment in FPP node pod

Terminology used in the installation document:

- FPP node - FPP pod in the `node` mode, which acts as a virtual switch on each Data Plane node
- Uplink - network interface, virtual or physical, which is used by FPP node to communicate inside the cluster and create a VXLAN mesh to interconnect workload CNFs between nodes

### Supported NICs

The following Network Interface Cards are supported using this installation guide:

- **Intel E810**, vendor ID: **8086**, device ID: **1593**, model name: **E810-XXVDA4**

### Intel E810 support

Check [the Intel DDP package section](https://docs.cennso.com/components/fpp/latest/deployment-guides/data-plane-node-config.md#update-the-intel-ddp-package) of the Data Plane configuration guide for more details.

## Steps

1. **Identify the PCI IDs for the NICs** that will be assigned to the FPP node pods. To perform the initial NIC configuration, follow the steps outlined in the [Configure Direct NIC Access section](#configure-direct-nic-access).
1. **Create an FPPDeployment object** for a multi-node direct-NIC deployment and [configure basic options](#basic-configuration).
1. **Configure the init container** to use the identified PCI IDs by following the steps in the [init container configuration guide](#configure-init-container).
1. **Map the PCI IDs** to the `spec.directNICMappings` field in the FPPDeployment. For detailed instructions, see [Configure Direct NIC Access](#configure-direct-nic-access).
1. **Configure the uplink IP addresses** and external networks by following the instructions in the [Uplink IPs and External Networks](#configure-uplink-ips-and-external-networks) section.
1. **Verify the FPPDeployment status** to ensure it is [working correctly](#verification).

### Configuration example

This configuration example deploys FPP multi-node deployment using Direct NIC attachment.

```yaml
# Apply this on the Management Cluster
apiVersion: fpp.cennso.com/v1alpha1
kind: FPPDeployment
metadata:
  name: multi-node-direct-nic-fpp
  namespace: cennso-infra
spec:
  version: <version>
  connectionSecretRef:
    name: example-core-cluster
    namespace: cennso-infra

  repository: oci://registry.cennso.com/cennso/charts
  operatorName: node-op
  targetNamespace: fpp

  useHugepages: true
  resources:
    cpu: "2"
    memory: 4Gi
    hugepages-2Mi: 2Gi

  nodeSelector:
    node-role.cennso.net/worker: dataplane

  additionalInitContainers:
  - name: bind-vfio
    image: travelping/nettools:1.12.0
    command:
    - /bin/sh
    - -c
    - |
        if [ "$(basename $(readlink /sys/bus/pci/devices/0000:8a:00.1/driver))" != vfio-pci ]; then
          echo '8086 1593' >/sys/bus/pci/drivers/vfio-pci/new_id
          echo '0000:8a:00.1' > '/sys/bus/pci/devices/0000:8a:00.1/driver/unbind'
          echo '0000:8a:00.1' > /sys/bus/pci/drivers/vfio-pci/bind
          echo '0000:8a:00.3' > '/sys/bus/pci/devices/0000:8a:00.3/driver/unbind'
          echo '0000:8a:00.3' > /sys/bus/pci/drivers/vfio-pci/bind
        fi
    securityContext:
        privileged: true
    volumeMounts:
    - name: hostsys
      mountPath: /sys
    resources:
      limits:
        cpu: 100m
        memory: 100Mi
  additionalVolumes:
  - name: hostsys
    hostPath:
      path: /sys

  directNICMappings:
    nic:
    - "0000:8a:00.1"
    - "0000:8a:00.3"

  vppConfigs:
  - nodeName: wk-1234.dev.cennso.net
    spec:
      uplinkConfig:
        bondMode: LACP
        ips:
        - 10.0.40.1/24
        vlanId: 1000

      externalNetworkConfig:
      - ifacePrefix: uplink-bond
        bridgeDomain: 1
        vlanId: 1001
```

### Configuration options

#### Basic configuration

For basic FPPDeployment options, see [Single Node deployment guide](https://docs.cennso.com/components/fpp/latest/deployment-guides/single-node.md#basic-configuration-options).

For purpose of this guide, we will use NICs with PCI IDs:
- `0000:8a:00.1`
- `0000:8a:00.3`

#### Configure init container

The FPP node deployment utilizes **spec.additionalInitContainers** to define an init container that binds NICs to the `vfio-pci` driver. Since the binding is reapplied every time the FPP node pod restarts, this method is inherently reboot-safe. The following example demonstrates how to use **spec.additionalVolumes** to grant the container access to the host's `/sys` directory.

```yaml
additionalInitContainers:
- name: bind-vfio
  image: travelping/nettools:1.12.0
  command:
  - /bin/sh
  - -c
  - |
      if [ "$(basename $(readlink /sys/bus/pci/devices/0000:8a:00.1/driver))" != vfio-pci ]; then
        echo '8086 1593' >/sys/bus/pci/drivers/vfio-pci/new_id
        echo '0000:8a:00.1' > '/sys/bus/pci/devices/0000:8a:00.1/driver/unbind'
        echo '0000:8a:00.1' > /sys/bus/pci/drivers/vfio-pci/bind
        echo '0000:8a:00.3' > '/sys/bus/pci/devices/0000:8a:00.3/driver/unbind'
        echo '0000:8a:00.3' > /sys/bus/pci/drivers/vfio-pci/bind
      fi
  securityContext:
      privileged: true
  volumeMounts:
  - name: hostsys
    mountPath: /sys
  resources:
    limits:
      cpu: 100m
      memory: 100Mi
additionalVolumes:
- name: hostsys
  hostPath:
    path: /sys
```

#### Specify NIC mappings

Use **spec.directNICMappings** to map each interface name to its corresponding PCI ID:

```yaml
directNICMappings:
  uplink:
  - "0000:8a:00.1"
  - "0000:8a:00.3"
```

The keys define the NIC interface prefixes (to which an index is automatically appended), while the values consist of a list of PCI IDs. For example, the mapping above will generate the `uplink0` and `uplink1` network interfaces in VPP for use as uplinks.

#### Configure Uplink IPs and external networks

To assign an IP address to the FPP uplink interface, use the **spec.vppConfigs** setting in the FPPDeployment. Each per-node entry should specify the uplink interface's IP address and VLAN ID. Additionally, you can define external network interfaces by providing extra VLAN IDs. Refer to the example below:

```yaml
vppConfigs:
- nodeName: wk-1234.dev.cennso.net
  spec:
    uplinkConfig:
      bondMode: LACP
      ips:
      - 10.0.40.1/24
      vlanId: 1000

    externalNetworkConfig:
    - ifacePrefix: uplink-bond
      bridgeDomain: 1
      vlanId: 1001
```

Use **spec.uplinkConfig.ips** to assign IP addresses to the uplink interface. Additionally, **spec.uplinkConfig.vlanId** can be used to create a dedicated VLAN subinterface for the uplink.

Configure **spec.externalNetworkConfig.vlanId** to create a VLAN subinterface connected to an FPPNetwork with VXLAN ID `1`. This setup enables external connectivity for workloads associated with that FPPNetwork. Additionally, set **spec.externalNetworkConfig.ifacePrefix** to `uplink-bond`, which is the prefix automatically generated for bonded DPDK interfaces.

## NIC preparation

### Configure direct NIC access

The FPP node can use Physical Functions (PFs) as uplinks. This approach eliminates the need for an SR-IOV operator, allowing NIC PCI IDs to be passed directly within the FPP deployment.

To identify which network cards the FPP should use, run the following command on the dataplane node in the Core Cluster:

```bash
lshw -c network -businfo
```

Sample output:

```bash
Bus info          Device           Class          Description
=============================================================
pci@0000:51:00.0  eno1             network        Ethernet Controller 10G X550T
pci@0000:51:00.1  eno2             network        Ethernet Controller 10G X550T
pci@0000:8a:00.0  ens6f0           network        Ethernet Controller E810-C for SFP
pci@0000:8a:00.1  ens6f1           network        Ethernet Controller E810-C for SFP
pci@0000:8a:00.2  ens6f2           network        Ethernet Controller E810-C for SFP
pci@0000:8a:00.3  ens6f3           network        Ethernet Controller E810-C for SFP
```

In this example, the PCI IDs `8a:00.1` and `8a:00.3` are selected. When using PFs with VPP, you must utilize the `vfio-pci` driver.

Ensure that no Virtual Functions (VFs) are created on these NICs. If the SR-IOV Network Operator is active, any SriovNetworkNodePolicy Custom Resources associated with these NICs must be removed.

Below is an example of how to manually disable VFs on the machine:

```bash
echo 0 > /sys/class/net/ens6f1/device/sriov_numvfs
echo 0 > /sys/class/net/ens6f3/device/sriov_numvfs
```

Once the VFs are disabled, you must bind the NICs to the `vfio-pci` driver. This is typically handled by an init container within the FPP node deployment. Below is an example of the commands executed:

```bash
echo '8086 1593' >/sys/bus/pci/drivers/vfio-pci/new_id
echo '0000:8a:00.1' > '/sys/bus/pci/devices/0000:8a:00.1/driver/unbind'
echo '0000:8a:00.1' > /sys/bus/pci/drivers/vfio-pci/bind
echo '0000:8a:00.3' > '/sys/bus/pci/devices/0000:8a:00.3/driver/unbind'
echo '0000:8a:00.3' > /sys/bus/pci/drivers/vfio-pci/bind
```

In the configuration above, `8086 1593` represents the vendor and device ID of the NIC. You can retrieve this information for your specific hardware by running:

```bash
lspci -nn -s 8a:00.1
```

Sample output:

```bash
8a:00.1 Ethernet controller [0200]: Intel Corporation Ethernet Controller E810-C for SFP [8086:1593] (rev 02)
```

### NIC mappings

The FPPDeployment's **spec.directNICMappings** setting is translated into environmental variables in the FPP Node DaemonSet:

```yaml
- name: MAPPING_NIC
  value: uplink
- name: PCIDEVICE_NIC
  value: 0000:8a:00.1,0000:8a:00.3
```

The following DPDK interfaces are configured in `startup.conf`:

```sh
dpdk {

  dev 0000:8a:00.1 {
      name uplink0
      num-rx-queues 4
      num-tx-queues 4
      num-rx-desc 2048
      num-tx-desc 2048
  }

  dev 0000:8a:00.3 {
      name uplink1
      num-rx-queues 4
      num-tx-queues 4
      num-rx-desc 2048
      num-tx-desc 2048
  }
}
```

`uplink0` and `uplink1` can be used in **spec.vppConfigs** `beforeCommands` and `afterCommands` sections. VPP Operator creates these VPPInterface objects corresponding to these NICs to be used as uplinks or as external network interfaces according to the external network prefixes defined in **spec.vppConfigs** (interfaces not matching any interface name prefixes are used as uplinks).

## Verification

First, check if FPPDeployment was [setup correctly](https://docs.cennso.com/components/fpp/latest/deployment-guides/single-node.md#verification).

Next, you can verify whether a `VPPInterface` VLAN object with your desired **vlanId** was created on the Core Cluster and whether its status is ready.

Run the following command on the Core Cluster to do it:

```bash
kubectl get -n fpp vppinterfaces.fpp-manager.cennso.com nic-node-wk-1234.dev.cennso.net-uplink-bond-extnet-vlan -oyaml
```

As a response, you get a VPPInterface object. See the example:

```yaml
apiVersion: fpp-manager.cennso.com/v1alpha1
kind: VPPInterface
metadata:
   creationTimestamp: "2025-02-10T13:39:39Z"
   finalizers:
   - fpp-manager.cennso.com/vpp-interface-finalizer
   generation: 1
   labels:
      fpp-manager.cennso.com/created-for: node-op
      fpp-manager.cennso.com/plumbing-node: wk-1234.dev.cennso.net
      fpp-manager.cennso.com/plumbing-physifrole: vlan
      fpp-manager.cennso.com/plumbing-physiftype: extnet
      fpp-manager.cennso.com/slice: default
   name: nic-node-wk-1234.dev.cennso.net-uplink-bond-extnet-vlan
   namespace: fpp
   resourceVersion: "25120"
   uid: 66f64312-9e23-4265-b90a-91735a296e7a
spec:
   bridgeDomain: 1
   ifName: uplink-bond.1001
   type: extnet
   vlan:
      ID: 1001
      parentIfName: uplink-bond
status:
   memberCount: 0
   ready: true
   swIfIndex: 5
   vppName: uplink-bond.1001
```

You can also verify the interface creation by running the following command in the FPP node pods:

```bash
vppctl show interfaces
```

In the resulting list, look for your interface by its ID (as in **uplink-bond.{ID}**):

```
              Name               Idx    State  MTU (L3/IP4/IP6/MPLS)     Counter          Count
local0                            0     down          0/0/0/0
uplink-bond                       3      up          9000/0/0/0     rx packets                  5109
                                                                    rx bytes                  628353
                                                                    drops                       1028
                                                                    ip6                           23
uplink-bond.1000                  4      up          9000/0/0/0
uplink-bond.1001                  5      up           0/0/0/0
uplink0                           1      up          9000/0/0/0     rx packets                  3059
                                                                    rx bytes                  374219
                                                                    tx packets                    73
                                                                    tx bytes                    9052
                                                                    drops                       2042
uplink1                           2      up          9000/0/0/0     rx packets                  2050
                                                                    rx bytes                  254134
                                                                    tx packets                    77
                                                                    tx bytes                    9548
                                                                    drops                       2039
```
