]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - net/tftp.c
am335x: Update timings for the beaglebone again
[karo-tx-uboot.git] / net / tftp.c
index bf32eabe88f2172c731f5b4baeaf6608f6eed029..09790eb7cf8202c051d594b5243aa3f843746691 100644 (file)
@@ -40,6 +40,7 @@
 
 static ulong TftpTimeoutMSecs = TIMEOUT;
 static int TftpTimeoutCountMax = TIMEOUT_COUNT;
+static ulong time_start;   /* Record time we started tftp */
 
 /*
  * These globals govern the timeout behavior when attempting a connection to a
@@ -156,7 +157,7 @@ mcast_cleanup(void)
 #endif /* CONFIG_MCAST_TFTP */
 
 static inline void
-store_block(unsigned block, uchar *src, unsigned len)
+store_block(int block, uchar *src, unsigned len)
 {
        ulong offset = block * TftpBlkSize + TftpBlockWrapOffset;
        ulong newsize = offset + len;
@@ -299,6 +300,12 @@ static void tftp_complete(void)
                TftpNumchars++;
        }
 #endif
+       time_start = get_timer(time_start);
+       if (time_start > 0) {
+               puts("\n\t ");  /* Line up with "Loading: " */
+               print_size(NetBootFileXferSize /
+                       time_start * 1000, "/s");
+       }
        puts("\ndone\n");
        net_set_state(NETLOOP_SUCCESS);
 }
@@ -775,10 +782,11 @@ void TftpStart(enum proto_t protocol)
                TftpState = STATE_SEND_RRQ;
        }
 
+       time_start = get_timer(0);
        TftpTimeoutCountMax = TftpRRQTimeoutCountMax;
 
        NetSetTimeout(TftpTimeoutMSecs, TftpTimeout);
-       NetSetHandler(TftpHandler);
+       net_set_udp_handler(TftpHandler);
 #ifdef CONFIG_CMD_TFTPPUT
        net_set_icmp_handler(icmp_handler);
 #endif
@@ -840,7 +848,7 @@ TftpStartServer(void)
 #endif
 
        TftpState = STATE_RECV_WRQ;
-       NetSetHandler(TftpHandler);
+       net_set_udp_handler(TftpHandler);
 }
 #endif /* CONFIG_CMD_TFTPSRV */