PERFORCE change 95829 for review

Warner Losh imp at FreeBSD.org
Fri Apr 21 21:28:12 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=95829

Change 95829 by imp at imp_hammer on 2006/04/21 21:27:19

	SWAP16(constant) instead of (var) in a few more places.

Affected files ...

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

Differences ...

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

@@ -236,7 +236,7 @@
 static void
 CheckForNewPacket(ip_header_t *pHeader)
 {
-	unsigned short	*pFrameType, *pArpOp;
+	unsigned short	*pFrameType;
 	unsigned	i;
 	char		*pData;
 	ip_header_t	*pIpHeader;
@@ -264,11 +264,9 @@
 
 	case PROTOCOL_ARP:
 
-		pArpOp = (unsigned short *) (pData + 20);
 		p_ARP = (arp_header_t*)pData;
 
-		if (SWAP16(*pArpOp) == ARP_REPLY) {
-
+		if (p_ARP->operation == SWAP16(ARP_REPLY)) {
 			// check if new server info is available
 			if ((!serverMACSet) &&
 				(!(p_memcmp((char*)p_ARP->sender_ip,
@@ -279,12 +277,9 @@
 				p_memcpy((char*)serverMACAddr,
 					(char*)p_ARP->sender_mac, 6);
 			}
-		}
-
-		if (SWAP16(*pArpOp) == ARP_REQUEST) {
-
+		} else if (p_ARP->operation == SWAP16(ARP_REQUEST)) {
 			// ARP REPLY operation
-			*pArpOp =  SWAP16(ARP_REPLY);				
+			p_ARP->operation =  SWAP16(ARP_REPLY);
 
 			// Fill the dest address and src address
 			for (i = 0; i <6; i++) {


More information about the p4-projects mailing list