Skip to contentSkip to conversation

add a exit condition even for no stop case

PATCH In review Paulo Flabiano Smorigo 2 participants 2 messages Jan 20, 2014 – Jan 21, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 add a exit condition even for no stop case

Hi all,

As I said in the my last email, I'm running tests in a network with heavy traffic, like, over 150 arp requests comming every second. Under these condition, I found an issue in the receive_packets function.

On line 1456 of net/net.c there is a while (1) that only exits if there is a stop condition and more then 10 packages or if there is no package received.

If GRUB is idle and enter in this loop, the only condition to leave is if it doesn't have incoming packages. In a network with heavy traffic (like mine) this never happens.

The result is that GRUB becomes muted and freeze.

I made a small fix that exits this loop if the incoming packages rearch a maximum level. I used 100 packages and it seems fine.

---
 grub-core/net/net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
grub-core/net/net.c +1 -1
index 683ab28..f2e723b 100644
@@ -1453,7 +1453,7 @@ receive_packets (struct grub_net_card *card, int *stop_condition)
 	}
       card->opened = 1;
     }
-  while (1)
+  while (received < 100)
     {
       /* Maybe should be better have a fixed number of packets for each card
 	 and just mark them as used and not used.  */ 
Signature · 6 lines
1.8.2.1


-- 
Paulo Flabiano Smorigo
IBM Linux Technology Center
#1 lore raw

Go ahead for trunk

Quoted 37 lines · Paulo Flabiano Smorigo

Hi all,

As I said in the my last email, I'm running tests in a network with heavy traffic, like, over 150 arp requests comming every second. Under these condition, I found an issue in the receive_packets function.

On line 1456 of net/net.c there is a while (1) that only exits if there is a stop condition and more then 10 packages or if there is no package received.

If GRUB is idle and enter in this loop, the only condition to leave is if it doesn't have incoming packages. In a network with heavy traffic (like mine) this never happens.

The result is that GRUB becomes muted and freeze.

I made a small fix that exits this loop if the incoming packages rearch a maximum level. I used 100 packages and it seems fine.

---
 grub-core/net/net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
grub-core/net/net.c +1 -1
index 683ab28..f2e723b 100644
@@ -1453,7 +1453,7 @@ receive_packets (struct grub_net_card *card, int *stop_condition)
 	}
       card->opened = 1;
     }
-  while (1)
+  while (received < 100)
     {
       /* Maybe should be better have a fixed number of packets for each card
 	 and just mark them as used and not used.  */