Bug 253535

Summary: em - VF interface invalid MAC address
Product: Base System Reporter: Balaev PA <mail>
Component: kernAssignee: Kevin Bowling <kbowling>
Status: Closed FIXED    
Severity: Affects Some People CC: kbowling, mail
Priority: --- Keywords: IntelNetworking
Version: CURRENTFlags: kbowling: mfc-stable13+
kbowling: mfc-stable12+
kbowling: mfc-stable11-
Hardware: Any   
OS: Any   
Attachments:
Description Flags
em VF MAC address patch none

Description Balaev PA 2021-02-15 13:22:19 UTC
Created attachment 222466 [details]
em VF MAC address patch

I have a host with I350 Ethernet Controller Virtual Function [8086:1520], when I try to passthrough it into FreeBSD (running on QEMU '-device vfio-pci,host=04:10.1') I get an error:
igb0: Invalid MAC address
igb0: IFDI_ATTACH_PRE failed 5
device_attach: igb0 attach returned 5

After applying patch (attached) everthing works fine:
igb0: Generate a random address
igb0: Using 1024 TX descriptors and 1024 RX descriptors
igb0: Using 1 RX queues 1 TX queues
igb0: Using MSI-X interrupts with 2 vectors
igb0: Ethernet address: 7e:da:23:50:00:1d
igb0: link state changed to UP
igb0: netmap queues/slots: TX 1/1024, RX 1/1024

This problem was fixed in igb driver: https://reviews.freebsd.org/rS308429. But after merging igb into em driver, it was lost.
Comment 1 Kevin Bowling freebsd_committer freebsd_triage 2021-04-15 18:07:18 UTC
https://reviews.freebsd.org/D29785
Comment 2 commit-hook freebsd_committer freebsd_triage 2021-04-15 18:48:27 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=68a46f11eadab48a1da9e3d3900569a6a1ce142e

commit 68a46f11eadab48a1da9e3d3900569a6a1ce142e
Author:     Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2021-04-15 18:45:02 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2021-04-15 18:45:02 +0000

    e1000: Restore VF interface random MAC

    Restore 525e07418c77 after the iflib conversion of igb(4). This
    reenables random MAC address generation when attaching to a VF with a
    zeroed MAC.

    PR:             253535
    Reported by:    Balaev PA <mail@void.so>
    Reviewed by:    markj
    MFC after:      2 weeks
    Differential Revision:  https://reviews.freebsd.org/D29785

 sys/dev/e1000/if_em.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)
Comment 3 commit-hook freebsd_committer freebsd_triage 2021-04-29 01:22:49 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=1a34afa9541e9e086451786a168c6fed634eb05b

commit 1a34afa9541e9e086451786a168c6fed634eb05b
Author:     Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2021-04-15 18:45:02 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2021-04-29 01:22:16 +0000

    e1000: Restore VF interface random MAC

    Restore 525e07418c77 after the iflib conversion of igb(4). This
    reenables random MAC address generation when attaching to a VF with a
    zeroed MAC.

    PR:             253535
    Reported by:    Balaev PA <mail@void.so>
    Reviewed by:    markj
    MFC after:      2 weeks
    Differential Revision:  https://reviews.freebsd.org/D29785

    (cherry picked from commit 68a46f11eadab48a1da9e3d3900569a6a1ce142e)

 sys/dev/e1000/if_em.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)
Comment 4 commit-hook freebsd_committer freebsd_triage 2021-04-29 01:24:51 UTC
A commit in branch stable/12 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=50cebb6a8596eaccca5c6ea6f0fbc871d0197ef3

commit 50cebb6a8596eaccca5c6ea6f0fbc871d0197ef3
Author:     Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2021-04-15 18:45:02 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2021-04-29 01:23:07 +0000

    e1000: Restore VF interface random MAC

    Restore 525e07418c77 after the iflib conversion of igb(4). This
    reenables random MAC address generation when attaching to a VF with a
    zeroed MAC.

    PR:             253535
    Reported by:    Balaev PA <mail@void.so>
    Reviewed by:    markj
    MFC after:      2 weeks
    Differential Revision:  https://reviews.freebsd.org/D29785

    (cherry picked from commit 68a46f11eadab48a1da9e3d3900569a6a1ce142e)

 sys/dev/e1000/if_em.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)
Comment 5 Kevin Bowling freebsd_committer freebsd_triage 2021-04-29 01:26:29 UTC
Thanks for your contribution!