summaryrefslogtreecommitdiffstats
path: root/cpukit/libnetworking
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2001-01-25 22:59:32 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2001-01-25 22:59:32 +0000
commit809feccc93a441cb072910b9d14139e289f25410 (patch)
treec6206f961d4d370190420374d68573263a137d4e /cpukit/libnetworking
parent2001-01-25 Joel Sherrill <joel@OARcorp.com> (diff)
downloadrtems-809feccc93a441cb072910b9d14139e289f25410.tar.bz2
2001-01-25 Eric Norum <eric.norum@usask.ca>
* lib/tftpDriver.c: Reduce first timeout interval. This improves throughput on systems which are dropping packets. Only the first timeout is reduced. This keeps the number of extra packets down on networks that are very busy and dropping lots of packets.
Diffstat (limited to 'cpukit/libnetworking')
-rw-r--r--cpukit/libnetworking/ChangeLog8
-rw-r--r--cpukit/libnetworking/lib/tftpDriver.c26
2 files changed, 25 insertions, 9 deletions
diff --git a/cpukit/libnetworking/ChangeLog b/cpukit/libnetworking/ChangeLog
index 3d0e7564ce..54c410a78e 100644
--- a/cpukit/libnetworking/ChangeLog
+++ b/cpukit/libnetworking/ChangeLog
@@ -1,3 +1,11 @@
+2001-01-25 Eric Norum <eric.norum@usask.ca>
+
+ * lib/tftpDriver.c: Reduce first timeout interval. This
+ improves throughput on systems which are dropping packets.
+ Only the first timeout is reduced. This keeps the number
+ of extra packets down on networks that are very busy and
+ dropping lots of packets.
+
2001-01-24 Sergei Organov <osv@javad.ru>
* rtems_servers/ftpd.c, rtems_servers/ftpd.h: Major enhancements
diff --git a/cpukit/libnetworking/lib/tftpDriver.c b/cpukit/libnetworking/lib/tftpDriver.c
index 4f08e90ff5..47a896cda7 100644
--- a/cpukit/libnetworking/lib/tftpDriver.c
+++ b/cpukit/libnetworking/lib/tftpDriver.c
@@ -49,9 +49,10 @@
/*
* Default limits
*/
-#define PACKET_REPLY_MILLISECONDS 6000
-#define OPEN_RETRY_LIMIT 10
-#define IO_RETRY_LIMIT 10
+#define PACKET_FIRST_TIMEOUT_MILLISECONDS 400
+#define PACKET_TIMEOUT_MILLISECONDS 6000
+#define OPEN_RETRY_LIMIT 10
+#define IO_RETRY_LIMIT 10
/*
* TFTP opcodes
@@ -305,13 +306,19 @@ sendStifle (struct tftpStream *tp, struct sockaddr_in *to)
* Wait for a data packet
*/
static int
-getPacket (struct tftpStream *tp)
+getPacket (struct tftpStream *tp, int retryCount)
{
int len;
struct timeval tv;
- tv.tv_sec = PACKET_REPLY_MILLISECONDS / 1000;
- tv.tv_usec = (PACKET_REPLY_MILLISECONDS % 1000) * 1000;
+ if (retryCount == 0) {
+ tv.tv_sec = PACKET_FIRST_TIMEOUT_MILLISECONDS / 1000;
+ tv.tv_usec = (PACKET_FIRST_TIMEOUT_MILLISECONDS % 1000) * 1000;
+ }
+ else {
+ tv.tv_sec = PACKET_TIMEOUT_MILLISECONDS / 1000;
+ tv.tv_usec = (PACKET_TIMEOUT_MILLISECONDS % 1000) * 1000;
+ }
setsockopt (tp->socket, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof tv);
for (;;) {
union {
@@ -547,6 +554,7 @@ static int rtems_tftp_open(
* Start the transfer
*/
tp->firstReply = 1;
+ retryCount = 0;
for (;;) {
/*
* Create the request
@@ -582,7 +590,7 @@ static int rtems_tftp_open(
/*
* Get reply
*/
- len = getPacket (tp);
+ len = getPacket (tp, retryCount);
if (len >= (int) sizeof tp->pkbuf.tftpACK) {
int opcode = ntohs (tp->pkbuf.tftpDATA.opcode);
if (!tp->writing
@@ -669,7 +677,7 @@ static int rtems_tftp_read(
*/
retryCount = 0;
for (;;) {
- int len = getPacket (tp);
+ int len = getPacket (tp, retryCount);
if (len >= (int)sizeof tp->pkbuf.tftpACK) {
int opcode = ntohs (tp->pkbuf.tftpDATA.opcode);
rtems_unsigned16 nextBlock = tp->blocknum + 1;
@@ -715,7 +723,7 @@ static int rtems_tftp_flush ( struct tftpStream *tp )
(struct sockaddr *)&tp->farAddress,
sizeof tp->farAddress) < 0)
return EIO;
- rlen = getPacket (tp);
+ rlen = getPacket (tp, retryCount);
if (rlen >= (int)sizeof tp->pkbuf.tftpACK) {
int opcode = ntohs (tp->pkbuf.tftpACK.opcode);
if ((opcode == TFTP_OPCODE_ACK)