JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Writing Device Drivers     Oracle Solaris 11 Information Library
search filter icon
search icon

Document Information


Part I Designing Device Drivers for the Oracle Solaris Platform

1.  Overview of Oracle Solaris Device Drivers

2.  Oracle Solaris Kernel and Device Tree

3.  Multithreading

4.  Properties

5.  Managing Events and Queueing Tasks

6.  Driver Autoconfiguration

7.  Device Access: Programmed I/O

8.  Interrupt Handlers

9.  Direct Memory Access (DMA)

10.  Mapping Device and Kernel Memory

11.  Device Context Management

12.  Power Management

13.  Hardening Oracle Solaris Drivers

14.  Layered Driver Interface (LDI)

Part II Designing Specific Kinds of Device Drivers

15.  Drivers for Character Devices

16.  Drivers for Block Devices

17.  SCSI Target Drivers

18.  SCSI Host Bus Adapter Drivers

19.  Drivers for Network Devices

20.  USB Drivers

21.  SR-IOV Drivers

Introduction to SR-IOV

Benefits of SR-IOV

Supported Platforms


Overview of SR-IOV Device Driver

Physical Function (PF) Driver

Virtual Function (VF) Driver

Device Configuration Parameters

pci.conf File

Setting Device Configuration Parameters

SR-IOV Configuration on Sparc OVM Platform

SR-IOV Configuration on Bare Metal Platforms

Boot Configuration Sequence

SR-IOV Interfaces Summary

Driver Ioctls

Interfaces for SR-IOV Drivers

pci_param_get() Interface

pci_param_get_ioctl() Interface

pci_plist_get() Interface

pci_plist_getvf() Interface

pciv_vf_config() Interface

pci_plist_lookup() Interface

pci_param_free() Interface

pciv_send() Interface

SR-IOV Driver Ioctls

Data Structures

iov_param_ver_info Structure

iov_param_validate Structure

iov_param_desc Structure




Driver Callbacks

Sample Code for Driver Ioctls

Part III Building a Device Driver

22.  Compiling, Loading, Packaging, and Testing Drivers

23.  Debugging, Testing, and Tuning Device Drivers

24.  Recommended Coding Practices

Part IV Appendixes

A.  Hardware Overview

B.  Summary of Oracle Solaris DDI/DKI Services

C.  Making a Device Driver 64-Bit Ready

D.  Console Frame Buffer Drivers

E.  pci.conf File


Overview of SR-IOV Device Driver

The SR-IOV functionality is comprised of the Physical Function (PF) driver and the Virtual Function (VF) driver. The following sections describe the PF and VF drivers and the details of the required device configuration.

Physical Function (PF) Driver

The PF driver of a SR-IOV device is used to manage the Physical Function (PF) of an SR-IOV capable device. A PCI Function that supports the SR-IOV capabilities is defined in the SR-IOV specification. A PF contains the SR-IOV capability structure and is used to manage the SR-IOV functionality. PFs are fully featured PCIe functions which can be discovered, managed, and manipulated like any other PCIe device. PFs have full configuration resources, and can be used to configure or control the PCIe device. A PF driver exhibits the following characteristics:

Virtual Function (VF) Driver

A function that is associated with a Physical Function. A VF is a lightweight PCIe function that shares one or more physical resources with the Physical Function and with other VFs that are associated with the same PF. A VF driver exhibits the following characteristics:

Note - The SR-IOV Capable PF and VF drivers have to register Interrupt Resource Management (IRM) callbacks and provide support for this feature. See Chapter 8, Interrupt Handlers for details and usage of IRM interfaces.

Note - If the VF is a network VF, the following parameters can be configured after the numVFs are enabled. The configuration should be completed before the VFs are enabled.

Device Configuration Parameters

The PF driver must support the configuration parameters listed in the following table. These parameters may be exported to the Sparc OVM Manager. Configuration is complete only when all the parameters are configured.

Table 21-1 Configuration Parameters Definition

Configuration Parameters
Standards related configuration parameters
Number of VFs it can support

Note - Changes to the number of VFs require the PF device to detach and attach again.

max-config-vfs – Maximum number of VFs that can actually be configured. A PF driver can export this parameter when the maximum number of VFs that a PF driver supports is different from the capability indicated by the SR-IOV functionality.
Resource and device-specific parameters
Bandwidth, pools, and Q-pairs. Changes to these parameters can affect both PF and VF drivers.

The framework may not be aware of device-specific parameters and they may be known only to the PF driver. These parameters should be known before enabling the VFs so that a PF driver initializes its hardware appropriately

See igb(7D) and ixgbe(7D) to learn how to obtain the device specific parameters that are exported to the IOV framework.

  • pvid-exclusive – Indicates that a port-vlan-id and vlan-ids cannot be supported at the same time.
  • max-vf-mtu – Maximum MTU allowed for a VF.

  • max-vlans – Maximum number of vlan slots supported by the network class PF driver.

Class-specific parameters
Common properties based on the class of the device. For example, Ethernet devices may have properties such as MAC addresses, VLAN-Ids, Port-VLAN-ID, bandwidth and so on.

Class specific configuration is expected to be used and may define the behavior of each of the parameters.


Note - When device configuration parameters are changed, the devices should be reattached.

Note - Configure the parameters in the following order before enabling the VFs. Class specific parameters will be based on the class specific configurator.

  1. Standards–related parameters

  2. Resource and device–specific parameters

  3. Class–specific parameters

pci.conf File

The PCI configuration information file, /etc/pci.conf enables the system to save PCI configurations such as the number of VFs of a particular PF. The pci.conf file provides the following:

See Appendix E, pci.conf File for more information.

Setting Device Configuration Parameters

Example 21-1 Setting Device Configuration Parameters


VF[0] = {
        primary-mac-addr = 0xaabbccddeeff
        alt-mac-addrs = 0x102233445556, 0x102233445557
        vlan-id = 20, 30

VF[1] = {
        primary-mac-addr = 0xaabbccddeef1
        alt-mac-addrs = 0x102233445568
        vlan-id = 20, 30, 40, 50

SR-IOV Configuration on Sparc OVM Platform

The Sparc OVM Manager is responsible for the SR-IOV configuration on all Sparc OVM platforms. The Sparc OVM Manager is responsible for the following operations:

The following figure shows a high-level view of the Sparc OVM configuration.

Figure 21-2 High-Level View of Sparc OVM Configuration

image:The figure shows a high-level view of the Sparc OVM Configuration

SR-IOV Configuration on Bare Metal Platforms

At the time of Oracle Solaris 11 release, no configuration tool is available to configure SR-IOV on bare metal platforms, including x86.