xref: /freebsd/share/man/man9/PCI_IOV_ADD_VF.9 (revision 548afe2bec75e5b1c3957700344c027d8ed09f59)
1f3bb9251SJohn Baldwin.\"
2f3bb9251SJohn Baldwin.\" Copyright (c) 2014 Sandvine Inc.
3f3bb9251SJohn Baldwin.\" All rights reserved.
4f3bb9251SJohn Baldwin.\"
5f3bb9251SJohn Baldwin.\" Redistribution and use in source and binary forms, with or without
6f3bb9251SJohn Baldwin.\" modification, are permitted provided that the following conditions
7f3bb9251SJohn Baldwin.\" are met:
8f3bb9251SJohn Baldwin.\" 1. Redistributions of source code must retain the above copyright
9f3bb9251SJohn Baldwin.\"    notice, this list of conditions and the following disclaimer.
10f3bb9251SJohn Baldwin.\" 2. Redistributions in binary form must reproduce the above copyright
11f3bb9251SJohn Baldwin.\"    notice, this list of conditions and the following disclaimer in the
12f3bb9251SJohn Baldwin.\"    documentation and/or other materials provided with the distribution.
13f3bb9251SJohn Baldwin.\"
14f3bb9251SJohn Baldwin.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15f3bb9251SJohn Baldwin.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16f3bb9251SJohn Baldwin.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17f3bb9251SJohn Baldwin.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18f3bb9251SJohn Baldwin.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19f3bb9251SJohn Baldwin.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20f3bb9251SJohn Baldwin.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21f3bb9251SJohn Baldwin.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22f3bb9251SJohn Baldwin.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23f3bb9251SJohn Baldwin.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24f3bb9251SJohn Baldwin.\" SUCH DAMAGE.
25f3bb9251SJohn Baldwin.\"
26f3bb9251SJohn Baldwin.\" $FreeBSD$
27f3bb9251SJohn Baldwin.\"
28f3bb9251SJohn Baldwin.Dd May 28, 2015
29f3bb9251SJohn Baldwin.Dt PCI_IOV_ADD_VF 9
30f3bb9251SJohn Baldwin.Os
31f3bb9251SJohn Baldwin.Sh NAME
32f3bb9251SJohn Baldwin.Nm PCI_IOV_ADD_VF
33f3bb9251SJohn Baldwin.Nd inform a PF driver that a VF is being created
34f3bb9251SJohn Baldwin.Sh SYNOPSIS
35f3bb9251SJohn Baldwin.In sys/bus.h
36f3bb9251SJohn Baldwin.In machine/stdarg.h
37f3bb9251SJohn Baldwin.In sys/nv.h
38f3bb9251SJohn Baldwin.In dev/pci/pci_iov.h
39f3bb9251SJohn Baldwin.Ft int
40f3bb9251SJohn Baldwin.Fn PCI_IOV_ADD_VF "device_t dev" "uint16_t vfnum" "const nvlist_t *vf_config"
41f3bb9251SJohn Baldwin.Sh DESCRIPTION
42f3bb9251SJohn BaldwinThe
43f3bb9251SJohn Baldwin.Fn PCI_IOV_ADD_VF
44f3bb9251SJohn Baldwinmethod is called by the PCI Single-Root I/O Virtualization
45f3bb9251SJohn Baldwin.Pq SR-IOV
46f3bb9251SJohn Baldwininfrastructure when it is initializating a new Virtual Function (VF) as a child
47f3bb9251SJohn Baldwinof the given Physical Function (PF) device.
48f3bb9251SJohn BaldwinThis method will not be called until a successful call to
49f3bb9251SJohn Baldwin.Xr PCI_IOV_INIT 9
50f3bb9251SJohn Baldwinhas been made.
51f3bb9251SJohn BaldwinIt is not guaranteed that this method will be called following a successful call
52f3bb9251SJohn Baldwinto
53f3bb9251SJohn Baldwin.Xr PCI_IOV_INIT 9 .
54f3bb9251SJohn BaldwinIf the infrastructure encounters a failure to allocate resources following the
55f3bb9251SJohn Baldwincall to
56f3bb9251SJohn Baldwin.Xr PCI_IOV_INIT 9 ,
57f3bb9251SJohn Baldwinthe VF creation will be aborted and
58f3bb9251SJohn Baldwin.Xr PCI_IOV_UNINIT 9
59f3bb9251SJohn Baldwinwill be called immediately without any preceding calls to
60f3bb9251SJohn Baldwin.Nm .
61f3bb9251SJohn Baldwin.Pp
62f3bb9251SJohn BaldwinThe index of the VF being initialized is passed in the
63f3bb9251SJohn Baldwin.Fa vfnum
64f3bb9251SJohn Baldwinargument.
65f3bb9251SJohn BaldwinVFs are always numbered sequentially starting at 0.
66f3bb9251SJohn Baldwin.Pp
67f3bb9251SJohn BaldwinIf the driver requested device-specific configuration parameters via a VF schema
68f3bb9251SJohn Baldwinin its call to
69f3bb9251SJohn Baldwin.Xr pci_iov_attach 9 ,
70f3bb9251SJohn Baldwinthose parameters will be contained in the
71f3bb9251SJohn Baldwin.Pa vf_config
72f3bb9251SJohn Baldwinargument.
73f3bb9251SJohn BaldwinAll configuration parameters that were either set as required parameters or that
74f3bb9251SJohn Baldwinhad a default value set in the VF schema are guaranteed to be present in
75f3bb9251SJohn Baldwin.Fa vf_config .
76f3bb9251SJohn BaldwinConfiguration parameters that were neither set as required nor were given a
77f3bb9251SJohn Baldwindefault value are optional and may or may not be present in
78f3bb9251SJohn Baldwin.Fa vf_config .
79f3bb9251SJohn Baldwin.Fa vf_config
80f3bb9251SJohn Baldwinwill not contain any configuration parameters that were not specified in the VF
81f3bb9251SJohn Baldwinschema.
82f3bb9251SJohn BaldwinAll configuration parameters will have the correct type and will be in the range
83f3bb9251SJohn Baldwinof valid values specified in the schema.
84f3bb9251SJohn Baldwin.Pp
85f3bb9251SJohn BaldwinNote that it is possible for the user to set different configuration values on
86f3bb9251SJohn Baldwindifferent VF devices that are children of the same PF.
87f3bb9251SJohn BaldwinThe PF driver must not cache configuration parameters passed in previous calls
88f3bb9251SJohn Baldwinto
89f3bb9251SJohn Baldwin.Fn PCI_IOV_ADD_VF
90f3bb9251SJohn Baldwinfor other VFs and apply those parameters to the current VF.
91f3bb9251SJohn Baldwin.Pp
92f3bb9251SJohn BaldwinThis function will not be called twice for the same
93f3bb9251SJohn Baldwin.Fa vf_num
94f3bb9251SJohn Baldwinon the same PF device without
95f3bb9251SJohn Baldwin.Xr PCI_IOV_UNINIT 9
96f3bb9251SJohn Baldwinand
97f3bb9251SJohn Baldwin.Xr PCI_IOV_INIT 9
98f3bb9251SJohn Baldwinfirst being called, in that order.
99f3bb9251SJohn Baldwin.Sh RETURN VALUES
100f3bb9251SJohn BaldwinThis method returns 0 on success, otherwise an appropriate error is returned.
101f3bb9251SJohn BaldwinIf this method returns an error then the current VF device will be destroyed
102f3bb9251SJohn Baldwinbut the rest of the VF devices will be created and SR-IOV will be enabled on
103f3bb9251SJohn Baldwinthe PF.
104f3bb9251SJohn Baldwin.Sh SEE ALSO
105f3bb9251SJohn Baldwin.Xr nv 9 ,
106f3bb9251SJohn Baldwin.Xr pci 9 ,
107f3bb9251SJohn Baldwin.Xr PCI_IOV_INIT 9 ,
108*548afe2bSChristian Brueffer.Xr pci_iov_schema 9 ,
109f3bb9251SJohn Baldwin.Xr PCI_IOV_UNINIT 9
110f3bb9251SJohn Baldwin.Sh AUTHORS
111f3bb9251SJohn BaldwinThis manual page was written by
112f3bb9251SJohn Baldwin.An Ryan Stone Aq Mt rstone@FreeBSD.org .
113