Date: Sun, 3 Jan 2016 09:38:06 +0000 (UTC) From: Garrett Cooper <ngie@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r293096 - in user/ngie/stable-10-libnv: share/man/man9 sys/conf sys/dev/ixl sys/dev/pci sys/modules/ixl Message-ID: <201601030938.u039c6wu035142@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ngie Date: Sun Jan 3 09:38:05 2016 New Revision: 293096 URL: https://svnweb.freebsd.org/changeset/base/293096 Log: MFC r279445,r279464,r283670: r279445 (by rstone): Document pci_iov_attach/detach in pci.9 r279464 (by rstone): Document the interface for defining a configuration schema r283670 (by jhb): Create a separate kobj interface for leaf-driver PCI IOV methods. Leaf drivers should not import the PCI bus interface to add IOV handling. Instead, move the IOV client methods to a separate kobj interface. Added: user/ngie/stable-10-libnv/share/man/man9/PCI_IOV_ADD_VF.9 - copied unchanged from r283670, head/share/man/man9/PCI_IOV_ADD_VF.9 user/ngie/stable-10-libnv/share/man/man9/PCI_IOV_INIT.9 - copied unchanged from r283670, head/share/man/man9/PCI_IOV_INIT.9 user/ngie/stable-10-libnv/share/man/man9/PCI_IOV_UNINIT.9 - copied unchanged from r283670, head/share/man/man9/PCI_IOV_UNINIT.9 user/ngie/stable-10-libnv/share/man/man9/pci_iov_schema.9 - copied, changed from r279464, head/share/man/man9/pci_iov_schema.9 user/ngie/stable-10-libnv/sys/dev/pci/pci_iov.h - copied unchanged from r283670, head/sys/dev/pci/pci_iov.h user/ngie/stable-10-libnv/sys/dev/pci/pci_iov_if.m - copied unchanged from r283670, head/sys/dev/pci/pci_iov_if.m Deleted: user/ngie/stable-10-libnv/share/man/man9/PCI_ADD_VF.9 user/ngie/stable-10-libnv/share/man/man9/PCI_INIT_IOV.9 user/ngie/stable-10-libnv/share/man/man9/PCI_UNINIT_IOV.9 Modified: user/ngie/stable-10-libnv/share/man/man9/Makefile user/ngie/stable-10-libnv/share/man/man9/pci.9 user/ngie/stable-10-libnv/sys/conf/files user/ngie/stable-10-libnv/sys/conf/kmod.mk user/ngie/stable-10-libnv/sys/dev/ixl/if_ixl.c user/ngie/stable-10-libnv/sys/dev/ixl/ixl.h user/ngie/stable-10-libnv/sys/dev/pci/pci_if.m user/ngie/stable-10-libnv/sys/dev/pci/pci_iov.c user/ngie/stable-10-libnv/sys/dev/pci/pcivar.h user/ngie/stable-10-libnv/sys/modules/ixl/Makefile (contents, props changed) Directory Properties: user/ngie/stable-10-libnv/ (props changed) Modified: user/ngie/stable-10-libnv/share/man/man9/Makefile ============================================================================== --- user/ngie/stable-10-libnv/share/man/man9/Makefile Sun Jan 3 09:19:54 2016 (r293095) +++ user/ngie/stable-10-libnv/share/man/man9/Makefile Sun Jan 3 09:38:05 2016 (r293096) @@ -195,9 +195,10 @@ MAN= accept_filter.9 \ p_candebug.9 \ p_cansee.9 \ pci.9 \ - PCI_ADD_VF.9 \ - PCI_INIT_IOV.9 \ - PCI_UNINIT_IOV.9 \ + PCI_IOV_ADD_VF.9 \ + PCI_IOV_INIT.9 \ + pci_iov_schema.9 \ + PCI_IOV_UNINIT.9 \ pfil.9 \ pfind.9 \ pget.9 \ @@ -1086,6 +1087,8 @@ MLINKS+=pci.9 pci_alloc_msi.9 \ pci.9 pci_get_powerstate.9 \ pci.9 pci_get_vpd_ident.9 \ pci.9 pci_get_vpd_readonly.9 \ + pci.9 pci_iov_attach.9 \ + pci.9 pci_iov_detach.9 \ pci.9 pci_msi_count.9 \ pci.9 pci_msix_count.9 \ pci.9 pci_pending_msix.9 \ @@ -1100,6 +1103,14 @@ MLINKS+=pci.9 pci_alloc_msi.9 \ pci.9 pcie_adjust_config.9 \ pci.9 pcie_read_config.9 \ pci.9 pcie_write_config.9 +MLINKS+=pci_iov_schema.9 pci_iov_schema_alloc_node.9 \ + pci_iov_schema.9 pci_iov_schema_add_bool.9 \ + pci_iov_schema.9 pci_iov_schema_add_string.9 \ + pci_iov_schema.9 pci_iov_schema_add_uint8.9 \ + pci_iov_schema.9 pci_iov_schema_add_uint16.9 \ + pci_iov_schema.9 pci_iov_schema_add_uint32.9 \ + pci_iov_schema.9 pci_iov_schema_add_uint64.9 \ + pci_iov_schema.9 pci_iov_schema_add_unicast_mac.9 MLINKS+=pfil.9 pfil_add_hook.9 \ pfil.9 pfil_hook_get.9 \ pfil.9 pfil_remove_hook.9 Copied: user/ngie/stable-10-libnv/share/man/man9/PCI_IOV_ADD_VF.9 (from r283670, head/share/man/man9/PCI_IOV_ADD_VF.9) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/ngie/stable-10-libnv/share/man/man9/PCI_IOV_ADD_VF.9 Sun Jan 3 09:38:05 2016 (r293096, copy of r283670, head/share/man/man9/PCI_IOV_ADD_VF.9) @@ -0,0 +1,112 @@ +.\" +.\" 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 28, 2015 +.Dt PCI_IOV_ADD_VF 9 +.Os +.Sh NAME +.Nm PCI_IOV_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/pci_iov.h +.Ft int +.Fn PCI_IOV_ADD_VF "device_t dev" "uint16_t vfnum" "const nvlist_t *vf_config" +.Sh DESCRIPTION +The +.Fn PCI_IOV_ADD_VF +method is called by the PCI Single-Root I/O Virtualization +.Pq 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 +.Xr PCI_IOV_INIT 9 +has been made. +It is not guaranteed that this method will be called following a successful call +to +.Xr PCI_IOV_INIT 9 . +If the infrastructure encounters a failure to allocate resources following the +call to +.Xr PCI_IOV_INIT 9 , +the VF creation will be aborted and +.Xr PCI_IOV_UNINIT 9 +will be called immediately without any preceding calls to +.Nm . +.Pp +The index 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 parameters 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 . +.Fa 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. +.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. +The PF driver must not cache configuration parameters passed in previous calls +to +.Fn PCI_IOV_ADD_VF +for other VFs and apply those parameters to the current VF. +.Pp +This function will not be called twice for the same +.Fa vf_num +on the same PF device without +.Xr PCI_IOV_UNINIT 9 +and +.Xr PCI_IOV_INIT 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_IOV_INIT 9 , +.Xr PCI_IOV_UNINIT 9 +.Sh AUTHORS +This manual page was written by +.An Ryan Stone Aq Mt rstone@FreeBSD.org . Copied: user/ngie/stable-10-libnv/share/man/man9/PCI_IOV_INIT.9 (from r283670, head/share/man/man9/PCI_IOV_INIT.9) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/ngie/stable-10-libnv/share/man/man9/PCI_IOV_INIT.9 Sun Jan 3 09:38:05 2016 (r293096, copy of r283670, head/share/man/man9/PCI_IOV_INIT.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 28, 2015 +.Dt PCI_IOV_INIT 9 +.Os +.Sh NAME +.Nm PCI_IOV_INIT +.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/pci_iov.h +.Ft int +.Fn PCI_IOV_INIT "device_t dev" "uint16_t num_vfs" "const nvlist_t *pf_config" +.Sh DESCRIPTION +The +.Fn PCI_IOV_INIT +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 Physical +Function (PF). +The number of Virtual Functions (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 . +.Fa pf_config +will not contain any configuration parameters that were not specified in the PF +schema. +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 this method will not be called again +on the same device until after a call to +.Xr PCI_IOV_UNINIT . +.Sh RETURN VALUES +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 9 , +.Xr pci 9 , +.Xr pci_iov_schema 9 , +.Xr PCI_IOV_ADD_VF 9 , +.Xr PCI_IOV_UNINIT 9 +.Sh AUTHORS +This manual page was written by +.An Ryan Stone Aq Mt rstone@FreeBSD.org . Copied: user/ngie/stable-10-libnv/share/man/man9/PCI_IOV_UNINIT.9 (from r283670, head/share/man/man9/PCI_IOV_UNINIT.9) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/ngie/stable-10-libnv/share/man/man9/PCI_IOV_UNINIT.9 Sun Jan 3 09:38:05 2016 (r293096, copy of r283670, head/share/man/man9/PCI_IOV_UNINIT.9) @@ -0,0 +1,63 @@ +.\" +.\" 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 28, 2015 +.Dt PCI_IOV_UNINIT 9 +.Os +.Sh NAME +.Nm PCI_IOV_UNINIT +.Nd disable SR-IOV on a PF device +.Sh SYNOPSIS +.In sys/bus.h +.In dev/pci/pci_iov.h +.Ft void +.Fn PCI_IOV_UNINIT "device_t dev" +.Sh DESCRIPTION +The +.Fn PCI_IOV_UNINIT +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 Physical +Function (PF). +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 +This method will only be called following a successful call to +.Xr PCI_IOV_INIT . +It is not guaranteed that +.Xr PCI_IOV_ADD_VF +will have been called for any Virtual Function (VF) after the call to +.Xr PCI_IOV_INIT +and before the call to +.Nm . +.Sh SEE ALSO +.Xr pci 9 , +.Xr PCI_IOV_ADD_VF 9 , +.Xr PCI_IOV_INIT 9 +.Sh AUTHORS +This manual page was written by +.An Ryan Stone Aq Mt rstone@FreeBSD.org . Modified: user/ngie/stable-10-libnv/share/man/man9/pci.9 ============================================================================== --- user/ngie/stable-10-libnv/share/man/man9/pci.9 Sun Jan 3 09:19:54 2016 (r293095) +++ user/ngie/stable-10-libnv/share/man/man9/pci.9 Sun Jan 3 09:38:05 2016 (r293096) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 5, 2015 +.Dd January 3, 2015 .Dt PCI 9 .Os .Sh NAME @@ -47,6 +47,8 @@ .Nm pci_get_powerstate , .Nm pci_get_vpd_ident , .Nm pci_get_vpd_readonly , +.Nm pci_iov_attach , +.Nm pci_iov_detach , .Nm pci_msi_count , .Nm pci_msix_count , .Nm pci_pending_msix , @@ -134,6 +136,11 @@ .Fn pcie_read_config "device_t dev" "int reg" "int width" .Ft void .Fn pcie_write_config "device_t dev" "int reg" "uint32_t val" "int width" +.In dev/pci/pci_iov.h +.Ft int +.Fn pci_iov_attach "device_t dev" "nvlist_t *pf_schema" "nvlist_t *vf_schema" +.Ft int +.Fn pci_iov_detach "device_t dev" .Sh DESCRIPTION The .Nm @@ -504,6 +511,75 @@ then the function will fail with .Er EOPNOTSUPP . .Pp The +.Fn pci_iov_attach +function is used to advertise that the given device +.Pq and associated device driver +supports PCI Single-Root I/O Virtualization +.Po SR-IOV Pc . +A driver that supports SR-IOV must implement the +.Xr PCI_IOV_INIT 9 , +.Xr PCI_IOV_ADD_VF 9 +and +.Xr PCI_IOV_UNINIT 9 +methods. +This function should be called during the +.Xr DEVICE_ATTACH 9 +method. +If this function returns an error, it is recommended that the device driver +still successfully attaches, but runs with SR-IOV disabled. +The +.Fa pf_schema +and +.Fa vf_schema +parameters are used to define what device-specific configuration parameters the +device driver accepts when SR-IOV is enabled for the Physical Function +.Pq PF +and for individual Virtual Functions +.Pq VFs +respectively. +See +.Xr pci_iov_schema 9 +for details on how to construct the schema. +If either the +.Pa pf_schema +or +.Pa vf_schema +is invalid or specifies parameter names that conflict with parameter names that +are already in use, +.Fn pci_iov_attach +will return an error and SR-IOV will not be available on the PF device. +If a driver does not accept configuration parameters for either the PF device +or the VF devices, the driver must pass an empty schema for that device. +The SR-IOV infrastructure takes ownership of the +.Fa pf_schema +and +.Fa vf_schema +and is responsible for freeing them. +The driver must never free the schemas itself. +.Pp +The +.Fn pci_iov_detach +function is used to advise the SR-IOV infrastructure that the driver for the +given device is attempting to detach and that all SR-IOV resources for the +device must be released. +This function must be called during the +.Xr DEVICE_DETACH 9 +method if +.Fn pci_iov_attach +was successfully called on the device and +.Fn pci_iov_detach +has not subsequently been called on the device and returned no error. +If this function returns an error, the +.Xr DEVICE_DETACH 9 +method must fail and return an error, as detaching the PF driver while VF +devices are active would cause system instability. +This function is safe to call and will always succeed if +.Fn pci_iov_attach +previously failed with an error on the given device, or if +.Fn pci_iov_attach +was never called on the device. +.Pp +The .Fn pci_save_state and .Fn pci_restore_state Copied and modified: user/ngie/stable-10-libnv/share/man/man9/pci_iov_schema.9 (from r279464, head/share/man/man9/pci_iov_schema.9) ============================================================================== --- head/share/man/man9/pci_iov_schema.9 Sun Mar 1 00:59:21 2015 (r279464, copy source) +++ user/ngie/stable-10-libnv/share/man/man9/pci_iov_schema.9 Sun Jan 3 09:38:05 2016 (r293096) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 25, 2014 +.Dd May 28, 2015 .Dt pci_iov_schema 9 .Os .Sh NAME @@ -258,8 +258,8 @@ The function returns a pointer to the allocated schema, or NULL if a failure occurs. .Sh SEE ALSO .Xr pci 9 , -.Xr PCI_ADD_VF 9 , -.Xr PCI_INIT_IOV 9 +.Xr PCI_IOV_ADD_VF 9 , +.Xr PCI_IOV_INIT 9 .Sh AUTHORS This manual page was written by .An Ryan Stone Aq rstone@FreeBSD.org . Modified: user/ngie/stable-10-libnv/sys/conf/files ============================================================================== --- user/ngie/stable-10-libnv/sys/conf/files Sun Jan 3 09:19:54 2016 (r293095) +++ user/ngie/stable-10-libnv/sys/conf/files Sun Jan 3 09:38:05 2016 (r293096) @@ -2007,6 +2007,7 @@ dev/pci/isa_pci.c optional pci isa dev/pci/pci.c optional pci dev/pci/pci_if.m standard dev/pci/pci_iov.c optional pci pci_iov +dev/pci/pci_iov_if.m standard dev/pci/pci_iov_schema.c optional pci pci_iov dev/pci/pci_pci.c optional pci dev/pci/pci_subr.c optional pci Modified: user/ngie/stable-10-libnv/sys/conf/kmod.mk ============================================================================== --- user/ngie/stable-10-libnv/sys/conf/kmod.mk Sun Jan 3 09:19:54 2016 (r293095) +++ user/ngie/stable-10-libnv/sys/conf/kmod.mk Sun Jan 3 09:38:05 2016 (r293096) @@ -357,7 +357,7 @@ MFILES?= dev/acpica/acpi_if.m dev/acpi_s dev/mmc/mmcbr_if.m dev/mmc/mmcbus_if.m \ dev/mii/miibus_if.m dev/mvs/mvs_if.m dev/ofw/ofw_bus_if.m \ dev/pccard/card_if.m dev/pccard/power_if.m dev/pci/pci_if.m \ - dev/pci/pcib_if.m dev/ppbus/ppbus_if.m \ + dev/pci/pci_iov_if.m dev/pci/pcib_if.m dev/ppbus/ppbus_if.m \ dev/sdhci/sdhci_if.m dev/smbus/smbus_if.m dev/spibus/spibus_if.m \ dev/sound/pci/hda/hdac_if.m \ dev/sound/pcm/ac97_if.m dev/sound/pcm/channel_if.m \ Modified: user/ngie/stable-10-libnv/sys/dev/ixl/if_ixl.c ============================================================================== --- user/ngie/stable-10-libnv/sys/dev/ixl/if_ixl.c Sun Jan 3 09:19:54 2016 (r293095) +++ user/ngie/stable-10-libnv/sys/dev/ixl/if_ixl.c Sun Jan 3 09:38:05 2016 (r293096) @@ -207,8 +207,8 @@ static int ixl_sysctl_switch_config(SYSC #ifdef PCI_IOV static int ixl_adminq_err_to_errno(enum i40e_admin_queue_err err); -static int ixl_init_iov(device_t dev, uint16_t num_vfs, const nvlist_t*); -static void ixl_uninit_iov(device_t dev); +static int ixl_iov_init(device_t dev, uint16_t num_vfs, const nvlist_t*); +static void ixl_iov_uninit(device_t dev); static int ixl_add_vf(device_t dev, uint16_t vfnum, const nvlist_t*); static void ixl_handle_vf_msg(struct ixl_pf *, @@ -230,9 +230,9 @@ static device_method_t ixl_methods[] = { DEVMETHOD(device_detach, ixl_detach), DEVMETHOD(device_shutdown, ixl_shutdown), #ifdef PCI_IOV - DEVMETHOD(pci_init_iov, ixl_init_iov), - DEVMETHOD(pci_uninit_iov, ixl_uninit_iov), - DEVMETHOD(pci_add_vf, ixl_add_vf), + DEVMETHOD(pci_iov_init, ixl_iov_init), + DEVMETHOD(pci_iov_uninit, ixl_iov_uninit), + DEVMETHOD(pci_iov_add_vf, ixl_add_vf), #endif {0, 0} }; @@ -6546,7 +6546,7 @@ ixl_adminq_err_to_errno(enum i40e_admin_ } static int -ixl_init_iov(device_t dev, uint16_t num_vfs, const nvlist_t *params) +ixl_iov_init(device_t dev, uint16_t num_vfs, const nvlist_t *params) { struct ixl_pf *pf; struct i40e_hw *hw; @@ -6594,7 +6594,7 @@ fail: } static void -ixl_uninit_iov(device_t dev) +ixl_iov_uninit(device_t dev) { struct ixl_pf *pf; struct i40e_hw *hw; Modified: user/ngie/stable-10-libnv/sys/dev/ixl/ixl.h ============================================================================== --- user/ngie/stable-10-libnv/sys/dev/ixl/ixl.h Sun Jan 3 09:19:54 2016 (r293095) +++ user/ngie/stable-10-libnv/sys/dev/ixl/ixl.h Sun Jan 3 09:38:05 2016 (r293096) @@ -93,6 +93,7 @@ #ifdef PCI_IOV #include <sys/nv.h> #include <sys/iov_schema.h> +#include <dev/pci/pci_iov.h> #endif #include "i40e_type.h" Modified: user/ngie/stable-10-libnv/sys/dev/pci/pci_if.m ============================================================================== --- user/ngie/stable-10-libnv/sys/dev/pci/pci_if.m Sun Jan 3 09:19:54 2016 (r293095) +++ user/ngie/stable-10-libnv/sys/dev/pci/pci_if.m Sun Jan 3 09:38:05 2016 (r293096) @@ -214,22 +214,6 @@ METHOD int iov_detach { device_t child; }; -METHOD int init_iov { - device_t dev; - uint16_t num_vfs; - const struct nvlist *config; -}; - -METHOD void uninit_iov { - device_t dev; -}; - -METHOD int add_vf { - device_t dev; - uint16_t vfnum; - const struct nvlist *config; -}; - METHOD device_t create_iov_child { device_t bus; device_t pf; @@ -237,4 +221,3 @@ METHOD device_t create_iov_child { uint16_t vid; uint16_t did; } DEFAULT null_create_iov_child; - Modified: user/ngie/stable-10-libnv/sys/dev/pci/pci_iov.c ============================================================================== --- user/ngie/stable-10-libnv/sys/dev/pci/pci_iov.c Sun Jan 3 09:19:54 2016 (r293095) +++ user/ngie/stable-10-libnv/sys/dev/pci/pci_iov.c Sun Jan 3 09:38:05 2016 (r293096) @@ -53,11 +53,11 @@ __FBSDID("$FreeBSD$"); #include <dev/pci/pcireg.h> #include <dev/pci/pcivar.h> +#include <dev/pci/pci_iov.h> #include <dev/pci/pci_private.h> #include <dev/pci/pci_iov_private.h> #include <dev/pci/schema_private.h> -#include "pci_if.h" #include "pcib_if.h" static MALLOC_DEFINE(M_SRIOV, "sr_iov", "PCI SR-IOV allocations"); @@ -479,13 +479,13 @@ pci_iov_config_page_size(struct pci_devi } static int -pci_init_iov(device_t dev, uint16_t num_vfs, const nvlist_t *config) +pci_iov_init(device_t dev, uint16_t num_vfs, const nvlist_t *config) { const nvlist_t *device, *driver_config; device = nvlist_get_nvlist(config, PF_CONFIG_NAME); driver_config = nvlist_get_nvlist(device, DRIVER_CONFIG_NAME); - return (PCI_INIT_IOV(dev, num_vfs, driver_config)); + return (PCI_IOV_INIT(dev, num_vfs, driver_config)); } static int @@ -591,7 +591,7 @@ pci_iov_enumerate_vfs(struct pci_devinfo pci_iov_add_bars(iov, vfinfo); - error = PCI_ADD_VF(dev, i, driver_config); + error = PCI_IOV_ADD_VF(dev, i, driver_config); if (error != 0) { device_printf(dev, "Failed to add VF %d\n", i); pci_delete_child(bus, vf); @@ -648,7 +648,7 @@ pci_iov_config(struct cdev *cdev, struct if (error != 0) goto out; - error = pci_init_iov(dev, num_vfs, config); + error = pci_iov_init(dev, num_vfs, config); if (error != 0) goto out; iov_inited = 1; @@ -696,7 +696,7 @@ pci_iov_config(struct cdev *cdev, struct return (0); out: if (iov_inited) - PCI_UNINIT_IOV(dev); + PCI_IOV_UNINIT(dev); for (i = 0; i <= PCIR_MAX_BAR_0; i++) { if (iov->iov_bar[i].res != NULL) { @@ -789,7 +789,7 @@ pci_iov_delete(struct cdev *cdev) if (pci_iov_is_child_vf(iov, vf)) pci_delete_child(bus, vf); } - PCI_UNINIT_IOV(dev); + PCI_IOV_UNINIT(dev); iov_ctl = IOV_READ(dinfo, PCIR_SRIOV_CTL, 2); iov_ctl &= ~(PCIM_SRIOV_VF_EN | PCIM_SRIOV_VF_MSE); Copied: user/ngie/stable-10-libnv/sys/dev/pci/pci_iov.h (from r283670, head/sys/dev/pci/pci_iov.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/ngie/stable-10-libnv/sys/dev/pci/pci_iov.h Sun Jan 3 09:38:05 2016 (r293096, copy of r283670, head/sys/dev/pci/pci_iov.h) @@ -0,0 +1,49 @@ +/*- + * Copyright (c) 2013-2015 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$ + */ + +#ifndef _PCI_IOV_H_ +#define _PCI_IOV_H_ + +#include "pci_iov_if.h" + +struct nvlist; + +static __inline int +pci_iov_attach(device_t dev, struct nvlist *pf_schema, struct nvlist *vf_schema) +{ + return (PCI_IOV_ATTACH(device_get_parent(dev), dev, pf_schema, + vf_schema)); +} + +static __inline int +pci_iov_detach(device_t dev) +{ + return (PCI_IOV_DETACH(device_get_parent(dev), dev)); +} + +#endif /* !_PCI_IOV_H_ */ Copied: user/ngie/stable-10-libnv/sys/dev/pci/pci_iov_if.m (from r283670, head/sys/dev/pci/pci_iov_if.m) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/ngie/stable-10-libnv/sys/dev/pci/pci_iov_if.m Sun Jan 3 09:38:05 2016 (r293096, copy of r283670, head/sys/dev/pci/pci_iov_if.m) @@ -0,0 +1,52 @@ +#- +# Copyright (c) 2013-2015 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$ +# + +#include <sys/bus.h> + +INTERFACE pci_iov; + +HEADER { + struct nvlist; +} + + +METHOD int init { + device_t dev; + uint16_t num_vfs; + const struct nvlist *config; +}; + +METHOD void uninit { + device_t dev; +}; + +METHOD int add_vf { + device_t dev; + uint16_t vfnum; + const struct nvlist *config; +}; Modified: user/ngie/stable-10-libnv/sys/dev/pci/pcivar.h ============================================================================== --- user/ngie/stable-10-libnv/sys/dev/pci/pcivar.h Sun Jan 3 09:19:54 2016 (r293095) +++ user/ngie/stable-10-libnv/sys/dev/pci/pcivar.h Sun Jan 3 09:38:05 2016 (r293096) @@ -39,8 +39,6 @@ typedef uint64_t pci_addr_t; -struct nvlist; - /* Interesting values for PCI power management */ struct pcicfg_pp { uint16_t pp_cap; /* PCI power management capabilities */ @@ -526,19 +524,6 @@ pci_child_added(device_t dev) return (PCI_CHILD_ADDED(device_get_parent(dev), dev)); } -static __inline int -pci_iov_attach(device_t dev, struct nvlist *pf_schema, struct nvlist *vf_schema) -{ - return (PCI_IOV_ATTACH(device_get_parent(dev), dev, pf_schema, - vf_schema)); -} - -static __inline int -pci_iov_detach(device_t dev) -{ - return (PCI_IOV_DETACH(device_get_parent(dev), dev)); -} - device_t pci_find_bsf(uint8_t, uint8_t, uint8_t); device_t pci_find_dbsf(uint32_t, uint8_t, uint8_t, uint8_t); device_t pci_find_device(uint16_t, uint16_t); Modified: user/ngie/stable-10-libnv/sys/modules/ixl/Makefile ============================================================================== --- user/ngie/stable-10-libnv/sys/modules/ixl/Makefile Sun Jan 3 09:19:54 2016 (r293095) +++ user/ngie/stable-10-libnv/sys/modules/ixl/Makefile Sun Jan 3 09:38:05 2016 (r293096) @@ -5,7 +5,7 @@ .PATH: ${.CURDIR}/../../dev/ixl KMOD = if_ixl -SRCS = device_if.h bus_if.h pci_if.h opt_bdg.h +SRCS = device_if.h bus_if.h pci_if.h pci_iov_if.h opt_bdg.h SRCS += opt_inet.h opt_inet6.h SRCS += if_ixl.c ixl_txrx.c i40e_osdep.c
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601030938.u039c6wu035142>