From 5c9af52e3d6ceb9c99c3f6df964cf3fd28b27f06 Mon Sep 17 00:00:00 2001 From: Ryan Stone Date: Sat, 24 May 2014 23:36:13 -0400 Subject: [PATCH 06/21] Add manpages for SR-IOV enable/disable driver interface --- share/man/man9/Makefile | 3 ++ share/man/man9/PCI_ADD_VF.9 | 114 ++++++++++++++++++++++++++++++++++++++++ share/man/man9/PCI_INIT_IOV.9 | 85 ++++++++++++++++++++++++++++++ share/man/man9/PCI_UNINIT_IOV.9 | 64 ++++++++++++++++++++++ 4 files changed, 266 insertions(+) create mode 100644 share/man/man9/PCI_ADD_VF.9 create mode 100644 share/man/man9/PCI_INIT_IOV.9 create mode 100644 share/man/man9/PCI_UNINIT_IOV.9 diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 0adfb69c..1fb50b7 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -190,6 +190,9 @@ MAN= accept_filter.9 \ p_candebug.9 \ p_cansee.9 \ pci.9 \ + PCI_ADD_VF.9 \ + PCI_INIT_IOV.9 \ + PCI_UNINIT_IOV.9 \ pfil.9 \ pfind.9 \ pget.9 \ diff --git a/share/man/man9/PCI_ADD_VF.9 b/share/man/man9/PCI_ADD_VF.9 new file mode 100644 index 0000000..d9b1597 --- /dev/null +++ b/share/man/man9/PCI_ADD_VF.9 @@ -0,0 +1,114 @@ +.\" +.\" Copyright (c) 2014 Sandvine Inc. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd May 24, 2014 +.Dt PCI_ADD_VF 9 +.Os +.Sh NAME +.Nm PCI_ADD_VF +.Nd inform a PF driver that a VF is being created +.Sh SYNOPSIS +.In sys/bus.h +.In machine/stdarg.h +.In sys/nv.h +.In dev/pci/pcireg.h +.In dev/pci/pcivar.h +.Ft int +.Fn PCI_ADD_VF "device_t dev" "uint16_t vfnum" "const nvlist_t *vf_config" +.Sh DESCRIPTION +The +.Fn PCI_ADD_VF +method is called by the PCI Single-Root I/O Virtualization (SR-IOV) +infrastructure when it is initializating a new VF as a child of the given PF +device. +It is guaranteed that this method will not be called until a successful +call to +.Xr PCI_INIT_IOV 9 +has been made. +It is not guaranteed that this method will be called following a successful call +to +.Xr PCI_INIT_IOV 9 . +If the infrastructure encounters a failure to allocate resources following the +call to +.Xr PCI_INIT_IOV 9 , +the VF creation will be aborted and +.Xr PCI_UNINIT_IOV 9 +will be called immediately without any preceeding calls to +.Nm . +.Pp +The number of the VF being initialized is passed in the +.Fa vfnum +argument. +VFs are always numbered sequentially starting at 0. +.Pp +If the driver requested device-specific configuration paramters via a VF schema +in its call to +.Xr pci_iov_attach 9 , +those parameters will be contained in the +.Pa 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 +.Fa 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 +.Fa vf_config . +It is guaranteed that +.Fa vf_config +will not contain any configuration parameters that were not specified in the VF +schema. +It is guaranteed that all configuration parameters will have the correct type +and are in the range of valid values specified in the schema. +.Pp +Note that it is possible for the user to set different configuration values on +different VF devices that are children of the same PF. +It is incorrect for the PF driver to cache configuration parameters passed in +previous calls to +.Fn PCI_ADD_VF +for other VFs and apply those parameters to the current VF. +.Pp +It is guaranteed that this function will not be called twice for the same +.Fa vf_num +on the same PF device without +.Xr PCI_UNINIT_IOV 9 +and +.Xr PCI_INIT_IOV 9 +first being called, in that order. +.Sh 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. +.Sh SEE ALSO +.Xr nv 9 , +.Xr pci 9 , +.Xr pci_iov_schema 9 , +.Xr PCI_INIT_IOV 9 , +.Xr PCI_UNINIT_IOV 9 +.Sh AUTHORS +This manual page was written by +.An Ryan Stone Aq rstone@FreeBSD.org . diff --git a/share/man/man9/PCI_INIT_IOV.9 b/share/man/man9/PCI_INIT_IOV.9 new file mode 100644 index 0000000..a4d404b --- /dev/null +++ b/share/man/man9/PCI_INIT_IOV.9 @@ -0,0 +1,85 @@ +.\" +.\" Copyright (c) 2014 Sandvine Inc. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd May 24, 2014 +.Dt PCI_INIT_IOV 9 +.Os +.Sh NAME +.Nm PCI_INIT_IOV +.Nd enable SR-IOV on a PF device +.Sh SYNOPSIS +.In sys/bus.h +.In machine/stdarg.h +.In sys/nv.h +.In dev/pci/pcireg.h +.In dev/pci/pcivar.h +.Ft int +.Fn PCI_INIT_IOV "device_t dev" "uint16_t num_vfs" "const nvlist_t *pf_config" +.Sh DESCRIPTION +The +.Fn PCI_INIT_IOV +method is called by the PCI Single-Root I/O Virtualization (SR-IOV) +infrastucture when the user requests that SR-IOV be enabled on a PF device. +The number of VFs that will be created is passed to this method in the +.Fa num_vfs +argument. +.Pp +If the driver requested device-specific PF configuration parameters via a PF +schema in its call to +.Xr pci_iov_attach 9 , +those parameters will be available in the +.Fa pf_config +argument. +All configuration parameters that were either set as required parameters or that +had a default value set in the PF schema are guaranteed to be present in +.Fa pf_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 +.Fa pf_config . +It is guaranteed that +.Fa pf_config +will not contain any configuration parameters that were not specified in the PF +schema. +It is guaranteed that all configuration parameters will have the correct type +and are in the range of valid values specified in the schema. +.Pp +If this method returns successfully, then it is guaranteed that this method will +not be called again on the same device until after a call to +.Xr PCI_UNINIT_IOV . +.Sh RETURN VALUES +This method returns 0 on success, otherwise an appropriate error is returned. +If this method returns an error then the SR-IOV configuration will be aborted +and no VFs will be created. +.Sh SEE ALSO +.Xr nv 3, +.Xr pci 9 , +.Xr pci_iov_schema 9 , +.Xr PCI_ADD_VF 9 , +.Xr PCI_UNINIT_IOV 9 +.Sh AUTHORS +This manual page was written by +.An Ryan Stone Aq rstone@FreeBSD.org . diff --git a/share/man/man9/PCI_UNINIT_IOV.9 b/share/man/man9/PCI_UNINIT_IOV.9 new file mode 100644 index 0000000..25004d4 --- /dev/null +++ b/share/man/man9/PCI_UNINIT_IOV.9 @@ -0,0 +1,64 @@ +.\" +.\" Copyright (c) 2014 Sandvine Inc. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd May 24, 2014 +.Dt PCI_UNINIT_IOV 9 +.Os +.Sh NAME +.Nm PCI_UNINIT_IOV +.Nd disable SR-IOV on a PF device +.Sh SYNOPSIS +.In sys/bus.h +.In dev/pci/pcireg.h +.In dev/pci/pcivar.h +.Ft void +.Fn PCI_UNINIT_IOV "device_t dev" +.Sh DESCRIPTION +The +.Fn PCI_UNINIT_IOV +method is called by the PCI Single-Root I/O Virtualization (SR-IOV) +infrastructure when the user requests that SR-IOV be disabled on a PF device. +When this method is called, the PF driver must release any SR-IOV-related +resources that it has allocated and disable any device-specific SR-IOV +configuration in the device. +.Pp +It is guaranteed that this method will only be called following a successful +call to +.Xr PCI_INIT_IOV . +It is not guaranteed that +.Xr PCI_ADD_VF +will have been called for any VF after the call to +.Xr PCI_INIT_IOV +and before the call to +.Nm . +.Sh SEE ALSO +.Xr pci 9 , +.Xr PCI_ADD_VF 9 , +.Xr PCI_INIT_IOV 9 +.Sh AUTHORS +This manual page was written by +.An Ryan Stone Aq rstone@FreeBSD.org . -- 1.9.2