Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F148950937
D2584.id5748.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
12 KB
Referenced Files
None
Subscribers
None
D2584.id5748.diff
View Options
Index: share/man/man9/Makefile
===================================================================
--- share/man/man9/Makefile
+++ share/man/man9/Makefile
@@ -195,10 +195,10 @@
p_candebug.9 \
p_cansee.9 \
pci.9 \
- PCI_ADD_VF.9 \
- PCI_INIT_IOV.9 \
+ PCI_IOV_ADD_VF.9 \
+ PCI_IOV_INIT.9 \
pci_iov_schema.9 \
- PCI_UNINIT_IOV.9 \
+ PCI_IOV_UNINIT.9 \
pfil.9 \
pfind.9 \
pget.9 \
Index: share/man/man9/PCI_IOV_ADD_VF.9
===================================================================
--- share/man/man9/PCI_IOV_ADD_VF.9
+++ share/man/man9/PCI_IOV_ADD_VF.9
@@ -26,10 +26,10 @@
.\" $FreeBSD$
.\"
.Dd May 24, 2014
-.Dt PCI_ADD_VF 9
+.Dt PCI_IOV_ADD_VF 9
.Os
.Sh NAME
-.Nm PCI_ADD_VF
+.Nm PCI_IOV_ADD_VF
.Nd inform a PF driver that a VF is being created
.Sh SYNOPSIS
.In sys/bus.h
@@ -38,25 +38,25 @@
.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"
+.Fn PCI_IOV_ADD_VF "device_t dev" "uint16_t vfnum" "const nvlist_t *vf_config"
.Sh DESCRIPTION
The
-.Fn PCI_ADD_VF
+.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_INIT_IOV 9
+.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_INIT_IOV 9 .
+.Xr PCI_IOV_INIT 9 .
If the infrastructure encounters a failure to allocate resources following the
call to
-.Xr PCI_INIT_IOV 9 ,
+.Xr PCI_IOV_INIT 9 ,
the VF creation will be aborted and
-.Xr PCI_UNINIT_IOV 9
+.Xr PCI_IOV_UNINIT 9
will be called immediately without any preceding calls to
.Nm .
.Pp
@@ -87,15 +87,15 @@
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_ADD_VF
+.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_UNINIT_IOV 9
+.Xr PCI_IOV_UNINIT 9
and
-.Xr PCI_INIT_IOV 9
+.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.
@@ -106,8 +106,8 @@
.Xr nv 9 ,
.Xr pci 9 ,
.Xr pci_iov_schema 9 ,
-.Xr PCI_INIT_IOV 9 ,
-.Xr PCI_UNINIT_IOV 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 .
Index: share/man/man9/PCI_IOV_INIT.9
===================================================================
--- share/man/man9/PCI_IOV_INIT.9
+++ share/man/man9/PCI_IOV_INIT.9
@@ -26,10 +26,10 @@
.\" $FreeBSD$
.\"
.Dd May 24, 2014
-.Dt PCI_INIT_IOV 9
+.Dt PCI_IOV_INIT 9
.Os
.Sh NAME
-.Nm PCI_INIT_IOV
+.Nm PCI_IOV_INIT
.Nd enable SR-IOV on a PF device
.Sh SYNOPSIS
.In sys/bus.h
@@ -38,10 +38,10 @@
.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"
+.Fn PCI_IOV_INIT "device_t dev" "uint16_t num_vfs" "const nvlist_t *pf_config"
.Sh DESCRIPTION
The
-.Fn PCI_INIT_IOV
+.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).
@@ -70,7 +70,7 @@
.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_UNINIT_IOV .
+.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
@@ -79,8 +79,8 @@
.Xr nv 9 ,
.Xr pci 9 ,
.Xr pci_iov_schema 9 ,
-.Xr PCI_ADD_VF 9 ,
-.Xr PCI_UNINIT_IOV 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 .
Index: share/man/man9/PCI_IOV_UNINIT.9
===================================================================
--- share/man/man9/PCI_IOV_UNINIT.9
+++ share/man/man9/PCI_IOV_UNINIT.9
@@ -26,20 +26,20 @@
.\" $FreeBSD$
.\"
.Dd May 24, 2014
-.Dt PCI_UNINIT_IOV 9
+.Dt PCI_IOV_UNINIT 9
.Os
.Sh NAME
-.Nm PCI_UNINIT_IOV
+.Nm PCI_IOV_UNINIT
.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"
+.Fn PCI_IOV_UNINIT "device_t dev"
.Sh DESCRIPTION
The
-.Fn PCI_UNINIT_IOV
+.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).
@@ -48,17 +48,17 @@
configuration in the device.
.Pp
This method will only be called following a successful call to
-.Xr PCI_INIT_IOV .
+.Xr PCI_IOV_INIT .
It is not guaranteed that
-.Xr PCI_ADD_VF
+.Xr PCI_IOV_ADD_VF
will have been called for any Virtual Function (VF) after the call to
-.Xr PCI_INIT_IOV
+.Xr PCI_IOV_INIT
and before the call to
.Nm .
.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 Mt rstone@FreeBSD.org .
Index: share/man/man9/pci.9
===================================================================
--- share/man/man9/pci.9
+++ share/man/man9/pci.9
@@ -446,10 +446,10 @@
supports PCI Single-Root I/O Virtualization
.Po SR-IOV Pc .
A driver that supports SR-IOV must implement the
-.Xr PCI_INIT_IOV 9 ,
-.Xr PCI_ADD_VF 9
+.Xr PCI_IOV_INIT 9 ,
+.Xr PCI_IOV_ADD_VF 9
and
-.Xr PCI_UNIT_IOV 9
+.Xr PCI_IOV_UNINIT 9
methods.
This function should be called during the
.Xr DEVICE_ATTACH 9
Index: share/man/man9/pci_iov_schema.9
===================================================================
--- share/man/man9/pci_iov_schema.9
+++ share/man/man9/pci_iov_schema.9
@@ -258,8 +258,8 @@
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 .
Index: sys/conf/files
===================================================================
--- sys/conf/files
+++ sys/conf/files
@@ -2024,6 +2024,7 @@
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
Index: sys/conf/kmod.mk
===================================================================
--- sys/conf/kmod.mk
+++ sys/conf/kmod.mk
@@ -349,7 +349,7 @@
dev/mbox/mbox_if.m 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 \
Index: sys/dev/ixl/if_ixl.c
===================================================================
--- sys/dev/ixl/if_ixl.c
+++ sys/dev/ixl/if_ixl.c
@@ -199,8 +199,8 @@
#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 *,
@@ -222,9 +222,9 @@
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}
};
@@ -6456,7 +6456,7 @@
}
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;
@@ -6504,7 +6504,7 @@
}
static void
-ixl_uninit_iov(device_t dev)
+ixl_iov_uninit(device_t dev)
{
struct ixl_pf *pf;
struct i40e_hw *hw;
Index: sys/dev/pci/pci_if.m
===================================================================
--- sys/dev/pci/pci_if.m
+++ sys/dev/pci/pci_if.m
@@ -214,22 +214,6 @@
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 @@
uint16_t vid;
uint16_t did;
} DEFAULT null_create_iov_child;
-
Index: sys/dev/pci/pci_iov.c
===================================================================
--- sys/dev/pci/pci_iov.c
+++ sys/dev/pci/pci_iov.c
@@ -58,6 +58,7 @@
#include <dev/pci/schema_private.h>
#include "pci_if.h"
+#include "pci_iov_if.h"
#include "pcib_if.h"
static MALLOC_DEFINE(M_SRIOV, "sr_iov", "PCI SR-IOV allocations");
@@ -483,13 +484,13 @@
}
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
@@ -595,7 +596,7 @@
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);
@@ -652,7 +653,7 @@
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;
@@ -700,7 +701,7 @@
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) {
@@ -793,7 +794,7 @@
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);
Index: sys/dev/pci/pci_iov_if.m
===================================================================
--- /dev/null
+++ sys/dev/pci/pci_iov_if.m
@@ -0,0 +1,52 @@
+#-
+# Copyright (c) 1998 Doug Rabson
+# 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;
+};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 22, 6:37 AM (4 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30111372
Default Alt Text
D2584.id5748.diff (12 KB)
Attached To
Mode
D2584: Create a separate interface for leaf-driver PCI IOV methods.
Attached
Detach File
Event Timeline
Log In to Comment