// Module included in the following assemblies:
//
// * networking/hardware_networks/configuring-interface-sysctl-sriov-device.adoc

:_mod-docs-content-type: PROCEDURE
[id="nw-basic-example-setting-one-sysctl-flag-node-policy_{context}"]
= Setting one sysctl flag on nodes with SR-IOV network devices

The SR-IOV Network Operator adds the `SriovNetworkNodePolicy.sriovnetwork.openshift.io` custom resource definition (CRD) to {product-title}. You can configure an SR-IOV network device by creating a `SriovNetworkNodePolicy` custom resource (CR).

[NOTE]
====
When applying the configuration specified in a `SriovNetworkNodePolicy` object, the SR-IOV Operator might drain and reboot the nodes.

It can take several minutes for a configuration change to apply.
====

Follow this procedure to create a `SriovNetworkNodePolicy` custom resource (CR).

.Procedure

. Create an `SriovNetworkNodePolicy` custom resource (CR). For example, save the following YAML as the file `policyoneflag-sriov-node-network.yaml`:
+
[source,yaml]
----
apiVersion: sriovnetwork.openshift.io/v1
kind: SriovNetworkNodePolicy
metadata:
  name: policyoneflag <1>
  namespace: openshift-sriov-network-operator <2>
spec:
  resourceName: policyoneflag <3>
  nodeSelector: <4>
    feature.node.kubernetes.io/network-sriov.capable="true"
  priority: 10 <5>
  numVfs: 5 <6>
  nicSelector: <7>
    pfNames: ["ens5"] <8>
  deviceType: "netdevice" <9>
  isRdma: false <10>
----
+
<1> The name for the custom resource object.
<2> The namespace where the SR-IOV Network Operator is installed.
<3> The resource name of the SR-IOV network device plugin. You can create multiple SR-IOV network node policies for a resource name.
<4> The node selector specifies the nodes to configure. Only SR-IOV network devices on the selected nodes are configured. The SR-IOV Container Network Interface (CNI) plugin and device plugin are deployed on selected nodes only.
<5> Optional: The priority is an integer value between `0` and `99`. A smaller value receives higher priority. For example, a priority of `10` is a higher priority than `99`. The default value is `99`.
<6> The number of the virtual functions (VFs) to create for the SR-IOV physical network device. For an Intel network interface controller (NIC), the number of VFs cannot be larger than the total VFs supported by the device. For a Mellanox NIC, the number of VFs cannot be larger than `128`.
<7> The NIC selector identifies the device for the Operator to configure. You do not have to specify values for all the parameters. It is recommended to identify the network device with enough precision to avoid selecting a device unintentionally.
If you specify `rootDevices`, you must also specify a value for `vendor`, `deviceID`, or `pfNames`. If you specify both `pfNames` and `rootDevices` at the same time, ensure that they refer to the same device. If you specify a value for `netFilter`, then you do not need to specify any other parameter because a network ID is unique.
<8> Optional: An array of one or more physical function (PF) names for the device.
<9> Optional: The driver type for the virtual functions. The only allowed value is `netdevice`.
For a Mellanox NIC to work in DPDK mode on bare metal nodes, set `isRdma` to `true`.
<10> Optional: Configures whether to enable remote direct memory access (RDMA) mode. The default value is `false`.
If the `isRdma` parameter is set to `true`, you can continue to use the RDMA-enabled VF as a normal network device. A device can be used in either mode.
Set `isRdma` to `true` and additionally set `needVhostNet` to `true` to configure a Mellanox NIC for use with Fast Datapath DPDK applications.
+
[NOTE]
====
The `vfio-pci` driver type is not supported.
====
+
. Create the `SriovNetworkNodePolicy` object:
+
[source,terminal]
----
$ oc create -f policyoneflag-sriov-node-network.yaml
----
+
After applying the configuration update, all the pods in `sriov-network-operator` namespace change to the `Running` status.
+
. To verify that the SR-IOV network device is configured, enter the following command. Replace `<node_name>` with the name of a node with the SR-IOV network device that you just configured.
+
[source,terminal]
----
$ oc get sriovnetworknodestates -n openshift-sriov-network-operator <node_name> -o jsonpath='{.status.syncStatus}'
----
+
.Example output
[source,terminal]
----
Succeeded
----