---
name: "PCI_IOV_ADD_VF"
section: "9freebsd"
platform: "linux"
package: "freebsd-manpages"
version: "12.2-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/PCI_IOV_ADD_VF/9freebsd"
---

# PCI\_IOV\_ADD\_VF(9freebsd)

inform a PF driver that a VF is being created

## NAME

**PCI\_IOV\_ADD\_VF** – inform a PF driver that a VF is being created

## SYNOPSIS

**#include \<sys/bus.h\>**

**#include \<machine/stdarg.h\>**

**#include \<sys/nv.h\>**

**#include \<dev/pci/pci\_iov.h\>**

*int*\

**PCI\_IOV\_ADD\_VF**(*device\_t dev*, *uint16\_t vfnum*, *const nvlist\_t \*vf\_config*);

## DESCRIPTION

The **PCI\_IOV\_ADD\_VF**() method is called by the PCI Single-Root I/O Virtualization (SR-IOV) infrastructure when it is initializating a new Virtual Function (VF) as a child of the given Physical Function (PF) device. This method will not be called until a successful call to [PCI\_IOV\_INIT(9)](/PCI_IOV_INIT/9.md) has been made. It is not guaranteed that this method will be called following a successful call to [PCI\_IOV\_INIT(9)](/PCI_IOV_INIT/9.md). If the infrastructure encounters a failure to allocate resources following the call to [PCI\_IOV\_INIT(9)](/PCI_IOV_INIT/9.md), the VF creation will be aborted and [PCI\_IOV\_UNINIT(9)](/PCI_IOV_UNINIT/9.md) will be called immediately without any preceding calls to **PCI\_IOV\_ADD\_VF**.

The index of the VF being initialized is passed in the *vfnum* argument. VFs are always numbered sequentially starting at 0.

If the driver requested device-specific configuration parameters via a VF schema in its call to [pci\_iov\_attach(9)](/pci_iov_attach/9.md), those parameters will be contained in the *vf\_config* argument. All configuration parameters that were either set as required parameters or that had a default value set in the VF schema are guaranteed to be present in *vf\_config*. Configuration parameters that were neither set as required nor were given a default value are optional and may or may not be present in *vf\_config*. *vf\_config* will not contain any configuration parameters that were not specified in the VF schema. All configuration parameters will have the correct type and will be in the range of valid values specified in the schema.

Note that it is possible for the user to set different configuration values on different VF devices that are children of the same PF. The PF driver must not cache configuration parameters passed in previous calls to **PCI\_IOV\_ADD\_VF**() for other VFs and apply those parameters to the current VF.

This function will not be called twice for the same *vf\_num* on the same PF device without [PCI\_IOV\_UNINIT(9)](/PCI_IOV_UNINIT/9.md) and [PCI\_IOV\_INIT(9)](/PCI_IOV_INIT/9.md) first being called, in that order.

## RETURN VALUES

This method returns 0 on success, otherwise an appropriate error is returned. If this method returns an error then the current VF device will be destroyed but the rest of the VF devices will be created and SR-IOV will be enabled on the PF.

## SEE ALSO

[nv(9)](/nv/9.md), [pci(9)](/pci/9.md), [PCI\_IOV\_INIT(9)](/PCI_IOV_INIT/9.md), [pci\_iov\_schema(9)](/pci_iov_schema/9.md), [PCI\_IOV\_UNINIT(9)](/PCI_IOV_UNINIT/9.md)

## AUTHORS

This manual page was written by Ryan Stone ⟨*rstone@FreeBSD.org*⟩.
