[U-Boot] [PATCH v2 14/21] net: cosmetic: Rename parameter len to payload_len

Joe Hershberger joe.hershberger at ni.com
Wed Mar 28 01:42:45 CEST 2012


This name more explicitly claims that it does not include the
header size

Signed-off-by: Joe Hershberger <joe.hershberger at ni.com>
Cc: Joe Hershberger <joe.hershberger at gmail.com>
Cc: Simon Glass <sjg at chromium.org>
Cc: Mike Frysinger <vapier at gentoo.org>
---
Changes for v2:
   - Split from "Improve variable names and code readability"

 include/net.h |    2 +-
 net/net.c     |   14 ++++++++------
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/include/net.h b/include/net.h
index 538eb86..64ecb38 100644
--- a/include/net.h
+++ b/include/net.h
@@ -462,7 +462,7 @@ extern void NetSendPacket(uchar *, int);
 
 /* Transmit UDP packet, performing ARP request if needed */
 extern int	NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport,
-			int sport, int len);
+			int sport, int payload_len);
 
 /* Processes a received packet */
 extern void NetReceive(uchar *, int);
diff --git a/net/net.c b/net/net.c
index f8ec623..19d0de6 100644
--- a/net/net.c
+++ b/net/net.c
@@ -594,7 +594,8 @@ NetSendPacket(uchar *pkt, int len)
 }
 
 int
-NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport, int len)
+NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport,
+		int payload_len)
 {
 	uchar *pkt;
 
@@ -620,14 +621,14 @@ NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport, int len)
 		pkt = NetArpWaitTxPacket;
 		pkt += NetSetEther(pkt, NetArpWaitPacketMAC, PROT_IP);
 
-		NetSetIP(pkt, dest, dport, sport, len);
+		NetSetIP(pkt, dest, dport, sport, payload_len);
 		memcpy(pkt + IP_UDP_HDR_SIZE, (uchar *)NetTxPacket +
 		       (pkt - (uchar *)NetArpWaitTxPacket) +
-		       IP_UDP_HDR_SIZE, len);
+		       IP_UDP_HDR_SIZE, payload_len);
 
 		/* size of the waiting packet */
 		NetArpWaitTxPacketSize = (pkt - NetArpWaitTxPacket) +
-			IP_UDP_HDR_SIZE + len;
+			IP_UDP_HDR_SIZE + payload_len;
 
 		/* and do the ARP request */
 		NetArpWaitTry = 1;
@@ -640,8 +641,9 @@ NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport, int len)
 
 	pkt = (uchar *)NetTxPacket;
 	pkt += NetSetEther(pkt, ether, PROT_IP);
-	NetSetIP(pkt, dest, dport, sport, len);
-	eth_send(NetTxPacket, (pkt - NetTxPacket) + IP_UDP_HDR_SIZE + len);
+	NetSetIP(pkt, dest, dport, sport, payload_len);
+	eth_send(NetTxPacket, (pkt - NetTxPacket) + IP_UDP_HDR_SIZE +
+		payload_len);
 
 	return 0;	/* transmitted */
 }
-- 
1.6.0.2



More information about the U-Boot mailing list