diff options
| author | Toomas Soome <tsoome@me.com> | 2019-06-19 10:05:31 +0300 |
|---|---|---|
| committer | Toomas Soome <tsoome@me.com> | 2019-06-25 23:37:43 +0300 |
| commit | 1998b0812b5fb5da180a47adadb55cc844465828 (patch) | |
| tree | 1d040b8ec04f8af14968277e765a875b11e88c57 | |
| parent | e41409bfa05152ed1ac94578d69a0444e4ab6904 (diff) | |
| download | illumos-joyent-1998b0812b5fb5da180a47adadb55cc844465828.tar.gz | |
11261 efinet: Defer exclusively opening the network handles
Reviewed by: Andy Fiddaman <andy@omniosce.org>
Approved by: Dan McDonald <danmcd@joyent.com>
| -rw-r--r-- | usr/src/boot/sys/boot/efi/libefi/efinet.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/usr/src/boot/sys/boot/efi/libefi/efinet.c b/usr/src/boot/sys/boot/efi/libefi/efinet.c index bcbf88373d..ed71f9d428 100644 --- a/usr/src/boot/sys/boot/efi/libefi/efinet.c +++ b/usr/src/boot/sys/boot/efi/libefi/efinet.c @@ -105,8 +105,26 @@ efinet_match(struct netif *nif, void *machdep_hint) } static int -efinet_probe(struct netif *nif, void *machdep_hint) +efinet_probe(struct netif *nif, void *machdep_hint __unused) { + EFI_SIMPLE_NETWORK *net; + EFI_HANDLE h; + EFI_STATUS status; + + h = nif->nif_driver->netif_ifs[nif->nif_unit].dif_private; + + /* + * Open the network device in exclusive mode. Without this + * we will be racing with the UEFI network stack. It will + * pull packets off the network leading to lost packets. + */ + status = BS->OpenProtocol(h, &sn_guid, (void **)&net, + IH, NULL, EFI_OPEN_PROTOCOL_EXCLUSIVE); + if (status != EFI_SUCCESS) { + printf("Unable to open network interface %d for " + "exclusive access: %lu\n", nif->nif_unit, + EFI_ERROR_CODE(status)); + } return (0); } @@ -268,7 +286,6 @@ efinet_dev_init(void) struct netif_dif *dif; struct netif_stats *stats; EFI_DEVICE_PATH *devpath, *node; - EFI_SIMPLE_NETWORK *net; EFI_HANDLE *handles, *handles2; EFI_STATUS status; UINTN sz; @@ -304,19 +321,6 @@ efinet_dev_init(void) DevicePathSubType(node) != MSG_MAC_ADDR_DP) continue; - /* - * Open the network device in exclusive mode. Without this - * we will be racing with the UEFI network stack. It will - * pull packets off the network leading to lost packets. - */ - status = BS->OpenProtocol(handles[i], &sn_guid, (void **)&net, - IH, NULL, EFI_OPEN_PROTOCOL_EXCLUSIVE); - if (status != EFI_SUCCESS) { - printf("Unable to open network interface %d for " - "exclusive access: %lu\n", i, - EFI_ERROR_CODE(status)); - } - handles2[nifs] = handles[i]; nifs++; } |
