Using virtual functions (VFs) with DPDK and RDMA modes
Prerequisites
Install the OpenShift CLI ().
Install the SR-IOV Network Operator.
Log in as a user with
cluster-admin
privileges.
Procedure
Create the following
SriovNetworkNodePolicy
object, and then save the YAML in theintel-dpdk-node-policy.yaml
file.1 Specify the driver type for the virtual functions to vfio-pci
.See the
Configuring SR-IOV network devices
section for a detailed explanation on each option inSriovNetworkNodePolicy
.When applying the configuration specified in a
SriovNetworkNodePolicy
object, the SR-IOV Operator may drain the nodes, and in some cases, reboot nodes. It may take several minutes for a configuration change to apply. Ensure that there are enough available nodes in your cluster to handle the evicted workload beforehand.After the configuration update is applied, all the pods in
openshift-sriov-network-operator
namespace will change to aRunning
status.Create the
SriovNetworkNodePolicy
object by running the following command:$ oc create -f intel-dpdk-node-policy.yaml
Create the following
SriovNetwork
object, and then save the YAML in theintel-dpdk-network.yaml
file.apiVersion: sriovnetwork.openshift.io/v1
kind: SriovNetwork
metadata:
name: intel-dpdk-network
namespace: openshift-sriov-network-operator
spec:
networkNamespace: <target_namespace>
ipam: "{}" (1)
vlan: <vlan>
resourceName: intelnics
1 Specify an empty object “{}”
for the ipam CNI plug-in. DPDK works in userspace mode and does not require an IP address.See the “Configuring SR-IOV additional network” section for a detailed explanation on each option in
SriovNetwork
.Create the
SriovNetwork
object by running the following command:$ oc create -f intel-dpdk-network.yaml
-
apiVersion: v1
kind: Pod
metadata:
name: dpdk-app
namespace: <target_namespace> (1)
annotations:
k8s.v1.cni.cncf.io/networks: intel-dpdk-network
spec:
containers:
- name: testpmd
image: <DPDK_image> (2)
securityContext:
runAsUser: 0
capabilities:
add: ["IPC_LOCK","SYS_RESOURCE","NET_RAW"] (3)
volumeMounts:
- mountPath: /dev/hugepages (4)
name: hugepage
resources:
limits:
openshift.io/intelnics: "1" (5)
memory: "1Gi"
cpu: "4" (6)
hugepages-1Gi: "4Gi" (7)
requests:
openshift.io/intelnics: "1"
memory: "1Gi"
cpu: "4"
hugepages-1Gi: "4Gi"
command: ["sleep", "infinity"]
volumes:
- name: hugepage
emptyDir:
Create the DPDK pod by running the following command:
$ oc create -f intel-dpdk-pod.yaml
Prerequisites
Install the OpenShift CLI (
oc
).Install the SR-IOV Network Operator.
Log in as a user with
cluster-admin
privileges.
Procedure
Create the following
SriovNetworkNodePolicy
object, and then save the YAML in themlx-dpdk-node-policy.yaml
file.1 Specify the device hex code of the SR-IOV network device. The only allowed values for Mellanox cards are 1015
,1017
.2 Specify the driver type for the virtual functions to netdevice
. Mellanox SR-IOV VF can work in DPDK mode without using thevfio-pci
device type. VF device appears as a kernel network interface inside a container.3 Enable RDMA mode. This is required by Mellanox cards to work in DPDK mode. See the
Configuring SR-IOV network devices
section for detailed explanation on each option inSriovNetworkNodePolicy
.When applying the configuration specified in a
SriovNetworkNodePolicy
object, the SR-IOV Operator may drain the nodes, and in some cases, reboot nodes. It may take several minutes for a configuration change to apply. Ensure that there are enough available nodes in your cluster to handle the evicted workload beforehand.After the configuration update is applied, all the pods in the
openshift-sriov-network-operator
namespace will change to aRunning
status.Create the
SriovNetworkNodePolicy
object by running the following command:$ oc create -f mlx-dpdk-node-policy.yaml
Create the following
SriovNetwork
object, and then save the YAML in themlx-dpdk-network.yaml
file.apiVersion: sriovnetwork.openshift.io/v1
kind: SriovNetwork
metadata:
name: mlx-dpdk-network
namespace: openshift-sriov-network-operator
spec:
networkNamespace: <target_namespace>
ipam: |- (1)
...
vlan: <vlan>
resourceName: mlxnics
1 Specify a configuration object for the ipam CNI plug-in as a YAML block scalar. The plug-in manages IP address assignment for the attachment definition. See the “Configuring SR-IOV additional network” section for a detailed explanation on each option in
SriovNetwork
.Create the
SriovNetworkNodePolicy
object by running the following command:$ oc create -f mlx-dpdk-network.yaml
Create the following
Pod
spec, and then save the YAML in themlx-dpdk-pod.yaml
file.apiVersion: v1
kind: Pod
metadata:
name: dpdk-app
namespace: <target_namespace> (1)
annotations:
k8s.v1.cni.cncf.io/networks: mlx-dpdk-network
spec:
containers:
- name: testpmd
image: <DPDK_image> (2)
securityContext:
runAsUser: 0
capabilities:
add: ["IPC_LOCK","SYS_RESOURCE","NET_RAW"] (3)
volumeMounts:
- mountPath: /dev/hugepages (4)
name: hugepage
resources:
limits:
openshift.io/mlxnics: "1" (5)
memory: "1Gi"
cpu: "4" (6)
hugepages-1Gi: "4Gi" (7)
requests:
openshift.io/mlxnics: "1"
memory: "1Gi"
cpu: "4"
hugepages-1Gi: "4Gi"
command: ["sleep", "infinity"]
volumes:
- name: hugepage
emptyDir:
-
$ oc create -f mlx-dpdk-pod.yaml
RDMA over Converged Ethernet (RoCE) is the only supported mode when using RDMA on OKD.
Prerequisites
Install the OpenShift CLI (
oc
).Install the SR-IOV Network Operator.
Log in as a user with
cluster-admin
privileges.
Procedure
Create the following
SriovNetworkNodePolicy
object, and then save the YAML in themlx-rdma-node-policy.yaml
file.1 Specify the device hex code of SR-IOV network device. The only allowed values for Mellanox cards are 1015
,1017
.2 Specify the driver type for the virtual functions to netdevice
.3 Enable RDMA mode. See the
Configuring SR-IOV network devices
section for a detailed explanation on each option inSriovNetworkNodePolicy
.When applying the configuration specified in a
SriovNetworkNodePolicy
object, the SR-IOV Operator may drain the nodes, and in some cases, reboot nodes. It may take several minutes for a configuration change to apply. Ensure that there are enough available nodes in your cluster to handle the evicted workload beforehand.After the configuration update is applied, all the pods in the
openshift-sriov-network-operator
namespace will change to aRunning
status.Create the
SriovNetworkNodePolicy
object by running the following command:$ oc create -f mlx-rdma-node-policy.yaml
Create the following
SriovNetwork
object, and then save the YAML in themlx-rdma-network.yaml
file.apiVersion: sriovnetwork.openshift.io/v1
kind: SriovNetwork
metadata:
name: mlx-rdma-network
namespace: openshift-sriov-network-operator
spec:
networkNamespace: <target_namespace>
ipam: |- (1)
...
vlan: <vlan>
resourceName: mlxnics
1 Specify a configuration object for the ipam CNI plug-in as a YAML block scalar. The plug-in manages IP address assignment for the attachment definition. See the “Configuring SR-IOV additional network” section for a detailed explanation on each option in
SriovNetwork
.Create the
SriovNetworkNodePolicy
object by running the following command:$ oc create -f mlx-rdma-network.yaml
Create the following
Pod
spec, and then save the YAML in themlx-rdma-pod.yaml
file.apiVersion: v1
kind: Pod
metadata:
name: rdma-app
namespace: <target_namespace> (1)
annotations:
k8s.v1.cni.cncf.io/networks: mlx-rdma-network
spec:
containers:
- name: testpmd
image: <RDMA_image> (2)
securityContext:
runAsUser: 0
capabilities:
add: ["IPC_LOCK","SYS_RESOURCE","NET_RAW"] (3)
volumeMounts:
- mountPath: /dev/hugepages (4)
name: hugepage
resources:
limits:
memory: "1Gi"
cpu: "4" (5)
hugepages-1Gi: "4Gi" (6)
requests:
memory: "1Gi"
cpu: "4"
hugepages-1Gi: "4Gi"
command: ["sleep", "infinity"]
volumes:
- name: hugepage
emptyDir:
medium: HugePages
-