software/libnet/microudp: speed-up ARP by changing timeout/tries
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Wed, 24 Apr 2019 07:55:41 +0000 (09:55 +0200)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Wed, 24 Apr 2019 07:55:41 +0000 (09:55 +0200)
First ARP request does not seem to be transmitted (the link is probably not
fully established). Reduce the timeout between tries and increase number of
tries.

litex/soc/software/libnet/microudp.c

index 69aa901db54664d061378c2311d740eb1cda4703..955340febfc96419887638cc243339aaed869175 100644 (file)
@@ -219,7 +219,7 @@ int microudp_arp_resolve(unsigned int ip)
        for(i=0;i<6;i++)
                cached_mac[i] = 0;
 
-       for(tries=0;tries<5;tries++) {
+       for(tries=0;tries<100;tries++) {
                /* Send an ARP request */
                fill_eth_header(&txbuffer->frame.eth_header,
                                broadcast,
@@ -242,7 +242,7 @@ int microudp_arp_resolve(unsigned int ip)
                send_packet();
 
                /* Do we get a reply ? */
-               for(timeout=0;timeout<2000000;timeout++) {
+               for(timeout=0;timeout<100000;timeout++) {
                        microudp_service();
                        for(i=0;i<6;i++)
                                if(cached_mac[i]) return 1;