Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Apr 2006 18:45:06 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 95815 for review
Message-ID:  <200604211845.k3LIj6ns005295@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=95815

Change 95815 by imp@imp_hammer on 2006/04/21 18:44:38

	Save 64 bytes by storing the serverPort in network byte order,
	rather than in host order and constantly swapping them...

Affected files ...

.. //depot/projects/arm/src/sys/boot/arm/at91/libat91/emac.c#7 edit

Differences ...

==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/emac.c#7 (text+ko) ====

@@ -148,7 +148,7 @@
 	udpHdr = (udp_header_t*)(ipHdr + 1);
 
 	udpHdr->src_port  = SWAP16(localPort);
-	udpHdr->dst_port  = SWAP16(serverPort);
+	udpHdr->dst_port  = serverPort;
 	udpHdr->udp_len   = SWAP16(8 + tftpLength);
 	udpHdr->udp_cksum = 0;
 
@@ -332,12 +332,12 @@
 
 			if (ackBlock == -1) {
 				if (SWAP16(tftpHdr->block_num) != 1)
-						break;
-					serverPort = SWAP16(udpHdr->src_port);
-					ackBlock = 0;
-				}
+					break;
+				serverPort = udpHdr->src_port;
+				ackBlock = 0;
+			}
 
-			if (serverPort != SWAP16(udpHdr->src_port))
+			if (serverPort != udpHdr->src_port)
 				break;
 
 			TFTP_ACK_Data(tftpHdr->data,
@@ -595,7 +595,7 @@
 	state = TFTP_WAITING_SERVER_MAC;
 	timeout = 10;
 	thisSeconds = GetSeconds();
-	serverPort = 69;
+	serverPort = SWAP16(69);
 	++localPort;
 	ackBlock = -1;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200604211845.k3LIj6ns005295>