Page MenuHomeFreeBSD

D4132.id10126.diff
No OneTemporary

D4132.id10126.diff

Index: sys/boot/efi/libefi/efinet.c
===================================================================
--- sys/boot/efi/libefi/efinet.c
+++ sys/boot/efi/libefi/efinet.c
@@ -184,10 +184,15 @@
EFI_HANDLE h;
EFI_STATUS status;
+ if (nif->nif_driver->netif_ifs[nif->nif_unit].dif_unit < 0) {
+ printf("Invlid network interface %d\n", nif->nif_unit);
+ return;
+ }
+
h = nif->nif_driver->netif_ifs[nif->nif_unit].dif_private;
status = BS->HandleProtocol(h, &sn_guid, (VOID **)&nif->nif_devdata);
if (status != EFI_SUCCESS) {
- printf("net%d: cannot start interface (status=%ld)\n",
+ printf("net%d: cannot start interface (status=%lx)\n",
nif->nif_unit, (long)status);
return;
}
@@ -288,11 +293,30 @@
stats = calloc(nifs, sizeof(struct netif_stats));
for (i = 0; i < nifs; i++) {
+ EFI_SIMPLE_NETWORK *net;
+ EFI_HANDLE h;
+
dif = &efinetif.netif_ifs[i];
+ dif->dif_unit = -1;
+
+ h = efi_find_handle(&efinet_dev, i);
+
+ /*
+ * 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, 0, EFI_OPEN_PROTOCOL_EXCLUSIVE);
+ if (status != EFI_SUCCESS) {
+ printf("Unable to open network interface %d\n", i);
+ continue;
+ }
+
dif->dif_unit = i;
dif->dif_nsel = 1;
dif->dif_stats = &stats[i];
- dif->dif_private = efi_find_handle(&efinet_dev, i);
+ dif->dif_private = h;
}
return (0);

File Metadata

Mime Type
text/plain
Expires
Sat, Oct 11, 1:20 PM (16 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
23578314
Default Alt Text
D4132.id10126.diff (1 KB)

Event Timeline