1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/nw-sriov-nic-partitioning.adoc

95 lines
3.5 KiB
Plaintext

// Module included in the following assemblies:
//
// * networking/hardware_networks/configuring-sriov-device.adoc
:_mod-docs-content-type: REFERENCE
[id="nw-sriov-nic-partitioning_{context}"]
= Virtual function (VF) partitioning for SR-IOV devices
In some cases, you might want to split virtual functions (VFs) from the same physical function (PF) into many resource pools. For example, you might want some of the VFs to load with the default driver and the remaining VFs load with the `vfio-pci` driver.
For example, the following YAML shows the selector for an interface named `netpf0` with VF `2` through `7`:
[source,yaml]
----
pfNames: ["netpf0#2-7"]
----
where:
`netpf0`:: The name of the PF interface name.
`2`:: The first VF index (0-based) that gets included in the range.
`7`:: The last VF index (0-based) that gets included in the range.
You can select VFs from the same PF by using different policy CRs provided that you meet the following requirements:
* The `numVfs` value must be similar for policies that select the same PF.
* The VF index must be in the range of `0` to `<numVfs>-1`. For example, if you have a policy with `numVfs` set to `8`, then the `<first_vf>` value must not be smaller than `0`, and the `<last_vf>` must not be larger than `7`.
* The VFs ranges in different policies must not overlap.
* The `<first_vf>` must not be larger than the `<last_vf>`.
The following example illustrates NIC partitioning for an SR-IOV device.
The policy `policy-net-1` defines a resource pool `net-1` that includes the VF `0` of PF `netpf0` with the default VF driver.
The policy `policy-net-1-dpdk` defines a resource pool `net-1-dpdk` that includes the VF `8` to `15` of PF `netpf0` with the `vfio` VF driver.
Policy `policy-net-1`:
[source,yaml]
----
apiVersion: sriovnetwork.openshift.io/v1
kind: SriovNetworkNodePolicy
metadata:
name: policy-net-1
namespace: openshift-sriov-network-operator
spec:
resourceName: net1
nodeSelector:
feature.node.kubernetes.io/network-sriov.capable: "true"
numVfs: 16
nicSelector:
pfNames: ["netpf0#0-0"]
deviceType: netdevice
----
Policy `policy-net-1-dpdk`:
[source,yaml]
----
apiVersion: sriovnetwork.openshift.io/v1
kind: SriovNetworkNodePolicy
metadata:
name: policy-net-1-dpdk
namespace: openshift-sriov-network-operator
spec:
resourceName: net1dpdk
nodeSelector:
feature.node.kubernetes.io/network-sriov.capable: "true"
numVfs: 16
nicSelector:
pfNames: ["netpf0#8-15"]
deviceType: vfio-pci
----
.Verifying that the interface is successfully partitioned
* Confirm that the interface partitioned to virtual functions (VFs) for the SR-IOV device by running the following command.
+
[source,terminal]
----
$ ip link show <interface> <1>
----
<1> Replace `<interface>` with the interface that you specified when partitioning to VFs for the SR-IOV device, for example, `ens3f1`.
+
.Example output
[source,terminal]
----
5: ens3f1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether 3c:fd:fe:d1:bc:01 brd ff:ff:ff:ff:ff:ff
vf 0 link/ether 5a:e7:88:25:ea:a0 brd ff:ff:ff:ff:ff:ff, spoof checking on, link-state auto, trust off
vf 1 link/ether 3e:1d:36:d7:3d:49 brd ff:ff:ff:ff:ff:ff, spoof checking on, link-state auto, trust off
vf 2 link/ether ce:09:56:97:df:f9 brd ff:ff:ff:ff:ff:ff, spoof checking on, link-state auto, trust off
vf 3 link/ether 5e:91:cf:88:d1:38 brd ff:ff:ff:ff:ff:ff, spoof checking on, link-state auto, trust off
vf 4 link/ether e6:06:a1:96:2f:de brd ff:ff:ff:ff:ff:ff, spoof checking on, link-state auto, trust off
----