> For the complete documentation index, see [llms.txt](https://docs.cennso.com/components/fpp/3.2/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/3.2/troubleshooting/sriov.md).

# SRIOV deployment troubleshooting

While deploying SRIOV, you may encounter some issues. The most common ones are explained in this document.

## Uplink interface missing in fpp-manager

If there are no uplink interfaces present in the VPPSwitch pod, access the pod and execute:

```bash
vppctl -s /run/vppswitch/cli.sock show logging
```

Search for output like the following:

```sh
2021/11/29 10:24:43:099 notice     dpdk           EAL:   Invalid NUMA socket, default to 0
2021/11/29 10:24:43:099 notice     dpdk           EAL:   0000:03:10.6 VFIO group is not viable! Not all devices in IOMMU group bound to VFIO or unbound
2021/11/29 10:24:43:099 notice     dpdk           EAL: Requested device 0000:03:10.6 cannot be used
2021/11/29 10:24:43:099 notice     dpdk           EAL:   Invalid NUMA socket, default to 0
2021/11/29 10:24:43:099 notice     dpdk           EAL:   0000:05:10.4 VFIO group is not viable! Not all devices in IOMMU group bound to VFIO or unbound
2021/11/29 10:24:43:099 notice     dpdk           EAL: Requested device 0000:05:10.4 cannot be used
```

If the above output is present in VPP logs, enable IOMMU grouping if the node is able to use it, or configure the no-IOMMU mode for the VFIO kernel module described below.

## Configuration for VFIO-no-IOMMU platform

When a worker node does not support IOMMU, you can run VPPSwitch by disabling IOMMU. Make sure that the following boot options are **not set** in `/proc/cmdline`:

```sh
iommu=pt intel_iommu=on pci=realloc pci=assign-busses
```

In the case of a platform that does not support IOMMU, DPDK driver can pick up NIC (PF/VF) only after you enable the unsafe no-IOMMU mode:

```sh
echo 1 > /sys/module/vfio/parameters/enable_unsafe_noiommu_mode
```

You must apply the above setting after each node restart.

To check if the kernel supports no-IOMMU module, run:

```sh
cat /boot/config-$(uname -r) | grep NOIOMMU
```

The output confirms that the no-IOMMU module is supported:

```
CONFIG_VFIO_NOIOMMU=y
```

## SRIOV VF MAC conflict

When using SRIOV VF as the FPP uplink, VPP inside the container sets the MAC address generated for the DPDK interface. SRIOV driver on the NIC side sets the VF MAC address after creating the VF. Overriding it inside the container by VPP results in a warning message in `dmesg`:

   ```sh
   [23544.190430] i40e 0000:06:00.2: MAC addr e2:0d:d2:15:f5:78 has been set by PF, cannot delete it for VF 8, reset VF to change MAC addr
   [23544.190468] i40e 0000:06:00.2: VF 8 failed opcode 11, retval: -5
   ```

The following kernel and driver versions are known not to work:

- kernels: `5.4.0-131-generic`, `5.4.0-148-generic`
- Intel NIC driver i40e in version `2.8.20-k`

Setting different MAC addresses on a node and in VPP may sometimes result in connectivity issues.

As a workaround, set the MAC address of a node to `00:00:00:00:00:00` on the VF that would be used for the FPP uplink. Sample bash command:

   ```bash
   for nic in ${NIC_LIST}; do
      for vf in $(ip link show dev "${nic}" | grep 'vf ' | awk '{print $2}'); do
         ip link set "${nic}" vf "${vf}" mac 00:00:00:00:00:00
      done
   done
   ```

Set the `$NIC_LIST` variable to the name of the network interface for which the VFs are created.

This action should be done by the cluster operator during the maintenance window, because setting the MAC address interrupts the network connectivity on the VF used in FPP. After you reset the MAC, FPP must be restarted.

MAC address can be set also in the `NetworkAttachmentDefinition`. This requires defining SRIOV NADs used for uplinks by hand on the Core Cluster, for example:

```yaml
apiVersion: k8s.cni.cncf.io/v1
kind: NetworkAttachmentDefinition
metadata:
  annotations:
    k8s.v1.cni.cncf.io/resourceName: openshift.io/uplink0_vfio
  name: uplink0
  namespace: fpp
spec:
  config: |
  '{
      "cniVersion":"0.3.1",
      "name":"uplink0",
      "type":"sriov",
      "mac":"00:00:00:00:00:00",
      "vlan":0,
      "spoofchk":"off",
      "trust":"on",
      "vlanQoS":0,
      "capabilities":{"ips": true, "mac": true },
      "ipam":{"range":"10.35.38.0/24","type":"whereabouts"}
   }'
---
apiVersion: k8s.cni.cncf.io/v1
kind: NetworkAttachmentDefinition
metadata:
  annotations:
    k8s.v1.cni.cncf.io/resourceName: openshift.io/uplink1_vfio
  name: uplink1
  namespace: fpp
spec:
  config: |
  '{
      "cniVersion":"0.3.1",
      "name":"uplink1",
      "type":"sriov",
      "mac":"00:00:00:00:00:00",
      "vlan":0,
      "spoofchk":"off",
      "trust":"on",
      "vlanQoS":0,
      "capabilities":{"ips": true, "mac": true },
      "ipam":{}
   }'
```

This approach enables automatic MAC reset done by SRIOV-CNI on VFs assigned by SRIOV operator to the FPP pod. It requires the FPP definition to be adjusted to use new NADs and after VPPDeployment modification, FPP pods are restarted. This approach does not affect other workloads using the VFs.
