> For the complete documentation index, see [llms.txt](https://book.bsdcn.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://book.bsdcn.org/man/man9/pci_iov_init.9.md).

# PCI\_IOV\_INIT.9

`PCI_IOV_INIT` — 在 PF 设备上启用 SR-IOV

## 名称

`PCI_IOV_INIT`

## 概要

```c
#include <sys/bus.h>
#include <sys/stdarg.h>
#include <sys/nv.h>
#include <dev/pci/pci_iov.h>

int
PCI_IOV_INIT(device_t dev, uint16_t num_vfs, const nvlist_t *pf_config)
```

## 描述

`PCI_IOV_INIT` 方法在用户请求在物理功能（PF）上启用 SR-IOV 时由 PCI 单根 I/O 虚拟化（SR-IOV）基础设施调用。将要创建的虚拟功能（VF）数量通过 `num_vfs` 参数传递给此方法。

如果驱动程序在其对 pci\_iov\_attach(9) 的调用中通过 PF 模式请求了设备特定的 PF 配置参数，这些参数将在 `pf_config` 参数中可用。在 PF 模式中设置为必需参数或设置了默认值的所有配置参数都保证存在于 `pf_config` 中。既未设置为必需也未设置默认值的配置参数是可选的，可能存在于 `pf_config` 中，也可能不存在。`pf_config` 不会包含未在 PF 模式中指定的任何配置参数。所有配置参数都将具有正确的类型，并位于模式中指定的有效值范围内。

如果此方法成功返回，则在此方法再次被调用之前（直到调用 [PCI\_IOV\_UNINIT(9)](/man/man9/pci_iov_uninit.9.md) 之后），不会在同一设备上再次调用此方法。

## 返回值

成功时返回 0，否则返回适当的错误。如果此方法返回错误，则 SR-IOV 配置将被中止，不会创建任何 VF。

## 参见

[nv(9)](/man/man9/nv.9.md), [pci(9)](/man/man9/pci.9.md), [PCI\_IOV\_ADD\_VF(9)](/man/man9/pci_iov_add_vf.9.md), [pci\_iov\_schema(9)](/man/man9/pci_iov_schema.9.md), [PCI\_IOV\_UNINIT(9)](/man/man9/pci_iov_uninit.9.md)

## 作者

本手册页由 Ryan Stone <rstone@FreeBSD.org> 编写。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://book.bsdcn.org/man/man9/pci_iov_init.9.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
