Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 May 2016 23:33:01 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 202097] [EFI] boot/loader.efi: efinet regression
Message-ID:  <bug-202097-8-YcKKQroFuQ@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-202097-8@https.bugs.freebsd.org/bugzilla/>
References:  <bug-202097-8@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D202097

--- Comment #9 from commit-hook@freebsd.org ---
A commit references this bug:

Author: jhb
Date: Thu May 26 23:32:29 UTC 2016
New revision: 300810
URL: https://svnweb.freebsd.org/changeset/base/300810

Log:
  Fix unit number of EFI net interfaces and ignore psuedo network interface=
s.

  In r277943, the efinet_match() routine was changed to use an off by one
  when matching network interfaces.  The effect was that using "net1"
  actually used the device attached to "net0".

  Digging into the hardware that needed this workaround more, I found that
  UEFI was creating two simple network protocol devices for each physical
  NIC.  The first device was a "raw" Ethernet device and the second device
  was a "IP" device that used the IP protocol on top of the underlying
  "raw" device.  The PXE code in the firmware used the "IP" device to pull
  across the loader.efi, so currdev was set to "net1" when booting from the
  physical interface "net0".  (The loaded image's device handle referenced
  the "IP" device that "net1" claimed.)

  However, the IP device isn't suitable for doing raw packet I/O (and the
  current code to open devices exclusively actually turns the "IP" devices
  off on these systems).

  To fix, change the efinet driver to only attach to "raw" devices.  This
  is determined by fetching the DEVICE_PATH for each handle which supports
  the simple network protocol and examining the last node in the path.  If
  the last node in the path is a MAC address, the device is assumed to be
  a "raw" device and is added as a 'netX' device.  If the last node is not
  a MAC address, the device is ignored.

  However, this causes a new problem as the device handle associated with
  the loaded image no longer matches any of the handles enumerated by
  efinet for systems that load the image via the "IP" device.  To handle
  this case, expand the logic that resolves currdev from the loaded image
  in main().  First, the existing logic of looking for a handle that
  matches the loaded image's handle is tried.  If that fails, the device
  path of the handle that loaded the loaded image is fetched via
  efi_lookup_image_devpath().  This device path is then walked from the
  end up to the beginning using efi_handle_lookup() to fetch the handle
  associated with a path.  If the handle is found and is a known handle,
  then that is used as currdev.  The effect for machines that load the
  image via the "IP" device is that the first lookup fails (the handle
  for the "IP" device isn't claimed by efinet), but walking up the
  image's device path finds the handle of the raw MAC device which is used
  as currdev.

  With these fixes in place, the hack to subtract 1 from the unit can now
  be removed, so that setting currdev to 'net0' actually uses 'net0'.

  PR:           202097
  Tested by:    ambrisko
  Sponsored by: Cisco Systems

Changes:
  head/sys/boot/efi/libefi/efinet.c
  head/sys/boot/efi/loader/main.c

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-202097-8-YcKKQroFuQ>