Add a driver to create VF devices on Chelsio T4/T5 NICs.
authorjhb <jhb@FreeBSD.org>
Fri, 22 Jul 2016 22:46:41 +0000 (22:46 +0000)
committerjhb <jhb@FreeBSD.org>
Fri, 22 Jul 2016 22:46:41 +0000 (22:46 +0000)
commit1c08175b6209252ebb89aa08ceaccf837d07125b
tree2b0b0491c4c9357b502f4d57f645808d4b6aa2c0
parentbfb9bd811df47f87f887e87516515983c31a1669
Add a driver to create VF devices on Chelsio T4/T5 NICs.

Chelsio NICs are a bit unique compared to some other NICs in that they
expose different functionality on different physical functions.  In
particular, PF4 is used to manage the NIC interfaces ('t4nex' and 't5nex').
However, PF4 is not able to create VF devices.  Instead, VFs are only
supported by physical functions 0 through 3.  This commit adds 't4iov'
and 't5iov' drivers that attach to PF0-3.

One extra wrinkle is that the iov devices cannot enable SR-IOV until the
firwmare has been initialized by the main PF4 driver.  To handle this
case, a new t4_if kobj interface has been added to permit cross-calls
between the PF drivers.  The PF4 driver notifies sibling drivers when it
is fully attached.  It also requests sibling drivers to detach before it
detaches.  Sibling drivers query the PF4 driver during their attach
routine to see if it is attached.  If not, the sibling drivers defer
their attach actions until the PF4 driver informs them it is attached.

VF devices are associated with a single port on the NIC.  VF devices
created from PF0 are associated with the first port on the NIC, VFs
from PF1 are associated with the second port, etc.  VF devices can
only be created from a PF device that has an associated port.  Thus,
on a 2-port card, VFs are only supported on PF0 and PF1.

Reviewed by: np (earlier versions)
MFC after: 1 month
Sponsored by: Chelsio Communications
sys/conf/files
sys/dev/cxgbe/t4_if.m [new file with mode: 0644]
sys/dev/cxgbe/t4_iov.c [new file with mode: 0644]
sys/dev/cxgbe/t4_main.c
sys/modules/cxgbe/if_cxgbe/Makefile