Blame SOURCES/0001-efinet-save-and-restore-SNP-rx-filters.patch

0dc71c
From 92012e6c08336baed7d59fab449310ca4fd21fed Mon Sep 17 00:00:00 2001
0dc71c
From: Mark Salter <msalter@redhat.com>
0dc71c
Date: Thu, 28 May 2015 09:52:07 -0400
0dc71c
Subject: [PATCH] efinet: save and restore SNP rx filters
0dc71c
0dc71c
Some firmware will clear the SNP receive filter settings when
0dc71c
opened with the exclusive flag. This patch saves the original
0dc71c
receive filter settings and restores them after the protocol
0dc71c
has been opened with the exclusive flag.
0dc71c
0dc71c
Signed-off-by: Mark Salter <msalter@redhat.com>
0dc71c
---
0dc71c
 grub-core/net/drivers/efi/efinet.c | 9 +++++++++
0dc71c
 include/grub/efi/api.h             | 7 ++++++-
0dc71c
 include/grub/net.h                 | 3 +++
0dc71c
 3 files changed, 18 insertions(+), 1 deletion(-)
0dc71c
0dc71c
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
0dc71c
index 775abde..e19dda0 100644
0dc71c
--- a/grub-core/net/drivers/efi/efinet.c
0dc71c
+++ b/grub-core/net/drivers/efi/efinet.c
0dc71c
@@ -156,6 +156,11 @@ open_card (struct grub_net_card *dev)
0dc71c
 	return grub_error (GRUB_ERR_NET_NO_CARD, "%s: net initialize failed",
0dc71c
 			   dev->name);
0dc71c
 
0dc71c
+      if (efi_call_6 (net->receive_filters, net, dev->rx_filter, 0,
0dc71c
+		      0, dev->mcast_filter_count, dev->mcast_filter))
0dc71c
+	return grub_error (GRUB_ERR_NET_NO_CARD, "%s: setting rx filters failed",
0dc71c
+			   dev->name);
0dc71c
+
0dc71c
       efi_call_4 (grub_efi_system_table->boot_services->close_protocol,
0dc71c
 		  dev->efi_net, &net_io_guid,
0dc71c
 		  grub_efi_image_handle, dev->efi_handle);
0dc71c
@@ -278,6 +283,10 @@ grub_efinet_findcards (void)
0dc71c
       grub_memcpy (card->default_address.mac,
0dc71c
 		   net->mode->current_address,
0dc71c
 		   sizeof (card->default_address.mac));
0dc71c
+      card->rx_filter = net->mode->receive_filter_setting;
0dc71c
+      card->mcast_filter_count = net->mode->mcast_filter_count;
0dc71c
+      grub_memcpy (card->mcast_filter, net->mode->mcast_filter,
0dc71c
+		   sizeof(card->mcast_filter));
0dc71c
       card->efi_net = net;
0dc71c
       card->efi_handle = *handle;
0dc71c
 
0dc71c
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
0dc71c
index 1423403..9dd8307 100644
0dc71c
--- a/include/grub/efi/api.h
0dc71c
+++ b/include/grub/efi/api.h
0dc71c
@@ -1574,7 +1574,12 @@ struct grub_efi_simple_network
0dc71c
 				   grub_efi_uintn_t extra_tx);
0dc71c
   void (*reset) (void);
0dc71c
   void (*shutdown) (void);
0dc71c
-  void (*receive_filters) (void);
0dc71c
+  grub_efi_status_t (*receive_filters) (struct grub_efi_simple_network *this,
0dc71c
+				        grub_uint32_t enable,
0dc71c
+				        grub_uint32_t disable,
0dc71c
+					grub_efi_boolean_t reset,
0dc71c
+				        grub_efi_uintn_t mcast_cnt,
0dc71c
+					grub_efi_mac_address_t *mcast_filters);
0dc71c
   void (*station_address) (void);
0dc71c
   void (*statistics) (void);
0dc71c
   void (*mcastiptomac) (void);
0dc71c
diff --git a/include/grub/net.h b/include/grub/net.h
0dc71c
index 88fc71c..7d7d315 100644
0dc71c
--- a/include/grub/net.h
0dc71c
+++ b/include/grub/net.h
0dc71c
@@ -140,6 +140,9 @@ struct grub_net_card
0dc71c
       struct grub_efi_simple_network *efi_net;
0dc71c
       grub_efi_handle_t efi_handle;
0dc71c
       grub_size_t last_pkt_size;
0dc71c
+      grub_uint32_t rx_filter;
0dc71c
+      grub_uint32_t mcast_filter_count;
0dc71c
+      grub_efi_mac_t mcast_filter[16];
0dc71c
     };
0dc71c
 #endif
0dc71c
     void *data;
0dc71c
-- 
0dc71c
1.9.3
0dc71c