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