IGB Nic MAC address is 0 o'clock VF can not be used in the guest how to solve

Source: Internet
Author: User
Tags diff

After using Linux 3.9 as the core of the KVM host, you may experience an IGB when you assign the VF (IGBVF) to use the Sr-iov of an Intel NIC (such as: 82576, I350). You can see the following error message in the guest's DMESG:

The code is as follows Copy Code
IGBVF 0000:00:03.0:IRQ for Msi/msi-x
IGBVF 0000:00:03.0:invalid MAC address:00:00:00:00:00:00
Igbvf:probe of 0000:00:03.0 failed with error-5


That is, the IGBVF MAC address detected in guest is full 0, such as the bug on the kernel (KVM) Bugzilla:
https://bugzilla.kernel.org/show_bug.cgi?id=55421

After analysis, the reason for this problem is that in the latest IGB driver in IGBF use, the default setting of its MAC address is all 0, and before the setting of a random Mac, you can see the following patch really to do this thing.

The code is as follows Copy Code
[Root@jay-linux kvm.git]# git diff 5ac6f91d39e088^ 5ac6f91d39e088
Diff--git A/drivers/net/ethernet/intel/igb/igb_main.c B/drivers/net/ethernet/intel/igb/igb_main.c
Index b81a953. a59e630 100644
---a/drivers/net/ethernet/intel/igb/igb_main.c
+++ B/DRIVERS/NET/ETHERNET/INTEL/IGB/IGB_MAIN.C
@@ -5197,7 +5197,7 @@ -5197,7 int igb_vf_configure (struct igb_adapter *adapter, int vf)
{
unsigned char Mac_addr[eth_alen];

-Eth_random_addr (MAC_ADDR);
+ eth_zero_addr (MAC_ADDR);
Igb_set_vf_mac (Adapter, VF, MAC_ADDR);

return 0;
@@ -5550,9 +5550,9 @@ -5550,9 void igb_vf_reset_event (struct igb_adapter *adapter, u32 VF)
{
unsigned char *vf_mac = adapter->vf_data[vf].vf_mac_addresses;

-* Generate a new MAC address as we were hotplug removed/added * *
+/* Clear MAC address as we were hotplug removed/added * *
if (!) ( Adapter->vf_data[vf].flags & Igb_vf_flag_pf_set_mac))
-Eth_random_addr (VF_MAC);
+ eth_zero_addr (VF_MAC);

/* Process remaining reset Events * *
Igb_vf_reset (adapter, VF);



As for why set to all 0 and do not use the random Mac, this is mainly because of the random Mac in the guest and udev not very good work, many times after using VF will let ETHX (x number) of the number of continuous growth change, may become eth500, eth666 and so on, Very unfriendly to the user.

So in KVM, for the IGB Nic Sr-iov operation, need to pay attention to the following two methods (note that use one of the methods to avoid VF mac all 0):

1. Before assigning VF to client, you need to set the MAC address of IGBVF in host, command as follows:

The code is as follows Copy Code
[Root@jay-linux ~]# IP link set eth0 VF 0 mac 00:1e:67:65:93:01
# eth0 is the interface name for PF in host, 0 is the VF (that is, the first VF) with the PF number 0.

# If you do not know the PF and VF correspondence, you can use the command below to check to make sure
[Root@jay-linux ~]# ethtool-i eth0
Driver:igb
Version:4.1.2-k
firmware-version:1.64, 0X800006FC
bus-info:0000:0a:00.0
Supports-statistics:yes
Supports-test:yes
Supports-eeprom-access:yes
Supports-register-dump:yes
Supports-priv-flags:no
[Root@jay-linux ~]# ls-l/sys/bus/pci/devices/0000:0a:00.0/virtfn*
lrwxrwxrwx 1 root 0 Apr 15:09/sys/bus/pci/devices/0000:0a:00.0/virtfn0->. /0000:0b:10.0
lrwxrwxrwx 1 root 0 Apr 15:09/sys/bus/pci/devices/0000:0a:00.0/virtfn1->. /0000:0b:10.4
lrwxrwxrwx 1 root 0 Apr 15:09/sys/bus/pci/devices/0000:0a:00.0/virtfn2->. /0000:0b:11.0
lrwxrwxrwx 1 root 0 Apr 15:09/sys/bus/pci/devices/0000:0a:00.0/virtfn3->. /0000:0b:11.4
lrwxrwxrwx 1 root 0 Apr 15:09/sys/bus/pci/devices/0000:0a:00.0/virtfn4->. /0000:0b:12.0
lrwxrwxrwx 1 root 0 Apr 15:09/sys/bus/pci/devices/0000:0a:00.0/virtfn5->. /0000:0b:12.4
lrwxrwxrwx 1 root 0 Apr 15:09/sys/bus/pci/devices/0000:0a:00.0/virtfn6->. /0000:0b:13.0


2. Upgrade the kernel or IGBVF driver in guest and find that you can use IGBVF after upgrading a rhel6.4 guest's kernel to Linux 3.9 (although you did not manually set the IGBVF Mac in the host in the first method).

This is because the latest IGBVF driver has also done special processing when it detects Mac as full 0 o'clock.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.