In the simplest of SR-IOV supported configurations each physical port is exposed as a single PF (adapter default) and up to 240 VFs.
The AMD Solarflare net driver (sfc.ko) detects that PF/VFs are present from the sfboot configuration and automatically configure the virtual adapters and virtual ports as required.
Adapter firmware also configures the firmware switching functions allowing packets to pass between PF and VFs or from VF to VF.
- With no VLAN configuration, the PFs and VFs are in the same Ethernet layer 2 broadcast domain, so any packet broadcast from the PF is received by all VFs. VLAN tags can optionally be assigned to VFs using standard libvirt commands.
- The L2 switch supports replication of received/transmitted broadcast packets to all functions.
- The L2 switch replicates received/transmitted multicast packets to all functions that have subscribed.
- The MUXER function is a firmware enabled layer2 switching function for transmit and receive traffic.
In the example above there are no virtual machines (VM) created. Network interfaces for the PF and each VF appear in the host. An sfc NIC driver loaded in the host identifies the PF and each VF as individual network interfaces.
Configuring Basic SR-IOV
To configure a basic SR-IOV setup:
- Ensure SR-IOV and the IOMMU are enabled on the host server
kernel command line.
Refer to Setting Up the Server for SR-IOV.
- Ensure the AMD Solarflare adapter driver (sfc.ko) is installed on the host.
-
Enable VFs on the adapter by loading a configuration file onto it. These example parameters select the full_featured firmware variant (which is required), and configure two VFs per PF:
[global] firmware_variant=full_featured vf_count=2Refer to Configuring the Adapter for SR-IOV.
- Give the server a cold reboot to perform the adapter reconfiguration.
- Create the VFs, up to the maximum number of VFs that you enabled
in step 3. For
example using sysfs to create two VFs on
the eth8
PF:
echo 2 > /sys/class/net/eth8/device/sriov_numvfsConfirm the setting you have made:
cat /sys/class/net/eth8/device/sriov_totalvfsRefer to arz1599571718498.html#arz1599571718498__.
Examining PFs and VFs
You can examine the PFs and VFs to get information about them:
- To view the
PCI®
addresses for the PFs and VFs, use the
lspcicommand. The following examples are from a dual-port adapter.If the record of PCI® IDs on your server is up to date, output is detailed:
# lspci -D -d1924: 0000:03:00.0 Ethernet controller: AMD Solarflare NS9480 1/10/25/40/50/100Gb Ethernet Controller PLUS 0000:03:00.1 Ethernet controller: AMD Solarflare NS9480 1/10/25/40/50/100Gb Ethernet Controller PLUS 0000:03:00.2 Ethernet controller: AMD Solarflare NS9480 1/10/25/40/50/100Gb Ethernet Controller PLUS (Virtual Function) 0000:03:00.3 Ethernet controller: AMD Solarflare NS9480 1/10/25/40/50/100Gb Ethernet Controller PLUS (Virtual Function) 0000:03:00.4 Ethernet controller: AMD Solarflare NS9480 1/10/25/40/50/100Gb Ethernet Controller PLUS (Virtual Function) 0000:03:00.5 Ethernet controller: AMD Solarflare NS9480 1/10/25/40/50/100Gb Ethernet Controller PLUS (Virtual Function)Otherwise the output shows PCI® device IDs, where the PFs are shown as
Device 0c03, and the VFs are presented as eitherDevice 1c03orDevice 3c03:# lspci -D -d1924: 0000:03:00.0 Ethernet controller: AMD Solarflare Device 0c03 0000:03:00.1 Ethernet controller: AMD Solarflare Device 0c03 0000:03:00.2 Ethernet controller: AMD Solarflare Device 3c03 0000:03:00.3 Ethernet controller: AMD Solarflare Device 3c03 0000:03:00.4 Ethernet controller: AMD Solarflare Device 3c03 0000:03:00.5 Ethernet controller: AMD Solarflare Device 3c03 - To view the interface names for the PFs and VFs, use the
ifconfigcommand:# ifconfig eth4 Link encap:Ethernet HWaddr 74:27:2C:21:00:60 eth5 Link encap:Ethernet HWaddr 74:27:2C:21:00:61 eth6 Link encap:Ethernet HWaddr AE:82:AB:C9:67:49 eth7 Link encap:Ethernet HWaddr 86:B4:C8:9E:27:D6 eth8 Link encap:Ethernet HWaddr 72:0B:C7:21:E1:59 eth9 Link encap:Ethernet HWaddr D2:B7:68:54:35:A5This example is from a dual-port adapter. The output is abbreviated. It shows two PFs and four VFs:
- MAC addresses beginning
74:27:2Care AMD Solarflare designated hardware addresses, used for PFs.So in this example, the PFs are eth4 and eth5 .
- MAC addresses assigned to VFs are randomly generated by
the host.
So in this example, the VFs are eth6 - eth9 inclusive.
- MAC addresses visible to the host are replaced by libvirt-generated MAC addresses in a VM.
- MAC addresses beginning
- To identify which physical port a given network interface is
using, use the following command:
# cat /sys/class/net/eth<N>/device/physical_port - To identify which PF a given VF is associated with, use the
ip link showcommand:# ip link show 19: eth4: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN qlen 1000 link/ether 74:27:2c:21:00:61 brd ff:ff:ff:ff:ff:ff vf 0 MAC 76:c1:36:0a:be:2b vf 1 MAC 1e:b8:a8:ea:c7:fb vf 2 MAC 52:6e:32:3d:50:85 vf 3 MAC b6:ad:a0:56:39:94In this example there are four VFs assigned to PF eth4.