All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/23] net: cosmetic: Fix naming and other checkpatch.pl issues in net/
@ 2015-04-03 21:14 Joe Hershberger
  2015-04-03 21:14 ` [U-Boot] [PATCH 01/23] net: cosmetic: Change IPaddr_t to struct in_addr Joe Hershberger
                   ` (24 more replies)
  0 siblings, 25 replies; 103+ messages in thread
From: Joe Hershberger @ 2015-04-03 21:14 UTC (permalink / raw)
  To: u-boot

This series is fairly disruptive in naming, so hopefully there aren't
many network stack changes in flight that will conflict with this. This
is based on top of dm/next for now so that the dm/eth series is assumed.
This will be rebased when that is, but will likely not have issues.

Like ripping off a bandage, do it quick and all at once.


Joe Hershberger (21):
  net: cosmetic: Change IPaddr_t to struct in_addr
  net: cosmetic: Fixup var names related to boot file
  net: cosmetic: Fixup var names for DHCP strings
  net: cosmetic: Name ethaddr variables consistently
  net: cosmetic: Cleanup internal packet buffer names
  net: cosmetic: Fix var naming net <-> eth drivers
  net: cosmetic: Clean up TFTP variables and functions
  net: cosmetic: Clean up ARP variables and functions
  net: cosmetic: Clean up DHCP variables and functions
  net: cosmetic: Clean up NFS variables and functions
  net: cosmetic: Clean up RARP variables and functions
  net: cosmetic: Clean up SNTP variables and functions
  net: cosmetic: Clean up ping variables and functions
  net: cosmetic: Clean up CDP variables and functions
  net: cosmetic: Clean up DNS variables and functions
  net: cosmetic: Clean up netconsole variables and functions
  net: cosmetic: Clean up cmd_net variables and functions
  net: cosmetic: Fix checkpatch.pl failures in linklocal
  net: cosmetic: Fix checkpatch.pl failures in eth.c
  net: cosmetic: Fix checkpatch.pl failures in net.h
  net: cosmetic: Fix checkpatch.pl failures in net.c

Sergey Temerkhanov (2):
  net: Fix incorrect DHCP/BOOTP packets on 64-bit systems
  net: Convert protocol structures to use explicit sizes

 README                                     |   6 +-
 arch/arm/mach-davinci/misc.c               |   2 +-
 arch/mips/mach-au1x00/au1x00_eth.c         |  12 +-
 arch/powerpc/cpu/mpc8260/ether_fcc.c       |  20 +-
 arch/powerpc/cpu/mpc8260/ether_scc.c       |   4 +-
 arch/powerpc/cpu/mpc85xx/ether_fcc.c       |   4 +-
 arch/powerpc/cpu/mpc8xx/fec.c              |  12 +-
 arch/powerpc/cpu/mpc8xx/scc.c              |   5 +-
 board/BuR/common/common.c                  |   4 +-
 board/ait/cam_enc_4xx/cam_enc_4xx.c        |   2 +-
 board/alphaproject/ap_sh4a_4a/ap_sh4a_4a.c |   2 +-
 board/bct-brettl2/bct-brettl2.c            |   2 +-
 board/bf518f-ezbrd/bf518f-ezbrd.c          |   4 +-
 board/bf526-ezbrd/bf526-ezbrd.c            |   4 +-
 board/bf527-ezkit/bf527-ezkit.c            |   4 +-
 board/bf537-minotaur/bf537-minotaur.c      |   2 +-
 board/bf537-pnav/bf537-pnav.c              |   2 +-
 board/bf537-srv1/bf537-srv1.c              |   2 +-
 board/bf537-stamp/bf537-stamp.c            |   4 +-
 board/birdland/bav335x/board.c             |   4 +-
 board/buffalo/lsxl/lsxl.c                  |   2 +-
 board/cm-bf527/cm-bf527.c                  |   4 +-
 board/cm-bf537e/cm-bf537e.c                |   2 +-
 board/cm-bf537u/cm-bf537u.c                |   2 +-
 board/compulab/cm_fx6/cm_fx6.c             |   2 +-
 board/compulab/cm_t335/cm_t335.c           |   2 +-
 board/compulab/cm_t35/cm_t35.c             |   2 +-
 board/compulab/cm_t3517/cm_t3517.c         |   4 +-
 board/compulab/cm_t54/cm_t54.c             |   4 +-
 board/davinci/da8xxevm/da850evm.c          |   6 +-
 board/dnp5370/dnp5370.c                    |   4 +-
 board/gumstix/pepper/board.c               |   2 +-
 board/ifm/ac14xx/ac14xx.c                  |   2 +-
 board/ip04/ip04.c                          |   2 +-
 board/isee/igep0033/board.c                |   2 +-
 board/phytec/pcm051/board.c                |   2 +-
 board/renesas/r0p7734/r0p7734.c            |   2 +-
 board/siemens/common/factoryset.c          |   4 +-
 board/siemens/pxm2/board.c                 |   2 +-
 board/silica/pengwyn/board.c               |   2 +-
 board/tcm-bf518/tcm-bf518.c                |   4 +-
 board/tcm-bf537/tcm-bf537.c                |   2 +-
 board/ti/am335x/board.c                    |   6 +-
 board/ti/am43xx/board.c                    |   4 +-
 board/ti/beagle_x15/board.c                |   4 +-
 board/ti/dra7xx/evm.c                      |   4 +-
 board/ti/ti814x/evm.c                      |   2 +-
 common/cmd_elf.c                           |   2 +-
 common/cmd_net.c                           | 133 +++----
 common/cmd_pxe.c                           |   4 +-
 common/spl/spl_net.c                       |   2 +-
 common/update.c                            |  25 +-
 doc/README.drivers.eth                     |  12 +-
 doc/README.enetaddr                        |   2 +-
 doc/README.link-local                      |   4 +-
 drivers/net/4xx_enet.c                     |  14 +-
 drivers/net/altera_tse.c                   |  15 +-
 drivers/net/armada100_fec.c                |   7 +-
 drivers/net/at91_emac.c                    |   4 +-
 drivers/net/ax88180.c                      |   6 +-
 drivers/net/bcm-sf2-eth.c                  |   6 +-
 drivers/net/bfin_mac.c                     |   4 +-
 drivers/net/calxedaxgmac.c                 |   2 +-
 drivers/net/cpsw.c                         |  17 +-
 drivers/net/cs8900.c                       |   5 +-
 drivers/net/davinci_emac.c                 |   5 +-
 drivers/net/dc2114x.c                      |   9 +-
 drivers/net/designware.c                   |   2 +-
 drivers/net/dm9000x.c                      |   9 +-
 drivers/net/dnet.c                         |   5 +-
 drivers/net/e1000.c                        |   4 +-
 drivers/net/eepro100.c                     |   3 +-
 drivers/net/enc28j60.c                     |  13 +-
 drivers/net/ep93xx_eth.c                   |  11 +-
 drivers/net/ethoc.c                        |   4 +-
 drivers/net/fec_mxc.c                      |   4 +-
 drivers/net/fm/eth.c                       |   2 +-
 drivers/net/fsl_mcdmafec.c                 |  23 +-
 drivers/net/ftgmac100.c                    |   4 +-
 drivers/net/ftmac100.c                     |   4 +-
 drivers/net/ftmac110.c                     |   4 +-
 drivers/net/greth.c                        |   2 +-
 drivers/net/keystone_net.c                 |   2 +-
 drivers/net/ks8851_mll.c                   |   6 +-
 drivers/net/lan91c96.c                     |  19 +-
 drivers/net/macb.c                         |  10 +-
 drivers/net/mcffec.c                       |   5 +-
 drivers/net/mpc512x_fec.c                  |   3 +-
 drivers/net/mpc5xxx_fec.c                  |   2 +-
 drivers/net/mvgbe.c                        |  41 +-
 drivers/net/mvneta.c                       |   2 +-
 drivers/net/natsemi.c                      |   3 +-
 drivers/net/ne2000_base.c                  |   2 +-
 drivers/net/netconsole.c                   |  94 ++---
 drivers/net/ns8382x.c                      |   6 +-
 drivers/net/pch_gbe.c                      |   2 +-
 drivers/net/pcnet.c                        |   2 +-
 drivers/net/rtl8139.c                      |   4 +-
 drivers/net/rtl8169.c                      |   2 +-
 drivers/net/sandbox-raw.c                  |   8 +-
 drivers/net/sandbox.c                      |  14 +-
 drivers/net/sh_eth.c                       |   2 +-
 drivers/net/smc91111.c                     |  18 +-
 drivers/net/smc911x.c                      |   4 +-
 drivers/net/sunxi_emac.c                   |   4 +-
 drivers/net/tsec.c                         |   7 +-
 drivers/net/tsi108_eth.c                   |   8 +-
 drivers/net/uli526x.c                      |   5 +-
 drivers/net/xilinx_axi_emac.c              |   2 +-
 drivers/net/xilinx_emaclite.c              |   2 +-
 drivers/net/xilinx_ll_temac_fifo.c         |   4 +-
 drivers/net/xilinx_ll_temac_sdma.c         |   4 +-
 drivers/net/zynq_gem.c                     |   2 +-
 drivers/qe/uec.c                           |   2 +-
 drivers/usb/eth/asix.c                     |   3 +-
 drivers/usb/eth/asix88179.c                |   2 +-
 drivers/usb/eth/mcs7830.c                  |   2 +-
 drivers/usb/eth/smsc95xx.c                 |   5 +-
 drivers/usb/gadget/ether.c                 |  13 +-
 include/common.h                           |   2 +-
 include/net.h                              | 303 ++++++++-------
 lib/net_utils.c                            |  16 +-
 net/arp.c                                  | 137 ++++---
 net/arp.h                                  |  22 +-
 net/bootp.c                                | 373 +++++++++---------
 net/bootp.h                                |  39 +-
 net/cdp.c                                  |  88 ++---
 net/cdp.h                                  |   2 +-
 net/dns.c                                  |  72 ++--
 net/dns.h                                  |   2 +-
 net/eth.c                                  |  61 +--
 net/link_local.c                           |  79 ++--
 net/net.c                                  | 442 +++++++++++-----------
 net/nfs.c                                  | 235 ++++++------
 net/nfs.h                                  |   2 +-
 net/ping.c                                 |  49 +--
 net/rarp.c                                 |  45 ++-
 net/rarp.h                                 |   6 +-
 net/sntp.c                                 |  42 +-
 net/sntp.h                                 |   2 +-
 net/tftp.c                                 | 589 +++++++++++++++--------------
 net/tftp.h                                 |   8 +-
 post/cpu/mpc8xx/ether.c                    |   6 +-
 test/dm/eth.c                              |  38 +-
 144 files changed, 1771 insertions(+), 1758 deletions(-)

-- 
1.7.11.5

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH 01/23] net: cosmetic: Change IPaddr_t to struct in_addr
  2015-04-03 21:14 [U-Boot] [PATCH 0/23] net: cosmetic: Fix naming and other checkpatch.pl issues in net/ Joe Hershberger
@ 2015-04-03 21:14 ` Joe Hershberger
  2015-04-08  1:26   ` Simon Glass
  2015-04-03 21:14 ` [U-Boot] [PATCH 02/23] net: cosmetic: Fixup var names related to boot file Joe Hershberger
                   ` (23 subsequent siblings)
  24 siblings, 1 reply; 103+ messages in thread
From: Joe Hershberger @ 2015-04-03 21:14 UTC (permalink / raw)
  To: u-boot

This patch is simply clean-up to make the IPv4 type that is used match
what Linux uses. It also attempts to move all variables that are IP
addresses use good naming instead of CamelCase. No functional change.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

 common/cmd_net.c          |  50 +++++++++----------
 common/cmd_pxe.c          |   2 +-
 drivers/net/netconsole.c  |  37 +++++++-------
 drivers/net/sandbox-raw.c |   8 +--
 drivers/net/sandbox.c     |  14 +++---
 include/common.h          |   2 +-
 include/net.h             |  63 ++++++++++++-----------
 lib/net_utils.c           |  16 +++---
 net/arp.c                 |  56 ++++++++++-----------
 net/arp.h                 |   6 +--
 net/bootp.c               | 125 +++++++++++++++++++++++++---------------------
 net/bootp.h               |   8 +--
 net/dns.c                 |  18 +++----
 net/eth.c                 |   8 +--
 net/link_local.c          |  21 ++++----
 net/net.c                 |  92 +++++++++++++++++-----------------
 net/nfs.c                 |  40 ++++++++-------
 net/ping.c                |  22 ++++----
 net/rarp.c                |   8 +--
 net/sntp.c                |  11 ++--
 net/tftp.c                |  69 +++++++++++++------------
 test/dm/eth.c             |  10 ++--
 22 files changed, 354 insertions(+), 332 deletions(-)

diff --git a/common/cmd_net.c b/common/cmd_net.c
index 3f52edc..0a85d72 100644
--- a/common/cmd_net.c
+++ b/common/cmd_net.c
@@ -114,13 +114,13 @@ static void netboot_update_env(void)
 {
 	char tmp[22];
 
-	if (NetOurGatewayIP) {
-		ip_to_string(NetOurGatewayIP, tmp);
+	if (net_gateway.s_addr) {
+		ip_to_string(net_gateway, tmp);
 		setenv("gatewayip", tmp);
 	}
 
-	if (NetOurSubnetMask) {
-		ip_to_string(NetOurSubnetMask, tmp);
+	if (net_netmask.s_addr) {
+		ip_to_string(net_netmask, tmp);
 		setenv("netmask", tmp);
 	}
 
@@ -130,8 +130,8 @@ static void netboot_update_env(void)
 	if (NetOurRootPath[0])
 		setenv("rootpath", NetOurRootPath);
 
-	if (NetOurIP) {
-		ip_to_string(NetOurIP, tmp);
+	if (net_ip.s_addr) {
+		ip_to_string(net_ip, tmp);
 		setenv("ipaddr", tmp);
 	}
 #if !defined(CONFIG_BOOTP_SERVERIP)
@@ -139,18 +139,18 @@ static void netboot_update_env(void)
 	 * Only attempt to change serverip if net/bootp.c:BootpCopyNetParams()
 	 * could have set it
 	 */
-	if (NetServerIP) {
-		ip_to_string(NetServerIP, tmp);
+	if (net_server_ip.s_addr) {
+		ip_to_string(net_server_ip, tmp);
 		setenv("serverip", tmp);
 	}
 #endif
-	if (NetOurDNSIP) {
-		ip_to_string(NetOurDNSIP, tmp);
+	if (net_dns_server.s_addr) {
+		ip_to_string(net_dns_server, tmp);
 		setenv("dnsip", tmp);
 	}
 #if defined(CONFIG_BOOTP_DNS2)
-	if (NetOurDNS2IP) {
-		ip_to_string(NetOurDNS2IP, tmp);
+	if (net_dns_server2.s_addr) {
+		ip_to_string(net_dns_server2, tmp);
 		setenv("dnsip2", tmp);
 	}
 #endif
@@ -166,8 +166,8 @@ static void netboot_update_env(void)
 #endif
 #if defined(CONFIG_CMD_SNTP) \
     && defined(CONFIG_BOOTP_NTPSERVER)
-	if (NetNtpServerIP) {
-		ip_to_string(NetNtpServerIP, tmp);
+	if (net_ntp_ip.s_addr) {
+		ip_to_string(net_ntp_ip, tmp);
 		setenv("ntpserverip", tmp);
 	}
 #endif
@@ -260,8 +260,8 @@ static int do_ping(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	if (argc < 2)
 		return CMD_RET_USAGE;
 
-	NetPingIP = string_to_ip(argv[1]);
-	if (NetPingIP == 0)
+	net_ping_ip = string_to_ip(argv[1]);
+	if (net_ping_ip.s_addr == 0)
 		return CMD_RET_USAGE;
 
 	if (NetLoop(PING) < 0) {
@@ -331,14 +331,14 @@ int do_sntp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	char *toff;
 
 	if (argc < 2) {
-		NetNtpServerIP = getenv_IPaddr("ntpserverip");
-		if (NetNtpServerIP == 0) {
+		net_ntp_server = getenv_ip("ntpserverip");
+		if (net_ntp_server.s_addr == 0) {
 			printf("ntpserverip not set\n");
 			return CMD_RET_FAILURE;
 		}
 	} else {
-		NetNtpServerIP = string_to_ip(argv[1]);
-		if (NetNtpServerIP == 0) {
+		net_ntp_server = string_to_ip(argv[1]);
+		if (net_ntp_server.s_addr == 0) {
 			printf("Bad NTP server IP address\n");
 			return CMD_RET_FAILURE;
 		}
@@ -352,7 +352,7 @@ int do_sntp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 	if (NetLoop(SNTP) < 0) {
 		printf("SNTP failed: host %pI4 not responding\n",
-			&NetNtpServerIP);
+			&net_ntp_server);
 		return CMD_RET_FAILURE;
 	}
 
@@ -421,14 +421,14 @@ static int do_link_local(cmd_tbl_t *cmdtp, int flag, int argc,
 	if (NetLoop(LINKLOCAL) < 0)
 		return CMD_RET_FAILURE;
 
-	NetOurGatewayIP = 0;
-	ip_to_string(NetOurGatewayIP, tmp);
+	net_gateway.s_addr = 0;
+	ip_to_string(net_gateway, tmp);
 	setenv("gatewayip", tmp);
 
-	ip_to_string(NetOurSubnetMask, tmp);
+	ip_to_string(net_netmask, tmp);
 	setenv("netmask", tmp);
 
-	ip_to_string(NetOurIP, tmp);
+	ip_to_string(net_ip, tmp);
 	setenv("ipaddr", tmp);
 	setenv("llipaddr", tmp); /* store this for next time */
 
diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c
index 96f963d..9eac5c6 100644
--- a/common/cmd_pxe.c
+++ b/common/cmd_pxe.c
@@ -331,7 +331,7 @@ static int pxe_ipaddr_paths(cmd_tbl_t *cmdtp, void *pxefile_addr_r)
 	char ip_addr[9];
 	int mask_pos, err;
 
-	sprintf(ip_addr, "%08X", ntohl(NetOurIP));
+	sprintf(ip_addr, "%08X", ntohl(net_ip.s_addr));
 
 	for (mask_pos = 7; mask_pos >= 0;  mask_pos--) {
 		err = get_pxelinux_path(cmdtp, ip_addr, pxefile_addr_r);
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index 87cea7a..55f383f 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -23,7 +23,7 @@ static int input_recursion;
 static int output_recursion;
 static int net_timeout;
 static uchar nc_ether[6]; /* server enet address */
-static IPaddr_t nc_ip; /* server ip */
+static struct in_addr nc_ip; /* server ip */
 static short nc_out_port; /* target output port */
 static short nc_in_port; /* source input port */
 static const char *output_packet; /* used by first send udp */
@@ -35,14 +35,14 @@ static int output_packet_len;
 enum proto_t net_loop_last_protocol = BOOTP;
 
 static void nc_wait_arp_handler(uchar *pkt, unsigned dest,
-				 IPaddr_t sip, unsigned src,
+				 struct in_addr sip, unsigned src,
 				 unsigned len)
 {
 	net_set_state(NETLOOP_SUCCESS); /* got arp reply - quit net loop */
 }
 
-static void nc_handler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
-			unsigned len)
+static void nc_handler(uchar *pkt, unsigned dest, struct in_addr sip,
+		       unsigned src, unsigned len)
 {
 	if (input_size)
 		net_set_state(NETLOOP_SUCCESS); /* got input - quit net loop */
@@ -53,24 +53,25 @@ static void nc_timeout(void)
 	net_set_state(NETLOOP_SUCCESS);
 }
 
-static int is_broadcast(IPaddr_t ip)
+static int is_broadcast(struct in_addr ip)
 {
-	static IPaddr_t netmask;
-	static IPaddr_t our_ip;
+	static struct in_addr netmask;
+	static struct in_addr our_ip;
 	static int env_changed_id;
 	int env_id = get_env_id();
 
 	/* update only when the environment has changed */
 	if (env_changed_id != env_id) {
-		netmask = getenv_IPaddr("netmask");
-		our_ip = getenv_IPaddr("ipaddr");
+		netmask = getenv_ip("netmask");
+		our_ip = getenv_ip("ipaddr");
 
 		env_changed_id = env_id;
 	}
 
-	return (ip == ~0 ||				/* 255.255.255.255 */
-	    ((netmask & our_ip) == (netmask & ip) &&	/* on the same net */
-	    (netmask | ip) == ~0));		/* broadcast to our net */
+	return (ip.s_addr == ~0 || /* 255.255.255.255 (global bcast) */
+		((netmask.s_addr & our_ip.s_addr) ==
+		 (netmask.s_addr & ip.s_addr) && /* on the same net and */
+		 (netmask.s_addr | ip.s_addr) == ~0)); /* bcast to our net */
 }
 
 static int refresh_settings_from_env(void)
@@ -82,8 +83,8 @@ static int refresh_settings_from_env(void)
 	/* update only when the environment has changed */
 	if (env_changed_id != env_id) {
 		if (getenv("ncip")) {
-			nc_ip = getenv_IPaddr("ncip");
-			if (!nc_ip)
+			nc_ip = getenv_ip("ncip");
+			if (!nc_ip.s_addr)
 				return -1;	/* ncip is 0.0.0.0 */
 			p = strchr(getenv("ncip"), ':');
 			if (p != NULL) {
@@ -91,7 +92,7 @@ static int refresh_settings_from_env(void)
 				nc_in_port = nc_out_port;
 			}
 		} else
-			nc_ip = ~0; /* ncip is not set, so broadcast */
+			nc_ip.s_addr = ~0; /* ncip is not set, so broadcast */
 
 		p = getenv("ncoutport");
 		if (p != NULL)
@@ -131,7 +132,7 @@ void NcStart(void)
 	}
 }
 
-int nc_input_packet(uchar *pkt, IPaddr_t src_ip, unsigned dest_port,
+int nc_input_packet(uchar *pkt, struct in_addr src_ip, unsigned dest_port,
 	unsigned src_port, unsigned len)
 {
 	int end, chunk;
@@ -139,7 +140,7 @@ int nc_input_packet(uchar *pkt, IPaddr_t src_ip, unsigned dest_port,
 	if (dest_port != nc_in_port || !len)
 		return 0; /* not for us */
 
-	if (src_ip != nc_ip && !is_broadcast(nc_ip))
+	if (src_ip.s_addr != nc_ip.s_addr && !is_broadcast(nc_ip))
 		return 0; /* not from our client */
 
 	debug_cond(DEBUG_DEV_PKT, "input: \"%*.*s\"\n", len, len, pkt);
@@ -171,7 +172,7 @@ static void nc_send_packet(const char *buf, int len)
 	int inited = 0;
 	uchar *pkt;
 	uchar *ether;
-	IPaddr_t ip;
+	struct in_addr ip;
 
 	debug_cond(DEBUG_DEV_PKT, "output: \"%*.*s\"\n", len, len, buf);
 
diff --git a/drivers/net/sandbox-raw.c b/drivers/net/sandbox-raw.c
index 91da5f5..45c3b18 100644
--- a/drivers/net/sandbox-raw.c
+++ b/drivers/net/sandbox-raw.c
@@ -16,7 +16,7 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 static int reply_arp;
-static IPaddr_t arp_ip;
+static struct in_addr arp_ip;
 
 static int sb_eth_raw_start(struct udevice *dev)
 {
@@ -55,7 +55,7 @@ static int sb_eth_raw_send(struct udevice *dev, void *packet, int length)
 			 * localhost works on a higher-level API in Linux than
 			 * ARP packets, so fake it
 			 */
-			arp_ip = NetReadIP(&arp->ar_tpa);
+			arp_ip = net_read_ip(&arp->ar_tpa);
 			reply_arp = 1;
 			return 0;
 		}
@@ -93,9 +93,9 @@ static int sb_eth_raw_recv(struct udevice *dev, uchar **packetp)
 		/* Any non-zero MAC address will work */
 		memset(&arp->ar_sha, 0x01, ARP_HLEN);
 		/* Use whatever IP we were looking for (always 127.0.0.1?) */
-		NetWriteIP(&arp->ar_spa, arp_ip);
+		net_write_ip(&arp->ar_spa, arp_ip);
 		memcpy(&arp->ar_tha, pdata->enetaddr, ARP_HLEN);
-		NetWriteIP(&arp->ar_tpa, NetOurIP);
+		net_write_ip(&arp->ar_tpa, net_ip);
 		length = ARP_HDR_SIZE;
 	} else {
 		/* If local, the Ethernet header won't be included; skip it */
diff --git a/drivers/net/sandbox.c b/drivers/net/sandbox.c
index db115d0..e239ff4 100644
--- a/drivers/net/sandbox.c
+++ b/drivers/net/sandbox.c
@@ -24,7 +24,7 @@ DECLARE_GLOBAL_DATA_PTR;
  */
 struct eth_sandbox_priv {
 	uchar fake_host_hwaddr[ARP_HLEN];
-	IPaddr_t fake_host_ipaddr;
+	struct in_addr fake_host_ipaddr;
 	uchar *recv_packet_buffer;
 	int recv_packet_length;
 };
@@ -73,7 +73,7 @@ static int sb_eth_send(struct udevice *dev, void *packet, int length)
 			struct arp_hdr *arp_recv;
 
 			/* store this as the assumed IP of the fake host */
-			priv->fake_host_ipaddr = NetReadIP(&arp->ar_tpa);
+			priv->fake_host_ipaddr = net_read_ip(&arp->ar_tpa);
 			/* Formulate a fake response */
 			eth_recv = (void *)priv->recv_packet_buffer;
 			memcpy(eth_recv->et_dest, eth->et_src, ARP_HLEN);
@@ -90,9 +90,9 @@ static int sb_eth_send(struct udevice *dev, void *packet, int length)
 			arp_recv->ar_op = htons(ARPOP_REPLY);
 			memcpy(&arp_recv->ar_sha, priv->fake_host_hwaddr,
 			       ARP_HLEN);
-			NetWriteIP(&arp_recv->ar_spa, priv->fake_host_ipaddr);
+			net_write_ip(&arp_recv->ar_spa, priv->fake_host_ipaddr);
 			memcpy(&arp_recv->ar_tha, &arp->ar_sha, ARP_HLEN);
-			NetCopyIP(&arp_recv->ar_tpa, &arp->ar_spa);
+			net_copy_ip(&arp_recv->ar_tpa, &arp->ar_spa);
 
 			priv->recv_packet_length = ETHER_HDR_SIZE +
 				ARP_HDR_SIZE;
@@ -121,9 +121,9 @@ static int sb_eth_send(struct udevice *dev, void *packet, int length)
 				       ARP_HLEN);
 				ipr->ip_sum = 0;
 				ipr->ip_off = 0;
-				NetCopyIP((void *)&ipr->ip_dst, &ip->ip_src);
-				NetWriteIP((void *)&ipr->ip_src,
-					   priv->fake_host_ipaddr);
+				net_copy_ip((void *)&ipr->ip_dst, &ip->ip_src);
+				net_write_ip((void *)&ipr->ip_src,
+					     priv->fake_host_ipaddr);
 				ipr->ip_sum = compute_ip_checksum(ipr,
 					IP_HDR_SIZE);
 
diff --git a/include/common.h b/include/common.h
index 932b2fc..a079f13 100644
--- a/include/common.h
+++ b/include/common.h
@@ -826,7 +826,7 @@ int zzip(void *dst, unsigned long *lenp, unsigned char *src,
 
 /* lib/net_utils.c */
 #include <net.h>
-static inline IPaddr_t getenv_IPaddr(char *var)
+static inline struct in_addr getenv_ip(char *var)
 {
 	return string_to_ip(getenv(var));
 }
diff --git a/include/net.h b/include/net.h
index e7f28d7..2699c44 100644
--- a/include/net.h
+++ b/include/net.h
@@ -39,8 +39,9 @@
 #define PKTALIGN	ARCH_DMA_MINALIGN
 
 /* IPv4 addresses are always 32 bits in size */
-typedef __be32		IPaddr_t;
-
+struct in_addr {
+	__be32 s_addr;
+};
 
 /**
  * An incoming packet handler.
@@ -51,7 +52,7 @@ typedef __be32		IPaddr_t;
  * @param len    packet length
  */
 typedef void rxhand_f(uchar *pkt, unsigned dport,
-		      IPaddr_t sip, unsigned sport,
+		      struct in_addr sip, unsigned sport,
 		      unsigned len);
 
 /**
@@ -65,7 +66,7 @@ typedef void rxhand_f(uchar *pkt, unsigned dport,
  * @param len	packet length
  */
 typedef void rxhand_icmp_f(unsigned type, unsigned code, unsigned dport,
-		IPaddr_t sip, unsigned sport, uchar *pkt, unsigned len);
+		struct in_addr sip, unsigned sport, uchar *pkt, unsigned len);
 
 /*
  *	A timeout handler.  Called after time interval has expired.
@@ -237,7 +238,7 @@ void eth_halt(void);			/* stop SCC */
 const char *eth_get_name(void);		/* get name of current device */
 
 #ifdef CONFIG_MCAST_TFTP
-int eth_mcast_join(IPaddr_t mcast_addr, int join);
+int eth_mcast_join(struct in_addr mcast_addr, int join);
 u32 ether_crc(size_t len, unsigned char const *p);
 #endif
 
@@ -312,8 +313,8 @@ struct ip_hdr {
 	uchar		ip_ttl;		/* time to live			*/
 	uchar		ip_p;		/* protocol			*/
 	ushort		ip_sum;		/* checksum			*/
-	IPaddr_t	ip_src;		/* Source IP address		*/
-	IPaddr_t	ip_dst;		/* Destination IP address	*/
+	struct in_addr	ip_src;		/* Source IP address		*/
+	struct in_addr	ip_dst;		/* Destination IP address	*/
 };
 
 #define IP_OFFS		0x1fff /* ip offset *= 8 */
@@ -336,8 +337,8 @@ struct ip_udp_hdr {
 	uchar		ip_ttl;		/* time to live			*/
 	uchar		ip_p;		/* protocol			*/
 	ushort		ip_sum;		/* checksum			*/
-	IPaddr_t	ip_src;		/* Source IP address		*/
-	IPaddr_t	ip_dst;		/* Destination IP address	*/
+	struct in_addr	ip_src;		/* Source IP address		*/
+	struct in_addr	ip_dst;		/* Destination IP address	*/
 	ushort		udp_src;	/* UDP source port		*/
 	ushort		udp_dst;	/* UDP destination port		*/
 	ushort		udp_len;	/* Length of UDP packet		*/
@@ -452,17 +453,19 @@ struct icmp_hdr {
  *
  * Note:
  *
- * All variables of type IPaddr_t are stored in NETWORK byte order
+ * All variables of type struct in_addr are stored in NETWORK byte order
  * (big endian).
  */
 
 /* net.c */
 /** BOOTP EXTENTIONS **/
-extern IPaddr_t NetOurGatewayIP;	/* Our gateway IP address */
-extern IPaddr_t NetOurSubnetMask;	/* Our subnet mask (0 = unknown) */
-extern IPaddr_t NetOurDNSIP;	/* Our Domain Name Server (0 = unknown) */
+extern struct in_addr net_gateway;	/* Our gateway IP address */
+extern struct in_addr net_netmask;	/* Our subnet mask (0 = unknown) */
+/* Our Domain Name Server (0 = unknown) */
+extern struct in_addr net_dns_server;
 #if defined(CONFIG_BOOTP_DNS2)
-extern IPaddr_t NetOurDNS2IP;	/* Our 2nd Domain Name Server (0 = unknown) */
+/* Our 2nd Domain Name Server (0 = unknown) */
+extern struct in_addr net_dns_server2;
 #endif
 extern char	NetOurNISDomain[32];	/* Our NIS domain */
 extern char	NetOurHostName[32];	/* Our hostname */
@@ -472,8 +475,8 @@ extern ushort	NetBootFileSize;	/* Our boot file size in blocks */
 extern ulong		NetBootFileXferSize;	/* size of bootfile in bytes */
 extern uchar		NetOurEther[6];		/* Our ethernet address */
 extern uchar		NetServerEther[6];	/* Boot server enet address */
-extern IPaddr_t		NetOurIP;	/* Our    IP addr (0 = unknown) */
-extern IPaddr_t		NetServerIP;	/* Server IP addr (0 = unknown) */
+extern struct in_addr	net_ip;		/* Our    IP addr (0 = unknown) */
+extern struct in_addr	net_server_ip;	/* Server IP addr (0 = unknown) */
 extern uchar		*NetTxPacket;		/* THE transmit packet */
 #ifdef CONFIG_DM_ETH
 extern uchar		*net_rx_packets[PKTBUFSRX]; /* Receive packets */
@@ -507,7 +510,7 @@ extern char *NetDNSenvvar;		/* the env var to put the ip into */
 #endif
 
 #if defined(CONFIG_CMD_PING)
-extern IPaddr_t	NetPingIP;			/* the ip address to ping */
+extern struct in_addr net_ping_ip;	/* the ip address to ping */
 #endif
 
 #if defined(CONFIG_CMD_CDP)
@@ -527,12 +530,12 @@ static inline int is_cdp_packet(const uchar *et_addr)
 #endif
 
 #if defined(CONFIG_CMD_SNTP)
-extern IPaddr_t	NetNtpServerIP;			/* the ip address to NTP */
+extern struct in_addr	net_ntp_server;		/* the ip address to NTP */
 extern int NetTimeOffset;			/* offset time from UTC */
 #endif
 
 #if defined(CONFIG_MCAST_TFTP)
-extern IPaddr_t Mcast_addr;
+extern struct in_addr net_mcast_addr;
 #endif
 
 /* Initialize the network adapter */
@@ -553,8 +556,8 @@ int NetSetEther(uchar *, uchar *, uint);
 int net_update_ether(struct ethernet_hdr *et, uchar *addr, uint prot);
 
 /* Set IP header */
-void net_set_ip_header(uchar *pkt, IPaddr_t dest, IPaddr_t source);
-void net_set_udp_header(uchar *pkt, IPaddr_t dest, int dport,
+void net_set_ip_header(uchar *pkt, struct in_addr dest, struct in_addr source);
+void net_set_udp_header(uchar *pkt, struct in_addr dest, int dport,
 				int sport, int len);
 
 /**
@@ -627,7 +630,7 @@ static inline void NetSendPacket(uchar *pkt, int len)
  * @param sport Source UDP port
  * @param payload_len Length of data after the UDP header
  */
-int NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport,
+int NetSendUDPPacket(uchar *ether, struct in_addr dest, int dport,
 			int sport, int payload_len);
 
 #ifndef CONFIG_DM_ETH
@@ -638,7 +641,7 @@ void net_process_received_packet(uchar *in_packet, int len);
 
 #ifdef CONFIG_NETCONSOLE
 void NcStart(void);
-int nc_input_packet(uchar *pkt, IPaddr_t src_ip, unsigned dest_port,
+int nc_input_packet(uchar *pkt, struct in_addr src_ip, unsigned dest_port,
 	unsigned src_port, unsigned len);
 #endif
 
@@ -676,9 +679,9 @@ void net_auto_load(void);
  * footprint in our tests.
  */
 /* return IP *in network byteorder* */
-static inline IPaddr_t NetReadIP(void *from)
+static inline struct in_addr net_read_ip(void *from)
 {
-	IPaddr_t ip;
+	struct in_addr ip;
 
 	memcpy((void *)&ip, (void *)from, sizeof(ip));
 	return ip;
@@ -694,15 +697,15 @@ static inline ulong NetReadLong(ulong *from)
 }
 
 /* write IP *in network byteorder* */
-static inline void NetWriteIP(void *to, IPaddr_t ip)
+static inline void net_write_ip(void *to, struct in_addr ip)
 {
 	memcpy(to, (void *)&ip, sizeof(ip));
 }
 
 /* copy IP */
-static inline void NetCopyIP(void *to, void *from)
+static inline void net_copy_ip(void *to, void *from)
 {
-	memcpy((void *)to, from, sizeof(IPaddr_t));
+	memcpy((void *)to, from, sizeof(struct in_addr));
 }
 
 /* copy ulong */
@@ -782,10 +785,10 @@ static inline void eth_random_addr(uchar *addr)
 }
 
 /* Convert an IP address to a string */
-void ip_to_string(IPaddr_t x, char *s);
+void ip_to_string(struct in_addr x, char *s);
 
 /* Convert a string to ip address */
-IPaddr_t string_to_ip(const char *s);
+struct in_addr string_to_ip(const char *s);
 
 /* Convert a VLAN id to a string */
 void VLAN_to_string(ushort x, char *s);
diff --git a/lib/net_utils.c b/lib/net_utils.c
index 8d66163..cfae842 100644
--- a/lib/net_utils.c
+++ b/lib/net_utils.c
@@ -12,23 +12,25 @@
 
 #include <common.h>
 
-IPaddr_t string_to_ip(const char *s)
+struct in_addr string_to_ip(const char *s)
 {
-	IPaddr_t addr;
+	struct in_addr addr;
 	char *e;
 	int i;
 
+	addr.s_addr = 0;
 	if (s == NULL)
-		return(0);
+		return addr;
 
-	for (addr=0, i=0; i<4; ++i) {
+	for (addr.s_addr = 0, i = 0; i < 4; ++i) {
 		ulong val = s ? simple_strtoul(s, &e, 10) : 0;
-		addr <<= 8;
-		addr |= (val & 0xFF);
+		addr.s_addr <<= 8;
+		addr.s_addr |= (val & 0xFF);
 		if (s) {
 			s = (*e) ? e+1 : e;
 		}
 	}
 
-	return (htonl(addr));
+	addr.s_addr = htonl(addr.s_addr);
+	return addr;
 }
diff --git a/net/arp.c b/net/arp.c
index 21ed31b..07c2ba0 100644
--- a/net/arp.c
+++ b/net/arp.c
@@ -27,8 +27,8 @@
 # define ARP_TIMEOUT_COUNT	CONFIG_NET_RETRY_COUNT
 #endif
 
-IPaddr_t	NetArpWaitPacketIP;
-static IPaddr_t	NetArpWaitReplyIP;
+struct in_addr net_arp_wait_packet_ip;
+static struct in_addr net_arp_wait_reply_ip;
 /* MAC address of waiting packet's destination */
 uchar	       *NetArpWaitPacketMAC;
 int		NetArpWaitTxPacketSize;
@@ -42,15 +42,15 @@ void ArpInit(void)
 {
 	/* XXX problem with bss workaround */
 	NetArpWaitPacketMAC = NULL;
-	NetArpWaitPacketIP = 0;
-	NetArpWaitReplyIP = 0;
+	net_arp_wait_packet_ip.s_addr = 0;
+	net_arp_wait_reply_ip.s_addr = 0;
 	NetArpWaitTxPacketSize = 0;
 	NetArpTxPacket = &NetArpPacketBuf[0] + (PKTALIGN - 1);
 	NetArpTxPacket -= (ulong)NetArpTxPacket % PKTALIGN;
 }
 
-void arp_raw_request(IPaddr_t sourceIP, const uchar *targetEther,
-	IPaddr_t targetIP)
+void arp_raw_request(struct in_addr source_ip, const uchar *targetEther,
+	struct in_addr target_ip)
 {
 	uchar *pkt;
 	struct arp_hdr *arp;
@@ -72,35 +72,35 @@ void arp_raw_request(IPaddr_t sourceIP, const uchar *targetEther,
 	arp->ar_op = htons(ARPOP_REQUEST);
 
 	memcpy(&arp->ar_sha, NetOurEther, ARP_HLEN);	/* source ET addr */
-	NetWriteIP(&arp->ar_spa, sourceIP);		/* source IP addr */
+	net_write_ip(&arp->ar_spa, source_ip);		/* source IP addr */
 	memcpy(&arp->ar_tha, targetEther, ARP_HLEN);	/* target ET addr */
-	NetWriteIP(&arp->ar_tpa, targetIP);		/* target IP addr */
+	net_write_ip(&arp->ar_tpa, target_ip);		/* target IP addr */
 
 	NetSendPacket(NetArpTxPacket, eth_hdr_size + ARP_HDR_SIZE);
 }
 
 void ArpRequest(void)
 {
-	if ((NetArpWaitPacketIP & NetOurSubnetMask) !=
-	    (NetOurIP & NetOurSubnetMask)) {
-		if (NetOurGatewayIP == 0) {
+	if ((net_arp_wait_packet_ip.s_addr & net_netmask.s_addr) !=
+	    (net_ip.s_addr & net_netmask.s_addr)) {
+		if (net_gateway.s_addr == 0) {
 			puts("## Warning: gatewayip needed but not set\n");
-			NetArpWaitReplyIP = NetArpWaitPacketIP;
+			net_arp_wait_reply_ip = net_arp_wait_packet_ip;
 		} else {
-			NetArpWaitReplyIP = NetOurGatewayIP;
+			net_arp_wait_reply_ip = net_gateway;
 		}
 	} else {
-		NetArpWaitReplyIP = NetArpWaitPacketIP;
+		net_arp_wait_reply_ip = net_arp_wait_packet_ip;
 	}
 
-	arp_raw_request(NetOurIP, NetEtherNullAddr, NetArpWaitReplyIP);
+	arp_raw_request(net_ip, NetEtherNullAddr, net_arp_wait_reply_ip);
 }
 
 void ArpTimeoutCheck(void)
 {
 	ulong t;
 
-	if (!NetArpWaitPacketIP)
+	if (!net_arp_wait_packet_ip.s_addr)
 		return;
 
 	t = get_timer(0);
@@ -123,7 +123,7 @@ void ArpTimeoutCheck(void)
 void ArpReceive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
 {
 	struct arp_hdr *arp;
-	IPaddr_t reply_ip_addr;
+	struct in_addr reply_ip_addr;
 	uchar *pkt;
 	int eth_hdr_size;
 
@@ -152,10 +152,10 @@ void ArpReceive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
 	if (arp->ar_pln != ARP_PLEN)
 		return;
 
-	if (NetOurIP == 0)
+	if (net_ip.s_addr == 0)
 		return;
 
-	if (NetReadIP(&arp->ar_tpa) != NetOurIP)
+	if (net_read_ip(&arp->ar_tpa).s_addr != net_ip.s_addr)
 		return;
 
 	switch (ntohs(arp->ar_op)) {
@@ -167,9 +167,9 @@ void ArpReceive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
 		pkt += eth_hdr_size;
 		arp->ar_op = htons(ARPOP_REPLY);
 		memcpy(&arp->ar_tha, &arp->ar_sha, ARP_HLEN);
-		NetCopyIP(&arp->ar_tpa, &arp->ar_spa);
+		net_copy_ip(&arp->ar_tpa, &arp->ar_spa);
 		memcpy(&arp->ar_sha, NetOurEther, ARP_HLEN);
-		NetCopyIP(&arp->ar_spa, &NetOurIP);
+		net_copy_ip(&arp->ar_spa, &net_ip);
 
 #ifdef CONFIG_CMD_LINK_LOCAL
 		/*
@@ -180,8 +180,8 @@ void ArpReceive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
 		 *   reply to ARP request so that our reply will overwrite
 		 *   the arp-proxy's instead of the other way around.
 		 */
-		if ((NetReadIP(&arp->ar_tpa) & NetOurSubnetMask) !=
-		    (NetReadIP(&arp->ar_spa) & NetOurSubnetMask))
+		if ((net_read_ip(&arp->ar_tpa).s_addr & net_netmask.s_addr) !=
+		    (net_read_ip(&arp->ar_spa).s_addr & net_netmask.s_addr))
 			udelay(5000);
 #endif
 		NetSendPacket((uchar *)et, eth_hdr_size + ARP_HDR_SIZE);
@@ -189,21 +189,21 @@ void ArpReceive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
 
 	case ARPOP_REPLY:		/* arp reply */
 		/* are we waiting for a reply */
-		if (!NetArpWaitPacketIP)
+		if (!net_arp_wait_packet_ip.s_addr)
 			break;
 
 #ifdef CONFIG_KEEP_SERVERADDR
-		if (NetServerIP == NetArpWaitPacketIP) {
+		if (net_server_ip == net_arp_wait_packet_ip) {
 			char buf[20];
 			sprintf(buf, "%pM", &arp->ar_sha);
 			setenv("serveraddr", buf);
 		}
 #endif
 
-		reply_ip_addr = NetReadIP(&arp->ar_spa);
+		reply_ip_addr = net_read_ip(&arp->ar_spa);
 
 		/* matched waiting packet's address */
-		if (reply_ip_addr == NetArpWaitReplyIP) {
+		if (reply_ip_addr.s_addr == net_arp_wait_reply_ip.s_addr) {
 			debug_cond(DEBUG_DEV_PKT,
 				"Got ARP REPLY, set eth addr (%pM)\n",
 				arp->ar_data);
@@ -223,7 +223,7 @@ void ArpReceive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
 			NetSendPacket(NetTxPacket, NetArpWaitTxPacketSize);
 
 			/* no arp request pending now */
-			NetArpWaitPacketIP = 0;
+			net_arp_wait_packet_ip.s_addr = 0;
 			NetArpWaitTxPacketSize = 0;
 			NetArpWaitPacketMAC = NULL;
 
diff --git a/net/arp.h b/net/arp.h
index 3a0a13a..718342b 100644
--- a/net/arp.h
+++ b/net/arp.h
@@ -14,7 +14,7 @@
 
 #include <common.h>
 
-extern IPaddr_t	NetArpWaitPacketIP;
+extern struct in_addr net_arp_wait_packet_ip;
 /* MAC address of waiting packet's destination */
 extern uchar *NetArpWaitPacketMAC;
 extern int NetArpWaitTxPacketSize;
@@ -23,8 +23,8 @@ extern int NetArpWaitTry;
 
 void ArpInit(void);
 void ArpRequest(void);
-void arp_raw_request(IPaddr_t sourceIP, const uchar *targetEther,
-	IPaddr_t targetIP);
+void arp_raw_request(struct in_addr source_ip, const uchar *targetEther,
+	struct in_addr target_ip);
 void ArpTimeoutCheck(void);
 void ArpReceive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len);
 
diff --git a/net/bootp.c b/net/bootp.c
index 8106601..a56ed4c 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -60,9 +60,9 @@ ulong		bootp_timeout;
 #if defined(CONFIG_CMD_DHCP)
 static dhcp_state_t dhcp_state = INIT;
 static unsigned long dhcp_leasetime;
-static IPaddr_t NetDHCPServerIP;
-static void DhcpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
-			unsigned len);
+static struct in_addr dhcp_server_ip;
+static void dhcp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
+			unsigned src, unsigned len);
 
 /* For Debug */
 #if 0
@@ -139,11 +139,11 @@ static int BootpCheckPkt(uchar *pkt, unsigned dest, unsigned src, unsigned len)
 static void BootpCopyNetParams(struct Bootp_t *bp)
 {
 #if !defined(CONFIG_BOOTP_SERVERIP)
-	IPaddr_t tmp_ip;
+	struct in_addr tmp_ip;
 
-	NetCopyIP(&tmp_ip, &bp->bp_siaddr);
-	if (tmp_ip != 0)
-		NetCopyIP(&NetServerIP, &bp->bp_siaddr);
+	net_copy_ip(&tmp_ip, &bp->bp_siaddr);
+	if (tmp_ip.s_addr != 0)
+		net_copy_ip(&net_server_ip, &bp->bp_siaddr);
 	memcpy(NetServerEther, ((struct ethernet_hdr *)NetRxPacket)->et_src, 6);
 	if (strlen(bp->bp_file) > 0)
 		copy_filename(BootFile, bp->bp_file, sizeof(BootFile));
@@ -157,7 +157,7 @@ static void BootpCopyNetParams(struct Bootp_t *bp)
 	if (*BootFile)
 		setenv("bootfile", BootFile);
 #endif
-	NetCopyIP(&NetOurIP, &bp->bp_yiaddr);
+	net_copy_ip(&net_ip, &bp->bp_yiaddr);
 }
 
 static int truncate_sz(const char *name, int maxlen, int curlen)
@@ -184,26 +184,28 @@ static void BootpVendorFieldProcess(u8 *ext)
 	switch (*ext) {
 		/* Fixed length fields */
 	case 1:			/* Subnet mask */
-		if (NetOurSubnetMask == 0)
-			NetCopyIP(&NetOurSubnetMask, (IPaddr_t *) (ext + 2));
+		if (net_netmask.s_addr == 0)
+			net_copy_ip(&net_netmask, (struct in_addr *)(ext + 2));
 		break;
 	case 2:			/* Time offset - Not yet supported */
 		break;
 		/* Variable length fields */
 	case 3:			/* Gateways list */
-		if (NetOurGatewayIP == 0)
-			NetCopyIP(&NetOurGatewayIP, (IPaddr_t *) (ext + 2));
+		if (net_gateway.s_addr == 0)
+			net_copy_ip(&net_gateway, (struct in_addr *)(ext + 2));
 		break;
 	case 4:			/* Time server - Not yet supported */
 		break;
 	case 5:			/* IEN-116 name server - Not yet supported */
 		break;
 	case 6:
-		if (NetOurDNSIP == 0)
-			NetCopyIP(&NetOurDNSIP, (IPaddr_t *) (ext + 2));
+		if (net_dns_server.s_addr == 0)
+			net_copy_ip(&net_dns_server,
+				    (struct in_addr *)(ext + 2));
 #if defined(CONFIG_BOOTP_DNS2)
-		if ((NetOurDNS2IP == 0) && (size > 4))
-			NetCopyIP(&NetOurDNS2IP, (IPaddr_t *) (ext + 2 + 4));
+		if ((net_dns_server2.s_addr == 0) && (size > 4))
+			net_copy_ip(&net_dns_server2,
+				    (struct in_addr *)(ext + 2 + 4));
 #endif
 		break;
 	case 7:			/* Log server - Not yet supported */
@@ -262,7 +264,7 @@ static void BootpVendorFieldProcess(u8 *ext)
 		break;
 #if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_NTPSERVER)
 	case 42:	/* NTP server IP */
-		NetCopyIP(&NetNtpServerIP, (IPaddr_t *) (ext + 2));
+		net_copy_ip(&net_ntp_server, (struct in_addr *)(ext + 2));
 		break;
 #endif
 		/* Application layer fields */
@@ -295,11 +297,11 @@ static void BootpVendorProcess(u8 *ext, int size)
 	}
 
 	debug("[BOOTP] Received fields:\n");
-	if (NetOurSubnetMask)
-		debug("NetOurSubnetMask : %pI4\n", &NetOurSubnetMask);
+	if (net_netmask.s_addr)
+		debug("net_netmask : %pI4\n", &net_netmask);
 
-	if (NetOurGatewayIP)
-		debug("NetOurGatewayIP	: %pI4", &NetOurGatewayIP);
+	if (net_gateway.s_addr)
+		debug("net_gateway	: %pI4", &net_gateway);
 
 	if (NetBootFileSize)
 		debug("NetBootFileSize : %d\n", NetBootFileSize);
@@ -317,17 +319,16 @@ static void BootpVendorProcess(u8 *ext, int size)
 		debug("NetBootFileSize: %d\n", NetBootFileSize);
 
 #if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_NTPSERVER)
-	if (NetNtpServerIP)
-		debug("NetNtpServerIP : %pI4\n", &NetNtpServerIP);
+	if (net_ntp_server)
+		debug("net_ntp_server : %pI4\n", &net_ntp_server);
 #endif
 }
 
 /*
  *	Handle a BOOTP received packet.
  */
-static void
-BootpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
-	     unsigned len)
+static void bootp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
+			  unsigned src, unsigned len)
 {
 	struct Bootp_t *bp;
 
@@ -400,8 +401,8 @@ BootpTimeout(void)
  *	Initialize BOOTP extension fields in the request.
  */
 #if defined(CONFIG_CMD_DHCP)
-static int DhcpExtended(u8 *e, int message_type, IPaddr_t ServerID,
-			IPaddr_t RequestedIP)
+static int dhcp_extended(u8 *e, int message_type, struct in_addr server_ip,
+			struct in_addr requested_ip)
 {
 	u8 *start = e;
 	u8 *cnt;
@@ -431,8 +432,8 @@ static int DhcpExtended(u8 *e, int message_type, IPaddr_t ServerID,
 	*e++ = (576 - 312 + OPT_FIELD_SIZE) >> 8;
 	*e++ = (576 - 312 + OPT_FIELD_SIZE) & 0xff;
 
-	if (ServerID) {
-		int tmp = ntohl(ServerID);
+	if (server_ip.s_addr) {
+		int tmp = ntohl(server_ip.s_addr);
 
 		*e++ = 54;	/* ServerID */
 		*e++ = 4;
@@ -442,8 +443,8 @@ static int DhcpExtended(u8 *e, int message_type, IPaddr_t ServerID,
 		*e++ = tmp & 0xff;
 	}
 
-	if (RequestedIP) {
-		int tmp = ntohl(RequestedIP);
+	if (requested_ip.s_addr) {
+		int tmp = ntohl(requested_ip.s_addr);
 
 		*e++ = 50;	/* Requested IP */
 		*e++ = 4;
@@ -561,7 +562,7 @@ static int DhcpExtended(u8 *e, int message_type, IPaddr_t ServerID,
 /*
  * Warning: no field size check - change CONFIG_BOOTP_* at your own risk!
  */
-static int BootpExtended(u8 *e)
+static int bootp_extended(u8 *e)
 {
 	u8 *start = e;
 
@@ -662,6 +663,8 @@ BootpRequest(void)
 	ulong rand_ms;
 #endif
 	ulong BootpID;
+	struct in_addr zero_ip;
+	struct in_addr bcast_ip;
 
 	bootstage_mark_name(BOOTSTAGE_ID_BOOTP_START, "bootp_start");
 #if defined(CONFIG_CMD_DHCP)
@@ -707,18 +710,20 @@ BootpRequest(void)
 	bp->bp_hlen = HWL_ETHER;
 	bp->bp_hops = 0;
 	bp->bp_secs = htons(get_timer(0) / 1000);
-	NetWriteIP(&bp->bp_ciaddr, 0);
-	NetWriteIP(&bp->bp_yiaddr, 0);
-	NetWriteIP(&bp->bp_siaddr, 0);
-	NetWriteIP(&bp->bp_giaddr, 0);
+	zero_ip.s_addr = 0;
+	net_write_ip(&bp->bp_ciaddr, zero_ip);
+	net_write_ip(&bp->bp_yiaddr, zero_ip);
+	net_write_ip(&bp->bp_siaddr, zero_ip);
+	net_write_ip(&bp->bp_giaddr, zero_ip);
 	memcpy(bp->bp_chaddr, NetOurEther, 6);
 	copy_filename(bp->bp_file, BootFile, sizeof(bp->bp_file));
 
 	/* Request additional information from the BOOTP/DHCP server */
 #if defined(CONFIG_CMD_DHCP)
-	extlen = DhcpExtended((u8 *)bp->bp_vend, DHCP_DISCOVER, 0, 0);
+	extlen = dhcp_extended((u8 *)bp->bp_vend, DHCP_DISCOVER, zero_ip,
+			       zero_ip);
 #else
-	extlen = BootpExtended((u8 *)bp->bp_vend);
+	extlen = bootp_extended((u8 *)bp->bp_vend);
 #endif
 
 	/*
@@ -740,14 +745,15 @@ BootpRequest(void)
 	 */
 	iplen = BOOTP_HDR_SIZE - OPT_FIELD_SIZE + extlen;
 	pktlen = eth_hdr_size + IP_UDP_HDR_SIZE + iplen;
-	net_set_udp_header(iphdr, 0xFFFFFFFFL, PORT_BOOTPS, PORT_BOOTPC, iplen);
+	bcast_ip.s_addr = 0xFFFFFFFFL;
+	net_set_udp_header(iphdr, bcast_ip, PORT_BOOTPS, PORT_BOOTPC, iplen);
 	NetSetTimeout(bootp_timeout, BootpTimeout);
 
 #if defined(CONFIG_CMD_DHCP)
 	dhcp_state = SELECTING;
-	net_set_udp_handler(DhcpHandler);
+	net_set_udp_handler(dhcp_handler);
 #else
-	net_set_udp_handler(BootpHandler);
+	net_set_udp_handler(bootp_handler);
 #endif
 	NetSendPacket(NetTxPacket, pktlen);
 }
@@ -765,7 +771,7 @@ static void DhcpOptionsProcess(uchar *popt, struct Bootp_t *bp)
 		oplen = *(popt + 1);
 		switch (*popt) {
 		case 1:
-			NetCopyIP(&NetOurSubnetMask, (popt + 2));
+			net_copy_ip(&net_netmask, (popt + 2));
 			break;
 #if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_TIMEOFFSET)
 		case 2:		/* Time offset	*/
@@ -775,13 +781,13 @@ static void DhcpOptionsProcess(uchar *popt, struct Bootp_t *bp)
 			break;
 #endif
 		case 3:
-			NetCopyIP(&NetOurGatewayIP, (popt + 2));
+			net_copy_ip(&net_gateway, (popt + 2));
 			break;
 		case 6:
-			NetCopyIP(&NetOurDNSIP, (popt + 2));
+			net_copy_ip(&net_dns_server, (popt + 2));
 #if defined(CONFIG_BOOTP_DNS2)
 			if (*(popt + 1) > 4)
-				NetCopyIP(&NetOurDNS2IP, (popt + 2 + 4));
+				net_copy_ip(&net_dns_server2, (popt + 2 + 4));
 #endif
 			break;
 		case 12:
@@ -802,7 +808,7 @@ static void DhcpOptionsProcess(uchar *popt, struct Bootp_t *bp)
 			break;
 #if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_NTPSERVER)
 		case 42:	/* NTP server IP */
-			NetCopyIP(&NetNtpServerIP, (popt + 2));
+			net_copy_ip(&net_ntp_server, (popt + 2));
 			break;
 #endif
 		case 51:
@@ -811,7 +817,7 @@ static void DhcpOptionsProcess(uchar *popt, struct Bootp_t *bp)
 		case 53:	/* Ignore Message Type Option */
 			break;
 		case 54:
-			NetCopyIP(&NetDHCPServerIP, (popt + 2));
+			net_copy_ip(&dhcp_server_ip, (popt + 2));
 			break;
 		case 58:	/* Ignore Renewal Time Option */
 			break;
@@ -878,7 +884,9 @@ static void DhcpSendRequestPkt(struct Bootp_t *bp_offer)
 	struct Bootp_t *bp;
 	int pktlen, iplen, extlen;
 	int eth_hdr_size;
-	IPaddr_t OfferedIP;
+	struct in_addr offered_ip;
+	struct in_addr zero_ip;
+	struct in_addr bcast_ip;
 
 	debug("DhcpSendRequestPkt: Sending DHCPREQUEST\n");
 	pkt = NetTxPacket;
@@ -903,7 +911,8 @@ static void DhcpSendRequestPkt(struct Bootp_t *bp_offer)
 	 * RFC3046 requires Relay Agents to discard packets with
 	 * nonzero and offered giaddr
 	 */
-	NetWriteIP(&bp->bp_giaddr, 0);
+	zero_ip.s_addr = 0;
+	net_write_ip(&bp->bp_giaddr, zero_ip);
 
 	memcpy(bp->bp_chaddr, NetOurEther, 6);
 
@@ -918,13 +927,14 @@ static void DhcpSendRequestPkt(struct Bootp_t *bp_offer)
 	 */
 
 	/* Copy offered IP into the parameters request list */
-	NetCopyIP(&OfferedIP, &bp_offer->bp_yiaddr);
-	extlen = DhcpExtended((u8 *)bp->bp_vend, DHCP_REQUEST,
-		NetDHCPServerIP, OfferedIP);
+	net_copy_ip(&offered_ip, &bp_offer->bp_yiaddr);
+	extlen = dhcp_extended((u8 *)bp->bp_vend, DHCP_REQUEST,
+		dhcp_server_ip, offered_ip);
 
 	iplen = BOOTP_HDR_SIZE - OPT_FIELD_SIZE + extlen;
 	pktlen = eth_hdr_size + IP_UDP_HDR_SIZE + iplen;
-	net_set_udp_header(iphdr, 0xFFFFFFFFL, PORT_BOOTPS, PORT_BOOTPC, iplen);
+	bcast_ip.s_addr = 0xFFFFFFFFL;
+	net_set_udp_header(iphdr, bcast_ip, PORT_BOOTPS, PORT_BOOTPC, iplen);
 
 #ifdef CONFIG_BOOTP_DHCP_REQUEST_DELAY
 	udelay(CONFIG_BOOTP_DHCP_REQUEST_DELAY);
@@ -936,9 +946,8 @@ static void DhcpSendRequestPkt(struct Bootp_t *bp_offer)
 /*
  *	Handle DHCP received packets.
  */
-static void
-DhcpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
-	    unsigned len)
+static void dhcp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
+			 unsigned src, unsigned len)
 {
 	struct Bootp_t *bp = (struct Bootp_t *)pkt;
 
@@ -993,7 +1002,7 @@ DhcpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
 			BootpCopyNetParams(bp);
 			dhcp_state = BOUND;
 			printf("DHCP client bound to address %pI4 (%lu ms)\n",
-				&NetOurIP, get_timer(bootp_start));
+				&net_ip, get_timer(bootp_start));
 			bootstage_mark_name(BOOTSTAGE_ID_BOOTP_STOP,
 				"bootp_stop");
 
diff --git a/net/bootp.h b/net/bootp.h
index 3b95a0a..16f40dc 100644
--- a/net/bootp.h
+++ b/net/bootp.h
@@ -41,10 +41,10 @@ struct Bootp_t {
 	ulong		bp_id;		/* Transaction ID		*/
 	ushort		bp_secs;	/* Seconds since boot		*/
 	ushort		bp_spare1;	/* Alignment			*/
-	IPaddr_t	bp_ciaddr;	/* Client IP address		*/
-	IPaddr_t	bp_yiaddr;	/* Your (client) IP address	*/
-	IPaddr_t	bp_siaddr;	/* Server IP address		*/
-	IPaddr_t	bp_giaddr;	/* Gateway IP address		*/
+	struct in_addr	bp_ciaddr;	/* Client IP address		*/
+	struct in_addr	bp_yiaddr;	/* Your (client) IP address	*/
+	struct in_addr	bp_siaddr;	/* Server IP address		*/
+	struct in_addr	bp_giaddr;	/* Gateway IP address		*/
 	uchar		bp_chaddr[16];	/* Client hardware address	*/
 	char		bp_sname[64];	/* Server host name		*/
 	char		bp_file[128];	/* Boot file name		*/
diff --git a/net/dns.c b/net/dns.c
index dd45320..6f8b1f2 100644
--- a/net/dns.c
+++ b/net/dns.c
@@ -5,7 +5,7 @@
  * Copyright (c) 2009 Robin Getz <rgetz@blackfin.uclinux.org>
  *
  * This is a simple DNS implementation for U-Boot. It will use the first IP
- * in the DNS response as NetServerIP. This can then be used for any other
+ * in the DNS response as net_server_ip. This can then be used for any other
  * network related activities.
  *
  * The packet handling is partly based on TADNS, original copyrights
@@ -89,8 +89,8 @@ DnsSend(void)
 
 	DnsOurPort = random_port();
 
-	NetSendUDPPacket(NetServerEther, NetOurDNSIP, DNS_SERVICE_PORT,
-		DnsOurPort, n);
+	NetSendUDPPacket(NetServerEther, net_dns_server, DNS_SERVICE_PORT,
+			 DnsOurPort, n);
 	debug("DNS packet sent\n");
 }
 
@@ -101,15 +101,15 @@ DnsTimeout(void)
 	net_set_state(NETLOOP_FAIL);
 }
 
-static void
-DnsHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src, unsigned len)
+static void dns_handler(uchar *pkt, unsigned dest, struct in_addr sip,
+			unsigned src, unsigned len)
 {
 	struct header *header;
 	const unsigned char *p, *e, *s;
 	u16 type, i;
 	int found, stop, dlen;
 	char IPStr[22];
-	IPaddr_t IPAddress;
+	struct in_addr ip_addr;
 
 
 	debug("%s\n", __func__);
@@ -180,10 +180,10 @@ DnsHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src, unsigned len)
 
 		dlen = get_unaligned_be16(p+10);
 		p += 12;
-		memcpy(&IPAddress, p, 4);
+		memcpy(&ip_addr, p, 4);
 
 		if (p + dlen <= e) {
-			ip_to_string(IPAddress, IPStr);
+			ip_to_string(ip_addr, IPStr);
 			printf("%s\n", IPStr);
 			if (NetDNSenvvar)
 				setenv(NetDNSenvvar, IPStr);
@@ -200,7 +200,7 @@ DnsStart(void)
 	debug("%s\n", __func__);
 
 	NetSetTimeout(DNS_TIMEOUT, DnsTimeout);
-	net_set_udp_handler(DnsHandler);
+	net_set_udp_handler(dns_handler);
 
 	/* Clear a previous MAC address, the server IP might have changed. */
 	memset(NetServerEther, 0, sizeof(NetServerEther));
diff --git a/net/eth.c b/net/eth.c
index 13b7723..930470e 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -766,14 +766,14 @@ int eth_initialize(void)
  * mcast_addr: multicast ipaddr from which multicast Mac is made
  * join: 1=join, 0=leave.
  */
-int eth_mcast_join(IPaddr_t mcast_ip, int join)
+int eth_mcast_join(struct in_addr mcast_ip, int join)
 {
 	u8 mcast_mac[6];
 	if (!eth_current || !eth_current->mcast)
 		return -1;
-	mcast_mac[5] = htonl(mcast_ip) & 0xff;
-	mcast_mac[4] = (htonl(mcast_ip)>>8) & 0xff;
-	mcast_mac[3] = (htonl(mcast_ip)>>16) & 0x7f;
+	mcast_mac[5] = htonl(mcast_ip.s_addr) & 0xff;
+	mcast_mac[4] = (htonl(mcast_ip.s_addr)>>8) & 0xff;
+	mcast_mac[3] = (htonl(mcast_ip.s_addr)>>16) & 0x7f;
 	mcast_mac[2] = 0x5e;
 	mcast_mac[1] = 0x0;
 	mcast_mac[0] = 0x1;
diff --git a/net/link_local.c b/net/link_local.c
index 4152fae..23a06cb 100644
--- a/net/link_local.c
+++ b/net/link_local.c
@@ -49,7 +49,7 @@ static enum ll_state_t {
 	DISABLED
 } state = DISABLED;
 
-static IPaddr_t ip;
+static struct in_addr ip;
 static int timeout_ms = -1;
 static unsigned deadline_ms;
 static unsigned conflicts;
@@ -64,14 +64,14 @@ static void link_local_timeout(void);
  * Pick a random link local IP address on 169.254/16, except that
  * the first and last 256 addresses are reserved.
  */
-static IPaddr_t pick(void)
+static struct in_addr pick(void)
 {
 	unsigned tmp;
 
 	do {
 		tmp = rand_r(&seed) & IN_CLASSB_HOST;
 	} while (tmp > (IN_CLASSB_HOST - 0x0200));
-	return (IPaddr_t) htonl((LINKLOCAL_ADDR + 0x0100) + tmp);
+	return (struct in_addr) htonl((LINKLOCAL_ADDR + 0x0100) + tmp);
 }
 
 /**
@@ -102,16 +102,17 @@ static void configure_wait(void)
 
 void link_local_start(void)
 {
-	ip = getenv_IPaddr("llipaddr");
-	if (ip != 0 && (ntohl(ip) & IN_CLASSB_NET) != LINKLOCAL_ADDR) {
+	ip = getenv_ip("llipaddr");
+	if (ip.s_addr != 0 &&
+	    (ntohl(ip.s_addr) & IN_CLASSB_NET) != LINKLOCAL_ADDR) {
 		puts("invalid link address");
 		net_set_state(NETLOOP_FAIL);
 		return;
 	}
-	NetOurSubnetMask = IN_CLASSB_NET;
+	net_netmask.s_addr = IN_CLASSB_NET;
 
 	seed = seed_mac();
-	if (ip == 0)
+	if (ip.s_addr == 0)
 		ip = pick();
 
 	state = PROBE;
@@ -172,7 +173,7 @@ static void link_local_timeout(void)
 			/* Switch to monitor state */
 			state = MONITOR;
 			printf("Successfully assigned %pI4\n", &ip);
-			NetCopyIP(&NetOurIP, &ip);
+			net_copy_ip(&net_ip, &ip);
 			ready = 1;
 			conflicts = 0;
 			timeout_ms = -1;
@@ -206,7 +207,7 @@ void link_local_receive_arp(struct arp_hdr *arp, int len)
 {
 	int source_ip_conflict;
 	int target_ip_conflict;
-	IPaddr_t null_ip = 0;
+	struct in_addr null_ip = {.s_addr = 0};
 
 	if (state == DISABLED)
 		return;
@@ -322,7 +323,7 @@ void link_local_receive_arp(struct arp_hdr *arp, int len)
 			state = PROBE;
 			debug("defend conflict -- starting over\n");
 			ready = 0;
-			NetOurIP = 0;
+			net_ip.s_addr = 0;
 
 			/* restart the whole protocol */
 			ip = pick();
diff --git a/net/net.c b/net/net.c
index 69f38f7..d86fb1d 100644
--- a/net/net.c
+++ b/net/net.c
@@ -112,14 +112,14 @@ DECLARE_GLOBAL_DATA_PTR;
 /** BOOTP EXTENTIONS **/
 
 /* Our subnet mask (0=unknown) */
-IPaddr_t	NetOurSubnetMask;
+struct in_addr net_netmask;
 /* Our gateways IP address */
-IPaddr_t	NetOurGatewayIP;
+struct in_addr net_gateway;
 /* Our DNS IP address */
-IPaddr_t	NetOurDNSIP;
+struct in_addr net_dns_server;
 #if defined(CONFIG_BOOTP_DNS2)
 /* Our 2nd DNS IP address */
-IPaddr_t	NetOurDNS2IP;
+struct in_addr net_dns_server2;
 #endif
 /* Our NIS domain */
 char		NetOurNISDomain[32] = {0,};
@@ -131,7 +131,7 @@ char		NetOurRootPath[64] = {0,};
 ushort		NetBootFileSize;
 
 #ifdef CONFIG_MCAST_TFTP	/* Multicast TFTP */
-IPaddr_t Mcast_addr;
+struct in_addr net_mcast_addr;
 #endif
 
 /** END OF BOOTP EXTENTIONS **/
@@ -143,9 +143,9 @@ uchar		NetOurEther[6];
 /* Boot server enet address */
 uchar		NetServerEther[6];
 /* Our IP addr (0 = unknown) */
-IPaddr_t	NetOurIP;
+struct in_addr	net_ip;
 /* Server IP addr (0 = unknown) */
-IPaddr_t	NetServerIP;
+struct in_addr	net_server_ip;
 /* Current receive packet */
 uchar *NetRxPacket;
 /* Current rx packet length */
@@ -178,7 +178,7 @@ char		BootFile[128];
 
 #if defined(CONFIG_CMD_SNTP)
 /* NTP server IP address */
-IPaddr_t	NetNtpServerIP;
+struct in_addr	net_ntp_server;
 /* offset time from UTC */
 int		NetTimeOffset;
 #endif
@@ -267,14 +267,14 @@ static void NetInitLoop(void)
 
 	/* update only when the environment has changed */
 	if (env_changed_id != env_id) {
-		NetOurIP = getenv_IPaddr("ipaddr");
-		NetOurGatewayIP = getenv_IPaddr("gatewayip");
-		NetOurSubnetMask = getenv_IPaddr("netmask");
-		NetServerIP = getenv_IPaddr("serverip");
+		net_ip = getenv_ip("ipaddr");
+		net_gateway = getenv_ip("gatewayip");
+		net_netmask = getenv_ip("netmask");
+		net_server_ip = getenv_ip("serverip");
 		NetOurNativeVLAN = getenv_VLAN("nvlan");
 		NetOurVLAN = getenv_VLAN("vlan");
 #if defined(CONFIG_CMD_DNS)
-		NetOurDNSIP = getenv_IPaddr("dnsip");
+		net_dns_server = getenv_ip("dnsip");
 #endif
 		env_changed_id = env_id;
 	}
@@ -397,21 +397,21 @@ restart:
 #if defined(CONFIG_CMD_DHCP)
 		case DHCP:
 			BootpReset();
-			NetOurIP = 0;
+			net_ip.s_addr = 0;
 			DhcpRequest();		/* Basically same as BOOTP */
 			break;
 #endif
 
 		case BOOTP:
 			BootpReset();
-			NetOurIP = 0;
+			net_ip.s_addr = 0;
 			BootpRequest();
 			break;
 
 #if defined(CONFIG_CMD_RARP)
 		case RARP:
 			RarpTry = 0;
-			NetOurIP = 0;
+			net_ip.s_addr = 0;
 			RarpRequest();
 			break;
 #endif
@@ -496,7 +496,7 @@ restart:
 		 */
 		if (ctrlc()) {
 			/* cancel any ARP that may not have completed */
-			NetArpWaitPacketIP = 0;
+			net_arp_wait_packet_ip.s_addr = 0;
 
 			net_cleanup_loop();
 			eth_halt();
@@ -660,7 +660,7 @@ int NetStartAgain(void)
  */
 
 static void dummy_handler(uchar *pkt, unsigned dport,
-			IPaddr_t sip, unsigned sport,
+			struct in_addr sip, unsigned sport,
 			unsigned len)
 {
 }
@@ -716,7 +716,7 @@ NetSetTimeout(ulong iv, thand_f *f)
 	}
 }
 
-int NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport,
+int NetSendUDPPacket(uchar *ether, struct in_addr dest, int dport, int sport,
 		int payload_len)
 {
 	uchar *pkt;
@@ -729,11 +729,11 @@ int NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport,
 		return -1;
 
 	/* convert to new style broadcast */
-	if (dest == 0)
-		dest = 0xFFFFFFFF;
+	if (dest.s_addr == 0)
+		dest.s_addr = 0xFFFFFFFF;
 
 	/* if broadcast, make the ether address a broadcast and don't do ARP */
-	if (dest == 0xFFFFFFFF)
+	if (dest.s_addr == 0xFFFFFFFF)
 		ether = NetBcastAddr;
 
 	pkt = (uchar *)NetTxPacket;
@@ -748,7 +748,7 @@ int NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport,
 		debug_cond(DEBUG_DEV_PKT, "sending ARP for %pI4\n", &dest);
 
 		/* save the ip and eth addr for the packet to send after arp */
-		NetArpWaitPacketIP = dest;
+		net_arp_wait_packet_ip = dest;
 		NetArpWaitPacketMAC = ether;
 
 		/* size of the waiting packet */
@@ -946,7 +946,7 @@ static inline struct ip_udp_hdr *NetDefragment(struct ip_udp_hdr *ip, int *lenp)
  * @parma ip	IP packet containing the ICMP
  */
 static void receive_icmp(struct ip_udp_hdr *ip, int len,
-			IPaddr_t src_ip, struct ethernet_hdr *et)
+			struct in_addr src_ip, struct ethernet_hdr *et)
 {
 	struct icmp_hdr *icmph = (struct icmp_hdr *)&ip->udp_src;
 
@@ -975,8 +975,8 @@ void net_process_received_packet(uchar *in_packet, int len)
 {
 	struct ethernet_hdr *et;
 	struct ip_udp_hdr *ip;
-	IPaddr_t dst_ip;
-	IPaddr_t src_ip;
+	struct in_addr dst_ip;
+	struct in_addr src_ip;
 	int eth_proto;
 #if defined(CONFIG_CMD_CDP)
 	int iscdp;
@@ -1112,15 +1112,16 @@ void net_process_received_packet(uchar *in_packet, int len)
 			return;
 		}
 		/* If it is not for us, ignore it */
-		dst_ip = NetReadIP(&ip->ip_dst);
-		if (NetOurIP && dst_ip != NetOurIP && dst_ip != 0xFFFFFFFF) {
+		dst_ip = net_read_ip(&ip->ip_dst);
+		if (net_ip.s_addr && dst_ip.s_addr != net_ip.s_addr &&
+		    dst_ip.s_addr != 0xFFFFFFFF) {
 #ifdef CONFIG_MCAST_TFTP
-			if (Mcast_addr != dst_ip)
+			if (net_mcast_addr != dst_ip)
 #endif
 				return;
 		}
 		/* Read source IP address for later use */
-		src_ip = NetReadIP(&ip->ip_src);
+		src_ip = net_read_ip(&ip->ip_src);
 		/*
 		 * The function returns the unchanged packet if it's not
 		 * a fragment, and either the complete packet or NULL if
@@ -1232,7 +1233,7 @@ static int net_check_prereq(enum proto_t protocol)
 		/* Fall through */
 #if defined(CONFIG_CMD_PING)
 	case PING:
-		if (NetPingIP == 0) {
+		if (net_ping_ip.s_addr == 0) {
 			puts("*** ERROR: ping address not given\n");
 			return 1;
 		}
@@ -1240,7 +1241,7 @@ static int net_check_prereq(enum proto_t protocol)
 #endif
 #if defined(CONFIG_CMD_SNTP)
 	case SNTP:
-		if (NetNtpServerIP == 0) {
+		if (net_ntp_server.s_addr == 0) {
 			puts("*** ERROR: NTP server address not given\n");
 			return 1;
 		}
@@ -1248,7 +1249,7 @@ static int net_check_prereq(enum proto_t protocol)
 #endif
 #if defined(CONFIG_CMD_DNS)
 	case DNS:
-		if (NetOurDNSIP == 0) {
+		if (net_dns_server.s_addr == 0) {
 			puts("*** ERROR: DNS server address not given\n");
 			return 1;
 		}
@@ -1259,7 +1260,7 @@ static int net_check_prereq(enum proto_t protocol)
 #endif
 	case TFTPGET:
 	case TFTPPUT:
-		if (NetServerIP == 0) {
+		if (net_server_ip.s_addr == 0) {
 			puts("*** ERROR: `serverip' not set\n");
 			return 1;
 		}
@@ -1271,7 +1272,7 @@ common:
 
 	case NETCONS:
 	case TFTPSRV:
-		if (NetOurIP == 0) {
+		if (net_ip.s_addr == 0) {
 			puts("*** ERROR: `ipaddr' not set\n");
 			return 1;
 		}
@@ -1373,7 +1374,7 @@ int net_update_ether(struct ethernet_hdr *et, uchar *addr, uint prot)
 	}
 }
 
-void net_set_ip_header(uchar *pkt, IPaddr_t dest, IPaddr_t source)
+void net_set_ip_header(uchar *pkt, struct in_addr dest, struct in_addr source)
 {
 	struct ip_udp_hdr *ip = (struct ip_udp_hdr *)pkt;
 
@@ -1389,12 +1390,12 @@ void net_set_ip_header(uchar *pkt, IPaddr_t dest, IPaddr_t source)
 	ip->ip_ttl   = 255;
 	ip->ip_sum   = 0;
 	/* already in network byte order */
-	NetCopyIP((void *)&ip->ip_src, &source);
+	net_copy_ip((void *)&ip->ip_src, &source);
 	/* already in network byte order */
-	NetCopyIP((void *)&ip->ip_dst, &dest);
+	net_copy_ip((void *)&ip->ip_dst, &dest);
 }
 
-void net_set_udp_header(uchar *pkt, IPaddr_t dest, int dport, int sport,
+void net_set_udp_header(uchar *pkt, struct in_addr dest, int dport, int sport,
 			int len)
 {
 	struct ip_udp_hdr *ip = (struct ip_udp_hdr *)pkt;
@@ -1407,7 +1408,7 @@ void net_set_udp_header(uchar *pkt, IPaddr_t dest, int dport, int sport,
 	if (len & 1)
 		pkt[IP_UDP_HDR_SIZE + len] = 0;
 
-	net_set_ip_header(pkt, dest, NetOurIP);
+	net_set_ip_header(pkt, dest, net_ip);
 	ip->ip_len   = htons(IP_UDP_HDR_SIZE + len);
 	ip->ip_p     = IPPROTO_UDP;
 	ip->ip_sum   = compute_ip_checksum(ip, IP_HDR_SIZE);
@@ -1444,13 +1445,14 @@ unsigned int random_port(void)
 }
 #endif
 
-void ip_to_string(IPaddr_t x, char *s)
+void ip_to_string(struct in_addr x, char *s)
 {
-	x = ntohl(x);
+	x.s_addr = ntohl(x.s_addr);
 	sprintf(s, "%d.%d.%d.%d",
-		(int) ((x >> 24) & 0xff),
-		(int) ((x >> 16) & 0xff),
-		(int) ((x >> 8) & 0xff), (int) ((x >> 0) & 0xff)
+		(int) ((x.s_addr >> 24) & 0xff),
+		(int) ((x.s_addr >> 16) & 0xff),
+		(int) ((x.s_addr >> 8) & 0xff),
+		(int) ((x.s_addr >> 0) & 0xff)
 	);
 }
 
diff --git a/net/nfs.c b/net/nfs.c
index 8e05ae5..34e5051 100644
--- a/net/nfs.c
+++ b/net/nfs.c
@@ -51,7 +51,7 @@ static char dirfh[NFS_FHSIZE];	/* file handle of directory */
 static char filefh[NFS_FHSIZE]; /* file handle of kernel image */
 
 static enum net_loop_state nfs_download_state;
-static IPaddr_t NfsServerIP;
+static struct in_addr nfs_server_ip;
 static int	NfsSrvMountPort;
 static int	NfsSrvNfsPort;
 static int	NfsOurPort;
@@ -211,8 +211,8 @@ rpc_req(int rpc_prog, int rpc_proc, uint32_t *data, int datalen)
 	else
 		sport = NfsSrvNfsPort;
 
-	NetSendUDPPacket(NetServerEther, NfsServerIP, sport, NfsOurPort,
-		pktlen);
+	NetSendUDPPacket(NetServerEther, nfs_server_ip, sport, NfsOurPort,
+			 pktlen);
 }
 
 /**************************************************************************
@@ -600,8 +600,8 @@ NfsTimeout(void)
 	}
 }
 
-static void
-NfsHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src, unsigned len)
+static void nfs_handler(uchar *pkt, unsigned dest, struct in_addr sip,
+			unsigned src, unsigned len)
 {
 	int rlen;
 	int reply;
@@ -715,7 +715,7 @@ NfsStart(void)
 	debug("%s\n", __func__);
 	nfs_download_state = NETLOOP_FAIL;
 
-	NfsServerIP = NetServerIP;
+	nfs_server_ip = net_server_ip;
 	nfs_path = (char *)nfs_path_buff;
 
 	if (nfs_path == NULL) {
@@ -726,10 +726,10 @@ NfsStart(void)
 
 	if (BootFile[0] == '\0') {
 		sprintf(default_filename, "/nfsroot/%02X%02X%02X%02X.img",
-			NetOurIP & 0xFF,
-			(NetOurIP >>  8) & 0xFF,
-			(NetOurIP >> 16) & 0xFF,
-			(NetOurIP >> 24) & 0xFF);
+			net_ip.s_addr & 0xFF,
+			(net_ip.s_addr >>  8) & 0xFF,
+			(net_ip.s_addr >> 16) & 0xFF,
+			(net_ip.s_addr >> 24) & 0xFF);
 		strcpy(nfs_path, default_filename);
 
 		printf("*** Warning: no boot file name; using '%s'\n",
@@ -740,7 +740,7 @@ NfsStart(void)
 		p = strchr(p, ':');
 
 		if (p != NULL) {
-			NfsServerIP = string_to_ip(BootFile);
+			nfs_server_ip = string_to_ip(BootFile);
 			++p;
 			strcpy(nfs_path, p);
 		} else {
@@ -753,17 +753,19 @@ NfsStart(void)
 
 	printf("Using %s device\n", eth_get_name());
 
-	printf("File transfer via NFS from server %pI4"
-		"; our IP address is %pI4", &NfsServerIP, &NetOurIP);
+	printf("File transfer via NFS from server %pI4; our IP address is %pI4",
+	       &nfs_server_ip, &net_ip);
 
 	/* Check if we need to send across this subnet */
-	if (NetOurGatewayIP && NetOurSubnetMask) {
-		IPaddr_t OurNet	    = NetOurIP	  & NetOurSubnetMask;
-		IPaddr_t ServerNet  = NetServerIP & NetOurSubnetMask;
+	if (net_gateway.s_addr && net_netmask.s_addr) {
+		struct in_addr our_net;
+		struct in_addr server_net;
 
-		if (OurNet != ServerNet)
+		our_net.s_addr = net_ip.s_addr & net_netmask.s_addr;
+		server_net.s_addr = net_server_ip.s_addr & net_netmask.s_addr;
+		if (our_net.s_addr != server_net.s_addr)
 			printf("; sending through gateway %pI4",
-				&NetOurGatewayIP);
+				&net_gateway);
 	}
 	printf("\nFilename '%s/%s'.", nfs_path, nfs_filename);
 
@@ -775,7 +777,7 @@ NfsStart(void)
 		"Loading: *\b", load_addr);
 
 	NetSetTimeout(nfs_timeout, NfsTimeout);
-	net_set_udp_handler(NfsHandler);
+	net_set_udp_handler(nfs_handler);
 
 	NfsTimeoutCount = 0;
 	NfsState = STATE_PRCLOOKUP_PROG_MOUNT_REQ;
diff --git a/net/ping.c b/net/ping.c
index 366f518..4918a1c 100644
--- a/net/ping.c
+++ b/net/ping.c
@@ -15,9 +15,9 @@
 static ushort PingSeqNo;
 
 /* The ip address to ping */
-IPaddr_t NetPingIP;
+struct in_addr net_ping_ip;
 
-static void set_icmp_header(uchar *pkt, IPaddr_t dest)
+static void set_icmp_header(uchar *pkt, struct in_addr dest)
 {
 	/*
 	 *	Construct an IP and ICMP header.
@@ -25,7 +25,7 @@ static void set_icmp_header(uchar *pkt, IPaddr_t dest)
 	struct ip_hdr *ip = (struct ip_hdr *)pkt;
 	struct icmp_hdr *icmp = (struct icmp_hdr *)(pkt + IP_HDR_SIZE);
 
-	net_set_ip_header(pkt, dest, NetOurIP);
+	net_set_ip_header(pkt, dest, net_ip);
 
 	ip->ip_len   = htons(IP_ICMP_HDR_SIZE);
 	ip->ip_p     = IPPROTO_ICMP;
@@ -46,14 +46,14 @@ static int ping_send(void)
 
 	/* XXX always send arp request */
 
-	debug_cond(DEBUG_DEV_PKT, "sending ARP for %pI4\n", &NetPingIP);
+	debug_cond(DEBUG_DEV_PKT, "sending ARP for %pI4\n", &net_ping_ip);
 
-	NetArpWaitPacketIP = NetPingIP;
+	net_arp_wait_packet_ip = net_ping_ip;
 
 	eth_hdr_size = NetSetEther(NetTxPacket, NetEtherNullAddr, PROT_IP);
 	pkt = (uchar *)NetTxPacket + eth_hdr_size;
 
-	set_icmp_header(pkt, NetPingIP);
+	set_icmp_header(pkt, net_ping_ip);
 
 	/* size of the waiting packet */
 	NetArpWaitTxPacketSize = eth_hdr_size + IP_ICMP_HDR_SIZE;
@@ -82,13 +82,13 @@ void ping_start(void)
 void ping_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
 {
 	struct icmp_hdr *icmph = (struct icmp_hdr *)&ip->udp_src;
-	IPaddr_t src_ip;
+	struct in_addr src_ip;
 	int eth_hdr_size;
 
 	switch (icmph->type) {
 	case ICMP_ECHO_REPLY:
-		src_ip = NetReadIP((void *)&ip->ip_src);
-		if (src_ip == NetPingIP)
+		src_ip = net_read_ip((void *)&ip->ip_src);
+		if (src_ip.s_addr == net_ping_ip.s_addr)
 			net_set_state(NETLOOP_SUCCESS);
 		return;
 	case ICMP_ECHO_REQUEST:
@@ -99,8 +99,8 @@ void ping_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
 
 		ip->ip_sum = 0;
 		ip->ip_off = 0;
-		NetCopyIP((void *)&ip->ip_dst, &ip->ip_src);
-		NetCopyIP((void *)&ip->ip_src, &NetOurIP);
+		net_copy_ip((void *)&ip->ip_dst, &ip->ip_src);
+		net_copy_ip((void *)&ip->ip_src, &net_ip);
 		ip->ip_sum = compute_ip_checksum(ip, IP_HDR_SIZE);
 
 		icmph->type = ICMP_ECHO_REPLY;
diff --git a/net/rarp.c b/net/rarp.c
index a8e0851..4c48bd5 100644
--- a/net/rarp.c
+++ b/net/rarp.c
@@ -43,9 +43,9 @@ void rarp_receive(struct ip_udp_hdr *ip, unsigned len)
 
 		puts("invalid RARP header\n");
 	} else {
-		NetCopyIP(&NetOurIP, &arp->ar_data[16]);
-		if (NetServerIP == 0)
-			NetCopyIP(&NetServerIP, &arp->ar_data[6]);
+		net_copy_ip(&net_ip, &arp->ar_data[16]);
+		if (net_server_ip == 0)
+			net_copy_ip(&net_server_ip, &arp->ar_data[6]);
 		memcpy(NetServerEther, &arp->ar_data[0], 6);
 		debug_cond(DEBUG_DEV_PKT, "Got good RARP\n");
 		net_auto_load();
@@ -88,7 +88,7 @@ void RarpRequest(void)
 	rarp->ar_pln = 4;
 	rarp->ar_op  = htons(RARPOP_REQUEST);
 	memcpy(&rarp->ar_data[0],  NetOurEther, 6);	/* source ET addr */
-	memcpy(&rarp->ar_data[6],  &NetOurIP,   4);	/* source IP addr */
+	memcpy(&rarp->ar_data[6],  &net_ip,   4);	/* source IP addr */
 	/* dest ET addr = source ET addr ??*/
 	memcpy(&rarp->ar_data[10], NetOurEther, 6);
 	/* dest IP addr set to broadcast */
diff --git a/net/sntp.c b/net/sntp.c
index 5de1952..3e45a83 100644
--- a/net/sntp.c
+++ b/net/sntp.c
@@ -37,8 +37,8 @@ SntpSend(void)
 	SntpOurPort = 10000 + (get_timer(0) % 4096);
 	sport = NTP_SERVICE_PORT;
 
-	NetSendUDPPacket(NetServerEther, NetNtpServerIP, sport, SntpOurPort,
-		pktlen);
+	NetSendUDPPacket(NetServerEther, net_ntp_server, sport, SntpOurPort,
+			 pktlen);
 }
 
 static void
@@ -49,9 +49,8 @@ SntpTimeout(void)
 	return;
 }
 
-static void
-SntpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
-	    unsigned len)
+static void sntp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
+			 unsigned src, unsigned len)
 {
 	struct sntp_pkt_t *rpktp = (struct sntp_pkt_t *)pkt;
 	struct rtc_time tm;
@@ -85,7 +84,7 @@ SntpStart(void)
 	debug("%s\n", __func__);
 
 	NetSetTimeout(SNTP_TIMEOUT, SntpTimeout);
-	net_set_udp_handler(SntpHandler);
+	net_set_udp_handler(sntp_handler);
 	memset(NetServerEther, 0, sizeof(NetServerEther));
 
 	SntpSend();
diff --git a/net/tftp.c b/net/tftp.c
index 51c67be..4c985fa 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -65,7 +65,7 @@ enum {
 	TFTP_ERR_FILE_ALREADY_EXISTS = 6,
 };
 
-static IPaddr_t TftpRemoteIP;
+static struct in_addr tftp_remote_ip;
 /* The UDP port at their end */
 static int	TftpRemotePort;
 /* The UDP port at our end */
@@ -146,12 +146,14 @@ static void parse_multicast_oack(char *pkt, int len);
 static void
 mcast_cleanup(void)
 {
-	if (Mcast_addr)
-		eth_mcast_join(Mcast_addr, 0);
+	if (net_mcast_addr)
+		eth_mcast_join(net_mcast_addr, 0);
 	if (Bitmap)
 		free(Bitmap);
 	Bitmap = NULL;
-	Mcast_addr = Multicast = Mcast_port = 0;
+	net_mcast_addr.s_addr = 0;
+	Multicast = 0;
+	Mcast_port = 0;
 	TftpEndingBlock = -1;
 }
 
@@ -433,13 +435,14 @@ TftpSend(void)
 		break;
 	}
 
-	NetSendUDPPacket(NetServerEther, TftpRemoteIP, TftpRemotePort,
+	NetSendUDPPacket(NetServerEther, tftp_remote_ip, TftpRemotePort,
 			 TftpOurPort, len);
 }
 
 #ifdef CONFIG_CMD_TFTPPUT
 static void icmp_handler(unsigned type, unsigned code, unsigned dest,
-			 IPaddr_t sip, unsigned src, uchar *pkt, unsigned len)
+			 struct in_addr sip, unsigned src, uchar *pkt,
+			 unsigned len)
 {
 	if (type == ICMP_NOT_REACH && code == ICMP_NOT_REACH_PORT) {
 		/* Oh dear the other end has gone away */
@@ -448,9 +451,8 @@ static void icmp_handler(unsigned type, unsigned code, unsigned dest,
 }
 #endif
 
-static void
-TftpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
-	    unsigned len)
+static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
+			 unsigned src, unsigned len)
 {
 	__be16 proto;
 	__be16 *s;
@@ -507,7 +509,7 @@ TftpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
 #ifdef CONFIG_CMD_TFTPSRV
 	case TFTP_WRQ:
 		debug("Got WRQ\n");
-		TftpRemoteIP = sip;
+		tftp_remote_ip = sip;
 		TftpRemotePort = src;
 		TftpOurPort = 1024 + (get_timer(0) % 3072);
 		new_transfer();
@@ -717,13 +719,13 @@ void TftpStart(enum proto_t protocol)
 	debug("TFTP blocksize = %i, timeout = %ld ms\n",
 		TftpBlkSizeOption, TftpTimeoutMSecs);
 
-	TftpRemoteIP = NetServerIP;
+	tftp_remote_ip = net_server_ip;
 	if (BootFile[0] == '\0') {
 		sprintf(default_filename, "%02X%02X%02X%02X.img",
-			NetOurIP & 0xFF,
-			(NetOurIP >>  8) & 0xFF,
-			(NetOurIP >> 16) & 0xFF,
-			(NetOurIP >> 24) & 0xFF);
+			net_ip.s_addr & 0xFF,
+			(net_ip.s_addr >>  8) & 0xFF,
+			(net_ip.s_addr >> 16) & 0xFF,
+			(net_ip.s_addr >> 24) & 0xFF);
 
 		strncpy(tftp_filename, default_filename, MAX_LEN);
 		tftp_filename[MAX_LEN-1] = 0;
@@ -737,7 +739,7 @@ void TftpStart(enum proto_t protocol)
 			strncpy(tftp_filename, BootFile, MAX_LEN);
 			tftp_filename[MAX_LEN-1] = 0;
 		} else {
-			TftpRemoteIP = string_to_ip(BootFile);
+			tftp_remote_ip = string_to_ip(BootFile);
 			strncpy(tftp_filename, p + 1, MAX_LEN);
 			tftp_filename[MAX_LEN-1] = 0;
 		}
@@ -750,16 +752,17 @@ void TftpStart(enum proto_t protocol)
 #else
 		"from",
 #endif
-		&TftpRemoteIP, &NetOurIP);
+		&tftp_remote_ip, &net_ip);
 
 	/* Check if we need to send across this subnet */
-	if (NetOurGatewayIP && NetOurSubnetMask) {
-		IPaddr_t OurNet	= NetOurIP    & NetOurSubnetMask;
-		IPaddr_t RemoteNet	= TftpRemoteIP & NetOurSubnetMask;
-
-		if (OurNet != RemoteNet)
-			printf("; sending through gateway %pI4",
-			       &NetOurGatewayIP);
+	if (net_gateway.s_addr && net_netmask.s_addr) {
+		struct in_addr our_net;
+		struct in_addr remote_net;
+
+		our_net.s_addr = net_ip.s_addr & net_netmask.s_addr;
+		remote_net.s_addr = tftp_remote_ip.s_addr & net_netmask.s_addr;
+		if (our_net.s_addr != remote_net.s_addr)
+			printf("; sending through gateway %pI4", &net_gateway);
 	}
 	putc('\n');
 
@@ -792,7 +795,7 @@ void TftpStart(enum proto_t protocol)
 	TftpTimeoutCountMax = TftpRRQTimeoutCountMax;
 
 	NetSetTimeout(TftpTimeoutMSecs, TftpTimeout);
-	net_set_udp_handler(TftpHandler);
+	net_set_udp_handler(tftp_handler);
 #ifdef CONFIG_CMD_TFTPPUT
 	net_set_icmp_handler(icmp_handler);
 #endif
@@ -833,7 +836,7 @@ TftpStartServer(void)
 	tftp_filename[0] = 0;
 
 	printf("Using %s device\n", eth_get_name());
-	printf("Listening for TFTP transfer on %pI4\n", &NetOurIP);
+	printf("Listening for TFTP transfer on %pI4\n", &net_ip);
 	printf("Load address: 0x%lx\n", load_addr);
 
 	puts("Loading: *\b");
@@ -854,7 +857,7 @@ TftpStartServer(void)
 #endif
 
 	TftpState = STATE_RECV_WRQ;
-	net_set_udp_handler(TftpHandler);
+	net_set_udp_handler(tftp_handler);
 
 	/* zero out server ether in case the server ip has changed */
 	memset(NetServerEther, 0, 6);
@@ -880,7 +883,7 @@ TftpStartServer(void)
 static void parse_multicast_oack(char *pkt, int len)
 {
 	int i;
-	IPaddr_t addr;
+	struct in_addr addr;
 	char *mc_adr, *port,  *mc;
 
 	mc_adr = port = mc = NULL;
@@ -935,11 +938,11 @@ static void parse_multicast_oack(char *pkt, int len)
 		Multicast = 1;
 	}
 	addr = string_to_ip(mc_adr);
-	if (Mcast_addr != addr) {
-		if (Mcast_addr)
-			eth_mcast_join(Mcast_addr, 0);
-		Mcast_addr = addr;
-		if (eth_mcast_join(Mcast_addr, 1)) {
+	if (net_mcast_addr.s_addr != addr.s_addr) {
+		if (net_mcast_addr.s_addr)
+			eth_mcast_join(net_mcast_addr, 0);
+		net_mcast_addr = addr;
+		if (eth_mcast_join(net_mcast_addr, 1)) {
 			printf("Fail to set mcast, revert to TFTP\n");
 			ProhibitMcast = 1;
 			mcast_cleanup();
diff --git a/test/dm/eth.c b/test/dm/eth.c
index 1923670..22fd26e 100644
--- a/test/dm/eth.c
+++ b/test/dm/eth.c
@@ -20,7 +20,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 static int dm_test_eth(struct dm_test_state *dms)
 {
-	NetPingIP = string_to_ip("1.1.2.2");
+	net_ping_ip = string_to_ip("1.1.2.2");
 
 	setenv("ethact", "eth at 10002000");
 	ut_assertok(NetLoop(PING));
@@ -40,7 +40,7 @@ DM_TEST(dm_test_eth, DM_TESTF_SCAN_FDT);
 
 static int dm_test_eth_alias(struct dm_test_state *dms)
 {
-	NetPingIP = string_to_ip("1.1.2.2");
+	net_ping_ip = string_to_ip("1.1.2.2");
 	setenv("ethact", "eth0");
 	ut_assertok(NetLoop(PING));
 	ut_asserteq_str("eth at 10002000", getenv("ethact"));
@@ -64,7 +64,7 @@ DM_TEST(dm_test_eth_alias, DM_TESTF_SCAN_FDT);
 
 static int dm_test_eth_prime(struct dm_test_state *dms)
 {
-	NetPingIP = string_to_ip("1.1.2.2");
+	net_ping_ip = string_to_ip("1.1.2.2");
 
 	/* Expected to be "eth at 10003000" because of ethprime variable */
 	setenv("ethact", NULL);
@@ -87,7 +87,7 @@ static int dm_test_eth_rotate(struct dm_test_state *dms)
 	char ethaddr[18];
 
 	/* Invalidate eth1's MAC address */
-	NetPingIP = string_to_ip("1.1.2.2");
+	net_ping_ip = string_to_ip("1.1.2.2");
 	strcpy(ethaddr, getenv("eth1addr"));
 	setenv("eth1addr", NULL);
 
@@ -126,7 +126,7 @@ DM_TEST(dm_test_eth_rotate, DM_TESTF_SCAN_FDT);
 
 static int dm_test_net_retry(struct dm_test_state *dms)
 {
-	NetPingIP = string_to_ip("1.1.2.2");
+	net_ping_ip = string_to_ip("1.1.2.2");
 
 	/*
 	 * eth1 is disabled and netretry is yes, so the ping should succeed and
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH 02/23] net: cosmetic: Fixup var names related to boot file
  2015-04-03 21:14 [U-Boot] [PATCH 0/23] net: cosmetic: Fix naming and other checkpatch.pl issues in net/ Joe Hershberger
  2015-04-03 21:14 ` [U-Boot] [PATCH 01/23] net: cosmetic: Change IPaddr_t to struct in_addr Joe Hershberger
@ 2015-04-03 21:14 ` Joe Hershberger
  2015-04-03 21:14 ` [U-Boot] [PATCH 03/23] net: cosmetic: Fixup var names for DHCP strings Joe Hershberger
                   ` (22 subsequent siblings)
  24 siblings, 0 replies; 103+ messages in thread
From: Joe Hershberger @ 2015-04-03 21:14 UTC (permalink / raw)
  To: u-boot

The variables around the bootfile were inconsistent and used CamelCase.
Update them to make the code more readable.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

 common/cmd_net.c |  9 ++++++---
 common/cmd_pxe.c |  2 +-
 common/update.c  |  7 ++++---
 include/net.h    |  9 +++++----
 net/bootp.c      | 27 ++++++++++++++-------------
 net/bootp.h      |  1 -
 net/eth.c        |  3 ++-
 net/net.c        | 26 +++++++++++++-------------
 net/nfs.c        | 19 ++++++++++---------
 net/tftp.c       | 29 +++++++++++++++--------------
 10 files changed, 70 insertions(+), 62 deletions(-)

diff --git a/common/cmd_net.c b/common/cmd_net.c
index 0a85d72..b5b0a11 100644
--- a/common/cmd_net.c
+++ b/common/cmd_net.c
@@ -201,11 +201,13 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc,
 		if (end == (argv[1] + strlen(argv[1])))
 			load_addr = addr;
 		else
-			copy_filename(BootFile, argv[1], sizeof(BootFile));
+			copy_filename(net_boot_file_name, argv[1],
+				      sizeof(net_boot_file_name));
 		break;
 
 	case 3:	load_addr = simple_strtoul(argv[1], NULL, 16);
-		copy_filename(BootFile, argv[2], sizeof(BootFile));
+		copy_filename(net_boot_file_name, argv[2],
+			      sizeof(net_boot_file_name));
 
 		break;
 
@@ -216,7 +218,8 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc,
 			printf("Invalid address/size\n");
 			return CMD_RET_USAGE;
 		}
-		copy_filename(BootFile, argv[3], sizeof(BootFile));
+		copy_filename(net_boot_file_name, argv[3],
+			      sizeof(net_boot_file_name));
 		break;
 #endif
 	default:
diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c
index 9eac5c6..5cde5b6 100644
--- a/common/cmd_pxe.c
+++ b/common/cmd_pxe.c
@@ -1568,7 +1568,7 @@ do_pxe_boot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 	destroy_pxe_menu(cfg);
 
-	copy_filename(BootFile, "", sizeof(BootFile));
+	copy_filename(net_boot_file_name, "", sizeof(net_boot_file_name));
 
 	return 0;
 }
diff --git a/common/update.c b/common/update.c
index cc830a7..bc0c48f 100644
--- a/common/update.c
+++ b/common/update.c
@@ -58,7 +58,7 @@ static int update_load(char *filename, ulong msec_max, int cnt_max, ulong addr)
 	saved_timeout_msecs = TftpRRQTimeoutMSecs;
 	saved_timeout_count = TftpRRQTimeoutCountMax;
 	saved_netretry = strdup(getenv("netretry"));
-	saved_bootfile = strdup(BootFile);
+	saved_bootfile = strdup(net_boot_file_name);
 
 	/* set timeouts for auto-update */
 	TftpRRQTimeoutMSecs = msec_max;
@@ -69,7 +69,7 @@ static int update_load(char *filename, ulong msec_max, int cnt_max, ulong addr)
 
 	/* download the update file */
 	load_addr = addr;
-	copy_filename(BootFile, filename, sizeof(BootFile));
+	copy_filename(net_boot_file_name, filename, sizeof(net_boot_file_name));
 	size = NetLoop(TFTPGET);
 
 	if (size < 0)
@@ -86,7 +86,8 @@ static int update_load(char *filename, ulong msec_max, int cnt_max, ulong addr)
 		free(saved_netretry);
 
 	if (saved_bootfile != NULL) {
-		copy_filename(BootFile, saved_bootfile, sizeof(BootFile));
+		copy_filename(net_boot_file_name, saved_bootfile,
+			      sizeof(net_boot_file_name));
 		free(saved_bootfile);
 	}
 
diff --git a/include/net.h b/include/net.h
index 2699c44..b484d4c 100644
--- a/include/net.h
+++ b/include/net.h
@@ -470,9 +470,7 @@ extern struct in_addr net_dns_server2;
 extern char	NetOurNISDomain[32];	/* Our NIS domain */
 extern char	NetOurHostName[32];	/* Our hostname */
 extern char	NetOurRootPath[64];	/* Our root path */
-extern ushort	NetBootFileSize;	/* Our boot file size in blocks */
 /** END OF BOOTP EXTENTIONS **/
-extern ulong		NetBootFileXferSize;	/* size of bootfile in bytes */
 extern uchar		NetOurEther[6];		/* Our ethernet address */
 extern uchar		NetServerEther[6];	/* Boot server enet address */
 extern struct in_addr	net_ip;		/* Our    IP addr (0 = unknown) */
@@ -501,8 +499,11 @@ enum proto_t {
 	TFTPSRV, TFTPPUT, LINKLOCAL
 };
 
-/* from net/net.c */
-extern char	BootFile[128];			/* Boot File name */
+extern char	net_boot_file_name[128];/* Boot File name */
+/* The actual transferred size of the bootfile (in bytes) */
+extern u32	net_boot_file_size;
+/* Boot file size in blocks as reported by the DHCP server */
+extern u32	net_boot_file_expected_size_in_blocks;
 
 #if defined(CONFIG_CMD_DNS)
 extern char *NetDNSResolve;		/* The host to resolve  */
diff --git a/net/bootp.c b/net/bootp.c
index a56ed4c..0148c19 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -146,16 +146,17 @@ static void BootpCopyNetParams(struct Bootp_t *bp)
 		net_copy_ip(&net_server_ip, &bp->bp_siaddr);
 	memcpy(NetServerEther, ((struct ethernet_hdr *)NetRxPacket)->et_src, 6);
 	if (strlen(bp->bp_file) > 0)
-		copy_filename(BootFile, bp->bp_file, sizeof(BootFile));
+		copy_filename(net_boot_file_name, bp->bp_file,
+			      sizeof(net_boot_file_name));
 
-	debug("Bootfile: %s\n", BootFile);
+	debug("net_boot_file_name: %s\n", net_boot_file_name);
 
 	/* Propagate to environment:
 	 * don't delete exising entry when BOOTP / DHCP reply does
 	 * not contain a new value
 	 */
-	if (*BootFile)
-		setenv("bootfile", BootFile);
+	if (*net_boot_file_name)
+		setenv("bootfile", net_boot_file_name);
 #endif
 	net_copy_ip(&net_ip, &bp->bp_yiaddr);
 }
@@ -179,7 +180,7 @@ static void BootpVendorFieldProcess(u8 *ext)
 	debug("[BOOTP] Processing extension %d... (%d bytes)\n", *ext,
 		*(ext + 1));
 
-	NetBootFileSize = 0;
+	net_boot_file_expected_size_in_blocks = 0;
 
 	switch (*ext) {
 		/* Fixed length fields */
@@ -228,9 +229,11 @@ static void BootpVendorFieldProcess(u8 *ext)
 		break;
 	case 13:		/* Boot file size */
 		if (size == 2)
-			NetBootFileSize = ntohs(*(ushort *) (ext + 2));
+			net_boot_file_expected_size_in_blocks =
+				ntohs(*(ushort *)(ext + 2));
 		else if (size == 4)
-			NetBootFileSize = ntohl(*(ulong *) (ext + 2));
+			net_boot_file_expected_size_in_blocks =
+				ntohl(*(ulong *)(ext + 2));
 		break;
 	case 14:		/* Merit dump file - Not yet supported */
 		break;
@@ -303,8 +306,9 @@ static void BootpVendorProcess(u8 *ext, int size)
 	if (net_gateway.s_addr)
 		debug("net_gateway	: %pI4", &net_gateway);
 
-	if (NetBootFileSize)
-		debug("NetBootFileSize : %d\n", NetBootFileSize);
+	if (net_boot_file_expected_size_in_blocks)
+		debug("net_boot_file_expected_size_in_blocks : %d\n",
+		      net_boot_file_expected_size_in_blocks);
 
 	if (NetOurHostName[0])
 		debug("NetOurHostName  : %s\n", NetOurHostName);
@@ -315,9 +319,6 @@ static void BootpVendorProcess(u8 *ext, int size)
 	if (NetOurNISDomain[0])
 		debug("NetOurNISDomain : %s\n", NetOurNISDomain);
 
-	if (NetBootFileSize)
-		debug("NetBootFileSize: %d\n", NetBootFileSize);
-
 #if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_NTPSERVER)
 	if (net_ntp_server)
 		debug("net_ntp_server : %pI4\n", &net_ntp_server);
@@ -716,7 +717,7 @@ BootpRequest(void)
 	net_write_ip(&bp->bp_siaddr, zero_ip);
 	net_write_ip(&bp->bp_giaddr, zero_ip);
 	memcpy(bp->bp_chaddr, NetOurEther, 6);
-	copy_filename(bp->bp_file, BootFile, sizeof(bp->bp_file));
+	copy_filename(bp->bp_file, net_boot_file_name, sizeof(bp->bp_file));
 
 	/* Request additional information from the BOOTP/DHCP server */
 #if defined(CONFIG_CMD_DHCP)
diff --git a/net/bootp.h b/net/bootp.h
index 16f40dc..8c591a6 100644
--- a/net/bootp.h
+++ b/net/bootp.h
@@ -60,7 +60,6 @@ struct Bootp_t {
 
 /* bootp.c */
 extern ulong	BootpID;		/* ID of cur BOOTP request	*/
-extern char	BootFile[128];		/* Boot file name		*/
 extern int	BootpTry;
 
 
diff --git a/net/eth.c b/net/eth.c
index 930470e..cc81eb7 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -66,7 +66,8 @@ static void eth_env_init(void)
 
 	s = getenv("bootfile");
 	if (s != NULL)
-		copy_filename(BootFile, s, sizeof(BootFile));
+		copy_filename(net_boot_file_name, s,
+			      sizeof(net_boot_file_name));
 }
 
 static int eth_mac_skip(int index)
diff --git a/net/net.c b/net/net.c
index d86fb1d..e0a66d4 100644
--- a/net/net.c
+++ b/net/net.c
@@ -127,8 +127,6 @@ char		NetOurNISDomain[32] = {0,};
 char		NetOurHostName[32] = {0,};
 /* Our bootpath */
 char		NetOurRootPath[64] = {0,};
-/* Our bootfile size in blocks */
-ushort		NetBootFileSize;
 
 #ifdef CONFIG_MCAST_TFTP	/* Multicast TFTP */
 struct in_addr net_mcast_addr;
@@ -136,8 +134,6 @@ struct in_addr net_mcast_addr;
 
 /** END OF BOOTP EXTENTIONS **/
 
-/* The actual transferred size of the bootfile (in bytes) */
-ulong		NetBootFileXferSize;
 /* Our ethernet address */
 uchar		NetOurEther[6];
 /* Boot server enet address */
@@ -174,7 +170,11 @@ ushort		NetOurVLAN = 0xFFFF;
 ushort		NetOurNativeVLAN = 0xFFFF;
 
 /* Boot File name */
-char		BootFile[128];
+char net_boot_file_name[128];
+/* The actual transferred size of the bootfile (in bytes) */
+u32 net_boot_file_size;
+/* Boot file size in blocks as reported by the DHCP server */
+u32 net_boot_file_expected_size_in_blocks;
 
 #if defined(CONFIG_CMD_SNTP)
 /* NTP server IP address */
@@ -222,7 +222,8 @@ static int on_bootfile(const char *name, const char *value, enum env_op op,
 	switch (op) {
 	case env_op_create:
 	case env_op_overwrite:
-		copy_filename(BootFile, value, sizeof(BootFile));
+		copy_filename(net_boot_file_name, value,
+			      sizeof(net_boot_file_name));
 		break;
 	default:
 		break;
@@ -380,7 +381,7 @@ restart:
 
 	case 0:
 		NetDevExists = 1;
-		NetBootFileXferSize = 0;
+		net_boot_file_size = 0;
 		switch (protocol) {
 		case TFTPGET:
 #ifdef CONFIG_CMD_TFTPPUT
@@ -551,11 +552,10 @@ restart:
 
 		case NETLOOP_SUCCESS:
 			net_cleanup_loop();
-			if (NetBootFileXferSize > 0) {
-				printf("Bytes transferred = %ld (%lx hex)\n",
-					NetBootFileXferSize,
-					NetBootFileXferSize);
-				setenv_hex("filesize", NetBootFileXferSize);
+			if (net_boot_file_size > 0) {
+				printf("Bytes transferred = %d (%x hex)\n",
+				       net_boot_file_size, net_boot_file_size);
+				setenv_hex("filesize", net_boot_file_size);
 				setenv_hex("fileaddr", load_addr);
 			}
 			if (protocol != NETCONS)
@@ -565,7 +565,7 @@ restart:
 
 			eth_set_last_protocol(protocol);
 
-			ret = NetBootFileXferSize;
+			ret = net_boot_file_size;
 			debug_cond(DEBUG_INT_STATE, "--- NetLoop Success!\n");
 			goto done;
 
diff --git a/net/nfs.c b/net/nfs.c
index 34e5051..1e5c1c3 100644
--- a/net/nfs.c
+++ b/net/nfs.c
@@ -100,8 +100,8 @@ store_block(uchar *src, unsigned offset, unsigned len)
 		unmap_sysmem(ptr);
 	}
 
-	if (NetBootFileXferSize < (offset+len))
-		NetBootFileXferSize = newsize;
+	if (net_boot_file_size < (offset + len))
+		net_boot_file_size = newsize;
 	return 0;
 }
 
@@ -724,7 +724,7 @@ NfsStart(void)
 		return;
 	}
 
-	if (BootFile[0] == '\0') {
+	if (net_boot_file_name[0] == '\0') {
 		sprintf(default_filename, "/nfsroot/%02X%02X%02X%02X.img",
 			net_ip.s_addr & 0xFF,
 			(net_ip.s_addr >>  8) & 0xFF,
@@ -735,16 +735,16 @@ NfsStart(void)
 		printf("*** Warning: no boot file name; using '%s'\n",
 			nfs_path);
 	} else {
-		char *p = BootFile;
+		char *p = net_boot_file_name;
 
 		p = strchr(p, ':');
 
 		if (p != NULL) {
-			nfs_server_ip = string_to_ip(BootFile);
+			nfs_server_ip = string_to_ip(net_boot_file_name);
 			++p;
 			strcpy(nfs_path, p);
 		} else {
-			strcpy(nfs_path, BootFile);
+			strcpy(nfs_path, net_boot_file_name);
 		}
 	}
 
@@ -769,9 +769,10 @@ NfsStart(void)
 	}
 	printf("\nFilename '%s/%s'.", nfs_path, nfs_filename);
 
-	if (NetBootFileSize) {
-		printf(" Size is 0x%x Bytes = ", NetBootFileSize<<9);
-		print_size(NetBootFileSize<<9, "");
+	if (net_boot_file_expected_size_in_blocks) {
+		printf(" Size is 0x%x Bytes = ",
+		       net_boot_file_expected_size_in_blocks << 9);
+		print_size(net_boot_file_expected_size_in_blocks << 9, "");
 	}
 	printf("\nLoad address: 0x%lx\n"
 		"Loading: *\b", load_addr);
diff --git a/net/tftp.c b/net/tftp.c
index 4c985fa..bafc354 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -197,8 +197,8 @@ store_block(int block, uchar *src, unsigned len)
 		ext2_set_bit(block, Bitmap);
 #endif
 
-	if (NetBootFileXferSize < newsize)
-		NetBootFileXferSize = newsize;
+	if (net_boot_file_size < newsize)
+		net_boot_file_size = newsize;
 }
 
 /* Clear our state ready for a new transfer */
@@ -227,7 +227,7 @@ static int load_block(unsigned block, uchar *dst, unsigned len)
 	ulong offset = ((int)block - 1) * len + TftpBlockWrapOffset;
 	ulong tosend = len;
 
-	tosend = min(NetBootFileXferSize - offset, tosend);
+	tosend = min(net_boot_file_size - offset, tosend);
 	(void)memcpy(dst, (void *)(save_addr + offset), tosend);
 	debug("%s: block=%d, offset=%ld, len=%d, tosend=%ld\n", __func__,
 		block, offset, len, tosend);
@@ -311,7 +311,7 @@ static void tftp_complete(void)
 	time_start = get_timer(time_start);
 	if (time_start > 0) {
 		puts("\n\t ");	/* Line up with "Loading: " */
-		print_size(NetBootFileXferSize /
+		print_size(net_boot_file_size /
 			time_start * 1000, "/s");
 	}
 	puts("\ndone\n");
@@ -361,8 +361,8 @@ TftpSend(void)
 		debug("send option \"timeout %s\"\n", (char *)pkt);
 		pkt += strlen((char *)pkt) + 1;
 #ifdef CONFIG_TFTP_TSIZE
-		pkt += sprintf((char *)pkt, "tsize%c%lu%c",
-				0, NetBootFileXferSize, 0);
+		pkt += sprintf((char *)pkt, "tsize%c%u%c",
+				0, net_boot_file_size, 0);
 #endif
 		/* try for more effic. blk size */
 		pkt += sprintf((char *)pkt, "blksize%c%d%c",
@@ -720,7 +720,7 @@ void TftpStart(enum proto_t protocol)
 		TftpBlkSizeOption, TftpTimeoutMSecs);
 
 	tftp_remote_ip = net_server_ip;
-	if (BootFile[0] == '\0') {
+	if (net_boot_file_name[0] == '\0') {
 		sprintf(default_filename, "%02X%02X%02X%02X.img",
 			net_ip.s_addr & 0xFF,
 			(net_ip.s_addr >>  8) & 0xFF,
@@ -733,13 +733,13 @@ void TftpStart(enum proto_t protocol)
 		printf("*** Warning: no boot file name; using '%s'\n",
 			tftp_filename);
 	} else {
-		char *p = strchr(BootFile, ':');
+		char *p = strchr(net_boot_file_name, ':');
 
 		if (p == NULL) {
-			strncpy(tftp_filename, BootFile, MAX_LEN);
+			strncpy(tftp_filename, net_boot_file_name, MAX_LEN);
 			tftp_filename[MAX_LEN-1] = 0;
 		} else {
-			tftp_remote_ip = string_to_ip(BootFile);
+			tftp_remote_ip = string_to_ip(net_boot_file_name);
 			strncpy(tftp_filename, p + 1, MAX_LEN);
 			tftp_filename[MAX_LEN-1] = 0;
 		}
@@ -768,9 +768,10 @@ void TftpStart(enum proto_t protocol)
 
 	printf("Filename '%s'.", tftp_filename);
 
-	if (NetBootFileSize) {
-		printf(" Size is 0x%x Bytes = ", NetBootFileSize<<9);
-		print_size(NetBootFileSize<<9, "");
+	if (net_boot_file_expected_size_in_blocks) {
+		printf(" Size is 0x%x Bytes = ",
+		       net_boot_file_expected_size_in_blocks << 9);
+		print_size(net_boot_file_expected_size_in_blocks << 9, "");
 	}
 
 	putc('\n');
@@ -779,7 +780,7 @@ void TftpStart(enum proto_t protocol)
 	if (TftpWriting) {
 		printf("Save address: 0x%lx\n", save_addr);
 		printf("Save size:    0x%lx\n", save_size);
-		NetBootFileXferSize = save_size;
+		net_boot_file_size = save_size;
 		puts("Saving: *\b");
 		TftpState = STATE_SEND_WRQ;
 		new_transfer();
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH 03/23] net: cosmetic: Fixup var names for DHCP strings
  2015-04-03 21:14 [U-Boot] [PATCH 0/23] net: cosmetic: Fix naming and other checkpatch.pl issues in net/ Joe Hershberger
  2015-04-03 21:14 ` [U-Boot] [PATCH 01/23] net: cosmetic: Change IPaddr_t to struct in_addr Joe Hershberger
  2015-04-03 21:14 ` [U-Boot] [PATCH 02/23] net: cosmetic: Fixup var names related to boot file Joe Hershberger
@ 2015-04-03 21:14 ` Joe Hershberger
  2015-04-03 21:14 ` [U-Boot] [PATCH 04/23] net: cosmetic: Name ethaddr variables consistently Joe Hershberger
                   ` (21 subsequent siblings)
  24 siblings, 0 replies; 103+ messages in thread
From: Joe Hershberger @ 2015-04-03 21:14 UTC (permalink / raw)
  To: u-boot

Remove CamelCase variable naming.
Move the definition to the same compilation unit as the primary use.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

 common/cmd_net.c | 12 ++++++------
 include/net.h    |  6 +++---
 net/bootp.c      | 51 +++++++++++++++++++++++++++------------------------
 net/net.c        |  6 ------
 4 files changed, 36 insertions(+), 39 deletions(-)

diff --git a/common/cmd_net.c b/common/cmd_net.c
index b5b0a11..290c0c5 100644
--- a/common/cmd_net.c
+++ b/common/cmd_net.c
@@ -124,11 +124,11 @@ static void netboot_update_env(void)
 		setenv("netmask", tmp);
 	}
 
-	if (NetOurHostName[0])
-		setenv("hostname", NetOurHostName);
+	if (net_hostname[0])
+		setenv("hostname", net_hostname);
 
-	if (NetOurRootPath[0])
-		setenv("rootpath", NetOurRootPath);
+	if (net_root_path[0])
+		setenv("rootpath", net_root_path);
 
 	if (net_ip.s_addr) {
 		ip_to_string(net_ip, tmp);
@@ -154,8 +154,8 @@ static void netboot_update_env(void)
 		setenv("dnsip2", tmp);
 	}
 #endif
-	if (NetOurNISDomain[0])
-		setenv("domain", NetOurNISDomain);
+	if (net_nis_domain[0])
+		setenv("domain", net_nis_domain);
 
 #if defined(CONFIG_CMD_SNTP) \
     && defined(CONFIG_BOOTP_TIMEOFFSET)
diff --git a/include/net.h b/include/net.h
index b484d4c..2664865 100644
--- a/include/net.h
+++ b/include/net.h
@@ -467,9 +467,9 @@ extern struct in_addr net_dns_server;
 /* Our 2nd Domain Name Server (0 = unknown) */
 extern struct in_addr net_dns_server2;
 #endif
-extern char	NetOurNISDomain[32];	/* Our NIS domain */
-extern char	NetOurHostName[32];	/* Our hostname */
-extern char	NetOurRootPath[64];	/* Our root path */
+extern char	net_nis_domain[32];	/* Our IS domain */
+extern char	net_hostname[32];	/* Our hostname */
+extern char	net_root_path[64];	/* Our root path */
 /** END OF BOOTP EXTENTIONS **/
 extern uchar		NetOurEther[6];		/* Our ethernet address */
 extern uchar		NetServerEther[6];	/* Boot server enet address */
diff --git a/net/bootp.c b/net/bootp.c
index 0148c19..9251e91 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -56,6 +56,9 @@ unsigned int	bootp_num_ids;
 int		BootpTry;
 ulong		bootp_start;
 ulong		bootp_timeout;
+char net_nis_domain[32] = {0,}; /* Our NIS domain */
+char net_hostname[32] = {0,}; /* Our hostname */
+char net_root_path[64] = {0,}; /* Our bootpath */
 
 #if defined(CONFIG_CMD_DHCP)
 static dhcp_state_t dhcp_state = INIT;
@@ -220,11 +223,11 @@ static void BootpVendorFieldProcess(u8 *ext)
 	case 11:		/* RPL server - Not yet supported */
 		break;
 	case 12:		/* Host name */
-		if (NetOurHostName[0] == 0) {
+		if (net_hostname[0] == 0) {
 			size = truncate_sz("Host Name",
-				sizeof(NetOurHostName), size);
-			memcpy(&NetOurHostName, ext + 2, size);
-			NetOurHostName[size] = 0;
+				sizeof(net_hostname), size);
+			memcpy(&net_hostname, ext + 2, size);
+			net_hostname[size] = 0;
 		}
 		break;
 	case 13:		/* Boot file size */
@@ -242,11 +245,11 @@ static void BootpVendorFieldProcess(u8 *ext)
 	case 16:		/* Swap server - Not yet supported */
 		break;
 	case 17:		/* Root path */
-		if (NetOurRootPath[0] == 0) {
+		if (net_root_path[0] == 0) {
 			size = truncate_sz("Root Path",
-				sizeof(NetOurRootPath), size);
-			memcpy(&NetOurRootPath, ext + 2, size);
-			NetOurRootPath[size] = 0;
+				sizeof(net_root_path), size);
+			memcpy(&net_root_path, ext + 2, size);
+			net_root_path[size] = 0;
 		}
 		break;
 	case 18:		/* Extension path - Not yet supported */
@@ -258,11 +261,11 @@ static void BootpVendorFieldProcess(u8 *ext)
 		break;
 		/* IP host layer fields */
 	case 40:		/* NIS Domain name */
-		if (NetOurNISDomain[0] == 0) {
+		if (net_nis_domain[0] == 0) {
 			size = truncate_sz("NIS Domain Name",
-				sizeof(NetOurNISDomain), size);
-			memcpy(&NetOurNISDomain, ext + 2, size);
-			NetOurNISDomain[size] = 0;
+				sizeof(net_nis_domain), size);
+			memcpy(&net_nis_domain, ext + 2, size);
+			net_nis_domain[size] = 0;
 		}
 		break;
 #if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_NTPSERVER)
@@ -310,14 +313,14 @@ static void BootpVendorProcess(u8 *ext, int size)
 		debug("net_boot_file_expected_size_in_blocks : %d\n",
 		      net_boot_file_expected_size_in_blocks);
 
-	if (NetOurHostName[0])
-		debug("NetOurHostName  : %s\n", NetOurHostName);
+	if (net_hostname[0])
+		debug("net_hostname  : %s\n", net_hostname);
 
-	if (NetOurRootPath[0])
-		debug("NetOurRootPath  : %s\n", NetOurRootPath);
+	if (net_root_path[0])
+		debug("net_root_path  : %s\n", net_root_path);
 
-	if (NetOurNISDomain[0])
-		debug("NetOurNISDomain : %s\n", NetOurNISDomain);
+	if (net_nis_domain[0])
+		debug("net_nis_domain : %s\n", net_nis_domain);
 
 #if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_NTPSERVER)
 	if (net_ntp_server)
@@ -793,17 +796,17 @@ static void DhcpOptionsProcess(uchar *popt, struct Bootp_t *bp)
 			break;
 		case 12:
 			size = truncate_sz("Host Name",
-				sizeof(NetOurHostName), oplen);
-			memcpy(&NetOurHostName, popt + 2, size);
-			NetOurHostName[size] = 0;
+				sizeof(net_hostname), oplen);
+			memcpy(&net_hostname, popt + 2, size);
+			net_hostname[size] = 0;
 			break;
 		case 15:	/* Ignore Domain Name Option */
 			break;
 		case 17:
 			size = truncate_sz("Root Path",
-				sizeof(NetOurRootPath), oplen);
-			memcpy(&NetOurRootPath, popt + 2, size);
-			NetOurRootPath[size] = 0;
+				sizeof(net_root_path), oplen);
+			memcpy(&net_root_path, popt + 2, size);
+			net_root_path[size] = 0;
 			break;
 		case 28:	/* Ignore Broadcast Address Option */
 			break;
diff --git a/net/net.c b/net/net.c
index e0a66d4..bf21099 100644
--- a/net/net.c
+++ b/net/net.c
@@ -121,12 +121,6 @@ struct in_addr net_dns_server;
 /* Our 2nd DNS IP address */
 struct in_addr net_dns_server2;
 #endif
-/* Our NIS domain */
-char		NetOurNISDomain[32] = {0,};
-/* Our hostname */
-char		NetOurHostName[32] = {0,};
-/* Our bootpath */
-char		NetOurRootPath[64] = {0,};
 
 #ifdef CONFIG_MCAST_TFTP	/* Multicast TFTP */
 struct in_addr net_mcast_addr;
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH 04/23] net: cosmetic: Name ethaddr variables consistently
  2015-04-03 21:14 [U-Boot] [PATCH 0/23] net: cosmetic: Fix naming and other checkpatch.pl issues in net/ Joe Hershberger
                   ` (2 preceding siblings ...)
  2015-04-03 21:14 ` [U-Boot] [PATCH 03/23] net: cosmetic: Fixup var names for DHCP strings Joe Hershberger
@ 2015-04-03 21:14 ` Joe Hershberger
  2015-04-03 21:14 ` [U-Boot] [PATCH 05/23] net: cosmetic: Cleanup internal packet buffer names Joe Hershberger
                   ` (20 subsequent siblings)
  24 siblings, 0 replies; 103+ messages in thread
From: Joe Hershberger @ 2015-04-03 21:14 UTC (permalink / raw)
  To: u-boot

Use "_ethaddr" at the end of variables and drop CamelCase.
Make constant values actually 'const'.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

 arch/arm/mach-davinci/misc.c               |  2 +-
 arch/powerpc/cpu/mpc8260/ether_fcc.c       | 14 +++++------
 arch/powerpc/cpu/mpc8xx/fec.c              |  6 ++---
 board/BuR/common/common.c                  |  4 ++--
 board/ait/cam_enc_4xx/cam_enc_4xx.c        |  2 +-
 board/alphaproject/ap_sh4a_4a/ap_sh4a_4a.c |  2 +-
 board/bct-brettl2/bct-brettl2.c            |  2 +-
 board/bf518f-ezbrd/bf518f-ezbrd.c          |  4 ++--
 board/bf526-ezbrd/bf526-ezbrd.c            |  4 ++--
 board/bf527-ezkit/bf527-ezkit.c            |  4 ++--
 board/bf537-minotaur/bf537-minotaur.c      |  2 +-
 board/bf537-pnav/bf537-pnav.c              |  2 +-
 board/bf537-srv1/bf537-srv1.c              |  2 +-
 board/bf537-stamp/bf537-stamp.c            |  4 ++--
 board/birdland/bav335x/board.c             |  4 ++--
 board/buffalo/lsxl/lsxl.c                  |  2 +-
 board/cm-bf527/cm-bf527.c                  |  4 ++--
 board/cm-bf537e/cm-bf537e.c                |  2 +-
 board/cm-bf537u/cm-bf537u.c                |  2 +-
 board/compulab/cm_fx6/cm_fx6.c             |  2 +-
 board/compulab/cm_t335/cm_t335.c           |  2 +-
 board/compulab/cm_t35/cm_t35.c             |  2 +-
 board/compulab/cm_t3517/cm_t3517.c         |  4 ++--
 board/compulab/cm_t54/cm_t54.c             |  4 ++--
 board/davinci/da8xxevm/da850evm.c          |  6 ++---
 board/dnp5370/dnp5370.c                    |  4 ++--
 board/gumstix/pepper/board.c               |  2 +-
 board/ifm/ac14xx/ac14xx.c                  |  2 +-
 board/ip04/ip04.c                          |  2 +-
 board/isee/igep0033/board.c                |  2 +-
 board/phytec/pcm051/board.c                |  2 +-
 board/renesas/r0p7734/r0p7734.c            |  2 +-
 board/siemens/common/factoryset.c          |  4 ++--
 board/siemens/pxm2/board.c                 |  2 +-
 board/silica/pengwyn/board.c               |  2 +-
 board/tcm-bf518/tcm-bf518.c                |  4 ++--
 board/tcm-bf537/tcm-bf537.c                |  2 +-
 board/ti/am335x/board.c                    |  6 ++---
 board/ti/am43xx/board.c                    |  4 ++--
 board/ti/beagle_x15/board.c                |  4 ++--
 board/ti/dra7xx/evm.c                      |  4 ++--
 board/ti/ti814x/evm.c                      |  2 +-
 doc/README.enetaddr                        |  2 +-
 drivers/net/cpsw.c                         | 13 +++++-----
 drivers/net/dm9000x.c                      |  4 ++--
 drivers/net/e1000.c                        |  2 +-
 drivers/net/fec_mxc.c                      |  2 +-
 drivers/net/ftmac110.c                     |  2 +-
 drivers/net/macb.c                         |  2 +-
 drivers/net/netconsole.c                   |  4 ++--
 drivers/usb/eth/smsc95xx.c                 |  2 +-
 drivers/usb/gadget/ether.c                 |  8 +++----
 include/net.h                              | 38 +++++++++++++++---------------
 net/arp.c                                  |  8 +++----
 net/bootp.c                                | 19 ++++++++-------
 net/cdp.c                                  |  8 +++----
 net/dns.c                                  |  4 ++--
 net/eth.c                                  | 22 ++++++++---------
 net/link_local.c                           | 18 +++++++-------
 net/net.c                                  | 24 +++++++++----------
 net/nfs.c                                  |  4 ++--
 net/ping.c                                 |  2 +-
 net/rarp.c                                 |  8 +++----
 net/sntp.c                                 |  4 ++--
 net/tftp.c                                 |  6 ++---
 65 files changed, 171 insertions(+), 173 deletions(-)

diff --git a/arch/arm/mach-davinci/misc.c b/arch/arm/mach-davinci/misc.c
index e18bdfc..e699d61 100644
--- a/arch/arm/mach-davinci/misc.c
+++ b/arch/arm/mach-davinci/misc.c
@@ -49,7 +49,7 @@ int dvevm_read_mac_address(uint8_t *buf)
 		goto i2cerr;
 
 	/* Check that MAC address is valid. */
-	if (!is_valid_ether_addr(buf))
+	if (!is_valid_ethaddr(buf))
 		goto err;
 
 	return 1; /* Found */
diff --git a/arch/powerpc/cpu/mpc8260/ether_fcc.c b/arch/powerpc/cpu/mpc8260/ether_fcc.c
index f777ba1..240e7ae 100644
--- a/arch/powerpc/cpu/mpc8260/ether_fcc.c
+++ b/arch/powerpc/cpu/mpc8260/ether_fcc.c
@@ -637,7 +637,7 @@ eth_loopback_test (void)
 
 	puts ("FCC Ethernet External loopback test\n");
 
-	eth_getenv_enetaddr("ethaddr", NetOurEther);
+	eth_getenv_enetaddr("ethaddr", net_ethaddr);
 
 	/*
 	 * global initialisations for all FCC channels
@@ -721,7 +721,7 @@ eth_loopback_test (void)
 				BD_ENET_TX_LAST | BD_ENET_TX_TC;
 
 			memset ((void *)bp, patbytes[i], ELBT_BUFSZ);
-			NetSetEther (bp, NetBcastAddr, 0x8000);
+			NetSetEther(bp, net_bcast_ethaddr, 0x8000);
 		}
 		ecp->txbd[ELBT_NTXBD - 1].cbd_sc |= BD_ENET_TX_WRAP;
 
@@ -799,11 +799,9 @@ eth_loopback_test (void)
 		 * So, far we have only been given one Ethernet address. We use
 		 * the same address for all channels
 		 */
-#define ea NetOurEther
-		fpp->fen_paddrh = (ea[5] << 8) + ea[4];
-		fpp->fen_paddrm = (ea[3] << 8) + ea[2];
-		fpp->fen_paddrl = (ea[1] << 8) + ea[0];
-#undef ea
+		fpp->fen_paddrh = (net_ethaddr[5] << 8) + net_ethaddr[4];
+		fpp->fen_paddrm = (net_ethaddr[3] << 8) + net_ethaddr[2];
+		fpp->fen_paddrl = (net_ethaddr[1] << 8) + net_ethaddr[0];
 
 		fpp->fen_minflr = PKT_MINBUF_SIZE; /* min frame len register */
 		/*
@@ -1016,7 +1014,7 @@ eth_loopback_test (void)
 							&ecp->rxbufs[i][0];
 
 						ours = memcmp (ehp->et_src, \
-							NetOurEther, 6);
+							net_ethaddr, 6);
 
 						prot = swap16 (ehp->et_protlen);
 						tb = prot & 0x8000;
diff --git a/arch/powerpc/cpu/mpc8xx/fec.c b/arch/powerpc/cpu/mpc8xx/fec.c
index 22b8ec7..454e77a 100644
--- a/arch/powerpc/cpu/mpc8xx/fec.c
+++ b/arch/powerpc/cpu/mpc8xx/fec.c
@@ -252,9 +252,9 @@ static int fec_recv (struct eth_device *dev)
 			length -= 4;
 
 #if defined(CONFIG_CMD_CDP)
-			if ((rx[0] & 1) != 0
-			    && memcmp ((uchar *) rx, NetBcastAddr, 6) != 0
-			    && !is_cdp_packet((uchar *)rx))
+			if ((rx[0] & 1) != 0 &&
+			    memcmp((uchar *)rx, net_bcast_ethaddr, 6) != 0 &&
+			    !is_cdp_packet((uchar *)rx))
 				rx = NULL;
 #endif
 			/*
diff --git a/board/BuR/common/common.c b/board/BuR/common/common.c
index ccaa9c6..13f23fd 100644
--- a/board/BuR/common/common.c
+++ b/board/BuR/common/common.c
@@ -216,7 +216,7 @@ static const char *dtbmacaddr(u32 ifno)
 
 	node = fdt_path_offset((void *)dtbaddr, path);
 	mac = fdt_getprop((void *)dtbaddr, node, "mac-address", &len);
-	if (mac && is_valid_ether_addr((u8 *)mac))
+	if (mac && is_valid_ethaddr((u8 *)mac))
 		return mac;
 
 	return NULL;
@@ -595,7 +595,7 @@ int board_eth_init(bd_t *bis)
 		#endif
 		if (!mac) {
 			printf("<ethaddr> not set. validating E-fuse MAC ... ");
-			if (is_valid_ether_addr((const u8 *)mac_addr))
+			if (is_valid_ethaddr((const u8 *)mac_addr))
 				mac = (const char *)mac_addr;
 		}
 
diff --git a/board/ait/cam_enc_4xx/cam_enc_4xx.c b/board/ait/cam_enc_4xx/cam_enc_4xx.c
index 290dc19..c5687ba 100644
--- a/board/ait/cam_enc_4xx/cam_enc_4xx.c
+++ b/board/ait/cam_enc_4xx/cam_enc_4xx.c
@@ -70,7 +70,7 @@ static int cam_enc_4xx_check_network(void)
 	if (!s)
 		return -EINVAL;
 
-	if (!is_valid_ether_addr((const u8 *)s))
+	if (!is_valid_ethaddr((const u8 *)s))
 		return -EINVAL;
 
 	s = getenv("ipaddr");
diff --git a/board/alphaproject/ap_sh4a_4a/ap_sh4a_4a.c b/board/alphaproject/ap_sh4a_4a/ap_sh4a_4a.c
index b81a68d..e65befc 100644
--- a/board/alphaproject/ap_sh4a_4a/ap_sh4a_4a.c
+++ b/board/alphaproject/ap_sh4a_4a/ap_sh4a_4a.c
@@ -167,7 +167,7 @@ int board_late_init(void)
 	/* Read MAC address */
 	i2c_read(0x50, 0x0, 0, mac, 6);
 
-	if (is_valid_ether_addr(mac))
+	if (is_valid_ethaddr(mac))
 		eth_setenv_enetaddr("ethaddr", mac);
 
 	return 0;
diff --git a/board/bct-brettl2/bct-brettl2.c b/board/bct-brettl2/bct-brettl2.c
index 6be9b18..1f0dfb4 100644
--- a/board/bct-brettl2/bct-brettl2.c
+++ b/board/bct-brettl2/bct-brettl2.c
@@ -32,7 +32,7 @@ int checkboard(void)
 static void board_init_enetaddr(uchar *mac_addr)
 {
 	puts("Warning: Generating 'random' MAC address\n");
-	eth_random_addr(mac_addr);
+	net_random_ethaddr(mac_addr);
 	eth_setenv_enetaddr("ethaddr", mac_addr);
 }
 
diff --git a/board/bf518f-ezbrd/bf518f-ezbrd.c b/board/bf518f-ezbrd/bf518f-ezbrd.c
index 3a94a57..8ecfbb2 100644
--- a/board/bf518f-ezbrd/bf518f-ezbrd.c
+++ b/board/bf518f-ezbrd/bf518f-ezbrd.c
@@ -39,7 +39,7 @@ static void board_init_enetaddr(uchar *mac_addr)
 	if (USE_MAC_IN_FLASH) {
 		/* we cram the MAC in the last flash sector */
 		uchar *board_mac_addr = (uchar *)0x203F0096;
-		if (is_valid_ether_addr(board_mac_addr)) {
+		if (is_valid_ethaddr(board_mac_addr)) {
 			memcpy(mac_addr, board_mac_addr, 6);
 			valid_mac = true;
 		}
@@ -47,7 +47,7 @@ static void board_init_enetaddr(uchar *mac_addr)
 
 	if (!valid_mac) {
 		puts("Warning: Generating 'random' MAC address\n");
-		eth_random_addr(mac_addr);
+		net_random_ethaddr(mac_addr);
 	}
 
 	eth_setenv_enetaddr("ethaddr", mac_addr);
diff --git a/board/bf526-ezbrd/bf526-ezbrd.c b/board/bf526-ezbrd/bf526-ezbrd.c
index 368d6be..0a88491 100644
--- a/board/bf526-ezbrd/bf526-ezbrd.c
+++ b/board/bf526-ezbrd/bf526-ezbrd.c
@@ -36,7 +36,7 @@ static void board_init_enetaddr(uchar *mac_addr)
 	if (USE_MAC_IN_FLASH) {
 		/* we cram the MAC in the last flash sector */
 		uchar *board_mac_addr = (uchar *)0x203F0096;
-		if (is_valid_ether_addr(board_mac_addr)) {
+		if (is_valid_ethaddr(board_mac_addr)) {
 			memcpy(mac_addr, board_mac_addr, 6);
 			valid_mac = true;
 		}
@@ -44,7 +44,7 @@ static void board_init_enetaddr(uchar *mac_addr)
 
 	if (!valid_mac) {
 		puts("Warning: Generating 'random' MAC address\n");
-		eth_random_addr(mac_addr);
+		net_random_ethaddr(mac_addr);
 	}
 
 	eth_setenv_enetaddr("ethaddr", mac_addr);
diff --git a/board/bf527-ezkit/bf527-ezkit.c b/board/bf527-ezkit/bf527-ezkit.c
index 88e1869..257775f 100644
--- a/board/bf527-ezkit/bf527-ezkit.c
+++ b/board/bf527-ezkit/bf527-ezkit.c
@@ -40,13 +40,13 @@ static void board_init_enetaddr(uchar *mac_addr)
 		for (ret = 0; ret < 6; ++ret)
 			mac_addr[ret] = otp_mac_p[5 - ret];
 
-		if (is_valid_ether_addr(mac_addr))
+		if (is_valid_ethaddr(mac_addr))
 			valid_mac = true;
 	}
 
 	if (!valid_mac) {
 		puts("Warning: Generating 'random' MAC address\n");
-		eth_random_addr(mac_addr);
+		net_random_ethaddr(mac_addr);
 	}
 
 	eth_setenv_enetaddr("ethaddr", mac_addr);
diff --git a/board/bf537-minotaur/bf537-minotaur.c b/board/bf537-minotaur/bf537-minotaur.c
index ca61ef9..71b4293 100644
--- a/board/bf537-minotaur/bf537-minotaur.c
+++ b/board/bf537-minotaur/bf537-minotaur.c
@@ -26,7 +26,7 @@ int checkboard(void)
 static void board_init_enetaddr(uchar *mac_addr)
 {
 	puts("Warning: Generating 'random' MAC address\n");
-	eth_random_addr(mac_addr);
+	net_random_ethaddr(mac_addr);
 	eth_setenv_enetaddr("ethaddr", mac_addr);
 }
 
diff --git a/board/bf537-pnav/bf537-pnav.c b/board/bf537-pnav/bf537-pnav.c
index df00110..93522df 100644
--- a/board/bf537-pnav/bf537-pnav.c
+++ b/board/bf537-pnav/bf537-pnav.c
@@ -26,7 +26,7 @@ int checkboard(void)
 static void board_init_enetaddr(uchar *mac_addr)
 {
 	puts("Warning: Generating 'random' MAC address\n");
-	eth_random_addr(mac_addr);
+	net_random_ethaddr(mac_addr);
 	eth_setenv_enetaddr("ethaddr", mac_addr);
 }
 
diff --git a/board/bf537-srv1/bf537-srv1.c b/board/bf537-srv1/bf537-srv1.c
index 725296a..6581028 100644
--- a/board/bf537-srv1/bf537-srv1.c
+++ b/board/bf537-srv1/bf537-srv1.c
@@ -26,7 +26,7 @@ int checkboard(void)
 static void board_init_enetaddr(uchar *mac_addr)
 {
 	puts("Warning: Generating 'random' MAC address\n");
-	eth_random_addr(mac_addr);
+	net_random_ethaddr(mac_addr);
 	eth_setenv_enetaddr("ethaddr", mac_addr);
 }
 
diff --git a/board/bf537-stamp/bf537-stamp.c b/board/bf537-stamp/bf537-stamp.c
index 32045a9..66e5492 100644
--- a/board/bf537-stamp/bf537-stamp.c
+++ b/board/bf537-stamp/bf537-stamp.c
@@ -39,7 +39,7 @@ static void board_init_enetaddr(uchar *mac_addr)
 	if (USE_MAC_IN_FLASH) {
 		/* we cram the MAC in the last flash sector */
 		uchar *board_mac_addr = (uchar *)0x203F0000;
-		if (is_valid_ether_addr(board_mac_addr)) {
+		if (is_valid_ethaddr(board_mac_addr)) {
 			memcpy(mac_addr, board_mac_addr, 6);
 			valid_mac = true;
 		}
@@ -47,7 +47,7 @@ static void board_init_enetaddr(uchar *mac_addr)
 
 	if (!valid_mac) {
 		puts("Warning: Generating 'random' MAC address\n");
-		eth_random_addr(mac_addr);
+		net_random_ethaddr(mac_addr);
 	}
 
 	eth_setenv_enetaddr("ethaddr", mac_addr);
diff --git a/board/birdland/bav335x/board.c b/board/birdland/bav335x/board.c
index d1e1c8c..32ff7a4 100644
--- a/board/birdland/bav335x/board.c
+++ b/board/birdland/bav335x/board.c
@@ -384,7 +384,7 @@ int board_eth_init(bd_t *bis)
 	ecode = read_eeprom(&header);
 	/* if we have a valid EE, get mac address from there */
 	if ((ecode == 0) &&
-	    is_valid_ether_addr((const u8 *)&header.mac_addr[0][0])) {
+	    is_valid_ethaddr((const u8 *)&header.mac_addr[0][0])) {
 		memcpy(mac_addr, (const void *)&header.mac_addr[0][0], 6);
 	}
 
@@ -395,7 +395,7 @@ int board_eth_init(bd_t *bis)
 	if (!getenv("ethaddr")) {
 		printf("<ethaddr> not set. Validating first E-fuse MAC\n");
 
-		if (is_valid_ether_addr(mac_addr))
+		if (is_valid_ethaddr(mac_addr))
 			eth_setenv_enetaddr("ethaddr", mac_addr);
 	}
 
diff --git a/board/buffalo/lsxl/lsxl.c b/board/buffalo/lsxl/lsxl.c
index b0d49c4..487875c 100644
--- a/board/buffalo/lsxl/lsxl.c
+++ b/board/buffalo/lsxl/lsxl.c
@@ -232,7 +232,7 @@ static void rescue_mode(void)
 	printf("Entering rescue mode..\n");
 #ifdef CONFIG_RANDOM_MACADDR
 	if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
-		eth_random_addr(enetaddr);
+		net_random_ethaddr(enetaddr);
 		if (eth_setenv_enetaddr("ethaddr", enetaddr)) {
 			printf("Failed to set ethernet address\n");
 				set_led(LED_ALARM_BLINKING);
diff --git a/board/cm-bf527/cm-bf527.c b/board/cm-bf527/cm-bf527.c
index 1533eb9..2871fa2 100644
--- a/board/cm-bf527/cm-bf527.c
+++ b/board/cm-bf527/cm-bf527.c
@@ -39,13 +39,13 @@ static void board_init_enetaddr(uchar *mac_addr)
 		for (ret = 0; ret < 6; ++ret)
 			mac_addr[ret] = otp_mac_p[5 - ret];
 
-		if (is_valid_ether_addr(mac_addr))
+		if (is_valid_ethaddr(mac_addr))
 			valid_mac = true;
 	}
 
 	if (!valid_mac) {
 		puts("Warning: Generating 'random' MAC address\n");
-		eth_random_addr(mac_addr);
+		net_random_ethaddr(mac_addr);
 	}
 
 	eth_setenv_enetaddr("ethaddr", mac_addr);
diff --git a/board/cm-bf537e/cm-bf537e.c b/board/cm-bf537e/cm-bf537e.c
index e79f90f..902611e 100644
--- a/board/cm-bf537e/cm-bf537e.c
+++ b/board/cm-bf537e/cm-bf537e.c
@@ -31,7 +31,7 @@ static void board_init_enetaddr(char *var)
 		return;
 
 	printf("Warning: %s: generating 'random' MAC address\n", var);
-	eth_random_addr(enetaddr);
+	net_random_ethaddr(enetaddr);
 	eth_setenv_enetaddr(var, enetaddr);
 }
 
diff --git a/board/cm-bf537u/cm-bf537u.c b/board/cm-bf537u/cm-bf537u.c
index 632cbda..69bffd7 100644
--- a/board/cm-bf537u/cm-bf537u.c
+++ b/board/cm-bf537u/cm-bf537u.c
@@ -31,7 +31,7 @@ static void board_init_enetaddr(char *var)
 		return;
 
 	printf("Warning: %s: generating 'random' MAC address\n", var);
-	eth_random_addr(enetaddr);
+	net_random_ethaddr(enetaddr);
 	eth_setenv_enetaddr(var, enetaddr);
 }
 
diff --git a/board/compulab/cm_fx6/cm_fx6.c b/board/compulab/cm_fx6/cm_fx6.c
index ae6945b..7a1bbaf 100644
--- a/board/compulab/cm_fx6/cm_fx6.c
+++ b/board/compulab/cm_fx6/cm_fx6.c
@@ -425,7 +425,7 @@ static int handle_mac_address(char *env_var, uint eeprom_bus)
 	if (rc)
 		return rc;
 
-	if (!is_valid_ether_addr(enetaddr))
+	if (!is_valid_ethaddr(enetaddr))
 		return -1;
 
 	return eth_setenv_enetaddr(env_var, enetaddr);
diff --git a/board/compulab/cm_t335/cm_t335.c b/board/compulab/cm_t335/cm_t335.c
index 592ef3d..428aee6 100644
--- a/board/compulab/cm_t335/cm_t335.c
+++ b/board/compulab/cm_t335/cm_t335.c
@@ -114,7 +114,7 @@ static int handle_mac_address(void)
 	if (rv)
 		get_efuse_mac_addr(enetaddr);
 
-	if (!is_valid_ether_addr(enetaddr))
+	if (!is_valid_ethaddr(enetaddr))
 		return -1;
 
 	return eth_setenv_enetaddr("ethaddr", enetaddr);
diff --git a/board/compulab/cm_t35/cm_t35.c b/board/compulab/cm_t35/cm_t35.c
index c4ea8ea..374edbc 100644
--- a/board/compulab/cm_t35/cm_t35.c
+++ b/board/compulab/cm_t35/cm_t35.c
@@ -441,7 +441,7 @@ static int handle_mac_address(void)
 	if (rc)
 		return rc;
 
-	if (!is_valid_ether_addr(enetaddr))
+	if (!is_valid_ethaddr(enetaddr))
 		return -1;
 
 	return eth_setenv_enetaddr("ethaddr", enetaddr);
diff --git a/board/compulab/cm_t3517/cm_t3517.c b/board/compulab/cm_t3517/cm_t3517.c
index 624cf4c..03b2bad 100644
--- a/board/compulab/cm_t3517/cm_t3517.c
+++ b/board/compulab/cm_t3517/cm_t3517.c
@@ -132,7 +132,7 @@ static int am3517_get_efuse_enetaddr(u8 *enetaddr)
 	enetaddr[4] = (u8)((lsb >> 8)  & 0xff);
 	enetaddr[5] = (u8)(lsb & 0xff);
 
-	return is_valid_ether_addr(enetaddr);
+	return is_valid_ethaddr(enetaddr);
 }
 
 static inline int cm_t3517_init_emac(bd_t *bis)
@@ -170,7 +170,7 @@ static int cm_t3517_handle_mac_address(void)
 			return ret;
 	}
 
-	if (!is_valid_ether_addr(enetaddr))
+	if (!is_valid_ethaddr(enetaddr))
 		return -1;
 
 	return eth_setenv_enetaddr("ethaddr", enetaddr);
diff --git a/board/compulab/cm_t54/cm_t54.c b/board/compulab/cm_t54/cm_t54.c
index fdea909..fad0551 100644
--- a/board/compulab/cm_t54/cm_t54.c
+++ b/board/compulab/cm_t54/cm_t54.c
@@ -166,10 +166,10 @@ static int handle_mac_address(void)
 		return 0;
 
 	ret = cl_eeprom_read_mac_addr(enetaddr, CONFIG_SYS_I2C_EEPROM_BUS);
-	if (ret || !is_valid_ether_addr(enetaddr))
+	if (ret || !is_valid_ethaddr(enetaddr))
 		generate_mac_addr(enetaddr);
 
-	if (!is_valid_ether_addr(enetaddr))
+	if (!is_valid_ethaddr(enetaddr))
 		return -1;
 
 	return eth_setenv_enetaddr("usbethaddr", enetaddr);
diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c
index b9ca38e..b82385a 100644
--- a/board/davinci/da8xxevm/da850evm.c
+++ b/board/davinci/da8xxevm/da850evm.c
@@ -145,7 +145,7 @@ int misc_init_r(void)
 	 */
 	if (!enetaddr_found) {
 		if (!spi_mac_read) {
-			if (is_valid_ether_addr(buff)) {
+			if (is_valid_ethaddr(buff)) {
 				if (eth_setenv_enetaddr("ethaddr", buff)) {
 					printf("Warning: Failed to "
 					"set MAC address from SPI flash\n");
@@ -160,8 +160,8 @@ int misc_init_r(void)
 		 * MAC address present in environment compare it with
 		 * the MAC address in SPI flash and warn on mismatch
 		 */
-		if (!spi_mac_read && is_valid_ether_addr(buff) &&
-						memcmp(env_enetaddr, buff, 6))
+		if (!spi_mac_read && is_valid_ethaddr(buff) &&
+		    memcmp(env_enetaddr, buff, 6))
 			printf("Warning: MAC address in SPI flash don't match "
 					"with the MAC address in the environment\n");
 			printf("Default using MAC address from environment\n");
diff --git a/board/dnp5370/dnp5370.c b/board/dnp5370/dnp5370.c
index df721c9..655fcac 100644
--- a/board/dnp5370/dnp5370.c
+++ b/board/dnp5370/dnp5370.c
@@ -46,7 +46,7 @@ static void board_init_enetaddr(uchar *mac_addr)
 	if (USE_MAC_IN_FLASH) {
 		/* we cram the MAC in the last flash sector */
 		uchar *board_mac_addr = (uchar *)0x202F0000;
-		if (is_valid_ether_addr(board_mac_addr)) {
+		if (is_valid_ethaddr(board_mac_addr)) {
 			memcpy(mac_addr, board_mac_addr, 6);
 			valid_mac = true;
 		}
@@ -54,7 +54,7 @@ static void board_init_enetaddr(uchar *mac_addr)
 
 	if (!valid_mac) {
 		puts("Warning: Generating 'random' MAC address\n");
-		eth_random_addr(mac_addr);
+		net_random_ethaddr(mac_addr);
 	}
 
 	eth_setenv_enetaddr("ethaddr", mac_addr);
diff --git a/board/gumstix/pepper/board.c b/board/gumstix/pepper/board.c
index f644f81..beb2fac 100644
--- a/board/gumstix/pepper/board.c
+++ b/board/gumstix/pepper/board.c
@@ -165,7 +165,7 @@ int board_eth_init(bd_t *bis)
 		mac_addr[3] = (mac_hi & 0xFF000000) >> 24;
 		mac_addr[4] = mac_lo & 0xFF;
 		mac_addr[5] = (mac_lo & 0xFF00) >> 8;
-		if (is_valid_ether_addr(mac_addr))
+		if (is_valid_ethaddr(mac_addr))
 			eth_setenv_enetaddr("ethaddr", mac_addr);
 	}
 
diff --git a/board/ifm/ac14xx/ac14xx.c b/board/ifm/ac14xx/ac14xx.c
index 5d2ab2f..72932ca 100644
--- a/board/ifm/ac14xx/ac14xx.c
+++ b/board/ifm/ac14xx/ac14xx.c
@@ -225,7 +225,7 @@ int mac_read_from_eeprom(void)
 		break;
 	}
 
-	if (mac && is_valid_ether_addr(mac)) {
+	if (mac && is_valid_ethaddr(mac)) {
 		eth_setenv_enetaddr("ethaddr", mac);
 		if (mac_diag) {
 			mac_txt = getenv("ethaddr");
diff --git a/board/ip04/ip04.c b/board/ip04/ip04.c
index ae52633..d20500f 100644
--- a/board/ip04/ip04.c
+++ b/board/ip04/ip04.c
@@ -32,7 +32,7 @@ int misc_init_r(void)
 	uchar enetaddr[6];
 	if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
 		puts("Warning: Generating 'random' MAC address\n");
-		eth_random_addr(enetaddr);
+		net_random_ethaddr(enetaddr);
 		eth_setenv_enetaddr("ethaddr", enetaddr);
 	}
 
diff --git a/board/isee/igep0033/board.c b/board/isee/igep0033/board.c
index 9f8fcf2..5fea7ff 100644
--- a/board/isee/igep0033/board.c
+++ b/board/isee/igep0033/board.c
@@ -156,7 +156,7 @@ int board_eth_init(bd_t *bis)
 		mac_addr[3] = (mac_hi & 0xFF000000) >> 24;
 		mac_addr[4] = mac_lo & 0xFF;
 		mac_addr[5] = (mac_lo & 0xFF00) >> 8;
-		if (is_valid_ether_addr(mac_addr))
+		if (is_valid_ethaddr(mac_addr))
 			eth_setenv_enetaddr("ethaddr", mac_addr);
 	}
 
diff --git a/board/phytec/pcm051/board.c b/board/phytec/pcm051/board.c
index 1071662..1bf9d73 100644
--- a/board/phytec/pcm051/board.c
+++ b/board/phytec/pcm051/board.c
@@ -228,7 +228,7 @@ int board_eth_init(bd_t *bis)
 		mac_addr[4] = mac_lo & 0xFF;
 		mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 
-		if (is_valid_ether_addr(mac_addr))
+		if (is_valid_ethaddr(mac_addr))
 			eth_setenv_enetaddr("ethaddr", mac_addr);
 		else
 			goto try_usbether;
diff --git a/board/renesas/r0p7734/r0p7734.c b/board/renesas/r0p7734/r0p7734.c
index 5687ad4..2e31ba6 100644
--- a/board/renesas/r0p7734/r0p7734.c
+++ b/board/renesas/r0p7734/r0p7734.c
@@ -55,7 +55,7 @@ int board_late_init(void)
 	/* Read MAC address */
 	i2c_read(0x50, 0x10, 0, mac, 6);
 
-	if (is_valid_ether_addr(mac))
+	if (is_valid_ethaddr(mac))
 		eth_setenv_enetaddr("ethaddr", mac);
 
 	return 0;
diff --git a/board/siemens/common/factoryset.c b/board/siemens/common/factoryset.c
index 7baac3d..d81f548 100644
--- a/board/siemens/common/factoryset.c
+++ b/board/siemens/common/factoryset.c
@@ -271,7 +271,7 @@ static int factoryset_mac_setenv(void)
 	uint8_t mac_addr[6];
 
 	debug("FactorySet: Set mac address\n");
-	if (is_valid_ether_addr(factory_dat.mac)) {
+	if (is_valid_ethaddr(factory_dat.mac)) {
 		memcpy(mac_addr, factory_dat.mac, 6);
 	} else {
 		uint32_t mac_hi, mac_lo;
@@ -286,7 +286,7 @@ static int factoryset_mac_setenv(void)
 		mac_addr[3] = (mac_hi & 0xFF000000) >> 24;
 		mac_addr[4] = mac_lo & 0xFF;
 		mac_addr[5] = (mac_lo & 0xFF00) >> 8;
-		if (!is_valid_ether_addr(mac_addr)) {
+		if (!is_valid_ethaddr(mac_addr)) {
 			printf("Warning: ethaddr not set by FactorySet or E-fuse. Set <ethaddr> variable to overcome this.\n");
 			return -1;
 		}
diff --git a/board/siemens/pxm2/board.c b/board/siemens/pxm2/board.c
index 264ba02..4d8ba3c 100644
--- a/board/siemens/pxm2/board.c
+++ b/board/siemens/pxm2/board.c
@@ -222,7 +222,7 @@ int board_eth_init(bd_t *bis)
 	struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
 #ifdef CONFIG_FACTORYSET
 	int rv;
-	if (!is_valid_ether_addr(factory_dat.mac))
+	if (!is_valid_ethaddr(factory_dat.mac))
 		printf("Error: no valid mac address\n");
 	else
 		eth_setenv_enetaddr("ethaddr", factory_dat.mac);
diff --git a/board/silica/pengwyn/board.c b/board/silica/pengwyn/board.c
index ee88b6f..815c9a7 100644
--- a/board/silica/pengwyn/board.c
+++ b/board/silica/pengwyn/board.c
@@ -189,7 +189,7 @@ int board_eth_init(bd_t *bis)
 		mac_addr[4] = mac_lo & 0xFF;
 		mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 
-		if (is_valid_ether_addr(mac_addr))
+		if (is_valid_ethaddr(mac_addr))
 			eth_setenv_enetaddr("ethaddr", mac_addr);
 		else
 			return n;
diff --git a/board/tcm-bf518/tcm-bf518.c b/board/tcm-bf518/tcm-bf518.c
index 5d25fcd..3fa7d97 100644
--- a/board/tcm-bf518/tcm-bf518.c
+++ b/board/tcm-bf518/tcm-bf518.c
@@ -39,14 +39,14 @@ static void board_init_enetaddr(uchar *mac_addr)
 		for (ret = 0; ret < 6; ++ret)
 			mac_addr[ret] = otp_mac_p[5 - ret];
 
-		if (is_valid_ether_addr(mac_addr))
+		if (is_valid_ethaddr(mac_addr))
 			valid_mac = true;
 	}
 #endif
 
 	if (!valid_mac) {
 		puts("Warning: Generating 'random' MAC address\n");
-		eth_random_addr(mac_addr);
+		net_random_ethaddr(mac_addr);
 	}
 
 	eth_setenv_enetaddr("ethaddr", mac_addr);
diff --git a/board/tcm-bf537/tcm-bf537.c b/board/tcm-bf537/tcm-bf537.c
index a4f0f71..2531a44 100644
--- a/board/tcm-bf537/tcm-bf537.c
+++ b/board/tcm-bf537/tcm-bf537.c
@@ -31,7 +31,7 @@ static void board_init_enetaddr(char *var)
 		return;
 
 	printf("Warning: %s: generating 'random' MAC address\n", var);
-	eth_random_addr(enetaddr);
+	net_random_ethaddr(enetaddr);
 	eth_setenv_enetaddr(var, enetaddr);
 }
 
diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c
index 0739e60..96245a3 100644
--- a/board/ti/am335x/board.c
+++ b/board/ti/am335x/board.c
@@ -593,7 +593,7 @@ int board_eth_init(bd_t *bis)
 	if (!getenv("ethaddr")) {
 		printf("<ethaddr> not set. Validating first E-fuse MAC\n");
 
-		if (is_valid_ether_addr(mac_addr))
+		if (is_valid_ethaddr(mac_addr))
 			eth_setenv_enetaddr("ethaddr", mac_addr);
 	}
 
@@ -609,7 +609,7 @@ int board_eth_init(bd_t *bis)
 	mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 
 	if (!getenv("eth1addr")) {
-		if (is_valid_ether_addr(mac_addr))
+		if (is_valid_ethaddr(mac_addr))
 			eth_setenv_enetaddr("eth1addr", mac_addr);
 	}
 
@@ -658,7 +658,7 @@ int board_eth_init(bd_t *bis)
 #endif
 #if defined(CONFIG_USB_ETHER) && \
 	(!defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_USBETH_SUPPORT))
-	if (is_valid_ether_addr(mac_addr))
+	if (is_valid_ethaddr(mac_addr))
 		eth_setenv_enetaddr("usbnet_devaddr", mac_addr);
 
 	rv = usb_eth_initialize(bis);
diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c
index 6703670..e58024d 100644
--- a/board/ti/am43xx/board.c
+++ b/board/ti/am43xx/board.c
@@ -694,7 +694,7 @@ int board_eth_init(bd_t *bis)
 
 	if (!getenv("ethaddr")) {
 		puts("<ethaddr> not set. Validating first E-fuse MAC\n");
-		if (is_valid_ether_addr(mac_addr))
+		if (is_valid_ethaddr(mac_addr))
 			eth_setenv_enetaddr("ethaddr", mac_addr);
 	}
 
@@ -708,7 +708,7 @@ int board_eth_init(bd_t *bis)
 	mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 
 	if (!getenv("eth1addr")) {
-		if (is_valid_ether_addr(mac_addr))
+		if (is_valid_ethaddr(mac_addr))
 			eth_setenv_enetaddr("eth1addr", mac_addr);
 	}
 
diff --git a/board/ti/beagle_x15/board.c b/board/ti/beagle_x15/board.c
index 3a7e04d..79c5c3d 100644
--- a/board/ti/beagle_x15/board.c
+++ b/board/ti/beagle_x15/board.c
@@ -356,7 +356,7 @@ int board_eth_init(bd_t *bis)
 	if (!getenv("ethaddr")) {
 		printf("<ethaddr> not set. Validating first E-fuse MAC\n");
 
-		if (is_valid_ether_addr(mac_addr))
+		if (is_valid_ethaddr(mac_addr))
 			eth_setenv_enetaddr("ethaddr", mac_addr);
 	}
 
@@ -370,7 +370,7 @@ int board_eth_init(bd_t *bis)
 	mac_addr[5] = mac_lo & 0xFF;
 
 	if (!getenv("eth1addr")) {
-		if (is_valid_ether_addr(mac_addr))
+		if (is_valid_ethaddr(mac_addr))
 			eth_setenv_enetaddr("eth1addr", mac_addr);
 	}
 
diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c
index 6522241..ff4fc02 100644
--- a/board/ti/dra7xx/evm.c
+++ b/board/ti/dra7xx/evm.c
@@ -232,7 +232,7 @@ int board_eth_init(bd_t *bis)
 	if (!getenv("ethaddr")) {
 		printf("<ethaddr> not set. Validating first E-fuse MAC\n");
 
-		if (is_valid_ether_addr(mac_addr))
+		if (is_valid_ethaddr(mac_addr))
 			eth_setenv_enetaddr("ethaddr", mac_addr);
 	}
 
@@ -246,7 +246,7 @@ int board_eth_init(bd_t *bis)
 	mac_addr[5] = mac_lo & 0xFF;
 
 	if (!getenv("eth1addr")) {
-		if (is_valid_ether_addr(mac_addr))
+		if (is_valid_ethaddr(mac_addr))
 			eth_setenv_enetaddr("eth1addr", mac_addr);
 	}
 
diff --git a/board/ti/ti814x/evm.c b/board/ti/ti814x/evm.c
index 54b3dfb..e406dab 100644
--- a/board/ti/ti814x/evm.c
+++ b/board/ti/ti814x/evm.c
@@ -178,7 +178,7 @@ int board_eth_init(bd_t *bis)
 		mac_addr[4] = mac_lo & 0xFF;
 		mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 
-		if (is_valid_ether_addr(mac_addr))
+		if (is_valid_ethaddr(mac_addr))
 			eth_setenv_enetaddr("ethaddr", mac_addr);
 		else
 			printf("Unable to read MAC address. Set <ethaddr>\n");
diff --git a/doc/README.enetaddr b/doc/README.enetaddr
index 1eaeaf9..0fafd2c 100644
--- a/doc/README.enetaddr
+++ b/doc/README.enetaddr
@@ -87,7 +87,7 @@ eth_parse_enetaddr(addr, enetaddr);
 Look up an environment variable and convert the stored address.  If the address
 is valid, then the function returns 1.  Otherwise, the function returns 0.  In
 all cases, the enetaddr memory is initialized.  If the env var is not found,
-then it is set to all zeros.  The common function is_valid_ether_addr() is used
+then it is set to all zeros.  The common function is_valid_ethaddr() is used
 to determine address validity.
 uchar enetaddr[6];
 if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c
index 52f8da6..d4b0cb9 100644
--- a/drivers/net/cpsw.c
+++ b/drivers/net/cpsw.c
@@ -289,7 +289,7 @@ static inline void cpsw_ale_get_addr(u32 *ale_entry, u8 *addr)
 		addr[i] = cpsw_ale_get_field(ale_entry, 40 - 8*i, 8);
 }
 
-static inline void cpsw_ale_set_addr(u32 *ale_entry, u8 *addr)
+static inline void cpsw_ale_set_addr(u32 *ale_entry, const u8 *addr)
 {
 	int i;
 
@@ -321,7 +321,7 @@ static int cpsw_ale_write(struct cpsw_priv *priv, int idx, u32 *ale_entry)
 	return idx;
 }
 
-static int cpsw_ale_match_addr(struct cpsw_priv *priv, u8* addr)
+static int cpsw_ale_match_addr(struct cpsw_priv *priv, const u8 *addr)
 {
 	u32 ale_entry[ALE_ENTRY_WORDS];
 	int type, idx;
@@ -374,7 +374,7 @@ static int cpsw_ale_find_ageable(struct cpsw_priv *priv)
 	return -ENOENT;
 }
 
-static int cpsw_ale_add_ucast(struct cpsw_priv *priv, u8 *addr,
+static int cpsw_ale_add_ucast(struct cpsw_priv *priv, const u8 *addr,
 			      int port, int flags)
 {
 	u32 ale_entry[ALE_ENTRY_WORDS] = {0, 0, 0};
@@ -399,7 +399,8 @@ static int cpsw_ale_add_ucast(struct cpsw_priv *priv, u8 *addr,
 	return 0;
 }
 
-static int cpsw_ale_add_mcast(struct cpsw_priv *priv, u8 *addr, int port_mask)
+static int cpsw_ale_add_mcast(struct cpsw_priv *priv, const u8 *addr,
+			      int port_mask)
 {
 	u32 ale_entry[ALE_ENTRY_WORDS] = {0, 0, 0};
 	int idx, mask;
@@ -644,7 +645,7 @@ static void cpsw_slave_init(struct cpsw_slave *slave, struct cpsw_priv *priv)
 	slave_port = cpsw_get_slave_port(priv, slave->slave_num);
 	cpsw_ale_port_state(priv, slave_port, ALE_PORT_STATE_FORWARD);
 
-	cpsw_ale_add_mcast(priv, NetBcastAddr, 1 << slave_port);
+	cpsw_ale_add_mcast(priv, net_bcast_ethaddr, 1 << slave_port);
 
 	priv->phy_mask |= 1 << slave->data->phy_addr;
 }
@@ -773,7 +774,7 @@ static int cpsw_init(struct eth_device *dev, bd_t *bis)
 
 	cpsw_ale_add_ucast(priv, priv->dev->enetaddr, priv->host_port,
 			   ALE_SECURE);
-	cpsw_ale_add_mcast(priv, NetBcastAddr, 1 << priv->host_port);
+	cpsw_ale_add_mcast(priv, net_bcast_ethaddr, 1 << priv->host_port);
 
 	for_active_slave(slave, priv)
 		cpsw_slave_init(slave, priv);
diff --git a/drivers/net/dm9000x.c b/drivers/net/dm9000x.c
index 4de9d41..d1c6f4c 100644
--- a/drivers/net/dm9000x.c
+++ b/drivers/net/dm9000x.c
@@ -342,10 +342,10 @@ static int dm9000_init(struct eth_device *dev, bd_t *bd)
 	DM9000_iow(DM9000_ISR, ISR_ROOS | ISR_ROS | ISR_PTS | ISR_PRS);
 
 	printf("MAC: %pM\n", dev->enetaddr);
-	if (!is_valid_ether_addr(dev->enetaddr)) {
+	if (!is_valid_ethaddr(dev->enetaddr)) {
 #ifdef CONFIG_RANDOM_MACADDR
 		printf("Bad MAC address (uninitialized EEPROM?), randomizing\n");
-		eth_random_addr(dev->enetaddr);
+		net_random_ethaddr(dev->enetaddr);
 		printf("MAC: %pM\n", dev->enetaddr);
 #else
 		printf("WARNING: Bad MAC address (uninitialized EEPROM?)\n");
diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c
index cd44222..6a2e0d2 100644
--- a/drivers/net/e1000.c
+++ b/drivers/net/e1000.c
@@ -1197,7 +1197,7 @@ e1000_read_mac_addr(struct eth_device *nic)
 		nic->enetaddr[5] ^= 1;
 
 #ifdef CONFIG_E1000_FALLBACK_MAC
-	if (!is_valid_ether_addr(nic->enetaddr)) {
+	if (!is_valid_ethaddr(nic->enetaddr)) {
 		unsigned char fb_mac[NODE_ADDRESS_SIZE] = CONFIG_E1000_FALLBACK_MAC;
 
 		memcpy (nic->enetaddr, fb_mac, NODE_ADDRESS_SIZE);
diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index b572470..1146d3b 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -357,7 +357,7 @@ static int fec_get_hwaddr(struct eth_device *dev, int dev_id,
 						unsigned char *mac)
 {
 	imx_get_mac_from_fuse(dev_id, mac);
-	return !is_valid_ether_addr(mac);
+	return !is_valid_ethaddr(mac);
 }
 
 static int fec_set_hwaddr(struct eth_device *dev)
diff --git a/drivers/net/ftmac110.c b/drivers/net/ftmac110.c
index 98c4f09..aef89a2 100644
--- a/drivers/net/ftmac110.c
+++ b/drivers/net/ftmac110.c
@@ -425,7 +425,7 @@ int ftmac110_initialize(bd_t *bis)
 	dev->recv = ftmac110_recv;
 
 	if (!eth_getenv_enetaddr_by_index("eth", card_nr, dev->enetaddr))
-		eth_random_addr(dev->enetaddr);
+		net_random_ethaddr(dev->enetaddr);
 
 	/* allocate tx descriptors (it must be 16 bytes aligned) */
 	chip->txd = dma_alloc_coherent(
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 170ff06..1fe408c 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -595,7 +595,7 @@ static int macb_init(struct eth_device *netdev, bd_t *bd)
 	}
 
 	/* update the ethaddr */
-	if (is_valid_ether_addr(netdev->enetaddr)) {
+	if (is_valid_ethaddr(netdev->enetaddr)) {
 		macb_write_hwaddr(netdev);
 	} else {
 		printf("%s: mac address is not valid\n", netdev->name);
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index 55f383f..0d81b44 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -117,7 +117,7 @@ static int refresh_settings_from_env(void)
 void NcStart(void)
 {
 	refresh_settings_from_env();
-	if (!output_packet_len || memcmp(nc_ether, NetEtherNullAddr, 6)) {
+	if (!output_packet_len || memcmp(nc_ether, net_null_ethaddr, 6)) {
 		/* going to check for input packet */
 		net_set_udp_handler(nc_handler);
 		NetSetTimeout(net_timeout, nc_timeout);
@@ -180,7 +180,7 @@ static void nc_send_packet(const char *buf, int len)
 	if (eth == NULL)
 		return;
 
-	if (!memcmp(nc_ether, NetEtherNullAddr, 6)) {
+	if (!memcmp(nc_ether, net_null_ethaddr, 6)) {
 		if (eth->state == ETH_STATE_ACTIVE)
 			return;	/* inside net loop */
 		output_packet = buf;
diff --git a/drivers/usb/eth/smsc95xx.c b/drivers/usb/eth/smsc95xx.c
index 6bca34d..78b469f 100644
--- a/drivers/usb/eth/smsc95xx.c
+++ b/drivers/usb/eth/smsc95xx.c
@@ -355,7 +355,7 @@ static int smsc95xx_init_mac_address(struct eth_device *eth,
 	/* try reading mac address from EEPROM */
 	if (smsc95xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN,
 			eth->enetaddr) == 0) {
-		if (is_valid_ether_addr(eth->enetaddr)) {
+		if (is_valid_ethaddr(eth->enetaddr)) {
 			/* eeprom values are valid so use them */
 			debug("MAC address read from EEPROM\n");
 			return 0;
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index 8f03a6b..c01163c 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -1644,13 +1644,13 @@ static int eth_start_xmit (struct sk_buff *skb, struct net_device *net)
 	if (!eth_is_promisc (dev)) {
 		u8		*dest = skb->data;
 
-		if (is_multicast_ether_addr(dest)) {
+		if (is_multicast_ethaddr(dest)) {
 			u16	type;
 
 			/* ignores USB_CDC_PACKET_TYPE_MULTICAST and host
 			 * SET_ETHERNET_MULTICAST_FILTERS requests
 			 */
-			if (is_broadcast_ether_addr(dest))
+			if (is_broadcast_ethaddr(dest))
 				type = USB_CDC_PACKET_TYPE_BROADCAST;
 			else
 				type = USB_CDC_PACKET_TYPE_ALL_MULTICAST;
@@ -1941,7 +1941,7 @@ static int is_eth_addr_valid(char *str)
 		}
 
 		/* Now check the contents. */
-		return is_valid_ether_addr(ea);
+		return is_valid_ethaddr(ea);
 	}
 	return 0;
 }
@@ -1970,7 +1970,7 @@ static int get_ether_addr(const char *str, u8 *dev_addr)
 			num |= (nibble(*str++));
 			dev_addr[i] = num;
 		}
-		if (is_valid_ether_addr(dev_addr))
+		if (is_valid_ethaddr(dev_addr))
 			return 0;
 	}
 	return 1;
diff --git a/include/net.h b/include/net.h
index 2664865..33e542f 100644
--- a/include/net.h
+++ b/include/net.h
@@ -471,8 +471,8 @@ extern char	net_nis_domain[32];	/* Our IS domain */
 extern char	net_hostname[32];	/* Our hostname */
 extern char	net_root_path[64];	/* Our root path */
 /** END OF BOOTP EXTENTIONS **/
-extern uchar		NetOurEther[6];		/* Our ethernet address */
-extern uchar		NetServerEther[6];	/* Boot server enet address */
+extern u8		net_ethaddr[6];		/* Our ethernet address */
+extern u8		net_server_ethaddr[6];	/* Boot server enet address */
 extern struct in_addr	net_ip;		/* Our    IP addr (0 = unknown) */
 extern struct in_addr	net_server_ip;	/* Server IP addr (0 = unknown) */
 extern uchar		*NetTxPacket;		/* THE transmit packet */
@@ -484,8 +484,8 @@ extern uchar		*NetRxPackets[PKTBUFSRX]; /* Receive packets */
 extern uchar		*NetRxPacket;		/* Current receive packet */
 extern int		NetRxPacketLen;		/* Current rx packet length */
 extern unsigned		NetIPID;		/* IP ID (counting) */
-extern uchar		NetBcastAddr[6];	/* Ethernet boardcast address */
-extern uchar		NetEtherNullAddr[6];
+extern const u8		net_bcast_ethaddr[6];	/* Ethernet broadcast address */
+extern const u8		net_null_ethaddr[6];
 
 #define VLAN_NONE	4095			/* untagged */
 #define VLAN_IDMASK	0x0fff			/* mask of valid vlan id */
@@ -522,11 +522,11 @@ extern ushort CDPApplianceVLAN;		/* CDP returned appliance VLAN */
 /*
  * Check for a CDP packet by examining the received MAC address field
  */
-static inline int is_cdp_packet(const uchar *et_addr)
+static inline int is_cdp_packet(const uchar *ethaddr)
 {
-	extern const uchar NetCDPAddr[6];
+	extern const u8 net_cdp_ethaddr[6];
 
-	return memcmp(et_addr, NetCDPAddr, 6) == 0;
+	return memcmp(ethaddr, net_cdp_ethaddr, 6) == 0;
 }
 #endif
 
@@ -553,7 +553,7 @@ int	NetStartAgain(void);
 int	NetEthHdrSize(void);
 
 /* Set ethernet header; returns the size of the header */
-int NetSetEther(uchar *, uchar *, uint);
+int NetSetEther(uchar *xet, const uchar *dest_ethaddr, uint prot);
 int net_update_ether(struct ethernet_hdr *et, uchar *addr, uint prot);
 
 /* Set IP header */
@@ -716,42 +716,42 @@ static inline void NetCopyLong(ulong *to, ulong *from)
 }
 
 /**
- * is_zero_ether_addr - Determine if give Ethernet address is all zeros.
+ * is_zero_ethaddr - Determine if give Ethernet address is all zeros.
  * @addr: Pointer to a six-byte array containing the Ethernet address
  *
  * Return true if the address is all zeroes.
  */
-static inline int is_zero_ether_addr(const u8 *addr)
+static inline int is_zero_ethaddr(const u8 *addr)
 {
 	return !(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5]);
 }
 
 /**
- * is_multicast_ether_addr - Determine if the Ethernet address is a multicast.
+ * is_multicast_ethaddr - Determine if the Ethernet address is a multicast.
  * @addr: Pointer to a six-byte array containing the Ethernet address
  *
  * Return true if the address is a multicast address.
  * By definition the broadcast address is also a multicast address.
  */
-static inline int is_multicast_ether_addr(const u8 *addr)
+static inline int is_multicast_ethaddr(const u8 *addr)
 {
 	return 0x01 & addr[0];
 }
 
 /*
- * is_broadcast_ether_addr - Determine if the Ethernet address is broadcast
+ * is_broadcast_ethaddr - Determine if the Ethernet address is broadcast
  * @addr: Pointer to a six-byte array containing the Ethernet address
  *
  * Return true if the address is the broadcast address.
  */
-static inline int is_broadcast_ether_addr(const u8 *addr)
+static inline int is_broadcast_ethaddr(const u8 *addr)
 {
 	return (addr[0] & addr[1] & addr[2] & addr[3] & addr[4] & addr[5]) ==
 		0xff;
 }
 
 /*
- * is_valid_ether_addr - Determine if the given Ethernet address is valid
+ * is_valid_ethaddr - Determine if the given Ethernet address is valid
  * @addr: Pointer to a six-byte array containing the Ethernet address
  *
  * Check that the Ethernet address (MAC) is not 00:00:00:00:00:00, is not
@@ -759,21 +759,21 @@ static inline int is_broadcast_ether_addr(const u8 *addr)
  *
  * Return true if the address is valid.
  */
-static inline int is_valid_ether_addr(const u8 *addr)
+static inline int is_valid_ethaddr(const u8 *addr)
 {
 	/* FF:FF:FF:FF:FF:FF is a multicast address so we don't need to
 	 * explicitly check for it here. */
-	return !is_multicast_ether_addr(addr) && !is_zero_ether_addr(addr);
+	return !is_multicast_ethaddr(addr) && !is_zero_ethaddr(addr);
 }
 
 /**
- * eth_random_addr - Generate software assigned random Ethernet address
+ * net_random_ethaddr - Generate software assigned random Ethernet address
  * @addr: Pointer to a six-byte array containing the Ethernet address
  *
  * Generate a random Ethernet address (MAC) that is not multicast
  * and has the local assigned bit set.
  */
-static inline void eth_random_addr(uchar *addr)
+static inline void net_random_ethaddr(uchar *addr)
 {
 	int i;
 	unsigned int seed = get_timer(0);
diff --git a/net/arp.c b/net/arp.c
index 07c2ba0..8dbcd65 100644
--- a/net/arp.c
+++ b/net/arp.c
@@ -60,7 +60,7 @@ void arp_raw_request(struct in_addr source_ip, const uchar *targetEther,
 
 	pkt = NetArpTxPacket;
 
-	eth_hdr_size = NetSetEther(pkt, NetBcastAddr, PROT_ARP);
+	eth_hdr_size = NetSetEther(pkt, net_bcast_ethaddr, PROT_ARP);
 	pkt += eth_hdr_size;
 
 	arp = (struct arp_hdr *) pkt;
@@ -71,7 +71,7 @@ void arp_raw_request(struct in_addr source_ip, const uchar *targetEther,
 	arp->ar_pln = ARP_PLEN;
 	arp->ar_op = htons(ARPOP_REQUEST);
 
-	memcpy(&arp->ar_sha, NetOurEther, ARP_HLEN);	/* source ET addr */
+	memcpy(&arp->ar_sha, net_ethaddr, ARP_HLEN);	/* source ET addr */
 	net_write_ip(&arp->ar_spa, source_ip);		/* source IP addr */
 	memcpy(&arp->ar_tha, targetEther, ARP_HLEN);	/* target ET addr */
 	net_write_ip(&arp->ar_tpa, target_ip);		/* target IP addr */
@@ -93,7 +93,7 @@ void ArpRequest(void)
 		net_arp_wait_reply_ip = net_arp_wait_packet_ip;
 	}
 
-	arp_raw_request(net_ip, NetEtherNullAddr, net_arp_wait_reply_ip);
+	arp_raw_request(net_ip, net_null_ethaddr, net_arp_wait_reply_ip);
 }
 
 void ArpTimeoutCheck(void)
@@ -168,7 +168,7 @@ void ArpReceive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
 		arp->ar_op = htons(ARPOP_REPLY);
 		memcpy(&arp->ar_tha, &arp->ar_sha, ARP_HLEN);
 		net_copy_ip(&arp->ar_tpa, &arp->ar_spa);
-		memcpy(&arp->ar_sha, NetOurEther, ARP_HLEN);
+		memcpy(&arp->ar_sha, net_ethaddr, ARP_HLEN);
 		net_copy_ip(&arp->ar_spa, &net_ip);
 
 #ifdef CONFIG_CMD_LINK_LOCAL
diff --git a/net/bootp.c b/net/bootp.c
index 9251e91..9b27d4c 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -147,7 +147,8 @@ static void BootpCopyNetParams(struct Bootp_t *bp)
 	net_copy_ip(&tmp_ip, &bp->bp_siaddr);
 	if (tmp_ip.s_addr != 0)
 		net_copy_ip(&net_server_ip, &bp->bp_siaddr);
-	memcpy(NetServerEther, ((struct ethernet_hdr *)NetRxPacket)->et_src, 6);
+	memcpy(net_server_ethaddr, ((struct ethernet_hdr *)NetRxPacket)->et_src,
+	       6);
 	if (strlen(bp->bp_file) > 0)
 		copy_filename(net_boot_file_name, bp->bp_file,
 			      sizeof(net_boot_file_name));
@@ -693,7 +694,7 @@ BootpRequest(void)
 	pkt = NetTxPacket;
 	memset((void *)pkt, 0, PKTSIZE);
 
-	eth_hdr_size = NetSetEther(pkt, NetBcastAddr, PROT_IP);
+	eth_hdr_size = NetSetEther(pkt, net_bcast_ethaddr, PROT_IP);
 	pkt += eth_hdr_size;
 
 	/*
@@ -719,7 +720,7 @@ BootpRequest(void)
 	net_write_ip(&bp->bp_yiaddr, zero_ip);
 	net_write_ip(&bp->bp_siaddr, zero_ip);
 	net_write_ip(&bp->bp_giaddr, zero_ip);
-	memcpy(bp->bp_chaddr, NetOurEther, 6);
+	memcpy(bp->bp_chaddr, net_ethaddr, 6);
 	copy_filename(bp->bp_file, net_boot_file_name, sizeof(bp->bp_file));
 
 	/* Request additional information from the BOOTP/DHCP server */
@@ -734,10 +735,10 @@ BootpRequest(void)
 	 *	Bootp ID is the lower 4 bytes of our ethernet address
 	 *	plus the current time in ms.
 	 */
-	BootpID = ((ulong)NetOurEther[2] << 24)
-		| ((ulong)NetOurEther[3] << 16)
-		| ((ulong)NetOurEther[4] << 8)
-		| (ulong)NetOurEther[5];
+	BootpID = ((ulong)net_ethaddr[2] << 24)
+		| ((ulong)net_ethaddr[3] << 16)
+		| ((ulong)net_ethaddr[4] << 8)
+		| (ulong)net_ethaddr[5];
 	BootpID += get_timer(0);
 	BootpID = htonl(BootpID);
 	bootp_add_id(BootpID);
@@ -896,7 +897,7 @@ static void DhcpSendRequestPkt(struct Bootp_t *bp_offer)
 	pkt = NetTxPacket;
 	memset((void *)pkt, 0, PKTSIZE);
 
-	eth_hdr_size = NetSetEther(pkt, NetBcastAddr, PROT_IP);
+	eth_hdr_size = NetSetEther(pkt, net_bcast_ethaddr, PROT_IP);
 	pkt += eth_hdr_size;
 
 	iphdr = pkt;	/* We'll need this later to set proper pkt size */
@@ -918,7 +919,7 @@ static void DhcpSendRequestPkt(struct Bootp_t *bp_offer)
 	zero_ip.s_addr = 0;
 	net_write_ip(&bp->bp_giaddr, zero_ip);
 
-	memcpy(bp->bp_chaddr, NetOurEther, 6);
+	memcpy(bp->bp_chaddr, net_ethaddr, 6);
 
 	/*
 	 * ID is the id of the OFFER packet
diff --git a/net/cdp.c b/net/cdp.c
index 2d8fa03..e8e7a67 100644
--- a/net/cdp.c
+++ b/net/cdp.c
@@ -18,7 +18,7 @@
 #include "cdp.h"
 
 /* Ethernet bcast address */
-const uchar NetCDPAddr[6] = { 0x01, 0x00, 0x0c, 0xcc, 0xcc, 0xcc };
+const u8 net_cdp_ethaddr[6] = { 0x01, 0x00, 0x0c, 0xcc, 0xcc, 0xcc };
 
 #define CDP_DEVICE_ID_TLV		0x0001
 #define CDP_ADDRESS_TLV			0x0002
@@ -124,8 +124,8 @@ CDPSendTrigger(void)
 	/* NOTE: trigger sent not on any VLAN */
 
 	/* form ethernet header */
-	memcpy(et->et_dest, NetCDPAddr, 6);
-	memcpy(et->et_src, NetOurEther, 6);
+	memcpy(et->et_dest, net_cdp_ethaddr, 6);
+	memcpy(et->et_src, net_ethaddr, 6);
 
 	pkt += ETHER_HDR_SIZE;
 
@@ -145,7 +145,7 @@ CDPSendTrigger(void)
 #ifdef CONFIG_CDP_DEVICE_ID
 	*s++ = htons(CDP_DEVICE_ID_TLV);
 	*s++ = htons(CONFIG_CDP_DEVICE_ID);
-	sprintf(buf, CONFIG_CDP_DEVICE_ID_PREFIX "%pm", NetOurEther);
+	sprintf(buf, CONFIG_CDP_DEVICE_ID_PREFIX "%pm", net_ethaddr);
 	memcpy((uchar *)s, buf, 16);
 	s += 16 / 2;
 #endif
diff --git a/net/dns.c b/net/dns.c
index 6f8b1f2..0ff2b75 100644
--- a/net/dns.c
+++ b/net/dns.c
@@ -89,7 +89,7 @@ DnsSend(void)
 
 	DnsOurPort = random_port();
 
-	NetSendUDPPacket(NetServerEther, net_dns_server, DNS_SERVICE_PORT,
+	NetSendUDPPacket(net_server_ethaddr, net_dns_server, DNS_SERVICE_PORT,
 			 DnsOurPort, n);
 	debug("DNS packet sent\n");
 }
@@ -203,7 +203,7 @@ DnsStart(void)
 	net_set_udp_handler(dns_handler);
 
 	/* Clear a previous MAC address, the server IP might have changed. */
-	memset(NetServerEther, 0, sizeof(NetServerEther));
+	memset(net_server_ethaddr, 0, sizeof(net_server_ethaddr));
 
 	DnsSend();
 }
diff --git a/net/eth.c b/net/eth.c
index cc81eb7..e936ca0 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -32,7 +32,7 @@ void eth_parse_enetaddr(const char *addr, uchar *enetaddr)
 int eth_getenv_enetaddr(char *name, uchar *enetaddr)
 {
 	eth_parse_enetaddr(getenv(name), enetaddr);
-	return is_valid_ether_addr(enetaddr);
+	return is_valid_ethaddr(enetaddr);
 }
 
 int eth_setenv_enetaddr(char *name, const uchar *enetaddr)
@@ -367,7 +367,7 @@ static int eth_write_hwaddr(struct udevice *dev)
 
 	/* seq is valid since the device is active */
 	if (eth_get_ops(dev)->write_hwaddr && !eth_mac_skip(dev->seq)) {
-		if (!is_valid_ether_addr(pdata->enetaddr)) {
+		if (!is_valid_ethaddr(pdata->enetaddr)) {
 			printf("\nError: %s address %pM illegal value\n",
 			       dev->name, pdata->enetaddr);
 			return -EINVAL;
@@ -468,8 +468,8 @@ static int eth_post_probe(struct udevice *dev)
 		eth_get_ops(dev)->read_rom_hwaddr(dev);
 
 	eth_getenv_enetaddr_by_index("eth", dev->seq, env_enetaddr);
-	if (!is_zero_ether_addr(env_enetaddr)) {
-		if (!is_zero_ether_addr(pdata->enetaddr) &&
+	if (!is_zero_ethaddr(env_enetaddr)) {
+		if (!is_zero_ethaddr(pdata->enetaddr) &&
 		    memcmp(pdata->enetaddr, env_enetaddr, 6)) {
 			printf("\nWarning: %s MAC addresses don't match:\n",
 			       dev->name);
@@ -481,11 +481,11 @@ static int eth_post_probe(struct udevice *dev)
 
 		/* Override the ROM MAC address */
 		memcpy(pdata->enetaddr, env_enetaddr, 6);
-	} else if (is_valid_ether_addr(pdata->enetaddr)) {
+	} else if (is_valid_ethaddr(pdata->enetaddr)) {
 		eth_setenv_enetaddr_by_index("eth", dev->seq, pdata->enetaddr);
 		printf("\nWarning: %s using MAC address from ROM\n",
 		       dev->name);
-	} else if (is_zero_ether_addr(pdata->enetaddr)) {
+	} else if (is_zero_ethaddr(pdata->enetaddr)) {
 		printf("\nError: %s address not set.\n",
 		       dev->name);
 		return -EINVAL;
@@ -606,8 +606,8 @@ int eth_write_hwaddr(struct eth_device *dev, const char *base_name,
 
 	eth_getenv_enetaddr_by_index(base_name, eth_number, env_enetaddr);
 
-	if (!is_zero_ether_addr(env_enetaddr)) {
-		if (!is_zero_ether_addr(dev->enetaddr) &&
+	if (!is_zero_ethaddr(env_enetaddr)) {
+		if (!is_zero_ethaddr(dev->enetaddr) &&
 		    memcmp(dev->enetaddr, env_enetaddr, 6)) {
 			printf("\nWarning: %s MAC addresses don't match:\n",
 				dev->name);
@@ -618,19 +618,19 @@ int eth_write_hwaddr(struct eth_device *dev, const char *base_name,
 		}
 
 		memcpy(dev->enetaddr, env_enetaddr, 6);
-	} else if (is_valid_ether_addr(dev->enetaddr)) {
+	} else if (is_valid_ethaddr(dev->enetaddr)) {
 		eth_setenv_enetaddr_by_index(base_name, eth_number,
 					     dev->enetaddr);
 		printf("\nWarning: %s using MAC address from net device\n",
 			dev->name);
-	} else if (is_zero_ether_addr(dev->enetaddr)) {
+	} else if (is_zero_ethaddr(dev->enetaddr)) {
 		printf("\nError: %s address not set.\n",
 		       dev->name);
 		return -EINVAL;
 	}
 
 	if (dev->write_hwaddr && !eth_mac_skip(eth_number)) {
-		if (!is_valid_ether_addr(dev->enetaddr)) {
+		if (!is_valid_ethaddr(dev->enetaddr)) {
 			printf("\nError: %s address %pM illegal value\n",
 				 dev->name, dev->enetaddr);
 			return -EINVAL;
diff --git a/net/link_local.c b/net/link_local.c
index 23a06cb..56616d6 100644
--- a/net/link_local.c
+++ b/net/link_local.c
@@ -135,7 +135,7 @@ static void link_local_timeout(void)
 			nprobes++;
 			debug_cond(DEBUG_LL_STATE, "probe/%u %s@%pI4\n",
 					nprobes, eth_get_name(), &ip);
-			arp_raw_request(0, NetEtherNullAddr, ip);
+			arp_raw_request(0, net_null_ethaddr, ip);
 			timeout_ms = PROBE_MIN * 1000;
 			timeout_ms += random_delay_ms(PROBE_MAX - PROBE_MIN);
 		} else {
@@ -144,7 +144,7 @@ static void link_local_timeout(void)
 			nclaims = 0;
 			debug_cond(DEBUG_LL_STATE, "announce/%u %s@%pI4\n",
 					nclaims, eth_get_name(), &ip);
-			arp_raw_request(ip, NetOurEther, ip);
+			arp_raw_request(ip, net_ethaddr, ip);
 			timeout_ms = ANNOUNCE_INTERVAL * 1000;
 		}
 		break;
@@ -156,7 +156,7 @@ static void link_local_timeout(void)
 		nclaims = 0;
 		debug_cond(DEBUG_LL_STATE, "announce/%u %s@%pI4\n",
 				nclaims, eth_get_name(), &ip);
-		arp_raw_request(ip, NetOurEther, ip);
+		arp_raw_request(ip, net_ethaddr, ip);
 		timeout_ms = ANNOUNCE_INTERVAL * 1000;
 		break;
 	case ANNOUNCE:
@@ -167,7 +167,7 @@ static void link_local_timeout(void)
 			nclaims++;
 			debug_cond(DEBUG_LL_STATE, "announce/%u %s@%pI4\n",
 					nclaims, eth_get_name(), &ip);
-			arp_raw_request(ip, NetOurEther, ip);
+			arp_raw_request(ip, net_ethaddr, ip);
 			timeout_ms = ANNOUNCE_INTERVAL * 1000;
 		} else {
 			/* Switch to monitor state */
@@ -264,11 +264,9 @@ void link_local_receive_arp(struct arp_hdr *arp, int len)
 	source_ip_conflict = 0;
 	target_ip_conflict = 0;
 
-	if (memcmp(&arp->ar_spa, &ip, ARP_PLEN) == 0
-	 && memcmp(&arp->ar_sha, NetOurEther, ARP_HLEN) != 0
-	) {
+	if (memcmp(&arp->ar_spa, &ip, ARP_PLEN) == 0 &&
+	    memcmp(&arp->ar_sha, net_ethaddr, ARP_HLEN) != 0)
 		source_ip_conflict = 1;
-	}
 
 	/*
 	 * According to RFC 3927, section 2.2.1:
@@ -280,7 +278,7 @@ void link_local_receive_arp(struct arp_hdr *arp, int len)
 	if (arp->ar_op == htons(ARPOP_REQUEST) &&
 	    memcmp(&arp->ar_spa, &null_ip, ARP_PLEN) == 0 &&
 	    memcmp(&arp->ar_tpa, &ip, ARP_PLEN) == 0 &&
-	    memcmp(&arp->ar_sha, NetOurEther, ARP_HLEN) != 0) {
+	    memcmp(&arp->ar_sha, net_ethaddr, ARP_HLEN) != 0) {
 		target_ip_conflict = 1;
 	}
 
@@ -314,7 +312,7 @@ void link_local_receive_arp(struct arp_hdr *arp, int len)
 			debug("monitor conflict -- defending\n");
 			state = DEFEND;
 			timeout_ms = DEFEND_INTERVAL * 1000;
-			arp_raw_request(ip, NetOurEther, ip);
+			arp_raw_request(ip, net_ethaddr, ip);
 		}
 		break;
 	case DEFEND:
diff --git a/net/net.c b/net/net.c
index bf21099..5ee4d6a 100644
--- a/net/net.c
+++ b/net/net.c
@@ -129,9 +129,9 @@ struct in_addr net_mcast_addr;
 /** END OF BOOTP EXTENTIONS **/
 
 /* Our ethernet address */
-uchar		NetOurEther[6];
+u8 net_ethaddr[6];
 /* Boot server enet address */
-uchar		NetServerEther[6];
+u8 net_server_ethaddr[6];
 /* Our IP addr (0 = unknown) */
 struct in_addr	net_ip;
 /* Server IP addr (0 = unknown) */
@@ -143,8 +143,8 @@ int		NetRxPacketLen;
 /* IP packet ID */
 unsigned	NetIPID;
 /* Ethernet bcast address */
-uchar		NetBcastAddr[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
-uchar		NetEtherNullAddr[6];
+const u8 net_bcast_ethaddr[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
+const u8 net_null_ethaddr[6];
 #ifdef CONFIG_API
 void		(*push_packet)(void *, int len) = 0;
 #endif
@@ -274,7 +274,7 @@ static void NetInitLoop(void)
 		env_changed_id = env_id;
 	}
 	if (eth_get_dev())
-		memcpy(NetOurEther, eth_get_ethaddr(), 6);
+		memcpy(net_ethaddr, eth_get_ethaddr(), 6);
 
 	return;
 }
@@ -728,7 +728,7 @@ int NetSendUDPPacket(uchar *ether, struct in_addr dest, int dport, int sport,
 
 	/* if broadcast, make the ether address a broadcast and don't do ARP */
 	if (dest.s_addr == 0xFFFFFFFF)
-		ether = NetBcastAddr;
+		ether = (uchar *)net_bcast_ethaddr;
 
 	pkt = (uchar *)NetTxPacket;
 
@@ -738,7 +738,7 @@ int NetSendUDPPacket(uchar *ether, struct in_addr dest, int dport, int sport,
 	pkt_hdr_size = eth_hdr_size + IP_UDP_HDR_SIZE;
 
 	/* if MAC address was not discovered yet, do an ARP request */
-	if (memcmp(ether, NetEtherNullAddr, 6) == 0) {
+	if (memcmp(ether, net_null_ethaddr, 6) == 0) {
 		debug_cond(DEBUG_DEV_PKT, "sending ARP for %pI4\n", &dest);
 
 		/* save the ip and eth addr for the packet to send after arp */
@@ -1279,7 +1279,7 @@ common:
 	case CDP:
 	case DHCP:
 	case LINKLOCAL:
-		if (memcmp(NetOurEther, "\0\0\0\0\0\0", 6) == 0) {
+		if (memcmp(net_ethaddr, "\0\0\0\0\0\0", 6) == 0) {
 			int num = eth_get_dev_index();
 
 			switch (num) {
@@ -1320,7 +1320,7 @@ NetEthHdrSize(void)
 }
 
 int
-NetSetEther(uchar *xet, uchar * addr, uint prot)
+NetSetEther(uchar *xet, const uchar *dest_ethaddr, uint prot)
 {
 	struct ethernet_hdr *et = (struct ethernet_hdr *)xet;
 	ushort myvlanid;
@@ -1329,8 +1329,8 @@ NetSetEther(uchar *xet, uchar * addr, uint prot)
 	if (myvlanid == (ushort)-1)
 		myvlanid = VLAN_NONE;
 
-	memcpy(et->et_dest, addr, 6);
-	memcpy(et->et_src, NetOurEther, 6);
+	memcpy(et->et_dest, dest_ethaddr, 6);
+	memcpy(et->et_src, net_ethaddr, 6);
 	if ((myvlanid & VLAN_IDMASK) == VLAN_NONE) {
 		et->et_protlen = htons(prot);
 		return ETHER_HDR_SIZE;
@@ -1350,7 +1350,7 @@ int net_update_ether(struct ethernet_hdr *et, uchar *addr, uint prot)
 	ushort protlen;
 
 	memcpy(et->et_dest, addr, 6);
-	memcpy(et->et_src, NetOurEther, 6);
+	memcpy(et->et_src, net_ethaddr, 6);
 	protlen = ntohs(et->et_protlen);
 	if (protlen == PROT_VLAN) {
 		struct vlan_ethernet_hdr *vet =
diff --git a/net/nfs.c b/net/nfs.c
index 1e5c1c3..23a9cc3 100644
--- a/net/nfs.c
+++ b/net/nfs.c
@@ -211,7 +211,7 @@ rpc_req(int rpc_prog, int rpc_proc, uint32_t *data, int datalen)
 	else
 		sport = NfsSrvNfsPort;
 
-	NetSendUDPPacket(NetServerEther, nfs_server_ip, sport, NfsOurPort,
+	NetSendUDPPacket(net_server_ethaddr, nfs_server_ip, sport, NfsOurPort,
 			 pktlen);
 }
 
@@ -788,7 +788,7 @@ NfsStart(void)
 	NfsOurPort = 1000;
 
 	/* zero out server ether in case the server ip has changed */
-	memset(NetServerEther, 0, 6);
+	memset(net_server_ethaddr, 0, 6);
 
 	NfsSend();
 }
diff --git a/net/ping.c b/net/ping.c
index 4918a1c..e4e3086 100644
--- a/net/ping.c
+++ b/net/ping.c
@@ -50,7 +50,7 @@ static int ping_send(void)
 
 	net_arp_wait_packet_ip = net_ping_ip;
 
-	eth_hdr_size = NetSetEther(NetTxPacket, NetEtherNullAddr, PROT_IP);
+	eth_hdr_size = NetSetEther(NetTxPacket, net_null_ethaddr, PROT_IP);
 	pkt = (uchar *)NetTxPacket + eth_hdr_size;
 
 	set_icmp_header(pkt, net_ping_ip);
diff --git a/net/rarp.c b/net/rarp.c
index 4c48bd5..b5ba224 100644
--- a/net/rarp.c
+++ b/net/rarp.c
@@ -46,7 +46,7 @@ void rarp_receive(struct ip_udp_hdr *ip, unsigned len)
 		net_copy_ip(&net_ip, &arp->ar_data[16]);
 		if (net_server_ip == 0)
 			net_copy_ip(&net_server_ip, &arp->ar_data[6]);
-		memcpy(NetServerEther, &arp->ar_data[0], 6);
+		memcpy(net_server_ethaddr, &arp->ar_data[0], 6);
 		debug_cond(DEBUG_DEV_PKT, "Got good RARP\n");
 		net_auto_load();
 	}
@@ -77,7 +77,7 @@ void RarpRequest(void)
 	printf("RARP broadcast %d\n", ++RarpTry);
 	pkt = NetTxPacket;
 
-	eth_hdr_size = NetSetEther(pkt, NetBcastAddr, PROT_RARP);
+	eth_hdr_size = NetSetEther(pkt, net_bcast_ethaddr, PROT_RARP);
 	pkt += eth_hdr_size;
 
 	rarp = (struct arp_hdr *)pkt;
@@ -87,10 +87,10 @@ void RarpRequest(void)
 	rarp->ar_hln = 6;
 	rarp->ar_pln = 4;
 	rarp->ar_op  = htons(RARPOP_REQUEST);
-	memcpy(&rarp->ar_data[0],  NetOurEther, 6);	/* source ET addr */
+	memcpy(&rarp->ar_data[0],  net_ethaddr, 6);	/* source ET addr */
 	memcpy(&rarp->ar_data[6],  &net_ip,   4);	/* source IP addr */
 	/* dest ET addr = source ET addr ??*/
-	memcpy(&rarp->ar_data[10], NetOurEther, 6);
+	memcpy(&rarp->ar_data[10], net_ethaddr, 6);
 	/* dest IP addr set to broadcast */
 	memset(&rarp->ar_data[16], 0xff,        4);
 
diff --git a/net/sntp.c b/net/sntp.c
index 3e45a83..b99aa3e 100644
--- a/net/sntp.c
+++ b/net/sntp.c
@@ -37,7 +37,7 @@ SntpSend(void)
 	SntpOurPort = 10000 + (get_timer(0) % 4096);
 	sport = NTP_SERVICE_PORT;
 
-	NetSendUDPPacket(NetServerEther, net_ntp_server, sport, SntpOurPort,
+	NetSendUDPPacket(net_server_ethaddr, net_ntp_server, sport, SntpOurPort,
 			 pktlen);
 }
 
@@ -85,7 +85,7 @@ SntpStart(void)
 
 	NetSetTimeout(SNTP_TIMEOUT, SntpTimeout);
 	net_set_udp_handler(sntp_handler);
-	memset(NetServerEther, 0, sizeof(NetServerEther));
+	memset(net_server_ethaddr, 0, sizeof(net_server_ethaddr));
 
 	SntpSend();
 }
diff --git a/net/tftp.c b/net/tftp.c
index bafc354..8ddc7be 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -435,7 +435,7 @@ TftpSend(void)
 		break;
 	}
 
-	NetSendUDPPacket(NetServerEther, tftp_remote_ip, TftpRemotePort,
+	NetSendUDPPacket(net_server_ethaddr, tftp_remote_ip, TftpRemotePort,
 			 TftpOurPort, len);
 }
 
@@ -816,7 +816,7 @@ void TftpStart(enum proto_t protocol)
 	TftpBlock = 0;
 
 	/* zero out server ether in case the server ip has changed */
-	memset(NetServerEther, 0, 6);
+	memset(net_server_ethaddr, 0, 6);
 	/* Revert TftpBlkSize to dflt */
 	TftpBlkSize = TFTP_BLOCK_SIZE;
 #ifdef CONFIG_MCAST_TFTP
@@ -861,7 +861,7 @@ TftpStartServer(void)
 	net_set_udp_handler(tftp_handler);
 
 	/* zero out server ether in case the server ip has changed */
-	memset(NetServerEther, 0, 6);
+	memset(net_server_ethaddr, 0, 6);
 }
 #endif /* CONFIG_CMD_TFTPSRV */
 
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH 05/23] net: cosmetic: Cleanup internal packet buffer names
  2015-04-03 21:14 [U-Boot] [PATCH 0/23] net: cosmetic: Fix naming and other checkpatch.pl issues in net/ Joe Hershberger
                   ` (3 preceding siblings ...)
  2015-04-03 21:14 ` [U-Boot] [PATCH 04/23] net: cosmetic: Name ethaddr variables consistently Joe Hershberger
@ 2015-04-03 21:14 ` Joe Hershberger
  2015-04-03 21:14 ` [U-Boot] [PATCH 06/23] net: cosmetic: Fix var naming net <-> eth drivers Joe Hershberger
                   ` (19 subsequent siblings)
  24 siblings, 0 replies; 103+ messages in thread
From: Joe Hershberger @ 2015-04-03 21:14 UTC (permalink / raw)
  To: u-boot

This patch cleans up the names of internal packet buffer names that are
used within the network stack and the functions that use them.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

 arch/powerpc/cpu/mpc8260/ether_fcc.c |  4 ++--
 drivers/net/netconsole.c             | 13 +++++------
 include/net.h                        | 16 +++++++-------
 net/arp.c                            | 20 ++++++++---------
 net/bootp.c                          | 16 +++++++-------
 net/cdp.c                            | 10 ++++-----
 net/dns.c                            |  7 +++---
 net/net.c                            | 42 ++++++++++++++++++------------------
 net/nfs.c                            |  8 +++----
 net/ping.c                           |  6 +++---
 net/rarp.c                           |  6 +++---
 net/sntp.c                           |  8 +++----
 net/tftp.c                           |  6 +++---
 13 files changed, 82 insertions(+), 80 deletions(-)

diff --git a/arch/powerpc/cpu/mpc8260/ether_fcc.c b/arch/powerpc/cpu/mpc8260/ether_fcc.c
index 240e7ae..50d1654 100644
--- a/arch/powerpc/cpu/mpc8260/ether_fcc.c
+++ b/arch/powerpc/cpu/mpc8260/ether_fcc.c
@@ -720,8 +720,8 @@ eth_loopback_test (void)
 			bdp->cbd_sc = BD_ENET_TX_READY | BD_ENET_TX_PAD | \
 				BD_ENET_TX_LAST | BD_ENET_TX_TC;
 
-			memset ((void *)bp, patbytes[i], ELBT_BUFSZ);
-			NetSetEther(bp, net_bcast_ethaddr, 0x8000);
+			memset((void *)bp, patbytes[i], ELBT_BUFSZ);
+			net_set_ether(bp, net_bcast_ethaddr, 0x8000);
 		}
 		ecp->txbd[ELBT_NTXBD - 1].cbd_sc |= BD_ENET_TX_WRAP;
 
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index 0d81b44..9aba0c5 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -125,10 +125,11 @@ void NcStart(void)
 		/* send arp request */
 		uchar *pkt;
 		net_set_arp_handler(nc_wait_arp_handler);
-		pkt = (uchar *)NetTxPacket + NetEthHdrSize() + IP_UDP_HDR_SIZE;
+		pkt = (uchar *)net_tx_packet + net_eth_hdr_size() +
+			IP_UDP_HDR_SIZE;
 		memcpy(pkt, output_packet, output_packet_len);
-		NetSendUDPPacket(nc_ether, nc_ip, nc_out_port, nc_in_port,
-			output_packet_len);
+		net_send_udp_packet(nc_ether, nc_ip, nc_out_port, nc_in_port,
+				    output_packet_len);
 	}
 }
 
@@ -202,11 +203,11 @@ static void nc_send_packet(const char *buf, int len)
 
 		inited = 1;
 	}
-	pkt = (uchar *)NetTxPacket + NetEthHdrSize() + IP_UDP_HDR_SIZE;
+	pkt = (uchar *)net_tx_packet + net_eth_hdr_size() + IP_UDP_HDR_SIZE;
 	memcpy(pkt, buf, len);
 	ether = nc_ether;
 	ip = nc_ip;
-	NetSendUDPPacket(ether, ip, nc_out_port, nc_in_port, len);
+	net_send_udp_packet(ether, ip, nc_out_port, nc_in_port, len);
 
 	if (inited) {
 		if (eth_is_on_demand_init())
@@ -229,7 +230,7 @@ static int nc_start(struct stdio_dev *dev)
 
 	/*
 	 * Initialize the static IP settings and buffer pointers
-	 * incase we call NetSendUDPPacket before NetLoop
+	 * incase we call net_send_udp_packet before NetLoop
 	 */
 	net_init();
 
diff --git a/include/net.h b/include/net.h
index 33e542f..18ae7d2 100644
--- a/include/net.h
+++ b/include/net.h
@@ -475,14 +475,14 @@ extern u8		net_ethaddr[6];		/* Our ethernet address */
 extern u8		net_server_ethaddr[6];	/* Boot server enet address */
 extern struct in_addr	net_ip;		/* Our    IP addr (0 = unknown) */
 extern struct in_addr	net_server_ip;	/* Server IP addr (0 = unknown) */
-extern uchar		*NetTxPacket;		/* THE transmit packet */
+extern uchar		*net_tx_packet;		/* THE transmit packet */
 #ifdef CONFIG_DM_ETH
 extern uchar		*net_rx_packets[PKTBUFSRX]; /* Receive packets */
 #else
 extern uchar		*NetRxPackets[PKTBUFSRX]; /* Receive packets */
 #endif
-extern uchar		*NetRxPacket;		/* Current receive packet */
-extern int		NetRxPacketLen;		/* Current rx packet length */
+extern uchar		*net_rx_packet;		/* Current receive packet */
+extern int		net_rx_packet_len;	/* Current rx packet length */
 extern unsigned		NetIPID;		/* IP ID (counting) */
 extern const u8		net_bcast_ethaddr[6];	/* Ethernet broadcast address */
 extern const u8		net_null_ethaddr[6];
@@ -550,10 +550,10 @@ void	NetStop(void);
 int	NetStartAgain(void);
 
 /* Get size of the ethernet header when we send */
-int	NetEthHdrSize(void);
+int net_eth_hdr_size(void);
 
 /* Set ethernet header; returns the size of the header */
-int NetSetEther(uchar *xet, const uchar *dest_ethaddr, uint prot);
+int net_set_ether(uchar *xet, const uchar *dest_ethaddr, uint prot);
 int net_update_ether(struct ethernet_hdr *et, uchar *addr, uint prot);
 
 /* Set IP header */
@@ -615,14 +615,14 @@ static inline void net_set_state(enum net_loop_state state)
 }
 
 /* Transmit a packet */
-static inline void NetSendPacket(uchar *pkt, int len)
+static inline void net_send_packet(uchar *pkt, int len)
 {
 	/* Currently no way to return errors from eth_send() */
 	(void) eth_send(pkt, len);
 }
 
 /*
- * Transmit "NetTxPacket" as UDP packet, performing ARP request if needed
+ * Transmit "net_tx_packet" as UDP packet, performing ARP request if needed
  *  (ether will be populated)
  *
  * @param ether Raw packet buffer
@@ -631,7 +631,7 @@ static inline void NetSendPacket(uchar *pkt, int len)
  * @param sport Source UDP port
  * @param payload_len Length of data after the UDP header
  */
-int NetSendUDPPacket(uchar *ether, struct in_addr dest, int dport,
+int net_send_udp_packet(uchar *ether, struct in_addr dest, int dport,
 			int sport, int payload_len);
 
 #ifndef CONFIG_DM_ETH
diff --git a/net/arp.c b/net/arp.c
index 8dbcd65..691811d 100644
--- a/net/arp.c
+++ b/net/arp.c
@@ -35,7 +35,7 @@ int		NetArpWaitTxPacketSize;
 ulong		NetArpWaitTimerStart;
 int		NetArpWaitTry;
 
-static uchar   *NetArpTxPacket;	/* THE ARP transmit packet */
+static uchar   *net_arp_tx_packet;	/* THE ARP transmit packet */
 static uchar	NetArpPacketBuf[PKTSIZE_ALIGN + PKTALIGN];
 
 void ArpInit(void)
@@ -45,8 +45,8 @@ void ArpInit(void)
 	net_arp_wait_packet_ip.s_addr = 0;
 	net_arp_wait_reply_ip.s_addr = 0;
 	NetArpWaitTxPacketSize = 0;
-	NetArpTxPacket = &NetArpPacketBuf[0] + (PKTALIGN - 1);
-	NetArpTxPacket -= (ulong)NetArpTxPacket % PKTALIGN;
+	net_arp_tx_packet = &NetArpPacketBuf[0] + (PKTALIGN - 1);
+	net_arp_tx_packet -= (ulong)net_arp_tx_packet % PKTALIGN;
 }
 
 void arp_raw_request(struct in_addr source_ip, const uchar *targetEther,
@@ -58,9 +58,9 @@ void arp_raw_request(struct in_addr source_ip, const uchar *targetEther,
 
 	debug_cond(DEBUG_DEV_PKT, "ARP broadcast %d\n", NetArpWaitTry);
 
-	pkt = NetArpTxPacket;
+	pkt = net_arp_tx_packet;
 
-	eth_hdr_size = NetSetEther(pkt, net_bcast_ethaddr, PROT_ARP);
+	eth_hdr_size = net_set_ether(pkt, net_bcast_ethaddr, PROT_ARP);
 	pkt += eth_hdr_size;
 
 	arp = (struct arp_hdr *) pkt;
@@ -76,7 +76,7 @@ void arp_raw_request(struct in_addr source_ip, const uchar *targetEther,
 	memcpy(&arp->ar_tha, targetEther, ARP_HLEN);	/* target ET addr */
 	net_write_ip(&arp->ar_tpa, target_ip);		/* target IP addr */
 
-	NetSendPacket(NetArpTxPacket, eth_hdr_size + ARP_HDR_SIZE);
+	net_send_packet(net_arp_tx_packet, eth_hdr_size + ARP_HDR_SIZE);
 }
 
 void ArpRequest(void)
@@ -184,7 +184,7 @@ void ArpReceive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
 		    (net_read_ip(&arp->ar_spa).s_addr & net_netmask.s_addr))
 			udelay(5000);
 #endif
-		NetSendPacket((uchar *)et, eth_hdr_size + ARP_HDR_SIZE);
+		net_send_packet((uchar *)et, eth_hdr_size + ARP_HDR_SIZE);
 		return;
 
 	case ARPOP_REPLY:		/* arp reply */
@@ -218,9 +218,9 @@ void ArpReceive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
 
 			/* set the mac address in the waiting packet's header
 			   and transmit it */
-			memcpy(((struct ethernet_hdr *)NetTxPacket)->et_dest,
-				&arp->ar_sha, ARP_HLEN);
-			NetSendPacket(NetTxPacket, NetArpWaitTxPacketSize);
+			memcpy(((struct ethernet_hdr *)net_tx_packet)->et_dest,
+			       &arp->ar_sha, ARP_HLEN);
+			net_send_packet(net_tx_packet, NetArpWaitTxPacketSize);
 
 			/* no arp request pending now */
 			net_arp_wait_packet_ip.s_addr = 0;
diff --git a/net/bootp.c b/net/bootp.c
index 9b27d4c..9788b52 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -147,8 +147,8 @@ static void BootpCopyNetParams(struct Bootp_t *bp)
 	net_copy_ip(&tmp_ip, &bp->bp_siaddr);
 	if (tmp_ip.s_addr != 0)
 		net_copy_ip(&net_server_ip, &bp->bp_siaddr);
-	memcpy(net_server_ethaddr, ((struct ethernet_hdr *)NetRxPacket)->et_src,
-	       6);
+	memcpy(net_server_ethaddr,
+	       ((struct ethernet_hdr *)net_rx_packet)->et_src, 6);
 	if (strlen(bp->bp_file) > 0)
 		copy_filename(net_boot_file_name, bp->bp_file,
 			      sizeof(net_boot_file_name));
@@ -691,10 +691,10 @@ BootpRequest(void)
 #endif	/* CONFIG_BOOTP_RANDOM_DELAY */
 
 	printf("BOOTP broadcast %d\n", ++BootpTry);
-	pkt = NetTxPacket;
+	pkt = net_tx_packet;
 	memset((void *)pkt, 0, PKTSIZE);
 
-	eth_hdr_size = NetSetEther(pkt, net_bcast_ethaddr, PROT_IP);
+	eth_hdr_size = net_set_ether(pkt, net_bcast_ethaddr, PROT_IP);
 	pkt += eth_hdr_size;
 
 	/*
@@ -760,7 +760,7 @@ BootpRequest(void)
 #else
 	net_set_udp_handler(bootp_handler);
 #endif
-	NetSendPacket(NetTxPacket, pktlen);
+	net_send_packet(net_tx_packet, pktlen);
 }
 
 #if defined(CONFIG_CMD_DHCP)
@@ -894,10 +894,10 @@ static void DhcpSendRequestPkt(struct Bootp_t *bp_offer)
 	struct in_addr bcast_ip;
 
 	debug("DhcpSendRequestPkt: Sending DHCPREQUEST\n");
-	pkt = NetTxPacket;
+	pkt = net_tx_packet;
 	memset((void *)pkt, 0, PKTSIZE);
 
-	eth_hdr_size = NetSetEther(pkt, net_bcast_ethaddr, PROT_IP);
+	eth_hdr_size = net_set_ether(pkt, net_bcast_ethaddr, PROT_IP);
 	pkt += eth_hdr_size;
 
 	iphdr = pkt;	/* We'll need this later to set proper pkt size */
@@ -945,7 +945,7 @@ static void DhcpSendRequestPkt(struct Bootp_t *bp_offer)
 	udelay(CONFIG_BOOTP_DHCP_REQUEST_DELAY);
 #endif	/* CONFIG_BOOTP_DHCP_REQUEST_DELAY */
 	debug("Transmitting DHCPREQUEST packet: len = %d\n", pktlen);
-	NetSendPacket(NetTxPacket, pktlen);
+	net_send_packet(net_tx_packet, pktlen);
 }
 
 /*
diff --git a/net/cdp.c b/net/cdp.c
index e8e7a67..392437d 100644
--- a/net/cdp.c
+++ b/net/cdp.c
@@ -118,7 +118,7 @@ CDPSendTrigger(void)
 	char buf[32];
 #endif
 
-	pkt = NetTxPacket;
+	pkt = net_tx_packet;
 	et = (struct ethernet_hdr *)pkt;
 
 	/* NOTE: trigger sent not on any VLAN */
@@ -207,17 +207,17 @@ CDPSendTrigger(void)
 #endif
 
 	/* length of ethernet packet */
-	len = (uchar *)s - ((uchar *)NetTxPacket + ETHER_HDR_SIZE);
+	len = (uchar *)s - ((uchar *)net_tx_packet + ETHER_HDR_SIZE);
 	et->et_protlen = htons(len);
 
 	len = ETHER_HDR_SIZE + sizeof(CDP_SNAP_hdr);
-	chksum = CDP_compute_csum((uchar *)NetTxPacket + len,
-				  (uchar *)s - (NetTxPacket + len));
+	chksum = CDP_compute_csum((uchar *)net_tx_packet + len,
+				  (uchar *)s - (net_tx_packet + len));
 	if (chksum == 0)
 		chksum = 0xFFFF;
 	*cp = htons(chksum);
 
-	NetSendPacket(NetTxPacket, (uchar *)s - NetTxPacket);
+	net_send_packet(net_tx_packet, (uchar *)s - net_tx_packet);
 	return 0;
 }
 
diff --git a/net/dns.c b/net/dns.c
index 0ff2b75..50d78ae 100644
--- a/net/dns.c
+++ b/net/dns.c
@@ -45,7 +45,8 @@ DnsSend(void)
 	enum dns_query_type qtype = DNS_A_RECORD;
 
 	name = NetDNSResolve;
-	pkt = p = (uchar *)(NetTxPacket + NetEthHdrSize() + IP_UDP_HDR_SIZE);
+	pkt = (uchar *)(net_tx_packet + net_eth_hdr_size() + IP_UDP_HDR_SIZE);
+	p = pkt;
 
 	/* Prepare DNS packet header */
 	header           = (struct header *) pkt;
@@ -89,8 +90,8 @@ DnsSend(void)
 
 	DnsOurPort = random_port();
 
-	NetSendUDPPacket(net_server_ethaddr, net_dns_server, DNS_SERVICE_PORT,
-			 DnsOurPort, n);
+	net_send_udp_packet(net_server_ethaddr, net_dns_server,
+			    DNS_SERVICE_PORT, DnsOurPort, n);
 	debug("DNS packet sent\n");
 }
 
diff --git a/net/net.c b/net/net.c
index 5ee4d6a..0fb0475 100644
--- a/net/net.c
+++ b/net/net.c
@@ -137,9 +137,9 @@ struct in_addr	net_ip;
 /* Server IP addr (0 = unknown) */
 struct in_addr	net_server_ip;
 /* Current receive packet */
-uchar *NetRxPacket;
+uchar *net_rx_packet;
 /* Current rx packet length */
-int		NetRxPacketLen;
+int		net_rx_packet_len;
 /* IP packet ID */
 unsigned	NetIPID;
 /* Ethernet bcast address */
@@ -177,7 +177,7 @@ struct in_addr	net_ntp_server;
 int		NetTimeOffset;
 #endif
 
-static uchar PktBuf[(PKTBUFSRX+1) * PKTSIZE_ALIGN + PKTALIGN];
+static uchar net_pkt_buf[(PKTBUFSRX+1) * PKTSIZE_ALIGN + PKTALIGN];
 #ifdef CONFIG_DM_ETH
 /* Receive packets */
 uchar *net_rx_packets[PKTBUFSRX];
@@ -200,7 +200,7 @@ static ulong	timeStart;
 /* Current timeout value */
 static ulong	timeDelta;
 /* THE transmit packet */
-uchar *NetTxPacket;
+uchar *net_tx_packet;
 
 static int net_check_prereq(enum proto_t protocol);
 
@@ -301,16 +301,17 @@ void net_init(void)
 		 */
 		int i;
 
-		NetTxPacket = &PktBuf[0] + (PKTALIGN - 1);
-		NetTxPacket -= (ulong)NetTxPacket % PKTALIGN;
+		net_tx_packet = &net_pkt_buf[0] + (PKTALIGN - 1);
+		net_tx_packet -= (ulong)net_tx_packet % PKTALIGN;
 #ifdef CONFIG_DM_ETH
 		for (i = 0; i < PKTBUFSRX; i++) {
-			net_rx_packets[i] = NetTxPacket + (i + 1) *
-				PKTSIZE_ALIGN;
+			net_rx_packets[i] = net_tx_packet +
+				(i + 1) * PKTSIZE_ALIGN;
 		}
 #else
 		for (i = 0; i < PKTBUFSRX; i++)
-			NetRxPackets[i] = NetTxPacket + (i + 1) * PKTSIZE_ALIGN;
+			NetRxPackets[i] = net_tx_packet +
+				(i + 1) * PKTSIZE_ALIGN;
 #endif
 		ArpInit();
 		net_clear_handlers();
@@ -710,16 +711,16 @@ NetSetTimeout(ulong iv, thand_f *f)
 	}
 }
 
-int NetSendUDPPacket(uchar *ether, struct in_addr dest, int dport, int sport,
+int net_send_udp_packet(uchar *ether, struct in_addr dest, int dport, int sport,
 		int payload_len)
 {
 	uchar *pkt;
 	int eth_hdr_size;
 	int pkt_hdr_size;
 
-	/* make sure the NetTxPacket is initialized (NetInit() was called) */
-	assert(NetTxPacket != NULL);
-	if (NetTxPacket == NULL)
+	/* make sure the net_tx_packet is initialized (NetInit() was called) */
+	assert(net_tx_packet != NULL);
+	if (net_tx_packet == NULL)
 		return -1;
 
 	/* convert to new style broadcast */
@@ -730,9 +731,9 @@ int NetSendUDPPacket(uchar *ether, struct in_addr dest, int dport, int sport,
 	if (dest.s_addr == 0xFFFFFFFF)
 		ether = (uchar *)net_bcast_ethaddr;
 
-	pkt = (uchar *)NetTxPacket;
+	pkt = (uchar *)net_tx_packet;
 
-	eth_hdr_size = NetSetEther(pkt, ether, PROT_IP);
+	eth_hdr_size = net_set_ether(pkt, ether, PROT_IP);
 	pkt += eth_hdr_size;
 	net_set_udp_header(pkt, dest, dport, sport, payload_len);
 	pkt_hdr_size = eth_hdr_size + IP_UDP_HDR_SIZE;
@@ -756,7 +757,7 @@ int NetSendUDPPacket(uchar *ether, struct in_addr dest, int dport, int sport,
 	} else {
 		debug_cond(DEBUG_DEV_PKT, "sending UDP to %pI4/%pM\n",
 			&dest, ether);
-		NetSendPacket(NetTxPacket, pkt_hdr_size + payload_len);
+		net_send_packet(net_tx_packet, pkt_hdr_size + payload_len);
 		return 0;	/* transmitted */
 	}
 }
@@ -979,8 +980,8 @@ void net_process_received_packet(uchar *in_packet, int len)
 
 	debug_cond(DEBUG_NET_PKT, "packet received\n");
 
-	NetRxPacket = in_packet;
-	NetRxPacketLen = len;
+	net_rx_packet = in_packet;
+	net_rx_packet_len = len;
 	et = (struct ethernet_hdr *)in_packet;
 
 	/* too small packet? */
@@ -1307,7 +1308,7 @@ common:
 /**********************************************************************/
 
 int
-NetEthHdrSize(void)
+net_eth_hdr_size(void)
 {
 	ushort myvlanid;
 
@@ -1319,8 +1320,7 @@ NetEthHdrSize(void)
 		VLAN_ETHER_HDR_SIZE;
 }
 
-int
-NetSetEther(uchar *xet, const uchar *dest_ethaddr, uint prot)
+int net_set_ether(uchar *xet, const uchar *dest_ethaddr, uint prot)
 {
 	struct ethernet_hdr *et = (struct ethernet_hdr *)xet;
 	ushort myvlanid;
diff --git a/net/nfs.c b/net/nfs.c
index 23a9cc3..6899265 100644
--- a/net/nfs.c
+++ b/net/nfs.c
@@ -201,8 +201,8 @@ rpc_req(int rpc_prog, int rpc_proc, uint32_t *data, int datalen)
 
 	pktlen = (char *)p + datalen*sizeof(uint32_t) - (char *)&pkt;
 
-	memcpy((char *)NetTxPacket + NetEthHdrSize() + IP_UDP_HDR_SIZE,
-		(char *)&pkt, pktlen);
+	memcpy((char *)net_tx_packet + net_eth_hdr_size() + IP_UDP_HDR_SIZE,
+	       (char *)&pkt, pktlen);
 
 	if (rpc_prog == PROG_PORTMAP)
 		sport = SUNRPC_PORT;
@@ -211,8 +211,8 @@ rpc_req(int rpc_prog, int rpc_proc, uint32_t *data, int datalen)
 	else
 		sport = NfsSrvNfsPort;
 
-	NetSendUDPPacket(net_server_ethaddr, nfs_server_ip, sport, NfsOurPort,
-			 pktlen);
+	net_send_udp_packet(net_server_ethaddr, nfs_server_ip, sport,
+			    NfsOurPort, pktlen);
 }
 
 /**************************************************************************
diff --git a/net/ping.c b/net/ping.c
index e4e3086..7c6084c 100644
--- a/net/ping.c
+++ b/net/ping.c
@@ -50,8 +50,8 @@ static int ping_send(void)
 
 	net_arp_wait_packet_ip = net_ping_ip;
 
-	eth_hdr_size = NetSetEther(NetTxPacket, net_null_ethaddr, PROT_IP);
-	pkt = (uchar *)NetTxPacket + eth_hdr_size;
+	eth_hdr_size = net_set_ether(net_tx_packet, net_null_ethaddr, PROT_IP);
+	pkt = (uchar *)net_tx_packet + eth_hdr_size;
 
 	set_icmp_header(pkt, net_ping_ip);
 
@@ -106,7 +106,7 @@ void ping_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
 		icmph->type = ICMP_ECHO_REPLY;
 		icmph->checksum = 0;
 		icmph->checksum = compute_ip_checksum(icmph, len - IP_HDR_SIZE);
-		NetSendPacket((uchar *)et, eth_hdr_size + len);
+		net_send_packet((uchar *)et, eth_hdr_size + len);
 		return;
 /*	default:
 		return;*/
diff --git a/net/rarp.c b/net/rarp.c
index b5ba224..7e7d0aa 100644
--- a/net/rarp.c
+++ b/net/rarp.c
@@ -75,9 +75,9 @@ void RarpRequest(void)
 	int eth_hdr_size;
 
 	printf("RARP broadcast %d\n", ++RarpTry);
-	pkt = NetTxPacket;
+	pkt = net_tx_packet;
 
-	eth_hdr_size = NetSetEther(pkt, net_bcast_ethaddr, PROT_RARP);
+	eth_hdr_size = net_set_ether(pkt, net_bcast_ethaddr, PROT_RARP);
 	pkt += eth_hdr_size;
 
 	rarp = (struct arp_hdr *)pkt;
@@ -94,7 +94,7 @@ void RarpRequest(void)
 	/* dest IP addr set to broadcast */
 	memset(&rarp->ar_data[16], 0xff,        4);
 
-	NetSendPacket(NetTxPacket, eth_hdr_size + ARP_HDR_SIZE);
+	net_send_packet(net_tx_packet, eth_hdr_size + ARP_HDR_SIZE);
 
 	NetSetTimeout(TIMEOUT, RarpTimeout);
 }
diff --git a/net/sntp.c b/net/sntp.c
index b99aa3e..1e2b678 100644
--- a/net/sntp.c
+++ b/net/sntp.c
@@ -31,14 +31,14 @@ SntpSend(void)
 	pkt.vn = NTP_VERSION;
 	pkt.mode = NTP_MODE_CLIENT;
 
-	memcpy((char *)NetTxPacket + NetEthHdrSize() + IP_UDP_HDR_SIZE,
-		(char *)&pkt, pktlen);
+	memcpy((char *)net_tx_packet + net_eth_hdr_size() + IP_UDP_HDR_SIZE,
+	       (char *)&pkt, pktlen);
 
 	SntpOurPort = 10000 + (get_timer(0) % 4096);
 	sport = NTP_SERVICE_PORT;
 
-	NetSendUDPPacket(net_server_ethaddr, net_ntp_server, sport, SntpOurPort,
-			 pktlen);
+	net_send_udp_packet(net_server_ethaddr, net_ntp_server, sport,
+			    SntpOurPort, pktlen);
 }
 
 static void
diff --git a/net/tftp.c b/net/tftp.c
index 8ddc7be..f25abaa 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -337,7 +337,7 @@ TftpSend(void)
 	 *	We will always be sending some sort of packet, so
 	 *	cobble together the packet headers now.
 	 */
-	pkt = NetTxPacket + NetEthHdrSize() + IP_UDP_HDR_SIZE;
+	pkt = net_tx_packet + net_eth_hdr_size() + IP_UDP_HDR_SIZE;
 
 	switch (TftpState) {
 	case STATE_SEND_RRQ:
@@ -435,8 +435,8 @@ TftpSend(void)
 		break;
 	}
 
-	NetSendUDPPacket(net_server_ethaddr, tftp_remote_ip, TftpRemotePort,
-			 TftpOurPort, len);
+	net_send_udp_packet(net_server_ethaddr, tftp_remote_ip, TftpRemotePort,
+			    TftpOurPort, len);
 }
 
 #ifdef CONFIG_CMD_TFTPPUT
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH 06/23] net: cosmetic: Fix var naming net <-> eth drivers
  2015-04-03 21:14 [U-Boot] [PATCH 0/23] net: cosmetic: Fix naming and other checkpatch.pl issues in net/ Joe Hershberger
                   ` (4 preceding siblings ...)
  2015-04-03 21:14 ` [U-Boot] [PATCH 05/23] net: cosmetic: Cleanup internal packet buffer names Joe Hershberger
@ 2015-04-03 21:14 ` Joe Hershberger
  2015-04-03 21:14 ` [U-Boot] [PATCH 07/23] net: cosmetic: Clean up TFTP variables and functions Joe Hershberger
                   ` (18 subsequent siblings)
  24 siblings, 0 replies; 103+ messages in thread
From: Joe Hershberger @ 2015-04-03 21:14 UTC (permalink / raw)
  To: u-boot

Update the naming convention used in the network stack functions and
variables that Ethernet drivers use to interact with it.

This cleans up the temporary hacks that were added to this interface
along with the DM support.

This patch has a few remaining checkpatch.pl failures that would be out
of the scope of this patch to fix (drivers that are in gross violation
of checkpatch.pl).

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

 arch/mips/mach-au1x00/au1x00_eth.c   | 12 ++++++-----
 arch/powerpc/cpu/mpc8260/ether_fcc.c |  4 ++--
 arch/powerpc/cpu/mpc8260/ether_scc.c |  4 ++--
 arch/powerpc/cpu/mpc85xx/ether_fcc.c |  4 ++--
 arch/powerpc/cpu/mpc8xx/fec.c        |  6 +++---
 arch/powerpc/cpu/mpc8xx/scc.c        |  5 +++--
 doc/README.drivers.eth               | 12 +++++------
 drivers/net/4xx_enet.c               | 14 +++++++-----
 drivers/net/altera_tse.c             | 15 +++++++------
 drivers/net/armada100_fec.c          |  7 +++---
 drivers/net/at91_emac.c              |  4 ++--
 drivers/net/ax88180.c                |  6 +++---
 drivers/net/bcm-sf2-eth.c            |  6 +++---
 drivers/net/bfin_mac.c               |  4 ++--
 drivers/net/calxedaxgmac.c           |  2 +-
 drivers/net/cpsw.c                   |  4 ++--
 drivers/net/cs8900.c                 |  5 ++---
 drivers/net/davinci_emac.c           |  5 +++--
 drivers/net/dc2114x.c                |  9 +++++---
 drivers/net/designware.c             |  2 +-
 drivers/net/dm9000x.c                |  5 +++--
 drivers/net/dnet.c                   |  5 +++--
 drivers/net/e1000.c                  |  2 +-
 drivers/net/eepro100.c               |  3 ++-
 drivers/net/enc28j60.c               | 13 ++++++------
 drivers/net/ep93xx_eth.c             | 11 +++++-----
 drivers/net/ethoc.c                  |  4 ++--
 drivers/net/fec_mxc.c                |  2 +-
 drivers/net/fm/eth.c                 |  2 +-
 drivers/net/fsl_mcdmafec.c           | 23 ++++++++++----------
 drivers/net/ftgmac100.c              |  4 ++--
 drivers/net/ftmac100.c               |  4 ++--
 drivers/net/ftmac110.c               |  2 +-
 drivers/net/greth.c                  |  2 +-
 drivers/net/keystone_net.c           |  2 +-
 drivers/net/ks8851_mll.c             |  6 +++---
 drivers/net/lan91c96.c               | 19 +++++++++--------
 drivers/net/macb.c                   |  8 +++----
 drivers/net/mcffec.c                 |  5 +++--
 drivers/net/mpc512x_fec.c            |  3 ++-
 drivers/net/mpc5xxx_fec.c            |  2 +-
 drivers/net/mvgbe.c                  | 41 +++++++++++++++++++-----------------
 drivers/net/mvneta.c                 |  2 +-
 drivers/net/natsemi.c                |  3 ++-
 drivers/net/ne2000_base.c            |  2 +-
 drivers/net/ns8382x.c                |  6 ++++--
 drivers/net/pch_gbe.c                |  2 +-
 drivers/net/pcnet.c                  |  2 +-
 drivers/net/rtl8139.c                |  4 ++--
 drivers/net/rtl8169.c                |  2 +-
 drivers/net/sh_eth.c                 |  2 +-
 drivers/net/smc91111.c               | 18 ++++++++--------
 drivers/net/smc911x.c                |  4 ++--
 drivers/net/sunxi_emac.c             |  4 ++--
 drivers/net/tsec.c                   |  7 +++---
 drivers/net/tsi108_eth.c             |  8 +++----
 drivers/net/uli526x.c                |  5 +++--
 drivers/net/xilinx_axi_emac.c        |  2 +-
 drivers/net/xilinx_emaclite.c        |  2 +-
 drivers/net/xilinx_ll_temac_fifo.c   |  4 ++--
 drivers/net/xilinx_ll_temac_sdma.c   |  4 ++--
 drivers/net/zynq_gem.c               |  2 +-
 drivers/qe/uec.c                     |  2 +-
 drivers/usb/eth/asix.c               |  3 ++-
 drivers/usb/eth/asix88179.c          |  2 +-
 drivers/usb/eth/mcs7830.c            |  2 +-
 drivers/usb/eth/smsc95xx.c           |  3 ++-
 drivers/usb/gadget/ether.c           |  5 +++--
 include/net.h                        |  7 ------
 net/net.c                            | 11 ----------
 post/cpu/mpc8xx/ether.c              |  6 +++---
 71 files changed, 219 insertions(+), 205 deletions(-)

diff --git a/arch/mips/mach-au1x00/au1x00_eth.c b/arch/mips/mach-au1x00/au1x00_eth.c
index a47f088..d6ebe07 100644
--- a/arch/mips/mach-au1x00/au1x00_eth.c
+++ b/arch/mips/mach-au1x00/au1x00_eth.c
@@ -187,13 +187,14 @@ static int au1x00_recv(struct eth_device* dev){
 
 		if(status&RX_ERROR){
 			printf("Rx error 0x%x\n", status);
-		}
-		else{
+		} else {
 			/* Pass the packet up to the protocol layers. */
-			NetReceive(NetRxPackets[next_rx], length - 4);
+			net_process_received_packet(net_rx_packets[next_rx],
+						    length - 4);
 		}
 
-		fifo_rx[next_rx].addr = (virt_to_phys(NetRxPackets[next_rx]))|RX_DMA_ENABLE;
+		fifo_rx[next_rx].addr =
+			(virt_to_phys(net_rx_packets[next_rx])) | RX_DMA_ENABLE;
 
 		next_rx++;
 		if(next_rx>=NO_OF_FIFOS){
@@ -234,7 +235,8 @@ static int au1x00_init(struct eth_device* dev, bd_t * bd){
 	for(i=0;i<NO_OF_FIFOS;i++){
 		fifo_tx[i].len = 0;
 		fifo_tx[i].addr = virt_to_phys(&txbuf[0]);
-		fifo_rx[i].addr = (virt_to_phys(NetRxPackets[i]))|RX_DMA_ENABLE;
+		fifo_rx[i].addr = (virt_to_phys(net_rx_packets[i])) |
+			RX_DMA_ENABLE;
 	}
 
 	/* Put mac addr in little endian */
diff --git a/arch/powerpc/cpu/mpc8260/ether_fcc.c b/arch/powerpc/cpu/mpc8260/ether_fcc.c
index 50d1654..30ea3de 100644
--- a/arch/powerpc/cpu/mpc8260/ether_fcc.c
+++ b/arch/powerpc/cpu/mpc8260/ether_fcc.c
@@ -183,7 +183,7 @@ static int fec_recv(struct eth_device* dev)
 	}
 	else {
 	    /* Pass the packet up to the protocol layers. */
-	    NetReceive(NetRxPackets[rxIdx], length - 4);
+	    net_process_received_packet(net_rx_packets[rxIdx], length - 4);
 	}
 
 
@@ -243,7 +243,7 @@ static int fec_init(struct eth_device* dev, bd_t *bis)
     {
       rtx.rxbd[i].cbd_sc = BD_ENET_RX_EMPTY;
       rtx.rxbd[i].cbd_datlen = 0;
-      rtx.rxbd[i].cbd_bufaddr = (uint)NetRxPackets[i];
+      rtx.rxbd[i].cbd_bufaddr = (uint)net_rx_packets[i];
     }
     rtx.rxbd[PKTBUFSRX - 1].cbd_sc |= BD_ENET_RX_WRAP;
 
diff --git a/arch/powerpc/cpu/mpc8260/ether_scc.c b/arch/powerpc/cpu/mpc8260/ether_scc.c
index c988def..5ba8bed 100644
--- a/arch/powerpc/cpu/mpc8260/ether_scc.c
+++ b/arch/powerpc/cpu/mpc8260/ether_scc.c
@@ -146,7 +146,7 @@ static int sec_rx(struct eth_device *dev)
 	else
 	{
 	    /* Pass the packet up to the protocol layers. */
-	    NetReceive(NetRxPackets[rxIdx], length - 4);
+	    net_process_received_packet(net_rx_packets[rxIdx], length - 4);
 	}
 
 
@@ -263,7 +263,7 @@ static int sec_init(struct eth_device *dev, bd_t *bis)
     {
 	rtx->rxbd[i].cbd_sc = BD_ENET_RX_EMPTY;
 	rtx->rxbd[i].cbd_datlen = 0;                  /* Reset */
-	rtx->rxbd[i].cbd_bufaddr = (uint)NetRxPackets[i];
+	rtx->rxbd[i].cbd_bufaddr = (uint)net_rx_packets[i];
     }
 
     rtx->rxbd[PKTBUFSRX - 1].cbd_sc |= BD_ENET_RX_WRAP;
diff --git a/arch/powerpc/cpu/mpc85xx/ether_fcc.c b/arch/powerpc/cpu/mpc85xx/ether_fcc.c
index 58d4bfb..14358ae 100644
--- a/arch/powerpc/cpu/mpc85xx/ether_fcc.c
+++ b/arch/powerpc/cpu/mpc85xx/ether_fcc.c
@@ -186,7 +186,7 @@ static int fec_recv(struct eth_device* dev)
 	}
 	else {
 	    /* Pass the packet up to the protocol layers. */
-	    NetReceive(NetRxPackets[rxIdx], length - 4);
+	    net_process_received_packet(net_rx_packets[rxIdx], length - 4);
 	}
 
 
@@ -263,7 +263,7 @@ static int fec_init(struct eth_device* dev, bd_t *bis)
     {
       rtx.rxbd[i].cbd_sc = BD_ENET_RX_EMPTY;
       rtx.rxbd[i].cbd_datlen = 0;
-      rtx.rxbd[i].cbd_bufaddr = (uint)NetRxPackets[i];
+      rtx.rxbd[i].cbd_bufaddr = (uint)net_rx_packets[i];
     }
     rtx.rxbd[PKTBUFSRX - 1].cbd_sc |= BD_ENET_RX_WRAP;
 
diff --git a/arch/powerpc/cpu/mpc8xx/fec.c b/arch/powerpc/cpu/mpc8xx/fec.c
index 454e77a..2e19603 100644
--- a/arch/powerpc/cpu/mpc8xx/fec.c
+++ b/arch/powerpc/cpu/mpc8xx/fec.c
@@ -247,7 +247,7 @@ static int fec_recv (struct eth_device *dev)
 				rtx->rxbd[rxIdx].cbd_sc);
 #endif
 		} else {
-			uchar *rx = NetRxPackets[rxIdx];
+			uchar *rx = net_rx_packets[rxIdx];
 
 			length -= 4;
 
@@ -261,7 +261,7 @@ static int fec_recv (struct eth_device *dev)
 			 * Pass the packet up to the protocol layers.
 			 */
 			if (rx != NULL)
-				NetReceive (rx, length);
+				net_process_received_packet(rx, length);
 		}
 
 		/* Give the buffer back to the FEC. */
@@ -576,7 +576,7 @@ static int fec_init (struct eth_device *dev, bd_t * bd)
 	for (i = 0; i < PKTBUFSRX; i++) {
 		rtx->rxbd[i].cbd_sc = BD_ENET_RX_EMPTY;
 		rtx->rxbd[i].cbd_datlen = 0;	/* Reset */
-		rtx->rxbd[i].cbd_bufaddr = (uint) NetRxPackets[i];
+		rtx->rxbd[i].cbd_bufaddr = (uint) net_rx_packets[i];
 	}
 	rtx->rxbd[PKTBUFSRX - 1].cbd_sc |= BD_ENET_RX_WRAP;
 
diff --git a/arch/powerpc/cpu/mpc8xx/scc.c b/arch/powerpc/cpu/mpc8xx/scc.c
index 66e4014..5498440 100644
--- a/arch/powerpc/cpu/mpc8xx/scc.c
+++ b/arch/powerpc/cpu/mpc8xx/scc.c
@@ -159,7 +159,8 @@ static int scc_recv (struct eth_device *dev)
 #endif
 		} else {
 			/* Pass the packet up to the protocol layers. */
-			NetReceive (NetRxPackets[rxIdx], length - 4);
+			net_process_received_packet(net_rx_packets[rxIdx],
+						    length - 4);
 		}
 
 
@@ -280,7 +281,7 @@ static int scc_init (struct eth_device *dev, bd_t * bis)
 	for (i = 0; i < PKTBUFSRX; i++) {
 		rtx->rxbd[i].cbd_sc = BD_ENET_RX_EMPTY;
 		rtx->rxbd[i].cbd_datlen = 0;	/* Reset */
-		rtx->rxbd[i].cbd_bufaddr = (uint) NetRxPackets[i];
+		rtx->rxbd[i].cbd_bufaddr = (uint) net_rx_packets[i];
 	}
 
 	rtx->rxbd[PKTBUFSRX - 1].cbd_sc |= BD_ENET_RX_WRAP;
diff --git a/doc/README.drivers.eth b/doc/README.drivers.eth
index 8b4d352..1a9a23b 100644
--- a/doc/README.drivers.eth
+++ b/doc/README.drivers.eth
@@ -141,11 +141,11 @@ function can be called multiple times in a row.
 
 The recv function should process packets as long as the hardware has them
 readily available before returning.  i.e. you should drain the hardware fifo.
-For each packet you receive, you should call the NetReceive() function on it
+For each packet you receive, you should call the net_process_received_packet() function on it
 along with the packet length.  The common code sets up packet buffers for you
-already in the .bss (NetRxPackets), so there should be no need to allocate your
-own.  This doesn't mean you must use the NetRxPackets array however; you're
-free to call the NetReceive() function with any buffer you wish.  So the pseudo
+already in the .bss (net_rx_packets), so there should be no need to allocate your
+own.  This doesn't mean you must use the net_rx_packets array however; you're
+free to call the net_process_received_packet() function with any buffer you wish.  So the pseudo
 code here would look something like:
 int ape_recv(struct eth_device *dev)
 {
@@ -153,9 +153,9 @@ int ape_recv(struct eth_device *dev)
 	...
 	while (packets_are_available()) {
 		...
-		length = ape_get_packet(&NetRxPackets[i]);
+		length = ape_get_packet(&net_rx_packets[i]);
 		...
-		NetReceive(&NetRxPackets[i], length);
+		net_process_received_packet(&net_rx_packets[i], length);
 		...
 		if (++i >= PKTBUFSRX)
 			i = 0;
diff --git a/drivers/net/4xx_enet.c b/drivers/net/4xx_enet.c
index 878f1b2..3c30f42 100644
--- a/drivers/net/4xx_enet.c
+++ b/drivers/net/4xx_enet.c
@@ -1350,7 +1350,7 @@ get_speed:
 	for (i = 0; i < NUM_RX_BUFF; i++) {
 		hw_p->rx[i].ctrl = 0;
 		hw_p->rx[i].data_len = 0;
-		hw_p->rx[i].data_ptr = (char *)NetRxPackets[i];
+		hw_p->rx[i].data_ptr = (char *)net_rx_packets[i];
 		if ((NUM_RX_BUFF - 1) == i)
 			hw_p->rx[i].ctrl |= MAL_RX_CTRL_WRAP;
 		hw_p->rx[i].ctrl |= MAL_RX_CTRL_EMPTY | MAL_RX_CTRL_INTR;
@@ -1858,13 +1858,17 @@ static int ppc_4xx_eth_rx (struct eth_device *dev)
 
 		length = hw_p->rx[user_index].data_len & 0x0fff;
 
-		/* Pass the packet up to the protocol layers. */
-		/*	 NetReceive(NetRxPackets[rxIdx], length - 4); */
-		/*	 NetReceive(NetRxPackets[i], length); */
+		/*
+		 * Pass the packet up to the protocol layers.
+		 * net_process_received_packet(net_rx_packets[rxIdx],
+		 *			       length - 4);
+		 * net_process_received_packet(net_rx_packets[i], length);
+		 */
 		invalidate_dcache_range((u32)hw_p->rx[user_index].data_ptr,
 					(u32)hw_p->rx[user_index].data_ptr +
 					length - 4);
-		NetReceive (NetRxPackets[user_index], length - 4);
+		net_process_received_packet(net_rx_packets[user_index],
+					    length - 4);
 		/* Free Recv Buffer */
 		hw_p->rx[user_index].ctrl |= MAL_RX_CTRL_EMPTY;
 		/* Free rx buffer descriptor queue */
diff --git a/drivers/net/altera_tse.c b/drivers/net/altera_tse.c
index de517f8..c4fd6ec 100644
--- a/drivers/net/altera_tse.c
+++ b/drivers/net/altera_tse.c
@@ -303,16 +303,17 @@ static int tse_eth_rx(struct eth_device *dev)
 	    ALT_SGDMA_DESCRIPTOR_STATUS_TERMINATED_BY_EOP_MSK) {
 		debug("got packet\n");
 		packet_length = rx_desc->actual_bytes_transferred;
-		NetReceive(NetRxPackets[0], packet_length);
+		net_process_received_packet(net_rx_packets[0], packet_length);
 
 		/* start descriptor again */
-		flush_dcache_range((unsigned long)(NetRxPackets[0]),
-			(unsigned long)(NetRxPackets[0]) + PKTSIZE_ALIGN);
+		flush_dcache_range((unsigned long)(net_rx_packets[0]),
+				   (unsigned long)(net_rx_packets[0] +
+						   PKTSIZE_ALIGN));
 		alt_sgdma_construct_descriptor_burst(
 			(volatile struct alt_sgdma_descriptor *)&rx_desc[0],
 			(volatile struct alt_sgdma_descriptor *)&rx_desc[1],
 			(unsigned int)0x0,	/* read addr */
-			(unsigned int *)NetRxPackets[0],
+			(unsigned int *)net_rx_packets[0],
 			0x0,	/* length or EOP */
 			0x0,	/* gen eop */
 			0x0,	/* read fixed */
@@ -835,13 +836,13 @@ static int tse_eth_init(struct eth_device *dev, bd_t * bd)
 		0x0	/* channel */
 		);
 	debug("Configuring rx desc\n");
-	flush_dcache_range((unsigned long)(NetRxPackets[0]),
-			(unsigned long)(NetRxPackets[0]) + PKTSIZE_ALIGN);
+	flush_dcache_range((unsigned long)(net_rx_packets[0]),
+			   (unsigned long)(net_rx_packets[0]) + PKTSIZE_ALIGN);
 	alt_sgdma_construct_descriptor_burst(
 		(volatile struct alt_sgdma_descriptor *)&rx_desc[0],
 		(volatile struct alt_sgdma_descriptor *)&rx_desc[1],
 		(unsigned int)0x0,	/* read addr */
-		(unsigned int *)NetRxPackets[0],
+		(unsigned int *)net_rx_packets[0],
 		0x0,	/* length or EOP */
 		0x0,	/* gen eop */
 		0x0,	/* read fixed */
diff --git a/drivers/net/armada100_fec.c b/drivers/net/armada100_fec.c
index a8da6b1..e6a6252 100644
--- a/drivers/net/armada100_fec.c
+++ b/drivers/net/armada100_fec.c
@@ -639,15 +639,16 @@ static int armdfec_recv(struct eth_device *dev)
 	} else {
 		/* !!! call higher layer processing */
 		debug("ARMD100 FEC: (%s) Sending Received packet to"
-			" upper layer (NetReceive)\n", __func__);
+		      " upper layer (net_process_received_packet)\n", __func__);
 
 		/*
 		 * let the upper layer handle the packet, subtract offset
 		 * as two dummy bytes are added in received buffer see
 		 * PORT_CONFIG_EXT register bit TWO_Byte_Stuff_Mode bit.
 		 */
-		NetReceive((p_rxdesc_curr->buf_ptr + RX_BUF_OFFSET),
-			   (int)(p_rxdesc_curr->byte_cnt - RX_BUF_OFFSET));
+		net_process_received_packet(
+			p_rxdesc_curr->buf_ptr + RX_BUF_OFFSET,
+			(int)(p_rxdesc_curr->byte_cnt - RX_BUF_OFFSET));
 	}
 	/*
 	 * free these descriptors and point next in the ring
diff --git a/drivers/net/at91_emac.c b/drivers/net/at91_emac.c
index 64d4c56..d51e098 100644
--- a/drivers/net/at91_emac.c
+++ b/drivers/net/at91_emac.c
@@ -352,7 +352,7 @@ static int at91emac_init(struct eth_device *netdev, bd_t *bd)
 
 	/* Init Ethernet buffers */
 	for (i = 0; i < RBF_FRAMEMAX; i++) {
-		dev->rbfdt[i].addr = (unsigned long) NetRxPackets[i];
+		dev->rbfdt[i].addr = (unsigned long) net_rx_packets[i];
 		dev->rbfdt[i].size = 0;
 	}
 	dev->rbfdt[RBF_FRAMEMAX - 1].addr |= RBF_WRAP;
@@ -420,7 +420,7 @@ static int at91emac_recv(struct eth_device *netdev)
 	rbfp = &dev->rbfdt[dev->rbindex];
 	while (rbfp->addr & RBF_OWNER)	{
 		size = rbfp->size & RBF_SIZE;
-		NetReceive(NetRxPackets[dev->rbindex], size);
+		net_process_received_packet(net_rx_packets[dev->rbindex], size);
 
 		debug_cond(DEBUG_AT91EMAC, "Recv[%ld]: %d bytes @ %lx\n",
 			dev->rbindex, size, rbfp->addr);
diff --git a/drivers/net/ax88180.c b/drivers/net/ax88180.c
index 7f0cfe5..ded9e06 100644
--- a/drivers/net/ax88180.c
+++ b/drivers/net/ax88180.c
@@ -192,9 +192,9 @@ static void ax88180_rx_handler (struct eth_device *dev)
 	unsigned short rxcurt_ptr, rxbound_ptr, next_ptr;
 	int i;
 #if defined (CONFIG_DRIVER_AX88180_16BIT)
-	unsigned short *rxdata = (unsigned short *)NetRxPackets[0];
+	unsigned short *rxdata = (unsigned short *)net_rx_packets[0];
 #else
-	unsigned long *rxdata = (unsigned long *)NetRxPackets[0];
+	unsigned long *rxdata = (unsigned long *)net_rx_packets[0];
 #endif
 	unsigned short count;
 
@@ -237,7 +237,7 @@ static void ax88180_rx_handler (struct eth_device *dev)
 		OUTW (dev, RX_STOP_READ, RXINDICATOR);
 
 		/* Pass the packet up to the protocol layers. */
-		NetReceive (NetRxPackets[0], data_size);
+		net_process_received_packet(net_rx_packets[0], data_size);
 
 		OUTW (dev, rxbound_ptr, RXBOUND);
 
diff --git a/drivers/net/bcm-sf2-eth.c b/drivers/net/bcm-sf2-eth.c
index 5252d49..51d5146 100644
--- a/drivers/net/bcm-sf2-eth.c
+++ b/drivers/net/bcm-sf2-eth.c
@@ -103,7 +103,7 @@ static int bcm_sf2_eth_send(struct eth_device *dev, void *packet, int length)
 static int bcm_sf2_eth_receive(struct eth_device *dev)
 {
 	struct eth_dma *dma = &(((struct eth_info *)(dev->priv))->dma);
-	uint8_t *buf = (uint8_t *)NetRxPackets[0];
+	uint8_t *buf = (uint8_t *)net_rx_packets[0];
 	int rcvlen;
 	int rc = 0;
 	int i = 0;
@@ -124,11 +124,11 @@ static int bcm_sf2_eth_receive(struct eth_device *dev)
 			debug("recieved\n");
 
 			/* Forward received packet to uboot network handler */
-			NetReceive(buf, rcvlen);
+			net_process_received_packet(buf, rcvlen);
 
 			if (++i >= PKTBUFSRX)
 				i = 0;
-			buf = NetRxPackets[i];
+			buf = net_rx_packets[i];
 		}
 	}
 
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index 0c2d2ef..61cb1b0 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -189,8 +189,8 @@ static int bfin_EMAC_recv(struct eth_device *dev)
 
 		debug("%s: len = %d\n", __func__, length - 4);
 
-		NetRxPackets[rxIdx] = rxbuf[rxIdx]->FrmData->Dest;
-		NetReceive(NetRxPackets[rxIdx], length - 4);
+		net_rx_packets[rxIdx] = rxbuf[rxIdx]->FrmData->Dest;
+		net_process_received_packet(net_rx_packets[rxIdx], length - 4);
 		bfin_write_DMA1_IRQ_STATUS(DMA_DONE | DMA_ERR);
 		rxbuf[rxIdx]->StatusWord = 0x00000000;
 		if ((rxIdx + 1) >= PKTBUFSRX)
diff --git a/drivers/net/calxedaxgmac.c b/drivers/net/calxedaxgmac.c
index ff94865..c02b397 100644
--- a/drivers/net/calxedaxgmac.c
+++ b/drivers/net/calxedaxgmac.c
@@ -466,7 +466,7 @@ static int xgmac_rx(struct eth_device *dev)
 
 	length = desc_get_rx_frame_len(rxdesc);
 
-	NetReceive(desc_get_buf_addr(rxdesc), length);
+	net_process_received_packet(desc_get_buf_addr(rxdesc), length);
 
 	/* set descriptor back to owned by XGMAC */
 	desc_set_rx_owner(rxdesc);
diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c
index d4b0cb9..fb4d621 100644
--- a/drivers/net/cpsw.c
+++ b/drivers/net/cpsw.c
@@ -846,7 +846,7 @@ static int cpsw_init(struct eth_device *dev, bd_t *bis)
 
 	/* submit rx descs */
 	for (i = 0; i < PKTBUFSRX; i++) {
-		ret = cpdma_submit(priv, &priv->rx_chan, NetRxPackets[i],
+		ret = cpdma_submit(priv, &priv->rx_chan, net_rx_packets[i],
 				   PKTSIZE);
 		if (ret < 0) {
 			printf("error %d submitting rx desc\n", ret);
@@ -905,7 +905,7 @@ static int cpsw_recv(struct eth_device *dev)
 	while (cpdma_process(priv, &priv->rx_chan, &buffer, &len) >= 0) {
 		invalidate_dcache_range((unsigned long)buffer,
 					(unsigned long)buffer + PKTSIZE_ALIGN);
-		NetReceive(buffer, len);
+		net_process_received_packet(buffer, len);
 		cpdma_submit(priv, &priv->rx_chan, buffer, PKTSIZE);
 	}
 
diff --git a/drivers/net/cs8900.c b/drivers/net/cs8900.c
index 84963c1..0713464 100644
--- a/drivers/net/cs8900.c
+++ b/drivers/net/cs8900.c
@@ -188,14 +188,13 @@ static int cs8900_recv(struct eth_device *dev)
 
 	if (rxlen > PKTSIZE_ALIGN + PKTALIGN)
 		debug("packet too big!\n");
-	for (addr = (u16 *) NetRxPackets[0], i = rxlen >> 1; i > 0;
-		 i--)
+	for (addr = (u16 *)net_rx_packets[0], i = rxlen >> 1; i > 0; i--)
 		*addr++ = REG_READ(&priv->regs->rtdata);
 	if (rxlen & 1)
 		*addr++ = REG_READ(&priv->regs->rtdata);
 
 	/* Pass the packet up to the protocol layers. */
-	NetReceive (NetRxPackets[0], rxlen);
+	net_process_received_packet(net_rx_packets[0], rxlen);
 	return rxlen;
 }
 
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index 08bc1af..427ad3e 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -700,8 +700,9 @@ static int davinci_eth_rcv_packet (struct eth_device *dev)
 			unsigned long tmp = (unsigned long)rx_curr_desc->buffer;
 
 			invalidate_dcache_range(tmp, tmp + EMAC_RXBUF_SIZE);
-			NetReceive (rx_curr_desc->buffer,
-				    (rx_curr_desc->buff_off_len & 0xffff));
+			net_process_received_packet(
+				rx_curr_desc->buffer,
+				rx_curr_desc->buff_off_len & 0xffff);
 			ret = rx_curr_desc->buff_off_len & 0xffff;
 		}
 
diff --git a/drivers/net/dc2114x.c b/drivers/net/dc2114x.c
index 799839c..8245cf5 100644
--- a/drivers/net/dc2114x.c
+++ b/drivers/net/dc2114x.c
@@ -333,9 +333,11 @@ static int dc21x4x_init(struct eth_device* dev, bd_t* bis)
 	for (i = 0; i < NUM_RX_DESC; i++) {
 		rx_ring[i].status = cpu_to_le32(R_OWN);
 		rx_ring[i].des1 = cpu_to_le32(RX_BUFF_SZ);
-		rx_ring[i].buf = cpu_to_le32(phys_to_bus((u32) NetRxPackets[i]));
+		rx_ring[i].buf = cpu_to_le32(
+			phys_to_bus((u32)net_rx_packets[i]));
 #ifdef CONFIG_TULIP_FIX_DAVICOM
-		rx_ring[i].next = cpu_to_le32(phys_to_bus((u32) &rx_ring[(i+1) % NUM_RX_DESC]));
+		rx_ring[i].next = cpu_to_le32(
+			phys_to_bus((u32)&rx_ring[(i + 1) % NUM_RX_DESC]));
 #else
 		rx_ring[i].next = 0;
 #endif
@@ -448,7 +450,8 @@ static int dc21x4x_recv(struct eth_device* dev)
 				/* Pass the packet up to the protocol
 				 * layers.
 				 */
-				NetReceive(NetRxPackets[rx_new], length - 4);
+				net_process_received_packet(
+					net_rx_packets[rx_new], length - 4);
 			}
 
 			/* Change buffer ownership for this frame, back
diff --git a/drivers/net/designware.c b/drivers/net/designware.c
index cc01604..bbf01f7 100644
--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c
@@ -374,7 +374,7 @@ static int dw_eth_recv(struct eth_device *dev)
 		data_end = data_start + roundup(length, ARCH_DMA_MINALIGN);
 		invalidate_dcache_range(data_start, data_end);
 
-		NetReceive(desc_p->dmamac_addr, length);
+		net_process_received_packet(desc_p->dmamac_addr, length);
 
 		/*
 		 * Make the current descriptor valid again and go to
diff --git a/drivers/net/dm9000x.c b/drivers/net/dm9000x.c
index d1c6f4c..ccd2131 100644
--- a/drivers/net/dm9000x.c
+++ b/drivers/net/dm9000x.c
@@ -464,7 +464,8 @@ static void dm9000_halt(struct eth_device *netdev)
 */
 static int dm9000_rx(struct eth_device *netdev)
 {
-	u8 rxbyte, *rdptr = (u8 *) NetRxPackets[0];
+	u8 rxbyte;
+	u8 *rdptr = (u8 *)net_rx_packets[0];
 	u16 RxStatus, RxLen = 0;
 	struct board_info *db = &dm9000_info;
 
@@ -525,7 +526,7 @@ static int dm9000_rx(struct eth_device *netdev)
 			DM9000_DMP_PACKET(__func__ , rdptr, RxLen);
 
 			DM9000_DBG("passing packet to upper layer\n");
-			NetReceive(NetRxPackets[0], RxLen);
+			net_process_received_packet(net_rx_packets[0], RxLen);
 		}
 	}
 	return 0;
diff --git a/drivers/net/dnet.c b/drivers/net/dnet.c
index 944a0c0..933d1fc 100644
--- a/drivers/net/dnet.c
+++ b/drivers/net/dnet.c
@@ -188,12 +188,13 @@ static int dnet_recv(struct eth_device *netdev)
 	if (cmd_word & 0xDF180000)
 		printf("%s packet receive error %x\n", __func__, cmd_word);
 
-	data_ptr = (unsigned int *) NetRxPackets[0];
+	data_ptr = (unsigned int *)net_rx_packets[0];
 
 	for (i = 0; i < (pkt_len + 3) >> 2; i++)
 		*data_ptr++ = readl(&dnet->regs->RX_DATA_FIFO);
 
-	NetReceive(NetRxPackets[0], pkt_len + 5); /* ok + 5 ?? */
+	/* ok + 5 ?? */
+	net_process_received_packet(net_rx_packets[0], pkt_len + 5);
 
 	return 0;
 }
diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c
index 6a2e0d2..2d66690 100644
--- a/drivers/net/e1000.c
+++ b/drivers/net/e1000.c
@@ -5158,7 +5158,7 @@ e1000_poll(struct eth_device *nic)
 	invalidate_dcache_range((unsigned long)packet,
 				(unsigned long)packet +
 				roundup(len, ARCH_DMA_MINALIGN));
-	NetReceive((uchar *)packet, len);
+	net_process_received_packet((uchar *)packet, len);
 	fill_rx(hw);
 	return 1;
 }
diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c
index a23a585..f2cd32c 100644
--- a/drivers/net/eepro100.c
+++ b/drivers/net/eepro100.c
@@ -674,7 +674,8 @@ static int eepro100_recv (struct eth_device *dev)
 			/* Pass the packet up to the protocol
 			 * layers.
 			 */
-			NetReceive((u8 *)rx_ring[rx_next].data, length);
+			net_process_received_packet((u8 *)rx_ring[rx_next].data,
+						    length);
 		} else {
 			/* There was an error.
 			 */
diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c
index ec33764..59ea11c 100644
--- a/drivers/net/enc28j60.c
+++ b/drivers/net/enc28j60.c
@@ -21,8 +21,8 @@
  * enc_miiphy_read(), enc_miiphy_write(), enc_write_hwaddr(),
  * enc_init(), enc_recv(), enc_send(), enc_halt()
  * ALL other functions assume that the bus has already been claimed!
- * Since NetReceive() might call enc_send() in return, the bus must be
- * released, NetReceive() called and claimed again.
+ * Since net_process_received_packet() might call enc_send() in return, the bus
+ * must be released, net_process_received_packet() called and claimed again.
  */
 
 /*
@@ -415,7 +415,7 @@ static void enc_reset_rx_call(enc_dev_t *enc)
  */
 static void enc_receive(enc_dev_t *enc)
 {
-	u8 *packet = (u8 *)NetRxPackets[0];
+	u8 *packet = (u8 *)net_rx_packets[0];
 	u16 pkt_len;
 	u16 copy_len;
 	u16 status;
@@ -468,11 +468,12 @@ static void enc_receive(enc_dev_t *enc)
 			continue;
 		}
 		/*
-		 * Because NetReceive() might call enc_send(), we need to
-		 * release the SPI bus, call NetReceive(), reclaim the bus
+		 * Because net_process_received_packet() might call enc_send(),
+		 * we need to release the SPI bus, call
+		 * net_process_received_packet(), reclaim the bus.
 		 */
 		enc_release_bus(enc);
-		NetReceive(packet, pkt_len);
+		net_process_received_packet(packet, pkt_len);
 		if (enc_claim_bus(enc))
 			return;
 		(void)enc_r8(enc, CTL_REG_EIR);
diff --git a/drivers/net/ep93xx_eth.c b/drivers/net/ep93xx_eth.c
index 1c09f10..a3721c5 100644
--- a/drivers/net/ep93xx_eth.c
+++ b/drivers/net/ep93xx_eth.c
@@ -53,7 +53,7 @@ static void dump_dev(struct eth_device *dev)
 	printf("  rx_sq.end	     %p\n", priv->rx_sq.end);
 
 	for (i = 0; i < NUMRXDESC; i++)
-		printf("  rx_buffer[%2.d]      %p\n", i, NetRxPackets[i]);
+		printf("  rx_buffer[%2.d]      %p\n", i, net_rx_packets[i]);
 
 	printf("  tx_dq.base	     %p\n", priv->tx_dq.base);
 	printf("  tx_dq.current	     %p\n", priv->tx_dq.current);
@@ -237,7 +237,7 @@ static int ep93xx_eth_open(struct eth_device *dev, bd_t *bd)
 	 */
 	for (i = 0; i < NUMRXDESC; i++) {
 		/* set buffer address */
-		(priv->rx_dq.base + i)->word1 = (uint32_t)NetRxPackets[i];
+		(priv->rx_dq.base + i)->word1 = (uint32_t)net_rx_packets[i];
 
 		/* set buffer length, clear buffer index and NSOF */
 		(priv->rx_dq.base + i)->word2 = PKTSIZE_ALIGN;
@@ -310,15 +310,16 @@ static int ep93xx_eth_rcv_packet(struct eth_device *dev)
 			/*
 			 * We have a good frame. Extract the frame's length
 			 * from the current rx_status_queue entry, and copy
-			 * the frame's data into NetRxPackets[] of the
+			 * the frame's data into net_rx_packets[] of the
 			 * protocol stack. We track the total number of
 			 * bytes in the frame (nbytes_frame) which will be
 			 * used when we pass the data off to the protocol
-			 * layer via NetReceive().
+			 * layer via net_process_received_packet().
 			 */
 			len = RX_STATUS_FRAME_LEN(priv->rx_sq.current);
 
-			NetReceive((uchar *)priv->rx_dq.current->word1,	len);
+			net_process_received_packet(
+				(uchar *)priv->rx_dq.current->word1, len);
 
 			debug("reporting %d bytes...\n", len);
 		} else {
diff --git a/drivers/net/ethoc.c b/drivers/net/ethoc.c
index 46c82bb..edb3c80 100644
--- a/drivers/net/ethoc.c
+++ b/drivers/net/ethoc.c
@@ -267,7 +267,7 @@ static int ethoc_init_ring(struct eth_device *dev)
 	bd.stat = RX_BD_EMPTY | RX_BD_IRQ;
 
 	for (i = 0; i < priv->num_rx; i++) {
-		bd.addr = (u32)NetRxPackets[i];
+		bd.addr = (u32)net_rx_packets[i];
 		if (i == priv->num_rx - 1)
 			bd.stat |= RX_BD_WRAP;
 
@@ -372,7 +372,7 @@ static int ethoc_rx(struct eth_device *dev, int limit)
 		if (ethoc_update_rx_stats(&bd) == 0) {
 			int size = bd.stat >> 16;
 			size -= 4;	/* strip the CRC */
-			NetReceive((void *)bd.addr, size);
+			net_process_received_packet((void *)bd.addr, size);
 		}
 
 		/* clear the buffer descriptor so it can be reused */
diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 1146d3b..9225d37 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -852,7 +852,7 @@ static int fec_recv(struct eth_device *dev)
 			swap_packet((uint32_t *)frame->data, frame_length);
 #endif
 			memcpy(buff, frame->data, frame_length);
-			NetReceive(buff, frame_length);
+			net_process_received_packet(buff, frame_length);
 			len = frame_length;
 		} else {
 			if (bd_status & FEC_RBD_ERR)
diff --git a/drivers/net/fm/eth.c b/drivers/net/fm/eth.c
index 1d1089d..55e76a7 100644
--- a/drivers/net/fm/eth.c
+++ b/drivers/net/fm/eth.c
@@ -530,7 +530,7 @@ static int fm_eth_recv(struct eth_device *dev)
 		if (!(status & RxBD_ERROR)) {
 			data = (u8 *)rxbd->buf_ptr_lo;
 			len = rxbd->len;
-			NetReceive(data, len);
+			net_process_received_packet(data, len);
 		} else {
 			printf("%s: Rx error\n", dev->name);
 			return 0;
diff --git a/drivers/net/fsl_mcdmafec.c b/drivers/net/fsl_mcdmafec.c
index 6391f9b..792534b 100644
--- a/drivers/net/fsl_mcdmafec.c
+++ b/drivers/net/fsl_mcdmafec.c
@@ -244,7 +244,7 @@ static int fec_recv(struct eth_device *dev)
 	struct fec_info_dma *info = dev->priv;
 	volatile fecdma_t *fecp = (fecdma_t *) (info->iobase);
 
-	cbd_t *pRbd = &info->rxbd[info->rxIdx];
+	cbd_t *prbd = &info->rxbd[info->rxIdx];
 	u32 ievent;
 	int frame_length, len = 0;
 
@@ -276,26 +276,27 @@ static int fec_recv(struct eth_device *dev)
 		}
 	}
 
-	if (!(pRbd->cbd_sc & BD_ENET_RX_EMPTY)) {
-		if ((pRbd->cbd_sc & BD_ENET_RX_LAST)
-		    && !(pRbd->cbd_sc & BD_ENET_RX_ERR)
-		    && ((pRbd->cbd_datlen - 4) > 14)) {
+	if (!(prbd->cbd_sc & BD_ENET_RX_EMPTY)) {
+		if ((prbd->cbd_sc & BD_ENET_RX_LAST) &&
+		    !(prbd->cbd_sc & BD_ENET_RX_ERR) &&
+		    ((prbd->cbd_datlen - 4) > 14)) {
 
 			/* Get buffer address and size */
-			frame_length = pRbd->cbd_datlen - 4;
+			frame_length = prbd->cbd_datlen - 4;
 
 			/* Fill the buffer and pass it to upper layers */
-			NetReceive((uchar *)pRbd->cbd_bufaddr, frame_length);
+			net_process_received_packet((uchar *)prbd->cbd_bufaddr,
+						    frame_length);
 			len = frame_length;
 		}
 
 		/* Reset buffer descriptor as empty */
 		if ((info->rxIdx) == (PKTBUFSRX - 1))
-			pRbd->cbd_sc = (BD_ENET_RX_WRAP | BD_ENET_RX_EMPTY);
+			prbd->cbd_sc = (BD_ENET_RX_WRAP | BD_ENET_RX_EMPTY);
 		else
-			pRbd->cbd_sc = BD_ENET_RX_EMPTY;
+			prbd->cbd_sc = BD_ENET_RX_EMPTY;
 
-		pRbd->cbd_datlen = PKTSIZE_ALIGN;
+		prbd->cbd_datlen = PKTSIZE_ALIGN;
 
 		/* Now, we have an empty RxBD, restart the DMA receive task */
 		MCD_continDma(info->rxTask);
@@ -399,7 +400,7 @@ static int fec_init(struct eth_device *dev, bd_t * bd)
 	for (i = 0; i < PKTBUFSRX; i++) {
 		info->rxbd[i].cbd_sc = BD_ENET_RX_EMPTY;
 		info->rxbd[i].cbd_datlen = PKTSIZE_ALIGN;
-		info->rxbd[i].cbd_bufaddr = (uint) NetRxPackets[i];
+		info->rxbd[i].cbd_bufaddr = (uint) net_rx_packets[i];
 	}
 	info->rxbd[PKTBUFSRX - 1].cbd_sc |= BD_ENET_RX_WRAP;
 
diff --git a/drivers/net/ftgmac100.c b/drivers/net/ftgmac100.c
index 8519314..515f0b2 100644
--- a/drivers/net/ftgmac100.c
+++ b/drivers/net/ftgmac100.c
@@ -423,7 +423,7 @@ static int ftgmac100_init(struct eth_device *dev, bd_t *bd)
 	for (i = 0; i < PKTBUFSRX; i++) {
 		/* RXBUF_BADR */
 		if (!rxdes[i].rxdes2) {
-			buf = NetRxPackets[i];
+			buf = net_rx_packets[i];
 			rxdes[i].rxdes3 = virt_to_phys(buf);
 			rxdes[i].rxdes2 = (uint)buf;
 		}
@@ -493,7 +493,7 @@ static int ftgmac100_recv(struct eth_device *dev)
 	dma_map_single((void *)curr_des->rxdes2, rxlen, DMA_FROM_DEVICE);
 
 	/* pass the packet up to the protocol layers. */
-	NetReceive((void *)curr_des->rxdes2, rxlen);
+	net_process_received_packet((void *)curr_des->rxdes2, rxlen);
 
 	/* release buffer to DMA */
 	curr_des->rxdes0 &= ~FTGMAC100_RXDES0_RXPKT_RDY;
diff --git a/drivers/net/ftmac100.c b/drivers/net/ftmac100.c
index 3e148db..bd94f83 100644
--- a/drivers/net/ftmac100.c
+++ b/drivers/net/ftmac100.c
@@ -102,7 +102,7 @@ static int ftmac100_init (struct eth_device *dev, bd_t *bd)
 
 	for (i = 0; i < PKTBUFSRX; i++) {
 		/* RXBUF_BADR */
-		rxdes[i].rxdes2 = (unsigned int)NetRxPackets[i];
+		rxdes[i].rxdes2 = (unsigned int)net_rx_packets[i];
 		rxdes[i].rxdes1 |= FTMAC100_RXDES1_RXBUF_SIZE (PKTSIZE_ALIGN);
 		rxdes[i].rxdes0 = FTMAC100_RXDES0_RXDMA_OWN;
 	}
@@ -164,7 +164,7 @@ static int ftmac100_recv (struct eth_device *dev)
 
 	/* pass the packet up to the protocol layers. */
 
-	NetReceive ((void *)curr_des->rxdes2, rxlen);
+	net_process_received_packet((void *)curr_des->rxdes2, rxlen);
 
 	/* release buffer to DMA */
 
diff --git a/drivers/net/ftmac110.c b/drivers/net/ftmac110.c
index aef89a2..4bae9ad 100644
--- a/drivers/net/ftmac110.c
+++ b/drivers/net/ftmac110.c
@@ -347,7 +347,7 @@ static int ftmac110_recv(struct eth_device *dev)
 			printf("ftmac110: rx error\n");
 		} else {
 			dma_map_single(buf, len, DMA_FROM_DEVICE);
-			NetReceive(buf, len);
+			net_process_received_packet(buf, len);
 			rlen += len;
 		}
 
diff --git a/drivers/net/greth.c b/drivers/net/greth.c
index c817af4..a93b37a 100644
--- a/drivers/net/greth.c
+++ b/drivers/net/greth.c
@@ -533,7 +533,7 @@ int greth_recv(struct eth_device *dev)
 			sparc_dcache_flush_all();
 
 			/* pass packet on to network subsystem */
-			NetReceive((void *)d, len);
+			net_process_received_packet((void *)d, len);
 
 			/* bump stats counters */
 			greth->stats.rx_packets++;
diff --git a/drivers/net/keystone_net.c b/drivers/net/keystone_net.c
index 35f1a57..0c5fdee 100644
--- a/drivers/net/keystone_net.c
+++ b/drivers/net/keystone_net.c
@@ -505,7 +505,7 @@ static int keystone2_eth_rcv_packet(struct eth_device *dev)
 	if (hd == NULL)
 		return 0;
 
-	NetReceive((uchar *)pkt, pkt_size);
+	net_process_received_packet((uchar *)pkt, pkt_size);
 
 	ksnav_release_rxhd(&netcp_pktdma, hd);
 
diff --git a/drivers/net/ks8851_mll.c b/drivers/net/ks8851_mll.c
index 05e5b14..5b4c5b0 100644
--- a/drivers/net/ks8851_mll.c
+++ b/drivers/net/ks8851_mll.c
@@ -321,8 +321,8 @@ static void ks_rcv(struct eth_device *dev, uchar **pv_data)
 			/* read data block including CRC 4 bytes */
 			ks_read_qmu(dev, (u16 *)(*pv_data), frame_hdr->len);
 
-			/* NetRxPackets buffer size is ok (*pv_data pointer) */
-			NetReceive(*pv_data, frame_hdr->len);
+			/* net_rx_packets buffer size is ok (*pv_data) */
+			net_process_received_packet(*pv_data, frame_hdr->len);
 			pv_data++;
 		} else {
 			ks_wrreg16(dev, KS_RXQCR, (ks->rc_rxqcr | RXQCR_RRXEF));
@@ -573,7 +573,7 @@ static int ks8851_mll_recv(struct eth_device *dev)
 	ks_wrreg16(dev, KS_ISR, status);
 
 	if ((status & IRQ_RXI))
-		ks_rcv(dev, (uchar **)NetRxPackets);
+		ks_rcv(dev, (uchar **)net_rx_packets);
 
 	if ((status & IRQ_LDI)) {
 		u16 pmecr = ks_rdreg16(dev, KS_PMECR);
diff --git a/drivers/net/lan91c96.c b/drivers/net/lan91c96.c
index 229658a..495c088 100644
--- a/drivers/net/lan91c96.c
+++ b/drivers/net/lan91c96.c
@@ -568,29 +568,30 @@ static int smc_rcv(struct eth_device *dev)
 		   to send the DWORDs or the bytes first, or some
 		   mixture.  A mixture might improve already slow PIO
 		   performance  */
-		SMC_insl(dev, LAN91C96_DATA_HIGH, NetRxPackets[0],
-				packet_length >> 2);
+		SMC_insl(dev, LAN91C96_DATA_HIGH, net_rx_packets[0],
+			 packet_length >> 2);
 		/* read the left over bytes */
 		if (packet_length & 3) {
 			int i;
 
-			byte *tail = (byte *) (NetRxPackets[0] + (packet_length & ~3));
+			byte *tail = (byte *)(net_rx_packets[0] +
+				(packet_length & ~3));
 			dword leftover = SMC_inl(dev, LAN91C96_DATA_HIGH);
 
 			for (i = 0; i < (packet_length & 3); i++)
 				*tail++ = (byte) (leftover >> (8 * i)) & 0xff;
 		}
 #else
-		PRINTK3 (" Reading %d words and %d byte(s) \n",
-				 (packet_length >> 1), packet_length & 1);
-		SMC_insw(dev, LAN91C96_DATA_HIGH, NetRxPackets[0],
-				packet_length >> 1);
+		PRINTK3(" Reading %d words and %d byte(s)\n",
+			(packet_length >> 1), packet_length & 1);
+		SMC_insw(dev, LAN91C96_DATA_HIGH, net_rx_packets[0],
+			 packet_length >> 1);
 
 #endif /* USE_32_BIT */
 
 #if	SMC_DEBUG > 2
 		printf ("Receiving Packet\n");
-		print_packet((byte *)NetRxPackets[0], packet_length);
+		print_packet((byte *)net_rx_packets[0], packet_length);
 #endif
 	} else {
 		/* error ... */
@@ -609,7 +610,7 @@ static int smc_rcv(struct eth_device *dev)
 
 	if (!is_error) {
 		/* Pass the packet up to the protocol layers. */
-		NetReceive (NetRxPackets[0], packet_length);
+		net_process_received_packet(net_rx_packets[0], packet_length);
 		return packet_length;
 	} else {
 		return 0;
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 1fe408c..4e1a7fe 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -347,14 +347,14 @@ static int macb_recv(struct eth_device *netdev)
 				headlen = 128 * (MACB_RX_RING_SIZE
 						 - macb->rx_tail);
 				taillen = length - headlen;
-				memcpy((void *)NetRxPackets[0],
+				memcpy((void *)net_rx_packets[0],
 				       buffer, headlen);
-				memcpy((void *)NetRxPackets[0] + headlen,
+				memcpy((void *)net_rx_packets[0] + headlen,
 				       macb->rx_buffer, taillen);
-				buffer = (void *)NetRxPackets[0];
+				buffer = (void *)net_rx_packets[0];
 			}
 
-			NetReceive(buffer, length);
+			net_process_received_packet(buffer, length);
 			if (++rx_tail >= MACB_RX_RING_SIZE)
 				rx_tail = 0;
 			reclaim_rx_buffers(macb, rx_tail);
diff --git a/drivers/net/mcffec.c b/drivers/net/mcffec.c
index 7c4b210..fd73099 100644
--- a/drivers/net/mcffec.c
+++ b/drivers/net/mcffec.c
@@ -219,7 +219,8 @@ int fec_recv(struct eth_device *dev)
 
 			length -= 4;
 			/* Pass the packet up to the protocol layers. */
-			NetReceive(NetRxPackets[info->rxIdx], length);
+			net_process_received_packet(net_rx_packets[info->rxIdx],
+						    length);
 
 			fecp->eir |= FEC_EIR_RXF;
 		}
@@ -477,7 +478,7 @@ int fec_init(struct eth_device *dev, bd_t * bd)
 	for (i = 0; i < PKTBUFSRX; i++) {
 		info->rxbd[i].cbd_sc = BD_ENET_RX_EMPTY;
 		info->rxbd[i].cbd_datlen = 0;	/* Reset */
-		info->rxbd[i].cbd_bufaddr = (uint) NetRxPackets[i];
+		info->rxbd[i].cbd_bufaddr = (uint) net_rx_packets[i];
 	}
 	info->rxbd[PKTBUFSRX - 1].cbd_sc |= BD_ENET_RX_WRAP;
 
diff --git a/drivers/net/mpc512x_fec.c b/drivers/net/mpc512x_fec.c
index 427e0b8..22ea114 100644
--- a/drivers/net/mpc512x_fec.c
+++ b/drivers/net/mpc512x_fec.c
@@ -591,7 +591,8 @@ static int mpc512x_fec_recv (struct eth_device *dev)
 			rx_buff_idx = frame_length;
 
 			if (pRbd->status & FEC_RBD_LAST) {
-				NetReceive ((uchar*)rx_buff, frame_length);
+				net_process_received_packet((uchar *)rx_buff,
+							    frame_length);
 				rx_buff_idx = 0;
 			}
 		}
diff --git a/drivers/net/mpc5xxx_fec.c b/drivers/net/mpc5xxx_fec.c
index d2a8ae0..2ebd176 100644
--- a/drivers/net/mpc5xxx_fec.c
+++ b/drivers/net/mpc5xxx_fec.c
@@ -859,7 +859,7 @@ static int mpc5xxx_fec_recv(struct eth_device *dev)
 			 */
 			memcpy(buff, frame->head, 14);
 			memcpy(buff + 14, frame->data, frame_length);
-			NetReceive(buff, frame_length);
+			net_process_received_packet(buff, frame_length);
 			len = frame_length;
 		}
 		/*
diff --git a/drivers/net/mvgbe.c b/drivers/net/mvgbe.c
index 6b31a82..ab5aa68 100644
--- a/drivers/net/mvgbe.c
+++ b/drivers/net/mvgbe.c
@@ -66,12 +66,12 @@ static int smi_reg_read(const char *devname, u8 phy_adr, u8 reg_ofs, u16 * data)
 	/* check parameters */
 	if (phy_adr > PHYADR_MASK) {
 		printf("Err..(%s) Invalid PHY address %d\n",
-			__FUNCTION__, phy_adr);
+			__func__, phy_adr);
 		return -EFAULT;
 	}
 	if (reg_ofs > PHYREG_MASK) {
 		printf("Err..(%s) Invalid register offset %d\n",
-			__FUNCTION__, reg_ofs);
+			__func__, reg_ofs);
 		return -EFAULT;
 	}
 
@@ -81,7 +81,7 @@ static int smi_reg_read(const char *devname, u8 phy_adr, u8 reg_ofs, u16 * data)
 		/* read smi register */
 		smi_reg = MVGBE_REG_RD(MVGBE_SMI_REG);
 		if (timeout-- == 0) {
-			printf("Err..(%s) SMI busy timeout\n", __FUNCTION__);
+			printf("Err..(%s) SMI busy timeout\n", __func__);
 			return -EFAULT;
 		}
 	} while (smi_reg & MVGBE_PHY_SMI_BUSY_MASK);
@@ -102,7 +102,7 @@ static int smi_reg_read(const char *devname, u8 phy_adr, u8 reg_ofs, u16 * data)
 		smi_reg = MVGBE_REG_RD(MVGBE_SMI_REG);
 		if (timeout-- == 0) {
 			printf("Err..(%s) SMI read ready timeout\n",
-				__FUNCTION__);
+				__func__);
 			return -EFAULT;
 		}
 	} while (!(smi_reg & MVGBE_PHY_SMI_READ_VALID_MASK));
@@ -113,8 +113,8 @@ static int smi_reg_read(const char *devname, u8 phy_adr, u8 reg_ofs, u16 * data)
 
 	*data = (u16) (MVGBE_REG_RD(MVGBE_SMI_REG) & MVGBE_PHY_SMI_DATA_MASK);
 
-	debug("%s:(adr %d, off %d) value= %04x\n", __FUNCTION__, phy_adr,
-		reg_ofs, *data);
+	debug("%s:(adr %d, off %d) value= %04x\n", __func__, phy_adr, reg_ofs,
+	      *data);
 
 	return 0;
 }
@@ -142,11 +142,11 @@ static int smi_reg_write(const char *devname, u8 phy_adr, u8 reg_ofs, u16 data)
 
 	/* check parameters */
 	if (phy_adr > PHYADR_MASK) {
-		printf("Err..(%s) Invalid phy address\n", __FUNCTION__);
+		printf("Err..(%s) Invalid phy address\n", __func__);
 		return -EINVAL;
 	}
 	if (reg_ofs > PHYREG_MASK) {
-		printf("Err..(%s) Invalid register offset\n", __FUNCTION__);
+		printf("Err..(%s) Invalid register offset\n", __func__);
 		return -EINVAL;
 	}
 
@@ -156,7 +156,7 @@ static int smi_reg_write(const char *devname, u8 phy_adr, u8 reg_ofs, u16 data)
 		/* read smi register */
 		smi_reg = MVGBE_REG_RD(MVGBE_SMI_REG);
 		if (timeout-- == 0) {
-			printf("Err..(%s) SMI busy timeout\n", __FUNCTION__);
+			printf("Err..(%s) SMI busy timeout\n", __func__);
 			return -ETIME;
 		}
 	} while (smi_reg & MVGBE_PHY_SMI_BUSY_MASK);
@@ -583,7 +583,7 @@ static int mvgbe_send(struct eth_device *dev, void *dataptr, int datasize)
 		if ((cmd_sts & (MVGBE_ERROR_SUMMARY | MVGBE_TX_LAST_FRAME)) ==
 				(MVGBE_ERROR_SUMMARY | MVGBE_TX_LAST_FRAME) &&
 				cmd_sts & (MVGBE_UR_ERROR | MVGBE_RL_ERROR)) {
-			printf("Err..(%s) in xmit packet\n", __FUNCTION__);
+			printf("Err..(%s) in xmit packet\n", __func__);
 			return -1;
 		}
 		cmd_sts = readl(&p_txdesc->cmd_sts);
@@ -604,14 +604,14 @@ static int mvgbe_recv(struct eth_device *dev)
 		if (timeout < MVGBE_PHY_SMI_TIMEOUT)
 			timeout++;
 		else {
-			debug("%s time out...\n", __FUNCTION__);
+			debug("%s time out...\n", __func__);
 			return -1;
 		}
 	} while (readl(&p_rxdesc_curr->cmd_sts) & MVGBE_BUFFER_OWNED_BY_DMA);
 
 	if (p_rxdesc_curr->byte_cnt != 0) {
 		debug("%s: Received %d byte Packet @ 0x%x (cmd_sts= %08x)\n",
-			__FUNCTION__, (u32) p_rxdesc_curr->byte_cnt,
+			__func__, (u32) p_rxdesc_curr->byte_cnt,
 			(u32) p_rxdesc_curr->buf_ptr,
 			(u32) p_rxdesc_curr->cmd_sts);
 	}
@@ -628,21 +628,24 @@ static int mvgbe_recv(struct eth_device *dev)
 		!= (MVGBE_RX_FIRST_DESC | MVGBE_RX_LAST_DESC)) {
 
 		printf("Err..(%s) Dropping packet spread on"
-			" multiple descriptors\n", __FUNCTION__);
+			" multiple descriptors\n", __func__);
 
 	} else if (cmd_sts & MVGBE_ERROR_SUMMARY) {
 
 		printf("Err..(%s) Dropping packet with errors\n",
-			__FUNCTION__);
+			__func__);
 
 	} else {
 		/* !!! call higher layer processing */
 		debug("%s: Sending Received packet to"
-			" upper layer (NetReceive)\n", __FUNCTION__);
+		      " upper layer (net_process_received_packet)\n",
+		      __func__);
 
 		/* let the upper layer handle the packet */
-		NetReceive((p_rxdesc_curr->buf_ptr + RX_BUF_OFFSET),
-			(int)(p_rxdesc_curr->byte_cnt - RX_BUF_OFFSET));
+		net_process_received_packet((p_rxdesc_curr->buf_ptr +
+					     RX_BUF_OFFSET),
+					    (int)(p_rxdesc_curr->byte_cnt -
+						  RX_BUF_OFFSET));
 	}
 	/*
 	 * free these descriptors and point next in the ring
@@ -747,7 +750,7 @@ error2:
 			free(dmvgbe);
 error1:
 			printf("Err.. %s Failed to allocate memory\n",
-				__FUNCTION__);
+				__func__);
 			return -1;
 		}
 
@@ -767,7 +770,7 @@ error1:
 #endif
 		default:	/* this should never happen */
 			printf("Err..(%s) Invalid device number %d\n",
-				__FUNCTION__, devnum);
+				__func__, devnum);
 			return -1;
 		}
 
diff --git a/drivers/net/mvneta.c b/drivers/net/mvneta.c
index a2a69b4..efaae16 100644
--- a/drivers/net/mvneta.c
+++ b/drivers/net/mvneta.c
@@ -1572,7 +1572,7 @@ static int mvneta_recv(struct eth_device *dev)
 		 * No cache invalidation needed here, since the rx_buffer's are
 		 * located in a uncached memory region
 		 */
-		NetReceive(data, rx_bytes);
+		net_process_received_packet(data, rx_bytes);
 	}
 
 	/* Update rxq management counters */
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index 04743bd..0ed9bb5 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -841,7 +841,8 @@ natsemi_poll(struct eth_device *dev)
 		     rx_status);
 		retstat = 0;
 	} else {		/* give packet to higher level routine */
-		NetReceive((rxb + cur_rx * RX_BUF_SIZE), length);
+		net_process_received_packet((rxb + cur_rx * RX_BUF_SIZE),
+					    length);
 		retstat = 1;
 	}
 
diff --git a/drivers/net/ne2000_base.c b/drivers/net/ne2000_base.c
index ef35922..07a7cec 100644
--- a/drivers/net/ne2000_base.c
+++ b/drivers/net/ne2000_base.c
@@ -665,7 +665,7 @@ void uboot_push_packet_len(int len) {
 	dp83902a_recv(&pbuf[0], len);
 
 	/*Just pass it to the upper layer*/
-	NetReceive(&pbuf[0], len);
+	net_process_received_packet(&pbuf[0], len);
 }
 
 void uboot_push_tx_done(int key, int val) {
diff --git a/drivers/net/ns8382x.c b/drivers/net/ns8382x.c
index cfe1f34..f941c15 100644
--- a/drivers/net/ns8382x.c
+++ b/drivers/net/ns8382x.c
@@ -809,11 +809,13 @@ ns8382x_poll(struct eth_device *dev)
 
 	if ((rx_status & (DescMore | DescPktOK | DescRxLong)) != DescPktOK) {
 		/* corrupted packet received */
-		printf("ns8382x_poll: Corrupted packet, status:%lx\n", rx_status);
+		printf("ns8382x_poll: Corrupted packet, status:%lx\n",
+		       rx_status);
 		retstat = 0;
 	} else {
 		/* give packet to higher level routine */
-		NetReceive((rxb + cur_rx * RX_BUF_SIZE), length);
+		net_process_received_packet((rxb + cur_rx * RX_BUF_SIZE),
+					    length);
 		retstat = 1;
 	}
 
diff --git a/drivers/net/pch_gbe.c b/drivers/net/pch_gbe.c
index 976848d..15c9cdc 100644
--- a/drivers/net/pch_gbe.c
+++ b/drivers/net/pch_gbe.c
@@ -297,7 +297,7 @@ static int pch_gbe_recv(struct eth_device *dev)
 
 	buffer_addr = pci_mem_to_phys(priv->bdf, rx_desc->buffer_addr);
 	length = rx_desc->rx_words_eob - 3 - ETH_FCS_LEN;
-	NetReceive((uchar *)buffer_addr, length);
+	net_process_received_packet((uchar *)buffer_addr, length);
 
 	/* Test the wrap-around condition */
 	if (++priv->rx_idx >= PCH_GBE_DESC_NUM)
diff --git a/drivers/net/pcnet.c b/drivers/net/pcnet.c
index 237fbba..cfcb1b4 100644
--- a/drivers/net/pcnet.c
+++ b/drivers/net/pcnet.c
@@ -507,7 +507,7 @@ static int pcnet_recv (struct eth_device *dev)
 				buf = (*lp->rx_buf)[lp->cur_rx];
 				invalidate_dcache_range((unsigned long)buf,
 					(unsigned long)buf + pkt_len);
-				NetReceive(buf, pkt_len);
+				net_process_received_packet(buf, pkt_len);
 				PCNET_DEBUG2("Rx%d: %d bytes from 0x%p\n",
 					     lp->cur_rx, pkt_len, buf);
 			}
diff --git a/drivers/net/rtl8139.c b/drivers/net/rtl8139.c
index 208ce5c..ea52343 100644
--- a/drivers/net/rtl8139.c
+++ b/drivers/net/rtl8139.c
@@ -504,11 +504,11 @@ static int rtl_poll(struct eth_device *dev)
 		memcpy(rxdata, rx_ring + ring_offs + 4, semi_count);
 		memcpy(&(rxdata[semi_count]), rx_ring, rx_size-4-semi_count);
 
-		NetReceive(rxdata, length);
+		net_process_received_packet(rxdata, length);
 		debug_cond(DEBUG_RX, "rx packet %d+%d bytes",
 			semi_count, rx_size-4-semi_count);
 	} else {
-		NetReceive(rx_ring + ring_offs + 4, length);
+		net_process_received_packet(rx_ring + ring_offs + 4, length);
 		debug_cond(DEBUG_RX, "rx packet %d bytes", rx_size-4);
 	}
 	flush_cache((unsigned long)rx_ring, RX_BUF_LEN);
diff --git a/drivers/net/rtl8169.c b/drivers/net/rtl8169.c
index cea6701..4a53710 100644
--- a/drivers/net/rtl8169.c
+++ b/drivers/net/rtl8169.c
@@ -538,7 +538,7 @@ static int rtl_recv(struct eth_device *dev)
 				cpu_to_le32(bus_to_phys(tpc->RxBufferRing[cur_rx]));
 			rtl_flush_rx_desc(&tpc->RxDescArray[cur_rx]);
 
-			NetReceive(rxdata, length);
+			net_process_received_packet(rxdata, length);
 		} else {
 			puts("Error Rx");
 		}
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c
index 4bf493e..a320b4d 100644
--- a/drivers/net/sh_eth.c
+++ b/drivers/net/sh_eth.c
@@ -127,7 +127,7 @@ int sh_eth_recv(struct eth_device *dev)
 			packet = (uchar *)
 				ADDR_TO_P2(port_info->rx_desc_cur->rd2);
 			invalidate_cache(packet, len);
-			NetReceive(packet, len);
+			net_process_received_packet(packet, len);
 		}
 
 		/* Make current descriptor available again */
diff --git a/drivers/net/smc91111.c b/drivers/net/smc91111.c
index 57c667a..ade14cd 100644
--- a/drivers/net/smc91111.c
+++ b/drivers/net/smc91111.c
@@ -756,35 +756,35 @@ static int smc_rcv(struct eth_device *dev)
 
 
 #ifdef USE_32_BIT
-		PRINTK3(" Reading %d dwords (and %d bytes) \n",
+		PRINTK3(" Reading %d dwords (and %d bytes)\n",
 			packet_length >> 2, packet_length & 3 );
 		/* QUESTION:  Like in the TX routine, do I want
 		   to send the DWORDs or the bytes first, or some
 		   mixture.  A mixture might improve already slow PIO
 		   performance	*/
-		SMC_insl( dev, SMC91111_DATA_REG, NetRxPackets[0],
-			packet_length >> 2 );
+		SMC_insl(dev, SMC91111_DATA_REG, net_rx_packets[0],
+			 packet_length >> 2);
 		/* read the left over bytes */
 		if (packet_length & 3) {
 			int i;
 
-			byte *tail = (byte *)(NetRxPackets[0] +
+			byte *tail = (byte *)(net_rx_packets[0] +
 				(packet_length & ~3));
 			dword leftover = SMC_inl(dev, SMC91111_DATA_REG);
 			for (i=0; i<(packet_length & 3); i++)
 				*tail++ = (byte) (leftover >> (8*i)) & 0xff;
 		}
 #else
-		PRINTK3(" Reading %d words and %d byte(s) \n",
+		PRINTK3(" Reading %d words and %d byte(s)\n",
 			(packet_length >> 1 ), packet_length & 1 );
-		SMC_insw(dev, SMC91111_DATA_REG , NetRxPackets[0],
-			packet_length >> 1);
+		SMC_insw(dev, SMC91111_DATA_REG , net_rx_packets[0],
+			 packet_length >> 1);
 
 #endif /* USE_32_BIT */
 
 #if	SMC_DEBUG > 2
 		printf("Receiving Packet\n");
-		print_packet( NetRxPackets[0], packet_length );
+		print_packet(net_rx_packets[0], packet_length);
 #endif
 	} else {
 		/* error ... */
@@ -815,7 +815,7 @@ static int smc_rcv(struct eth_device *dev)
 
 	if (!is_error) {
 		/* Pass the packet up to the protocol layers. */
-		NetReceive(NetRxPackets[0], packet_length);
+		net_process_received_packet(net_rx_packets[0], packet_length);
 		return packet_length;
 	} else {
 		return 0;
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index 5959672..c85a178 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -192,7 +192,7 @@ static void smc911x_halt(struct eth_device *dev)
 
 static int smc911x_rx(struct eth_device *dev)
 {
-	u32 *data = (u32 *)NetRxPackets[0];
+	u32 *data = (u32 *)net_rx_packets[0];
 	u32 pktlen, tmplen;
 	u32 status;
 
@@ -211,7 +211,7 @@ static int smc911x_rx(struct eth_device *dev)
 				": dropped bad packet. Status: 0x%08x\n",
 				status);
 		else
-			NetReceive(NetRxPackets[0], pktlen);
+			net_process_received_packet(net_rx_packets[0], pktlen);
 	}
 
 	return 0;
diff --git a/drivers/net/sunxi_emac.c b/drivers/net/sunxi_emac.c
index 5a06d68..46fb34f 100644
--- a/drivers/net/sunxi_emac.c
+++ b/drivers/net/sunxi_emac.c
@@ -437,10 +437,10 @@ static int sunxi_emac_eth_recv(struct eth_device *dev)
 			printf("Received packet is too big (len=%d)\n", rx_len);
 		} else {
 			emac_inblk_32bit((void *)&regs->rx_io_data,
-					 NetRxPackets[0], rx_len);
+					 net_rx_packets[0], rx_len);
 
 			/* Pass to upper layer */
-			NetReceive(NetRxPackets[0], rx_len);
+			net_process_received_packet(net_rx_packets[0], rx_len);
 			return rx_len;
 		}
 	}
diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
index dcdba4e..42d0374 100644
--- a/drivers/net/tsec.c
+++ b/drivers/net/tsec.c
@@ -287,7 +287,7 @@ void redundant_init(struct eth_device *dev)
 			}
 		}
 
-		if (!memcmp(pkt, (void *)NetRxPackets[rx_idx], sizeof(pkt)))
+		if (!memcmp(pkt, (void *)net_rx_packets[rx_idx], sizeof(pkt)))
 			fail = 0;
 
 		out_be16(&rxbd[rx_idx].length, 0);
@@ -343,7 +343,7 @@ static void startup_tsec(struct eth_device *dev)
 	for (i = 0; i < PKTBUFSRX; i++) {
 		out_be16(&rxbd[i].status, RXBD_EMPTY);
 		out_be16(&rxbd[i].length, 0);
-		out_be32(&rxbd[i].bufptr, (u32)NetRxPackets[i]);
+		out_be32(&rxbd[i].bufptr, (u32)net_rx_packets[i]);
 	}
 	status = in_be16(&rxbd[PKTBUFSRX - 1].status);
 	out_be16(&rxbd[PKTBUFSRX - 1].status, status | RXBD_WRAP);
@@ -430,7 +430,8 @@ static int tsec_recv(struct eth_device *dev)
 
 		/* Send the packet up if there were no errors */
 		if (!(status & RXBD_STATS))
-			NetReceive(NetRxPackets[rx_idx], length - 4);
+			net_process_received_packet(net_rx_packets[rx_idx],
+						    length - 4);
 		else
 			printf("Got error %x\n", (status & RXBD_STATS));
 
diff --git a/drivers/net/tsi108_eth.c b/drivers/net/tsi108_eth.c
index 72b8159..9da59a0 100644
--- a/drivers/net/tsi108_eth.c
+++ b/drivers/net/tsi108_eth.c
@@ -804,11 +804,11 @@ static int tsi108_eth_probe (struct eth_device *dev, bd_t * bis)
 	rx_descr_current = rx_descr;
 	for (index = 0; index < NUM_RX_DESC; index++) {
 		/* make sure the receive buffers are not in cache */
-		invalidate_dcache_range((unsigned long)NetRxPackets[index],
-					(unsigned long)NetRxPackets[index] +
+		invalidate_dcache_range((unsigned long)net_rx_packets[index],
+					(unsigned long)net_rx_packets[index] +
 					RX_BUFFER_SIZE);
 		rx_descr->start_addr0 =
-		    cpu_to_le32((vuint32) NetRxPackets[index]);
+		    cpu_to_le32((vuint32) net_rx_packets[index]);
 		rx_descr->start_addr1 = 0;
 		rx_descr->next_descr_addr0 =
 		    cpu_to_le32((vuint32) (rx_descr + 1));
@@ -966,7 +966,7 @@ static int tsi108_eth_recv (struct eth_device *dev)
 
 			/*** process packet ***/
 			buffer = (uchar *)(le32_to_cpu(rx_descr->start_addr0));
-			NetReceive(buffer, length);
+			net_process_received_packet(buffer, length);
 
 			invalidate_dcache_range ((unsigned long)buffer,
 						(unsigned long)buffer +
diff --git a/drivers/net/uli526x.c b/drivers/net/uli526x.c
index 9526faa..47cdb85 100644
--- a/drivers/net/uli526x.c
+++ b/drivers/net/uli526x.c
@@ -587,7 +587,8 @@ static int uli526x_rx_packet(struct eth_device *dev)
 					__FUNCTION__, i, rxptr->rx_buf_ptr[i]);
 #endif
 
-				NetReceive((uchar *)rxptr->rx_buf_ptr, rxlen);
+				net_process_received_packet(
+					(uchar *)rxptr->rx_buf_ptr, rxlen);
 				uli526x_reuse_buf(rxptr);
 
 			} else {
@@ -709,7 +710,7 @@ static void allocate_rx_buffer(struct uli526x_board_info *db)
 	u32 addr;
 
 	for (index = 0; index < RX_DESC_CNT; index++) {
-		addr = (u32)NetRxPackets[index];
+		addr = (u32)net_rx_packets[index];
 		addr += (16 - (addr & 15));
 		rxptr->rx_buf_ptr = (char *) addr;
 		rxptr->rdes2 = cpu_to_le32(addr);
diff --git a/drivers/net/xilinx_axi_emac.c b/drivers/net/xilinx_axi_emac.c
index 262b67b..df053fe 100644
--- a/drivers/net/xilinx_axi_emac.c
+++ b/drivers/net/xilinx_axi_emac.c
@@ -556,7 +556,7 @@ static int axiemac_recv(struct eth_device *dev)
 #endif
 	/* Pass the received frame up for processing */
 	if (length)
-		NetReceive(rxframe, length);
+		net_process_received_packet(rxframe, length);
 
 #ifdef DEBUG
 	/* It is useful to clear buffer to be sure that it is consistent */
diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c
index 2a5cc44..c9afa99 100644
--- a/drivers/net/xilinx_emaclite.c
+++ b/drivers/net/xilinx_emaclite.c
@@ -322,7 +322,7 @@ static int emaclite_recv(struct eth_device *dev)
 	out_be32 (baseaddress + XEL_RSR_OFFSET, reg);
 
 	debug("Packet receive from 0x%x, length %dB\n", baseaddress, length);
-	NetReceive((uchar *) etherrxbuff, length);
+	net_process_received_packet((uchar *)etherrxbuff, length);
 	return length;
 
 }
diff --git a/drivers/net/xilinx_ll_temac_fifo.c b/drivers/net/xilinx_ll_temac_fifo.c
index b8993cd..78319d7 100644
--- a/drivers/net/xilinx_ll_temac_fifo.c
+++ b/drivers/net/xilinx_ll_temac_fifo.c
@@ -48,7 +48,7 @@ int ll_temac_reset_fifo(struct eth_device *dev)
 int ll_temac_recv_fifo(struct eth_device *dev)
 {
 	int i, length = 0;
-	u32 *buf = (u32 *)NetRxPackets[0];
+	u32 *buf = (u32 *)net_rx_packets[0];
 	struct ll_temac *ll_temac = dev->priv;
 	struct fifo_ctrl *fifo_ctrl = (void *)ll_temac->ctrladdr;
 
@@ -93,7 +93,7 @@ int ll_temac_recv_fifo(struct eth_device *dev)
 		for (i = 0; i < length; i += 4)
 			*buf++ = in_be32(&fifo_ctrl->rdfd);
 
-		NetReceive(NetRxPackets[0], length);
+		net_process_received_packet(net_rx_packets[0], length);
 	}
 
 	return 0;
diff --git a/drivers/net/xilinx_ll_temac_sdma.c b/drivers/net/xilinx_ll_temac_sdma.c
index 32a822e..07c5f6b 100644
--- a/drivers/net/xilinx_ll_temac_sdma.c
+++ b/drivers/net/xilinx_ll_temac_sdma.c
@@ -180,7 +180,7 @@ int ll_temac_init_sdma(struct eth_device *dev)
 		memset(rx_dp, 0, sizeof(*rx_dp));
 		rx_dp->next_p = rx_dp;
 		rx_dp->buf_len = PKTSIZE_ALIGN;
-		rx_dp->phys_buf_p = (u8 *)NetRxPackets[i];
+		rx_dp->phys_buf_p = (u8 *)net_rx_packets[i];
 		flush_cache((u32)rx_dp->phys_buf_p, PKTSIZE_ALIGN);
 	}
 	flush_cache((u32)cdmac_bd.rx, sizeof(cdmac_bd.rx));
@@ -316,7 +316,7 @@ int ll_temac_recv_sdma(struct eth_device *dev)
 	ll_temac->out32(ra[RX_TAILDESC_PTR], (int)&cdmac_bd.rx[rx_idx]);
 
 	if (length > 0 && pb_idx != -1)
-		NetReceive(NetRxPackets[pb_idx], length);
+		net_process_received_packet(net_rx_packets[pb_idx], length);
 
 	return 0;
 }
diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
index 430e228..74fda70 100644
--- a/drivers/net/zynq_gem.c
+++ b/drivers/net/zynq_gem.c
@@ -439,7 +439,7 @@ static int zynq_gem_recv(struct eth_device *dev)
 		u32 size = roundup(frame_len, ARCH_DMA_MINALIGN);
 		invalidate_dcache_range(addr, addr + size);
 
-		NetReceive((u8 *)addr, frame_len);
+		net_process_received_packet((u8 *)addr, frame_len);
 
 		if (current_bd->status & ZYNQ_GEM_RXBUF_SOF_MASK)
 			priv->rx_first_buf = priv->rxbd_current;
diff --git a/drivers/qe/uec.c b/drivers/qe/uec.c
index c91f084..e0ab04a 100644
--- a/drivers/qe/uec.c
+++ b/drivers/qe/uec.c
@@ -1333,7 +1333,7 @@ static int uec_recv(struct eth_device* dev)
 		if (!(status & RxBD_ERROR)) {
 			data = BD_DATA(bd);
 			len = BD_LENGTH(bd);
-			NetReceive(data, len);
+			net_process_received_packet(data, len);
 		} else {
 			printf("%s: Rx error\n", dev->name);
 		}
diff --git a/drivers/usb/eth/asix.c b/drivers/usb/eth/asix.c
index 1181109..3f0c814 100644
--- a/drivers/usb/eth/asix.c
+++ b/drivers/usb/eth/asix.c
@@ -534,7 +534,8 @@ static int asix_recv(struct eth_device *eth)
 		}
 
 		/* Notify net stack */
-		NetReceive(buf_ptr + sizeof(packet_len), packet_len);
+		net_process_received_packet(buf_ptr + sizeof(packet_len),
+					    packet_len);
 
 		/* Adjust for next iteration. Packets are padded to 16-bits */
 		if (packet_len & 1)
diff --git a/drivers/usb/eth/asix88179.c b/drivers/usb/eth/asix88179.c
index 0ef85db..94dfe85 100644
--- a/drivers/usb/eth/asix88179.c
+++ b/drivers/usb/eth/asix88179.c
@@ -558,7 +558,7 @@ static int asix_recv(struct eth_device *eth)
 
 		frame_pos += 2;
 
-		NetReceive(recv_buf + frame_pos, pkt_len);
+		net_process_received_packet(recv_buf + frame_pos, pkt_len);
 
 		pkt_hdr++;
 		frame_pos += ((pkt_len + 7) & 0xFFF8)-2;
diff --git a/drivers/usb/eth/mcs7830.c b/drivers/usb/eth/mcs7830.c
index 8e738d4..c1b7086 100644
--- a/drivers/usb/eth/mcs7830.c
+++ b/drivers/usb/eth/mcs7830.c
@@ -600,7 +600,7 @@ static int mcs7830_recv(struct eth_device *eth)
 
 	if (sts == STAT_RX_FRAME_CORRECT) {
 		debug("%s() got a frame, len=%d\n", __func__, gotlen);
-		NetReceive(buf, gotlen);
+		net_process_received_packet(buf, gotlen);
 		return 0;
 	}
 
diff --git a/drivers/usb/eth/smsc95xx.c b/drivers/usb/eth/smsc95xx.c
index 78b469f..a7e50d6 100644
--- a/drivers/usb/eth/smsc95xx.c
+++ b/drivers/usb/eth/smsc95xx.c
@@ -760,7 +760,8 @@ static int smsc95xx_recv(struct eth_device *eth)
 		}
 
 		/* Notify net stack */
-		NetReceive(buf_ptr + sizeof(packet_len), packet_len - 4);
+		net_process_received_packet(buf_ptr + sizeof(packet_len),
+					    packet_len - 4);
 
 		/* Adjust for next iteration */
 		actual_len -= sizeof(packet_len) + packet_len;
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index c01163c..52c6c1a 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -1521,7 +1521,7 @@ static int rx_submit(struct eth_dev *dev, struct usb_request *req,
 	 * RNDIS headers involve variable numbers of LE32 values.
 	 */
 
-	req->buf = (u8 *) NetRxPackets[0];
+	req->buf = (u8 *)net_rx_packets[0];
 	req->length = size;
 	req->complete = rx_complete;
 
@@ -2446,7 +2446,8 @@ static int usb_eth_recv(struct eth_device *netdev)
 	if (packet_received) {
 		debug("%s: packet received\n", __func__);
 		if (dev->rx_req) {
-			NetReceive(NetRxPackets[0], dev->rx_req->length);
+			net_process_received_packet(net_rx_packets[0],
+						    dev->rx_req->length);
 			packet_received = 0;
 
 			rx_submit(dev, dev->rx_req, 0);
diff --git a/include/net.h b/include/net.h
index 18ae7d2..1dc54ce 100644
--- a/include/net.h
+++ b/include/net.h
@@ -476,11 +476,7 @@ extern u8		net_server_ethaddr[6];	/* Boot server enet address */
 extern struct in_addr	net_ip;		/* Our    IP addr (0 = unknown) */
 extern struct in_addr	net_server_ip;	/* Server IP addr (0 = unknown) */
 extern uchar		*net_tx_packet;		/* THE transmit packet */
-#ifdef CONFIG_DM_ETH
 extern uchar		*net_rx_packets[PKTBUFSRX]; /* Receive packets */
-#else
-extern uchar		*NetRxPackets[PKTBUFSRX]; /* Receive packets */
-#endif
 extern uchar		*net_rx_packet;		/* Current receive packet */
 extern int		net_rx_packet_len;	/* Current rx packet length */
 extern unsigned		NetIPID;		/* IP ID (counting) */
@@ -634,9 +630,6 @@ static inline void net_send_packet(uchar *pkt, int len)
 int net_send_udp_packet(uchar *ether, struct in_addr dest, int dport,
 			int sport, int payload_len);
 
-#ifndef CONFIG_DM_ETH
-#define NetReceive(in_packet, len) net_process_received_packet(in_packet, len)
-#endif
 /* Processes a received packet */
 void net_process_received_packet(uchar *in_packet, int len);
 
diff --git a/net/net.c b/net/net.c
index 0fb0475..c47e570 100644
--- a/net/net.c
+++ b/net/net.c
@@ -178,13 +178,8 @@ int		NetTimeOffset;
 #endif
 
 static uchar net_pkt_buf[(PKTBUFSRX+1) * PKTSIZE_ALIGN + PKTALIGN];
-#ifdef CONFIG_DM_ETH
 /* Receive packets */
 uchar *net_rx_packets[PKTBUFSRX];
-#else
-/* Receive packet */
-uchar *NetRxPackets[PKTBUFSRX];
-#endif
 /* Current UDP RX packet handler */
 static rxhand_f *udp_packet_handler;
 /* Current ARP RX packet handler */
@@ -303,16 +298,10 @@ void net_init(void)
 
 		net_tx_packet = &net_pkt_buf[0] + (PKTALIGN - 1);
 		net_tx_packet -= (ulong)net_tx_packet % PKTALIGN;
-#ifdef CONFIG_DM_ETH
 		for (i = 0; i < PKTBUFSRX; i++) {
 			net_rx_packets[i] = net_tx_packet +
 				(i + 1) * PKTSIZE_ALIGN;
 		}
-#else
-		for (i = 0; i < PKTBUFSRX; i++)
-			NetRxPackets[i] = net_tx_packet +
-				(i + 1) * PKTSIZE_ALIGN;
-#endif
 		ArpInit();
 		net_clear_handlers();
 
diff --git a/post/cpu/mpc8xx/ether.c b/post/cpu/mpc8xx/ether.c
index 3a8b483..1b75eb6 100644
--- a/post/cpu/mpc8xx/ether.c
+++ b/post/cpu/mpc8xx/ether.c
@@ -212,7 +212,7 @@ static void scc_init (int scc_index)
 	for (i = 0; i < PKTBUFSRX; i++) {
 		rtx->rxbd[i].cbd_sc = BD_ENET_RX_EMPTY;
 		rtx->rxbd[i].cbd_datlen = 0;	/* Reset */
-		rtx->rxbd[i].cbd_bufaddr = (uint) NetRxPackets[i];
+		rtx->rxbd[i].cbd_bufaddr = (uint) net_rx_packets[i];
 	}
 
 	rtx->rxbd[PKTBUFSRX - 1].cbd_sc |= BD_ENET_RX_WRAP;
@@ -405,8 +405,8 @@ static int scc_recv (int index, void *packet, int max_length)
 	if (!(rtx->rxbd[rxIdx].cbd_sc & 0x003f)) {
 		length = rtx->rxbd[rxIdx].cbd_datlen - 4;
 		memcpy (packet,
-				(void *) (NetRxPackets[rxIdx]),
-				length < max_length ? length : max_length);
+			(void *)(net_rx_packets[rxIdx]),
+			length < max_length ? length : max_length);
 	}
 
 	/* Give the buffer back to the SCC. */
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH 07/23] net: cosmetic: Clean up TFTP variables and functions
  2015-04-03 21:14 [U-Boot] [PATCH 0/23] net: cosmetic: Fix naming and other checkpatch.pl issues in net/ Joe Hershberger
                   ` (5 preceding siblings ...)
  2015-04-03 21:14 ` [U-Boot] [PATCH 06/23] net: cosmetic: Fix var naming net <-> eth drivers Joe Hershberger
@ 2015-04-03 21:14 ` Joe Hershberger
  2015-04-03 21:14 ` [U-Boot] [PATCH 08/23] net: cosmetic: Clean up ARP " Joe Hershberger
                   ` (17 subsequent siblings)
  24 siblings, 0 replies; 103+ messages in thread
From: Joe Hershberger @ 2015-04-03 21:14 UTC (permalink / raw)
  To: u-boot

Make a thorough pass through all variables and function names contained
within tftp and remove CamelCase and improve naming.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

 common/update.c |  16 +-
 net/net.c       |   6 +-
 net/tftp.c      | 483 ++++++++++++++++++++++++++++----------------------------
 net/tftp.h      |   8 +-
 4 files changed, 259 insertions(+), 254 deletions(-)

diff --git a/common/update.c b/common/update.c
index bc0c48f..1bf2f82 100644
--- a/common/update.c
+++ b/common/update.c
@@ -39,8 +39,8 @@
 #define CONFIG_UPDATE_TFTP_CNT_MAX	0
 #endif
 
-extern ulong TftpRRQTimeoutMSecs;
-extern int TftpRRQTimeoutCountMax;
+extern ulong tftp_timeout_ms;
+extern int tftp_timeout_count_max;
 extern flash_info_t flash_info[];
 extern ulong load_addr;
 
@@ -55,14 +55,14 @@ static int update_load(char *filename, ulong msec_max, int cnt_max, ulong addr)
 
 	rv = 0;
 	/* save used globals and env variable */
-	saved_timeout_msecs = TftpRRQTimeoutMSecs;
-	saved_timeout_count = TftpRRQTimeoutCountMax;
+	saved_timeout_msecs = tftp_timeout_ms;
+	saved_timeout_count = tftp_timeout_count_max;
 	saved_netretry = strdup(getenv("netretry"));
 	saved_bootfile = strdup(net_boot_file_name);
 
 	/* set timeouts for auto-update */
-	TftpRRQTimeoutMSecs = msec_max;
-	TftpRRQTimeoutCountMax = cnt_max;
+	tftp_timeout_ms = msec_max;
+	tftp_timeout_count_max = cnt_max;
 
 	/* we don't want to retry the connection if errors occur */
 	setenv("netretry", "no");
@@ -78,8 +78,8 @@ static int update_load(char *filename, ulong msec_max, int cnt_max, ulong addr)
 		flush_cache(addr, size);
 
 	/* restore changed globals and env variable */
-	TftpRRQTimeoutMSecs = saved_timeout_msecs;
-	TftpRRQTimeoutCountMax = saved_timeout_count;
+	tftp_timeout_ms = saved_timeout_msecs;
+	tftp_timeout_count_max = saved_timeout_count;
 
 	setenv("netretry", saved_netretry);
 	if (saved_netretry != NULL)
diff --git a/net/net.c b/net/net.c
index c47e570..e0e0724 100644
--- a/net/net.c
+++ b/net/net.c
@@ -247,7 +247,7 @@ void net_auto_load(void)
 		net_set_state(NETLOOP_SUCCESS);
 		return;
 	}
-	TftpStart(TFTPGET);
+	tftp_start(TFTPGET);
 }
 
 static void NetInitLoop(void)
@@ -372,11 +372,11 @@ restart:
 		case TFTPPUT:
 #endif
 			/* always use ARP to get server ethernet address */
-			TftpStart(protocol);
+			tftp_start(protocol);
 			break;
 #ifdef CONFIG_CMD_TFTPSRV
 		case TFTPSRV:
-			TftpStartServer();
+			tftp_start_server();
 			break;
 #endif
 #if defined(CONFIG_CMD_DHCP)
diff --git a/net/tftp.c b/net/tftp.c
index f25abaa..14acf04 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -39,21 +39,21 @@
 #define TFTP_ERROR	5
 #define TFTP_OACK	6
 
-static ulong TftpTimeoutMSecs = TIMEOUT;
-static int TftpTimeoutCountMax = TIMEOUT_COUNT;
+static ulong timeout_ms = TIMEOUT;
+static int timeout_count_max = TIMEOUT_COUNT;
 static ulong time_start;   /* Record time we started tftp */
 
 /*
  * These globals govern the timeout behavior when attempting a connection to a
- * TFTP server. TftpRRQTimeoutMSecs specifies the number of milliseconds to
+ * TFTP server. tftp_timeout_ms specifies the number of milliseconds to
  * wait for the server to respond to initial connection. Second global,
- * TftpRRQTimeoutCountMax, gives the number of such connection retries.
- * TftpRRQTimeoutCountMax must be non-negative and TftpRRQTimeoutMSecs must be
+ * tftp_timeout_count_max, gives the number of such connection retries.
+ * tftp_timeout_count_max must be non-negative and tftp_timeout_ms must be
  * positive. The globals are meant to be set (and restored) by code needing
  * non-standard timeout behavior when initiating a TFTP transfer.
  */
-ulong TftpRRQTimeoutMSecs = TIMEOUT;
-int TftpRRQTimeoutCountMax = TIMEOUT_COUNT;
+ulong tftp_timeout_ms = TIMEOUT;
+int tftp_timeout_count_max = TIMEOUT_COUNT;
 
 enum {
 	TFTP_ERR_UNDEFINED           = 0,
@@ -67,30 +67,32 @@ enum {
 
 static struct in_addr tftp_remote_ip;
 /* The UDP port at their end */
-static int	TftpRemotePort;
+static int	tftp_remote_port;
 /* The UDP port at our end */
-static int	TftpOurPort;
-static int	TftpTimeoutCount;
+static int	tftp_our_port;
+static int	timeout_count;
 /* packet sequence number */
-static ulong	TftpBlock;
+static ulong	tftp_cur_block;
 /* last packet sequence number received */
-static ulong	TftpLastBlock;
+static ulong	tftp_prev_block;
 /* count of sequence number wraparounds */
-static ulong	TftpBlockWrap;
+static ulong	tftp_block_wrap;
 /* memory offset due to wrapping */
-static ulong	TftpBlockWrapOffset;
-static int	TftpState;
+static ulong	tftp_block_wrap_offset;
+static int	tftp_state;
 #ifdef CONFIG_TFTP_TSIZE
 /* The file size reported by the server */
-static int	TftpTsize;
+static int	tftp_tsize;
 /* The number of hashes we printed */
-static short	TftpNumchars;
+static short	tftp_tsize_num_hash;
 #endif
 #ifdef CONFIG_CMD_TFTPPUT
-static int	TftpWriting;	/* 1 if writing, else 0 */
-static int	TftpFinalBlock;	/* 1 if we have sent the last block */
+/* 1 if writing, else 0 */
+static int	tftp_put_active;
+/* 1 if we have sent the last block */
+static int	tftp_put_final_block_sent;
 #else
-#define TftpWriting	0
+#define tftp_put_active	0
 #endif
 
 #define STATE_SEND_RRQ	1
@@ -128,41 +130,42 @@ static char tftp_filename[MAX_LEN];
 #define TFTP_MTU_BLOCKSIZE 1468
 #endif
 
-static unsigned short TftpBlkSize = TFTP_BLOCK_SIZE;
-static unsigned short TftpBlkSizeOption = TFTP_MTU_BLOCKSIZE;
+static unsigned short tftp_block_size = TFTP_BLOCK_SIZE;
+static unsigned short tftp_block_size_option = TFTP_MTU_BLOCKSIZE;
 
 #ifdef CONFIG_MCAST_TFTP
 #include <malloc.h>
 #define MTFTP_BITMAPSIZE	0x1000
-static unsigned *Bitmap;
-static int PrevBitmapHole, Mapsize = MTFTP_BITMAPSIZE;
-static uchar ProhibitMcast, MasterClient;
-static uchar Multicast;
-static int Mcast_port;
-static ulong TftpEndingBlock; /* can get 'last' block before done..*/
+static unsigned *tftp_mcast_bitmap;
+static int tftp_mcast_prev_hole;
+static int tftp_mcast_bitmap_size = MTFTP_BITMAPSIZE;
+static int tftp_mcast_disabled;
+static int tftp_mcast_master_client;
+static int tftp_mcast_active;
+static int tftp_mcast_port;
+/* can get 'last' block before done..*/
+static ulong tftp_mcast_ending_block;
 
 static void parse_multicast_oack(char *pkt, int len);
 
-static void
-mcast_cleanup(void)
+static void mcast_cleanup(void)
 {
 	if (net_mcast_addr)
 		eth_mcast_join(net_mcast_addr, 0);
-	if (Bitmap)
-		free(Bitmap);
-	Bitmap = NULL;
+	if (tftp_mcast_bitmap)
+		free(tftp_mcast_bitmap);
+	tftp_mcast_bitmap = NULL;
 	net_mcast_addr.s_addr = 0;
-	Multicast = 0;
-	Mcast_port = 0;
-	TftpEndingBlock = -1;
+	tftp_mcast_active = 0;
+	tftp_mcast_port = 0;
+	tftp_mcast_ending_block = -1;
 }
 
 #endif	/* CONFIG_MCAST_TFTP */
 
-static inline void
-store_block(int block, uchar *src, unsigned len)
+static inline void store_block(int block, uchar *src, unsigned len)
 {
-	ulong offset = block * TftpBlkSize + TftpBlockWrapOffset;
+	ulong offset = block * tftp_block_size + tftp_block_wrap_offset;
 	ulong newsize = offset + len;
 #ifdef CONFIG_SYS_DIRECT_FLASH_TFTP
 	int i, rc = 0;
@@ -193,8 +196,8 @@ store_block(int block, uchar *src, unsigned len)
 		unmap_sysmem(ptr);
 	}
 #ifdef CONFIG_MCAST_TFTP
-	if (Multicast)
-		ext2_set_bit(block, Bitmap);
+	if (tftp_mcast_active)
+		ext2_set_bit(block, tftp_mcast_bitmap);
 #endif
 
 	if (net_boot_file_size < newsize)
@@ -204,11 +207,11 @@ store_block(int block, uchar *src, unsigned len)
 /* Clear our state ready for a new transfer */
 static void new_transfer(void)
 {
-	TftpLastBlock = 0;
-	TftpBlockWrap = 0;
-	TftpBlockWrapOffset = 0;
+	tftp_prev_block = 0;
+	tftp_block_wrap = 0;
+	tftp_block_wrap_offset = 0;
 #ifdef CONFIG_CMD_TFTPPUT
-	TftpFinalBlock = 0;
+	tftp_put_final_block_sent = 0;
 #endif
 }
 
@@ -224,38 +227,39 @@ static void new_transfer(void)
 static int load_block(unsigned block, uchar *dst, unsigned len)
 {
 	/* We may want to get the final block from the previous set */
-	ulong offset = ((int)block - 1) * len + TftpBlockWrapOffset;
+	ulong offset = ((int)block - 1) * len + tftp_block_wrap_offset;
 	ulong tosend = len;
 
 	tosend = min(net_boot_file_size - offset, tosend);
 	(void)memcpy(dst, (void *)(save_addr + offset), tosend);
 	debug("%s: block=%d, offset=%ld, len=%d, tosend=%ld\n", __func__,
-		block, offset, len, tosend);
+	      block, offset, len, tosend);
 	return tosend;
 }
 #endif
 
-static void TftpSend(void);
-static void TftpTimeout(void);
+static void tftp_send(void);
+static void tftp_timeout_handler(void);
 
 /**********************************************************************/
 
 static void show_block_marker(void)
 {
 #ifdef CONFIG_TFTP_TSIZE
-	if (TftpTsize) {
-		ulong pos = TftpBlock * TftpBlkSize + TftpBlockWrapOffset;
+	if (tftp_tsize) {
+		ulong pos = tftp_cur_block * tftp_block_size +
+			tftp_block_wrap_offset;
 
-		while (TftpNumchars < pos * 50 / TftpTsize) {
+		while (tftp_tsize_num_hash < pos * 50 / tftp_tsize) {
 			putc('#');
-			TftpNumchars++;
+			tftp_tsize_num_hash++;
 		}
 	} else
 #endif
 	{
-		if (((TftpBlock - 1) % 10) == 0)
+		if (((tftp_cur_block - 1) % 10) == 0)
 			putc('#');
-		else if ((TftpBlock % (10 * HASHES_PER_LINE)) == 0)
+		else if ((tftp_cur_block % (10 * HASHES_PER_LINE)) == 0)
 			puts("\n\t ");
 	}
 }
@@ -287,10 +291,10 @@ static void update_block_number(void)
 	 * number of 0 this means that there was a wrap
 	 * around of the (16 bit) counter.
 	 */
-	if (TftpBlock == 0 && TftpLastBlock != 0) {
-		TftpBlockWrap++;
-		TftpBlockWrapOffset += TftpBlkSize * TFTP_SEQUENCE_SIZE;
-		TftpTimeoutCount = 0; /* we've done well, reset thhe timeout */
+	if (tftp_cur_block == 0 && tftp_prev_block != 0) {
+		tftp_block_wrap++;
+		tftp_block_wrap_offset += tftp_block_size * TFTP_SEQUENCE_SIZE;
+		timeout_count = 0; /* we've done well, reset the timeout */
 	} else {
 		show_block_marker();
 	}
@@ -301,12 +305,12 @@ static void tftp_complete(void)
 {
 #ifdef CONFIG_TFTP_TSIZE
 	/* Print hash marks for the last packet received */
-	while (TftpTsize && TftpNumchars < 49) {
+	while (tftp_tsize && tftp_tsize_num_hash < 49) {
 		putc('#');
-		TftpNumchars++;
+		tftp_tsize_num_hash++;
 	}
 	puts("  ");
-	print_size(TftpTsize, "");
+	print_size(tftp_tsize, "");
 #endif
 	time_start = get_timer(time_start);
 	if (time_start > 0) {
@@ -318,8 +322,7 @@ static void tftp_complete(void)
 	net_set_state(NETLOOP_SUCCESS);
 }
 
-static void
-TftpSend(void)
+static void tftp_send(void)
 {
 	uchar *pkt;
 	uchar *xp;
@@ -328,9 +331,8 @@ TftpSend(void)
 
 #ifdef CONFIG_MCAST_TFTP
 	/* Multicast TFTP.. non-MasterClients do not ACK data. */
-	if (Multicast
-	 && (TftpState == STATE_DATA)
-	 && (MasterClient == 0))
+	if (tftp_mcast_active && tftp_state == STATE_DATA &&
+	    tftp_mcast_master_client == 0)
 		return;
 #endif
 	/*
@@ -339,13 +341,13 @@ TftpSend(void)
 	 */
 	pkt = net_tx_packet + net_eth_hdr_size() + IP_UDP_HDR_SIZE;
 
-	switch (TftpState) {
+	switch (tftp_state) {
 	case STATE_SEND_RRQ:
 	case STATE_SEND_WRQ:
 		xp = pkt;
 		s = (ushort *)pkt;
 #ifdef CONFIG_CMD_TFTPPUT
-		*s++ = htons(TftpState == STATE_SEND_RRQ ? TFTP_RRQ :
+		*s++ = htons(tftp_state == STATE_SEND_RRQ ? TFTP_RRQ :
 			TFTP_WRQ);
 #else
 		*s++ = htons(TFTP_RRQ);
@@ -357,7 +359,7 @@ TftpSend(void)
 		pkt += 5 /*strlen("octet")*/ + 1;
 		strcpy((char *)pkt, "timeout");
 		pkt += 7 /*strlen("timeout")*/ + 1;
-		sprintf((char *)pkt, "%lu", TftpTimeoutMSecs / 1000);
+		sprintf((char *)pkt, "%lu", timeout_ms / 1000);
 		debug("send option \"timeout %s\"\n", (char *)pkt);
 		pkt += strlen((char *)pkt) + 1;
 #ifdef CONFIG_TFTP_TSIZE
@@ -366,14 +368,14 @@ TftpSend(void)
 #endif
 		/* try for more effic. blk size */
 		pkt += sprintf((char *)pkt, "blksize%c%d%c",
-				0, TftpBlkSizeOption, 0);
+				0, tftp_block_size_option, 0);
 #ifdef CONFIG_MCAST_TFTP
 		/* Check all preconditions before even trying the option */
-		if (!ProhibitMcast) {
-			Bitmap = malloc(Mapsize);
-			if (Bitmap && eth_get_dev()->mcast) {
-				free(Bitmap);
-				Bitmap = NULL;
+		if (!tftp_mcast_disabled) {
+			tftp_mcast_bitmap = malloc(tftp_mcast_bitmap_size);
+			if (tftp_mcast_bitmap && eth_get_dev()->mcast) {
+				free(tftp_mcast_bitmap);
+				tftp_mcast_bitmap = NULL;
 				pkt += sprintf((char *)pkt, "multicast%c%c",
 					0, 0);
 			}
@@ -384,11 +386,12 @@ TftpSend(void)
 
 	case STATE_OACK:
 #ifdef CONFIG_MCAST_TFTP
-		/* My turn!  Start at where I need blocks I missed.*/
-		if (Multicast)
-			TftpBlock = ext2_find_next_zero_bit(Bitmap,
-							    (Mapsize*8), 0);
-		/*..falling..*/
+		/* My turn!  Start at where I need blocks I missed. */
+		if (tftp_mcast_active)
+			tftp_cur_block = ext2_find_next_zero_bit(
+				tftp_mcast_bitmap,
+				tftp_mcast_bitmap_size * 8, 0);
+		/* fall through */
 #endif
 
 	case STATE_RECV_WRQ:
@@ -396,16 +399,16 @@ TftpSend(void)
 		xp = pkt;
 		s = (ushort *)pkt;
 		s[0] = htons(TFTP_ACK);
-		s[1] = htons(TftpBlock);
+		s[1] = htons(tftp_cur_block);
 		pkt = (uchar *)(s + 2);
 #ifdef CONFIG_CMD_TFTPPUT
-		if (TftpWriting) {
-			int toload = TftpBlkSize;
-			int loaded = load_block(TftpBlock, pkt, toload);
+		if (tftp_put_active) {
+			int toload = tftp_block_size;
+			int loaded = load_block(tftp_cur_block, pkt, toload);
 
 			s[0] = htons(TFTP_DATA);
 			pkt += loaded;
-			TftpFinalBlock = (loaded < toload);
+			tftp_put_final_block_sent = (loaded < toload);
 		}
 #endif
 		len = pkt - xp;
@@ -435,8 +438,8 @@ TftpSend(void)
 		break;
 	}
 
-	net_send_udp_packet(net_server_ethaddr, tftp_remote_ip, TftpRemotePort,
-			    TftpOurPort, len);
+	net_send_udp_packet(net_server_ethaddr, tftp_remote_ip,
+			    tftp_remote_port, tftp_our_port, len);
 }
 
 #ifdef CONFIG_CMD_TFTPPUT
@@ -458,15 +461,15 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 	__be16 *s;
 	int i;
 
-	if (dest != TftpOurPort) {
+	if (dest != tftp_our_port) {
 #ifdef CONFIG_MCAST_TFTP
-		if (Multicast
-		 && (!Mcast_port || (dest != Mcast_port)))
+		if (tftp_mcast_active &&
+		    (!tftp_mcast_port || dest != tftp_mcast_port))
 #endif
 			return;
 	}
-	if (TftpState != STATE_SEND_RRQ && src != TftpRemotePort &&
-	    TftpState != STATE_RECV_WRQ && TftpState != STATE_SEND_WRQ)
+	if (tftp_state != STATE_SEND_RRQ && src != tftp_remote_port &&
+	    tftp_state != STATE_RECV_WRQ && tftp_state != STATE_SEND_WRQ)
 		return;
 
 	if (len < 2)
@@ -477,14 +480,13 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 	proto = *s++;
 	pkt = (uchar *)s;
 	switch (ntohs(proto)) {
-
 	case TFTP_RRQ:
 		break;
 
 	case TFTP_ACK:
 #ifdef CONFIG_CMD_TFTPPUT
-		if (TftpWriting) {
-			if (TftpFinalBlock) {
+		if (tftp_put_active) {
+			if (tftp_put_final_block_sent) {
 				tftp_complete();
 			} else {
 				/*
@@ -492,12 +494,12 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 				 * count to wrap just like the other end!
 				 */
 				int block = ntohs(*s);
-				int ack_ok = (TftpBlock == block);
+				int ack_ok = (tftp_cur_block == block);
 
-				TftpBlock = (unsigned short)(block + 1);
+				tftp_cur_block = (unsigned short)(block + 1);
 				update_block_number();
 				if (ack_ok)
-					TftpSend(); /* Send next data block */
+					tftp_send(); /* Send next data block */
 			}
 		}
 #endif
@@ -510,101 +512,98 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 	case TFTP_WRQ:
 		debug("Got WRQ\n");
 		tftp_remote_ip = sip;
-		TftpRemotePort = src;
-		TftpOurPort = 1024 + (get_timer(0) % 3072);
+		tftp_remote_port = src;
+		tftp_our_port = 1024 + (get_timer(0) % 3072);
 		new_transfer();
-		TftpSend(); /* Send ACK(0) */
+		tftp_send(); /* Send ACK(0) */
 		break;
 #endif
 
 	case TFTP_OACK:
 		debug("Got OACK: %s %s\n",
-			pkt,
-			pkt + strlen((char *)pkt) + 1);
-		TftpState = STATE_OACK;
-		TftpRemotePort = src;
+		      pkt, pkt + strlen((char *)pkt) + 1);
+		tftp_state = STATE_OACK;
+		tftp_remote_port = src;
 		/*
 		 * Check for 'blksize' option.
 		 * Careful: "i" is signed, "len" is unsigned, thus
 		 * something like "len-8" may give a *huge* number
 		 */
 		for (i = 0; i+8 < len; i++) {
-			if (strcmp((char *)pkt+i, "blksize") == 0) {
-				TftpBlkSize = (unsigned short)
-					simple_strtoul((char *)pkt+i+8, NULL,
-						       10);
+			if (strcmp((char *)pkt + i, "blksize") == 0) {
+				tftp_block_size = (unsigned short)
+					simple_strtoul((char *)pkt + i + 8,
+						       NULL, 10);
 				debug("Blocksize ack: %s, %d\n",
-					(char *)pkt+i+8, TftpBlkSize);
+				      (char *)pkt + i + 8, tftp_block_size);
 			}
 #ifdef CONFIG_TFTP_TSIZE
 			if (strcmp((char *)pkt+i, "tsize") == 0) {
-				TftpTsize = simple_strtoul((char *)pkt+i+6,
+				tftp_tsize = simple_strtoul((char *)pkt + i + 6,
 							   NULL, 10);
 				debug("size = %s, %d\n",
-					 (char *)pkt+i+6, TftpTsize);
+				      (char *)pkt + i + 6, tftp_tsize);
 			}
 #endif
 		}
 #ifdef CONFIG_MCAST_TFTP
-		parse_multicast_oack((char *)pkt, len-1);
-		if ((Multicast) && (!MasterClient))
-			TftpState = STATE_DATA;	/* passive.. */
+		parse_multicast_oack((char *)pkt, len - 1);
+		if ((tftp_mcast_active) && (!tftp_mcast_master_client))
+			tftp_state = STATE_DATA;	/* passive.. */
 		else
 #endif
 #ifdef CONFIG_CMD_TFTPPUT
-		if (TftpWriting) {
+		if (tftp_put_active) {
 			/* Get ready to send the first block */
-			TftpState = STATE_DATA;
-			TftpBlock++;
+			tftp_state = STATE_DATA;
+			tftp_cur_block++;
 		}
 #endif
-		TftpSend(); /* Send ACK or first data block */
+		tftp_send(); /* Send ACK or first data block */
 		break;
 	case TFTP_DATA:
 		if (len < 2)
 			return;
 		len -= 2;
-		TftpBlock = ntohs(*(__be16 *)pkt);
+		tftp_cur_block = ntohs(*(__be16 *)pkt);
 
 		update_block_number();
 
-		if (TftpState == STATE_SEND_RRQ)
+		if (tftp_state == STATE_SEND_RRQ)
 			debug("Server did not acknowledge timeout option!\n");
 
-		if (TftpState == STATE_SEND_RRQ || TftpState == STATE_OACK ||
-		    TftpState == STATE_RECV_WRQ) {
+		if (tftp_state == STATE_SEND_RRQ || tftp_state == STATE_OACK ||
+		    tftp_state == STATE_RECV_WRQ) {
 			/* first block received */
-			TftpState = STATE_DATA;
-			TftpRemotePort = src;
+			tftp_state = STATE_DATA;
+			tftp_remote_port = src;
 			new_transfer();
 
 #ifdef CONFIG_MCAST_TFTP
-			if (Multicast) { /* start!=1 common if mcast */
-				TftpLastBlock = TftpBlock - 1;
+			if (tftp_mcast_active) { /* start!=1 common if mcast */
+				tftp_prev_block = tftp_cur_block - 1;
 			} else
 #endif
-			if (TftpBlock != 1) {	/* Assertion */
-				printf("\nTFTP error: "
-				       "First block is not block 1 (%ld)\n"
-				       "Starting again\n\n",
-					TftpBlock);
+			if (tftp_cur_block != 1) {	/* Assertion */
+				puts("\nTFTP error: ");
+				printf("First block is not block 1 (%ld)\n",
+				       tftp_cur_block);
+				puts("Starting again\n\n");
 				NetStartAgain();
 				break;
 			}
 		}
 
-		if (TftpBlock == TftpLastBlock) {
-			/*
-			 *	Same block again; ignore it.
-			 */
+		if (tftp_cur_block == tftp_prev_block) {
+			/* Same block again; ignore it. */
 			break;
 		}
 
-		TftpLastBlock = TftpBlock;
-		TftpTimeoutCountMax = TIMEOUT_COUNT;
-		NetSetTimeout(TftpTimeoutMSecs, TftpTimeout);
+		tftp_prev_block = tftp_cur_block;
+		timeout_count_max = TIMEOUT_COUNT;
+		NetSetTimeout(timeout_ms, tftp_timeout_handler);
 
-		store_block(TftpBlock - 1, pkt + 2, len);
+		store_block(tftp_cur_block - 1, pkt + 2, len);
 
 		/*
 		 *	Acknowledge the block just received, which will prompt
@@ -614,39 +613,41 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 		/* if I am the MasterClient, actively calculate what my next
 		 * needed block is; else I'm passive; not ACKING
 		 */
-		if (Multicast) {
-			if (len < TftpBlkSize)  {
-				TftpEndingBlock = TftpBlock;
-			} else if (MasterClient) {
-				TftpBlock = PrevBitmapHole =
-					ext2_find_next_zero_bit(
-						Bitmap,
-						(Mapsize*8),
-						PrevBitmapHole);
-				if (TftpBlock > ((Mapsize*8) - 1)) {
-					printf("tftpfile too big\n");
+		if (tftp_mcast_active) {
+			if (len < tftp_block_size)  {
+				tftp_mcast_ending_block = tftp_cur_block;
+			} else if (tftp_mcast_master_client) {
+				tftp_mcast_prev_hole = ext2_find_next_zero_bit(
+					tftp_mcast_bitmap,
+					tftp_mcast_bitmap_size * 8,
+					tftp_mcast_prev_hole);
+				tftp_cur_block = tftp_mcast_prev_hole;
+				if (tftp_cur_block >
+				    ((tftp_mcast_bitmap_size * 8) - 1)) {
+					debug("tftpfile too big\n");
 					/* try to double it and retry */
-					Mapsize <<= 1;
+					tftp_mcast_bitmap_size <<= 1;
 					mcast_cleanup();
 					NetStartAgain();
 					return;
 				}
-				TftpLastBlock = TftpBlock;
+				tftp_prev_block = tftp_cur_block;
 			}
 		}
 #endif
-		TftpSend();
+		tftp_send();
 
 #ifdef CONFIG_MCAST_TFTP
-		if (Multicast) {
-			if (MasterClient && (TftpBlock >= TftpEndingBlock)) {
+		if (tftp_mcast_active) {
+			if (tftp_mcast_master_client &&
+			    (tftp_cur_block >= tftp_mcast_ending_block)) {
 				puts("\nMulticast tftp done\n");
 				mcast_cleanup();
 				net_set_state(NETLOOP_SUCCESS);
 			}
 		} else
 #endif
-		if (len < TftpBlkSize)
+		if (len < tftp_block_size)
 			tftp_complete();
 		break;
 
@@ -679,21 +680,20 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 }
 
 
-static void
-TftpTimeout(void)
+static void tftp_timeout_handler(void)
 {
-	if (++TftpTimeoutCount > TftpTimeoutCountMax) {
+	if (++timeout_count > timeout_count_max) {
 		restart("Retry count exceeded");
 	} else {
 		puts("T ");
-		NetSetTimeout(TftpTimeoutMSecs, TftpTimeout);
-		if (TftpState != STATE_RECV_WRQ)
-			TftpSend();
+		NetSetTimeout(timeout_ms, tftp_timeout_handler);
+		if (tftp_state != STATE_RECV_WRQ)
+			tftp_send();
 	}
 }
 
 
-void TftpStart(enum proto_t protocol)
+void tftp_start(enum proto_t protocol)
 {
 	char *ep;             /* Environment pointer */
 
@@ -703,21 +703,20 @@ void TftpStart(enum proto_t protocol)
 	 */
 	ep = getenv("tftpblocksize");
 	if (ep != NULL)
-		TftpBlkSizeOption = simple_strtol(ep, NULL, 10);
+		tftp_block_size_option = simple_strtol(ep, NULL, 10);
 
 	ep = getenv("tftptimeout");
 	if (ep != NULL)
-		TftpTimeoutMSecs = simple_strtol(ep, NULL, 10);
+		timeout_ms = simple_strtol(ep, NULL, 10);
 
-	if (TftpTimeoutMSecs < 1000) {
-		printf("TFTP timeout (%ld ms) too low, "
-			"set minimum = 1000 ms\n",
-			TftpTimeoutMSecs);
-		TftpTimeoutMSecs = 1000;
+	if (timeout_ms < 1000) {
+		printf("TFTP timeout (%ld ms) too low, set min = 1000 ms\n",
+		       timeout_ms);
+		timeout_ms = 1000;
 	}
 
 	debug("TFTP blocksize = %i, timeout = %ld ms\n",
-		TftpBlkSizeOption, TftpTimeoutMSecs);
+	      tftp_block_size_option, timeout_ms);
 
 	tftp_remote_ip = net_server_ip;
 	if (net_boot_file_name[0] == '\0') {
@@ -728,20 +727,20 @@ void TftpStart(enum proto_t protocol)
 			(net_ip.s_addr >> 24) & 0xFF);
 
 		strncpy(tftp_filename, default_filename, MAX_LEN);
-		tftp_filename[MAX_LEN-1] = 0;
+		tftp_filename[MAX_LEN - 1] = 0;
 
 		printf("*** Warning: no boot file name; using '%s'\n",
-			tftp_filename);
+		       tftp_filename);
 	} else {
 		char *p = strchr(net_boot_file_name, ':');
 
 		if (p == NULL) {
 			strncpy(tftp_filename, net_boot_file_name, MAX_LEN);
-			tftp_filename[MAX_LEN-1] = 0;
+			tftp_filename[MAX_LEN - 1] = 0;
 		} else {
 			tftp_remote_ip = string_to_ip(net_boot_file_name);
 			strncpy(tftp_filename, p + 1, MAX_LEN);
-			tftp_filename[MAX_LEN-1] = 0;
+			tftp_filename[MAX_LEN - 1] = 0;
 		}
 	}
 
@@ -750,9 +749,9 @@ void TftpStart(enum proto_t protocol)
 #ifdef CONFIG_CMD_TFTPPUT
 	       protocol == TFTPPUT ? "to" : "from",
 #else
-		"from",
+	       "from",
 #endif
-		&tftp_remote_ip, &net_ip);
+	       &tftp_remote_ip, &net_ip);
 
 	/* Check if we need to send across this subnet */
 	if (net_gateway.s_addr && net_netmask.s_addr) {
@@ -776,63 +775,62 @@ void TftpStart(enum proto_t protocol)
 
 	putc('\n');
 #ifdef CONFIG_CMD_TFTPPUT
-	TftpWriting = (protocol == TFTPPUT);
-	if (TftpWriting) {
+	tftp_put_active = (protocol == TFTPPUT);
+	if (tftp_put_active) {
 		printf("Save address: 0x%lx\n", save_addr);
 		printf("Save size:    0x%lx\n", save_size);
 		net_boot_file_size = save_size;
 		puts("Saving: *\b");
-		TftpState = STATE_SEND_WRQ;
+		tftp_state = STATE_SEND_WRQ;
 		new_transfer();
 	} else
 #endif
 	{
 		printf("Load address: 0x%lx\n", load_addr);
 		puts("Loading: *\b");
-		TftpState = STATE_SEND_RRQ;
+		tftp_state = STATE_SEND_RRQ;
 	}
 
 	time_start = get_timer(0);
-	TftpTimeoutCountMax = TftpRRQTimeoutCountMax;
+	timeout_count_max = tftp_timeout_count_max;
 
-	NetSetTimeout(TftpTimeoutMSecs, TftpTimeout);
+	NetSetTimeout(timeout_ms, tftp_timeout_handler);
 	net_set_udp_handler(tftp_handler);
 #ifdef CONFIG_CMD_TFTPPUT
 	net_set_icmp_handler(icmp_handler);
 #endif
-	TftpRemotePort = WELL_KNOWN_PORT;
-	TftpTimeoutCount = 0;
+	tftp_remote_port = WELL_KNOWN_PORT;
+	timeout_count = 0;
 	/* Use a pseudo-random port unless a specific port is set */
-	TftpOurPort = 1024 + (get_timer(0) % 3072);
+	tftp_our_port = 1024 + (get_timer(0) % 3072);
 
 #ifdef CONFIG_TFTP_PORT
 	ep = getenv("tftpdstp");
 	if (ep != NULL)
-		TftpRemotePort = simple_strtol(ep, NULL, 10);
+		tftp_remote_port = simple_strtol(ep, NULL, 10);
 	ep = getenv("tftpsrcp");
 	if (ep != NULL)
-		TftpOurPort = simple_strtol(ep, NULL, 10);
+		tftp_our_port = simple_strtol(ep, NULL, 10);
 #endif
-	TftpBlock = 0;
+	tftp_cur_block = 0;
 
 	/* zero out server ether in case the server ip has changed */
 	memset(net_server_ethaddr, 0, 6);
-	/* Revert TftpBlkSize to dflt */
-	TftpBlkSize = TFTP_BLOCK_SIZE;
+	/* Revert tftp_block_size to dflt */
+	tftp_block_size = TFTP_BLOCK_SIZE;
 #ifdef CONFIG_MCAST_TFTP
 	mcast_cleanup();
 #endif
 #ifdef CONFIG_TFTP_TSIZE
-	TftpTsize = 0;
-	TftpNumchars = 0;
+	tftp_tsize = 0;
+	tftp_tsize_num_hash = 0;
 #endif
 
-	TftpSend();
+	tftp_send();
 }
 
 #ifdef CONFIG_CMD_TFTPSRV
-void
-TftpStartServer(void)
+void tftp_start_server(void)
 {
 	tftp_filename[0] = 0;
 
@@ -842,22 +840,22 @@ TftpStartServer(void)
 
 	puts("Loading: *\b");
 
-	TftpTimeoutCountMax = TIMEOUT_COUNT;
-	TftpTimeoutCount = 0;
-	TftpTimeoutMSecs = TIMEOUT;
-	NetSetTimeout(TftpTimeoutMSecs, TftpTimeout);
+	timeout_count_max = TIMEOUT_COUNT;
+	timeout_count = 0;
+	timeout_ms = TIMEOUT;
+	NetSetTimeout(timeout_ms, tftp_timeout_handler);
 
-	/* Revert TftpBlkSize to dflt */
-	TftpBlkSize = TFTP_BLOCK_SIZE;
-	TftpBlock = 0;
-	TftpOurPort = WELL_KNOWN_PORT;
+	/* Revert tftp_block_size to dflt */
+	tftp_block_size = TFTP_BLOCK_SIZE;
+	tftp_cur_block = 0;
+	tftp_our_port = WELL_KNOWN_PORT;
 
 #ifdef CONFIG_TFTP_TSIZE
-	TftpTsize = 0;
-	TftpNumchars = 0;
+	tftp_tsize = 0;
+	tftp_tsize_num_hash = 0;
 #endif
 
-	TftpState = STATE_RECV_WRQ;
+	tftp_state = STATE_RECV_WRQ;
 	net_set_udp_handler(tftp_handler);
 
 	/* zero out server ether in case the server ip has changed */
@@ -866,10 +864,12 @@ TftpStartServer(void)
 #endif /* CONFIG_CMD_TFTPSRV */
 
 #ifdef CONFIG_MCAST_TFTP
-/* Credits: atftp project.
+/*
+ * Credits: atftp project.
  */
 
-/* pick up BcastAddr, Port, and whether I am [now] the master-client. *
+/*
+ * Pick up BcastAddr, Port, and whether I am [now] the master-client.
  * Frame:
  *    +-------+-----------+---+-------~~-------+---+
  *    |  opc  | multicast | 0 | addr, port, mc | 0 |
@@ -885,58 +885,62 @@ static void parse_multicast_oack(char *pkt, int len)
 {
 	int i;
 	struct in_addr addr;
-	char *mc_adr, *port,  *mc;
+	char *mc_adr;
+	char *port;
+	char *mc;
 
-	mc_adr = port = mc = NULL;
+	mc_adr = NULL;
+	port = NULL;
+	mc = NULL;
 	/* march along looking for 'multicast\0', which has to start at least
 	 * 14 bytes back from the end.
 	 */
-	for (i = 0; i < len-14; i++)
-		if (strcmp(pkt+i, "multicast") == 0)
+	for (i = 0; i < len - 14; i++)
+		if (strcmp(pkt + i, "multicast") == 0)
 			break;
-	if (i >= (len-14)) /* non-Multicast OACK, ign. */
+	if (i >= (len - 14)) /* non-Multicast OACK, ign. */
 		return;
 
 	i += 10; /* strlen multicast */
-	mc_adr = pkt+i;
+	mc_adr = pkt + i;
 	for (; i < len; i++) {
-		if (*(pkt+i) == ',') {
-			*(pkt+i) = '\0';
+		if (*(pkt + i) == ',') {
+			*(pkt + i) = '\0';
 			if (port) {
-				mc = pkt+i+1;
+				mc = pkt + i + 1;
 				break;
 			} else {
-				port = pkt+i+1;
+				port = pkt + i + 1;
 			}
 		}
 	}
 	if (!port || !mc_adr || !mc)
 		return;
-	if (Multicast && MasterClient) {
+	if (tftp_mcast_active && tftp_mcast_master_client) {
 		printf("I got a OACK as master Client, WRONG!\n");
 		return;
 	}
 	/* ..I now accept packets destined for this MCAST addr, port */
-	if (!Multicast) {
-		if (Bitmap) {
+	if (!tftp_mcast_active) {
+		if (tftp_mcast_bitmap) {
 			printf("Internal failure! no mcast.\n");
-			free(Bitmap);
-			Bitmap = NULL;
-			ProhibitMcast = 1;
-			return ;
+			free(tftp_mcast_bitmap);
+			tftp_mcast_bitmap = NULL;
+			tftp_mcast_disabled = 1;
+			return;
 		}
 		/* I malloc instead of pre-declare; so that if the file ends
 		 * up being too big for this bitmap I can retry
 		 */
-		Bitmap = malloc(Mapsize);
-		if (!Bitmap) {
-			printf("No Bitmap, no multicast. Sorry.\n");
-			ProhibitMcast = 1;
+		tftp_mcast_bitmap = malloc(tftp_mcast_bitmap_size);
+		if (!tftp_mcast_bitmap) {
+			printf("No bitmap, no multicast. Sorry.\n");
+			tftp_mcast_disabled = 1;
 			return;
 		}
-		memset(Bitmap, 0, Mapsize);
-		PrevBitmapHole = 0;
-		Multicast = 1;
+		memset(tftp_mcast_bitmap, 0, tftp_mcast_bitmap_size);
+		tftp_mcast_prev_hole = 0;
+		tftp_mcast_active = 1;
 	}
 	addr = string_to_ip(mc_adr);
 	if (net_mcast_addr.s_addr != addr.s_addr) {
@@ -945,14 +949,15 @@ static void parse_multicast_oack(char *pkt, int len)
 		net_mcast_addr = addr;
 		if (eth_mcast_join(net_mcast_addr, 1)) {
 			printf("Fail to set mcast, revert to TFTP\n");
-			ProhibitMcast = 1;
+			tftp_mcast_disabled = 1;
 			mcast_cleanup();
 			NetStartAgain();
 		}
 	}
-	MasterClient = (unsigned char)simple_strtoul((char *)mc, NULL, 10);
-	Mcast_port = (unsigned short)simple_strtoul(port, NULL, 10);
-	printf("Multicast: %s:%d [%d]\n", mc_adr, Mcast_port, MasterClient);
+	tftp_mcast_master_client = simple_strtoul((char *)mc, NULL, 10);
+	tftp_mcast_port = (unsigned short)simple_strtoul(port, NULL, 10);
+	printf("Multicast: %s:%d [%d]\n", mc_adr, tftp_mcast_port,
+	       tftp_mcast_master_client);
 	return;
 }
 
diff --git a/net/tftp.h b/net/tftp.h
index 2b686e3..c411c9b 100644
--- a/net/tftp.h
+++ b/net/tftp.h
@@ -16,14 +16,14 @@
  */
 
 /* tftp.c */
-void TftpStart(enum proto_t protocol);	/* Begin TFTP get/put */
+void tftp_start(enum proto_t protocol);	/* Begin TFTP get/put */
 
 #ifdef CONFIG_CMD_TFTPSRV
-extern void TftpStartServer(void);	/* Wait for incoming TFTP put */
+void tftp_start_server(void);	/* Wait for incoming TFTP put */
 #endif
 
-extern ulong TftpRRQTimeoutMSecs;
-extern int TftpRRQTimeoutCountMax;
+extern ulong tftp_timeout_ms;
+extern int tftp_timeout_count_max;
 
 /**********************************************************************/
 
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH 08/23] net: cosmetic: Clean up ARP variables and functions
  2015-04-03 21:14 [U-Boot] [PATCH 0/23] net: cosmetic: Fix naming and other checkpatch.pl issues in net/ Joe Hershberger
                   ` (6 preceding siblings ...)
  2015-04-03 21:14 ` [U-Boot] [PATCH 07/23] net: cosmetic: Clean up TFTP variables and functions Joe Hershberger
@ 2015-04-03 21:14 ` Joe Hershberger
  2015-04-03 21:14 ` [U-Boot] [PATCH 09/23] net: cosmetic: Clean up DHCP " Joe Hershberger
                   ` (16 subsequent siblings)
  24 siblings, 0 replies; 103+ messages in thread
From: Joe Hershberger @ 2015-04-03 21:14 UTC (permalink / raw)
  To: u-boot

Make a thorough pass through all variables and function names contained
within arp and remove CamelCase and improve naming.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

 net/arp.c  | 69 +++++++++++++++++++++++++++++++-------------------------------
 net/arp.h  | 16 +++++++--------
 net/net.c  | 16 +++++++--------
 net/ping.c |  8 ++++----
 4 files changed, 54 insertions(+), 55 deletions(-)

diff --git a/net/arp.c b/net/arp.c
index 691811d..f64f13d 100644
--- a/net/arp.c
+++ b/net/arp.c
@@ -30,40 +30,40 @@
 struct in_addr net_arp_wait_packet_ip;
 static struct in_addr net_arp_wait_reply_ip;
 /* MAC address of waiting packet's destination */
-uchar	       *NetArpWaitPacketMAC;
-int		NetArpWaitTxPacketSize;
-ulong		NetArpWaitTimerStart;
-int		NetArpWaitTry;
+uchar	       *arp_wait_packet_ethaddr;
+int		arp_wait_tx_packet_size;
+ulong		arp_wait_timer_start;
+int		arp_wait_try;
 
-static uchar   *net_arp_tx_packet;	/* THE ARP transmit packet */
-static uchar	NetArpPacketBuf[PKTSIZE_ALIGN + PKTALIGN];
+static uchar   *arp_tx_packet;	/* THE ARP transmit packet */
+static uchar	arp_tx_packet_buf[PKTSIZE_ALIGN + PKTALIGN];
 
-void ArpInit(void)
+void arp_init(void)
 {
 	/* XXX problem with bss workaround */
-	NetArpWaitPacketMAC = NULL;
+	arp_wait_packet_ethaddr = NULL;
 	net_arp_wait_packet_ip.s_addr = 0;
 	net_arp_wait_reply_ip.s_addr = 0;
-	NetArpWaitTxPacketSize = 0;
-	net_arp_tx_packet = &NetArpPacketBuf[0] + (PKTALIGN - 1);
-	net_arp_tx_packet -= (ulong)net_arp_tx_packet % PKTALIGN;
+	arp_wait_tx_packet_size = 0;
+	arp_tx_packet = &arp_tx_packet_buf[0] + (PKTALIGN - 1);
+	arp_tx_packet -= (ulong)arp_tx_packet % PKTALIGN;
 }
 
-void arp_raw_request(struct in_addr source_ip, const uchar *targetEther,
+void arp_raw_request(struct in_addr source_ip, const uchar *target_ethaddr,
 	struct in_addr target_ip)
 {
 	uchar *pkt;
 	struct arp_hdr *arp;
 	int eth_hdr_size;
 
-	debug_cond(DEBUG_DEV_PKT, "ARP broadcast %d\n", NetArpWaitTry);
+	debug_cond(DEBUG_DEV_PKT, "ARP broadcast %d\n", arp_wait_try);
 
-	pkt = net_arp_tx_packet;
+	pkt = arp_tx_packet;
 
 	eth_hdr_size = net_set_ether(pkt, net_bcast_ethaddr, PROT_ARP);
 	pkt += eth_hdr_size;
 
-	arp = (struct arp_hdr *) pkt;
+	arp = (struct arp_hdr *)pkt;
 
 	arp->ar_hrd = htons(ARP_ETHER);
 	arp->ar_pro = htons(PROT_IP);
@@ -73,13 +73,13 @@ void arp_raw_request(struct in_addr source_ip, const uchar *targetEther,
 
 	memcpy(&arp->ar_sha, net_ethaddr, ARP_HLEN);	/* source ET addr */
 	net_write_ip(&arp->ar_spa, source_ip);		/* source IP addr */
-	memcpy(&arp->ar_tha, targetEther, ARP_HLEN);	/* target ET addr */
+	memcpy(&arp->ar_tha, target_ethaddr, ARP_HLEN);	/* target ET addr */
 	net_write_ip(&arp->ar_tpa, target_ip);		/* target IP addr */
 
-	net_send_packet(net_arp_tx_packet, eth_hdr_size + ARP_HDR_SIZE);
+	net_send_packet(arp_tx_packet, eth_hdr_size + ARP_HDR_SIZE);
 }
 
-void ArpRequest(void)
+void arp_request(void)
 {
 	if ((net_arp_wait_packet_ip.s_addr & net_netmask.s_addr) !=
 	    (net_ip.s_addr & net_netmask.s_addr)) {
@@ -96,7 +96,7 @@ void ArpRequest(void)
 	arp_raw_request(net_ip, net_null_ethaddr, net_arp_wait_reply_ip);
 }
 
-void ArpTimeoutCheck(void)
+void arp_timeout_check(void)
 {
 	ulong t;
 
@@ -106,21 +106,21 @@ void ArpTimeoutCheck(void)
 	t = get_timer(0);
 
 	/* check for arp timeout */
-	if ((t - NetArpWaitTimerStart) > ARP_TIMEOUT) {
-		NetArpWaitTry++;
+	if ((t - arp_wait_timer_start) > ARP_TIMEOUT) {
+		arp_wait_try++;
 
-		if (NetArpWaitTry >= ARP_TIMEOUT_COUNT) {
+		if (arp_wait_try >= ARP_TIMEOUT_COUNT) {
 			puts("\nARP Retry count exceeded; starting again\n");
-			NetArpWaitTry = 0;
+			arp_wait_try = 0;
 			NetStartAgain();
 		} else {
-			NetArpWaitTimerStart = t;
-			ArpRequest();
+			arp_wait_timer_start = t;
+			arp_request();
 		}
 	}
 }
 
-void ArpReceive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
+void arp_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
 {
 	struct arp_hdr *arp;
 	struct in_addr reply_ip_addr;
@@ -205,28 +205,27 @@ void ArpReceive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
 		/* matched waiting packet's address */
 		if (reply_ip_addr.s_addr == net_arp_wait_reply_ip.s_addr) {
 			debug_cond(DEBUG_DEV_PKT,
-				"Got ARP REPLY, set eth addr (%pM)\n",
-				arp->ar_data);
+				   "Got ARP REPLY, set eth addr (%pM)\n",
+				   arp->ar_data);
 
 			/* save address for later use */
-			if (NetArpWaitPacketMAC != NULL)
-				memcpy(NetArpWaitPacketMAC,
+			if (arp_wait_packet_ethaddr != NULL)
+				memcpy(arp_wait_packet_ethaddr,
 				       &arp->ar_sha, ARP_HLEN);
 
 			net_get_arp_handler()((uchar *)arp, 0, reply_ip_addr,
-				0, len);
+					      0, len);
 
 			/* set the mac address in the waiting packet's header
 			   and transmit it */
 			memcpy(((struct ethernet_hdr *)net_tx_packet)->et_dest,
 			       &arp->ar_sha, ARP_HLEN);
-			net_send_packet(net_tx_packet, NetArpWaitTxPacketSize);
+			net_send_packet(net_tx_packet, arp_wait_tx_packet_size);
 
 			/* no arp request pending now */
 			net_arp_wait_packet_ip.s_addr = 0;
-			NetArpWaitTxPacketSize = 0;
-			NetArpWaitPacketMAC = NULL;
-
+			arp_wait_tx_packet_size = 0;
+			arp_wait_packet_ethaddr = NULL;
 		}
 		return;
 	default:
diff --git a/net/arp.h b/net/arp.h
index 718342b..43c6296 100644
--- a/net/arp.h
+++ b/net/arp.h
@@ -16,16 +16,16 @@
 
 extern struct in_addr net_arp_wait_packet_ip;
 /* MAC address of waiting packet's destination */
-extern uchar *NetArpWaitPacketMAC;
-extern int NetArpWaitTxPacketSize;
-extern ulong NetArpWaitTimerStart;
-extern int NetArpWaitTry;
+extern uchar *arp_wait_packet_ethaddr;
+extern int arp_wait_tx_packet_size;
+extern ulong arp_wait_timer_start;
+extern int arp_wait_try;
 
-void ArpInit(void);
-void ArpRequest(void);
+void arp_init(void);
+void arp_request(void);
 void arp_raw_request(struct in_addr source_ip, const uchar *targetEther,
 	struct in_addr target_ip);
-void ArpTimeoutCheck(void);
-void ArpReceive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len);
+void arp_timeout_check(void);
+void arp_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len);
 
 #endif /* __ARP_H__ */
diff --git a/net/net.c b/net/net.c
index e0e0724..71f11cd 100644
--- a/net/net.c
+++ b/net/net.c
@@ -302,7 +302,7 @@ void net_init(void)
 			net_rx_packets[i] = net_tx_packet +
 				(i + 1) * PKTSIZE_ALIGN;
 		}
-		ArpInit();
+		arp_init();
 		net_clear_handlers();
 
 		/* Only need to setup buffer pointers once. */
@@ -495,7 +495,7 @@ restart:
 			goto done;
 		}
 
-		ArpTimeoutCheck();
+		arp_timeout_check();
 
 		/*
 		 *	Check for a timeout, and run the timeout handler
@@ -733,15 +733,15 @@ int net_send_udp_packet(uchar *ether, struct in_addr dest, int dport, int sport,
 
 		/* save the ip and eth addr for the packet to send after arp */
 		net_arp_wait_packet_ip = dest;
-		NetArpWaitPacketMAC = ether;
+		arp_wait_packet_ethaddr = ether;
 
 		/* size of the waiting packet */
-		NetArpWaitTxPacketSize = pkt_hdr_size + payload_len;
+		arp_wait_tx_packet_size = pkt_hdr_size + payload_len;
 
 		/* and do the ARP request */
-		NetArpWaitTry = 1;
-		NetArpWaitTimerStart = get_timer(0);
-		ArpRequest();
+		arp_wait_try = 1;
+		arp_wait_timer_start = get_timer(0);
+		arp_request();
 		return 1;	/* waiting */
 	} else {
 		debug_cond(DEBUG_DEV_PKT, "sending UDP to %pI4/%pM\n",
@@ -1059,7 +1059,7 @@ void net_process_received_packet(uchar *in_packet, int len)
 	switch (eth_proto) {
 
 	case PROT_ARP:
-		ArpReceive(et, ip, len);
+		arp_receive(et, ip, len);
 		break;
 
 #ifdef CONFIG_CMD_RARP
diff --git a/net/ping.c b/net/ping.c
index 7c6084c..76e8749 100644
--- a/net/ping.c
+++ b/net/ping.c
@@ -56,12 +56,12 @@ static int ping_send(void)
 	set_icmp_header(pkt, net_ping_ip);
 
 	/* size of the waiting packet */
-	NetArpWaitTxPacketSize = eth_hdr_size + IP_ICMP_HDR_SIZE;
+	arp_wait_tx_packet_size = eth_hdr_size + IP_ICMP_HDR_SIZE;
 
 	/* and do the ARP request */
-	NetArpWaitTry = 1;
-	NetArpWaitTimerStart = get_timer(0);
-	ArpRequest();
+	arp_wait_try = 1;
+	arp_wait_timer_start = get_timer(0);
+	arp_request();
 	return 1;	/* waiting */
 }
 
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH 09/23] net: cosmetic: Clean up DHCP variables and functions
  2015-04-03 21:14 [U-Boot] [PATCH 0/23] net: cosmetic: Fix naming and other checkpatch.pl issues in net/ Joe Hershberger
                   ` (7 preceding siblings ...)
  2015-04-03 21:14 ` [U-Boot] [PATCH 08/23] net: cosmetic: Clean up ARP " Joe Hershberger
@ 2015-04-03 21:14 ` Joe Hershberger
  2015-04-03 21:14 ` [U-Boot] [PATCH 10/23] net: cosmetic: Clean up NFS " Joe Hershberger
                   ` (15 subsequent siblings)
  24 siblings, 0 replies; 103+ messages in thread
From: Joe Hershberger @ 2015-04-03 21:14 UTC (permalink / raw)
  To: u-boot

Make a thorough pass through all variables and function names contained
within bootp.c and remove CamelCase and improve naming.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

 net/bootp.c | 119 +++++++++++++++++++++++++++++-------------------------------
 net/bootp.h |  14 +++----
 net/net.c   |   8 ++--
 3 files changed, 69 insertions(+), 72 deletions(-)

diff --git a/net/bootp.c b/net/bootp.c
index 9788b52..fa75125 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -53,7 +53,7 @@
 
 ulong		bootp_ids[CONFIG_BOOTP_ID_CACHE_SIZE];
 unsigned int	bootp_num_ids;
-int		BootpTry;
+int		bootp_try;
 ulong		bootp_start;
 ulong		bootp_timeout;
 char net_nis_domain[32] = {0,}; /* Our NIS domain */
@@ -109,14 +109,14 @@ static bool bootp_match_id(ulong id)
 	return false;
 }
 
-static int BootpCheckPkt(uchar *pkt, unsigned dest, unsigned src, unsigned len)
+static int check_packet(uchar *pkt, unsigned dest, unsigned src, unsigned len)
 {
-	struct Bootp_t *bp = (struct Bootp_t *) pkt;
+	struct bootp_hdr *bp = (struct bootp_hdr *)pkt;
 	int retval = 0;
 
 	if (dest != PORT_BOOTPC || src != PORT_BOOTPS)
 		retval = -1;
-	else if (len < sizeof(struct Bootp_t) - OPT_FIELD_SIZE)
+	else if (len < sizeof(struct bootp_hdr) - OPT_FIELD_SIZE)
 		retval = -2;
 	else if (bp->bp_op != OP_BOOTREQUEST &&
 			bp->bp_op != OP_BOOTREPLY &&
@@ -139,7 +139,7 @@ static int BootpCheckPkt(uchar *pkt, unsigned dest, unsigned src, unsigned len)
 /*
  * Copy parameters of interest from BOOTP_REPLY/DHCP_OFFER packet
  */
-static void BootpCopyNetParams(struct Bootp_t *bp)
+static void store_net_params(struct bootp_hdr *bp)
 {
 #if !defined(CONFIG_BOOTP_SERVERIP)
 	struct in_addr tmp_ip;
@@ -177,12 +177,12 @@ static int truncate_sz(const char *name, int maxlen, int curlen)
 
 #if !defined(CONFIG_CMD_DHCP)
 
-static void BootpVendorFieldProcess(u8 *ext)
+static void bootp_process_vendor_field(u8 *ext)
 {
 	int size = *(ext + 1);
 
 	debug("[BOOTP] Processing extension %d... (%d bytes)\n", *ext,
-		*(ext + 1));
+	      *(ext + 1));
 
 	net_boot_file_expected_size_in_blocks = 0;
 
@@ -285,7 +285,7 @@ static void BootpVendorFieldProcess(u8 *ext)
 	}
 }
 
-static void BootpVendorProcess(u8 *ext, int size)
+static void bootp_process_vendor(u8 *ext, int size)
 {
 	u8 *end = ext + size;
 
@@ -299,7 +299,7 @@ static void BootpVendorProcess(u8 *ext, int size)
 
 			ext += ext[1] + 2;
 			if (ext <= end)
-				BootpVendorFieldProcess(opt);
+				bootp_process_vendor_field(opt);
 		}
 	}
 
@@ -335,15 +335,15 @@ static void BootpVendorProcess(u8 *ext, int size)
 static void bootp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 			  unsigned src, unsigned len)
 {
-	struct Bootp_t *bp;
+	struct bootp_hdr *bp;
 
 	debug("got BOOTP packet (src=%d, dst=%d, len=%d want_len=%zu)\n",
-		src, dest, len, sizeof(struct Bootp_t));
+	      src, dest, len, sizeof(struct bootp_hdr));
 
-	bp = (struct Bootp_t *)pkt;
+	bp = (struct bootp_hdr *)pkt;
 
 	/* Filter out pkts we don't want */
-	if (BootpCheckPkt(pkt, dest, src, len))
+	if (check_packet(pkt, dest, src, len))
 		return;
 
 	/*
@@ -353,11 +353,11 @@ static void bootp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 	status_led_set(STATUS_LED_BOOT, STATUS_LED_OFF);
 #endif
 
-	BootpCopyNetParams(bp);		/* Store net parameters from reply */
+	store_net_params(bp);		/* Store net parameters from reply */
 
 	/* Retrieve extended information (we must parse the vendor area) */
 	if (NetReadLong((ulong *)&bp->bp_vend[0]) == htonl(BOOTP_VENDOR_MAGIC))
-		BootpVendorProcess((uchar *)&bp->bp_vend[4], len);
+		bootp_process_vendor((uchar *)&bp->bp_vend[4], len);
 
 	NetSetTimeout(0, (thand_f *)0);
 	bootstage_mark_name(BOOTSTAGE_ID_BOOTP_STOP, "bootp_stop");
@@ -371,8 +371,7 @@ static void bootp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 /*
  *	Timeout on BOOTP/DHCP request.
  */
-static void
-BootpTimeout(void)
+static void bootp_timeout_handler(void)
 {
 	ulong time_taken = get_timer(bootp_start);
 
@@ -388,8 +387,8 @@ BootpTimeout(void)
 		bootp_timeout *= 2;
 		if (bootp_timeout > 2000)
 			bootp_timeout = 2000;
-		NetSetTimeout(bootp_timeout, BootpTimeout);
-		BootpRequest();
+		NetSetTimeout(bootp_timeout, bootp_timeout_handler);
+		bootp_request();
 	}
 }
 
@@ -649,25 +648,24 @@ static int bootp_extended(u8 *e)
 }
 #endif
 
-void BootpReset(void)
+void bootp_reset(void)
 {
 	bootp_num_ids = 0;
-	BootpTry = 0;
+	bootp_try = 0;
 	bootp_start = get_timer(0);
 	bootp_timeout = 250;
 }
 
-void
-BootpRequest(void)
+void bootp_request(void)
 {
 	uchar *pkt, *iphdr;
-	struct Bootp_t *bp;
+	struct bootp_hdr *bp;
 	int extlen, pktlen, iplen;
 	int eth_hdr_size;
 #ifdef CONFIG_BOOTP_RANDOM_DELAY
 	ulong rand_ms;
 #endif
-	ulong BootpID;
+	ulong bootp_id;
 	struct in_addr zero_ip;
 	struct in_addr bcast_ip;
 
@@ -677,11 +675,11 @@ BootpRequest(void)
 #endif
 
 #ifdef CONFIG_BOOTP_RANDOM_DELAY		/* Random BOOTP delay */
-	if (BootpTry == 0)
+	if (bootp_try == 0)
 		srand_mac();
 
-	if (BootpTry <= 2)	/* Start with max 1024 * 1ms */
-		rand_ms = rand() >> (22 - BootpTry);
+	if (bootp_try <= 2)	/* Start with max 1024 * 1ms */
+		rand_ms = rand() >> (22 - bootp_try);
 	else		/* After 3rd BOOTP request max 8192 * 1ms */
 		rand_ms = rand() >> 19;
 
@@ -690,7 +688,7 @@ BootpRequest(void)
 
 #endif	/* CONFIG_BOOTP_RANDOM_DELAY */
 
-	printf("BOOTP broadcast %d\n", ++BootpTry);
+	printf("BOOTP broadcast %d\n", ++bootp_try);
 	pkt = net_tx_packet;
 	memset((void *)pkt, 0, PKTSIZE);
 
@@ -705,11 +703,11 @@ BootpRequest(void)
 	 * C. Hallinan, DS4.COM, Inc.
 	 */
 	/* net_set_udp_header(pkt, 0xFFFFFFFFL, PORT_BOOTPS, PORT_BOOTPC,
-		sizeof (struct Bootp_t)); */
+		sizeof (struct bootp_hdr)); */
 	iphdr = pkt;	/* We need this later for net_set_udp_header() */
 	pkt += IP_UDP_HDR_SIZE;
 
-	bp = (struct Bootp_t *)pkt;
+	bp = (struct bootp_hdr *)pkt;
 	bp->bp_op = OP_BOOTREQUEST;
 	bp->bp_htype = HWT_ETHER;
 	bp->bp_hlen = HWL_ETHER;
@@ -735,14 +733,14 @@ BootpRequest(void)
 	 *	Bootp ID is the lower 4 bytes of our ethernet address
 	 *	plus the current time in ms.
 	 */
-	BootpID = ((ulong)net_ethaddr[2] << 24)
+	bootp_id = ((ulong)net_ethaddr[2] << 24)
 		| ((ulong)net_ethaddr[3] << 16)
 		| ((ulong)net_ethaddr[4] << 8)
 		| (ulong)net_ethaddr[5];
-	BootpID += get_timer(0);
-	BootpID = htonl(BootpID);
-	bootp_add_id(BootpID);
-	NetCopyLong(&bp->bp_id, &BootpID);
+	bootp_id += get_timer(0);
+	bootp_id = htonl(bootp_id);
+	bootp_add_id(bootp_id);
+	NetCopyLong(&bp->bp_id, &bootp_id);
 
 	/*
 	 * Calculate proper packet lengths taking into account the
@@ -752,7 +750,7 @@ BootpRequest(void)
 	pktlen = eth_hdr_size + IP_UDP_HDR_SIZE + iplen;
 	bcast_ip.s_addr = 0xFFFFFFFFL;
 	net_set_udp_header(iphdr, bcast_ip, PORT_BOOTPS, PORT_BOOTPC, iplen);
-	NetSetTimeout(bootp_timeout, BootpTimeout);
+	NetSetTimeout(bootp_timeout, bootp_timeout_handler);
 
 #if defined(CONFIG_CMD_DHCP)
 	dhcp_state = SELECTING;
@@ -764,7 +762,7 @@ BootpRequest(void)
 }
 
 #if defined(CONFIG_CMD_DHCP)
-static void DhcpOptionsProcess(uchar *popt, struct Bootp_t *bp)
+static void dhcp_process_options(uchar *popt, struct bootp_hdr *bp)
 {
 	uchar *end = popt + BOOTP_HDR_SIZE;
 	int oplen, size;
@@ -851,7 +849,7 @@ static void DhcpOptionsProcess(uchar *popt, struct Bootp_t *bp)
 				 * to me
 				 */
 				printf("*** WARNING: using vendor "
-					"optional boot file\n");
+				       "optional boot file\n");
 				memcpy(bp->bp_file, popt + 2, size);
 				bp->bp_file[size] = '\0';
 			}
@@ -862,14 +860,14 @@ static void DhcpOptionsProcess(uchar *popt, struct Bootp_t *bp)
 				break;
 #endif
 			printf("*** Unhandled DHCP Option in OFFER/ACK:"
-				" %d\n", *popt);
+			       " %d\n", *popt);
 			break;
 		}
 		popt += oplen + 2;	/* Process next option */
 	}
 }
 
-static int DhcpMessageType(unsigned char *popt)
+static int dhcp_message_type(unsigned char *popt)
 {
 	if (NetReadLong((ulong *)popt) != htonl(BOOTP_VENDOR_MAGIC))
 		return -1;
@@ -883,17 +881,17 @@ static int DhcpMessageType(unsigned char *popt)
 	return -1;
 }
 
-static void DhcpSendRequestPkt(struct Bootp_t *bp_offer)
+static void dhcp_send_request_packet(struct bootp_hdr *bp_offer)
 {
 	uchar *pkt, *iphdr;
-	struct Bootp_t *bp;
+	struct bootp_hdr *bp;
 	int pktlen, iplen, extlen;
 	int eth_hdr_size;
 	struct in_addr offered_ip;
 	struct in_addr zero_ip;
 	struct in_addr bcast_ip;
 
-	debug("DhcpSendRequestPkt: Sending DHCPREQUEST\n");
+	debug("dhcp_send_request_packet: Sending DHCPREQUEST\n");
 	pkt = net_tx_packet;
 	memset((void *)pkt, 0, PKTSIZE);
 
@@ -903,7 +901,7 @@ static void DhcpSendRequestPkt(struct Bootp_t *bp_offer)
 	iphdr = pkt;	/* We'll need this later to set proper pkt size */
 	pkt += IP_UDP_HDR_SIZE;
 
-	bp = (struct Bootp_t *)pkt;
+	bp = (struct bootp_hdr *)pkt;
 	bp->bp_op = OP_BOOTREQUEST;
 	bp->bp_htype = HWT_ETHER;
 	bp->bp_hlen = HWL_ETHER;
@@ -954,17 +952,17 @@ static void DhcpSendRequestPkt(struct Bootp_t *bp_offer)
 static void dhcp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 			 unsigned src, unsigned len)
 {
-	struct Bootp_t *bp = (struct Bootp_t *)pkt;
+	struct bootp_hdr *bp = (struct bootp_hdr *)pkt;
 
 	debug("DHCPHandler: got packet: (src=%d, dst=%d, len=%d) state: %d\n",
-		src, dest, len, dhcp_state);
+	      src, dest, len, dhcp_state);
 
 	/* Filter out pkts we don't want */
-	if (BootpCheckPkt(pkt, dest, src, len))
+	if (check_packet(pkt, dest, src, len))
 		return;
 
-	debug("DHCPHandler: got DHCP packet: (src=%d, dst=%d, len=%d) state:"
-		" %d\n", src, dest, len, dhcp_state);
+	debug("DHCPHandler: got DHCP packet: (src=%d, dst=%d, len=%d) state: "
+	      "%d\n", src, dest, len, dhcp_state);
 
 	switch (dhcp_state) {
 	case SELECTING:
@@ -986,10 +984,10 @@ static void dhcp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 
 			if (NetReadLong((ulong *)&bp->bp_vend[0]) ==
 						htonl(BOOTP_VENDOR_MAGIC))
-				DhcpOptionsProcess((u8 *)&bp->bp_vend[4], bp);
+				dhcp_process_options((u8 *)&bp->bp_vend[4], bp);
 
-			NetSetTimeout(5000, BootpTimeout);
-			DhcpSendRequestPkt(bp);
+			NetSetTimeout(5000, bootp_timeout_handler);
+			dhcp_send_request_packet(bp);
 #ifdef CONFIG_SYS_BOOTFILE_PREFIX
 		}
 #endif	/* CONFIG_SYS_BOOTFILE_PREFIX */
@@ -999,17 +997,17 @@ static void dhcp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 	case REQUESTING:
 		debug("DHCP State: REQUESTING\n");
 
-		if (DhcpMessageType((u8 *)bp->bp_vend) == DHCP_ACK) {
+		if (dhcp_message_type((u8 *)bp->bp_vend) == DHCP_ACK) {
 			if (NetReadLong((ulong *)&bp->bp_vend[0]) ==
 						htonl(BOOTP_VENDOR_MAGIC))
-				DhcpOptionsProcess((u8 *)&bp->bp_vend[4], bp);
+				dhcp_process_options((u8 *)&bp->bp_vend[4], bp);
 			/* Store net params from reply */
-			BootpCopyNetParams(bp);
+			store_net_params(bp);
 			dhcp_state = BOUND;
 			printf("DHCP client bound to address %pI4 (%lu ms)\n",
-				&net_ip, get_timer(bootp_start));
+			       &net_ip, get_timer(bootp_start));
 			bootstage_mark_name(BOOTSTAGE_ID_BOOTP_STOP,
-				"bootp_stop");
+					    "bootp_stop");
 
 			net_auto_load();
 			return;
@@ -1022,11 +1020,10 @@ static void dhcp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 		puts("DHCP: INVALID STATE\n");
 		break;
 	}
-
 }
 
-void DhcpRequest(void)
+void dhcp_request(void)
 {
-	BootpRequest();
+	bootp_request();
 }
 #endif	/* CONFIG_CMD_DHCP */
diff --git a/net/bootp.h b/net/bootp.h
index 8c591a6..efc2100 100644
--- a/net/bootp.h
+++ b/net/bootp.h
@@ -29,7 +29,7 @@ extern u8 *dhcp_vendorex_proc(u8 *e); /*rtn next e if mine,else NULL  */
 #define OPT_FIELD_SIZE 64
 #endif
 
-struct Bootp_t {
+struct bootp_hdr {
 	uchar		bp_op;		/* Operation			*/
 # define OP_BOOTREQUEST	1
 # define OP_BOOTREPLY	2
@@ -51,7 +51,7 @@ struct Bootp_t {
 	char		bp_vend[OPT_FIELD_SIZE]; /* Vendor information	*/
 };
 
-#define BOOTP_HDR_SIZE	sizeof(struct Bootp_t)
+#define BOOTP_HDR_SIZE	sizeof(struct bootp_hdr)
 
 /**********************************************************************/
 /*
@@ -59,16 +59,16 @@ struct Bootp_t {
  */
 
 /* bootp.c */
-extern ulong	BootpID;		/* ID of cur BOOTP request	*/
-extern int	BootpTry;
+extern ulong	bootp_id;		/* ID of cur BOOTP request	*/
+extern int	bootp_try;
 
 
 /* Send a BOOTP request */
-extern void BootpReset(void);
-extern void BootpRequest(void);
+void bootp_reset(void);
+void bootp_request(void);
 
 /****************** DHCP Support *********************/
-extern void DhcpRequest(void);
+void dhcp_request(void);
 
 /* DHCP States */
 typedef enum { INIT,
diff --git a/net/net.c b/net/net.c
index 71f11cd..721519a 100644
--- a/net/net.c
+++ b/net/net.c
@@ -381,16 +381,16 @@ restart:
 #endif
 #if defined(CONFIG_CMD_DHCP)
 		case DHCP:
-			BootpReset();
+			bootp_reset();
 			net_ip.s_addr = 0;
-			DhcpRequest();		/* Basically same as BOOTP */
+			dhcp_request();		/* Basically same as BOOTP */
 			break;
 #endif
 
 		case BOOTP:
-			BootpReset();
+			bootp_reset();
 			net_ip.s_addr = 0;
-			BootpRequest();
+			bootp_request();
 			break;
 
 #if defined(CONFIG_CMD_RARP)
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH 10/23] net: cosmetic: Clean up NFS variables and functions
  2015-04-03 21:14 [U-Boot] [PATCH 0/23] net: cosmetic: Fix naming and other checkpatch.pl issues in net/ Joe Hershberger
                   ` (8 preceding siblings ...)
  2015-04-03 21:14 ` [U-Boot] [PATCH 09/23] net: cosmetic: Clean up DHCP " Joe Hershberger
@ 2015-04-03 21:14 ` Joe Hershberger
  2015-04-03 21:14 ` [U-Boot] [PATCH 11/23] net: cosmetic: Clean up RARP " Joe Hershberger
                   ` (14 subsequent siblings)
  24 siblings, 0 replies; 103+ messages in thread
From: Joe Hershberger @ 2015-04-03 21:14 UTC (permalink / raw)
  To: u-boot

Make a thorough pass through all variables and function names contained
within nfs.c and remove CamelCase and improve naming.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

 net/net.c |   4 +-
 net/nfs.c | 173 +++++++++++++++++++++++++++-----------------------------------
 net/nfs.h |   2 +-
 3 files changed, 79 insertions(+), 100 deletions(-)

diff --git a/net/net.c b/net/net.c
index 721519a..55b680f 100644
--- a/net/net.c
+++ b/net/net.c
@@ -235,7 +235,7 @@ void net_auto_load(void)
 		/*
 		 * Use NFS to load the bootfile.
 		 */
-		NfsStart();
+		nfs_start();
 		return;
 	}
 #endif
@@ -407,7 +407,7 @@ restart:
 #endif
 #if defined(CONFIG_CMD_NFS)
 		case NFS:
-			NfsStart();
+			nfs_start();
 			break;
 #endif
 #if defined(CONFIG_CMD_CDP)
diff --git a/net/nfs.c b/net/nfs.c
index 6899265..4357cc3 100644
--- a/net/nfs.c
+++ b/net/nfs.c
@@ -52,11 +52,11 @@ static char filefh[NFS_FHSIZE]; /* file handle of kernel image */
 
 static enum net_loop_state nfs_download_state;
 static struct in_addr nfs_server_ip;
-static int	NfsSrvMountPort;
-static int	NfsSrvNfsPort;
-static int	NfsOurPort;
-static int	NfsTimeoutCount;
-static int	NfsState;
+static int nfs_server_mount_port;
+static int nfs_server_port;
+static int nfs_our_port;
+static int nfs_timeout_count;
+static int nfs_state;
 #define STATE_PRCLOOKUP_PROG_MOUNT_REQ	1
 #define STATE_PRCLOOKUP_PROG_NFS_REQ	2
 #define STATE_MOUNT_REQ			3
@@ -70,8 +70,7 @@ static char *nfs_filename;
 static char *nfs_path;
 static char nfs_path_buff[2048];
 
-static inline int
-store_block(uchar *src, unsigned offset, unsigned len)
+static inline int store_block(uchar *src, unsigned offset, unsigned len)
 {
 	ulong newsize = offset + len;
 #ifdef CONFIG_SYS_DIRECT_FLASH_NFS
@@ -105,8 +104,7 @@ store_block(uchar *src, unsigned offset, unsigned len)
 	return 0;
 }
 
-static char*
-basename(char *path)
+static char *basename(char *path)
 {
 	char *fname;
 
@@ -121,8 +119,7 @@ basename(char *path)
 	return fname;
 }
 
-static char*
-dirname(char *path)
+static char *dirname(char *path)
 {
 	char *fname;
 
@@ -178,8 +175,7 @@ static long *rpc_add_credentials(long *p)
 /**************************************************************************
 RPC_LOOKUP - Lookup RPC Port numbers
 **************************************************************************/
-static void
-rpc_req(int rpc_prog, int rpc_proc, uint32_t *data, int datalen)
+static void rpc_req(int rpc_prog, int rpc_proc, uint32_t *data, int datalen)
 {
 	struct rpc_t pkt;
 	unsigned long id;
@@ -207,19 +203,18 @@ rpc_req(int rpc_prog, int rpc_proc, uint32_t *data, int datalen)
 	if (rpc_prog == PROG_PORTMAP)
 		sport = SUNRPC_PORT;
 	else if (rpc_prog == PROG_MOUNT)
-		sport = NfsSrvMountPort;
+		sport = nfs_server_mount_port;
 	else
-		sport = NfsSrvNfsPort;
+		sport = nfs_server_port;
 
 	net_send_udp_packet(net_server_ethaddr, nfs_server_ip, sport,
-			    NfsOurPort, pktlen);
+			    nfs_our_port, pktlen);
 }
 
 /**************************************************************************
 RPC_LOOKUP - Lookup RPC Port numbers
 **************************************************************************/
-static void
-rpc_lookup_req(int prog, int ver)
+static void rpc_lookup_req(int prog, int ver)
 {
 	uint32_t data[16];
 
@@ -236,8 +231,7 @@ rpc_lookup_req(int prog, int ver)
 /**************************************************************************
 NFS_MOUNT - Mount an NFS Filesystem
 **************************************************************************/
-static void
-nfs_mount_req(char *path)
+static void nfs_mount_req(char *path)
 {
 	uint32_t data[1024];
 	uint32_t *p;
@@ -263,14 +257,13 @@ nfs_mount_req(char *path)
 /**************************************************************************
 NFS_UMOUNTALL - Unmount all our NFS Filesystems on the Server
 **************************************************************************/
-static void
-nfs_umountall_req(void)
+static void nfs_umountall_req(void)
 {
 	uint32_t data[1024];
 	uint32_t *p;
 	int len;
 
-	if ((NfsSrvMountPort == -1) || (!fs_mounted))
+	if ((nfs_server_mount_port == -1) || (!fs_mounted))
 		/* Nothing mounted, nothing to umount */
 		return;
 
@@ -289,8 +282,7 @@ nfs_umountall_req(void)
  * In case of successful readlink(), the dirname is manipulated,
  * so that inside the nfs() function a recursion can be done.
  **************************************************************************/
-static void
-nfs_readlink_req(void)
+static void nfs_readlink_req(void)
 {
 	uint32_t data[1024];
 	uint32_t *p;
@@ -310,8 +302,7 @@ nfs_readlink_req(void)
 /**************************************************************************
 NFS_LOOKUP - Lookup Pathname
 **************************************************************************/
-static void
-nfs_lookup_req(char *fname)
+static void nfs_lookup_req(char *fname)
 {
 	uint32_t data[1024];
 	uint32_t *p;
@@ -339,8 +330,7 @@ nfs_lookup_req(char *fname)
 /**************************************************************************
 NFS_READ - Read File on NFS Server
 **************************************************************************/
-static void
-nfs_read_req(int offset, int readlen)
+static void nfs_read_req(int offset, int readlen)
 {
 	uint32_t data[1024];
 	uint32_t *p;
@@ -363,13 +353,11 @@ nfs_read_req(int offset, int readlen)
 /**************************************************************************
 RPC request dispatcher
 **************************************************************************/
-
-static void
-NfsSend(void)
+static void nfs_send(void)
 {
 	debug("%s\n", __func__);
 
-	switch (NfsState) {
+	switch (nfs_state) {
 	case STATE_PRCLOOKUP_PROG_MOUNT_REQ:
 		rpc_lookup_req(PROG_MOUNT, 1);
 		break;
@@ -398,8 +386,7 @@ NfsSend(void)
 Handlers for the reply from server
 **************************************************************************/
 
-static int
-rpc_lookup_reply(int prog, uchar *pkt, unsigned len)
+static int rpc_lookup_reply(int prog, uchar *pkt, unsigned len)
 {
 	struct rpc_t rpc_pkt;
 
@@ -419,18 +406,17 @@ rpc_lookup_reply(int prog, uchar *pkt, unsigned len)
 
 	switch (prog) {
 	case PROG_MOUNT:
-		NfsSrvMountPort = ntohl(rpc_pkt.u.reply.data[0]);
+		nfs_server_mount_port = ntohl(rpc_pkt.u.reply.data[0]);
 		break;
 	case PROG_NFS:
-		NfsSrvNfsPort = ntohl(rpc_pkt.u.reply.data[0]);
+		nfs_server_port = ntohl(rpc_pkt.u.reply.data[0]);
 		break;
 	}
 
 	return 0;
 }
 
-static int
-nfs_mount_reply(uchar *pkt, unsigned len)
+static int nfs_mount_reply(uchar *pkt, unsigned len)
 {
 	struct rpc_t rpc_pkt;
 
@@ -455,8 +441,7 @@ nfs_mount_reply(uchar *pkt, unsigned len)
 	return 0;
 }
 
-static int
-nfs_umountall_reply(uchar *pkt, unsigned len)
+static int nfs_umountall_reply(uchar *pkt, unsigned len)
 {
 	struct rpc_t rpc_pkt;
 
@@ -480,8 +465,7 @@ nfs_umountall_reply(uchar *pkt, unsigned len)
 	return 0;
 }
 
-static int
-nfs_lookup_reply(uchar *pkt, unsigned len)
+static int nfs_lookup_reply(uchar *pkt, unsigned len)
 {
 	struct rpc_t rpc_pkt;
 
@@ -505,8 +489,7 @@ nfs_lookup_reply(uchar *pkt, unsigned len)
 	return 0;
 }
 
-static int
-nfs_readlink_reply(uchar *pkt, unsigned len)
+static int nfs_readlink_reply(uchar *pkt, unsigned len)
 {
 	struct rpc_t rpc_pkt;
 	int rlen;
@@ -533,7 +516,7 @@ nfs_readlink_reply(uchar *pkt, unsigned len)
 		strcat(nfs_path, "/");
 		pathlen = strlen(nfs_path);
 		memcpy(nfs_path + pathlen, (uchar *)&(rpc_pkt.u.reply.data[2]),
-			rlen);
+		       rlen);
 		nfs_path[pathlen + rlen] = 0;
 	} else {
 		memcpy(nfs_path, (uchar *)&(rpc_pkt.u.reply.data[2]), rlen);
@@ -542,8 +525,7 @@ nfs_readlink_reply(uchar *pkt, unsigned len)
 	return 0;
 }
 
-static int
-nfs_read_reply(uchar *pkt, unsigned len)
+static int nfs_read_reply(uchar *pkt, unsigned len)
 {
 	struct rpc_t rpc_pkt;
 	int rlen;
@@ -585,18 +567,16 @@ nfs_read_reply(uchar *pkt, unsigned len)
 /**************************************************************************
 Interfaces of U-BOOT
 **************************************************************************/
-
-static void
-NfsTimeout(void)
+static void nfs_timeout_handler(void)
 {
-	if (++NfsTimeoutCount > NFS_RETRY_COUNT) {
+	if (++nfs_timeout_count > NFS_RETRY_COUNT) {
 		puts("\nRetry count exceeded; starting again\n");
 		NetStartAgain();
 	} else {
 		puts("T ");
-		NetSetTimeout(nfs_timeout + NFS_TIMEOUT * NfsTimeoutCount,
-			      NfsTimeout);
-		NfsSend();
+		NetSetTimeout(nfs_timeout + NFS_TIMEOUT * nfs_timeout_count,
+			      nfs_timeout_handler);
+		nfs_send();
 	}
 }
 
@@ -608,44 +588,44 @@ static void nfs_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 
 	debug("%s\n", __func__);
 
-	if (dest != NfsOurPort)
+	if (dest != nfs_our_port)
 		return;
 
-	switch (NfsState) {
+	switch (nfs_state) {
 	case STATE_PRCLOOKUP_PROG_MOUNT_REQ:
 		if (rpc_lookup_reply(PROG_MOUNT, pkt, len) == -NFS_RPC_DROP)
 			break;
-		NfsState = STATE_PRCLOOKUP_PROG_NFS_REQ;
-		NfsSend();
+		nfs_state = STATE_PRCLOOKUP_PROG_NFS_REQ;
+		nfs_send();
 		break;
 
 	case STATE_PRCLOOKUP_PROG_NFS_REQ:
 		if (rpc_lookup_reply(PROG_NFS, pkt, len) == -NFS_RPC_DROP)
 			break;
-		NfsState = STATE_MOUNT_REQ;
-		NfsSend();
+		nfs_state = STATE_MOUNT_REQ;
+		nfs_send();
 		break;
 
 	case STATE_MOUNT_REQ:
 		reply = nfs_mount_reply(pkt, len);
-		if (reply == -NFS_RPC_DROP)
+		if (reply == -NFS_RPC_DROP) {
 			break;
-		else if (reply == -NFS_RPC_ERR) {
+		} else if (reply == -NFS_RPC_ERR) {
 			puts("*** ERROR: Cannot mount\n");
 			/* just to be sure... */
-			NfsState = STATE_UMOUNT_REQ;
-			NfsSend();
+			nfs_state = STATE_UMOUNT_REQ;
+			nfs_send();
 		} else {
-			NfsState = STATE_LOOKUP_REQ;
-			NfsSend();
+			nfs_state = STATE_LOOKUP_REQ;
+			nfs_send();
 		}
 		break;
 
 	case STATE_UMOUNT_REQ:
 		reply = nfs_umountall_reply(pkt, len);
-		if (reply == -NFS_RPC_DROP)
+		if (reply == -NFS_RPC_DROP) {
 			break;
-		else if (reply == -NFS_RPC_ERR) {
+		} else if (reply == -NFS_RPC_ERR) {
 			puts("*** ERROR: Cannot umount\n");
 			net_set_state(NETLOOP_FAIL);
 		} else {
@@ -656,61 +636,60 @@ static void nfs_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 
 	case STATE_LOOKUP_REQ:
 		reply = nfs_lookup_reply(pkt, len);
-		if (reply == -NFS_RPC_DROP)
+		if (reply == -NFS_RPC_DROP) {
 			break;
-		else if (reply == -NFS_RPC_ERR) {
+		} else if (reply == -NFS_RPC_ERR) {
 			puts("*** ERROR: File lookup fail\n");
-			NfsState = STATE_UMOUNT_REQ;
-			NfsSend();
+			nfs_state = STATE_UMOUNT_REQ;
+			nfs_send();
 		} else {
-			NfsState = STATE_READ_REQ;
+			nfs_state = STATE_READ_REQ;
 			nfs_offset = 0;
 			nfs_len = NFS_READ_SIZE;
-			NfsSend();
+			nfs_send();
 		}
 		break;
 
 	case STATE_READLINK_REQ:
 		reply = nfs_readlink_reply(pkt, len);
-		if (reply == -NFS_RPC_DROP)
+		if (reply == -NFS_RPC_DROP) {
 			break;
-		else if (reply == -NFS_RPC_ERR) {
+		} else if (reply == -NFS_RPC_ERR) {
 			puts("*** ERROR: Symlink fail\n");
-			NfsState = STATE_UMOUNT_REQ;
-			NfsSend();
+			nfs_state = STATE_UMOUNT_REQ;
+			nfs_send();
 		} else {
 			debug("Symlink --> %s\n", nfs_path);
 			nfs_filename = basename(nfs_path);
 			nfs_path     = dirname(nfs_path);
 
-			NfsState = STATE_MOUNT_REQ;
-			NfsSend();
+			nfs_state = STATE_MOUNT_REQ;
+			nfs_send();
 		}
 		break;
 
 	case STATE_READ_REQ:
 		rlen = nfs_read_reply(pkt, len);
-		NetSetTimeout(nfs_timeout, NfsTimeout);
+		NetSetTimeout(nfs_timeout, nfs_timeout_handler);
 		if (rlen > 0) {
 			nfs_offset += rlen;
-			NfsSend();
+			nfs_send();
 		} else if ((rlen == -NFSERR_ISDIR) || (rlen == -NFSERR_INVAL)) {
 			/* symbolic link */
-			NfsState = STATE_READLINK_REQ;
-			NfsSend();
+			nfs_state = STATE_READLINK_REQ;
+			nfs_send();
 		} else {
 			if (!rlen)
 				nfs_download_state = NETLOOP_SUCCESS;
-			NfsState = STATE_UMOUNT_REQ;
-			NfsSend();
+			nfs_state = STATE_UMOUNT_REQ;
+			nfs_send();
 		}
 		break;
 	}
 }
 
 
-void
-NfsStart(void)
+void nfs_start(void)
 {
 	debug("%s\n", __func__);
 	nfs_download_state = NETLOOP_FAIL;
@@ -733,7 +712,7 @@ NfsStart(void)
 		strcpy(nfs_path, default_filename);
 
 		printf("*** Warning: no boot file name; using '%s'\n",
-			nfs_path);
+		       nfs_path);
 	} else {
 		char *p = net_boot_file_name;
 
@@ -765,7 +744,7 @@ NfsStart(void)
 		server_net.s_addr = net_server_ip.s_addr & net_netmask.s_addr;
 		if (our_net.s_addr != server_net.s_addr)
 			printf("; sending through gateway %pI4",
-				&net_gateway);
+			       &net_gateway);
 	}
 	printf("\nFilename '%s/%s'.", nfs_path, nfs_filename);
 
@@ -777,18 +756,18 @@ NfsStart(void)
 	printf("\nLoad address: 0x%lx\n"
 		"Loading: *\b", load_addr);
 
-	NetSetTimeout(nfs_timeout, NfsTimeout);
+	NetSetTimeout(nfs_timeout, nfs_timeout_handler);
 	net_set_udp_handler(nfs_handler);
 
-	NfsTimeoutCount = 0;
-	NfsState = STATE_PRCLOOKUP_PROG_MOUNT_REQ;
+	nfs_timeout_count = 0;
+	nfs_state = STATE_PRCLOOKUP_PROG_MOUNT_REQ;
 
-	/*NfsOurPort = 4096 + (get_ticks() % 3072);*/
+	/*nfs_our_port = 4096 + (get_ticks() % 3072);*/
 	/*FIX ME !!!*/
-	NfsOurPort = 1000;
+	nfs_our_port = 1000;
 
 	/* zero out server ether in case the server ip has changed */
 	memset(net_server_ethaddr, 0, 6);
 
-	NfsSend();
+	nfs_send();
 }
diff --git a/net/nfs.h b/net/nfs.h
index 53451db..d69b422 100644
--- a/net/nfs.h
+++ b/net/nfs.h
@@ -69,7 +69,7 @@ struct rpc_t {
 		} reply;
 	} u;
 };
-extern void NfsStart(void);	/* Begin NFS */
+void nfs_start(void);	/* Begin NFS */
 
 
 /**********************************************************************/
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH 11/23] net: cosmetic: Clean up RARP variables and functions
  2015-04-03 21:14 [U-Boot] [PATCH 0/23] net: cosmetic: Fix naming and other checkpatch.pl issues in net/ Joe Hershberger
                   ` (9 preceding siblings ...)
  2015-04-03 21:14 ` [U-Boot] [PATCH 10/23] net: cosmetic: Clean up NFS " Joe Hershberger
@ 2015-04-03 21:14 ` Joe Hershberger
  2015-04-03 21:14 ` [U-Boot] [PATCH 12/23] net: cosmetic: Clean up SNTP " Joe Hershberger
                   ` (13 subsequent siblings)
  24 siblings, 0 replies; 103+ messages in thread
From: Joe Hershberger @ 2015-04-03 21:14 UTC (permalink / raw)
  To: u-boot

Make a thorough pass through all variables and function names contained
within rarp.c and remove CamelCase and improve naming.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

 net/net.c  |  4 ++--
 net/rarp.c | 23 +++++++++++------------
 net/rarp.h |  6 +++---
 3 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/net/net.c b/net/net.c
index 55b680f..bf7fdfc 100644
--- a/net/net.c
+++ b/net/net.c
@@ -395,9 +395,9 @@ restart:
 
 #if defined(CONFIG_CMD_RARP)
 		case RARP:
-			RarpTry = 0;
+			rarp_try = 0;
 			net_ip.s_addr = 0;
-			RarpRequest();
+			rarp_request();
 			break;
 #endif
 #if defined(CONFIG_CMD_PING)
diff --git a/net/rarp.c b/net/rarp.c
index 7e7d0aa..2b983cc 100644
--- a/net/rarp.c
+++ b/net/rarp.c
@@ -20,7 +20,7 @@
 #define TIMEOUT_COUNT (CONFIG_NET_RETRY_COUNT)
 #endif
 
-int RarpTry;
+int rarp_try;
 
 /*
  *	Handle a RARP received packet.
@@ -37,10 +37,9 @@ void rarp_receive(struct ip_udp_hdr *ip, unsigned len)
 	}
 
 	if ((ntohs(arp->ar_op) != RARPOP_REPLY) ||
-		(ntohs(arp->ar_hrd) != ARP_ETHER)   ||
-		(ntohs(arp->ar_pro) != PROT_IP)     ||
-		(arp->ar_hln != 6) || (arp->ar_pln != 4)) {
-
+	    (ntohs(arp->ar_hrd) != ARP_ETHER)   ||
+	    (ntohs(arp->ar_pro) != PROT_IP)     ||
+	    (arp->ar_hln != 6) || (arp->ar_pln != 4)) {
 		puts("invalid RARP header\n");
 	} else {
 		net_copy_ip(&net_ip, &arp->ar_data[16]);
@@ -56,25 +55,25 @@ void rarp_receive(struct ip_udp_hdr *ip, unsigned len)
 /*
  *	Timeout on BOOTP request.
  */
-static void RarpTimeout(void)
+static void rarp_timeout_handler(void)
 {
-	if (RarpTry >= TIMEOUT_COUNT) {
+	if (rarp_try >= TIMEOUT_COUNT) {
 		puts("\nRetry count exceeded; starting again\n");
 		NetStartAgain();
 	} else {
-		NetSetTimeout(TIMEOUT, RarpTimeout);
-		RarpRequest();
+		NetSetTimeout(TIMEOUT, rarp_timeout_handler);
+		rarp_request();
 	}
 }
 
 
-void RarpRequest(void)
+void rarp_request(void)
 {
 	uchar *pkt;
 	struct arp_hdr *rarp;
 	int eth_hdr_size;
 
-	printf("RARP broadcast %d\n", ++RarpTry);
+	printf("RARP broadcast %d\n", ++rarp_try);
 	pkt = net_tx_packet;
 
 	eth_hdr_size = net_set_ether(pkt, net_bcast_ethaddr, PROT_RARP);
@@ -96,5 +95,5 @@ void RarpRequest(void)
 
 	net_send_packet(net_tx_packet, eth_hdr_size + ARP_HDR_SIZE);
 
-	NetSetTimeout(TIMEOUT, RarpTimeout);
+	NetSetTimeout(TIMEOUT, rarp_timeout_handler);
 }
diff --git a/net/rarp.h b/net/rarp.h
index 93e1889..1ca8833 100644
--- a/net/rarp.h
+++ b/net/rarp.h
@@ -17,11 +17,11 @@
  *	Global functions and variables.
  */
 
-extern int RarpTry;
+extern int rarp_try;
 
 /* Process the receipt of a RARP packet */
-extern void rarp_receive(struct ip_udp_hdr *ip, unsigned len);
-extern void RarpRequest(void);	/* Send a RARP request */
+void rarp_receive(struct ip_udp_hdr *ip, unsigned len);
+void rarp_request(void);	/* Send a RARP request */
 
 /**********************************************************************/
 
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH 12/23] net: cosmetic: Clean up SNTP variables and functions
  2015-04-03 21:14 [U-Boot] [PATCH 0/23] net: cosmetic: Fix naming and other checkpatch.pl issues in net/ Joe Hershberger
                   ` (10 preceding siblings ...)
  2015-04-03 21:14 ` [U-Boot] [PATCH 11/23] net: cosmetic: Clean up RARP " Joe Hershberger
@ 2015-04-03 21:14 ` Joe Hershberger
  2015-04-03 21:14 ` [U-Boot] [PATCH 13/23] net: cosmetic: Clean up ping " Joe Hershberger
                   ` (12 subsequent siblings)
  24 siblings, 0 replies; 103+ messages in thread
From: Joe Hershberger @ 2015-04-03 21:14 UTC (permalink / raw)
  To: u-boot

Make a thorough pass through all variables and function names contained
within sntp.c and remove CamelCase and improve naming.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

 net/net.c  |  2 +-
 net/sntp.c | 25 +++++++++++--------------
 net/sntp.h |  2 +-
 3 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/net/net.c b/net/net.c
index bf7fdfc..71baf35 100644
--- a/net/net.c
+++ b/net/net.c
@@ -422,7 +422,7 @@ restart:
 #endif
 #if defined(CONFIG_CMD_SNTP)
 		case SNTP:
-			SntpStart();
+			sntp_start();
 			break;
 #endif
 #if defined(CONFIG_CMD_DNS)
diff --git a/net/sntp.c b/net/sntp.c
index 1e2b678..8073ca6 100644
--- a/net/sntp.c
+++ b/net/sntp.c
@@ -14,10 +14,9 @@
 
 #define SNTP_TIMEOUT 10000UL
 
-static int SntpOurPort;
+static int sntp_our_port;
 
-static void
-SntpSend(void)
+static void sntp_send(void)
 {
 	struct sntp_pkt_t pkt;
 	int pktlen = SNTP_PACKET_LEN;
@@ -34,15 +33,14 @@ SntpSend(void)
 	memcpy((char *)net_tx_packet + net_eth_hdr_size() + IP_UDP_HDR_SIZE,
 	       (char *)&pkt, pktlen);
 
-	SntpOurPort = 10000 + (get_timer(0) % 4096);
+	sntp_our_port = 10000 + (get_timer(0) % 4096);
 	sport = NTP_SERVICE_PORT;
 
 	net_send_udp_packet(net_server_ethaddr, net_ntp_server, sport,
-			    SntpOurPort, pktlen);
+			    sntp_our_port, pktlen);
 }
 
-static void
-SntpTimeout(void)
+static void sntp_timeout_handler(void)
 {
 	puts("Timeout\n");
 	net_set_state(NETLOOP_FAIL);
@@ -58,7 +56,7 @@ static void sntp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 
 	debug("%s\n", __func__);
 
-	if (dest != SntpOurPort)
+	if (dest != sntp_our_port)
 		return;
 
 	/*
@@ -72,20 +70,19 @@ static void sntp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 	rtc_set(&tm);
 #endif
 	printf("Date: %4d-%02d-%02d Time: %2d:%02d:%02d\n",
-		tm.tm_year, tm.tm_mon, tm.tm_mday,
-		tm.tm_hour, tm.tm_min, tm.tm_sec);
+	       tm.tm_year, tm.tm_mon, tm.tm_mday,
+	       tm.tm_hour, tm.tm_min, tm.tm_sec);
 
 	net_set_state(NETLOOP_SUCCESS);
 }
 
-void
-SntpStart(void)
+void sntp_start(void)
 {
 	debug("%s\n", __func__);
 
-	NetSetTimeout(SNTP_TIMEOUT, SntpTimeout);
+	NetSetTimeout(SNTP_TIMEOUT, sntp_timeout_handler);
 	net_set_udp_handler(sntp_handler);
 	memset(net_server_ethaddr, 0, sizeof(net_server_ethaddr));
 
-	SntpSend();
+	sntp_send();
 }
diff --git a/net/sntp.h b/net/sntp.h
index bf5bf0b..6a9c6bb 100644
--- a/net/sntp.h
+++ b/net/sntp.h
@@ -53,6 +53,6 @@ struct sntp_pkt_t {
 	unsigned long long transmit_timestamp;
 };
 
-extern void SntpStart(void);	/* Begin SNTP */
+void sntp_start(void);	/* Begin SNTP */
 
 #endif /* __SNTP_H__ */
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH 13/23] net: cosmetic: Clean up ping variables and functions
  2015-04-03 21:14 [U-Boot] [PATCH 0/23] net: cosmetic: Fix naming and other checkpatch.pl issues in net/ Joe Hershberger
                   ` (11 preceding siblings ...)
  2015-04-03 21:14 ` [U-Boot] [PATCH 12/23] net: cosmetic: Clean up SNTP " Joe Hershberger
@ 2015-04-03 21:14 ` Joe Hershberger
  2015-04-03 21:14 ` [U-Boot] [PATCH 14/23] net: cosmetic: Clean up CDP " Joe Hershberger
                   ` (11 subsequent siblings)
  24 siblings, 0 replies; 103+ messages in thread
From: Joe Hershberger @ 2015-04-03 21:14 UTC (permalink / raw)
  To: u-boot

Make a thorough pass through all variables and function names contained
within ping.c and remove CamelCase and improve naming.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

 net/ping.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/net/ping.c b/net/ping.c
index 76e8749..87da555 100644
--- a/net/ping.c
+++ b/net/ping.c
@@ -12,7 +12,7 @@
 #include "ping.h"
 #include "arp.h"
 
-static ushort PingSeqNo;
+static ushort ping_seq_number;
 
 /* The ip address to ping */
 struct in_addr net_ping_ip;
@@ -35,7 +35,7 @@ static void set_icmp_header(uchar *pkt, struct in_addr dest)
 	icmp->code = 0;
 	icmp->checksum = 0;
 	icmp->un.echo.id = 0;
-	icmp->un.echo.sequence = htons(PingSeqNo++);
+	icmp->un.echo.sequence = htons(ping_seq_number++);
 	icmp->checksum = compute_ip_checksum(icmp, ICMP_HDR_SIZE);
 }
 
@@ -65,7 +65,7 @@ static int ping_send(void)
 	return 1;	/* waiting */
 }
 
-static void ping_timeout(void)
+static void ping_timeout_handler(void)
 {
 	eth_halt();
 	net_set_state(NETLOOP_FAIL);	/* we did not get the reply */
@@ -74,7 +74,7 @@ static void ping_timeout(void)
 void ping_start(void)
 {
 	printf("Using %s device\n", eth_get_name());
-	NetSetTimeout(10000UL, ping_timeout);
+	NetSetTimeout(10000UL, ping_timeout_handler);
 
 	ping_send();
 }
@@ -94,8 +94,9 @@ void ping_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
 	case ICMP_ECHO_REQUEST:
 		eth_hdr_size = net_update_ether(et, et->et_src, PROT_IP);
 
-		debug_cond(DEBUG_DEV_PKT, "Got ICMP ECHO REQUEST, return "
-			"%d bytes\n", eth_hdr_size + len);
+		debug_cond(DEBUG_DEV_PKT,
+			   "Got ICMP ECHO REQUEST, return %d bytes\n",
+			   eth_hdr_size + len);
 
 		ip->ip_sum = 0;
 		ip->ip_off = 0;
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH 14/23] net: cosmetic: Clean up CDP variables and functions
  2015-04-03 21:14 [U-Boot] [PATCH 0/23] net: cosmetic: Fix naming and other checkpatch.pl issues in net/ Joe Hershberger
                   ` (12 preceding siblings ...)
  2015-04-03 21:14 ` [U-Boot] [PATCH 13/23] net: cosmetic: Clean up ping " Joe Hershberger
@ 2015-04-03 21:14 ` Joe Hershberger
  2015-04-03 21:14 ` [U-Boot] [PATCH 15/23] net: cosmetic: Clean up DNS " Joe Hershberger
                   ` (10 subsequent siblings)
  24 siblings, 0 replies; 103+ messages in thread
From: Joe Hershberger @ 2015-04-03 21:14 UTC (permalink / raw)
  To: u-boot

Make a thorough pass through all variables and function names contained
within cdp.c and remove CamelCase and improve naming.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

 common/cmd_net.c | 17 +++++++-------
 include/net.h    |  4 ++--
 net/cdp.c        | 70 ++++++++++++++++++++++++++------------------------------
 net/cdp.h        |  2 +-
 net/net.c        |  2 +-
 5 files changed, 46 insertions(+), 49 deletions(-)

diff --git a/common/cmd_net.c b/common/cmd_net.c
index 290c0c5..0ade0f8 100644
--- a/common/cmd_net.c
+++ b/common/cmd_net.c
@@ -290,18 +290,19 @@ static void cdp_update_env(void)
 {
 	char tmp[16];
 
-	if (CDPApplianceVLAN != htons(-1)) {
-		printf("CDP offered appliance VLAN %d\n", ntohs(CDPApplianceVLAN));
-		VLAN_to_string(CDPApplianceVLAN, tmp);
+	if (cdp_appliance_vlan != htons(-1)) {
+		printf("CDP offered appliance VLAN %d\n",
+		       ntohs(cdp_appliance_vlan));
+		VLAN_to_string(cdp_appliance_vlan, tmp);
 		setenv("vlan", tmp);
-		NetOurVLAN = CDPApplianceVLAN;
+		NetOurVLAN = cdp_appliance_vlan;
 	}
 
-	if (CDPNativeVLAN != htons(-1)) {
-		printf("CDP offered native VLAN %d\n", ntohs(CDPNativeVLAN));
-		VLAN_to_string(CDPNativeVLAN, tmp);
+	if (cdp_native_vlan != htons(-1)) {
+		printf("CDP offered native VLAN %d\n", ntohs(cdp_native_vlan));
+		VLAN_to_string(cdp_native_vlan, tmp);
 		setenv("nvlan", tmp);
-		NetOurNativeVLAN = CDPNativeVLAN;
+		NetOurNativeVLAN = cdp_native_vlan;
 	}
 
 }
diff --git a/include/net.h b/include/net.h
index 1dc54ce..9343ade 100644
--- a/include/net.h
+++ b/include/net.h
@@ -512,8 +512,8 @@ extern struct in_addr net_ping_ip;	/* the ip address to ping */
 
 #if defined(CONFIG_CMD_CDP)
 /* when CDP completes these hold the return values */
-extern ushort CDPNativeVLAN;		/* CDP returned native VLAN */
-extern ushort CDPApplianceVLAN;		/* CDP returned appliance VLAN */
+extern ushort cdp_native_vlan;		/* CDP returned native VLAN */
+extern ushort cdp_appliance_vlan;	/* CDP returned appliance VLAN */
 
 /*
  * Check for a CDP packet by examining the received MAC address field
diff --git a/net/cdp.c b/net/cdp.c
index 392437d..d8df3ea 100644
--- a/net/cdp.c
+++ b/net/cdp.c
@@ -36,17 +36,16 @@ const u8 net_cdp_ethaddr[6] = { 0x01, 0x00, 0x0c, 0xcc, 0xcc, 0xcc };
 
 #define CDP_TIMEOUT			250UL	/* one packet every 250ms */
 
-static int CDPSeq;
-static int CDPOK;
+static int cdp_seq;
+static int cdp_ok;
 
-ushort CDPNativeVLAN;
-ushort CDPApplianceVLAN;
+ushort cdp_native_vlan;
+ushort cdp_appliance_vlan;
 
-static const uchar CDP_SNAP_hdr[8] = {
+static const uchar cdp_snap_hdr[8] = {
 	0xAA, 0xAA, 0x03, 0x00, 0x00, 0x0C, 0x20, 0x00 };
 
-static ushort
-CDP_compute_csum(const uchar *buff, ushort len)
+static ushort cdp_compute_csum(const uchar *buff, ushort len)
 {
 	ushort csum;
 	int     odd;
@@ -104,8 +103,7 @@ CDP_compute_csum(const uchar *buff, ushort len)
 	return csum;
 }
 
-static int
-CDPSendTrigger(void)
+static int cdp_send_trigger(void)
 {
 	uchar *pkt;
 	ushort *s;
@@ -130,8 +128,8 @@ CDPSendTrigger(void)
 	pkt += ETHER_HDR_SIZE;
 
 	/* SNAP header */
-	memcpy((uchar *)pkt, CDP_SNAP_hdr, sizeof(CDP_SNAP_hdr));
-	pkt += sizeof(CDP_SNAP_hdr);
+	memcpy((uchar *)pkt, cdp_snap_hdr, sizeof(cdp_snap_hdr));
+	pkt += sizeof(cdp_snap_hdr);
 
 	/* CDP header */
 	*pkt++ = 0x02;				/* CDP version 2 */
@@ -210,8 +208,8 @@ CDPSendTrigger(void)
 	len = (uchar *)s - ((uchar *)net_tx_packet + ETHER_HDR_SIZE);
 	et->et_protlen = htons(len);
 
-	len = ETHER_HDR_SIZE + sizeof(CDP_SNAP_hdr);
-	chksum = CDP_compute_csum((uchar *)net_tx_packet + len,
+	len = ETHER_HDR_SIZE + sizeof(cdp_snap_hdr);
+	chksum = cdp_compute_csum((uchar *)net_tx_packet + len,
 				  (uchar *)s - (net_tx_packet + len));
 	if (chksum == 0)
 		chksum = 0xFFFF;
@@ -221,19 +219,18 @@ CDPSendTrigger(void)
 	return 0;
 }
 
-static void
-CDPTimeout(void)
+static void cdp_timeout_handler(void)
 {
-	CDPSeq++;
+	cdp_seq++;
 
-	if (CDPSeq < 3) {
-		NetSetTimeout(CDP_TIMEOUT, CDPTimeout);
-		CDPSendTrigger();
+	if (cdp_seq < 3) {
+		NetSetTimeout(CDP_TIMEOUT, cdp_timeout_handler);
+		cdp_send_trigger();
 		return;
 	}
 
 	/* if not OK try again */
-	if (!CDPOK)
+	if (!cdp_ok)
 		NetStartAgain();
 	else
 		net_set_state(NETLOOP_SUCCESS);
@@ -247,15 +244,15 @@ void cdp_receive(const uchar *pkt, unsigned len)
 	ushort vlan, nvlan;
 
 	/* minimum size? */
-	if (len < sizeof(CDP_SNAP_hdr) + 4)
+	if (len < sizeof(cdp_snap_hdr) + 4)
 		goto pkt_short;
 
 	/* check for valid CDP SNAP header */
-	if (memcmp(pkt, CDP_SNAP_hdr, sizeof(CDP_SNAP_hdr)) != 0)
+	if (memcmp(pkt, cdp_snap_hdr, sizeof(cdp_snap_hdr)) != 0)
 		return;
 
-	pkt += sizeof(CDP_SNAP_hdr);
-	len -= sizeof(CDP_SNAP_hdr);
+	pkt += sizeof(cdp_snap_hdr);
+	len -= sizeof(cdp_snap_hdr);
 
 	/* Version of CDP protocol must be >= 2 and TTL != 0 */
 	if (pkt[0] < 0x02 || pkt[1] == 0)
@@ -269,7 +266,7 @@ void cdp_receive(const uchar *pkt, unsigned len)
 		printf("**WARNING: CDP packet received with a protocol version "
 				"%d > 2\n", pkt[0] & 0xff);
 
-	if (CDP_compute_csum(pkt, len) != 0)
+	if (cdp_compute_csum(pkt, len) != 0)
 		return;
 
 	pkt += 4;
@@ -340,28 +337,27 @@ void cdp_receive(const uchar *pkt, unsigned len)
 		}
 	}
 
-	CDPApplianceVLAN = vlan;
-	CDPNativeVLAN = nvlan;
+	cdp_appliance_vlan = vlan;
+	cdp_native_vlan = nvlan;
 
-	CDPOK = 1;
+	cdp_ok = 1;
 	return;
 
- pkt_short:
+pkt_short:
 	printf("** CDP packet is too short\n");
 	return;
 }
 
-void
-CDPStart(void)
+void cdp_start(void)
 {
 	printf("Using %s device\n", eth_get_name());
-	CDPSeq = 0;
-	CDPOK = 0;
+	cdp_seq = 0;
+	cdp_ok = 0;
 
-	CDPNativeVLAN = htons(-1);
-	CDPApplianceVLAN = htons(-1);
+	cdp_native_vlan = htons(-1);
+	cdp_appliance_vlan = htons(-1);
 
-	NetSetTimeout(CDP_TIMEOUT, CDPTimeout);
+	NetSetTimeout(CDP_TIMEOUT, cdp_timeout_handler);
 
-	CDPSendTrigger();
+	cdp_send_trigger();
 }
diff --git a/net/cdp.h b/net/cdp.h
index 95e4ce0..83475c9 100644
--- a/net/cdp.h
+++ b/net/cdp.h
@@ -14,7 +14,7 @@
 #ifndef __CDP_H__
 #define __CDP_H__
 
-void CDPStart(void);
+void cdp_start(void);
 /* Process a received CDP packet */
 void cdp_receive(const uchar *pkt, unsigned len);
 
diff --git a/net/net.c b/net/net.c
index 71baf35..4ae4134 100644
--- a/net/net.c
+++ b/net/net.c
@@ -412,7 +412,7 @@ restart:
 #endif
 #if defined(CONFIG_CMD_CDP)
 		case CDP:
-			CDPStart();
+			cdp_start();
 			break;
 #endif
 #if defined (CONFIG_NETCONSOLE) && !(CONFIG_SPL_BUILD)
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH 15/23] net: cosmetic: Clean up DNS variables and functions
  2015-04-03 21:14 [U-Boot] [PATCH 0/23] net: cosmetic: Fix naming and other checkpatch.pl issues in net/ Joe Hershberger
                   ` (13 preceding siblings ...)
  2015-04-03 21:14 ` [U-Boot] [PATCH 14/23] net: cosmetic: Clean up CDP " Joe Hershberger
@ 2015-04-03 21:14 ` Joe Hershberger
  2015-04-03 21:14 ` [U-Boot] [PATCH 16/23] net: cosmetic: Clean up netconsole " Joe Hershberger
                   ` (9 subsequent siblings)
  24 siblings, 0 replies; 103+ messages in thread
From: Joe Hershberger @ 2015-04-03 21:14 UTC (permalink / raw)
  To: u-boot

Make a thorough pass through all variables and function names contained
within dns.c and remove CamelCase and improve naming.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

 common/cmd_net.c |  6 +++---
 include/net.h    |  4 ++--
 net/dns.c        | 53 +++++++++++++++++++++++++----------------------------
 net/dns.h        |  2 +-
 net/net.c        |  2 +-
 5 files changed, 32 insertions(+), 35 deletions(-)

diff --git a/common/cmd_net.c b/common/cmd_net.c
index 0ade0f8..006524d 100644
--- a/common/cmd_net.c
+++ b/common/cmd_net.c
@@ -393,12 +393,12 @@ int do_dns(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		return CMD_RET_FAILURE;
 	}
 
-	NetDNSResolve = argv[1];
+	net_dns_resolve = argv[1];
 
 	if (argc == 3)
-		NetDNSenvvar = argv[2];
+		net_dns_env_var = argv[2];
 	else
-		NetDNSenvvar = NULL;
+		net_dns_env_var = NULL;
 
 	if (NetLoop(DNS) < 0) {
 		printf("dns lookup of %s failed, check setup\n", argv[1]);
diff --git a/include/net.h b/include/net.h
index 9343ade..1275ffe 100644
--- a/include/net.h
+++ b/include/net.h
@@ -502,8 +502,8 @@ extern u32	net_boot_file_size;
 extern u32	net_boot_file_expected_size_in_blocks;
 
 #if defined(CONFIG_CMD_DNS)
-extern char *NetDNSResolve;		/* The host to resolve  */
-extern char *NetDNSenvvar;		/* the env var to put the ip into */
+extern char *net_dns_resolve;		/* The host to resolve  */
+extern char *net_dns_env_var;		/* the env var to put the ip into */
 #endif
 
 #if defined(CONFIG_CMD_PING)
diff --git a/net/dns.c b/net/dns.c
index 50d78ae..cf4ed86 100644
--- a/net/dns.c
+++ b/net/dns.c
@@ -29,13 +29,12 @@
 
 #include "dns.h"
 
-char *NetDNSResolve;	/* The host to resolve  */
-char *NetDNSenvvar;	/* The envvar to store the answer in */
+char *net_dns_resolve;	/* The host to resolve  */
+char *net_dns_env_var;	/* The envvar to store the answer in */
 
-static int DnsOurPort;
+static int dns_our_port;
 
-static void
-DnsSend(void)
+static void dns_send(void)
 {
 	struct header *header;
 	int n, name_len;
@@ -44,12 +43,12 @@ DnsSend(void)
 	const char *name;
 	enum dns_query_type qtype = DNS_A_RECORD;
 
-	name = NetDNSResolve;
+	name = net_dns_resolve;
 	pkt = (uchar *)(net_tx_packet + net_eth_hdr_size() + IP_UDP_HDR_SIZE);
 	p = pkt;
 
 	/* Prepare DNS packet header */
-	header           = (struct header *) pkt;
+	header           = (struct header *)pkt;
 	header->tid      = 1;
 	header->flags    = htons(0x100);	/* standard query */
 	header->nqueries = htons(1);		/* Just one query */
@@ -59,7 +58,7 @@ DnsSend(void)
 
 	/* Encode DNS name */
 	name_len = strlen(name);
-	p = (uchar *) &header->data;	/* For encoding host name into packet */
+	p = (uchar *)&header->data;	/* For encoding host name into packet */
 
 	do {
 		s = strchr(name, '.');
@@ -88,15 +87,14 @@ DnsSend(void)
 	n = p - pkt;				/* Total packet length */
 	debug("Packet size %d\n", n);
 
-	DnsOurPort = random_port();
+	dns_our_port = random_port();
 
 	net_send_udp_packet(net_server_ethaddr, net_dns_server,
-			    DNS_SERVICE_PORT, DnsOurPort, n);
+			    DNS_SERVICE_PORT, dns_our_port, n);
 	debug("DNS packet sent\n");
 }
 
-static void
-DnsTimeout(void)
+static void dns_timeout_handler(void)
 {
 	puts("Timeout\n");
 	net_set_state(NETLOOP_FAIL);
@@ -109,20 +107,20 @@ static void dns_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 	const unsigned char *p, *e, *s;
 	u16 type, i;
 	int found, stop, dlen;
-	char IPStr[22];
+	char ip_str[22];
 	struct in_addr ip_addr;
 
 
 	debug("%s\n", __func__);
-	if (dest != DnsOurPort)
+	if (dest != dns_our_port)
 		return;
 
 	for (i = 0; i < len; i += 4)
 		debug("0x%p - 0x%.2x  0x%.2x  0x%.2x  0x%.2x\n",
-			pkt+i, pkt[i], pkt[i+1], pkt[i+2], pkt[i+3]);
+		      pkt+i, pkt[i], pkt[i+1], pkt[i+2], pkt[i+3]);
 
 	/* We sent one query. We want to have a single answer: */
-	header = (struct header *) pkt;
+	header = (struct header *)pkt;
 	if (ntohs(header->nqueries) != 1)
 		return;
 
@@ -151,7 +149,6 @@ static void dns_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 
 	/* Loop through the answers, we want A type answer */
 	for (found = stop = 0; !stop && &p[12] < e; ) {
-
 		/* Skip possible name in CNAME answer */
 		if (*p != 0xc0) {
 			while (*p && &p[12] < e)
@@ -170,7 +167,8 @@ static void dns_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 			p += 12 + dlen;
 		} else if (type == DNS_A_RECORD) {
 			debug("Found A-record\n");
-			found = stop = 1;
+			found = 1;
+			stop = 1;
 		} else {
 			debug("Unknown type\n");
 			stop = 1;
@@ -178,33 +176,32 @@ static void dns_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 	}
 
 	if (found && &p[12] < e) {
-
 		dlen = get_unaligned_be16(p+10);
 		p += 12;
 		memcpy(&ip_addr, p, 4);
 
 		if (p + dlen <= e) {
-			ip_to_string(ip_addr, IPStr);
-			printf("%s\n", IPStr);
-			if (NetDNSenvvar)
-				setenv(NetDNSenvvar, IPStr);
-		} else
+			ip_to_string(ip_addr, ip_str);
+			printf("%s\n", ip_str);
+			if (net_dns_env_var)
+				setenv(net_dns_env_var, ip_str);
+		} else {
 			puts("server responded with invalid IP number\n");
+		}
 	}
 
 	net_set_state(NETLOOP_SUCCESS);
 }
 
-void
-DnsStart(void)
+void dns_start(void)
 {
 	debug("%s\n", __func__);
 
-	NetSetTimeout(DNS_TIMEOUT, DnsTimeout);
+	NetSetTimeout(DNS_TIMEOUT, dns_timeout_handler);
 	net_set_udp_handler(dns_handler);
 
 	/* Clear a previous MAC address, the server IP might have changed. */
 	memset(net_server_ethaddr, 0, sizeof(net_server_ethaddr));
 
-	DnsSend();
+	dns_send();
 }
diff --git a/net/dns.h b/net/dns.h
index dbc3890..c4e96af 100644
--- a/net/dns.h
+++ b/net/dns.h
@@ -31,6 +31,6 @@ struct header {
 	unsigned char	data[1];	/* Data, variable length */
 };
 
-extern void DnsStart(void);		/* Begin DNS */
+void dns_start(void);		/* Begin DNS */
 
 #endif
diff --git a/net/net.c b/net/net.c
index 4ae4134..d5b0bc4 100644
--- a/net/net.c
+++ b/net/net.c
@@ -427,7 +427,7 @@ restart:
 #endif
 #if defined(CONFIG_CMD_DNS)
 		case DNS:
-			DnsStart();
+			dns_start();
 			break;
 #endif
 #if defined(CONFIG_CMD_LINK_LOCAL)
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH 16/23] net: cosmetic: Clean up netconsole variables and functions
  2015-04-03 21:14 [U-Boot] [PATCH 0/23] net: cosmetic: Fix naming and other checkpatch.pl issues in net/ Joe Hershberger
                   ` (14 preceding siblings ...)
  2015-04-03 21:14 ` [U-Boot] [PATCH 15/23] net: cosmetic: Clean up DNS " Joe Hershberger
@ 2015-04-03 21:14 ` Joe Hershberger
  2015-04-03 21:14 ` [U-Boot] [PATCH 17/23] net: cosmetic: Clean up cmd_net " Joe Hershberger
                   ` (8 subsequent siblings)
  24 siblings, 0 replies; 103+ messages in thread
From: Joe Hershberger @ 2015-04-03 21:14 UTC (permalink / raw)
  To: u-boot

Make a thorough pass through all variables and function names contained
within netconsole.c and remove CamelCase and improve naming.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

 drivers/net/netconsole.c | 32 +++++++++++++++++---------------
 include/net.h            |  2 +-
 net/net.c                |  2 +-
 3 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index 9aba0c5..c2e0184 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -48,7 +48,7 @@ static void nc_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 		net_set_state(NETLOOP_SUCCESS); /* got input - quit net loop */
 }
 
-static void nc_timeout(void)
+static void nc_timeout_handler(void)
 {
 	net_set_state(NETLOOP_SUCCESS);
 }
@@ -91,8 +91,9 @@ static int refresh_settings_from_env(void)
 				nc_out_port = simple_strtoul(p + 1, NULL, 10);
 				nc_in_port = nc_out_port;
 			}
-		} else
+		} else {
 			nc_ip.s_addr = ~0; /* ncip is not set, so broadcast */
+		}
 
 		p = getenv("ncoutport");
 		if (p != NULL)
@@ -114,13 +115,13 @@ static int refresh_settings_from_env(void)
 /**
  * Called from NetLoop in net/net.c before each packet
  */
-void NcStart(void)
+void nc_start(void)
 {
 	refresh_settings_from_env();
 	if (!output_packet_len || memcmp(nc_ether, net_null_ethaddr, 6)) {
 		/* going to check for input packet */
 		net_set_udp_handler(nc_handler);
-		NetSetTimeout(net_timeout, nc_timeout);
+		NetSetTimeout(net_timeout, nc_timeout_handler);
 	} else {
 		/* send arp request */
 		uchar *pkt;
@@ -198,8 +199,9 @@ static void nc_send_packet(const char *buf, int len)
 			if (eth_init() < 0)
 				return;
 			eth_set_last_protocol(NETCONS);
-		} else
+		} else {
 			eth_init_state_only();
+		}
 
 		inited = 1;
 	}
@@ -217,7 +219,7 @@ static void nc_send_packet(const char *buf, int len)
 	}
 }
 
-static int nc_start(struct stdio_dev *dev)
+static int nc_stdio_start(struct stdio_dev *dev)
 {
 	int retval;
 
@@ -237,7 +239,7 @@ static int nc_start(struct stdio_dev *dev)
 	return 0;
 }
 
-static void nc_putc(struct stdio_dev *dev, char c)
+static void nc_stdio_putc(struct stdio_dev *dev, char c)
 {
 	if (output_recursion)
 		return;
@@ -248,7 +250,7 @@ static void nc_putc(struct stdio_dev *dev, char c)
 	output_recursion = 0;
 }
 
-static void nc_puts(struct stdio_dev *dev, const char *s)
+static void nc_stdio_puts(struct stdio_dev *dev, const char *s)
 {
 	int len;
 
@@ -267,7 +269,7 @@ static void nc_puts(struct stdio_dev *dev, const char *s)
 	output_recursion = 0;
 }
 
-static int nc_getc(struct stdio_dev *dev)
+static int nc_stdio_getc(struct stdio_dev *dev)
 {
 	uchar c;
 
@@ -288,7 +290,7 @@ static int nc_getc(struct stdio_dev *dev)
 	return c;
 }
 
-static int nc_tstc(struct stdio_dev *dev)
+static int nc_stdio_tstc(struct stdio_dev *dev)
 {
 	struct eth_device *eth;
 
@@ -321,11 +323,11 @@ int drv_nc_init(void)
 
 	strcpy(dev.name, "nc");
 	dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_INPUT | DEV_FLAGS_SYSTEM;
-	dev.start = nc_start;
-	dev.putc = nc_putc;
-	dev.puts = nc_puts;
-	dev.getc = nc_getc;
-	dev.tstc = nc_tstc;
+	dev.start = nc_stdio_start;
+	dev.putc = nc_stdio_putc;
+	dev.puts = nc_stdio_puts;
+	dev.getc = nc_stdio_getc;
+	dev.tstc = nc_stdio_tstc;
 
 	rc = stdio_register(&dev);
 
diff --git a/include/net.h b/include/net.h
index 1275ffe..a7aefbc 100644
--- a/include/net.h
+++ b/include/net.h
@@ -634,7 +634,7 @@ int net_send_udp_packet(uchar *ether, struct in_addr dest, int dport,
 void net_process_received_packet(uchar *in_packet, int len);
 
 #ifdef CONFIG_NETCONSOLE
-void NcStart(void);
+void nc_start(void);
 int nc_input_packet(uchar *pkt, struct in_addr src_ip, unsigned dest_port,
 	unsigned src_port, unsigned len);
 #endif
diff --git a/net/net.c b/net/net.c
index d5b0bc4..030ceb1 100644
--- a/net/net.c
+++ b/net/net.c
@@ -417,7 +417,7 @@ restart:
 #endif
 #if defined (CONFIG_NETCONSOLE) && !(CONFIG_SPL_BUILD)
 		case NETCONS:
-			NcStart();
+			nc_start();
 			break;
 #endif
 #if defined(CONFIG_CMD_SNTP)
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH 17/23] net: cosmetic: Clean up cmd_net variables and functions
  2015-04-03 21:14 [U-Boot] [PATCH 0/23] net: cosmetic: Fix naming and other checkpatch.pl issues in net/ Joe Hershberger
                   ` (15 preceding siblings ...)
  2015-04-03 21:14 ` [U-Boot] [PATCH 16/23] net: cosmetic: Clean up netconsole " Joe Hershberger
@ 2015-04-03 21:14 ` Joe Hershberger
  2015-04-03 21:14 ` [U-Boot] [PATCH 18/23] net: cosmetic: Fix checkpatch.pl failures in linklocal Joe Hershberger
                   ` (7 subsequent siblings)
  24 siblings, 0 replies; 103+ messages in thread
From: Joe Hershberger @ 2015-04-03 21:14 UTC (permalink / raw)
  To: u-boot

Make a thorough pass through all variables and function names contained
within common/cmd_net.c and remove CamelCase and improve naming.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

 common/cmd_net.c | 29 ++++++++++++++---------------
 include/net.h    | 10 +++++-----
 net/net.c        | 26 +++++++++++++-------------
 3 files changed, 32 insertions(+), 33 deletions(-)

diff --git a/common/cmd_net.c b/common/cmd_net.c
index 006524d..6c8d517 100644
--- a/common/cmd_net.c
+++ b/common/cmd_net.c
@@ -157,15 +157,13 @@ static void netboot_update_env(void)
 	if (net_nis_domain[0])
 		setenv("domain", net_nis_domain);
 
-#if defined(CONFIG_CMD_SNTP) \
-    && defined(CONFIG_BOOTP_TIMEOFFSET)
+#if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_TIMEOFFSET)
 	if (NetTimeOffset) {
 		sprintf(tmp, "%d", NetTimeOffset);
 		setenv("timeoffset", tmp);
 	}
 #endif
-#if defined(CONFIG_CMD_SNTP) \
-    && defined(CONFIG_BOOTP_NTPSERVER)
+#if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_NTPSERVER)
 	if (net_ntp_ip.s_addr) {
 		ip_to_string(net_ntp_ip, tmp);
 		setenv("ntpserverip", tmp);
@@ -183,9 +181,9 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc,
 	ulong addr;
 
 	/* pre-set load_addr */
-	if ((s = getenv("loadaddr")) != NULL) {
+	s = getenv("loadaddr");
+	if (s != NULL)
 		load_addr = simple_strtoul(s, NULL, 16);
-	}
 
 	switch (argc) {
 	case 1:
@@ -205,7 +203,8 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc,
 				      sizeof(net_boot_file_name));
 		break;
 
-	case 3:	load_addr = simple_strtoul(argv[1], NULL, 16);
+	case 3:
+		load_addr = simple_strtoul(argv[1], NULL, 16);
 		copy_filename(net_boot_file_name, argv[2],
 			      sizeof(net_boot_file_name));
 
@@ -214,7 +213,7 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc,
 #ifdef CONFIG_CMD_TFTPPUT
 	case 4:
 		if (strict_strtoul(argv[1], 16, &save_addr) < 0 ||
-			strict_strtoul(argv[2], 16, &save_size) < 0) {
+		    strict_strtoul(argv[2], 16, &save_size) < 0) {
 			printf("Invalid address/size\n");
 			return CMD_RET_USAGE;
 		}
@@ -228,7 +227,8 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc,
 	}
 	bootstage_mark(BOOTSTAGE_ID_NET_START);
 
-	if ((size = NetLoop(proto)) < 0) {
+	size = NetLoop(proto);
+	if (size < 0) {
 		bootstage_error(BOOTSTAGE_ID_NET_NETLOOP_OK);
 		return CMD_RET_FAILURE;
 	}
@@ -293,18 +293,17 @@ static void cdp_update_env(void)
 	if (cdp_appliance_vlan != htons(-1)) {
 		printf("CDP offered appliance VLAN %d\n",
 		       ntohs(cdp_appliance_vlan));
-		VLAN_to_string(cdp_appliance_vlan, tmp);
+		vlan_to_string(cdp_appliance_vlan, tmp);
 		setenv("vlan", tmp);
-		NetOurVLAN = cdp_appliance_vlan;
+		net_our_vlan = cdp_appliance_vlan;
 	}
 
 	if (cdp_native_vlan != htons(-1)) {
 		printf("CDP offered native VLAN %d\n", ntohs(cdp_native_vlan));
-		VLAN_to_string(cdp_native_vlan, tmp);
+		vlan_to_string(cdp_native_vlan, tmp);
 		setenv("nvlan", tmp);
-		NetOurNativeVLAN = cdp_native_vlan;
+		net_native_vlan = cdp_native_vlan;
 	}
-
 }
 
 int do_cdp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
@@ -356,7 +355,7 @@ int do_sntp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 	if (NetLoop(SNTP) < 0) {
 		printf("SNTP failed: host %pI4 not responding\n",
-			&net_ntp_server);
+		       &net_ntp_server);
 		return CMD_RET_FAILURE;
 	}
 
diff --git a/include/net.h b/include/net.h
index a7aefbc..c4a534c 100644
--- a/include/net.h
+++ b/include/net.h
@@ -485,8 +485,8 @@ extern const u8		net_null_ethaddr[6];
 
 #define VLAN_NONE	4095			/* untagged */
 #define VLAN_IDMASK	0x0fff			/* mask of valid vlan id */
-extern ushort		NetOurVLAN;		/* Our VLAN */
-extern ushort		NetOurNativeVLAN;	/* Our Native VLAN */
+extern ushort		net_our_vlan;		/* Our VLAN */
+extern ushort		net_native_vlan;	/* Our Native VLAN */
 
 extern int		NetRestartWrap;		/* Tried all network devices */
 
@@ -785,13 +785,13 @@ void ip_to_string(struct in_addr x, char *s);
 struct in_addr string_to_ip(const char *s);
 
 /* Convert a VLAN id to a string */
-void VLAN_to_string(ushort x, char *s);
+void vlan_to_string(ushort x, char *s);
 
 /* Convert a string to a vlan id */
-ushort string_to_VLAN(const char *s);
+ushort string_to_vlan(const char *s);
 
 /* read a VLAN id from an environment variable */
-ushort getenv_VLAN(char *);
+ushort getenv_vlan(char *);
 
 /* copy a filename (allow for "..." notation, limit length) */
 void copy_filename(char *dst, const char *src, int size);
diff --git a/net/net.c b/net/net.c
index 030ceb1..e78638d 100644
--- a/net/net.c
+++ b/net/net.c
@@ -159,9 +159,9 @@ static int	NetDevExists;
 
 /* XXX in both little & big endian machines 0xFFFF == ntohs(-1) */
 /* default is without VLAN */
-ushort		NetOurVLAN = 0xFFFF;
+ushort		net_our_vlan = 0xFFFF;
 /* ditto */
-ushort		NetOurNativeVLAN = 0xFFFF;
+ushort		net_native_vlan = 0xFFFF;
 
 /* Boot File name */
 char net_boot_file_name[128];
@@ -261,8 +261,8 @@ static void NetInitLoop(void)
 		net_gateway = getenv_ip("gatewayip");
 		net_netmask = getenv_ip("netmask");
 		net_server_ip = getenv_ip("serverip");
-		NetOurNativeVLAN = getenv_VLAN("nvlan");
-		NetOurVLAN = getenv_VLAN("vlan");
+		net_native_vlan = getenv_vlan("nvlan");
+		net_our_vlan = getenv_vlan("vlan");
 #if defined(CONFIG_CMD_DNS)
 		net_dns_server = getenv_ip("dnsip");
 #endif
@@ -989,10 +989,10 @@ void net_process_received_packet(uchar *in_packet, int len)
 	iscdp = is_cdp_packet(et->et_dest);
 #endif
 
-	myvlanid = ntohs(NetOurVLAN);
+	myvlanid = ntohs(net_our_vlan);
 	if (myvlanid == (ushort)-1)
 		myvlanid = VLAN_NONE;
-	mynvlanid = ntohs(NetOurNativeVLAN);
+	mynvlanid = ntohs(net_native_vlan);
 	if (mynvlanid == (ushort)-1)
 		mynvlanid = VLAN_NONE;
 
@@ -1024,7 +1024,7 @@ void net_process_received_packet(uchar *in_packet, int len)
 			return;
 
 		/* if no VLAN active */
-		if ((ntohs(NetOurVLAN) & VLAN_IDMASK) == VLAN_NONE
+		if ((ntohs(net_our_vlan) & VLAN_IDMASK) == VLAN_NONE
 #if defined(CONFIG_CMD_CDP)
 				&& iscdp == 0
 #endif
@@ -1301,7 +1301,7 @@ net_eth_hdr_size(void)
 {
 	ushort myvlanid;
 
-	myvlanid = ntohs(NetOurVLAN);
+	myvlanid = ntohs(net_our_vlan);
 	if (myvlanid == (ushort)-1)
 		myvlanid = VLAN_NONE;
 
@@ -1314,7 +1314,7 @@ int net_set_ether(uchar *xet, const uchar *dest_ethaddr, uint prot)
 	struct ethernet_hdr *et = (struct ethernet_hdr *)xet;
 	ushort myvlanid;
 
-	myvlanid = ntohs(NetOurVLAN);
+	myvlanid = ntohs(net_our_vlan);
 	if (myvlanid == (ushort)-1)
 		myvlanid = VLAN_NONE;
 
@@ -1439,7 +1439,7 @@ void ip_to_string(struct in_addr x, char *s)
 	);
 }
 
-void VLAN_to_string(ushort x, char *s)
+void vlan_to_string(ushort x, char *s)
 {
 	x = ntohs(x);
 
@@ -1452,7 +1452,7 @@ void VLAN_to_string(ushort x, char *s)
 		sprintf(s, "%d", x & VLAN_IDMASK);
 }
 
-ushort string_to_VLAN(const char *s)
+ushort string_to_vlan(const char *s)
 {
 	ushort id;
 
@@ -1467,7 +1467,7 @@ ushort string_to_VLAN(const char *s)
 	return htons(id);
 }
 
-ushort getenv_VLAN(char *var)
+ushort getenv_vlan(char *var)
 {
-	return string_to_VLAN(getenv(var));
+	return string_to_vlan(getenv(var));
 }
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH 18/23] net: cosmetic: Fix checkpatch.pl failures in linklocal
  2015-04-03 21:14 [U-Boot] [PATCH 0/23] net: cosmetic: Fix naming and other checkpatch.pl issues in net/ Joe Hershberger
                   ` (16 preceding siblings ...)
  2015-04-03 21:14 ` [U-Boot] [PATCH 17/23] net: cosmetic: Clean up cmd_net " Joe Hershberger
@ 2015-04-03 21:14 ` Joe Hershberger
  2015-04-03 21:14 ` [U-Boot] [PATCH 19/23] net: cosmetic: Fix checkpatch.pl failures in eth.c Joe Hershberger
                   ` (6 subsequent siblings)
  24 siblings, 0 replies; 103+ messages in thread
From: Joe Hershberger @ 2015-04-03 21:14 UTC (permalink / raw)
  To: u-boot

A few new rules in checkpatch.pl since linklocal.c was added.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

 net/link_local.c | 36 +++++++++++++++++-------------------
 1 file changed, 17 insertions(+), 19 deletions(-)

diff --git a/net/link_local.c b/net/link_local.c
index 56616d6..e2f14fc 100644
--- a/net/link_local.c
+++ b/net/link_local.c
@@ -95,7 +95,7 @@ static void configure_wait(void)
 	deadline_ms = MONOTONIC_MS() + timeout_ms;
 
 	debug_cond(DEBUG_DEV_PKT, "...wait %d %s nprobes=%u, nclaims=%u\n",
-			timeout_ms, eth_get_name(), nprobes, nclaims);
+		   timeout_ms, eth_get_name(), nprobes, nclaims);
 
 	NetSetTimeout(timeout_ms, link_local_timeout);
 }
@@ -134,7 +134,7 @@ static void link_local_timeout(void)
 		if (nprobes < PROBE_NUM) {
 			nprobes++;
 			debug_cond(DEBUG_LL_STATE, "probe/%u %s@%pI4\n",
-					nprobes, eth_get_name(), &ip);
+				   nprobes, eth_get_name(), &ip);
 			arp_raw_request(0, net_null_ethaddr, ip);
 			timeout_ms = PROBE_MIN * 1000;
 			timeout_ms += random_delay_ms(PROBE_MAX - PROBE_MIN);
@@ -143,7 +143,7 @@ static void link_local_timeout(void)
 			state = ANNOUNCE;
 			nclaims = 0;
 			debug_cond(DEBUG_LL_STATE, "announce/%u %s@%pI4\n",
-					nclaims, eth_get_name(), &ip);
+				   nclaims, eth_get_name(), &ip);
 			arp_raw_request(ip, net_ethaddr, ip);
 			timeout_ms = ANNOUNCE_INTERVAL * 1000;
 		}
@@ -155,7 +155,7 @@ static void link_local_timeout(void)
 		state = ANNOUNCE;
 		nclaims = 0;
 		debug_cond(DEBUG_LL_STATE, "announce/%u %s@%pI4\n",
-				nclaims, eth_get_name(), &ip);
+			   nclaims, eth_get_name(), &ip);
 		arp_raw_request(ip, net_ethaddr, ip);
 		timeout_ms = ANNOUNCE_INTERVAL * 1000;
 		break;
@@ -166,7 +166,7 @@ static void link_local_timeout(void)
 		if (nclaims < ANNOUNCE_NUM) {
 			nclaims++;
 			debug_cond(DEBUG_LL_STATE, "announce/%u %s@%pI4\n",
-					nclaims, eth_get_name(), &ip);
+				   nclaims, eth_get_name(), &ip);
 			arp_raw_request(ip, net_ethaddr, ip);
 			timeout_ms = ANNOUNCE_INTERVAL * 1000;
 		} else {
@@ -220,7 +220,7 @@ void link_local_receive_arp(struct arp_hdr *arp, int len)
 			/* Current time is greater than the expected timeout
 			   time. This should never happen */
 			debug_cond(DEBUG_LL_STATE,
-				"missed an expected timeout\n");
+				   "missed an expected timeout\n");
 			timeout_ms = 0;
 		} else {
 			debug_cond(DEBUG_INT_STATE, "adjusting timeout\n");
@@ -235,9 +235,8 @@ void link_local_receive_arp(struct arp_hdr *arp, int len)
 			 * FIXME: links routinely go down;
 			 */
 			bb_error_msg("iface %s is down", eth_get_name());
-			if (ready) {
+			if (ready)
 				run(argv, "deconfig", &ip);
-			}
 			return EXIT_FAILURE;
 		}
 		continue;
@@ -245,18 +244,17 @@ void link_local_receive_arp(struct arp_hdr *arp, int len)
 #endif
 
 	debug_cond(DEBUG_INT_STATE, "%s recv arp type=%d, op=%d,\n",
-		eth_get_name(), ntohs(arp->ar_pro),
-		ntohs(arp->ar_op));
+		   eth_get_name(), ntohs(arp->ar_pro),
+		   ntohs(arp->ar_op));
 	debug_cond(DEBUG_INT_STATE, "\tsource=%pM %pI4\n",
-		&arp->ar_sha,
-		&arp->ar_spa);
+		   &arp->ar_sha,
+		   &arp->ar_spa);
 	debug_cond(DEBUG_INT_STATE, "\ttarget=%pM %pI4\n",
-		&arp->ar_tha,
-		&arp->ar_tpa);
+		   &arp->ar_tha,
+		   &arp->ar_tpa);
 
-	if (arp->ar_op != htons(ARPOP_REQUEST)
-	 && arp->ar_op != htons(ARPOP_REPLY)
-	) {
+	if (arp->ar_op != htons(ARPOP_REQUEST) &&
+	    arp->ar_op != htons(ARPOP_REPLY)) {
 		configure_wait();
 		return;
 	}
@@ -283,8 +281,8 @@ void link_local_receive_arp(struct arp_hdr *arp, int len)
 	}
 
 	debug_cond(DEBUG_NET_PKT,
-		"state = %d, source ip conflict = %d, target ip conflict = "
-		"%d\n", state, source_ip_conflict, target_ip_conflict);
+		   "state = %d, source ip conflict = %d, target ip conflict = "
+		   "%d\n", state, source_ip_conflict, target_ip_conflict);
 	switch (state) {
 	case PROBE:
 	case ANNOUNCE:
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH 19/23] net: cosmetic: Fix checkpatch.pl failures in eth.c
  2015-04-03 21:14 [U-Boot] [PATCH 0/23] net: cosmetic: Fix naming and other checkpatch.pl issues in net/ Joe Hershberger
                   ` (17 preceding siblings ...)
  2015-04-03 21:14 ` [U-Boot] [PATCH 18/23] net: cosmetic: Fix checkpatch.pl failures in linklocal Joe Hershberger
@ 2015-04-03 21:14 ` Joe Hershberger
  2015-04-03 21:14 ` [U-Boot] [PATCH 20/23] net: cosmetic: Fix checkpatch.pl failures in net.h Joe Hershberger
                   ` (5 subsequent siblings)
  24 siblings, 0 replies; 103+ messages in thread
From: Joe Hershberger @ 2015-04-03 21:14 UTC (permalink / raw)
  To: u-boot

There were still a few failures in net/eth.c, especially in the legacy
part of the code.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

 net/eth.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/net/eth.c b/net/eth.c
index e936ca0..953b6a6 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -74,8 +74,10 @@ static int eth_mac_skip(int index)
 {
 	char enetvar[15];
 	char *skip_state;
+
 	sprintf(enetvar, index ? "eth%dmacskip" : "ethmacskip", index);
-	return ((skip_state = getenv(enetvar)) != NULL);
+	skip_state = getenv(enetvar);
+	return skip_state != NULL;
 }
 
 static void eth_current_changed(void);
@@ -275,8 +277,9 @@ int eth_init(void)
 				priv->state = ETH_STATE_ACTIVE;
 				return 0;
 			}
-		} else
+		} else {
 			ret = eth_errno;
+		}
 
 		debug("FAIL\n");
 
@@ -610,11 +613,11 @@ int eth_write_hwaddr(struct eth_device *dev, const char *base_name,
 		if (!is_zero_ethaddr(dev->enetaddr) &&
 		    memcmp(dev->enetaddr, env_enetaddr, 6)) {
 			printf("\nWarning: %s MAC addresses don't match:\n",
-				dev->name);
+			       dev->name);
 			printf("Address in SROM is         %pM\n",
-				dev->enetaddr);
+			       dev->enetaddr);
 			printf("Address in environment is  %pM\n",
-				env_enetaddr);
+			       env_enetaddr);
 		}
 
 		memcpy(dev->enetaddr, env_enetaddr, 6);
@@ -622,7 +625,7 @@ int eth_write_hwaddr(struct eth_device *dev, const char *base_name,
 		eth_setenv_enetaddr_by_index(base_name, eth_number,
 					     dev->enetaddr);
 		printf("\nWarning: %s using MAC address from net device\n",
-			dev->name);
+		       dev->name);
 	} else if (is_zero_ethaddr(dev->enetaddr)) {
 		printf("\nError: %s address not set.\n",
 		       dev->name);
@@ -632,13 +635,14 @@ int eth_write_hwaddr(struct eth_device *dev, const char *base_name,
 	if (dev->write_hwaddr && !eth_mac_skip(eth_number)) {
 		if (!is_valid_ethaddr(dev->enetaddr)) {
 			printf("\nError: %s address %pM illegal value\n",
-				 dev->name, dev->enetaddr);
+			       dev->name, dev->enetaddr);
 			return -EINVAL;
 		}
 
 		ret = dev->write_hwaddr(dev);
 		if (ret)
-			printf("\nWarning: %s failed to set MAC address\n", dev->name);
+			printf("\nWarning: %s failed to set MAC address\n",
+			       dev->name);
 	}
 
 	return ret;
@@ -652,7 +656,8 @@ int eth_register(struct eth_device *dev)
 	assert(strlen(dev->name) < sizeof(dev->name));
 
 	if (!eth_devices) {
-		eth_current = eth_devices = dev;
+		eth_devices = dev;
+		eth_current = dev;
 		eth_current_changed();
 	} else {
 		for (d = eth_devices; d->next != eth_devices; d = d->next)
@@ -723,8 +728,9 @@ int eth_initialize(void)
 	} else if (cpu_eth_init != __def_eth_init) {
 		if (cpu_eth_init(gd->bd) < 0)
 			printf("CPU Net Initialization Failed\n");
-	} else
+	} else {
 		printf("Net Initialization Skipped\n");
+	}
 
 	if (!eth_devices) {
 		puts("No ethernet found.\n");
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH 20/23] net: cosmetic: Fix checkpatch.pl failures in net.h
  2015-04-03 21:14 [U-Boot] [PATCH 0/23] net: cosmetic: Fix naming and other checkpatch.pl issues in net/ Joe Hershberger
                   ` (18 preceding siblings ...)
  2015-04-03 21:14 ` [U-Boot] [PATCH 19/23] net: cosmetic: Fix checkpatch.pl failures in eth.c Joe Hershberger
@ 2015-04-03 21:14 ` Joe Hershberger
  2015-04-03 21:14 ` [U-Boot] [PATCH 21/23] net: cosmetic: Fix checkpatch.pl failures in net.c Joe Hershberger
                   ` (4 subsequent siblings)
  24 siblings, 0 replies; 103+ messages in thread
From: Joe Hershberger @ 2015-04-03 21:14 UTC (permalink / raw)
  To: u-boot

There were still a few remaining complains in the legacy eth_device
definition that hadn't been addressed.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

 include/net.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/net.h b/include/net.h
index c4a534c..069b688 100644
--- a/include/net.h
+++ b/include/net.h
@@ -143,14 +143,14 @@ struct eth_device {
 	phys_addr_t iobase;
 	int state;
 
-	int  (*init) (struct eth_device *, bd_t *);
-	int  (*send) (struct eth_device *, void *packet, int length);
-	int  (*recv) (struct eth_device *);
-	void (*halt) (struct eth_device *);
+	int (*init)(struct eth_device *, bd_t *);
+	int (*send)(struct eth_device *, void *packet, int length);
+	int (*recv)(struct eth_device *);
+	void (*halt)(struct eth_device *);
 #ifdef CONFIG_MCAST_TFTP
-	int (*mcast) (struct eth_device *, const u8 *enetaddr, u8 set);
+	int (*mcast)(struct eth_device *, const u8 *enetaddr, u8 set);
 #endif
-	int  (*write_hwaddr) (struct eth_device *);
+	int (*write_hwaddr)(struct eth_device *);
 	struct eth_device *next;
 	int index;
 	void *priv;
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH 21/23] net: cosmetic: Fix checkpatch.pl failures in net.c
  2015-04-03 21:14 [U-Boot] [PATCH 0/23] net: cosmetic: Fix naming and other checkpatch.pl issues in net/ Joe Hershberger
                   ` (19 preceding siblings ...)
  2015-04-03 21:14 ` [U-Boot] [PATCH 20/23] net: cosmetic: Fix checkpatch.pl failures in net.h Joe Hershberger
@ 2015-04-03 21:14 ` Joe Hershberger
  2015-04-03 21:14 ` [U-Boot] [PATCH 22/23] net: Fix incorrect DHCP/BOOTP packets on 64-bit systems Joe Hershberger
                   ` (3 subsequent siblings)
  24 siblings, 0 replies; 103+ messages in thread
From: Joe Hershberger @ 2015-04-03 21:14 UTC (permalink / raw)
  To: u-boot

Finish eliminating CamelCase from net.c and other failures

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

 README                   |   6 +-
 common/cmd_elf.c         |   2 +-
 common/cmd_net.c         |  22 +++---
 common/spl/spl_net.c     |   2 +-
 common/update.c          |   2 +-
 doc/README.link-local    |   4 +-
 drivers/net/netconsole.c |  12 ++--
 include/net.h            |  18 ++---
 net/arp.c                |   2 +-
 net/bootp.c              |  33 ++++-----
 net/cdp.c                |   6 +-
 net/dns.c                |   2 +-
 net/eth.c                |   2 +-
 net/link_local.c         |   4 +-
 net/net.c                | 179 +++++++++++++++++++++++------------------------
 net/nfs.c                |  11 +--
 net/ping.c               |   2 +-
 net/rarp.c               |   6 +-
 net/sntp.c               |   4 +-
 net/tftp.c               |  18 ++---
 test/dm/eth.c            |  28 ++++----
 21 files changed, 181 insertions(+), 184 deletions(-)

diff --git a/README b/README
index 5d57eb9..25aebbc 100644
--- a/README
+++ b/README
@@ -3340,9 +3340,9 @@ Legacy uImage format:
    65	net/eth.c		Ethernet found.
 
   -80	common/cmd_net.c	usage wrong
-   80	common/cmd_net.c	before calling NetLoop()
-  -81	common/cmd_net.c	some error in NetLoop() occurred
-   81	common/cmd_net.c	NetLoop() back without error
+   80	common/cmd_net.c	before calling net_loop()
+  -81	common/cmd_net.c	some error in net_loop() occurred
+   81	common/cmd_net.c	net_loop() back without error
   -82	common/cmd_net.c	size == 0 (File with size 0 loaded)
    82	common/cmd_net.c	trying automatic boot
    83	common/cmd_net.c	running "source" command
diff --git a/common/cmd_elf.c b/common/cmd_elf.c
index c745371..22475dc 100644
--- a/common/cmd_elf.c
+++ b/common/cmd_elf.c
@@ -170,7 +170,7 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	 * Check to see if we need to tftp the image ourselves before starting
 	 */
 	if ((argc == 2) && (strcmp(argv[1], "tftp") == 0)) {
-		if (NetLoop(TFTPGET) <= 0)
+		if (net_loop(TFTPGET) <= 0)
 			return 1;
 		printf("Automatic boot of VxWorks image@address 0x%08lx ...\n",
 			addr);
diff --git a/common/cmd_net.c b/common/cmd_net.c
index 6c8d517..09e95d5 100644
--- a/common/cmd_net.c
+++ b/common/cmd_net.c
@@ -158,8 +158,8 @@ static void netboot_update_env(void)
 		setenv("domain", net_nis_domain);
 
 #if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_TIMEOFFSET)
-	if (NetTimeOffset) {
-		sprintf(tmp, "%d", NetTimeOffset);
+	if (net_ntp_time_offset) {
+		sprintf(tmp, "%d", net_ntp_time_offset);
 		setenv("timeoffset", tmp);
 	}
 #endif
@@ -227,14 +227,14 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc,
 	}
 	bootstage_mark(BOOTSTAGE_ID_NET_START);
 
-	size = NetLoop(proto);
+	size = net_loop(proto);
 	if (size < 0) {
 		bootstage_error(BOOTSTAGE_ID_NET_NETLOOP_OK);
 		return CMD_RET_FAILURE;
 	}
 	bootstage_mark(BOOTSTAGE_ID_NET_NETLOOP_OK);
 
-	/* NetLoop ok, update environment */
+	/* net_loop ok, update environment */
 	netboot_update_env();
 
 	/* done if no file was loaded (no errors though) */
@@ -267,7 +267,7 @@ static int do_ping(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	if (net_ping_ip.s_addr == 0)
 		return CMD_RET_USAGE;
 
-	if (NetLoop(PING) < 0) {
+	if (net_loop(PING) < 0) {
 		printf("ping failed; host %s is not alive\n", argv[1]);
 		return CMD_RET_FAILURE;
 	}
@@ -310,7 +310,7 @@ int do_cdp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	int r;
 
-	r = NetLoop(CDP);
+	r = net_loop(CDP);
 	if (r < 0) {
 		printf("cdp failed; perhaps not a CISCO switch?\n");
 		return CMD_RET_FAILURE;
@@ -349,11 +349,11 @@ int do_sntp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 	toff = getenv("timeoffset");
 	if (toff == NULL)
-		NetTimeOffset = 0;
+		net_ntp_time_offset = 0;
 	else
-		NetTimeOffset = simple_strtol(toff, NULL, 10);
+		net_ntp_time_offset = simple_strtol(toff, NULL, 10);
 
-	if (NetLoop(SNTP) < 0) {
+	if (net_loop(SNTP) < 0) {
 		printf("SNTP failed: host %pI4 not responding\n",
 		       &net_ntp_server);
 		return CMD_RET_FAILURE;
@@ -399,7 +399,7 @@ int do_dns(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	else
 		net_dns_env_var = NULL;
 
-	if (NetLoop(DNS) < 0) {
+	if (net_loop(DNS) < 0) {
 		printf("dns lookup of %s failed, check setup\n", argv[1]);
 		return CMD_RET_FAILURE;
 	}
@@ -421,7 +421,7 @@ static int do_link_local(cmd_tbl_t *cmdtp, int flag, int argc,
 {
 	char tmp[22];
 
-	if (NetLoop(LINKLOCAL) < 0)
+	if (net_loop(LINKLOCAL) < 0)
 		return CMD_RET_FAILURE;
 
 	net_gateway.s_addr = 0;
diff --git a/common/spl/spl_net.c b/common/spl/spl_net.c
index af4952f..217a435 100644
--- a/common/spl/spl_net.c
+++ b/common/spl/spl_net.c
@@ -28,7 +28,7 @@ void spl_net_load_image(const char *device)
 	}
 	if (device)
 		setenv("ethact", device);
-	rv = NetLoop(BOOTP);
+	rv = net_loop(BOOTP);
 	if (rv < 0) {
 		printf("Problem booting with BOOTP\n");
 		hang();
diff --git a/common/update.c b/common/update.c
index 1bf2f82..1c6aa18 100644
--- a/common/update.c
+++ b/common/update.c
@@ -70,7 +70,7 @@ static int update_load(char *filename, ulong msec_max, int cnt_max, ulong addr)
 	/* download the update file */
 	load_addr = addr;
 	copy_filename(net_boot_file_name, filename, sizeof(net_boot_file_name));
-	size = NetLoop(TFTPGET);
+	size = net_loop(TFTPGET);
 
 	if (size < 0)
 		rv = 1;
diff --git a/doc/README.link-local b/doc/README.link-local
index 9586eca..148b498 100644
--- a/doc/README.link-local
+++ b/doc/README.link-local
@@ -32,11 +32,11 @@ after successful negotiation to enable network access.
 -------------
 
 RFC3927 requires that addresses are continuously checked to
-avoid conflicts, however this can only happen when the NetLoop
+avoid conflicts, however this can only happen when the net_loop
 is getting called.  It is possible for a conflict to go undetected
 until a command that accesses the network is executed.
 
-Using NetConsole is one way to ensure that NetLoop is always
+Using NetConsole is one way to ensure that net_loop is always
 processing packets and monitoring for conflicts.
 
 This is also not a concern if the feature is use to connect
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index c2e0184..31042a6 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -113,7 +113,7 @@ static int refresh_settings_from_env(void)
 }
 
 /**
- * Called from NetLoop in net/net.c before each packet
+ * Called from net_loop in net/net.c before each packet
  */
 void nc_start(void)
 {
@@ -121,7 +121,7 @@ void nc_start(void)
 	if (!output_packet_len || memcmp(nc_ether, net_null_ethaddr, 6)) {
 		/* going to check for input packet */
 		net_set_udp_handler(nc_handler);
-		NetSetTimeout(net_timeout, nc_timeout_handler);
+		net_set_timeout_handler(net_timeout, nc_timeout_handler);
 	} else {
 		/* send arp request */
 		uchar *pkt;
@@ -188,7 +188,7 @@ static void nc_send_packet(const char *buf, int len)
 		output_packet = buf;
 		output_packet_len = len;
 		input_recursion = 1;
-		NetLoop(NETCONS); /* wait for arp reply and send packet */
+		net_loop(NETCONS); /* wait for arp reply and send packet */
 		input_recursion = 0;
 		output_packet_len = 0;
 		return;
@@ -232,7 +232,7 @@ static int nc_stdio_start(struct stdio_dev *dev)
 
 	/*
 	 * Initialize the static IP settings and buffer pointers
-	 * incase we call net_send_udp_packet before NetLoop
+	 * incase we call net_send_udp_packet before net_loop
 	 */
 	net_init();
 
@@ -277,7 +277,7 @@ static int nc_stdio_getc(struct stdio_dev *dev)
 
 	net_timeout = 0;	/* no timeout */
 	while (!input_size)
-		NetLoop(NETCONS);
+		net_loop(NETCONS);
 
 	input_recursion = 0;
 
@@ -307,7 +307,7 @@ static int nc_stdio_tstc(struct stdio_dev *dev)
 	input_recursion = 1;
 
 	net_timeout = 1;
-	NetLoop(NETCONS);	/* kind of poll */
+	net_loop(NETCONS);	/* kind of poll */
 
 	input_recursion = 0;
 
diff --git a/include/net.h b/include/net.h
index 069b688..e9131f7 100644
--- a/include/net.h
+++ b/include/net.h
@@ -479,7 +479,6 @@ extern uchar		*net_tx_packet;		/* THE transmit packet */
 extern uchar		*net_rx_packets[PKTBUFSRX]; /* Receive packets */
 extern uchar		*net_rx_packet;		/* Current receive packet */
 extern int		net_rx_packet_len;	/* Current rx packet length */
-extern unsigned		NetIPID;		/* IP ID (counting) */
 extern const u8		net_bcast_ethaddr[6];	/* Ethernet broadcast address */
 extern const u8		net_null_ethaddr[6];
 
@@ -488,7 +487,7 @@ extern const u8		net_null_ethaddr[6];
 extern ushort		net_our_vlan;		/* Our VLAN */
 extern ushort		net_native_vlan;	/* Our Native VLAN */
 
-extern int		NetRestartWrap;		/* Tried all network devices */
+extern int		net_restart_wrap;	/* Tried all network devices */
 
 enum proto_t {
 	BOOTP, RARP, ARP, TFTPGET, DHCP, PING, DNS, NFS, CDP, NETCONS, SNTP,
@@ -528,7 +527,7 @@ static inline int is_cdp_packet(const uchar *ethaddr)
 
 #if defined(CONFIG_CMD_SNTP)
 extern struct in_addr	net_ntp_server;		/* the ip address to NTP */
-extern int NetTimeOffset;			/* offset time from UTC */
+extern int net_ntp_time_offset;			/* offset time from UTC */
 #endif
 
 #if defined(CONFIG_MCAST_TFTP)
@@ -537,13 +536,10 @@ extern struct in_addr net_mcast_addr;
 
 /* Initialize the network adapter */
 void net_init(void);
-int NetLoop(enum proto_t);
-
-/* Shutdown adapters and cleanup */
-void	NetStop(void);
+int net_loop(enum proto_t);
 
 /* Load failed.	 Start again. */
-int	NetStartAgain(void);
+int net_start_again(void);
 
 /* Get size of the ethernet header when we send */
 int net_eth_hdr_size(void);
@@ -593,7 +589,7 @@ void net_set_udp_handler(rxhand_f *);	/* Set UDP RX packet handler */
 rxhand_f *net_get_arp_handler(void);	/* Get ARP RX packet handler */
 void net_set_arp_handler(rxhand_f *);	/* Set ARP RX packet handler */
 void net_set_icmp_handler(rxhand_icmp_f *f); /* Set ICMP RX handler */
-void	NetSetTimeout(ulong, thand_f *);/* Set timeout handler */
+void net_set_timeout_handler(ulong, thand_f *);/* Set timeout handler */
 
 /* Network loop state */
 enum net_loop_state {
@@ -682,7 +678,7 @@ static inline struct in_addr net_read_ip(void *from)
 }
 
 /* return ulong *in network byteorder* */
-static inline ulong NetReadLong(ulong *from)
+static inline ulong net_read_long(ulong *from)
 {
 	ulong l;
 
@@ -703,7 +699,7 @@ static inline void net_copy_ip(void *to, void *from)
 }
 
 /* copy ulong */
-static inline void NetCopyLong(ulong *to, ulong *from)
+static inline void net_copy_long(ulong *to, ulong *from)
 {
 	memcpy((void *)to, (void *)from, sizeof(ulong));
 }
diff --git a/net/arp.c b/net/arp.c
index f64f13d..4eee38b 100644
--- a/net/arp.c
+++ b/net/arp.c
@@ -112,7 +112,7 @@ void arp_timeout_check(void)
 		if (arp_wait_try >= ARP_TIMEOUT_COUNT) {
 			puts("\nARP Retry count exceeded; starting again\n");
 			arp_wait_try = 0;
-			NetStartAgain();
+			net_start_again();
 		} else {
 			arp_wait_timer_start = t;
 			arp_request();
diff --git a/net/bootp.c b/net/bootp.c
index fa75125..500850c 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -128,7 +128,7 @@ static int check_packet(uchar *pkt, unsigned dest, unsigned src, unsigned len)
 		retval = -4;
 	else if (bp->bp_hlen != HWL_ETHER)
 		retval = -5;
-	else if (!bootp_match_id(NetReadLong((ulong *)&bp->bp_id)))
+	else if (!bootp_match_id(net_read_long((ulong *)&bp->bp_id)))
 		retval = -6;
 
 	debug("Filtering pkt = %d\n", retval);
@@ -356,10 +356,11 @@ static void bootp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 	store_net_params(bp);		/* Store net parameters from reply */
 
 	/* Retrieve extended information (we must parse the vendor area) */
-	if (NetReadLong((ulong *)&bp->bp_vend[0]) == htonl(BOOTP_VENDOR_MAGIC))
+	if (net_read_long((ulong *)&bp->bp_vend[0]) ==
+	    htonl(BOOTP_VENDOR_MAGIC))
 		bootp_process_vendor((uchar *)&bp->bp_vend[4], len);
 
-	NetSetTimeout(0, (thand_f *)0);
+	net_set_timeout_handler(0, (thand_f *)0);
 	bootstage_mark_name(BOOTSTAGE_ID_BOOTP_STOP, "bootp_stop");
 
 	debug("Got good BOOTP\n");
@@ -381,13 +382,13 @@ static void bootp_timeout_handler(void)
 		net_set_state(NETLOOP_FAIL);
 #else
 		puts("\nRetry time exceeded; starting again\n");
-		NetStartAgain();
+		net_start_again();
 #endif
 	} else {
 		bootp_timeout *= 2;
 		if (bootp_timeout > 2000)
 			bootp_timeout = 2000;
-		NetSetTimeout(bootp_timeout, bootp_timeout_handler);
+		net_set_timeout_handler(bootp_timeout, bootp_timeout_handler);
 		bootp_request();
 	}
 }
@@ -740,7 +741,7 @@ void bootp_request(void)
 	bootp_id += get_timer(0);
 	bootp_id = htonl(bootp_id);
 	bootp_add_id(bootp_id);
-	NetCopyLong(&bp->bp_id, &bootp_id);
+	net_copy_long(&bp->bp_id, &bootp_id);
 
 	/*
 	 * Calculate proper packet lengths taking into account the
@@ -750,7 +751,7 @@ void bootp_request(void)
 	pktlen = eth_hdr_size + IP_UDP_HDR_SIZE + iplen;
 	bcast_ip.s_addr = 0xFFFFFFFFL;
 	net_set_udp_header(iphdr, bcast_ip, PORT_BOOTPS, PORT_BOOTPC, iplen);
-	NetSetTimeout(bootp_timeout, bootp_timeout_handler);
+	net_set_timeout_handler(bootp_timeout, bootp_timeout_handler);
 
 #if defined(CONFIG_CMD_DHCP)
 	dhcp_state = SELECTING;
@@ -778,9 +779,9 @@ static void dhcp_process_options(uchar *popt, struct bootp_hdr *bp)
 			break;
 #if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_TIMEOFFSET)
 		case 2:		/* Time offset	*/
-			to_ptr = &NetTimeOffset;
-			NetCopyLong((ulong *)to_ptr, (ulong *)(popt + 2));
-			NetTimeOffset = ntohl(NetTimeOffset);
+			to_ptr = &net_ntp_time_offset;
+			net_copy_long((ulong *)to_ptr, (ulong *)(popt + 2));
+			net_ntp_time_offset = ntohl(net_ntp_time_offset);
 			break;
 #endif
 		case 3:
@@ -815,7 +816,7 @@ static void dhcp_process_options(uchar *popt, struct bootp_hdr *bp)
 			break;
 #endif
 		case 51:
-			NetCopyLong(&dhcp_leasetime, (ulong *) (popt + 2));
+			net_copy_long(&dhcp_leasetime, (ulong *)(popt + 2));
 			break;
 		case 53:	/* Ignore Message Type Option */
 			break;
@@ -869,7 +870,7 @@ static void dhcp_process_options(uchar *popt, struct bootp_hdr *bp)
 
 static int dhcp_message_type(unsigned char *popt)
 {
-	if (NetReadLong((ulong *)popt) != htonl(BOOTP_VENDOR_MAGIC))
+	if (net_read_long((ulong *)popt) != htonl(BOOTP_VENDOR_MAGIC))
 		return -1;
 
 	popt += 4;
@@ -923,7 +924,7 @@ static void dhcp_send_request_packet(struct bootp_hdr *bp_offer)
 	 * ID is the id of the OFFER packet
 	 */
 
-	NetCopyLong(&bp->bp_id, &bp_offer->bp_id);
+	net_copy_long(&bp->bp_id, &bp_offer->bp_id);
 
 	/*
 	 * Copy options from OFFER packet if present
@@ -982,11 +983,11 @@ static void dhcp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 			debug("TRANSITIONING TO REQUESTING STATE\n");
 			dhcp_state = REQUESTING;
 
-			if (NetReadLong((ulong *)&bp->bp_vend[0]) ==
+			if (net_read_long((ulong *)&bp->bp_vend[0]) ==
 						htonl(BOOTP_VENDOR_MAGIC))
 				dhcp_process_options((u8 *)&bp->bp_vend[4], bp);
 
-			NetSetTimeout(5000, bootp_timeout_handler);
+			net_set_timeout_handler(5000, bootp_timeout_handler);
 			dhcp_send_request_packet(bp);
 #ifdef CONFIG_SYS_BOOTFILE_PREFIX
 		}
@@ -998,7 +999,7 @@ static void dhcp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 		debug("DHCP State: REQUESTING\n");
 
 		if (dhcp_message_type((u8 *)bp->bp_vend) == DHCP_ACK) {
-			if (NetReadLong((ulong *)&bp->bp_vend[0]) ==
+			if (net_read_long((ulong *)&bp->bp_vend[0]) ==
 						htonl(BOOTP_VENDOR_MAGIC))
 				dhcp_process_options((u8 *)&bp->bp_vend[4], bp);
 			/* Store net params from reply */
diff --git a/net/cdp.c b/net/cdp.c
index d8df3ea..f9ccf53 100644
--- a/net/cdp.c
+++ b/net/cdp.c
@@ -224,14 +224,14 @@ static void cdp_timeout_handler(void)
 	cdp_seq++;
 
 	if (cdp_seq < 3) {
-		NetSetTimeout(CDP_TIMEOUT, cdp_timeout_handler);
+		net_set_timeout_handler(CDP_TIMEOUT, cdp_timeout_handler);
 		cdp_send_trigger();
 		return;
 	}
 
 	/* if not OK try again */
 	if (!cdp_ok)
-		NetStartAgain();
+		net_start_again();
 	else
 		net_set_state(NETLOOP_SUCCESS);
 }
@@ -357,7 +357,7 @@ void cdp_start(void)
 	cdp_native_vlan = htons(-1);
 	cdp_appliance_vlan = htons(-1);
 
-	NetSetTimeout(CDP_TIMEOUT, cdp_timeout_handler);
+	net_set_timeout_handler(CDP_TIMEOUT, cdp_timeout_handler);
 
 	cdp_send_trigger();
 }
diff --git a/net/dns.c b/net/dns.c
index cf4ed86..7017bac 100644
--- a/net/dns.c
+++ b/net/dns.c
@@ -197,7 +197,7 @@ void dns_start(void)
 {
 	debug("%s\n", __func__);
 
-	NetSetTimeout(DNS_TIMEOUT, dns_timeout_handler);
+	net_set_timeout_handler(DNS_TIMEOUT, dns_timeout_handler);
 	net_set_udp_handler(dns_handler);
 
 	/* Clear a previous MAC address, the server IP might have changed. */
diff --git a/net/eth.c b/net/eth.c
index 953b6a6..6ea1b13 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -963,7 +963,7 @@ void eth_try_another(int first_restart)
 	eth_current_changed();
 
 	if (first_failed == eth_get_dev())
-		NetRestartWrap = 1;
+		net_restart_wrap = 1;
 }
 
 void eth_set_current(void)
diff --git a/net/link_local.c b/net/link_local.c
index e2f14fc..9a712be 100644
--- a/net/link_local.c
+++ b/net/link_local.c
@@ -97,7 +97,7 @@ static void configure_wait(void)
 	debug_cond(DEBUG_DEV_PKT, "...wait %d %s nprobes=%u, nclaims=%u\n",
 		   timeout_ms, eth_get_name(), nprobes, nclaims);
 
-	NetSetTimeout(timeout_ms, link_local_timeout);
+	net_set_timeout_handler(timeout_ms, link_local_timeout);
 }
 
 void link_local_start(void)
@@ -178,7 +178,7 @@ static void link_local_timeout(void)
 			conflicts = 0;
 			timeout_ms = -1;
 			/* Never timeout in the monitor state */
-			NetSetTimeout(0, NULL);
+			net_set_timeout_handler(0, NULL);
 
 			/* NOTE: all other exit paths should deconfig ... */
 			net_set_state(NETLOOP_SUCCESS);
diff --git a/net/net.c b/net/net.c
index e78638d..5331799 100644
--- a/net/net.c
+++ b/net/net.c
@@ -141,21 +141,21 @@ uchar *net_rx_packet;
 /* Current rx packet length */
 int		net_rx_packet_len;
 /* IP packet ID */
-unsigned	NetIPID;
+static unsigned	net_ip_id;
 /* Ethernet bcast address */
 const u8 net_bcast_ethaddr[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
 const u8 net_null_ethaddr[6];
 #ifdef CONFIG_API
-void		(*push_packet)(void *, int len) = 0;
+void (*push_packet)(void *, int len) = 0;
 #endif
 /* Network loop state */
 enum net_loop_state net_state;
 /* Tried all network devices */
-int		NetRestartWrap;
+int		net_restart_wrap;
 /* Network loop restarted */
-static int	NetRestarted;
+static int	net_restarted;
 /* At least one device configured */
-static int	NetDevExists;
+static int	net_dev_exists;
 
 /* XXX in both little & big endian machines 0xFFFF == ntohs(-1) */
 /* default is without VLAN */
@@ -174,7 +174,7 @@ u32 net_boot_file_expected_size_in_blocks;
 /* NTP server IP address */
 struct in_addr	net_ntp_server;
 /* offset time from UTC */
-int		NetTimeOffset;
+int		net_ntp_time_offset;
 #endif
 
 static uchar net_pkt_buf[(PKTBUFSRX+1) * PKTSIZE_ALIGN + PKTALIGN];
@@ -189,17 +189,17 @@ static rxhand_f *arp_packet_handler;
 static rxhand_icmp_f *packet_icmp_handler;
 #endif
 /* Current timeout handler */
-static thand_f *timeHandler;
+static thand_f *time_handler;
 /* Time base value */
-static ulong	timeStart;
+static ulong	time_start;
 /* Current timeout value */
-static ulong	timeDelta;
+static ulong	time_delta;
 /* THE transmit packet */
 uchar *net_tx_packet;
 
 static int net_check_prereq(enum proto_t protocol);
 
-static int NetTryCount;
+static int net_try_count;
 
 int __maybe_unused net_busy_flag;
 
@@ -250,7 +250,7 @@ void net_auto_load(void)
 	tftp_start(TFTPGET);
 }
 
-static void NetInitLoop(void)
+static void net_init_loop(void)
 {
 	static int env_changed_id;
 	int env_id = get_env_id();
@@ -278,7 +278,7 @@ static void net_clear_handlers(void)
 {
 	net_set_udp_handler(NULL);
 	net_set_arp_handler(NULL);
-	NetSetTimeout(0, NULL);
+	net_set_timeout_handler(0, NULL);
 }
 
 static void net_cleanup_loop(void)
@@ -309,7 +309,7 @@ void net_init(void)
 		first_call = 0;
 	}
 
-	NetInitLoop();
+	net_init_loop();
 }
 
 /**********************************************************************/
@@ -317,14 +317,14 @@ void net_init(void)
  *	Main network processing loop.
  */
 
-int NetLoop(enum proto_t protocol)
+int net_loop(enum proto_t protocol)
 {
 	int ret = -EINVAL;
 
-	NetRestarted = 0;
-	NetDevExists = 0;
-	NetTryCount = 1;
-	debug_cond(DEBUG_INT_STATE, "--- NetLoop Entry\n");
+	net_restarted = 0;
+	net_dev_exists = 0;
+	net_try_count = 1;
+	debug_cond(DEBUG_INT_STATE, "--- net_loop Entry\n");
 
 	bootstage_mark_name(BOOTSTAGE_ID_ETH_START, "eth_start");
 	net_init();
@@ -336,9 +336,9 @@ int NetLoop(enum proto_t protocol)
 			eth_halt();
 			return ret;
 		}
-	} else
+	} else {
 		eth_init_state_only();
-
+	}
 restart:
 #ifdef CONFIG_USB_KEYBOARD
 	net_busy_flag = 0;
@@ -350,8 +350,8 @@ restart:
 	 *	here on, this code is a state machine driven by received
 	 *	packets and timer events.
 	 */
-	debug_cond(DEBUG_INT_STATE, "--- NetLoop Init\n");
-	NetInitLoop();
+	debug_cond(DEBUG_INT_STATE, "--- net_loop Init\n");
+	net_init_loop();
 
 	switch (net_check_prereq(protocol)) {
 	case 1:
@@ -364,7 +364,7 @@ restart:
 		break;
 
 	case 0:
-		NetDevExists = 1;
+		net_dev_exists = 1;
 		net_boot_file_size = 0;
 		switch (protocol) {
 		case TFTPGET:
@@ -415,7 +415,7 @@ restart:
 			cdp_start();
 			break;
 #endif
-#if defined (CONFIG_NETCONSOLE) && !(CONFIG_SPL_BUILD)
+#if defined(CONFIG_NETCONSOLE) && !(CONFIG_SPL_BUILD)
 		case NETCONS:
 			nc_start();
 			break;
@@ -491,7 +491,7 @@ restart:
 			puts("\nAbort\n");
 			/* include a debug print as well incase the debug
 			   messages are directed to stderr */
-			debug_cond(DEBUG_INT_STATE, "--- NetLoop Abort!\n");
+			debug_cond(DEBUG_INT_STATE, "--- net_loop Abort!\n");
 			goto done;
 		}
 
@@ -501,7 +501,8 @@ restart:
 		 *	Check for a timeout, and run the timeout handler
 		 *	if we have one.
 		 */
-		if (timeHandler && ((get_timer(0) - timeStart) > timeDelta)) {
+		if (time_handler &&
+		    ((get_timer(0) - time_start) > time_delta)) {
 			thand_f *x;
 
 #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
@@ -512,26 +513,24 @@ restart:
 			 * Echo the inverted link state to the fault LED.
 			 */
 			if (miiphy_link(eth_get_dev()->name,
-				       CONFIG_SYS_FAULT_MII_ADDR)) {
+					CONFIG_SYS_FAULT_MII_ADDR))
 				status_led_set(STATUS_LED_RED, STATUS_LED_OFF);
-			} else {
+			else
 				status_led_set(STATUS_LED_RED, STATUS_LED_ON);
-			}
 #endif /* CONFIG_SYS_FAULT_ECHO_LINK_DOWN, ... */
 #endif /* CONFIG_MII, ... */
-			debug_cond(DEBUG_INT_STATE, "--- NetLoop timeout\n");
-			x = timeHandler;
-			timeHandler = (thand_f *)0;
+			debug_cond(DEBUG_INT_STATE, "--- net_loop timeout\n");
+			x = time_handler;
+			time_handler = (thand_f *)0;
 			(*x)();
 		}
 
 		if (net_state == NETLOOP_FAIL)
-			ret = NetStartAgain();
+			ret = net_start_again();
 
 		switch (net_state) {
-
 		case NETLOOP_RESTART:
-			NetRestarted = 1;
+			net_restarted = 1;
 			goto restart;
 
 		case NETLOOP_SUCCESS:
@@ -550,14 +549,14 @@ restart:
 			eth_set_last_protocol(protocol);
 
 			ret = net_boot_file_size;
-			debug_cond(DEBUG_INT_STATE, "--- NetLoop Success!\n");
+			debug_cond(DEBUG_INT_STATE, "--- net_loop Success!\n");
 			goto done;
 
 		case NETLOOP_FAIL:
 			net_cleanup_loop();
 			/* Invalidate the last protocol */
 			eth_set_last_protocol(BOOTP);
-			debug_cond(DEBUG_INT_STATE, "--- NetLoop Fail!\n");
+			debug_cond(DEBUG_INT_STATE, "--- net_loop Fail!\n");
 			goto done;
 
 		case NETLOOP_CONTINUE:
@@ -579,13 +578,12 @@ done:
 
 /**********************************************************************/
 
-static void
-startAgainTimeout(void)
+static void start_again_timeout_handler(void)
 {
 	net_set_state(NETLOOP_RESTART);
 }
 
-int NetStartAgain(void)
+int net_start_again(void)
 {
 	char *nretry;
 	int retry_forever = 0;
@@ -607,7 +605,7 @@ int NetStartAgain(void)
 		retry_forever = 0;
 	}
 
-	if ((!retry_forever) && (NetTryCount >= retrycnt)) {
+	if ((!retry_forever) && (net_try_count >= retrycnt)) {
 		eth_halt();
 		net_set_state(NETLOOP_FAIL);
 		/*
@@ -617,17 +615,18 @@ int NetStartAgain(void)
 		return -ETIMEDOUT;
 	}
 
-	NetTryCount++;
+	net_try_count++;
 
 	eth_halt();
 #if !defined(CONFIG_NET_DO_NOT_TRY_ANOTHER)
-	eth_try_another(!NetRestarted);
+	eth_try_another(!net_restarted);
 #endif
 	ret = eth_init();
-	if (NetRestartWrap) {
-		NetRestartWrap = 0;
-		if (NetDevExists) {
-			NetSetTimeout(10000UL, startAgainTimeout);
+	if (net_restart_wrap) {
+		net_restart_wrap = 0;
+		if (net_dev_exists) {
+			net_set_timeout_handler(10000UL,
+						start_again_timeout_handler);
 			net_set_udp_handler(NULL);
 		} else {
 			net_set_state(NETLOOP_FAIL);
@@ -656,7 +655,7 @@ rxhand_f *net_get_udp_handler(void)
 
 void net_set_udp_handler(rxhand_f *f)
 {
-	debug_cond(DEBUG_INT_STATE, "--- NetLoop UDP handler set (%p)\n", f);
+	debug_cond(DEBUG_INT_STATE, "--- net_loop UDP handler set (%p)\n", f);
 	if (f == NULL)
 		udp_packet_handler = dummy_handler;
 	else
@@ -670,7 +669,7 @@ rxhand_f *net_get_arp_handler(void)
 
 void net_set_arp_handler(rxhand_f *f)
 {
-	debug_cond(DEBUG_INT_STATE, "--- NetLoop ARP handler set (%p)\n", f);
+	debug_cond(DEBUG_INT_STATE, "--- net_loop ARP handler set (%p)\n", f);
 	if (f == NULL)
 		arp_packet_handler = dummy_handler;
 	else
@@ -684,19 +683,18 @@ void net_set_icmp_handler(rxhand_icmp_f *f)
 }
 #endif
 
-void
-NetSetTimeout(ulong iv, thand_f *f)
+void net_set_timeout_handler(ulong iv, thand_f *f)
 {
 	if (iv == 0) {
 		debug_cond(DEBUG_INT_STATE,
-			"--- NetLoop timeout handler cancelled\n");
-		timeHandler = (thand_f *)0;
+			   "--- net_loop timeout handler cancelled\n");
+		time_handler = (thand_f *)0;
 	} else {
 		debug_cond(DEBUG_INT_STATE,
-			"--- NetLoop timeout handler set (%p)\n", f);
-		timeHandler = f;
-		timeStart = get_timer(0);
-		timeDelta = iv * CONFIG_SYS_HZ / 1000;
+			   "--- net_loop timeout handler set (%p)\n", f);
+		time_handler = f;
+		time_start = get_timer(0);
+		time_delta = iv * CONFIG_SYS_HZ / 1000;
 	}
 }
 
@@ -707,7 +705,7 @@ int net_send_udp_packet(uchar *ether, struct in_addr dest, int dport, int sport,
 	int eth_hdr_size;
 	int pkt_hdr_size;
 
-	/* make sure the net_tx_packet is initialized (NetInit() was called) */
+	/* make sure the net_tx_packet is initialized (net_init() was called) */
 	assert(net_tx_packet != NULL);
 	if (net_tx_packet == NULL)
 		return -1;
@@ -745,7 +743,7 @@ int net_send_udp_packet(uchar *ether, struct in_addr dest, int dport, int sport,
 		return 1;	/* waiting */
 	} else {
 		debug_cond(DEBUG_DEV_PKT, "sending UDP to %pI4/%pM\n",
-			&dest, ether);
+			   &dest, ether);
 		net_send_packet(net_tx_packet, pkt_hdr_size + payload_len);
 		return 0;	/* transmitted */
 	}
@@ -784,7 +782,7 @@ struct hole {
 	u16 unused;
 };
 
-static struct ip_udp_hdr *__NetDefragment(struct ip_udp_hdr *ip, int *lenp)
+static struct ip_udp_hdr *__net_defragment(struct ip_udp_hdr *ip, int *lenp)
 {
 	static uchar pkt_buff[IP_PKTSIZE] __aligned(PKTALIGN);
 	static u16 first_hole, total_len;
@@ -904,17 +902,19 @@ static struct ip_udp_hdr *__NetDefragment(struct ip_udp_hdr *ip, int *lenp)
 	return localip;
 }
 
-static inline struct ip_udp_hdr *NetDefragment(struct ip_udp_hdr *ip, int *lenp)
+static inline struct ip_udp_hdr *net_defragment(struct ip_udp_hdr *ip,
+	int *lenp)
 {
 	u16 ip_off = ntohs(ip->ip_off);
 	if (!(ip_off & (IP_OFFS | IP_FLAGS_MFRAG)))
 		return ip; /* not a fragment */
-	return __NetDefragment(ip, lenp);
+	return __net_defragment(ip, lenp);
 }
 
 #else /* !CONFIG_IP_DEFRAG */
 
-static inline struct ip_udp_hdr *NetDefragment(struct ip_udp_hdr *ip, int *lenp)
+static inline struct ip_udp_hdr *net_defragment(struct ip_udp_hdr *ip,
+	int *lenp)
 {
 	u16 ip_off = ntohs(ip->ip_off);
 	if (!(ip_off & (IP_OFFS | IP_FLAGS_MFRAG)))
@@ -939,7 +939,7 @@ static void receive_icmp(struct ip_udp_hdr *ip, int len,
 		if (icmph->code != ICMP_REDIR_HOST)
 			return;
 		printf(" ICMP Host Redirect to %pI4 ",
-			&icmph->un.gateway);
+		       &icmph->un.gateway);
 		break;
 	default:
 #if defined(CONFIG_CMD_PING)
@@ -948,8 +948,9 @@ static void receive_icmp(struct ip_udp_hdr *ip, int len,
 #ifdef CONFIG_CMD_TFTPPUT
 		if (packet_icmp_handler)
 			packet_icmp_handler(icmph->type, icmph->code,
-				ntohs(ip->udp_dst), src_ip, ntohs(ip->udp_src),
-				icmph->un.data, ntohs(ip->udp_len));
+					    ntohs(ip->udp_dst), src_ip,
+					    ntohs(ip->udp_src), icmph->un.data,
+					    ntohs(ip->udp_len));
 #endif
 		break;
 	}
@@ -1057,7 +1058,6 @@ void net_process_received_packet(uchar *in_packet, int len)
 	}
 
 	switch (eth_proto) {
-
 	case PROT_ARP:
 		arp_receive(et, ip, len);
 		break;
@@ -1072,7 +1072,7 @@ void net_process_received_packet(uchar *in_packet, int len)
 		/* Before we start poking the header, make sure it is there */
 		if (len < IP_UDP_HDR_SIZE) {
 			debug("len bad %d < %lu\n", len,
-				(ulong)IP_UDP_HDR_SIZE);
+			      (ulong)IP_UDP_HDR_SIZE);
 			return;
 		}
 		/* Check the packet length */
@@ -1082,7 +1082,7 @@ void net_process_received_packet(uchar *in_packet, int len)
 		}
 		len = ntohs(ip->ip_len);
 		debug_cond(DEBUG_NET_PKT, "len=%d, v=%02x\n",
-			len, ip->ip_hl_v & 0xff);
+			   len, ip->ip_hl_v & 0xff);
 
 		/* Can't deal with anything except IPv4 */
 		if ((ip->ip_hl_v & 0xf0) != 0x40)
@@ -1111,7 +1111,7 @@ void net_process_received_packet(uchar *in_packet, int len)
 		 * a fragment, and either the complete packet or NULL if
 		 * it is a fragment (if !CONFIG_IP_DEFRAG, it returns NULL)
 		 */
-		ip = NetDefragment(ip, &len);
+		ip = net_defragment(ip, &len);
 		if (!ip)
 			return;
 		/*
@@ -1143,8 +1143,8 @@ void net_process_received_packet(uchar *in_packet, int len)
 		}
 
 		debug_cond(DEBUG_DEV_PKT,
-			"received UDP (to=%pI4, from=%pI4, len=%d)\n",
-			&dst_ip, &src_ip, len);
+			   "received UDP (to=%pI4, from=%pI4, len=%d)\n",
+			   &dst_ip, &src_ip, len);
 
 #ifdef CONFIG_UDP_CHECKSUM
 		if (ip->udp_xsum != 0) {
@@ -1160,7 +1160,7 @@ void net_process_received_packet(uchar *in_packet, int len)
 			xsum += (ntohl(ip->ip_dst) >>  0) & 0x0000ffff;
 
 			sumlen = ntohs(ip->udp_len);
-			sumptr = (ushort *) &(ip->udp_src);
+			sumptr = (ushort *)&(ip->udp_src);
 
 			while (sumlen > 1) {
 				ushort sumdata;
@@ -1172,7 +1172,7 @@ void net_process_received_packet(uchar *in_packet, int len)
 			if (sumlen > 0) {
 				ushort sumdata;
 
-				sumdata = *(unsigned char *) sumptr;
+				sumdata = *(unsigned char *)sumptr;
 				sumdata = (sumdata << 8) & 0xff00;
 				xsum += sumdata;
 			}
@@ -1182,33 +1182,31 @@ void net_process_received_packet(uchar *in_packet, int len)
 			}
 			if ((xsum != 0x00000000) && (xsum != 0x0000ffff)) {
 				printf(" UDP wrong checksum %08lx %08x\n",
-					xsum, ntohs(ip->udp_xsum));
+				       xsum, ntohs(ip->udp_xsum));
 				return;
 			}
 		}
 #endif
 
-
-#if defined (CONFIG_NETCONSOLE) && !(CONFIG_SPL_BUILD)
+#if defined(CONFIG_NETCONSOLE) && !(CONFIG_SPL_BUILD)
 		nc_input_packet((uchar *)ip + IP_UDP_HDR_SIZE,
-					src_ip,
-					ntohs(ip->udp_dst),
-					ntohs(ip->udp_src),
-					ntohs(ip->udp_len) - UDP_HDR_SIZE);
+				src_ip,
+				ntohs(ip->udp_dst),
+				ntohs(ip->udp_src),
+				ntohs(ip->udp_len) - UDP_HDR_SIZE);
 #endif
 		/*
-		 *	IP header OK.  Pass the packet to the current handler.
+		 * IP header OK.  Pass the packet to the current handler.
 		 */
 		(*udp_packet_handler)((uchar *)ip + IP_UDP_HDR_SIZE,
-				ntohs(ip->udp_dst),
-				src_ip,
-				ntohs(ip->udp_src),
-				ntohs(ip->udp_len) - UDP_HDR_SIZE);
+				      ntohs(ip->udp_dst),
+				      src_ip,
+				      ntohs(ip->udp_src),
+				      ntohs(ip->udp_len) - UDP_HDR_SIZE);
 		break;
 	}
 }
 
-
 /**********************************************************************/
 
 static int net_check_prereq(enum proto_t protocol)
@@ -1242,6 +1240,7 @@ static int net_check_prereq(enum proto_t protocol)
 #if defined(CONFIG_CMD_NFS)
 	case NFS:
 #endif
+		/* Fall through */
 	case TFTPGET:
 	case TFTPPUT:
 		if (net_server_ip.s_addr == 0) {
@@ -1281,11 +1280,11 @@ common:
 				break;
 			default:
 				printf("*** ERROR: `eth%daddr' not set\n",
-					num);
+				       num);
 				break;
 			}
 
-			NetStartAgain();
+			net_start_again();
 			return 2;
 		}
 		/* Fall through */
@@ -1368,7 +1367,7 @@ void net_set_ip_header(uchar *pkt, struct in_addr dest, struct in_addr source)
 	ip->ip_hl_v  = 0x45;
 	ip->ip_tos   = 0;
 	ip->ip_len   = htons(IP_HDR_SIZE);
-	ip->ip_id    = htons(NetIPID++);
+	ip->ip_id    = htons(net_ip_id++);
 	ip->ip_off   = htons(IP_FLAGS_DFRAG);	/* Don't fragment */
 	ip->ip_ttl   = 255;
 	ip->ip_sum   = 0;
diff --git a/net/nfs.c b/net/nfs.c
index 4357cc3..78968d8 100644
--- a/net/nfs.c
+++ b/net/nfs.c
@@ -571,11 +571,12 @@ static void nfs_timeout_handler(void)
 {
 	if (++nfs_timeout_count > NFS_RETRY_COUNT) {
 		puts("\nRetry count exceeded; starting again\n");
-		NetStartAgain();
+		net_start_again();
 	} else {
 		puts("T ");
-		NetSetTimeout(nfs_timeout + NFS_TIMEOUT * nfs_timeout_count,
-			      nfs_timeout_handler);
+		net_set_timeout_handler(nfs_timeout +
+					NFS_TIMEOUT * nfs_timeout_count,
+					nfs_timeout_handler);
 		nfs_send();
 	}
 }
@@ -670,7 +671,7 @@ static void nfs_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 
 	case STATE_READ_REQ:
 		rlen = nfs_read_reply(pkt, len);
-		NetSetTimeout(nfs_timeout, nfs_timeout_handler);
+		net_set_timeout_handler(nfs_timeout, nfs_timeout_handler);
 		if (rlen > 0) {
 			nfs_offset += rlen;
 			nfs_send();
@@ -756,7 +757,7 @@ void nfs_start(void)
 	printf("\nLoad address: 0x%lx\n"
 		"Loading: *\b", load_addr);
 
-	NetSetTimeout(nfs_timeout, nfs_timeout_handler);
+	net_set_timeout_handler(nfs_timeout, nfs_timeout_handler);
 	net_set_udp_handler(nfs_handler);
 
 	nfs_timeout_count = 0;
diff --git a/net/ping.c b/net/ping.c
index 87da555..9508cf1 100644
--- a/net/ping.c
+++ b/net/ping.c
@@ -74,7 +74,7 @@ static void ping_timeout_handler(void)
 void ping_start(void)
 {
 	printf("Using %s device\n", eth_get_name());
-	NetSetTimeout(10000UL, ping_timeout_handler);
+	net_set_timeout_handler(10000UL, ping_timeout_handler);
 
 	ping_send();
 }
diff --git a/net/rarp.c b/net/rarp.c
index 2b983cc..761447d 100644
--- a/net/rarp.c
+++ b/net/rarp.c
@@ -59,9 +59,9 @@ static void rarp_timeout_handler(void)
 {
 	if (rarp_try >= TIMEOUT_COUNT) {
 		puts("\nRetry count exceeded; starting again\n");
-		NetStartAgain();
+		net_start_again();
 	} else {
-		NetSetTimeout(TIMEOUT, rarp_timeout_handler);
+		net_set_timeout_handler(TIMEOUT, rarp_timeout_handler);
 		rarp_request();
 	}
 }
@@ -95,5 +95,5 @@ void rarp_request(void)
 
 	net_send_packet(net_tx_packet, eth_hdr_size + ARP_HDR_SIZE);
 
-	NetSetTimeout(TIMEOUT, rarp_timeout_handler);
+	net_set_timeout_handler(TIMEOUT, rarp_timeout_handler);
 }
diff --git a/net/sntp.c b/net/sntp.c
index 8073ca6..d3427d8 100644
--- a/net/sntp.c
+++ b/net/sntp.c
@@ -65,7 +65,7 @@ static void sntp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 	 */
 	memcpy(&seconds, &rpktp->transmit_timestamp, sizeof(ulong));
 
-	to_tm(ntohl(seconds) - 2208988800UL + NetTimeOffset, &tm);
+	to_tm(ntohl(seconds) - 2208988800UL + net_ntp_time_offset, &tm);
 #if defined(CONFIG_CMD_DATE)
 	rtc_set(&tm);
 #endif
@@ -80,7 +80,7 @@ void sntp_start(void)
 {
 	debug("%s\n", __func__);
 
-	NetSetTimeout(SNTP_TIMEOUT, sntp_timeout_handler);
+	net_set_timeout_handler(SNTP_TIMEOUT, sntp_timeout_handler);
 	net_set_udp_handler(sntp_handler);
 	memset(net_server_ethaddr, 0, sizeof(net_server_ethaddr));
 
diff --git a/net/tftp.c b/net/tftp.c
index 14acf04..3e99e73 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -275,7 +275,7 @@ static void restart(const char *msg)
 #ifdef CONFIG_MCAST_TFTP
 	mcast_cleanup();
 #endif
-	NetStartAgain();
+	net_start_again();
 }
 
 /*
@@ -589,7 +589,7 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 				printf("First block is not block 1 (%ld)\n",
 				       tftp_cur_block);
 				puts("Starting again\n\n");
-				NetStartAgain();
+				net_start_again();
 				break;
 			}
 		}
@@ -601,7 +601,7 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 
 		tftp_prev_block = tftp_cur_block;
 		timeout_count_max = TIMEOUT_COUNT;
-		NetSetTimeout(timeout_ms, tftp_timeout_handler);
+		net_set_timeout_handler(timeout_ms, tftp_timeout_handler);
 
 		store_block(tftp_cur_block - 1, pkt + 2, len);
 
@@ -628,7 +628,7 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 					/* try to double it and retry */
 					tftp_mcast_bitmap_size <<= 1;
 					mcast_cleanup();
-					NetStartAgain();
+					net_start_again();
 					return;
 				}
 				tftp_prev_block = tftp_cur_block;
@@ -672,7 +672,7 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 #ifdef CONFIG_MCAST_TFTP
 			mcast_cleanup();
 #endif
-			NetStartAgain();
+			net_start_again();
 			break;
 		}
 		break;
@@ -686,7 +686,7 @@ static void tftp_timeout_handler(void)
 		restart("Retry count exceeded");
 	} else {
 		puts("T ");
-		NetSetTimeout(timeout_ms, tftp_timeout_handler);
+		net_set_timeout_handler(timeout_ms, tftp_timeout_handler);
 		if (tftp_state != STATE_RECV_WRQ)
 			tftp_send();
 	}
@@ -794,7 +794,7 @@ void tftp_start(enum proto_t protocol)
 	time_start = get_timer(0);
 	timeout_count_max = tftp_timeout_count_max;
 
-	NetSetTimeout(timeout_ms, tftp_timeout_handler);
+	net_set_timeout_handler(timeout_ms, tftp_timeout_handler);
 	net_set_udp_handler(tftp_handler);
 #ifdef CONFIG_CMD_TFTPPUT
 	net_set_icmp_handler(icmp_handler);
@@ -843,7 +843,7 @@ void tftp_start_server(void)
 	timeout_count_max = TIMEOUT_COUNT;
 	timeout_count = 0;
 	timeout_ms = TIMEOUT;
-	NetSetTimeout(timeout_ms, tftp_timeout_handler);
+	net_set_timeout_handler(timeout_ms, tftp_timeout_handler);
 
 	/* Revert tftp_block_size to dflt */
 	tftp_block_size = TFTP_BLOCK_SIZE;
@@ -951,7 +951,7 @@ static void parse_multicast_oack(char *pkt, int len)
 			printf("Fail to set mcast, revert to TFTP\n");
 			tftp_mcast_disabled = 1;
 			mcast_cleanup();
-			NetStartAgain();
+			net_start_again();
 		}
 	}
 	tftp_mcast_master_client = simple_strtoul((char *)mc, NULL, 10);
diff --git a/test/dm/eth.c b/test/dm/eth.c
index 22fd26e..4891f3a 100644
--- a/test/dm/eth.c
+++ b/test/dm/eth.c
@@ -23,15 +23,15 @@ static int dm_test_eth(struct dm_test_state *dms)
 	net_ping_ip = string_to_ip("1.1.2.2");
 
 	setenv("ethact", "eth at 10002000");
-	ut_assertok(NetLoop(PING));
+	ut_assertok(net_loop(PING));
 	ut_asserteq_str("eth at 10002000", getenv("ethact"));
 
 	setenv("ethact", "eth at 10003000");
-	ut_assertok(NetLoop(PING));
+	ut_assertok(net_loop(PING));
 	ut_asserteq_str("eth at 10003000", getenv("ethact"));
 
 	setenv("ethact", "eth at 10004000");
-	ut_assertok(NetLoop(PING));
+	ut_assertok(net_loop(PING));
 	ut_asserteq_str("eth at 10004000", getenv("ethact"));
 
 	return 0;
@@ -42,20 +42,20 @@ static int dm_test_eth_alias(struct dm_test_state *dms)
 {
 	net_ping_ip = string_to_ip("1.1.2.2");
 	setenv("ethact", "eth0");
-	ut_assertok(NetLoop(PING));
+	ut_assertok(net_loop(PING));
 	ut_asserteq_str("eth at 10002000", getenv("ethact"));
 
 	setenv("ethact", "eth1");
-	ut_assertok(NetLoop(PING));
+	ut_assertok(net_loop(PING));
 	ut_asserteq_str("eth at 10004000", getenv("ethact"));
 
 	/* Expected to fail since eth2 is not defined in the device tree */
 	setenv("ethact", "eth2");
-	ut_assertok(NetLoop(PING));
+	ut_assertok(net_loop(PING));
 	ut_asserteq_str("eth at 10002000", getenv("ethact"));
 
 	setenv("ethact", "eth5");
-	ut_assertok(NetLoop(PING));
+	ut_assertok(net_loop(PING));
 	ut_asserteq_str("eth at 10003000", getenv("ethact"));
 
 	return 0;
@@ -69,13 +69,13 @@ static int dm_test_eth_prime(struct dm_test_state *dms)
 	/* Expected to be "eth at 10003000" because of ethprime variable */
 	setenv("ethact", NULL);
 	setenv("ethprime", "eth5");
-	ut_assertok(NetLoop(PING));
+	ut_assertok(net_loop(PING));
 	ut_asserteq_str("eth at 10003000", getenv("ethact"));
 
 	/* Expected to be "eth at 10002000" because it is first */
 	setenv("ethact", NULL);
 	setenv("ethprime", NULL);
-	ut_assertok(NetLoop(PING));
+	ut_assertok(net_loop(PING));
 	ut_asserteq_str("eth at 10002000", getenv("ethact"));
 
 	return 0;
@@ -93,13 +93,13 @@ static int dm_test_eth_rotate(struct dm_test_state *dms)
 
 	/* Make sure that the default is to rotate to the next interface */
 	setenv("ethact", "eth at 10004000");
-	ut_assertok(NetLoop(PING));
+	ut_assertok(net_loop(PING));
 	ut_asserteq_str("eth at 10002000", getenv("ethact"));
 
 	/* If ethrotate is no, then we should fail on a bad MAC */
 	setenv("ethact", "eth at 10004000");
 	setenv("ethrotate", "no");
-	ut_asserteq(-EINVAL, NetLoop(PING));
+	ut_asserteq(-EINVAL, net_loop(PING));
 	ut_asserteq_str("eth at 10004000", getenv("ethact"));
 
 	/* Restore the env */
@@ -113,7 +113,7 @@ static int dm_test_eth_rotate(struct dm_test_state *dms)
 
 	/* Make sure we can skip invalid devices */
 	setenv("ethact", "eth at 10004000");
-	ut_assertok(NetLoop(PING));
+	ut_assertok(net_loop(PING));
 	ut_asserteq_str("eth at 10004000", getenv("ethact"));
 
 	/* Restore the env */
@@ -135,7 +135,7 @@ static int dm_test_net_retry(struct dm_test_state *dms)
 	sandbox_eth_disable_response(1, true);
 	setenv("ethact", "eth at 10004000");
 	setenv("netretry", "yes");
-	ut_assertok(NetLoop(PING));
+	ut_assertok(net_loop(PING));
 	ut_asserteq_str("eth at 10002000", getenv("ethact"));
 
 	/*
@@ -144,7 +144,7 @@ static int dm_test_net_retry(struct dm_test_state *dms)
 	 */
 	setenv("ethact", "eth at 10004000");
 	setenv("netretry", "no");
-	ut_asserteq(-ETIMEDOUT, NetLoop(PING));
+	ut_asserteq(-ETIMEDOUT, net_loop(PING));
 	ut_asserteq_str("eth@10004000", getenv("ethact"));
 
 	/* Restore the env */
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH 22/23] net: Fix incorrect DHCP/BOOTP packets on 64-bit systems
  2015-04-03 21:14 [U-Boot] [PATCH 0/23] net: cosmetic: Fix naming and other checkpatch.pl issues in net/ Joe Hershberger
                   ` (20 preceding siblings ...)
  2015-04-03 21:14 ` [U-Boot] [PATCH 21/23] net: cosmetic: Fix checkpatch.pl failures in net.c Joe Hershberger
@ 2015-04-03 21:14 ` Joe Hershberger
  2015-04-03 21:14 ` [U-Boot] [PATCH 23/23] net: Convert protocol structures to use explicit sizes Joe Hershberger
                   ` (2 subsequent siblings)
  24 siblings, 0 replies; 103+ messages in thread
From: Joe Hershberger @ 2015-04-03 21:14 UTC (permalink / raw)
  To: u-boot

From: Sergey Temerkhanov <s.temerkhanov@gmail.com>

This commit fixes incorrect DHCP/BOOTP packet layout caused by
'ulong' type size difference on 64 and 32-bit architectures.
It also renames NetReadLong()/NetCopyLong() to
net_read_u32/net_copy_u32() accordingly.


Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com>
Signed-off-by: Sergey Temerkhanov <s.temerkhanov@gmail.com>
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

 include/net.h | 10 +++++-----
 net/bootp.c   | 33 ++++++++++++++++-----------------
 net/bootp.h   |  4 ++--
 3 files changed, 23 insertions(+), 24 deletions(-)

diff --git a/include/net.h b/include/net.h
index e9131f7..def1fd9 100644
--- a/include/net.h
+++ b/include/net.h
@@ -410,7 +410,7 @@ struct icmp_hdr {
 			ushort	id;
 			ushort	sequence;
 		} echo;
-		ulong	gateway;
+		u32	gateway;
 		struct {
 			ushort	unused;
 			ushort	mtu;
@@ -678,9 +678,9 @@ static inline struct in_addr net_read_ip(void *from)
 }
 
 /* return ulong *in network byteorder* */
-static inline ulong net_read_long(ulong *from)
+static inline u32 net_read_u32(u32 *from)
 {
-	ulong l;
+	u32 l;
 
 	memcpy((void *)&l, (void *)from, sizeof(l));
 	return l;
@@ -699,9 +699,9 @@ static inline void net_copy_ip(void *to, void *from)
 }
 
 /* copy ulong */
-static inline void net_copy_long(ulong *to, ulong *from)
+static inline void net_copy_u32(u32 *to, u32 *from)
 {
-	memcpy((void *)to, (void *)from, sizeof(ulong));
+	memcpy((void *)to, (void *)from, sizeof(u32));
 }
 
 /**
diff --git a/net/bootp.c b/net/bootp.c
index 500850c..43466af 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -51,7 +51,7 @@
 #define CONFIG_BOOTP_ID_CACHE_SIZE 4
 #endif
 
-ulong		bootp_ids[CONFIG_BOOTP_ID_CACHE_SIZE];
+u32		bootp_ids[CONFIG_BOOTP_ID_CACHE_SIZE];
 unsigned int	bootp_num_ids;
 int		bootp_try;
 ulong		bootp_start;
@@ -62,7 +62,7 @@ char net_root_path[64] = {0,}; /* Our bootpath */
 
 #if defined(CONFIG_CMD_DHCP)
 static dhcp_state_t dhcp_state = INIT;
-static unsigned long dhcp_leasetime;
+static u32 dhcp_leasetime;
 static struct in_addr dhcp_server_ip;
 static void dhcp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 			unsigned src, unsigned len);
@@ -128,7 +128,7 @@ static int check_packet(uchar *pkt, unsigned dest, unsigned src, unsigned len)
 		retval = -4;
 	else if (bp->bp_hlen != HWL_ETHER)
 		retval = -5;
-	else if (!bootp_match_id(net_read_long((ulong *)&bp->bp_id)))
+	else if (!bootp_match_id(net_read_u32(&bp->bp_id)))
 		retval = -6;
 
 	debug("Filtering pkt = %d\n", retval);
@@ -356,8 +356,7 @@ static void bootp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 	store_net_params(bp);		/* Store net parameters from reply */
 
 	/* Retrieve extended information (we must parse the vendor area) */
-	if (net_read_long((ulong *)&bp->bp_vend[0]) ==
-	    htonl(BOOTP_VENDOR_MAGIC))
+	if (net_read_u32((u32 *)&bp->bp_vend[0]) == htonl(BOOTP_VENDOR_MAGIC))
 		bootp_process_vendor((uchar *)&bp->bp_vend[4], len);
 
 	net_set_timeout_handler(0, (thand_f *)0);
@@ -666,7 +665,7 @@ void bootp_request(void)
 #ifdef CONFIG_BOOTP_RANDOM_DELAY
 	ulong rand_ms;
 #endif
-	ulong bootp_id;
+	u32 bootp_id;
 	struct in_addr zero_ip;
 	struct in_addr bcast_ip;
 
@@ -734,14 +733,14 @@ void bootp_request(void)
 	 *	Bootp ID is the lower 4 bytes of our ethernet address
 	 *	plus the current time in ms.
 	 */
-	bootp_id = ((ulong)net_ethaddr[2] << 24)
-		| ((ulong)net_ethaddr[3] << 16)
-		| ((ulong)net_ethaddr[4] << 8)
-		| (ulong)net_ethaddr[5];
+	bootp_id = ((u32)net_ethaddr[2] << 24)
+		| ((u32)net_ethaddr[3] << 16)
+		| ((u32)net_ethaddr[4] << 8)
+		| (u32)net_ethaddr[5];
 	bootp_id += get_timer(0);
 	bootp_id = htonl(bootp_id);
 	bootp_add_id(bootp_id);
-	net_copy_long(&bp->bp_id, &bootp_id);
+	net_copy_u32(&bp->bp_id, &bootp_id);
 
 	/*
 	 * Calculate proper packet lengths taking into account the
@@ -780,7 +779,7 @@ static void dhcp_process_options(uchar *popt, struct bootp_hdr *bp)
 #if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_TIMEOFFSET)
 		case 2:		/* Time offset	*/
 			to_ptr = &net_ntp_time_offset;
-			net_copy_long((ulong *)to_ptr, (ulong *)(popt + 2));
+			net_copy_u32((u32 *)to_ptr, (u32 *)(popt + 2));
 			net_ntp_time_offset = ntohl(net_ntp_time_offset);
 			break;
 #endif
@@ -816,7 +815,7 @@ static void dhcp_process_options(uchar *popt, struct bootp_hdr *bp)
 			break;
 #endif
 		case 51:
-			net_copy_long(&dhcp_leasetime, (ulong *)(popt + 2));
+			net_copy_u32(&dhcp_leasetime, (u32 *)(popt + 2));
 			break;
 		case 53:	/* Ignore Message Type Option */
 			break;
@@ -870,7 +869,7 @@ static void dhcp_process_options(uchar *popt, struct bootp_hdr *bp)
 
 static int dhcp_message_type(unsigned char *popt)
 {
-	if (net_read_long((ulong *)popt) != htonl(BOOTP_VENDOR_MAGIC))
+	if (net_read_u32((u32 *)popt) != htonl(BOOTP_VENDOR_MAGIC))
 		return -1;
 
 	popt += 4;
@@ -924,7 +923,7 @@ static void dhcp_send_request_packet(struct bootp_hdr *bp_offer)
 	 * ID is the id of the OFFER packet
 	 */
 
-	net_copy_long(&bp->bp_id, &bp_offer->bp_id);
+	net_copy_u32(&bp->bp_id, &bp_offer->bp_id);
 
 	/*
 	 * Copy options from OFFER packet if present
@@ -983,7 +982,7 @@ static void dhcp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 			debug("TRANSITIONING TO REQUESTING STATE\n");
 			dhcp_state = REQUESTING;
 
-			if (net_read_long((ulong *)&bp->bp_vend[0]) ==
+			if (net_read_u32((u32 *)&bp->bp_vend[0]) ==
 						htonl(BOOTP_VENDOR_MAGIC))
 				dhcp_process_options((u8 *)&bp->bp_vend[4], bp);
 
@@ -999,7 +998,7 @@ static void dhcp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 		debug("DHCP State: REQUESTING\n");
 
 		if (dhcp_message_type((u8 *)bp->bp_vend) == DHCP_ACK) {
-			if (net_read_long((ulong *)&bp->bp_vend[0]) ==
+			if (net_read_u32((u32 *)&bp->bp_vend[0]) ==
 						htonl(BOOTP_VENDOR_MAGIC))
 				dhcp_process_options((u8 *)&bp->bp_vend[4], bp);
 			/* Store net params from reply */
diff --git a/net/bootp.h b/net/bootp.h
index efc2100..1a59286 100644
--- a/net/bootp.h
+++ b/net/bootp.h
@@ -38,7 +38,7 @@ struct bootp_hdr {
 	uchar		bp_hlen;	/* Hardware address length	*/
 # define HWL_ETHER	6
 	uchar		bp_hops;	/* Hop count (gateway thing)	*/
-	ulong		bp_id;		/* Transaction ID		*/
+	u32		bp_id;		/* Transaction ID		*/
 	ushort		bp_secs;	/* Seconds since boot		*/
 	ushort		bp_spare1;	/* Alignment			*/
 	struct in_addr	bp_ciaddr;	/* Client IP address		*/
@@ -59,7 +59,7 @@ struct bootp_hdr {
  */
 
 /* bootp.c */
-extern ulong	bootp_id;		/* ID of cur BOOTP request	*/
+extern u32	bootp_id;		/* ID of cur BOOTP request	*/
 extern int	bootp_try;
 
 
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH 23/23] net: Convert protocol structures to use explicit sizes
  2015-04-03 21:14 [U-Boot] [PATCH 0/23] net: cosmetic: Fix naming and other checkpatch.pl issues in net/ Joe Hershberger
                   ` (21 preceding siblings ...)
  2015-04-03 21:14 ` [U-Boot] [PATCH 22/23] net: Fix incorrect DHCP/BOOTP packets on 64-bit systems Joe Hershberger
@ 2015-04-03 21:14 ` Joe Hershberger
  2015-04-06 20:41 ` [U-Boot] [PATCH 0/23] net: cosmetic: Fix naming and other checkpatch.pl issues in net/ Joe Hershberger
  2015-04-08  6:41 ` [U-Boot] [PATCH v2 0/25] " Joe Hershberger
  24 siblings, 0 replies; 103+ messages in thread
From: Joe Hershberger @ 2015-04-03 21:14 UTC (permalink / raw)
  To: u-boot

From: Sergey Temerkhanov <s.temerkhanov@gmail.com>

Convert uchar/ushort to u8/u16 respectively.


Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com>
Signed-off-by: Sergey Temerkhanov <s.temerkhanov@gmail.com>
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

 include/net.h | 112 +++++++++++++++++++++++++++++-----------------------------
 net/bootp.h   |  14 ++++----
 2 files changed, 63 insertions(+), 63 deletions(-)

diff --git a/include/net.h b/include/net.h
index def1fd9..62e213d 100644
--- a/include/net.h
+++ b/include/net.h
@@ -253,9 +253,9 @@ u32 ether_crc(size_t len, unsigned char const *p);
  */
 
 struct ethernet_hdr {
-	uchar		et_dest[6];	/* Destination node		*/
-	uchar		et_src[6];	/* Source node			*/
-	ushort		et_protlen;	/* Protocol or length		*/
+	u8		et_dest[6];	/* Destination node		*/
+	u8		et_src[6];	/* Source node			*/
+	u16		et_protlen;	/* Protocol or length		*/
 };
 
 /* Ethernet header size */
@@ -264,16 +264,16 @@ struct ethernet_hdr {
 #define ETH_FCS_LEN	4		/* Octets in the FCS		*/
 
 struct e802_hdr {
-	uchar		et_dest[6];	/* Destination node		*/
-	uchar		et_src[6];	/* Source node			*/
-	ushort		et_protlen;	/* Protocol or length		*/
-	uchar		et_dsap;	/* 802 DSAP			*/
-	uchar		et_ssap;	/* 802 SSAP			*/
-	uchar		et_ctl;		/* 802 control			*/
-	uchar		et_snap1;	/* SNAP				*/
-	uchar		et_snap2;
-	uchar		et_snap3;
-	ushort		et_prot;	/* 802 protocol			*/
+	u8		et_dest[6];	/* Destination node		*/
+	u8		et_src[6];	/* Source node			*/
+	u16		et_protlen;	/* Protocol or length		*/
+	u8		et_dsap;	/* 802 DSAP			*/
+	u8		et_ssap;	/* 802 SSAP			*/
+	u8		et_ctl;		/* 802 control			*/
+	u8		et_snap1;	/* SNAP				*/
+	u8		et_snap2;
+	u8		et_snap3;
+	u16		et_prot;	/* 802 protocol			*/
 };
 
 /* 802 + SNAP + ethernet header size */
@@ -283,11 +283,11 @@ struct e802_hdr {
  *	Virtual LAN Ethernet header
  */
 struct vlan_ethernet_hdr {
-	uchar		vet_dest[6];	/* Destination node		*/
-	uchar		vet_src[6];	/* Source node			*/
-	ushort		vet_vlan_type;	/* PROT_VLAN			*/
-	ushort		vet_tag;	/* TAG of VLAN			*/
-	ushort		vet_type;	/* protocol type		*/
+	u8		vet_dest[6];	/* Destination node		*/
+	u8		vet_src[6];	/* Source node			*/
+	u16		vet_vlan_type;	/* PROT_VLAN			*/
+	u16		vet_tag;	/* TAG of VLAN			*/
+	u16		vet_type;	/* protocol type		*/
 };
 
 /* VLAN Ethernet header size */
@@ -305,14 +305,14 @@ struct vlan_ethernet_hdr {
  *	Internet Protocol (IP) header.
  */
 struct ip_hdr {
-	uchar		ip_hl_v;	/* header length and version	*/
-	uchar		ip_tos;		/* type of service		*/
-	ushort		ip_len;		/* total length			*/
-	ushort		ip_id;		/* identification		*/
-	ushort		ip_off;		/* fragment offset field	*/
-	uchar		ip_ttl;		/* time to live			*/
-	uchar		ip_p;		/* protocol			*/
-	ushort		ip_sum;		/* checksum			*/
+	u8		ip_hl_v;	/* header length and version	*/
+	u8		ip_tos;		/* type of service		*/
+	u16		ip_len;		/* total length			*/
+	u16		ip_id;		/* identification		*/
+	u16		ip_off;		/* fragment offset field	*/
+	u8		ip_ttl;		/* time to live			*/
+	u8		ip_p;		/* protocol			*/
+	u16		ip_sum;		/* checksum			*/
 	struct in_addr	ip_src;		/* Source IP address		*/
 	struct in_addr	ip_dst;		/* Destination IP address	*/
 };
@@ -329,20 +329,20 @@ struct ip_hdr {
  *	Internet Protocol (IP) + UDP header.
  */
 struct ip_udp_hdr {
-	uchar		ip_hl_v;	/* header length and version	*/
-	uchar		ip_tos;		/* type of service		*/
-	ushort		ip_len;		/* total length			*/
-	ushort		ip_id;		/* identification		*/
-	ushort		ip_off;		/* fragment offset field	*/
-	uchar		ip_ttl;		/* time to live			*/
-	uchar		ip_p;		/* protocol			*/
-	ushort		ip_sum;		/* checksum			*/
+	u8		ip_hl_v;	/* header length and version	*/
+	u8		ip_tos;		/* type of service		*/
+	u16		ip_len;		/* total length			*/
+	u16		ip_id;		/* identification		*/
+	u16		ip_off;		/* fragment offset field	*/
+	u8		ip_ttl;		/* time to live			*/
+	u8		ip_p;		/* protocol			*/
+	u16		ip_sum;		/* checksum			*/
 	struct in_addr	ip_src;		/* Source IP address		*/
 	struct in_addr	ip_dst;		/* Destination IP address	*/
-	ushort		udp_src;	/* UDP source port		*/
-	ushort		udp_dst;	/* UDP destination port		*/
-	ushort		udp_len;	/* Length of UDP packet		*/
-	ushort		udp_xsum;	/* Checksum			*/
+	u16		udp_src;	/* UDP source port		*/
+	u16		udp_dst;	/* UDP destination port		*/
+	u16		udp_len;	/* Length of UDP packet		*/
+	u16		udp_xsum;	/* Checksum			*/
 };
 
 #define IP_UDP_HDR_SIZE		(sizeof(struct ip_udp_hdr))
@@ -352,14 +352,14 @@ struct ip_udp_hdr {
  *	Address Resolution Protocol (ARP) header.
  */
 struct arp_hdr {
-	ushort		ar_hrd;		/* Format of hardware address	*/
+	u16		ar_hrd;		/* Format of hardware address	*/
 #   define ARP_ETHER	    1		/* Ethernet  hardware address	*/
-	ushort		ar_pro;		/* Format of protocol address	*/
-	uchar		ar_hln;		/* Length of hardware address	*/
+	u16		ar_pro;		/* Format of protocol address	*/
+	u8		ar_hln;		/* Length of hardware address	*/
 #   define ARP_HLEN	6
-	uchar		ar_pln;		/* Length of protocol address	*/
+	u8		ar_pln;		/* Length of protocol address	*/
 #   define ARP_PLEN	4
-	ushort		ar_op;		/* Operation			*/
+	u16		ar_op;		/* Operation			*/
 #   define ARPOP_REQUEST    1		/* Request  to resolve  address	*/
 #   define ARPOP_REPLY	    2		/* Response to previous request	*/
 
@@ -371,16 +371,16 @@ struct arp_hdr {
 	 * the sizes above, and are defined as appropriate for
 	 * specific hardware/protocol combinations.
 	 */
-	uchar		ar_data[0];
+	u8		ar_data[0];
 #define ar_sha		ar_data[0]
 #define ar_spa		ar_data[ARP_HLEN]
 #define ar_tha		ar_data[ARP_HLEN + ARP_PLEN]
 #define ar_tpa		ar_data[ARP_HLEN + ARP_PLEN + ARP_HLEN]
 #if 0
-	uchar		ar_sha[];	/* Sender hardware address	*/
-	uchar		ar_spa[];	/* Sender protocol address	*/
-	uchar		ar_tha[];	/* Target hardware address	*/
-	uchar		ar_tpa[];	/* Target protocol address	*/
+	u8		ar_sha[];	/* Sender hardware address	*/
+	u8		ar_spa[];	/* Sender protocol address	*/
+	u8		ar_tha[];	/* Target hardware address	*/
+	u8		ar_tpa[];	/* Target protocol address	*/
 #endif /* 0 */
 };
 
@@ -402,20 +402,20 @@ struct arp_hdr {
 #define ICMP_NOT_REACH_PORT	3	/* Port unreachable		*/
 
 struct icmp_hdr {
-	uchar		type;
-	uchar		code;
-	ushort		checksum;
+	u8		type;
+	u8		code;
+	u16		checksum;
 	union {
 		struct {
-			ushort	id;
-			ushort	sequence;
+			u16	id;
+			u16	sequence;
 		} echo;
 		u32	gateway;
 		struct {
-			ushort	unused;
-			ushort	mtu;
+			u16	unused;
+			u16	mtu;
 		} frag;
-		uchar data[0];
+		u8 data[0];
 	} un;
 };
 
diff --git a/net/bootp.h b/net/bootp.h
index 1a59286..fcb0a64 100644
--- a/net/bootp.h
+++ b/net/bootp.h
@@ -30,22 +30,22 @@ extern u8 *dhcp_vendorex_proc(u8 *e); /*rtn next e if mine,else NULL  */
 #endif
 
 struct bootp_hdr {
-	uchar		bp_op;		/* Operation			*/
+	u8		bp_op;		/* Operation			*/
 # define OP_BOOTREQUEST	1
 # define OP_BOOTREPLY	2
-	uchar		bp_htype;	/* Hardware type		*/
+	u8		bp_htype;	/* Hardware type		*/
 # define HWT_ETHER	1
-	uchar		bp_hlen;	/* Hardware address length	*/
+	u8		bp_hlen;	/* Hardware address length	*/
 # define HWL_ETHER	6
-	uchar		bp_hops;	/* Hop count (gateway thing)	*/
+	u8		bp_hops;	/* Hop count (gateway thing)	*/
 	u32		bp_id;		/* Transaction ID		*/
-	ushort		bp_secs;	/* Seconds since boot		*/
-	ushort		bp_spare1;	/* Alignment			*/
+	u16		bp_secs;	/* Seconds since boot		*/
+	u16		bp_spare1;	/* Alignment			*/
 	struct in_addr	bp_ciaddr;	/* Client IP address		*/
 	struct in_addr	bp_yiaddr;	/* Your (client) IP address	*/
 	struct in_addr	bp_siaddr;	/* Server IP address		*/
 	struct in_addr	bp_giaddr;	/* Gateway IP address		*/
-	uchar		bp_chaddr[16];	/* Client hardware address	*/
+	u8		bp_chaddr[16];	/* Client hardware address	*/
 	char		bp_sname[64];	/* Server host name		*/
 	char		bp_file[128];	/* Boot file name		*/
 	char		bp_vend[OPT_FIELD_SIZE]; /* Vendor information	*/
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH 0/23] net: cosmetic: Fix naming and other checkpatch.pl issues in net/
  2015-04-03 21:14 [U-Boot] [PATCH 0/23] net: cosmetic: Fix naming and other checkpatch.pl issues in net/ Joe Hershberger
                   ` (22 preceding siblings ...)
  2015-04-03 21:14 ` [U-Boot] [PATCH 23/23] net: Convert protocol structures to use explicit sizes Joe Hershberger
@ 2015-04-06 20:41 ` Joe Hershberger
  2015-04-06 21:54   ` Simon Glass
  2015-04-08  6:41 ` [U-Boot] [PATCH v2 0/25] " Joe Hershberger
  24 siblings, 1 reply; 103+ messages in thread
From: Joe Hershberger @ 2015-04-06 20:41 UTC (permalink / raw)
  To: u-boot

Hi Simon,

On Fri, Apr 3, 2015 at 4:14 PM, Joe Hershberger <joe.hershberger@ni.com>
wrote:
>
> This series is fairly disruptive in naming, so hopefully there aren't
> many network stack changes in flight that will conflict with this. This
> is based on top of dm/next for now so that the dm/eth series is assumed.
> This will be rebased when that is, but will likely not have issues.
>
> Like ripping off a bandage, do it quick and all at once.

It would be good if you can pull this in through dm/next if there are no
oppositions, since this depends on that tree and will be disruptive if left
out for any amount of time.

> Joe Hershberger (21):
>   net: cosmetic: Change IPaddr_t to struct in_addr
>   net: cosmetic: Fixup var names related to boot file
>   net: cosmetic: Fixup var names for DHCP strings
>   net: cosmetic: Name ethaddr variables consistently
>   net: cosmetic: Cleanup internal packet buffer names
>   net: cosmetic: Fix var naming net <-> eth drivers
>   net: cosmetic: Clean up TFTP variables and functions
>   net: cosmetic: Clean up ARP variables and functions
>   net: cosmetic: Clean up DHCP variables and functions
>   net: cosmetic: Clean up NFS variables and functions
>   net: cosmetic: Clean up RARP variables and functions
>   net: cosmetic: Clean up SNTP variables and functions
>   net: cosmetic: Clean up ping variables and functions
>   net: cosmetic: Clean up CDP variables and functions
>   net: cosmetic: Clean up DNS variables and functions
>   net: cosmetic: Clean up netconsole variables and functions
>   net: cosmetic: Clean up cmd_net variables and functions
>   net: cosmetic: Fix checkpatch.pl failures in linklocal
>   net: cosmetic: Fix checkpatch.pl failures in eth.c
>   net: cosmetic: Fix checkpatch.pl failures in net.h
>   net: cosmetic: Fix checkpatch.pl failures in net.c
>
> Sergey Temerkhanov (2):
>   net: Fix incorrect DHCP/BOOTP packets on 64-bit systems
>   net: Convert protocol structures to use explicit sizes
>
>  README                                     |   6 +-
>  arch/arm/mach-davinci/misc.c               |   2 +-
>  arch/mips/mach-au1x00/au1x00_eth.c         |  12 +-
>  arch/powerpc/cpu/mpc8260/ether_fcc.c       |  20 +-
>  arch/powerpc/cpu/mpc8260/ether_scc.c       |   4 +-
>  arch/powerpc/cpu/mpc85xx/ether_fcc.c       |   4 +-
>  arch/powerpc/cpu/mpc8xx/fec.c              |  12 +-
>  arch/powerpc/cpu/mpc8xx/scc.c              |   5 +-
>  board/BuR/common/common.c                  |   4 +-
>  board/ait/cam_enc_4xx/cam_enc_4xx.c        |   2 +-
>  board/alphaproject/ap_sh4a_4a/ap_sh4a_4a.c |   2 +-
>  board/bct-brettl2/bct-brettl2.c            |   2 +-
>  board/bf518f-ezbrd/bf518f-ezbrd.c          |   4 +-
>  board/bf526-ezbrd/bf526-ezbrd.c            |   4 +-
>  board/bf527-ezkit/bf527-ezkit.c            |   4 +-
>  board/bf537-minotaur/bf537-minotaur.c      |   2 +-
>  board/bf537-pnav/bf537-pnav.c              |   2 +-
>  board/bf537-srv1/bf537-srv1.c              |   2 +-
>  board/bf537-stamp/bf537-stamp.c            |   4 +-
>  board/birdland/bav335x/board.c             |   4 +-
>  board/buffalo/lsxl/lsxl.c                  |   2 +-
>  board/cm-bf527/cm-bf527.c                  |   4 +-
>  board/cm-bf537e/cm-bf537e.c                |   2 +-
>  board/cm-bf537u/cm-bf537u.c                |   2 +-
>  board/compulab/cm_fx6/cm_fx6.c             |   2 +-
>  board/compulab/cm_t335/cm_t335.c           |   2 +-
>  board/compulab/cm_t35/cm_t35.c             |   2 +-
>  board/compulab/cm_t3517/cm_t3517.c         |   4 +-
>  board/compulab/cm_t54/cm_t54.c             |   4 +-
>  board/davinci/da8xxevm/da850evm.c          |   6 +-
>  board/dnp5370/dnp5370.c                    |   4 +-
>  board/gumstix/pepper/board.c               |   2 +-
>  board/ifm/ac14xx/ac14xx.c                  |   2 +-
>  board/ip04/ip04.c                          |   2 +-
>  board/isee/igep0033/board.c                |   2 +-
>  board/phytec/pcm051/board.c                |   2 +-
>  board/renesas/r0p7734/r0p7734.c            |   2 +-
>  board/siemens/common/factoryset.c          |   4 +-
>  board/siemens/pxm2/board.c                 |   2 +-
>  board/silica/pengwyn/board.c               |   2 +-
>  board/tcm-bf518/tcm-bf518.c                |   4 +-
>  board/tcm-bf537/tcm-bf537.c                |   2 +-
>  board/ti/am335x/board.c                    |   6 +-
>  board/ti/am43xx/board.c                    |   4 +-
>  board/ti/beagle_x15/board.c                |   4 +-
>  board/ti/dra7xx/evm.c                      |   4 +-
>  board/ti/ti814x/evm.c                      |   2 +-
>  common/cmd_elf.c                           |   2 +-
>  common/cmd_net.c                           | 133 +++----
>  common/cmd_pxe.c                           |   4 +-
>  common/spl/spl_net.c                       |   2 +-
>  common/update.c                            |  25 +-
>  doc/README.drivers.eth                     |  12 +-
>  doc/README.enetaddr                        |   2 +-
>  doc/README.link-local                      |   4 +-
>  drivers/net/4xx_enet.c                     |  14 +-
>  drivers/net/altera_tse.c                   |  15 +-
>  drivers/net/armada100_fec.c                |   7 +-
>  drivers/net/at91_emac.c                    |   4 +-
>  drivers/net/ax88180.c                      |   6 +-
>  drivers/net/bcm-sf2-eth.c                  |   6 +-
>  drivers/net/bfin_mac.c                     |   4 +-
>  drivers/net/calxedaxgmac.c                 |   2 +-
>  drivers/net/cpsw.c                         |  17 +-
>  drivers/net/cs8900.c                       |   5 +-
>  drivers/net/davinci_emac.c                 |   5 +-
>  drivers/net/dc2114x.c                      |   9 +-
>  drivers/net/designware.c                   |   2 +-
>  drivers/net/dm9000x.c                      |   9 +-
>  drivers/net/dnet.c                         |   5 +-
>  drivers/net/e1000.c                        |   4 +-
>  drivers/net/eepro100.c                     |   3 +-
>  drivers/net/enc28j60.c                     |  13 +-
>  drivers/net/ep93xx_eth.c                   |  11 +-
>  drivers/net/ethoc.c                        |   4 +-
>  drivers/net/fec_mxc.c                      |   4 +-
>  drivers/net/fm/eth.c                       |   2 +-
>  drivers/net/fsl_mcdmafec.c                 |  23 +-
>  drivers/net/ftgmac100.c                    |   4 +-
>  drivers/net/ftmac100.c                     |   4 +-
>  drivers/net/ftmac110.c                     |   4 +-
>  drivers/net/greth.c                        |   2 +-
>  drivers/net/keystone_net.c                 |   2 +-
>  drivers/net/ks8851_mll.c                   |   6 +-
>  drivers/net/lan91c96.c                     |  19 +-
>  drivers/net/macb.c                         |  10 +-
>  drivers/net/mcffec.c                       |   5 +-
>  drivers/net/mpc512x_fec.c                  |   3 +-
>  drivers/net/mpc5xxx_fec.c                  |   2 +-
>  drivers/net/mvgbe.c                        |  41 +-
>  drivers/net/mvneta.c                       |   2 +-
>  drivers/net/natsemi.c                      |   3 +-
>  drivers/net/ne2000_base.c                  |   2 +-
>  drivers/net/netconsole.c                   |  94 ++---
>  drivers/net/ns8382x.c                      |   6 +-
>  drivers/net/pch_gbe.c                      |   2 +-
>  drivers/net/pcnet.c                        |   2 +-
>  drivers/net/rtl8139.c                      |   4 +-
>  drivers/net/rtl8169.c                      |   2 +-
>  drivers/net/sandbox-raw.c                  |   8 +-
>  drivers/net/sandbox.c                      |  14 +-
>  drivers/net/sh_eth.c                       |   2 +-
>  drivers/net/smc91111.c                     |  18 +-
>  drivers/net/smc911x.c                      |   4 +-
>  drivers/net/sunxi_emac.c                   |   4 +-
>  drivers/net/tsec.c                         |   7 +-
>  drivers/net/tsi108_eth.c                   |   8 +-
>  drivers/net/uli526x.c                      |   5 +-
>  drivers/net/xilinx_axi_emac.c              |   2 +-
>  drivers/net/xilinx_emaclite.c              |   2 +-
>  drivers/net/xilinx_ll_temac_fifo.c         |   4 +-
>  drivers/net/xilinx_ll_temac_sdma.c         |   4 +-
>  drivers/net/zynq_gem.c                     |   2 +-
>  drivers/qe/uec.c                           |   2 +-
>  drivers/usb/eth/asix.c                     |   3 +-
>  drivers/usb/eth/asix88179.c                |   2 +-
>  drivers/usb/eth/mcs7830.c                  |   2 +-
>  drivers/usb/eth/smsc95xx.c                 |   5 +-
>  drivers/usb/gadget/ether.c                 |  13 +-
>  include/common.h                           |   2 +-
>  include/net.h                              | 303 ++++++++-------
>  lib/net_utils.c                            |  16 +-
>  net/arp.c                                  | 137 ++++---
>  net/arp.h                                  |  22 +-
>  net/bootp.c                                | 373 +++++++++---------
>  net/bootp.h                                |  39 +-
>  net/cdp.c                                  |  88 ++---
>  net/cdp.h                                  |   2 +-
>  net/dns.c                                  |  72 ++--
>  net/dns.h                                  |   2 +-
>  net/eth.c                                  |  61 +--
>  net/link_local.c                           |  79 ++--
>  net/net.c                                  | 442 +++++++++++-----------
>  net/nfs.c                                  | 235 ++++++------
>  net/nfs.h                                  |   2 +-
>  net/ping.c                                 |  49 +--
>  net/rarp.c                                 |  45 ++-
>  net/rarp.h                                 |   6 +-
>  net/sntp.c                                 |  42 +-
>  net/sntp.h                                 |   2 +-
>  net/tftp.c                                 | 589
+++++++++++++++--------------
>  net/tftp.h                                 |   8 +-
>  post/cpu/mpc8xx/ether.c                    |   6 +-
>  test/dm/eth.c                              |  38 +-
>  144 files changed, 1771 insertions(+), 1758 deletions(-)

Thanks,
-Joe

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH 0/23] net: cosmetic: Fix naming and other checkpatch.pl issues in net/
  2015-04-06 20:41 ` [U-Boot] [PATCH 0/23] net: cosmetic: Fix naming and other checkpatch.pl issues in net/ Joe Hershberger
@ 2015-04-06 21:54   ` Simon Glass
  0 siblings, 0 replies; 103+ messages in thread
From: Simon Glass @ 2015-04-06 21:54 UTC (permalink / raw)
  To: u-boot

Hi Joe,

On 6 April 2015 at 14:41, Joe Hershberger <joe.hershberger@gmail.com> wrote:
> Hi Simon,
>
> On Fri, Apr 3, 2015 at 4:14 PM, Joe Hershberger <joe.hershberger@ni.com>
> wrote:
>>
>> This series is fairly disruptive in naming, so hopefully there aren't
>> many network stack changes in flight that will conflict with this. This
>> is based on top of dm/next for now so that the dm/eth series is assumed.
>> This will be rebased when that is, but will likely not have issues.
>>
>> Like ripping off a bandage, do it quick and all at once.
>
> It would be good if you can pull this in through dm/next if there are no
> oppositions, since this depends on that tree and will be disruptive if left
> out for any amount of time.

OK I can do that. The merge window opens in a week so it is good timing.

Regards,
Simon

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH 01/23] net: cosmetic: Change IPaddr_t to struct in_addr
  2015-04-03 21:14 ` [U-Boot] [PATCH 01/23] net: cosmetic: Change IPaddr_t to struct in_addr Joe Hershberger
@ 2015-04-08  1:26   ` Simon Glass
  2015-04-08  6:57     ` Joe Hershberger
  0 siblings, 1 reply; 103+ messages in thread
From: Simon Glass @ 2015-04-08  1:26 UTC (permalink / raw)
  To: u-boot

Hi Joe,

On 3 April 2015 at 15:14, Joe Hershberger <joe.hershberger@ni.com> wrote:
> This patch is simply clean-up to make the IPv4 type that is used match
> what Linux uses. It also attempts to move all variables that are IP
> addresses use good naming instead of CamelCase. No functional change.
>
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> ---

I see the following breakage on this patch (my build is incomplete,
but it looks like it is just one problem in cmd_net.c).

02: net: cosmetic: Change IPaddr_t to struct in_addr
      mips:  +   qemu_mips64el qemu_mips64
  blackfin:  +   bf561-acvilon cm-bf561 bct-brettl2 cm-bf527 ip04
bf537-stamp bf527-ezkit-v2 cm-bf537e tcm-bf518 cm-bf537u bf527-ezkit
cm-bf533 pr1 bf533-ezkit ibf-dsp561 bf537-pnav cm-bf548 bf538f-ezkit
bf548-ezkit tcm-bf537 bf533-stamp bf518f-ezbrd bf526-ezbrd bf561-ezkit
       arm:  +   ethernut5
      m68k:  +   M5329AFEE M5208EVBE M5475FFE M5475GFE M5485BFE
M5329BFEE M5475EFE M5475CFE M5485AFE M5475AFE M5485HFE M5485DFE
M5475DFE M53017EVB M5475BFE M5485GFE M5485EFE M5485FFE M5373EVB
M5485CFE
   powerpc:  +   a4m2k a3m071
-(taihu) powerpc-linux-ld.bfd: section .resetvec loaded at
[fffffffc,ffffffff] overlaps section .u_boot_list loaded at
[fffffd88,00000687]
-(taihu) powerpc-linux-ld.bfd: u-boot: section .resetvec lma
0xfffffffc adjusted to 0x688
-(openrd_base)   actual: 412684 bytes
-(openrd_base)   excess: 19468 bytes
-(taishan) powerpc-linux-ld.bfd: section .bootpg loaded at
[fffff000,fffff24f] overlaps section .data loaded at
[ffffd288,fffff95b]
-(taishan) powerpc-linux-ld.bfd: section .resetvec loaded at
[fffffffc,ffffffff] overlaps section .u_boot_list loaded at
[fffff95c,000002cb]
-(taishan) powerpc-linux-ld.bfd: u-boot: section .bootpg lma
0xfffff000 adjusted to 0xfffff95c
-(taishan) powerpc-linux-ld.bfd: u-boot: section .u_boot_list lma
0xfffff95c adjusted to 0xfffffbac
-(ocotea) powerpc-linux-ld.bfd: section .bootpg loaded at
[fffff000,fffff24f] overlaps section .data loaded at
[ffffccac,fffff4b3]
-(ocotea) powerpc-linux-ld.bfd: u-boot: section .bootpg lma 0xfffff000
adjusted to 0xfffff4b4
-(ocotea) powerpc-linux-ld.bfd: u-boot: section .u_boot_list lma
0xfffff4b4 adjusted to 0xfffff704
-(ocotea) powerpc-linux-ld.bfd: u-boot: section .data.init lma
0xfffffe00 adjusted to 0xffffff5c
-(openrd_ultimate)   actual: 412736 bytes
-(openrd_ultimate)   excess: 19520 bytes
-(openrd_client)   actual: 412756 bytes
-(openrd_client)   excess: 19540 bytes
-(ebony) powerpc-linux-ld.bfd: section .bootpg loaded at
[fffff000,fffff23f] overlaps section .u_boot_list loaded at
[ffffeb28,fffff37f]
-(ebony) powerpc-linux-ld.bfd: u-boot: section .bootpg lma 0xfffff000
adjusted to 0xfffff380
-(ebony) powerpc-linux-ld.bfd: u-boot: section .data.init lma
0xfffff400 adjusted to 0xfffff5c0
-(alpr) powerpc-linux-ld.bfd: section .bootpg loaded at
[fffff000,fffff27f] overlaps section .data loaded at
[ffffba08,fffff0e7]
-(alpr) powerpc-linux-ld.bfd: section .u_boot_list loaded at
[fffff0e8,fffff63b] overlaps section .bootpg loaded at
[fffff000,fffff27f]
-(alpr) powerpc-linux-ld.bfd: u-boot: section .bootpg lma 0xfffff000
adjusted to 0xfffff0e8
-(alpr) powerpc-linux-ld.bfd: u-boot: section .u_boot_list lma
0xfffff0e8 adjusted to 0xfffff368
-(alpr) powerpc-linux-ld.bfd: u-boot: section .data.init lma
0xfffff700 adjusted to 0xfffff8bc
+(bf561-acvilon,cm-bf561,ip04,bct-brettl2,ibf-dsp561,cm-bf533,bf561-ezkit)
../net/arp.c: In function ?ArpReceive?:
+(bf561-acvilon,cm-bf561,ip04,bct-brettl2,ibf-dsp561,cm-bf533,bf561-ezkit)
../net/arp.c:196: error: invalid operands to binary == (have ?struct
in_addr? and ?struct in_addr?)
+(bf561-acvilon,cm-bf561,ip04,bct-brettl2,ibf-dsp561,cm-bf533,bf561-ezkit)
make[2]: *** [net/arp.o] Error 1
+(bf561-acvilon,M5329AFEE,cm-bf561,M5208EVBE,a4m2k,ethernut5,ip04,M5485AFE,M5485BFE,M5475EFE,M5475CFE,M53017EVB,M5485HFE,qemu_mips64el,bct-brettl2,ibf-dsp561,M5485DFE,M5475DFE,M5485CFE,M5475FFE,qemu_mips64,M5475BFE,M5485GFE,M5373EVB,M5485EFE,M5485FFE,M5329BFEE,cm-bf533,M5475GFE,M5475AFE,a3m071,bf561-ezkit)
make[1]: *** [net] Error 2
+(M5329AFEE,M5208EVBE,M5485AFE,M5485BFE,M5475EFE,M5475CFE,M53017EVB,M5485HFE,M5485DFE,M5475DFE,M5485CFE,M5475FFE,M5475BFE,M5485GFE,M5373EVB,M5485EFE,M5485FFE,M5329BFEE,M5475GFE,M5475AFE)
../net/net.c: In function 'net_process_received_packet':
+(M5329AFEE,M5208EVBE,M5485AFE,M5485BFE,M5475EFE,M5475CFE,M53017EVB,M5485HFE,M5485DFE,M5475DFE,M5485CFE,M5475FFE,M5475BFE,M5485GFE,M5373EVB,M5485EFE,M5485FFE,M5329BFEE,M5475GFE,M5475AFE)
../net/net.c:1173:4: error: aggregate value used where an integer was
expected
+(M5329AFEE,M5208EVBE,M5485AFE,M5485BFE,M5475EFE,M5475CFE,M53017EVB,M5485HFE,M5485DFE,M5475DFE,M5485CFE,M5475FFE,M5475BFE,M5485GFE,M5373EVB,M5485EFE,M5485FFE,M5329BFEE,M5475GFE,M5475AFE)
../net/net.c:1174:4: error: aggregate value used where an integer was
expected
+(M5329AFEE,M5208EVBE,M5485AFE,M5485BFE,M5475EFE,M5475CFE,M53017EVB,M5485HFE,M5485DFE,M5475DFE,M5485CFE,M5475FFE,M5475BFE,M5485GFE,M5373EVB,M5485EFE,M5485FFE,M5329BFEE,M5475GFE,M5475AFE)
../net/net.c:1175:4: error: aggregate value used where an integer was
expected
+(M5329AFEE,M5208EVBE,M5485AFE,M5485BFE,M5475EFE,M5475CFE,M53017EVB,M5485HFE,M5485DFE,M5475DFE,M5485CFE,M5475FFE,M5475BFE,M5485GFE,M5373EVB,M5485EFE,M5485FFE,M5329BFEE,M5475GFE,M5475AFE)
../net/net.c:1176:4: error: aggregate value used where an integer was
expected
+(M5329AFEE,M5208EVBE,M5485AFE,M5485BFE,M5475EFE,M5475CFE,M53017EVB,M5485HFE,M5485DFE,M5475DFE,M5485CFE,M5475FFE,M5475BFE,M5485GFE,M5373EVB,M5485EFE,M5485FFE,M5329BFEE,M5475GFE,M5475AFE)
make[2]: *** [net/net.o] Error 1
+(taihu) powerpc-linux-ld.bfd: section .resetvec loaded at
[fffffffc,ffffffff] overlaps section .u_boot_list loaded at
[fffffe84,00000783]
+(taihu) powerpc-linux-ld.bfd: u-boot: section .resetvec lma
0xfffffffc adjusted to 0x784
+(bf533-stamp,cm-bf527,bf537-stamp,bf527-ezkit-v2,tcm-bf518,cm-bf537u,cm-bf537e,tcm-bf537,bf527-ezkit,pr1,bf533-ezkit,bf537-pnav,cm-bf548,bf538f-ezkit,bf548-ezkit,bf518f-ezbrd,bf526-ezbrd)
../common/cmd_net.c: In function ?netboot_update_env?:
+(bf533-stamp,cm-bf527,bf537-stamp,bf527-ezkit-v2,tcm-bf518,cm-bf537u,cm-bf537e,tcm-bf537,bf527-ezkit,pr1,bf533-ezkit,bf537-pnav,cm-bf548,bf538f-ezkit,bf548-ezkit,bf518f-ezbrd,bf526-ezbrd)
../common/cmd_net.c:169: error: ?net_ntp_ip? undeclared (first use in
this function)
+(bf533-stamp,cm-bf527,bf537-stamp,bf527-ezkit-v2,tcm-bf518,cm-bf537u,cm-bf537e,tcm-bf537,bf527-ezkit,pr1,bf533-ezkit,bf537-pnav,cm-bf548,bf538f-ezkit,bf548-ezkit,bf518f-ezbrd,bf526-ezbrd)
../common/cmd_net.c:169: error: (Each undeclared identifier is
reported only once
+(bf533-stamp,cm-bf527,bf537-stamp,bf527-ezkit-v2,tcm-bf518,cm-bf537u,cm-bf537e,tcm-bf537,bf527-ezkit,pr1,bf533-ezkit,bf537-pnav,cm-bf548,bf538f-ezkit,bf548-ezkit,bf518f-ezbrd,bf526-ezbrd)
../common/cmd_net.c:169: error: for each function it appears in.)
+(bf533-stamp,cm-bf527,bf537-stamp,bf527-ezkit-v2,tcm-bf518,cm-bf537u,cm-bf537e,tcm-bf537,bf527-ezkit,pr1,bf533-ezkit,bf537-pnav,cm-bf548,bf538f-ezkit,bf548-ezkit,bf518f-ezbrd,bf526-ezbrd)
make[2]: *** [common/cmd_net.o] Error 1
+(bf533-stamp,cm-bf527,bf537-stamp,bf527-ezkit-v2,tcm-bf518,cm-bf537u,cm-bf537e,tcm-bf537,bf527-ezkit,pr1,bf533-ezkit,bf537-pnav,cm-bf548,bf538f-ezkit,bf548-ezkit,bf518f-ezbrd,bf526-ezbrd)
make[1]: *** [common] Error 2
+(a4m2k,a3m071) ../net/link_local.c: In function 'pick':
+(a4m2k,a3m071) ../net/link_local.c:74:17: error: conversion to
non-scalar type requested
+(a4m2k,a3m071) ../net/link_local.c: In function 'link_local_timeout':
+(a4m2k,a3m071) ../net/link_local.c:138:4: error: incompatible type
for argument 1 of 'arp_raw_request'
+(a4m2k,a3m071) ../net/arp.h:26:6: note: expected 'struct in_addr' but
argument is of type 'int'
+(a4m2k,a3m071) make[2]: *** [net/link_local.o] Error 1
+(ethernut5) ../net/rarp.c: In function ?rarp_receive?:
+(ethernut5) ../net/rarp.c:47:21: error: invalid operands to binary ==
(have ?struct in_addr? and ?int?)
+(ethernut5,qemu_mips64el,qemu_mips64) make[2]: *** [net/rarp.o] Error 1
+(openrd_base)   actual: 412600 bytes
+(openrd_base)   excess: 19384 bytes
+(taishan) powerpc-linux-ld.bfd: section .bootpg loaded at
[fffff000,fffff24f] overlaps section .data loaded at
[ffffd388,fffffa57]
+(taishan) powerpc-linux-ld.bfd: section .resetvec loaded at
[fffffffc,ffffffff] overlaps section .u_boot_list loaded at
[fffffa58,000003c7]
+(taishan) powerpc-linux-ld.bfd: u-boot: section .bootpg lma
0xfffff000 adjusted to 0xfffffa58
+(taishan) powerpc-linux-ld.bfd: u-boot: section .u_boot_list lma
0xfffffa58 adjusted to 0xfffffca8
+(ocotea) powerpc-linux-ld.bfd: section .bootpg loaded at
[fffff000,fffff24f] overlaps section .data loaded at
[ffffcdac,fffff5af]
+(ocotea) powerpc-linux-ld.bfd: u-boot: section .bootpg lma 0xfffff000
adjusted to 0xfffff5b0
+(ocotea) powerpc-linux-ld.bfd: u-boot: section .u_boot_list lma
0xfffff5b0 adjusted to 0xfffff800
+(ocotea) powerpc-linux-ld.bfd: u-boot: section .data.init lma
0xffffff00 adjusted to 0x58
+(ocotea) powerpc-linux-ld.bfd: u-boot: section .resetvec lma
0xfffffffc adjusted to 0x60
+(qemu_mips64el,qemu_mips64) ../net/rarp.c: In function 'rarp_receive':
+(qemu_mips64el,qemu_mips64) ../net/rarp.c:47:21: error: invalid
operands to binary == (have 'struct in_addr' and 'int')
+(openrd_ultimate)   actual: 412652 bytes
+(openrd_ultimate)   excess: 19436 bytes
+(openrd_client)   actual: 412672 bytes
+(openrd_client)   excess: 19456 bytes
+(ebony) powerpc-linux-ld.bfd: section .bootpg loaded at
[fffff000,fffff23f] overlaps section .u_boot_list loaded at
[ffffec24,fffff47b]
+(ebony) powerpc-linux-ld.bfd: u-boot: section .bootpg lma 0xfffff000
adjusted to 0xfffff47c
+(ebony) powerpc-linux-ld.bfd: u-boot: section .data.init lma
0xfffff500 adjusted to 0xfffff6bc
+(alpr) powerpc-linux-ld.bfd: section .bootpg loaded at
[fffff000,fffff27f] overlaps section .data loaded at
[ffffbb08,fffff1e3]
+(alpr) powerpc-linux-ld.bfd: section .u_boot_list loaded at
[fffff1e4,fffff737] overlaps section .bootpg loaded at
[fffff000,fffff27f]
+(alpr) powerpc-linux-ld.bfd: u-boot: section .bootpg lma 0xfffff000
adjusted to 0xfffff1e4
+(alpr) powerpc-linux-ld.bfd: u-boot: section .u_boot_list lma
0xfffff1e4 adjusted to 0xfffff464
+(alpr) powerpc-linux-ld.bfd: u-boot: section .data.init lma
0xfffff800 adjusted to 0xfffff9b8
w+(a4m2k,a3m071) ../net/link_local.c: In function 'pick':
w+(a4m2k,a3m071) ../net/link_local.c:75:1: warning: control reaches
end of non-void function [-Wreturn-type]

Regards,
Simon

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 0/25] net: cosmetic: Fix naming and other checkpatch.pl issues in net/
  2015-04-03 21:14 [U-Boot] [PATCH 0/23] net: cosmetic: Fix naming and other checkpatch.pl issues in net/ Joe Hershberger
                   ` (23 preceding siblings ...)
  2015-04-06 20:41 ` [U-Boot] [PATCH 0/23] net: cosmetic: Fix naming and other checkpatch.pl issues in net/ Joe Hershberger
@ 2015-04-08  6:41 ` Joe Hershberger
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 01/25] net: cosmetic: Change IPaddr_t to struct in_addr Joe Hershberger
                     ` (25 more replies)
  24 siblings, 26 replies; 103+ messages in thread
From: Joe Hershberger @ 2015-04-08  6:41 UTC (permalink / raw)
  To: u-boot

This series is fairly disruptive in naming, so hopefully there aren't
many network stack changes in flight that will conflict with this. This
is based on top of dm/next for now so that the dm/eth series is assumed.
This will be rebased when that is, but will likely not have issues.

Like ripping off a bandage, do it quick and all at once.

Changes in v2:
-Fixed build failures in ip conversion patch
-New to series

Joe Hershberger (23):
  net: cosmetic: Change IPaddr_t to struct in_addr
  net: cosmetic: Fixup var names related to boot file
  net: cosmetic: Fixup var names for DHCP strings
  net: cosmetic: Name ethaddr variables consistently
  net: cosmetic: Cleanup internal packet buffer names
  net: cosmetic: Fix var naming net <-> eth drivers
  net: cosmetic: Clean up TFTP variables and functions
  net: cosmetic: Clean up ARP variables and functions
  net: cosmetic: Clean up DHCP variables and functions
  net: cosmetic: Clean up NFS variables and functions
  net: cosmetic: Clean up RARP variables and functions
  net: cosmetic: Clean up SNTP variables and functions
  net: cosmetic: Clean up ping variables and functions
  net: cosmetic: Clean up CDP variables and functions
  net: cosmetic: Clean up DNS variables and functions
  net: cosmetic: Clean up netconsole variables and functions
  net: cosmetic: Clean up cmd_net variables and functions
  net: cosmetic: Fix checkpatch.pl failures in linklocal
  net: cosmetic: Fix checkpatch.pl failures in eth.c
  net: cosmetic: Fix checkpatch.pl failures in net.h
  net: cosmetic: Fix checkpatch.pl failures in net.c
  net: Fix compile errors when SNTP enabled and not DATE
  sandbox: Enable more network features for sandbox

Sergey Temerkhanov (2):
  net: Fix incorrect DHCP/BOOTP packets on 64-bit systems
  net: Convert protocol structures to use explicit sizes

 README                                     |   6 +-
 arch/arm/mach-davinci/misc.c               |   2 +-
 arch/mips/mach-au1x00/au1x00_eth.c         |  12 +-
 arch/powerpc/cpu/mpc8260/ether_fcc.c       |  20 +-
 arch/powerpc/cpu/mpc8260/ether_scc.c       |   4 +-
 arch/powerpc/cpu/mpc85xx/ether_fcc.c       |   4 +-
 arch/powerpc/cpu/mpc8xx/fec.c              |  12 +-
 arch/powerpc/cpu/mpc8xx/scc.c              |   5 +-
 board/BuR/common/common.c                  |   4 +-
 board/ait/cam_enc_4xx/cam_enc_4xx.c        |   2 +-
 board/alphaproject/ap_sh4a_4a/ap_sh4a_4a.c |   2 +-
 board/bct-brettl2/bct-brettl2.c            |   2 +-
 board/bf518f-ezbrd/bf518f-ezbrd.c          |   4 +-
 board/bf526-ezbrd/bf526-ezbrd.c            |   4 +-
 board/bf527-ezkit/bf527-ezkit.c            |   4 +-
 board/bf537-minotaur/bf537-minotaur.c      |   2 +-
 board/bf537-pnav/bf537-pnav.c              |   2 +-
 board/bf537-srv1/bf537-srv1.c              |   2 +-
 board/bf537-stamp/bf537-stamp.c            |   4 +-
 board/birdland/bav335x/board.c             |   4 +-
 board/buffalo/lsxl/lsxl.c                  |   2 +-
 board/cm-bf527/cm-bf527.c                  |   4 +-
 board/cm-bf537e/cm-bf537e.c                |   2 +-
 board/cm-bf537u/cm-bf537u.c                |   2 +-
 board/compulab/cm_fx6/cm_fx6.c             |   2 +-
 board/compulab/cm_t335/cm_t335.c           |   2 +-
 board/compulab/cm_t35/cm_t35.c             |   2 +-
 board/compulab/cm_t3517/cm_t3517.c         |   4 +-
 board/compulab/cm_t54/cm_t54.c             |   4 +-
 board/davinci/da8xxevm/da850evm.c          |   6 +-
 board/dnp5370/dnp5370.c                    |   4 +-
 board/gumstix/pepper/board.c               |   2 +-
 board/ifm/ac14xx/ac14xx.c                  |   2 +-
 board/ip04/ip04.c                          |   2 +-
 board/isee/igep0033/board.c                |   2 +-
 board/phytec/pcm051/board.c                |   2 +-
 board/renesas/r0p7734/r0p7734.c            |   2 +-
 board/siemens/common/factoryset.c          |   4 +-
 board/siemens/pxm2/board.c                 |   2 +-
 board/silica/pengwyn/board.c               |   2 +-
 board/tcm-bf518/tcm-bf518.c                |   4 +-
 board/tcm-bf537/tcm-bf537.c                |   2 +-
 board/ti/am335x/board.c                    |   6 +-
 board/ti/am43xx/board.c                    |   4 +-
 board/ti/beagle_x15/board.c                |   4 +-
 board/ti/dra7xx/evm.c                      |   4 +-
 board/ti/ti814x/evm.c                      |   2 +-
 common/cmd_elf.c                           |   2 +-
 common/cmd_net.c                           | 133 +++----
 common/cmd_pxe.c                           |   4 +-
 common/spl/spl_net.c                       |   2 +-
 common/update.c                            |  25 +-
 doc/README.drivers.eth                     |  12 +-
 doc/README.enetaddr                        |   2 +-
 doc/README.link-local                      |   4 +-
 drivers/net/4xx_enet.c                     |  14 +-
 drivers/net/altera_tse.c                   |  15 +-
 drivers/net/armada100_fec.c                |   7 +-
 drivers/net/at91_emac.c                    |   4 +-
 drivers/net/ax88180.c                      |   6 +-
 drivers/net/bcm-sf2-eth.c                  |   6 +-
 drivers/net/bfin_mac.c                     |   4 +-
 drivers/net/calxedaxgmac.c                 |   2 +-
 drivers/net/cpsw.c                         |  17 +-
 drivers/net/cs8900.c                       |   5 +-
 drivers/net/davinci_emac.c                 |   5 +-
 drivers/net/dc2114x.c                      |   9 +-
 drivers/net/designware.c                   |   2 +-
 drivers/net/dm9000x.c                      |   9 +-
 drivers/net/dnet.c                         |   5 +-
 drivers/net/e1000.c                        |   4 +-
 drivers/net/eepro100.c                     |   3 +-
 drivers/net/enc28j60.c                     |  13 +-
 drivers/net/ep93xx_eth.c                   |  11 +-
 drivers/net/ethoc.c                        |   4 +-
 drivers/net/fec_mxc.c                      |   4 +-
 drivers/net/fm/eth.c                       |   2 +-
 drivers/net/fsl_mcdmafec.c                 |  23 +-
 drivers/net/ftgmac100.c                    |   4 +-
 drivers/net/ftmac100.c                     |   4 +-
 drivers/net/ftmac110.c                     |   4 +-
 drivers/net/greth.c                        |   2 +-
 drivers/net/keystone_net.c                 |   2 +-
 drivers/net/ks8851_mll.c                   |   6 +-
 drivers/net/lan91c96.c                     |  19 +-
 drivers/net/macb.c                         |  10 +-
 drivers/net/mcffec.c                       |   5 +-
 drivers/net/mpc512x_fec.c                  |   3 +-
 drivers/net/mpc5xxx_fec.c                  |   2 +-
 drivers/net/mvgbe.c                        |  41 +-
 drivers/net/mvneta.c                       |   2 +-
 drivers/net/natsemi.c                      |   3 +-
 drivers/net/ne2000_base.c                  |   2 +-
 drivers/net/netconsole.c                   |  94 ++---
 drivers/net/ns8382x.c                      |   6 +-
 drivers/net/pch_gbe.c                      |   2 +-
 drivers/net/pcnet.c                        |   2 +-
 drivers/net/rtl8139.c                      |   4 +-
 drivers/net/rtl8169.c                      |   2 +-
 drivers/net/sandbox-raw.c                  |   8 +-
 drivers/net/sandbox.c                      |  14 +-
 drivers/net/sh_eth.c                       |   2 +-
 drivers/net/smc91111.c                     |  18 +-
 drivers/net/smc911x.c                      |   4 +-
 drivers/net/sunxi_emac.c                   |   4 +-
 drivers/net/tsec.c                         |   7 +-
 drivers/net/tsi108_eth.c                   |   8 +-
 drivers/net/uli526x.c                      |   5 +-
 drivers/net/xilinx_axi_emac.c              |   2 +-
 drivers/net/xilinx_emaclite.c              |   2 +-
 drivers/net/xilinx_ll_temac_fifo.c         |   4 +-
 drivers/net/xilinx_ll_temac_sdma.c         |   4 +-
 drivers/net/zynq_gem.c                     |   2 +-
 drivers/qe/uec.c                           |   2 +-
 drivers/usb/eth/asix.c                     |   3 +-
 drivers/usb/eth/asix88179.c                |   2 +-
 drivers/usb/eth/mcs7830.c                  |   2 +-
 drivers/usb/eth/smsc95xx.c                 |   5 +-
 drivers/usb/gadget/ether.c                 |  13 +-
 include/common.h                           |   2 +-
 include/configs/sandbox.h                  |   9 +
 include/net.h                              | 303 ++++++++-------
 lib/net_utils.c                            |  16 +-
 net/arp.c                                  | 137 ++++---
 net/arp.h                                  |  22 +-
 net/bootp.c                                | 373 +++++++++---------
 net/bootp.h                                |  39 +-
 net/cdp.c                                  |  88 ++---
 net/cdp.h                                  |   2 +-
 net/dns.c                                  |  72 ++--
 net/dns.h                                  |   2 +-
 net/eth.c                                  |  61 +--
 net/link_local.c                           |  83 ++--
 net/net.c                                  | 450 +++++++++++-----------
 net/nfs.c                                  | 235 ++++++------
 net/nfs.h                                  |   2 +-
 net/ping.c                                 |  49 +--
 net/rarp.c                                 |  45 ++-
 net/rarp.h                                 |   6 +-
 net/sntp.c                                 |  48 +--
 net/sntp.h                                 |   2 +-
 net/tftp.c                                 | 589 +++++++++++++++--------------
 net/tftp.h                                 |   8 +-
 post/cpu/mpc8xx/ether.c                    |   6 +-
 test/dm/eth.c                              |  38 +-
 145 files changed, 1793 insertions(+), 1763 deletions(-)

-- 
1.7.11.5

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 01/25] net: cosmetic: Change IPaddr_t to struct in_addr
  2015-04-08  6:41 ` [U-Boot] [PATCH v2 0/25] " Joe Hershberger
@ 2015-04-08  6:41   ` Joe Hershberger
  2015-04-08 12:45     ` Simon Glass
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 02/25] net: cosmetic: Fixup var names related to boot file Joe Hershberger
                     ` (24 subsequent siblings)
  25 siblings, 1 reply; 103+ messages in thread
From: Joe Hershberger @ 2015-04-08  6:41 UTC (permalink / raw)
  To: u-boot

This patch is simply clean-up to make the IPv4 type that is used match
what Linux uses. It also attempts to move all variables that are IP
addresses use good naming instead of CamelCase. No functional change.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

Changes in v2:
-Fixed build failures in ip conversion patch

 common/cmd_net.c          |  50 +++++++++----------
 common/cmd_pxe.c          |   2 +-
 drivers/net/netconsole.c  |  37 +++++++-------
 drivers/net/sandbox-raw.c |   8 +--
 drivers/net/sandbox.c     |  14 +++---
 include/common.h          |   2 +-
 include/net.h             |  63 ++++++++++++-----------
 lib/net_utils.c           |  16 +++---
 net/arp.c                 |  56 ++++++++++-----------
 net/arp.h                 |   6 +--
 net/bootp.c               | 125 +++++++++++++++++++++++++---------------------
 net/bootp.h               |   8 +--
 net/dns.c                 |  18 +++----
 net/eth.c                 |   8 +--
 net/link_local.c          |  27 ++++++----
 net/net.c                 | 100 +++++++++++++++++++------------------
 net/nfs.c                 |  40 ++++++++-------
 net/ping.c                |  22 ++++----
 net/rarp.c                |   8 +--
 net/sntp.c                |  11 ++--
 net/tftp.c                |  69 +++++++++++++------------
 test/dm/eth.c             |  10 ++--
 22 files changed, 363 insertions(+), 337 deletions(-)

diff --git a/common/cmd_net.c b/common/cmd_net.c
index 3f52edc..53760a2 100644
--- a/common/cmd_net.c
+++ b/common/cmd_net.c
@@ -114,13 +114,13 @@ static void netboot_update_env(void)
 {
 	char tmp[22];
 
-	if (NetOurGatewayIP) {
-		ip_to_string(NetOurGatewayIP, tmp);
+	if (net_gateway.s_addr) {
+		ip_to_string(net_gateway, tmp);
 		setenv("gatewayip", tmp);
 	}
 
-	if (NetOurSubnetMask) {
-		ip_to_string(NetOurSubnetMask, tmp);
+	if (net_netmask.s_addr) {
+		ip_to_string(net_netmask, tmp);
 		setenv("netmask", tmp);
 	}
 
@@ -130,8 +130,8 @@ static void netboot_update_env(void)
 	if (NetOurRootPath[0])
 		setenv("rootpath", NetOurRootPath);
 
-	if (NetOurIP) {
-		ip_to_string(NetOurIP, tmp);
+	if (net_ip.s_addr) {
+		ip_to_string(net_ip, tmp);
 		setenv("ipaddr", tmp);
 	}
 #if !defined(CONFIG_BOOTP_SERVERIP)
@@ -139,18 +139,18 @@ static void netboot_update_env(void)
 	 * Only attempt to change serverip if net/bootp.c:BootpCopyNetParams()
 	 * could have set it
 	 */
-	if (NetServerIP) {
-		ip_to_string(NetServerIP, tmp);
+	if (net_server_ip.s_addr) {
+		ip_to_string(net_server_ip, tmp);
 		setenv("serverip", tmp);
 	}
 #endif
-	if (NetOurDNSIP) {
-		ip_to_string(NetOurDNSIP, tmp);
+	if (net_dns_server.s_addr) {
+		ip_to_string(net_dns_server, tmp);
 		setenv("dnsip", tmp);
 	}
 #if defined(CONFIG_BOOTP_DNS2)
-	if (NetOurDNS2IP) {
-		ip_to_string(NetOurDNS2IP, tmp);
+	if (net_dns_server2.s_addr) {
+		ip_to_string(net_dns_server2, tmp);
 		setenv("dnsip2", tmp);
 	}
 #endif
@@ -166,8 +166,8 @@ static void netboot_update_env(void)
 #endif
 #if defined(CONFIG_CMD_SNTP) \
     && defined(CONFIG_BOOTP_NTPSERVER)
-	if (NetNtpServerIP) {
-		ip_to_string(NetNtpServerIP, tmp);
+	if (net_ntp_server.s_addr) {
+		ip_to_string(net_ntp_server, tmp);
 		setenv("ntpserverip", tmp);
 	}
 #endif
@@ -260,8 +260,8 @@ static int do_ping(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	if (argc < 2)
 		return CMD_RET_USAGE;
 
-	NetPingIP = string_to_ip(argv[1]);
-	if (NetPingIP == 0)
+	net_ping_ip = string_to_ip(argv[1]);
+	if (net_ping_ip.s_addr == 0)
 		return CMD_RET_USAGE;
 
 	if (NetLoop(PING) < 0) {
@@ -331,14 +331,14 @@ int do_sntp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	char *toff;
 
 	if (argc < 2) {
-		NetNtpServerIP = getenv_IPaddr("ntpserverip");
-		if (NetNtpServerIP == 0) {
+		net_ntp_server = getenv_ip("ntpserverip");
+		if (net_ntp_server.s_addr == 0) {
 			printf("ntpserverip not set\n");
 			return CMD_RET_FAILURE;
 		}
 	} else {
-		NetNtpServerIP = string_to_ip(argv[1]);
-		if (NetNtpServerIP == 0) {
+		net_ntp_server = string_to_ip(argv[1]);
+		if (net_ntp_server.s_addr == 0) {
 			printf("Bad NTP server IP address\n");
 			return CMD_RET_FAILURE;
 		}
@@ -352,7 +352,7 @@ int do_sntp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 	if (NetLoop(SNTP) < 0) {
 		printf("SNTP failed: host %pI4 not responding\n",
-			&NetNtpServerIP);
+			&net_ntp_server);
 		return CMD_RET_FAILURE;
 	}
 
@@ -421,14 +421,14 @@ static int do_link_local(cmd_tbl_t *cmdtp, int flag, int argc,
 	if (NetLoop(LINKLOCAL) < 0)
 		return CMD_RET_FAILURE;
 
-	NetOurGatewayIP = 0;
-	ip_to_string(NetOurGatewayIP, tmp);
+	net_gateway.s_addr = 0;
+	ip_to_string(net_gateway, tmp);
 	setenv("gatewayip", tmp);
 
-	ip_to_string(NetOurSubnetMask, tmp);
+	ip_to_string(net_netmask, tmp);
 	setenv("netmask", tmp);
 
-	ip_to_string(NetOurIP, tmp);
+	ip_to_string(net_ip, tmp);
 	setenv("ipaddr", tmp);
 	setenv("llipaddr", tmp); /* store this for next time */
 
diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c
index 96f963d..9eac5c6 100644
--- a/common/cmd_pxe.c
+++ b/common/cmd_pxe.c
@@ -331,7 +331,7 @@ static int pxe_ipaddr_paths(cmd_tbl_t *cmdtp, void *pxefile_addr_r)
 	char ip_addr[9];
 	int mask_pos, err;
 
-	sprintf(ip_addr, "%08X", ntohl(NetOurIP));
+	sprintf(ip_addr, "%08X", ntohl(net_ip.s_addr));
 
 	for (mask_pos = 7; mask_pos >= 0;  mask_pos--) {
 		err = get_pxelinux_path(cmdtp, ip_addr, pxefile_addr_r);
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index 87cea7a..55f383f 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -23,7 +23,7 @@ static int input_recursion;
 static int output_recursion;
 static int net_timeout;
 static uchar nc_ether[6]; /* server enet address */
-static IPaddr_t nc_ip; /* server ip */
+static struct in_addr nc_ip; /* server ip */
 static short nc_out_port; /* target output port */
 static short nc_in_port; /* source input port */
 static const char *output_packet; /* used by first send udp */
@@ -35,14 +35,14 @@ static int output_packet_len;
 enum proto_t net_loop_last_protocol = BOOTP;
 
 static void nc_wait_arp_handler(uchar *pkt, unsigned dest,
-				 IPaddr_t sip, unsigned src,
+				 struct in_addr sip, unsigned src,
 				 unsigned len)
 {
 	net_set_state(NETLOOP_SUCCESS); /* got arp reply - quit net loop */
 }
 
-static void nc_handler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
-			unsigned len)
+static void nc_handler(uchar *pkt, unsigned dest, struct in_addr sip,
+		       unsigned src, unsigned len)
 {
 	if (input_size)
 		net_set_state(NETLOOP_SUCCESS); /* got input - quit net loop */
@@ -53,24 +53,25 @@ static void nc_timeout(void)
 	net_set_state(NETLOOP_SUCCESS);
 }
 
-static int is_broadcast(IPaddr_t ip)
+static int is_broadcast(struct in_addr ip)
 {
-	static IPaddr_t netmask;
-	static IPaddr_t our_ip;
+	static struct in_addr netmask;
+	static struct in_addr our_ip;
 	static int env_changed_id;
 	int env_id = get_env_id();
 
 	/* update only when the environment has changed */
 	if (env_changed_id != env_id) {
-		netmask = getenv_IPaddr("netmask");
-		our_ip = getenv_IPaddr("ipaddr");
+		netmask = getenv_ip("netmask");
+		our_ip = getenv_ip("ipaddr");
 
 		env_changed_id = env_id;
 	}
 
-	return (ip == ~0 ||				/* 255.255.255.255 */
-	    ((netmask & our_ip) == (netmask & ip) &&	/* on the same net */
-	    (netmask | ip) == ~0));		/* broadcast to our net */
+	return (ip.s_addr == ~0 || /* 255.255.255.255 (global bcast) */
+		((netmask.s_addr & our_ip.s_addr) ==
+		 (netmask.s_addr & ip.s_addr) && /* on the same net and */
+		 (netmask.s_addr | ip.s_addr) == ~0)); /* bcast to our net */
 }
 
 static int refresh_settings_from_env(void)
@@ -82,8 +83,8 @@ static int refresh_settings_from_env(void)
 	/* update only when the environment has changed */
 	if (env_changed_id != env_id) {
 		if (getenv("ncip")) {
-			nc_ip = getenv_IPaddr("ncip");
-			if (!nc_ip)
+			nc_ip = getenv_ip("ncip");
+			if (!nc_ip.s_addr)
 				return -1;	/* ncip is 0.0.0.0 */
 			p = strchr(getenv("ncip"), ':');
 			if (p != NULL) {
@@ -91,7 +92,7 @@ static int refresh_settings_from_env(void)
 				nc_in_port = nc_out_port;
 			}
 		} else
-			nc_ip = ~0; /* ncip is not set, so broadcast */
+			nc_ip.s_addr = ~0; /* ncip is not set, so broadcast */
 
 		p = getenv("ncoutport");
 		if (p != NULL)
@@ -131,7 +132,7 @@ void NcStart(void)
 	}
 }
 
-int nc_input_packet(uchar *pkt, IPaddr_t src_ip, unsigned dest_port,
+int nc_input_packet(uchar *pkt, struct in_addr src_ip, unsigned dest_port,
 	unsigned src_port, unsigned len)
 {
 	int end, chunk;
@@ -139,7 +140,7 @@ int nc_input_packet(uchar *pkt, IPaddr_t src_ip, unsigned dest_port,
 	if (dest_port != nc_in_port || !len)
 		return 0; /* not for us */
 
-	if (src_ip != nc_ip && !is_broadcast(nc_ip))
+	if (src_ip.s_addr != nc_ip.s_addr && !is_broadcast(nc_ip))
 		return 0; /* not from our client */
 
 	debug_cond(DEBUG_DEV_PKT, "input: \"%*.*s\"\n", len, len, pkt);
@@ -171,7 +172,7 @@ static void nc_send_packet(const char *buf, int len)
 	int inited = 0;
 	uchar *pkt;
 	uchar *ether;
-	IPaddr_t ip;
+	struct in_addr ip;
 
 	debug_cond(DEBUG_DEV_PKT, "output: \"%*.*s\"\n", len, len, buf);
 
diff --git a/drivers/net/sandbox-raw.c b/drivers/net/sandbox-raw.c
index 91da5f5..45c3b18 100644
--- a/drivers/net/sandbox-raw.c
+++ b/drivers/net/sandbox-raw.c
@@ -16,7 +16,7 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 static int reply_arp;
-static IPaddr_t arp_ip;
+static struct in_addr arp_ip;
 
 static int sb_eth_raw_start(struct udevice *dev)
 {
@@ -55,7 +55,7 @@ static int sb_eth_raw_send(struct udevice *dev, void *packet, int length)
 			 * localhost works on a higher-level API in Linux than
 			 * ARP packets, so fake it
 			 */
-			arp_ip = NetReadIP(&arp->ar_tpa);
+			arp_ip = net_read_ip(&arp->ar_tpa);
 			reply_arp = 1;
 			return 0;
 		}
@@ -93,9 +93,9 @@ static int sb_eth_raw_recv(struct udevice *dev, uchar **packetp)
 		/* Any non-zero MAC address will work */
 		memset(&arp->ar_sha, 0x01, ARP_HLEN);
 		/* Use whatever IP we were looking for (always 127.0.0.1?) */
-		NetWriteIP(&arp->ar_spa, arp_ip);
+		net_write_ip(&arp->ar_spa, arp_ip);
 		memcpy(&arp->ar_tha, pdata->enetaddr, ARP_HLEN);
-		NetWriteIP(&arp->ar_tpa, NetOurIP);
+		net_write_ip(&arp->ar_tpa, net_ip);
 		length = ARP_HDR_SIZE;
 	} else {
 		/* If local, the Ethernet header won't be included; skip it */
diff --git a/drivers/net/sandbox.c b/drivers/net/sandbox.c
index db115d0..e239ff4 100644
--- a/drivers/net/sandbox.c
+++ b/drivers/net/sandbox.c
@@ -24,7 +24,7 @@ DECLARE_GLOBAL_DATA_PTR;
  */
 struct eth_sandbox_priv {
 	uchar fake_host_hwaddr[ARP_HLEN];
-	IPaddr_t fake_host_ipaddr;
+	struct in_addr fake_host_ipaddr;
 	uchar *recv_packet_buffer;
 	int recv_packet_length;
 };
@@ -73,7 +73,7 @@ static int sb_eth_send(struct udevice *dev, void *packet, int length)
 			struct arp_hdr *arp_recv;
 
 			/* store this as the assumed IP of the fake host */
-			priv->fake_host_ipaddr = NetReadIP(&arp->ar_tpa);
+			priv->fake_host_ipaddr = net_read_ip(&arp->ar_tpa);
 			/* Formulate a fake response */
 			eth_recv = (void *)priv->recv_packet_buffer;
 			memcpy(eth_recv->et_dest, eth->et_src, ARP_HLEN);
@@ -90,9 +90,9 @@ static int sb_eth_send(struct udevice *dev, void *packet, int length)
 			arp_recv->ar_op = htons(ARPOP_REPLY);
 			memcpy(&arp_recv->ar_sha, priv->fake_host_hwaddr,
 			       ARP_HLEN);
-			NetWriteIP(&arp_recv->ar_spa, priv->fake_host_ipaddr);
+			net_write_ip(&arp_recv->ar_spa, priv->fake_host_ipaddr);
 			memcpy(&arp_recv->ar_tha, &arp->ar_sha, ARP_HLEN);
-			NetCopyIP(&arp_recv->ar_tpa, &arp->ar_spa);
+			net_copy_ip(&arp_recv->ar_tpa, &arp->ar_spa);
 
 			priv->recv_packet_length = ETHER_HDR_SIZE +
 				ARP_HDR_SIZE;
@@ -121,9 +121,9 @@ static int sb_eth_send(struct udevice *dev, void *packet, int length)
 				       ARP_HLEN);
 				ipr->ip_sum = 0;
 				ipr->ip_off = 0;
-				NetCopyIP((void *)&ipr->ip_dst, &ip->ip_src);
-				NetWriteIP((void *)&ipr->ip_src,
-					   priv->fake_host_ipaddr);
+				net_copy_ip((void *)&ipr->ip_dst, &ip->ip_src);
+				net_write_ip((void *)&ipr->ip_src,
+					     priv->fake_host_ipaddr);
 				ipr->ip_sum = compute_ip_checksum(ipr,
 					IP_HDR_SIZE);
 
diff --git a/include/common.h b/include/common.h
index 932b2fc..a079f13 100644
--- a/include/common.h
+++ b/include/common.h
@@ -826,7 +826,7 @@ int zzip(void *dst, unsigned long *lenp, unsigned char *src,
 
 /* lib/net_utils.c */
 #include <net.h>
-static inline IPaddr_t getenv_IPaddr(char *var)
+static inline struct in_addr getenv_ip(char *var)
 {
 	return string_to_ip(getenv(var));
 }
diff --git a/include/net.h b/include/net.h
index e7f28d7..2699c44 100644
--- a/include/net.h
+++ b/include/net.h
@@ -39,8 +39,9 @@
 #define PKTALIGN	ARCH_DMA_MINALIGN
 
 /* IPv4 addresses are always 32 bits in size */
-typedef __be32		IPaddr_t;
-
+struct in_addr {
+	__be32 s_addr;
+};
 
 /**
  * An incoming packet handler.
@@ -51,7 +52,7 @@ typedef __be32		IPaddr_t;
  * @param len    packet length
  */
 typedef void rxhand_f(uchar *pkt, unsigned dport,
-		      IPaddr_t sip, unsigned sport,
+		      struct in_addr sip, unsigned sport,
 		      unsigned len);
 
 /**
@@ -65,7 +66,7 @@ typedef void rxhand_f(uchar *pkt, unsigned dport,
  * @param len	packet length
  */
 typedef void rxhand_icmp_f(unsigned type, unsigned code, unsigned dport,
-		IPaddr_t sip, unsigned sport, uchar *pkt, unsigned len);
+		struct in_addr sip, unsigned sport, uchar *pkt, unsigned len);
 
 /*
  *	A timeout handler.  Called after time interval has expired.
@@ -237,7 +238,7 @@ void eth_halt(void);			/* stop SCC */
 const char *eth_get_name(void);		/* get name of current device */
 
 #ifdef CONFIG_MCAST_TFTP
-int eth_mcast_join(IPaddr_t mcast_addr, int join);
+int eth_mcast_join(struct in_addr mcast_addr, int join);
 u32 ether_crc(size_t len, unsigned char const *p);
 #endif
 
@@ -312,8 +313,8 @@ struct ip_hdr {
 	uchar		ip_ttl;		/* time to live			*/
 	uchar		ip_p;		/* protocol			*/
 	ushort		ip_sum;		/* checksum			*/
-	IPaddr_t	ip_src;		/* Source IP address		*/
-	IPaddr_t	ip_dst;		/* Destination IP address	*/
+	struct in_addr	ip_src;		/* Source IP address		*/
+	struct in_addr	ip_dst;		/* Destination IP address	*/
 };
 
 #define IP_OFFS		0x1fff /* ip offset *= 8 */
@@ -336,8 +337,8 @@ struct ip_udp_hdr {
 	uchar		ip_ttl;		/* time to live			*/
 	uchar		ip_p;		/* protocol			*/
 	ushort		ip_sum;		/* checksum			*/
-	IPaddr_t	ip_src;		/* Source IP address		*/
-	IPaddr_t	ip_dst;		/* Destination IP address	*/
+	struct in_addr	ip_src;		/* Source IP address		*/
+	struct in_addr	ip_dst;		/* Destination IP address	*/
 	ushort		udp_src;	/* UDP source port		*/
 	ushort		udp_dst;	/* UDP destination port		*/
 	ushort		udp_len;	/* Length of UDP packet		*/
@@ -452,17 +453,19 @@ struct icmp_hdr {
  *
  * Note:
  *
- * All variables of type IPaddr_t are stored in NETWORK byte order
+ * All variables of type struct in_addr are stored in NETWORK byte order
  * (big endian).
  */
 
 /* net.c */
 /** BOOTP EXTENTIONS **/
-extern IPaddr_t NetOurGatewayIP;	/* Our gateway IP address */
-extern IPaddr_t NetOurSubnetMask;	/* Our subnet mask (0 = unknown) */
-extern IPaddr_t NetOurDNSIP;	/* Our Domain Name Server (0 = unknown) */
+extern struct in_addr net_gateway;	/* Our gateway IP address */
+extern struct in_addr net_netmask;	/* Our subnet mask (0 = unknown) */
+/* Our Domain Name Server (0 = unknown) */
+extern struct in_addr net_dns_server;
 #if defined(CONFIG_BOOTP_DNS2)
-extern IPaddr_t NetOurDNS2IP;	/* Our 2nd Domain Name Server (0 = unknown) */
+/* Our 2nd Domain Name Server (0 = unknown) */
+extern struct in_addr net_dns_server2;
 #endif
 extern char	NetOurNISDomain[32];	/* Our NIS domain */
 extern char	NetOurHostName[32];	/* Our hostname */
@@ -472,8 +475,8 @@ extern ushort	NetBootFileSize;	/* Our boot file size in blocks */
 extern ulong		NetBootFileXferSize;	/* size of bootfile in bytes */
 extern uchar		NetOurEther[6];		/* Our ethernet address */
 extern uchar		NetServerEther[6];	/* Boot server enet address */
-extern IPaddr_t		NetOurIP;	/* Our    IP addr (0 = unknown) */
-extern IPaddr_t		NetServerIP;	/* Server IP addr (0 = unknown) */
+extern struct in_addr	net_ip;		/* Our    IP addr (0 = unknown) */
+extern struct in_addr	net_server_ip;	/* Server IP addr (0 = unknown) */
 extern uchar		*NetTxPacket;		/* THE transmit packet */
 #ifdef CONFIG_DM_ETH
 extern uchar		*net_rx_packets[PKTBUFSRX]; /* Receive packets */
@@ -507,7 +510,7 @@ extern char *NetDNSenvvar;		/* the env var to put the ip into */
 #endif
 
 #if defined(CONFIG_CMD_PING)
-extern IPaddr_t	NetPingIP;			/* the ip address to ping */
+extern struct in_addr net_ping_ip;	/* the ip address to ping */
 #endif
 
 #if defined(CONFIG_CMD_CDP)
@@ -527,12 +530,12 @@ static inline int is_cdp_packet(const uchar *et_addr)
 #endif
 
 #if defined(CONFIG_CMD_SNTP)
-extern IPaddr_t	NetNtpServerIP;			/* the ip address to NTP */
+extern struct in_addr	net_ntp_server;		/* the ip address to NTP */
 extern int NetTimeOffset;			/* offset time from UTC */
 #endif
 
 #if defined(CONFIG_MCAST_TFTP)
-extern IPaddr_t Mcast_addr;
+extern struct in_addr net_mcast_addr;
 #endif
 
 /* Initialize the network adapter */
@@ -553,8 +556,8 @@ int NetSetEther(uchar *, uchar *, uint);
 int net_update_ether(struct ethernet_hdr *et, uchar *addr, uint prot);
 
 /* Set IP header */
-void net_set_ip_header(uchar *pkt, IPaddr_t dest, IPaddr_t source);
-void net_set_udp_header(uchar *pkt, IPaddr_t dest, int dport,
+void net_set_ip_header(uchar *pkt, struct in_addr dest, struct in_addr source);
+void net_set_udp_header(uchar *pkt, struct in_addr dest, int dport,
 				int sport, int len);
 
 /**
@@ -627,7 +630,7 @@ static inline void NetSendPacket(uchar *pkt, int len)
  * @param sport Source UDP port
  * @param payload_len Length of data after the UDP header
  */
-int NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport,
+int NetSendUDPPacket(uchar *ether, struct in_addr dest, int dport,
 			int sport, int payload_len);
 
 #ifndef CONFIG_DM_ETH
@@ -638,7 +641,7 @@ void net_process_received_packet(uchar *in_packet, int len);
 
 #ifdef CONFIG_NETCONSOLE
 void NcStart(void);
-int nc_input_packet(uchar *pkt, IPaddr_t src_ip, unsigned dest_port,
+int nc_input_packet(uchar *pkt, struct in_addr src_ip, unsigned dest_port,
 	unsigned src_port, unsigned len);
 #endif
 
@@ -676,9 +679,9 @@ void net_auto_load(void);
  * footprint in our tests.
  */
 /* return IP *in network byteorder* */
-static inline IPaddr_t NetReadIP(void *from)
+static inline struct in_addr net_read_ip(void *from)
 {
-	IPaddr_t ip;
+	struct in_addr ip;
 
 	memcpy((void *)&ip, (void *)from, sizeof(ip));
 	return ip;
@@ -694,15 +697,15 @@ static inline ulong NetReadLong(ulong *from)
 }
 
 /* write IP *in network byteorder* */
-static inline void NetWriteIP(void *to, IPaddr_t ip)
+static inline void net_write_ip(void *to, struct in_addr ip)
 {
 	memcpy(to, (void *)&ip, sizeof(ip));
 }
 
 /* copy IP */
-static inline void NetCopyIP(void *to, void *from)
+static inline void net_copy_ip(void *to, void *from)
 {
-	memcpy((void *)to, from, sizeof(IPaddr_t));
+	memcpy((void *)to, from, sizeof(struct in_addr));
 }
 
 /* copy ulong */
@@ -782,10 +785,10 @@ static inline void eth_random_addr(uchar *addr)
 }
 
 /* Convert an IP address to a string */
-void ip_to_string(IPaddr_t x, char *s);
+void ip_to_string(struct in_addr x, char *s);
 
 /* Convert a string to ip address */
-IPaddr_t string_to_ip(const char *s);
+struct in_addr string_to_ip(const char *s);
 
 /* Convert a VLAN id to a string */
 void VLAN_to_string(ushort x, char *s);
diff --git a/lib/net_utils.c b/lib/net_utils.c
index 8d66163..cfae842 100644
--- a/lib/net_utils.c
+++ b/lib/net_utils.c
@@ -12,23 +12,25 @@
 
 #include <common.h>
 
-IPaddr_t string_to_ip(const char *s)
+struct in_addr string_to_ip(const char *s)
 {
-	IPaddr_t addr;
+	struct in_addr addr;
 	char *e;
 	int i;
 
+	addr.s_addr = 0;
 	if (s == NULL)
-		return(0);
+		return addr;
 
-	for (addr=0, i=0; i<4; ++i) {
+	for (addr.s_addr = 0, i = 0; i < 4; ++i) {
 		ulong val = s ? simple_strtoul(s, &e, 10) : 0;
-		addr <<= 8;
-		addr |= (val & 0xFF);
+		addr.s_addr <<= 8;
+		addr.s_addr |= (val & 0xFF);
 		if (s) {
 			s = (*e) ? e+1 : e;
 		}
 	}
 
-	return (htonl(addr));
+	addr.s_addr = htonl(addr.s_addr);
+	return addr;
 }
diff --git a/net/arp.c b/net/arp.c
index 21ed31b..4971a53 100644
--- a/net/arp.c
+++ b/net/arp.c
@@ -27,8 +27,8 @@
 # define ARP_TIMEOUT_COUNT	CONFIG_NET_RETRY_COUNT
 #endif
 
-IPaddr_t	NetArpWaitPacketIP;
-static IPaddr_t	NetArpWaitReplyIP;
+struct in_addr net_arp_wait_packet_ip;
+static struct in_addr net_arp_wait_reply_ip;
 /* MAC address of waiting packet's destination */
 uchar	       *NetArpWaitPacketMAC;
 int		NetArpWaitTxPacketSize;
@@ -42,15 +42,15 @@ void ArpInit(void)
 {
 	/* XXX problem with bss workaround */
 	NetArpWaitPacketMAC = NULL;
-	NetArpWaitPacketIP = 0;
-	NetArpWaitReplyIP = 0;
+	net_arp_wait_packet_ip.s_addr = 0;
+	net_arp_wait_reply_ip.s_addr = 0;
 	NetArpWaitTxPacketSize = 0;
 	NetArpTxPacket = &NetArpPacketBuf[0] + (PKTALIGN - 1);
 	NetArpTxPacket -= (ulong)NetArpTxPacket % PKTALIGN;
 }
 
-void arp_raw_request(IPaddr_t sourceIP, const uchar *targetEther,
-	IPaddr_t targetIP)
+void arp_raw_request(struct in_addr source_ip, const uchar *targetEther,
+	struct in_addr target_ip)
 {
 	uchar *pkt;
 	struct arp_hdr *arp;
@@ -72,35 +72,35 @@ void arp_raw_request(IPaddr_t sourceIP, const uchar *targetEther,
 	arp->ar_op = htons(ARPOP_REQUEST);
 
 	memcpy(&arp->ar_sha, NetOurEther, ARP_HLEN);	/* source ET addr */
-	NetWriteIP(&arp->ar_spa, sourceIP);		/* source IP addr */
+	net_write_ip(&arp->ar_spa, source_ip);		/* source IP addr */
 	memcpy(&arp->ar_tha, targetEther, ARP_HLEN);	/* target ET addr */
-	NetWriteIP(&arp->ar_tpa, targetIP);		/* target IP addr */
+	net_write_ip(&arp->ar_tpa, target_ip);		/* target IP addr */
 
 	NetSendPacket(NetArpTxPacket, eth_hdr_size + ARP_HDR_SIZE);
 }
 
 void ArpRequest(void)
 {
-	if ((NetArpWaitPacketIP & NetOurSubnetMask) !=
-	    (NetOurIP & NetOurSubnetMask)) {
-		if (NetOurGatewayIP == 0) {
+	if ((net_arp_wait_packet_ip.s_addr & net_netmask.s_addr) !=
+	    (net_ip.s_addr & net_netmask.s_addr)) {
+		if (net_gateway.s_addr == 0) {
 			puts("## Warning: gatewayip needed but not set\n");
-			NetArpWaitReplyIP = NetArpWaitPacketIP;
+			net_arp_wait_reply_ip = net_arp_wait_packet_ip;
 		} else {
-			NetArpWaitReplyIP = NetOurGatewayIP;
+			net_arp_wait_reply_ip = net_gateway;
 		}
 	} else {
-		NetArpWaitReplyIP = NetArpWaitPacketIP;
+		net_arp_wait_reply_ip = net_arp_wait_packet_ip;
 	}
 
-	arp_raw_request(NetOurIP, NetEtherNullAddr, NetArpWaitReplyIP);
+	arp_raw_request(net_ip, NetEtherNullAddr, net_arp_wait_reply_ip);
 }
 
 void ArpTimeoutCheck(void)
 {
 	ulong t;
 
-	if (!NetArpWaitPacketIP)
+	if (!net_arp_wait_packet_ip.s_addr)
 		return;
 
 	t = get_timer(0);
@@ -123,7 +123,7 @@ void ArpTimeoutCheck(void)
 void ArpReceive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
 {
 	struct arp_hdr *arp;
-	IPaddr_t reply_ip_addr;
+	struct in_addr reply_ip_addr;
 	uchar *pkt;
 	int eth_hdr_size;
 
@@ -152,10 +152,10 @@ void ArpReceive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
 	if (arp->ar_pln != ARP_PLEN)
 		return;
 
-	if (NetOurIP == 0)
+	if (net_ip.s_addr == 0)
 		return;
 
-	if (NetReadIP(&arp->ar_tpa) != NetOurIP)
+	if (net_read_ip(&arp->ar_tpa).s_addr != net_ip.s_addr)
 		return;
 
 	switch (ntohs(arp->ar_op)) {
@@ -167,9 +167,9 @@ void ArpReceive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
 		pkt += eth_hdr_size;
 		arp->ar_op = htons(ARPOP_REPLY);
 		memcpy(&arp->ar_tha, &arp->ar_sha, ARP_HLEN);
-		NetCopyIP(&arp->ar_tpa, &arp->ar_spa);
+		net_copy_ip(&arp->ar_tpa, &arp->ar_spa);
 		memcpy(&arp->ar_sha, NetOurEther, ARP_HLEN);
-		NetCopyIP(&arp->ar_spa, &NetOurIP);
+		net_copy_ip(&arp->ar_spa, &net_ip);
 
 #ifdef CONFIG_CMD_LINK_LOCAL
 		/*
@@ -180,8 +180,8 @@ void ArpReceive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
 		 *   reply to ARP request so that our reply will overwrite
 		 *   the arp-proxy's instead of the other way around.
 		 */
-		if ((NetReadIP(&arp->ar_tpa) & NetOurSubnetMask) !=
-		    (NetReadIP(&arp->ar_spa) & NetOurSubnetMask))
+		if ((net_read_ip(&arp->ar_tpa).s_addr & net_netmask.s_addr) !=
+		    (net_read_ip(&arp->ar_spa).s_addr & net_netmask.s_addr))
 			udelay(5000);
 #endif
 		NetSendPacket((uchar *)et, eth_hdr_size + ARP_HDR_SIZE);
@@ -189,21 +189,21 @@ void ArpReceive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
 
 	case ARPOP_REPLY:		/* arp reply */
 		/* are we waiting for a reply */
-		if (!NetArpWaitPacketIP)
+		if (!net_arp_wait_packet_ip.s_addr)
 			break;
 
 #ifdef CONFIG_KEEP_SERVERADDR
-		if (NetServerIP == NetArpWaitPacketIP) {
+		if (net_server_ip.s_addr == net_arp_wait_packet_ip.s_addr) {
 			char buf[20];
 			sprintf(buf, "%pM", &arp->ar_sha);
 			setenv("serveraddr", buf);
 		}
 #endif
 
-		reply_ip_addr = NetReadIP(&arp->ar_spa);
+		reply_ip_addr = net_read_ip(&arp->ar_spa);
 
 		/* matched waiting packet's address */
-		if (reply_ip_addr == NetArpWaitReplyIP) {
+		if (reply_ip_addr.s_addr == net_arp_wait_reply_ip.s_addr) {
 			debug_cond(DEBUG_DEV_PKT,
 				"Got ARP REPLY, set eth addr (%pM)\n",
 				arp->ar_data);
@@ -223,7 +223,7 @@ void ArpReceive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
 			NetSendPacket(NetTxPacket, NetArpWaitTxPacketSize);
 
 			/* no arp request pending now */
-			NetArpWaitPacketIP = 0;
+			net_arp_wait_packet_ip.s_addr = 0;
 			NetArpWaitTxPacketSize = 0;
 			NetArpWaitPacketMAC = NULL;
 
diff --git a/net/arp.h b/net/arp.h
index 3a0a13a..718342b 100644
--- a/net/arp.h
+++ b/net/arp.h
@@ -14,7 +14,7 @@
 
 #include <common.h>
 
-extern IPaddr_t	NetArpWaitPacketIP;
+extern struct in_addr net_arp_wait_packet_ip;
 /* MAC address of waiting packet's destination */
 extern uchar *NetArpWaitPacketMAC;
 extern int NetArpWaitTxPacketSize;
@@ -23,8 +23,8 @@ extern int NetArpWaitTry;
 
 void ArpInit(void);
 void ArpRequest(void);
-void arp_raw_request(IPaddr_t sourceIP, const uchar *targetEther,
-	IPaddr_t targetIP);
+void arp_raw_request(struct in_addr source_ip, const uchar *targetEther,
+	struct in_addr target_ip);
 void ArpTimeoutCheck(void);
 void ArpReceive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len);
 
diff --git a/net/bootp.c b/net/bootp.c
index 8106601..a56ed4c 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -60,9 +60,9 @@ ulong		bootp_timeout;
 #if defined(CONFIG_CMD_DHCP)
 static dhcp_state_t dhcp_state = INIT;
 static unsigned long dhcp_leasetime;
-static IPaddr_t NetDHCPServerIP;
-static void DhcpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
-			unsigned len);
+static struct in_addr dhcp_server_ip;
+static void dhcp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
+			unsigned src, unsigned len);
 
 /* For Debug */
 #if 0
@@ -139,11 +139,11 @@ static int BootpCheckPkt(uchar *pkt, unsigned dest, unsigned src, unsigned len)
 static void BootpCopyNetParams(struct Bootp_t *bp)
 {
 #if !defined(CONFIG_BOOTP_SERVERIP)
-	IPaddr_t tmp_ip;
+	struct in_addr tmp_ip;
 
-	NetCopyIP(&tmp_ip, &bp->bp_siaddr);
-	if (tmp_ip != 0)
-		NetCopyIP(&NetServerIP, &bp->bp_siaddr);
+	net_copy_ip(&tmp_ip, &bp->bp_siaddr);
+	if (tmp_ip.s_addr != 0)
+		net_copy_ip(&net_server_ip, &bp->bp_siaddr);
 	memcpy(NetServerEther, ((struct ethernet_hdr *)NetRxPacket)->et_src, 6);
 	if (strlen(bp->bp_file) > 0)
 		copy_filename(BootFile, bp->bp_file, sizeof(BootFile));
@@ -157,7 +157,7 @@ static void BootpCopyNetParams(struct Bootp_t *bp)
 	if (*BootFile)
 		setenv("bootfile", BootFile);
 #endif
-	NetCopyIP(&NetOurIP, &bp->bp_yiaddr);
+	net_copy_ip(&net_ip, &bp->bp_yiaddr);
 }
 
 static int truncate_sz(const char *name, int maxlen, int curlen)
@@ -184,26 +184,28 @@ static void BootpVendorFieldProcess(u8 *ext)
 	switch (*ext) {
 		/* Fixed length fields */
 	case 1:			/* Subnet mask */
-		if (NetOurSubnetMask == 0)
-			NetCopyIP(&NetOurSubnetMask, (IPaddr_t *) (ext + 2));
+		if (net_netmask.s_addr == 0)
+			net_copy_ip(&net_netmask, (struct in_addr *)(ext + 2));
 		break;
 	case 2:			/* Time offset - Not yet supported */
 		break;
 		/* Variable length fields */
 	case 3:			/* Gateways list */
-		if (NetOurGatewayIP == 0)
-			NetCopyIP(&NetOurGatewayIP, (IPaddr_t *) (ext + 2));
+		if (net_gateway.s_addr == 0)
+			net_copy_ip(&net_gateway, (struct in_addr *)(ext + 2));
 		break;
 	case 4:			/* Time server - Not yet supported */
 		break;
 	case 5:			/* IEN-116 name server - Not yet supported */
 		break;
 	case 6:
-		if (NetOurDNSIP == 0)
-			NetCopyIP(&NetOurDNSIP, (IPaddr_t *) (ext + 2));
+		if (net_dns_server.s_addr == 0)
+			net_copy_ip(&net_dns_server,
+				    (struct in_addr *)(ext + 2));
 #if defined(CONFIG_BOOTP_DNS2)
-		if ((NetOurDNS2IP == 0) && (size > 4))
-			NetCopyIP(&NetOurDNS2IP, (IPaddr_t *) (ext + 2 + 4));
+		if ((net_dns_server2.s_addr == 0) && (size > 4))
+			net_copy_ip(&net_dns_server2,
+				    (struct in_addr *)(ext + 2 + 4));
 #endif
 		break;
 	case 7:			/* Log server - Not yet supported */
@@ -262,7 +264,7 @@ static void BootpVendorFieldProcess(u8 *ext)
 		break;
 #if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_NTPSERVER)
 	case 42:	/* NTP server IP */
-		NetCopyIP(&NetNtpServerIP, (IPaddr_t *) (ext + 2));
+		net_copy_ip(&net_ntp_server, (struct in_addr *)(ext + 2));
 		break;
 #endif
 		/* Application layer fields */
@@ -295,11 +297,11 @@ static void BootpVendorProcess(u8 *ext, int size)
 	}
 
 	debug("[BOOTP] Received fields:\n");
-	if (NetOurSubnetMask)
-		debug("NetOurSubnetMask : %pI4\n", &NetOurSubnetMask);
+	if (net_netmask.s_addr)
+		debug("net_netmask : %pI4\n", &net_netmask);
 
-	if (NetOurGatewayIP)
-		debug("NetOurGatewayIP	: %pI4", &NetOurGatewayIP);
+	if (net_gateway.s_addr)
+		debug("net_gateway	: %pI4", &net_gateway);
 
 	if (NetBootFileSize)
 		debug("NetBootFileSize : %d\n", NetBootFileSize);
@@ -317,17 +319,16 @@ static void BootpVendorProcess(u8 *ext, int size)
 		debug("NetBootFileSize: %d\n", NetBootFileSize);
 
 #if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_NTPSERVER)
-	if (NetNtpServerIP)
-		debug("NetNtpServerIP : %pI4\n", &NetNtpServerIP);
+	if (net_ntp_server)
+		debug("net_ntp_server : %pI4\n", &net_ntp_server);
 #endif
 }
 
 /*
  *	Handle a BOOTP received packet.
  */
-static void
-BootpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
-	     unsigned len)
+static void bootp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
+			  unsigned src, unsigned len)
 {
 	struct Bootp_t *bp;
 
@@ -400,8 +401,8 @@ BootpTimeout(void)
  *	Initialize BOOTP extension fields in the request.
  */
 #if defined(CONFIG_CMD_DHCP)
-static int DhcpExtended(u8 *e, int message_type, IPaddr_t ServerID,
-			IPaddr_t RequestedIP)
+static int dhcp_extended(u8 *e, int message_type, struct in_addr server_ip,
+			struct in_addr requested_ip)
 {
 	u8 *start = e;
 	u8 *cnt;
@@ -431,8 +432,8 @@ static int DhcpExtended(u8 *e, int message_type, IPaddr_t ServerID,
 	*e++ = (576 - 312 + OPT_FIELD_SIZE) >> 8;
 	*e++ = (576 - 312 + OPT_FIELD_SIZE) & 0xff;
 
-	if (ServerID) {
-		int tmp = ntohl(ServerID);
+	if (server_ip.s_addr) {
+		int tmp = ntohl(server_ip.s_addr);
 
 		*e++ = 54;	/* ServerID */
 		*e++ = 4;
@@ -442,8 +443,8 @@ static int DhcpExtended(u8 *e, int message_type, IPaddr_t ServerID,
 		*e++ = tmp & 0xff;
 	}
 
-	if (RequestedIP) {
-		int tmp = ntohl(RequestedIP);
+	if (requested_ip.s_addr) {
+		int tmp = ntohl(requested_ip.s_addr);
 
 		*e++ = 50;	/* Requested IP */
 		*e++ = 4;
@@ -561,7 +562,7 @@ static int DhcpExtended(u8 *e, int message_type, IPaddr_t ServerID,
 /*
  * Warning: no field size check - change CONFIG_BOOTP_* at your own risk!
  */
-static int BootpExtended(u8 *e)
+static int bootp_extended(u8 *e)
 {
 	u8 *start = e;
 
@@ -662,6 +663,8 @@ BootpRequest(void)
 	ulong rand_ms;
 #endif
 	ulong BootpID;
+	struct in_addr zero_ip;
+	struct in_addr bcast_ip;
 
 	bootstage_mark_name(BOOTSTAGE_ID_BOOTP_START, "bootp_start");
 #if defined(CONFIG_CMD_DHCP)
@@ -707,18 +710,20 @@ BootpRequest(void)
 	bp->bp_hlen = HWL_ETHER;
 	bp->bp_hops = 0;
 	bp->bp_secs = htons(get_timer(0) / 1000);
-	NetWriteIP(&bp->bp_ciaddr, 0);
-	NetWriteIP(&bp->bp_yiaddr, 0);
-	NetWriteIP(&bp->bp_siaddr, 0);
-	NetWriteIP(&bp->bp_giaddr, 0);
+	zero_ip.s_addr = 0;
+	net_write_ip(&bp->bp_ciaddr, zero_ip);
+	net_write_ip(&bp->bp_yiaddr, zero_ip);
+	net_write_ip(&bp->bp_siaddr, zero_ip);
+	net_write_ip(&bp->bp_giaddr, zero_ip);
 	memcpy(bp->bp_chaddr, NetOurEther, 6);
 	copy_filename(bp->bp_file, BootFile, sizeof(bp->bp_file));
 
 	/* Request additional information from the BOOTP/DHCP server */
 #if defined(CONFIG_CMD_DHCP)
-	extlen = DhcpExtended((u8 *)bp->bp_vend, DHCP_DISCOVER, 0, 0);
+	extlen = dhcp_extended((u8 *)bp->bp_vend, DHCP_DISCOVER, zero_ip,
+			       zero_ip);
 #else
-	extlen = BootpExtended((u8 *)bp->bp_vend);
+	extlen = bootp_extended((u8 *)bp->bp_vend);
 #endif
 
 	/*
@@ -740,14 +745,15 @@ BootpRequest(void)
 	 */
 	iplen = BOOTP_HDR_SIZE - OPT_FIELD_SIZE + extlen;
 	pktlen = eth_hdr_size + IP_UDP_HDR_SIZE + iplen;
-	net_set_udp_header(iphdr, 0xFFFFFFFFL, PORT_BOOTPS, PORT_BOOTPC, iplen);
+	bcast_ip.s_addr = 0xFFFFFFFFL;
+	net_set_udp_header(iphdr, bcast_ip, PORT_BOOTPS, PORT_BOOTPC, iplen);
 	NetSetTimeout(bootp_timeout, BootpTimeout);
 
 #if defined(CONFIG_CMD_DHCP)
 	dhcp_state = SELECTING;
-	net_set_udp_handler(DhcpHandler);
+	net_set_udp_handler(dhcp_handler);
 #else
-	net_set_udp_handler(BootpHandler);
+	net_set_udp_handler(bootp_handler);
 #endif
 	NetSendPacket(NetTxPacket, pktlen);
 }
@@ -765,7 +771,7 @@ static void DhcpOptionsProcess(uchar *popt, struct Bootp_t *bp)
 		oplen = *(popt + 1);
 		switch (*popt) {
 		case 1:
-			NetCopyIP(&NetOurSubnetMask, (popt + 2));
+			net_copy_ip(&net_netmask, (popt + 2));
 			break;
 #if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_TIMEOFFSET)
 		case 2:		/* Time offset	*/
@@ -775,13 +781,13 @@ static void DhcpOptionsProcess(uchar *popt, struct Bootp_t *bp)
 			break;
 #endif
 		case 3:
-			NetCopyIP(&NetOurGatewayIP, (popt + 2));
+			net_copy_ip(&net_gateway, (popt + 2));
 			break;
 		case 6:
-			NetCopyIP(&NetOurDNSIP, (popt + 2));
+			net_copy_ip(&net_dns_server, (popt + 2));
 #if defined(CONFIG_BOOTP_DNS2)
 			if (*(popt + 1) > 4)
-				NetCopyIP(&NetOurDNS2IP, (popt + 2 + 4));
+				net_copy_ip(&net_dns_server2, (popt + 2 + 4));
 #endif
 			break;
 		case 12:
@@ -802,7 +808,7 @@ static void DhcpOptionsProcess(uchar *popt, struct Bootp_t *bp)
 			break;
 #if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_NTPSERVER)
 		case 42:	/* NTP server IP */
-			NetCopyIP(&NetNtpServerIP, (popt + 2));
+			net_copy_ip(&net_ntp_server, (popt + 2));
 			break;
 #endif
 		case 51:
@@ -811,7 +817,7 @@ static void DhcpOptionsProcess(uchar *popt, struct Bootp_t *bp)
 		case 53:	/* Ignore Message Type Option */
 			break;
 		case 54:
-			NetCopyIP(&NetDHCPServerIP, (popt + 2));
+			net_copy_ip(&dhcp_server_ip, (popt + 2));
 			break;
 		case 58:	/* Ignore Renewal Time Option */
 			break;
@@ -878,7 +884,9 @@ static void DhcpSendRequestPkt(struct Bootp_t *bp_offer)
 	struct Bootp_t *bp;
 	int pktlen, iplen, extlen;
 	int eth_hdr_size;
-	IPaddr_t OfferedIP;
+	struct in_addr offered_ip;
+	struct in_addr zero_ip;
+	struct in_addr bcast_ip;
 
 	debug("DhcpSendRequestPkt: Sending DHCPREQUEST\n");
 	pkt = NetTxPacket;
@@ -903,7 +911,8 @@ static void DhcpSendRequestPkt(struct Bootp_t *bp_offer)
 	 * RFC3046 requires Relay Agents to discard packets with
 	 * nonzero and offered giaddr
 	 */
-	NetWriteIP(&bp->bp_giaddr, 0);
+	zero_ip.s_addr = 0;
+	net_write_ip(&bp->bp_giaddr, zero_ip);
 
 	memcpy(bp->bp_chaddr, NetOurEther, 6);
 
@@ -918,13 +927,14 @@ static void DhcpSendRequestPkt(struct Bootp_t *bp_offer)
 	 */
 
 	/* Copy offered IP into the parameters request list */
-	NetCopyIP(&OfferedIP, &bp_offer->bp_yiaddr);
-	extlen = DhcpExtended((u8 *)bp->bp_vend, DHCP_REQUEST,
-		NetDHCPServerIP, OfferedIP);
+	net_copy_ip(&offered_ip, &bp_offer->bp_yiaddr);
+	extlen = dhcp_extended((u8 *)bp->bp_vend, DHCP_REQUEST,
+		dhcp_server_ip, offered_ip);
 
 	iplen = BOOTP_HDR_SIZE - OPT_FIELD_SIZE + extlen;
 	pktlen = eth_hdr_size + IP_UDP_HDR_SIZE + iplen;
-	net_set_udp_header(iphdr, 0xFFFFFFFFL, PORT_BOOTPS, PORT_BOOTPC, iplen);
+	bcast_ip.s_addr = 0xFFFFFFFFL;
+	net_set_udp_header(iphdr, bcast_ip, PORT_BOOTPS, PORT_BOOTPC, iplen);
 
 #ifdef CONFIG_BOOTP_DHCP_REQUEST_DELAY
 	udelay(CONFIG_BOOTP_DHCP_REQUEST_DELAY);
@@ -936,9 +946,8 @@ static void DhcpSendRequestPkt(struct Bootp_t *bp_offer)
 /*
  *	Handle DHCP received packets.
  */
-static void
-DhcpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
-	    unsigned len)
+static void dhcp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
+			 unsigned src, unsigned len)
 {
 	struct Bootp_t *bp = (struct Bootp_t *)pkt;
 
@@ -993,7 +1002,7 @@ DhcpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
 			BootpCopyNetParams(bp);
 			dhcp_state = BOUND;
 			printf("DHCP client bound to address %pI4 (%lu ms)\n",
-				&NetOurIP, get_timer(bootp_start));
+				&net_ip, get_timer(bootp_start));
 			bootstage_mark_name(BOOTSTAGE_ID_BOOTP_STOP,
 				"bootp_stop");
 
diff --git a/net/bootp.h b/net/bootp.h
index 3b95a0a..16f40dc 100644
--- a/net/bootp.h
+++ b/net/bootp.h
@@ -41,10 +41,10 @@ struct Bootp_t {
 	ulong		bp_id;		/* Transaction ID		*/
 	ushort		bp_secs;	/* Seconds since boot		*/
 	ushort		bp_spare1;	/* Alignment			*/
-	IPaddr_t	bp_ciaddr;	/* Client IP address		*/
-	IPaddr_t	bp_yiaddr;	/* Your (client) IP address	*/
-	IPaddr_t	bp_siaddr;	/* Server IP address		*/
-	IPaddr_t	bp_giaddr;	/* Gateway IP address		*/
+	struct in_addr	bp_ciaddr;	/* Client IP address		*/
+	struct in_addr	bp_yiaddr;	/* Your (client) IP address	*/
+	struct in_addr	bp_siaddr;	/* Server IP address		*/
+	struct in_addr	bp_giaddr;	/* Gateway IP address		*/
 	uchar		bp_chaddr[16];	/* Client hardware address	*/
 	char		bp_sname[64];	/* Server host name		*/
 	char		bp_file[128];	/* Boot file name		*/
diff --git a/net/dns.c b/net/dns.c
index dd45320..6f8b1f2 100644
--- a/net/dns.c
+++ b/net/dns.c
@@ -5,7 +5,7 @@
  * Copyright (c) 2009 Robin Getz <rgetz@blackfin.uclinux.org>
  *
  * This is a simple DNS implementation for U-Boot. It will use the first IP
- * in the DNS response as NetServerIP. This can then be used for any other
+ * in the DNS response as net_server_ip. This can then be used for any other
  * network related activities.
  *
  * The packet handling is partly based on TADNS, original copyrights
@@ -89,8 +89,8 @@ DnsSend(void)
 
 	DnsOurPort = random_port();
 
-	NetSendUDPPacket(NetServerEther, NetOurDNSIP, DNS_SERVICE_PORT,
-		DnsOurPort, n);
+	NetSendUDPPacket(NetServerEther, net_dns_server, DNS_SERVICE_PORT,
+			 DnsOurPort, n);
 	debug("DNS packet sent\n");
 }
 
@@ -101,15 +101,15 @@ DnsTimeout(void)
 	net_set_state(NETLOOP_FAIL);
 }
 
-static void
-DnsHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src, unsigned len)
+static void dns_handler(uchar *pkt, unsigned dest, struct in_addr sip,
+			unsigned src, unsigned len)
 {
 	struct header *header;
 	const unsigned char *p, *e, *s;
 	u16 type, i;
 	int found, stop, dlen;
 	char IPStr[22];
-	IPaddr_t IPAddress;
+	struct in_addr ip_addr;
 
 
 	debug("%s\n", __func__);
@@ -180,10 +180,10 @@ DnsHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src, unsigned len)
 
 		dlen = get_unaligned_be16(p+10);
 		p += 12;
-		memcpy(&IPAddress, p, 4);
+		memcpy(&ip_addr, p, 4);
 
 		if (p + dlen <= e) {
-			ip_to_string(IPAddress, IPStr);
+			ip_to_string(ip_addr, IPStr);
 			printf("%s\n", IPStr);
 			if (NetDNSenvvar)
 				setenv(NetDNSenvvar, IPStr);
@@ -200,7 +200,7 @@ DnsStart(void)
 	debug("%s\n", __func__);
 
 	NetSetTimeout(DNS_TIMEOUT, DnsTimeout);
-	net_set_udp_handler(DnsHandler);
+	net_set_udp_handler(dns_handler);
 
 	/* Clear a previous MAC address, the server IP might have changed. */
 	memset(NetServerEther, 0, sizeof(NetServerEther));
diff --git a/net/eth.c b/net/eth.c
index 13b7723..930470e 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -766,14 +766,14 @@ int eth_initialize(void)
  * mcast_addr: multicast ipaddr from which multicast Mac is made
  * join: 1=join, 0=leave.
  */
-int eth_mcast_join(IPaddr_t mcast_ip, int join)
+int eth_mcast_join(struct in_addr mcast_ip, int join)
 {
 	u8 mcast_mac[6];
 	if (!eth_current || !eth_current->mcast)
 		return -1;
-	mcast_mac[5] = htonl(mcast_ip) & 0xff;
-	mcast_mac[4] = (htonl(mcast_ip)>>8) & 0xff;
-	mcast_mac[3] = (htonl(mcast_ip)>>16) & 0x7f;
+	mcast_mac[5] = htonl(mcast_ip.s_addr) & 0xff;
+	mcast_mac[4] = (htonl(mcast_ip.s_addr)>>8) & 0xff;
+	mcast_mac[3] = (htonl(mcast_ip.s_addr)>>16) & 0x7f;
 	mcast_mac[2] = 0x5e;
 	mcast_mac[1] = 0x0;
 	mcast_mac[0] = 0x1;
diff --git a/net/link_local.c b/net/link_local.c
index 4152fae..6d92c55 100644
--- a/net/link_local.c
+++ b/net/link_local.c
@@ -49,7 +49,7 @@ static enum ll_state_t {
 	DISABLED
 } state = DISABLED;
 
-static IPaddr_t ip;
+static struct in_addr ip;
 static int timeout_ms = -1;
 static unsigned deadline_ms;
 static unsigned conflicts;
@@ -64,14 +64,16 @@ static void link_local_timeout(void);
  * Pick a random link local IP address on 169.254/16, except that
  * the first and last 256 addresses are reserved.
  */
-static IPaddr_t pick(void)
+static struct in_addr pick(void)
 {
 	unsigned tmp;
+	struct in_addr ip;
 
 	do {
 		tmp = rand_r(&seed) & IN_CLASSB_HOST;
 	} while (tmp > (IN_CLASSB_HOST - 0x0200));
-	return (IPaddr_t) htonl((LINKLOCAL_ADDR + 0x0100) + tmp);
+	ip.s_addr = htonl((LINKLOCAL_ADDR + 0x0100) + tmp);
+	return ip;
 }
 
 /**
@@ -102,16 +104,17 @@ static void configure_wait(void)
 
 void link_local_start(void)
 {
-	ip = getenv_IPaddr("llipaddr");
-	if (ip != 0 && (ntohl(ip) & IN_CLASSB_NET) != LINKLOCAL_ADDR) {
+	ip = getenv_ip("llipaddr");
+	if (ip.s_addr != 0 &&
+	    (ntohl(ip.s_addr) & IN_CLASSB_NET) != LINKLOCAL_ADDR) {
 		puts("invalid link address");
 		net_set_state(NETLOOP_FAIL);
 		return;
 	}
-	NetOurSubnetMask = IN_CLASSB_NET;
+	net_netmask.s_addr = IN_CLASSB_NET;
 
 	seed = seed_mac();
-	if (ip == 0)
+	if (ip.s_addr == 0)
 		ip = pick();
 
 	state = PROBE;
@@ -131,10 +134,12 @@ static void link_local_timeout(void)
 		/* timeouts in the PROBE state mean no conflicting ARP packets
 		   have been received, so we can progress through the states */
 		if (nprobes < PROBE_NUM) {
+			struct in_addr zero_ip = {.s_addr = 0};
+
 			nprobes++;
 			debug_cond(DEBUG_LL_STATE, "probe/%u %s@%pI4\n",
 					nprobes, eth_get_name(), &ip);
-			arp_raw_request(0, NetEtherNullAddr, ip);
+			arp_raw_request(zero_ip, NetEtherNullAddr, ip);
 			timeout_ms = PROBE_MIN * 1000;
 			timeout_ms += random_delay_ms(PROBE_MAX - PROBE_MIN);
 		} else {
@@ -172,7 +177,7 @@ static void link_local_timeout(void)
 			/* Switch to monitor state */
 			state = MONITOR;
 			printf("Successfully assigned %pI4\n", &ip);
-			NetCopyIP(&NetOurIP, &ip);
+			net_copy_ip(&net_ip, &ip);
 			ready = 1;
 			conflicts = 0;
 			timeout_ms = -1;
@@ -206,7 +211,7 @@ void link_local_receive_arp(struct arp_hdr *arp, int len)
 {
 	int source_ip_conflict;
 	int target_ip_conflict;
-	IPaddr_t null_ip = 0;
+	struct in_addr null_ip = {.s_addr = 0};
 
 	if (state == DISABLED)
 		return;
@@ -322,7 +327,7 @@ void link_local_receive_arp(struct arp_hdr *arp, int len)
 			state = PROBE;
 			debug("defend conflict -- starting over\n");
 			ready = 0;
-			NetOurIP = 0;
+			net_ip.s_addr = 0;
 
 			/* restart the whole protocol */
 			ip = pick();
diff --git a/net/net.c b/net/net.c
index 69f38f7..b1b822d 100644
--- a/net/net.c
+++ b/net/net.c
@@ -112,14 +112,14 @@ DECLARE_GLOBAL_DATA_PTR;
 /** BOOTP EXTENTIONS **/
 
 /* Our subnet mask (0=unknown) */
-IPaddr_t	NetOurSubnetMask;
+struct in_addr net_netmask;
 /* Our gateways IP address */
-IPaddr_t	NetOurGatewayIP;
+struct in_addr net_gateway;
 /* Our DNS IP address */
-IPaddr_t	NetOurDNSIP;
+struct in_addr net_dns_server;
 #if defined(CONFIG_BOOTP_DNS2)
 /* Our 2nd DNS IP address */
-IPaddr_t	NetOurDNS2IP;
+struct in_addr net_dns_server2;
 #endif
 /* Our NIS domain */
 char		NetOurNISDomain[32] = {0,};
@@ -131,7 +131,7 @@ char		NetOurRootPath[64] = {0,};
 ushort		NetBootFileSize;
 
 #ifdef CONFIG_MCAST_TFTP	/* Multicast TFTP */
-IPaddr_t Mcast_addr;
+struct in_addr net_mcast_addr;
 #endif
 
 /** END OF BOOTP EXTENTIONS **/
@@ -143,9 +143,9 @@ uchar		NetOurEther[6];
 /* Boot server enet address */
 uchar		NetServerEther[6];
 /* Our IP addr (0 = unknown) */
-IPaddr_t	NetOurIP;
+struct in_addr	net_ip;
 /* Server IP addr (0 = unknown) */
-IPaddr_t	NetServerIP;
+struct in_addr	net_server_ip;
 /* Current receive packet */
 uchar *NetRxPacket;
 /* Current rx packet length */
@@ -178,7 +178,7 @@ char		BootFile[128];
 
 #if defined(CONFIG_CMD_SNTP)
 /* NTP server IP address */
-IPaddr_t	NetNtpServerIP;
+struct in_addr	net_ntp_server;
 /* offset time from UTC */
 int		NetTimeOffset;
 #endif
@@ -267,14 +267,14 @@ static void NetInitLoop(void)
 
 	/* update only when the environment has changed */
 	if (env_changed_id != env_id) {
-		NetOurIP = getenv_IPaddr("ipaddr");
-		NetOurGatewayIP = getenv_IPaddr("gatewayip");
-		NetOurSubnetMask = getenv_IPaddr("netmask");
-		NetServerIP = getenv_IPaddr("serverip");
+		net_ip = getenv_ip("ipaddr");
+		net_gateway = getenv_ip("gatewayip");
+		net_netmask = getenv_ip("netmask");
+		net_server_ip = getenv_ip("serverip");
 		NetOurNativeVLAN = getenv_VLAN("nvlan");
 		NetOurVLAN = getenv_VLAN("vlan");
 #if defined(CONFIG_CMD_DNS)
-		NetOurDNSIP = getenv_IPaddr("dnsip");
+		net_dns_server = getenv_ip("dnsip");
 #endif
 		env_changed_id = env_id;
 	}
@@ -397,21 +397,21 @@ restart:
 #if defined(CONFIG_CMD_DHCP)
 		case DHCP:
 			BootpReset();
-			NetOurIP = 0;
+			net_ip.s_addr = 0;
 			DhcpRequest();		/* Basically same as BOOTP */
 			break;
 #endif
 
 		case BOOTP:
 			BootpReset();
-			NetOurIP = 0;
+			net_ip.s_addr = 0;
 			BootpRequest();
 			break;
 
 #if defined(CONFIG_CMD_RARP)
 		case RARP:
 			RarpTry = 0;
-			NetOurIP = 0;
+			net_ip.s_addr = 0;
 			RarpRequest();
 			break;
 #endif
@@ -496,7 +496,7 @@ restart:
 		 */
 		if (ctrlc()) {
 			/* cancel any ARP that may not have completed */
-			NetArpWaitPacketIP = 0;
+			net_arp_wait_packet_ip.s_addr = 0;
 
 			net_cleanup_loop();
 			eth_halt();
@@ -660,7 +660,7 @@ int NetStartAgain(void)
  */
 
 static void dummy_handler(uchar *pkt, unsigned dport,
-			IPaddr_t sip, unsigned sport,
+			struct in_addr sip, unsigned sport,
 			unsigned len)
 {
 }
@@ -716,7 +716,7 @@ NetSetTimeout(ulong iv, thand_f *f)
 	}
 }
 
-int NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport,
+int NetSendUDPPacket(uchar *ether, struct in_addr dest, int dport, int sport,
 		int payload_len)
 {
 	uchar *pkt;
@@ -729,11 +729,11 @@ int NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport,
 		return -1;
 
 	/* convert to new style broadcast */
-	if (dest == 0)
-		dest = 0xFFFFFFFF;
+	if (dest.s_addr == 0)
+		dest.s_addr = 0xFFFFFFFF;
 
 	/* if broadcast, make the ether address a broadcast and don't do ARP */
-	if (dest == 0xFFFFFFFF)
+	if (dest.s_addr == 0xFFFFFFFF)
 		ether = NetBcastAddr;
 
 	pkt = (uchar *)NetTxPacket;
@@ -748,7 +748,7 @@ int NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport,
 		debug_cond(DEBUG_DEV_PKT, "sending ARP for %pI4\n", &dest);
 
 		/* save the ip and eth addr for the packet to send after arp */
-		NetArpWaitPacketIP = dest;
+		net_arp_wait_packet_ip = dest;
 		NetArpWaitPacketMAC = ether;
 
 		/* size of the waiting packet */
@@ -946,7 +946,7 @@ static inline struct ip_udp_hdr *NetDefragment(struct ip_udp_hdr *ip, int *lenp)
  * @parma ip	IP packet containing the ICMP
  */
 static void receive_icmp(struct ip_udp_hdr *ip, int len,
-			IPaddr_t src_ip, struct ethernet_hdr *et)
+			struct in_addr src_ip, struct ethernet_hdr *et)
 {
 	struct icmp_hdr *icmph = (struct icmp_hdr *)&ip->udp_src;
 
@@ -975,8 +975,8 @@ void net_process_received_packet(uchar *in_packet, int len)
 {
 	struct ethernet_hdr *et;
 	struct ip_udp_hdr *ip;
-	IPaddr_t dst_ip;
-	IPaddr_t src_ip;
+	struct in_addr dst_ip;
+	struct in_addr src_ip;
 	int eth_proto;
 #if defined(CONFIG_CMD_CDP)
 	int iscdp;
@@ -1112,15 +1112,16 @@ void net_process_received_packet(uchar *in_packet, int len)
 			return;
 		}
 		/* If it is not for us, ignore it */
-		dst_ip = NetReadIP(&ip->ip_dst);
-		if (NetOurIP && dst_ip != NetOurIP && dst_ip != 0xFFFFFFFF) {
+		dst_ip = net_read_ip(&ip->ip_dst);
+		if (net_ip.s_addr && dst_ip.s_addr != net_ip.s_addr &&
+		    dst_ip.s_addr != 0xFFFFFFFF) {
 #ifdef CONFIG_MCAST_TFTP
-			if (Mcast_addr != dst_ip)
+			if (net_mcast_addr != dst_ip)
 #endif
 				return;
 		}
 		/* Read source IP address for later use */
-		src_ip = NetReadIP(&ip->ip_src);
+		src_ip = net_read_ip(&ip->ip_src);
 		/*
 		 * The function returns the unchanged packet if it's not
 		 * a fragment, and either the complete packet or NULL if
@@ -1169,10 +1170,10 @@ void net_process_received_packet(uchar *in_packet, int len)
 
 			xsum  = ip->ip_p;
 			xsum += (ntohs(ip->udp_len));
-			xsum += (ntohl(ip->ip_src) >> 16) & 0x0000ffff;
-			xsum += (ntohl(ip->ip_src) >>  0) & 0x0000ffff;
-			xsum += (ntohl(ip->ip_dst) >> 16) & 0x0000ffff;
-			xsum += (ntohl(ip->ip_dst) >>  0) & 0x0000ffff;
+			xsum += (ntohl(ip->ip_src.s_addr) >> 16) & 0x0000ffff;
+			xsum += (ntohl(ip->ip_src.s_addr) >>  0) & 0x0000ffff;
+			xsum += (ntohl(ip->ip_dst.s_addr) >> 16) & 0x0000ffff;
+			xsum += (ntohl(ip->ip_dst.s_addr) >>  0) & 0x0000ffff;
 
 			sumlen = ntohs(ip->udp_len);
 			sumptr = (ushort *) &(ip->udp_src);
@@ -1232,7 +1233,7 @@ static int net_check_prereq(enum proto_t protocol)
 		/* Fall through */
 #if defined(CONFIG_CMD_PING)
 	case PING:
-		if (NetPingIP == 0) {
+		if (net_ping_ip.s_addr == 0) {
 			puts("*** ERROR: ping address not given\n");
 			return 1;
 		}
@@ -1240,7 +1241,7 @@ static int net_check_prereq(enum proto_t protocol)
 #endif
 #if defined(CONFIG_CMD_SNTP)
 	case SNTP:
-		if (NetNtpServerIP == 0) {
+		if (net_ntp_server.s_addr == 0) {
 			puts("*** ERROR: NTP server address not given\n");
 			return 1;
 		}
@@ -1248,7 +1249,7 @@ static int net_check_prereq(enum proto_t protocol)
 #endif
 #if defined(CONFIG_CMD_DNS)
 	case DNS:
-		if (NetOurDNSIP == 0) {
+		if (net_dns_server.s_addr == 0) {
 			puts("*** ERROR: DNS server address not given\n");
 			return 1;
 		}
@@ -1259,7 +1260,7 @@ static int net_check_prereq(enum proto_t protocol)
 #endif
 	case TFTPGET:
 	case TFTPPUT:
-		if (NetServerIP == 0) {
+		if (net_server_ip.s_addr == 0) {
 			puts("*** ERROR: `serverip' not set\n");
 			return 1;
 		}
@@ -1271,7 +1272,7 @@ common:
 
 	case NETCONS:
 	case TFTPSRV:
-		if (NetOurIP == 0) {
+		if (net_ip.s_addr == 0) {
 			puts("*** ERROR: `ipaddr' not set\n");
 			return 1;
 		}
@@ -1373,7 +1374,7 @@ int net_update_ether(struct ethernet_hdr *et, uchar *addr, uint prot)
 	}
 }
 
-void net_set_ip_header(uchar *pkt, IPaddr_t dest, IPaddr_t source)
+void net_set_ip_header(uchar *pkt, struct in_addr dest, struct in_addr source)
 {
 	struct ip_udp_hdr *ip = (struct ip_udp_hdr *)pkt;
 
@@ -1389,12 +1390,12 @@ void net_set_ip_header(uchar *pkt, IPaddr_t dest, IPaddr_t source)
 	ip->ip_ttl   = 255;
 	ip->ip_sum   = 0;
 	/* already in network byte order */
-	NetCopyIP((void *)&ip->ip_src, &source);
+	net_copy_ip((void *)&ip->ip_src, &source);
 	/* already in network byte order */
-	NetCopyIP((void *)&ip->ip_dst, &dest);
+	net_copy_ip((void *)&ip->ip_dst, &dest);
 }
 
-void net_set_udp_header(uchar *pkt, IPaddr_t dest, int dport, int sport,
+void net_set_udp_header(uchar *pkt, struct in_addr dest, int dport, int sport,
 			int len)
 {
 	struct ip_udp_hdr *ip = (struct ip_udp_hdr *)pkt;
@@ -1407,7 +1408,7 @@ void net_set_udp_header(uchar *pkt, IPaddr_t dest, int dport, int sport,
 	if (len & 1)
 		pkt[IP_UDP_HDR_SIZE + len] = 0;
 
-	net_set_ip_header(pkt, dest, NetOurIP);
+	net_set_ip_header(pkt, dest, net_ip);
 	ip->ip_len   = htons(IP_UDP_HDR_SIZE + len);
 	ip->ip_p     = IPPROTO_UDP;
 	ip->ip_sum   = compute_ip_checksum(ip, IP_HDR_SIZE);
@@ -1444,13 +1445,14 @@ unsigned int random_port(void)
 }
 #endif
 
-void ip_to_string(IPaddr_t x, char *s)
+void ip_to_string(struct in_addr x, char *s)
 {
-	x = ntohl(x);
+	x.s_addr = ntohl(x.s_addr);
 	sprintf(s, "%d.%d.%d.%d",
-		(int) ((x >> 24) & 0xff),
-		(int) ((x >> 16) & 0xff),
-		(int) ((x >> 8) & 0xff), (int) ((x >> 0) & 0xff)
+		(int) ((x.s_addr >> 24) & 0xff),
+		(int) ((x.s_addr >> 16) & 0xff),
+		(int) ((x.s_addr >> 8) & 0xff),
+		(int) ((x.s_addr >> 0) & 0xff)
 	);
 }
 
diff --git a/net/nfs.c b/net/nfs.c
index 8e05ae5..34e5051 100644
--- a/net/nfs.c
+++ b/net/nfs.c
@@ -51,7 +51,7 @@ static char dirfh[NFS_FHSIZE];	/* file handle of directory */
 static char filefh[NFS_FHSIZE]; /* file handle of kernel image */
 
 static enum net_loop_state nfs_download_state;
-static IPaddr_t NfsServerIP;
+static struct in_addr nfs_server_ip;
 static int	NfsSrvMountPort;
 static int	NfsSrvNfsPort;
 static int	NfsOurPort;
@@ -211,8 +211,8 @@ rpc_req(int rpc_prog, int rpc_proc, uint32_t *data, int datalen)
 	else
 		sport = NfsSrvNfsPort;
 
-	NetSendUDPPacket(NetServerEther, NfsServerIP, sport, NfsOurPort,
-		pktlen);
+	NetSendUDPPacket(NetServerEther, nfs_server_ip, sport, NfsOurPort,
+			 pktlen);
 }
 
 /**************************************************************************
@@ -600,8 +600,8 @@ NfsTimeout(void)
 	}
 }
 
-static void
-NfsHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src, unsigned len)
+static void nfs_handler(uchar *pkt, unsigned dest, struct in_addr sip,
+			unsigned src, unsigned len)
 {
 	int rlen;
 	int reply;
@@ -715,7 +715,7 @@ NfsStart(void)
 	debug("%s\n", __func__);
 	nfs_download_state = NETLOOP_FAIL;
 
-	NfsServerIP = NetServerIP;
+	nfs_server_ip = net_server_ip;
 	nfs_path = (char *)nfs_path_buff;
 
 	if (nfs_path == NULL) {
@@ -726,10 +726,10 @@ NfsStart(void)
 
 	if (BootFile[0] == '\0') {
 		sprintf(default_filename, "/nfsroot/%02X%02X%02X%02X.img",
-			NetOurIP & 0xFF,
-			(NetOurIP >>  8) & 0xFF,
-			(NetOurIP >> 16) & 0xFF,
-			(NetOurIP >> 24) & 0xFF);
+			net_ip.s_addr & 0xFF,
+			(net_ip.s_addr >>  8) & 0xFF,
+			(net_ip.s_addr >> 16) & 0xFF,
+			(net_ip.s_addr >> 24) & 0xFF);
 		strcpy(nfs_path, default_filename);
 
 		printf("*** Warning: no boot file name; using '%s'\n",
@@ -740,7 +740,7 @@ NfsStart(void)
 		p = strchr(p, ':');
 
 		if (p != NULL) {
-			NfsServerIP = string_to_ip(BootFile);
+			nfs_server_ip = string_to_ip(BootFile);
 			++p;
 			strcpy(nfs_path, p);
 		} else {
@@ -753,17 +753,19 @@ NfsStart(void)
 
 	printf("Using %s device\n", eth_get_name());
 
-	printf("File transfer via NFS from server %pI4"
-		"; our IP address is %pI4", &NfsServerIP, &NetOurIP);
+	printf("File transfer via NFS from server %pI4; our IP address is %pI4",
+	       &nfs_server_ip, &net_ip);
 
 	/* Check if we need to send across this subnet */
-	if (NetOurGatewayIP && NetOurSubnetMask) {
-		IPaddr_t OurNet	    = NetOurIP	  & NetOurSubnetMask;
-		IPaddr_t ServerNet  = NetServerIP & NetOurSubnetMask;
+	if (net_gateway.s_addr && net_netmask.s_addr) {
+		struct in_addr our_net;
+		struct in_addr server_net;
 
-		if (OurNet != ServerNet)
+		our_net.s_addr = net_ip.s_addr & net_netmask.s_addr;
+		server_net.s_addr = net_server_ip.s_addr & net_netmask.s_addr;
+		if (our_net.s_addr != server_net.s_addr)
 			printf("; sending through gateway %pI4",
-				&NetOurGatewayIP);
+				&net_gateway);
 	}
 	printf("\nFilename '%s/%s'.", nfs_path, nfs_filename);
 
@@ -775,7 +777,7 @@ NfsStart(void)
 		"Loading: *\b", load_addr);
 
 	NetSetTimeout(nfs_timeout, NfsTimeout);
-	net_set_udp_handler(NfsHandler);
+	net_set_udp_handler(nfs_handler);
 
 	NfsTimeoutCount = 0;
 	NfsState = STATE_PRCLOOKUP_PROG_MOUNT_REQ;
diff --git a/net/ping.c b/net/ping.c
index 366f518..4918a1c 100644
--- a/net/ping.c
+++ b/net/ping.c
@@ -15,9 +15,9 @@
 static ushort PingSeqNo;
 
 /* The ip address to ping */
-IPaddr_t NetPingIP;
+struct in_addr net_ping_ip;
 
-static void set_icmp_header(uchar *pkt, IPaddr_t dest)
+static void set_icmp_header(uchar *pkt, struct in_addr dest)
 {
 	/*
 	 *	Construct an IP and ICMP header.
@@ -25,7 +25,7 @@ static void set_icmp_header(uchar *pkt, IPaddr_t dest)
 	struct ip_hdr *ip = (struct ip_hdr *)pkt;
 	struct icmp_hdr *icmp = (struct icmp_hdr *)(pkt + IP_HDR_SIZE);
 
-	net_set_ip_header(pkt, dest, NetOurIP);
+	net_set_ip_header(pkt, dest, net_ip);
 
 	ip->ip_len   = htons(IP_ICMP_HDR_SIZE);
 	ip->ip_p     = IPPROTO_ICMP;
@@ -46,14 +46,14 @@ static int ping_send(void)
 
 	/* XXX always send arp request */
 
-	debug_cond(DEBUG_DEV_PKT, "sending ARP for %pI4\n", &NetPingIP);
+	debug_cond(DEBUG_DEV_PKT, "sending ARP for %pI4\n", &net_ping_ip);
 
-	NetArpWaitPacketIP = NetPingIP;
+	net_arp_wait_packet_ip = net_ping_ip;
 
 	eth_hdr_size = NetSetEther(NetTxPacket, NetEtherNullAddr, PROT_IP);
 	pkt = (uchar *)NetTxPacket + eth_hdr_size;
 
-	set_icmp_header(pkt, NetPingIP);
+	set_icmp_header(pkt, net_ping_ip);
 
 	/* size of the waiting packet */
 	NetArpWaitTxPacketSize = eth_hdr_size + IP_ICMP_HDR_SIZE;
@@ -82,13 +82,13 @@ void ping_start(void)
 void ping_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
 {
 	struct icmp_hdr *icmph = (struct icmp_hdr *)&ip->udp_src;
-	IPaddr_t src_ip;
+	struct in_addr src_ip;
 	int eth_hdr_size;
 
 	switch (icmph->type) {
 	case ICMP_ECHO_REPLY:
-		src_ip = NetReadIP((void *)&ip->ip_src);
-		if (src_ip == NetPingIP)
+		src_ip = net_read_ip((void *)&ip->ip_src);
+		if (src_ip.s_addr == net_ping_ip.s_addr)
 			net_set_state(NETLOOP_SUCCESS);
 		return;
 	case ICMP_ECHO_REQUEST:
@@ -99,8 +99,8 @@ void ping_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
 
 		ip->ip_sum = 0;
 		ip->ip_off = 0;
-		NetCopyIP((void *)&ip->ip_dst, &ip->ip_src);
-		NetCopyIP((void *)&ip->ip_src, &NetOurIP);
+		net_copy_ip((void *)&ip->ip_dst, &ip->ip_src);
+		net_copy_ip((void *)&ip->ip_src, &net_ip);
 		ip->ip_sum = compute_ip_checksum(ip, IP_HDR_SIZE);
 
 		icmph->type = ICMP_ECHO_REPLY;
diff --git a/net/rarp.c b/net/rarp.c
index a8e0851..3e1c74c 100644
--- a/net/rarp.c
+++ b/net/rarp.c
@@ -43,9 +43,9 @@ void rarp_receive(struct ip_udp_hdr *ip, unsigned len)
 
 		puts("invalid RARP header\n");
 	} else {
-		NetCopyIP(&NetOurIP, &arp->ar_data[16]);
-		if (NetServerIP == 0)
-			NetCopyIP(&NetServerIP, &arp->ar_data[6]);
+		net_copy_ip(&net_ip, &arp->ar_data[16]);
+		if (net_server_ip.s_addr == 0)
+			net_copy_ip(&net_server_ip, &arp->ar_data[6]);
 		memcpy(NetServerEther, &arp->ar_data[0], 6);
 		debug_cond(DEBUG_DEV_PKT, "Got good RARP\n");
 		net_auto_load();
@@ -88,7 +88,7 @@ void RarpRequest(void)
 	rarp->ar_pln = 4;
 	rarp->ar_op  = htons(RARPOP_REQUEST);
 	memcpy(&rarp->ar_data[0],  NetOurEther, 6);	/* source ET addr */
-	memcpy(&rarp->ar_data[6],  &NetOurIP,   4);	/* source IP addr */
+	memcpy(&rarp->ar_data[6],  &net_ip,   4);	/* source IP addr */
 	/* dest ET addr = source ET addr ??*/
 	memcpy(&rarp->ar_data[10], NetOurEther, 6);
 	/* dest IP addr set to broadcast */
diff --git a/net/sntp.c b/net/sntp.c
index 5de1952..3e45a83 100644
--- a/net/sntp.c
+++ b/net/sntp.c
@@ -37,8 +37,8 @@ SntpSend(void)
 	SntpOurPort = 10000 + (get_timer(0) % 4096);
 	sport = NTP_SERVICE_PORT;
 
-	NetSendUDPPacket(NetServerEther, NetNtpServerIP, sport, SntpOurPort,
-		pktlen);
+	NetSendUDPPacket(NetServerEther, net_ntp_server, sport, SntpOurPort,
+			 pktlen);
 }
 
 static void
@@ -49,9 +49,8 @@ SntpTimeout(void)
 	return;
 }
 
-static void
-SntpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
-	    unsigned len)
+static void sntp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
+			 unsigned src, unsigned len)
 {
 	struct sntp_pkt_t *rpktp = (struct sntp_pkt_t *)pkt;
 	struct rtc_time tm;
@@ -85,7 +84,7 @@ SntpStart(void)
 	debug("%s\n", __func__);
 
 	NetSetTimeout(SNTP_TIMEOUT, SntpTimeout);
-	net_set_udp_handler(SntpHandler);
+	net_set_udp_handler(sntp_handler);
 	memset(NetServerEther, 0, sizeof(NetServerEther));
 
 	SntpSend();
diff --git a/net/tftp.c b/net/tftp.c
index 51c67be..4c985fa 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -65,7 +65,7 @@ enum {
 	TFTP_ERR_FILE_ALREADY_EXISTS = 6,
 };
 
-static IPaddr_t TftpRemoteIP;
+static struct in_addr tftp_remote_ip;
 /* The UDP port at their end */
 static int	TftpRemotePort;
 /* The UDP port at our end */
@@ -146,12 +146,14 @@ static void parse_multicast_oack(char *pkt, int len);
 static void
 mcast_cleanup(void)
 {
-	if (Mcast_addr)
-		eth_mcast_join(Mcast_addr, 0);
+	if (net_mcast_addr)
+		eth_mcast_join(net_mcast_addr, 0);
 	if (Bitmap)
 		free(Bitmap);
 	Bitmap = NULL;
-	Mcast_addr = Multicast = Mcast_port = 0;
+	net_mcast_addr.s_addr = 0;
+	Multicast = 0;
+	Mcast_port = 0;
 	TftpEndingBlock = -1;
 }
 
@@ -433,13 +435,14 @@ TftpSend(void)
 		break;
 	}
 
-	NetSendUDPPacket(NetServerEther, TftpRemoteIP, TftpRemotePort,
+	NetSendUDPPacket(NetServerEther, tftp_remote_ip, TftpRemotePort,
 			 TftpOurPort, len);
 }
 
 #ifdef CONFIG_CMD_TFTPPUT
 static void icmp_handler(unsigned type, unsigned code, unsigned dest,
-			 IPaddr_t sip, unsigned src, uchar *pkt, unsigned len)
+			 struct in_addr sip, unsigned src, uchar *pkt,
+			 unsigned len)
 {
 	if (type == ICMP_NOT_REACH && code == ICMP_NOT_REACH_PORT) {
 		/* Oh dear the other end has gone away */
@@ -448,9 +451,8 @@ static void icmp_handler(unsigned type, unsigned code, unsigned dest,
 }
 #endif
 
-static void
-TftpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
-	    unsigned len)
+static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
+			 unsigned src, unsigned len)
 {
 	__be16 proto;
 	__be16 *s;
@@ -507,7 +509,7 @@ TftpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
 #ifdef CONFIG_CMD_TFTPSRV
 	case TFTP_WRQ:
 		debug("Got WRQ\n");
-		TftpRemoteIP = sip;
+		tftp_remote_ip = sip;
 		TftpRemotePort = src;
 		TftpOurPort = 1024 + (get_timer(0) % 3072);
 		new_transfer();
@@ -717,13 +719,13 @@ void TftpStart(enum proto_t protocol)
 	debug("TFTP blocksize = %i, timeout = %ld ms\n",
 		TftpBlkSizeOption, TftpTimeoutMSecs);
 
-	TftpRemoteIP = NetServerIP;
+	tftp_remote_ip = net_server_ip;
 	if (BootFile[0] == '\0') {
 		sprintf(default_filename, "%02X%02X%02X%02X.img",
-			NetOurIP & 0xFF,
-			(NetOurIP >>  8) & 0xFF,
-			(NetOurIP >> 16) & 0xFF,
-			(NetOurIP >> 24) & 0xFF);
+			net_ip.s_addr & 0xFF,
+			(net_ip.s_addr >>  8) & 0xFF,
+			(net_ip.s_addr >> 16) & 0xFF,
+			(net_ip.s_addr >> 24) & 0xFF);
 
 		strncpy(tftp_filename, default_filename, MAX_LEN);
 		tftp_filename[MAX_LEN-1] = 0;
@@ -737,7 +739,7 @@ void TftpStart(enum proto_t protocol)
 			strncpy(tftp_filename, BootFile, MAX_LEN);
 			tftp_filename[MAX_LEN-1] = 0;
 		} else {
-			TftpRemoteIP = string_to_ip(BootFile);
+			tftp_remote_ip = string_to_ip(BootFile);
 			strncpy(tftp_filename, p + 1, MAX_LEN);
 			tftp_filename[MAX_LEN-1] = 0;
 		}
@@ -750,16 +752,17 @@ void TftpStart(enum proto_t protocol)
 #else
 		"from",
 #endif
-		&TftpRemoteIP, &NetOurIP);
+		&tftp_remote_ip, &net_ip);
 
 	/* Check if we need to send across this subnet */
-	if (NetOurGatewayIP && NetOurSubnetMask) {
-		IPaddr_t OurNet	= NetOurIP    & NetOurSubnetMask;
-		IPaddr_t RemoteNet	= TftpRemoteIP & NetOurSubnetMask;
-
-		if (OurNet != RemoteNet)
-			printf("; sending through gateway %pI4",
-			       &NetOurGatewayIP);
+	if (net_gateway.s_addr && net_netmask.s_addr) {
+		struct in_addr our_net;
+		struct in_addr remote_net;
+
+		our_net.s_addr = net_ip.s_addr & net_netmask.s_addr;
+		remote_net.s_addr = tftp_remote_ip.s_addr & net_netmask.s_addr;
+		if (our_net.s_addr != remote_net.s_addr)
+			printf("; sending through gateway %pI4", &net_gateway);
 	}
 	putc('\n');
 
@@ -792,7 +795,7 @@ void TftpStart(enum proto_t protocol)
 	TftpTimeoutCountMax = TftpRRQTimeoutCountMax;
 
 	NetSetTimeout(TftpTimeoutMSecs, TftpTimeout);
-	net_set_udp_handler(TftpHandler);
+	net_set_udp_handler(tftp_handler);
 #ifdef CONFIG_CMD_TFTPPUT
 	net_set_icmp_handler(icmp_handler);
 #endif
@@ -833,7 +836,7 @@ TftpStartServer(void)
 	tftp_filename[0] = 0;
 
 	printf("Using %s device\n", eth_get_name());
-	printf("Listening for TFTP transfer on %pI4\n", &NetOurIP);
+	printf("Listening for TFTP transfer on %pI4\n", &net_ip);
 	printf("Load address: 0x%lx\n", load_addr);
 
 	puts("Loading: *\b");
@@ -854,7 +857,7 @@ TftpStartServer(void)
 #endif
 
 	TftpState = STATE_RECV_WRQ;
-	net_set_udp_handler(TftpHandler);
+	net_set_udp_handler(tftp_handler);
 
 	/* zero out server ether in case the server ip has changed */
 	memset(NetServerEther, 0, 6);
@@ -880,7 +883,7 @@ TftpStartServer(void)
 static void parse_multicast_oack(char *pkt, int len)
 {
 	int i;
-	IPaddr_t addr;
+	struct in_addr addr;
 	char *mc_adr, *port,  *mc;
 
 	mc_adr = port = mc = NULL;
@@ -935,11 +938,11 @@ static void parse_multicast_oack(char *pkt, int len)
 		Multicast = 1;
 	}
 	addr = string_to_ip(mc_adr);
-	if (Mcast_addr != addr) {
-		if (Mcast_addr)
-			eth_mcast_join(Mcast_addr, 0);
-		Mcast_addr = addr;
-		if (eth_mcast_join(Mcast_addr, 1)) {
+	if (net_mcast_addr.s_addr != addr.s_addr) {
+		if (net_mcast_addr.s_addr)
+			eth_mcast_join(net_mcast_addr, 0);
+		net_mcast_addr = addr;
+		if (eth_mcast_join(net_mcast_addr, 1)) {
 			printf("Fail to set mcast, revert to TFTP\n");
 			ProhibitMcast = 1;
 			mcast_cleanup();
diff --git a/test/dm/eth.c b/test/dm/eth.c
index 1923670..22fd26e 100644
--- a/test/dm/eth.c
+++ b/test/dm/eth.c
@@ -20,7 +20,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 static int dm_test_eth(struct dm_test_state *dms)
 {
-	NetPingIP = string_to_ip("1.1.2.2");
+	net_ping_ip = string_to_ip("1.1.2.2");
 
 	setenv("ethact", "eth at 10002000");
 	ut_assertok(NetLoop(PING));
@@ -40,7 +40,7 @@ DM_TEST(dm_test_eth, DM_TESTF_SCAN_FDT);
 
 static int dm_test_eth_alias(struct dm_test_state *dms)
 {
-	NetPingIP = string_to_ip("1.1.2.2");
+	net_ping_ip = string_to_ip("1.1.2.2");
 	setenv("ethact", "eth0");
 	ut_assertok(NetLoop(PING));
 	ut_asserteq_str("eth at 10002000", getenv("ethact"));
@@ -64,7 +64,7 @@ DM_TEST(dm_test_eth_alias, DM_TESTF_SCAN_FDT);
 
 static int dm_test_eth_prime(struct dm_test_state *dms)
 {
-	NetPingIP = string_to_ip("1.1.2.2");
+	net_ping_ip = string_to_ip("1.1.2.2");
 
 	/* Expected to be "eth at 10003000" because of ethprime variable */
 	setenv("ethact", NULL);
@@ -87,7 +87,7 @@ static int dm_test_eth_rotate(struct dm_test_state *dms)
 	char ethaddr[18];
 
 	/* Invalidate eth1's MAC address */
-	NetPingIP = string_to_ip("1.1.2.2");
+	net_ping_ip = string_to_ip("1.1.2.2");
 	strcpy(ethaddr, getenv("eth1addr"));
 	setenv("eth1addr", NULL);
 
@@ -126,7 +126,7 @@ DM_TEST(dm_test_eth_rotate, DM_TESTF_SCAN_FDT);
 
 static int dm_test_net_retry(struct dm_test_state *dms)
 {
-	NetPingIP = string_to_ip("1.1.2.2");
+	net_ping_ip = string_to_ip("1.1.2.2");
 
 	/*
 	 * eth1 is disabled and netretry is yes, so the ping should succeed and
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 02/25] net: cosmetic: Fixup var names related to boot file
  2015-04-08  6:41 ` [U-Boot] [PATCH v2 0/25] " Joe Hershberger
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 01/25] net: cosmetic: Change IPaddr_t to struct in_addr Joe Hershberger
@ 2015-04-08  6:41   ` Joe Hershberger
  2015-04-08 12:45     ` Simon Glass
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 03/25] net: cosmetic: Fixup var names for DHCP strings Joe Hershberger
                     ` (23 subsequent siblings)
  25 siblings, 1 reply; 103+ messages in thread
From: Joe Hershberger @ 2015-04-08  6:41 UTC (permalink / raw)
  To: u-boot

The variables around the bootfile were inconsistent and used CamelCase.
Update them to make the code more readable.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

Changes in v2: None

 common/cmd_net.c |  9 ++++++---
 common/cmd_pxe.c |  2 +-
 common/update.c  |  7 ++++---
 include/net.h    |  9 +++++----
 net/bootp.c      | 27 ++++++++++++++-------------
 net/bootp.h      |  1 -
 net/eth.c        |  3 ++-
 net/net.c        | 26 +++++++++++++-------------
 net/nfs.c        | 19 ++++++++++---------
 net/tftp.c       | 29 +++++++++++++++--------------
 10 files changed, 70 insertions(+), 62 deletions(-)

diff --git a/common/cmd_net.c b/common/cmd_net.c
index 53760a2..d75718c 100644
--- a/common/cmd_net.c
+++ b/common/cmd_net.c
@@ -201,11 +201,13 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc,
 		if (end == (argv[1] + strlen(argv[1])))
 			load_addr = addr;
 		else
-			copy_filename(BootFile, argv[1], sizeof(BootFile));
+			copy_filename(net_boot_file_name, argv[1],
+				      sizeof(net_boot_file_name));
 		break;
 
 	case 3:	load_addr = simple_strtoul(argv[1], NULL, 16);
-		copy_filename(BootFile, argv[2], sizeof(BootFile));
+		copy_filename(net_boot_file_name, argv[2],
+			      sizeof(net_boot_file_name));
 
 		break;
 
@@ -216,7 +218,8 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc,
 			printf("Invalid address/size\n");
 			return CMD_RET_USAGE;
 		}
-		copy_filename(BootFile, argv[3], sizeof(BootFile));
+		copy_filename(net_boot_file_name, argv[3],
+			      sizeof(net_boot_file_name));
 		break;
 #endif
 	default:
diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c
index 9eac5c6..5cde5b6 100644
--- a/common/cmd_pxe.c
+++ b/common/cmd_pxe.c
@@ -1568,7 +1568,7 @@ do_pxe_boot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 	destroy_pxe_menu(cfg);
 
-	copy_filename(BootFile, "", sizeof(BootFile));
+	copy_filename(net_boot_file_name, "", sizeof(net_boot_file_name));
 
 	return 0;
 }
diff --git a/common/update.c b/common/update.c
index cc830a7..bc0c48f 100644
--- a/common/update.c
+++ b/common/update.c
@@ -58,7 +58,7 @@ static int update_load(char *filename, ulong msec_max, int cnt_max, ulong addr)
 	saved_timeout_msecs = TftpRRQTimeoutMSecs;
 	saved_timeout_count = TftpRRQTimeoutCountMax;
 	saved_netretry = strdup(getenv("netretry"));
-	saved_bootfile = strdup(BootFile);
+	saved_bootfile = strdup(net_boot_file_name);
 
 	/* set timeouts for auto-update */
 	TftpRRQTimeoutMSecs = msec_max;
@@ -69,7 +69,7 @@ static int update_load(char *filename, ulong msec_max, int cnt_max, ulong addr)
 
 	/* download the update file */
 	load_addr = addr;
-	copy_filename(BootFile, filename, sizeof(BootFile));
+	copy_filename(net_boot_file_name, filename, sizeof(net_boot_file_name));
 	size = NetLoop(TFTPGET);
 
 	if (size < 0)
@@ -86,7 +86,8 @@ static int update_load(char *filename, ulong msec_max, int cnt_max, ulong addr)
 		free(saved_netretry);
 
 	if (saved_bootfile != NULL) {
-		copy_filename(BootFile, saved_bootfile, sizeof(BootFile));
+		copy_filename(net_boot_file_name, saved_bootfile,
+			      sizeof(net_boot_file_name));
 		free(saved_bootfile);
 	}
 
diff --git a/include/net.h b/include/net.h
index 2699c44..b484d4c 100644
--- a/include/net.h
+++ b/include/net.h
@@ -470,9 +470,7 @@ extern struct in_addr net_dns_server2;
 extern char	NetOurNISDomain[32];	/* Our NIS domain */
 extern char	NetOurHostName[32];	/* Our hostname */
 extern char	NetOurRootPath[64];	/* Our root path */
-extern ushort	NetBootFileSize;	/* Our boot file size in blocks */
 /** END OF BOOTP EXTENTIONS **/
-extern ulong		NetBootFileXferSize;	/* size of bootfile in bytes */
 extern uchar		NetOurEther[6];		/* Our ethernet address */
 extern uchar		NetServerEther[6];	/* Boot server enet address */
 extern struct in_addr	net_ip;		/* Our    IP addr (0 = unknown) */
@@ -501,8 +499,11 @@ enum proto_t {
 	TFTPSRV, TFTPPUT, LINKLOCAL
 };
 
-/* from net/net.c */
-extern char	BootFile[128];			/* Boot File name */
+extern char	net_boot_file_name[128];/* Boot File name */
+/* The actual transferred size of the bootfile (in bytes) */
+extern u32	net_boot_file_size;
+/* Boot file size in blocks as reported by the DHCP server */
+extern u32	net_boot_file_expected_size_in_blocks;
 
 #if defined(CONFIG_CMD_DNS)
 extern char *NetDNSResolve;		/* The host to resolve  */
diff --git a/net/bootp.c b/net/bootp.c
index a56ed4c..0148c19 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -146,16 +146,17 @@ static void BootpCopyNetParams(struct Bootp_t *bp)
 		net_copy_ip(&net_server_ip, &bp->bp_siaddr);
 	memcpy(NetServerEther, ((struct ethernet_hdr *)NetRxPacket)->et_src, 6);
 	if (strlen(bp->bp_file) > 0)
-		copy_filename(BootFile, bp->bp_file, sizeof(BootFile));
+		copy_filename(net_boot_file_name, bp->bp_file,
+			      sizeof(net_boot_file_name));
 
-	debug("Bootfile: %s\n", BootFile);
+	debug("net_boot_file_name: %s\n", net_boot_file_name);
 
 	/* Propagate to environment:
 	 * don't delete exising entry when BOOTP / DHCP reply does
 	 * not contain a new value
 	 */
-	if (*BootFile)
-		setenv("bootfile", BootFile);
+	if (*net_boot_file_name)
+		setenv("bootfile", net_boot_file_name);
 #endif
 	net_copy_ip(&net_ip, &bp->bp_yiaddr);
 }
@@ -179,7 +180,7 @@ static void BootpVendorFieldProcess(u8 *ext)
 	debug("[BOOTP] Processing extension %d... (%d bytes)\n", *ext,
 		*(ext + 1));
 
-	NetBootFileSize = 0;
+	net_boot_file_expected_size_in_blocks = 0;
 
 	switch (*ext) {
 		/* Fixed length fields */
@@ -228,9 +229,11 @@ static void BootpVendorFieldProcess(u8 *ext)
 		break;
 	case 13:		/* Boot file size */
 		if (size == 2)
-			NetBootFileSize = ntohs(*(ushort *) (ext + 2));
+			net_boot_file_expected_size_in_blocks =
+				ntohs(*(ushort *)(ext + 2));
 		else if (size == 4)
-			NetBootFileSize = ntohl(*(ulong *) (ext + 2));
+			net_boot_file_expected_size_in_blocks =
+				ntohl(*(ulong *)(ext + 2));
 		break;
 	case 14:		/* Merit dump file - Not yet supported */
 		break;
@@ -303,8 +306,9 @@ static void BootpVendorProcess(u8 *ext, int size)
 	if (net_gateway.s_addr)
 		debug("net_gateway	: %pI4", &net_gateway);
 
-	if (NetBootFileSize)
-		debug("NetBootFileSize : %d\n", NetBootFileSize);
+	if (net_boot_file_expected_size_in_blocks)
+		debug("net_boot_file_expected_size_in_blocks : %d\n",
+		      net_boot_file_expected_size_in_blocks);
 
 	if (NetOurHostName[0])
 		debug("NetOurHostName  : %s\n", NetOurHostName);
@@ -315,9 +319,6 @@ static void BootpVendorProcess(u8 *ext, int size)
 	if (NetOurNISDomain[0])
 		debug("NetOurNISDomain : %s\n", NetOurNISDomain);
 
-	if (NetBootFileSize)
-		debug("NetBootFileSize: %d\n", NetBootFileSize);
-
 #if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_NTPSERVER)
 	if (net_ntp_server)
 		debug("net_ntp_server : %pI4\n", &net_ntp_server);
@@ -716,7 +717,7 @@ BootpRequest(void)
 	net_write_ip(&bp->bp_siaddr, zero_ip);
 	net_write_ip(&bp->bp_giaddr, zero_ip);
 	memcpy(bp->bp_chaddr, NetOurEther, 6);
-	copy_filename(bp->bp_file, BootFile, sizeof(bp->bp_file));
+	copy_filename(bp->bp_file, net_boot_file_name, sizeof(bp->bp_file));
 
 	/* Request additional information from the BOOTP/DHCP server */
 #if defined(CONFIG_CMD_DHCP)
diff --git a/net/bootp.h b/net/bootp.h
index 16f40dc..8c591a6 100644
--- a/net/bootp.h
+++ b/net/bootp.h
@@ -60,7 +60,6 @@ struct Bootp_t {
 
 /* bootp.c */
 extern ulong	BootpID;		/* ID of cur BOOTP request	*/
-extern char	BootFile[128];		/* Boot file name		*/
 extern int	BootpTry;
 
 
diff --git a/net/eth.c b/net/eth.c
index 930470e..cc81eb7 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -66,7 +66,8 @@ static void eth_env_init(void)
 
 	s = getenv("bootfile");
 	if (s != NULL)
-		copy_filename(BootFile, s, sizeof(BootFile));
+		copy_filename(net_boot_file_name, s,
+			      sizeof(net_boot_file_name));
 }
 
 static int eth_mac_skip(int index)
diff --git a/net/net.c b/net/net.c
index b1b822d..f60998b 100644
--- a/net/net.c
+++ b/net/net.c
@@ -127,8 +127,6 @@ char		NetOurNISDomain[32] = {0,};
 char		NetOurHostName[32] = {0,};
 /* Our bootpath */
 char		NetOurRootPath[64] = {0,};
-/* Our bootfile size in blocks */
-ushort		NetBootFileSize;
 
 #ifdef CONFIG_MCAST_TFTP	/* Multicast TFTP */
 struct in_addr net_mcast_addr;
@@ -136,8 +134,6 @@ struct in_addr net_mcast_addr;
 
 /** END OF BOOTP EXTENTIONS **/
 
-/* The actual transferred size of the bootfile (in bytes) */
-ulong		NetBootFileXferSize;
 /* Our ethernet address */
 uchar		NetOurEther[6];
 /* Boot server enet address */
@@ -174,7 +170,11 @@ ushort		NetOurVLAN = 0xFFFF;
 ushort		NetOurNativeVLAN = 0xFFFF;
 
 /* Boot File name */
-char		BootFile[128];
+char net_boot_file_name[128];
+/* The actual transferred size of the bootfile (in bytes) */
+u32 net_boot_file_size;
+/* Boot file size in blocks as reported by the DHCP server */
+u32 net_boot_file_expected_size_in_blocks;
 
 #if defined(CONFIG_CMD_SNTP)
 /* NTP server IP address */
@@ -222,7 +222,8 @@ static int on_bootfile(const char *name, const char *value, enum env_op op,
 	switch (op) {
 	case env_op_create:
 	case env_op_overwrite:
-		copy_filename(BootFile, value, sizeof(BootFile));
+		copy_filename(net_boot_file_name, value,
+			      sizeof(net_boot_file_name));
 		break;
 	default:
 		break;
@@ -380,7 +381,7 @@ restart:
 
 	case 0:
 		NetDevExists = 1;
-		NetBootFileXferSize = 0;
+		net_boot_file_size = 0;
 		switch (protocol) {
 		case TFTPGET:
 #ifdef CONFIG_CMD_TFTPPUT
@@ -551,11 +552,10 @@ restart:
 
 		case NETLOOP_SUCCESS:
 			net_cleanup_loop();
-			if (NetBootFileXferSize > 0) {
-				printf("Bytes transferred = %ld (%lx hex)\n",
-					NetBootFileXferSize,
-					NetBootFileXferSize);
-				setenv_hex("filesize", NetBootFileXferSize);
+			if (net_boot_file_size > 0) {
+				printf("Bytes transferred = %d (%x hex)\n",
+				       net_boot_file_size, net_boot_file_size);
+				setenv_hex("filesize", net_boot_file_size);
 				setenv_hex("fileaddr", load_addr);
 			}
 			if (protocol != NETCONS)
@@ -565,7 +565,7 @@ restart:
 
 			eth_set_last_protocol(protocol);
 
-			ret = NetBootFileXferSize;
+			ret = net_boot_file_size;
 			debug_cond(DEBUG_INT_STATE, "--- NetLoop Success!\n");
 			goto done;
 
diff --git a/net/nfs.c b/net/nfs.c
index 34e5051..1e5c1c3 100644
--- a/net/nfs.c
+++ b/net/nfs.c
@@ -100,8 +100,8 @@ store_block(uchar *src, unsigned offset, unsigned len)
 		unmap_sysmem(ptr);
 	}
 
-	if (NetBootFileXferSize < (offset+len))
-		NetBootFileXferSize = newsize;
+	if (net_boot_file_size < (offset + len))
+		net_boot_file_size = newsize;
 	return 0;
 }
 
@@ -724,7 +724,7 @@ NfsStart(void)
 		return;
 	}
 
-	if (BootFile[0] == '\0') {
+	if (net_boot_file_name[0] == '\0') {
 		sprintf(default_filename, "/nfsroot/%02X%02X%02X%02X.img",
 			net_ip.s_addr & 0xFF,
 			(net_ip.s_addr >>  8) & 0xFF,
@@ -735,16 +735,16 @@ NfsStart(void)
 		printf("*** Warning: no boot file name; using '%s'\n",
 			nfs_path);
 	} else {
-		char *p = BootFile;
+		char *p = net_boot_file_name;
 
 		p = strchr(p, ':');
 
 		if (p != NULL) {
-			nfs_server_ip = string_to_ip(BootFile);
+			nfs_server_ip = string_to_ip(net_boot_file_name);
 			++p;
 			strcpy(nfs_path, p);
 		} else {
-			strcpy(nfs_path, BootFile);
+			strcpy(nfs_path, net_boot_file_name);
 		}
 	}
 
@@ -769,9 +769,10 @@ NfsStart(void)
 	}
 	printf("\nFilename '%s/%s'.", nfs_path, nfs_filename);
 
-	if (NetBootFileSize) {
-		printf(" Size is 0x%x Bytes = ", NetBootFileSize<<9);
-		print_size(NetBootFileSize<<9, "");
+	if (net_boot_file_expected_size_in_blocks) {
+		printf(" Size is 0x%x Bytes = ",
+		       net_boot_file_expected_size_in_blocks << 9);
+		print_size(net_boot_file_expected_size_in_blocks << 9, "");
 	}
 	printf("\nLoad address: 0x%lx\n"
 		"Loading: *\b", load_addr);
diff --git a/net/tftp.c b/net/tftp.c
index 4c985fa..bafc354 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -197,8 +197,8 @@ store_block(int block, uchar *src, unsigned len)
 		ext2_set_bit(block, Bitmap);
 #endif
 
-	if (NetBootFileXferSize < newsize)
-		NetBootFileXferSize = newsize;
+	if (net_boot_file_size < newsize)
+		net_boot_file_size = newsize;
 }
 
 /* Clear our state ready for a new transfer */
@@ -227,7 +227,7 @@ static int load_block(unsigned block, uchar *dst, unsigned len)
 	ulong offset = ((int)block - 1) * len + TftpBlockWrapOffset;
 	ulong tosend = len;
 
-	tosend = min(NetBootFileXferSize - offset, tosend);
+	tosend = min(net_boot_file_size - offset, tosend);
 	(void)memcpy(dst, (void *)(save_addr + offset), tosend);
 	debug("%s: block=%d, offset=%ld, len=%d, tosend=%ld\n", __func__,
 		block, offset, len, tosend);
@@ -311,7 +311,7 @@ static void tftp_complete(void)
 	time_start = get_timer(time_start);
 	if (time_start > 0) {
 		puts("\n\t ");	/* Line up with "Loading: " */
-		print_size(NetBootFileXferSize /
+		print_size(net_boot_file_size /
 			time_start * 1000, "/s");
 	}
 	puts("\ndone\n");
@@ -361,8 +361,8 @@ TftpSend(void)
 		debug("send option \"timeout %s\"\n", (char *)pkt);
 		pkt += strlen((char *)pkt) + 1;
 #ifdef CONFIG_TFTP_TSIZE
-		pkt += sprintf((char *)pkt, "tsize%c%lu%c",
-				0, NetBootFileXferSize, 0);
+		pkt += sprintf((char *)pkt, "tsize%c%u%c",
+				0, net_boot_file_size, 0);
 #endif
 		/* try for more effic. blk size */
 		pkt += sprintf((char *)pkt, "blksize%c%d%c",
@@ -720,7 +720,7 @@ void TftpStart(enum proto_t protocol)
 		TftpBlkSizeOption, TftpTimeoutMSecs);
 
 	tftp_remote_ip = net_server_ip;
-	if (BootFile[0] == '\0') {
+	if (net_boot_file_name[0] == '\0') {
 		sprintf(default_filename, "%02X%02X%02X%02X.img",
 			net_ip.s_addr & 0xFF,
 			(net_ip.s_addr >>  8) & 0xFF,
@@ -733,13 +733,13 @@ void TftpStart(enum proto_t protocol)
 		printf("*** Warning: no boot file name; using '%s'\n",
 			tftp_filename);
 	} else {
-		char *p = strchr(BootFile, ':');
+		char *p = strchr(net_boot_file_name, ':');
 
 		if (p == NULL) {
-			strncpy(tftp_filename, BootFile, MAX_LEN);
+			strncpy(tftp_filename, net_boot_file_name, MAX_LEN);
 			tftp_filename[MAX_LEN-1] = 0;
 		} else {
-			tftp_remote_ip = string_to_ip(BootFile);
+			tftp_remote_ip = string_to_ip(net_boot_file_name);
 			strncpy(tftp_filename, p + 1, MAX_LEN);
 			tftp_filename[MAX_LEN-1] = 0;
 		}
@@ -768,9 +768,10 @@ void TftpStart(enum proto_t protocol)
 
 	printf("Filename '%s'.", tftp_filename);
 
-	if (NetBootFileSize) {
-		printf(" Size is 0x%x Bytes = ", NetBootFileSize<<9);
-		print_size(NetBootFileSize<<9, "");
+	if (net_boot_file_expected_size_in_blocks) {
+		printf(" Size is 0x%x Bytes = ",
+		       net_boot_file_expected_size_in_blocks << 9);
+		print_size(net_boot_file_expected_size_in_blocks << 9, "");
 	}
 
 	putc('\n');
@@ -779,7 +780,7 @@ void TftpStart(enum proto_t protocol)
 	if (TftpWriting) {
 		printf("Save address: 0x%lx\n", save_addr);
 		printf("Save size:    0x%lx\n", save_size);
-		NetBootFileXferSize = save_size;
+		net_boot_file_size = save_size;
 		puts("Saving: *\b");
 		TftpState = STATE_SEND_WRQ;
 		new_transfer();
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 03/25] net: cosmetic: Fixup var names for DHCP strings
  2015-04-08  6:41 ` [U-Boot] [PATCH v2 0/25] " Joe Hershberger
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 01/25] net: cosmetic: Change IPaddr_t to struct in_addr Joe Hershberger
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 02/25] net: cosmetic: Fixup var names related to boot file Joe Hershberger
@ 2015-04-08  6:41   ` Joe Hershberger
  2015-04-08 12:45     ` Simon Glass
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 04/25] net: cosmetic: Name ethaddr variables consistently Joe Hershberger
                     ` (22 subsequent siblings)
  25 siblings, 1 reply; 103+ messages in thread
From: Joe Hershberger @ 2015-04-08  6:41 UTC (permalink / raw)
  To: u-boot

Remove CamelCase variable naming.
Move the definition to the same compilation unit as the primary use.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

Changes in v2: None

 common/cmd_net.c | 12 ++++++------
 include/net.h    |  6 +++---
 net/bootp.c      | 51 +++++++++++++++++++++++++++------------------------
 net/net.c        |  6 ------
 4 files changed, 36 insertions(+), 39 deletions(-)

diff --git a/common/cmd_net.c b/common/cmd_net.c
index d75718c..87c4ed1 100644
--- a/common/cmd_net.c
+++ b/common/cmd_net.c
@@ -124,11 +124,11 @@ static void netboot_update_env(void)
 		setenv("netmask", tmp);
 	}
 
-	if (NetOurHostName[0])
-		setenv("hostname", NetOurHostName);
+	if (net_hostname[0])
+		setenv("hostname", net_hostname);
 
-	if (NetOurRootPath[0])
-		setenv("rootpath", NetOurRootPath);
+	if (net_root_path[0])
+		setenv("rootpath", net_root_path);
 
 	if (net_ip.s_addr) {
 		ip_to_string(net_ip, tmp);
@@ -154,8 +154,8 @@ static void netboot_update_env(void)
 		setenv("dnsip2", tmp);
 	}
 #endif
-	if (NetOurNISDomain[0])
-		setenv("domain", NetOurNISDomain);
+	if (net_nis_domain[0])
+		setenv("domain", net_nis_domain);
 
 #if defined(CONFIG_CMD_SNTP) \
     && defined(CONFIG_BOOTP_TIMEOFFSET)
diff --git a/include/net.h b/include/net.h
index b484d4c..2664865 100644
--- a/include/net.h
+++ b/include/net.h
@@ -467,9 +467,9 @@ extern struct in_addr net_dns_server;
 /* Our 2nd Domain Name Server (0 = unknown) */
 extern struct in_addr net_dns_server2;
 #endif
-extern char	NetOurNISDomain[32];	/* Our NIS domain */
-extern char	NetOurHostName[32];	/* Our hostname */
-extern char	NetOurRootPath[64];	/* Our root path */
+extern char	net_nis_domain[32];	/* Our IS domain */
+extern char	net_hostname[32];	/* Our hostname */
+extern char	net_root_path[64];	/* Our root path */
 /** END OF BOOTP EXTENTIONS **/
 extern uchar		NetOurEther[6];		/* Our ethernet address */
 extern uchar		NetServerEther[6];	/* Boot server enet address */
diff --git a/net/bootp.c b/net/bootp.c
index 0148c19..9251e91 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -56,6 +56,9 @@ unsigned int	bootp_num_ids;
 int		BootpTry;
 ulong		bootp_start;
 ulong		bootp_timeout;
+char net_nis_domain[32] = {0,}; /* Our NIS domain */
+char net_hostname[32] = {0,}; /* Our hostname */
+char net_root_path[64] = {0,}; /* Our bootpath */
 
 #if defined(CONFIG_CMD_DHCP)
 static dhcp_state_t dhcp_state = INIT;
@@ -220,11 +223,11 @@ static void BootpVendorFieldProcess(u8 *ext)
 	case 11:		/* RPL server - Not yet supported */
 		break;
 	case 12:		/* Host name */
-		if (NetOurHostName[0] == 0) {
+		if (net_hostname[0] == 0) {
 			size = truncate_sz("Host Name",
-				sizeof(NetOurHostName), size);
-			memcpy(&NetOurHostName, ext + 2, size);
-			NetOurHostName[size] = 0;
+				sizeof(net_hostname), size);
+			memcpy(&net_hostname, ext + 2, size);
+			net_hostname[size] = 0;
 		}
 		break;
 	case 13:		/* Boot file size */
@@ -242,11 +245,11 @@ static void BootpVendorFieldProcess(u8 *ext)
 	case 16:		/* Swap server - Not yet supported */
 		break;
 	case 17:		/* Root path */
-		if (NetOurRootPath[0] == 0) {
+		if (net_root_path[0] == 0) {
 			size = truncate_sz("Root Path",
-				sizeof(NetOurRootPath), size);
-			memcpy(&NetOurRootPath, ext + 2, size);
-			NetOurRootPath[size] = 0;
+				sizeof(net_root_path), size);
+			memcpy(&net_root_path, ext + 2, size);
+			net_root_path[size] = 0;
 		}
 		break;
 	case 18:		/* Extension path - Not yet supported */
@@ -258,11 +261,11 @@ static void BootpVendorFieldProcess(u8 *ext)
 		break;
 		/* IP host layer fields */
 	case 40:		/* NIS Domain name */
-		if (NetOurNISDomain[0] == 0) {
+		if (net_nis_domain[0] == 0) {
 			size = truncate_sz("NIS Domain Name",
-				sizeof(NetOurNISDomain), size);
-			memcpy(&NetOurNISDomain, ext + 2, size);
-			NetOurNISDomain[size] = 0;
+				sizeof(net_nis_domain), size);
+			memcpy(&net_nis_domain, ext + 2, size);
+			net_nis_domain[size] = 0;
 		}
 		break;
 #if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_NTPSERVER)
@@ -310,14 +313,14 @@ static void BootpVendorProcess(u8 *ext, int size)
 		debug("net_boot_file_expected_size_in_blocks : %d\n",
 		      net_boot_file_expected_size_in_blocks);
 
-	if (NetOurHostName[0])
-		debug("NetOurHostName  : %s\n", NetOurHostName);
+	if (net_hostname[0])
+		debug("net_hostname  : %s\n", net_hostname);
 
-	if (NetOurRootPath[0])
-		debug("NetOurRootPath  : %s\n", NetOurRootPath);
+	if (net_root_path[0])
+		debug("net_root_path  : %s\n", net_root_path);
 
-	if (NetOurNISDomain[0])
-		debug("NetOurNISDomain : %s\n", NetOurNISDomain);
+	if (net_nis_domain[0])
+		debug("net_nis_domain : %s\n", net_nis_domain);
 
 #if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_NTPSERVER)
 	if (net_ntp_server)
@@ -793,17 +796,17 @@ static void DhcpOptionsProcess(uchar *popt, struct Bootp_t *bp)
 			break;
 		case 12:
 			size = truncate_sz("Host Name",
-				sizeof(NetOurHostName), oplen);
-			memcpy(&NetOurHostName, popt + 2, size);
-			NetOurHostName[size] = 0;
+				sizeof(net_hostname), oplen);
+			memcpy(&net_hostname, popt + 2, size);
+			net_hostname[size] = 0;
 			break;
 		case 15:	/* Ignore Domain Name Option */
 			break;
 		case 17:
 			size = truncate_sz("Root Path",
-				sizeof(NetOurRootPath), oplen);
-			memcpy(&NetOurRootPath, popt + 2, size);
-			NetOurRootPath[size] = 0;
+				sizeof(net_root_path), oplen);
+			memcpy(&net_root_path, popt + 2, size);
+			net_root_path[size] = 0;
 			break;
 		case 28:	/* Ignore Broadcast Address Option */
 			break;
diff --git a/net/net.c b/net/net.c
index f60998b..bfa326e 100644
--- a/net/net.c
+++ b/net/net.c
@@ -121,12 +121,6 @@ struct in_addr net_dns_server;
 /* Our 2nd DNS IP address */
 struct in_addr net_dns_server2;
 #endif
-/* Our NIS domain */
-char		NetOurNISDomain[32] = {0,};
-/* Our hostname */
-char		NetOurHostName[32] = {0,};
-/* Our bootpath */
-char		NetOurRootPath[64] = {0,};
 
 #ifdef CONFIG_MCAST_TFTP	/* Multicast TFTP */
 struct in_addr net_mcast_addr;
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 04/25] net: cosmetic: Name ethaddr variables consistently
  2015-04-08  6:41 ` [U-Boot] [PATCH v2 0/25] " Joe Hershberger
                     ` (2 preceding siblings ...)
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 03/25] net: cosmetic: Fixup var names for DHCP strings Joe Hershberger
@ 2015-04-08  6:41   ` Joe Hershberger
  2015-04-08 12:46     ` Simon Glass
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 05/25] net: cosmetic: Cleanup internal packet buffer names Joe Hershberger
                     ` (21 subsequent siblings)
  25 siblings, 1 reply; 103+ messages in thread
From: Joe Hershberger @ 2015-04-08  6:41 UTC (permalink / raw)
  To: u-boot

Use "_ethaddr" at the end of variables and drop CamelCase.
Make constant values actually 'const'.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

Changes in v2: None

 arch/arm/mach-davinci/misc.c               |  2 +-
 arch/powerpc/cpu/mpc8260/ether_fcc.c       | 14 +++++------
 arch/powerpc/cpu/mpc8xx/fec.c              |  6 ++---
 board/BuR/common/common.c                  |  4 ++--
 board/ait/cam_enc_4xx/cam_enc_4xx.c        |  2 +-
 board/alphaproject/ap_sh4a_4a/ap_sh4a_4a.c |  2 +-
 board/bct-brettl2/bct-brettl2.c            |  2 +-
 board/bf518f-ezbrd/bf518f-ezbrd.c          |  4 ++--
 board/bf526-ezbrd/bf526-ezbrd.c            |  4 ++--
 board/bf527-ezkit/bf527-ezkit.c            |  4 ++--
 board/bf537-minotaur/bf537-minotaur.c      |  2 +-
 board/bf537-pnav/bf537-pnav.c              |  2 +-
 board/bf537-srv1/bf537-srv1.c              |  2 +-
 board/bf537-stamp/bf537-stamp.c            |  4 ++--
 board/birdland/bav335x/board.c             |  4 ++--
 board/buffalo/lsxl/lsxl.c                  |  2 +-
 board/cm-bf527/cm-bf527.c                  |  4 ++--
 board/cm-bf537e/cm-bf537e.c                |  2 +-
 board/cm-bf537u/cm-bf537u.c                |  2 +-
 board/compulab/cm_fx6/cm_fx6.c             |  2 +-
 board/compulab/cm_t335/cm_t335.c           |  2 +-
 board/compulab/cm_t35/cm_t35.c             |  2 +-
 board/compulab/cm_t3517/cm_t3517.c         |  4 ++--
 board/compulab/cm_t54/cm_t54.c             |  4 ++--
 board/davinci/da8xxevm/da850evm.c          |  6 ++---
 board/dnp5370/dnp5370.c                    |  4 ++--
 board/gumstix/pepper/board.c               |  2 +-
 board/ifm/ac14xx/ac14xx.c                  |  2 +-
 board/ip04/ip04.c                          |  2 +-
 board/isee/igep0033/board.c                |  2 +-
 board/phytec/pcm051/board.c                |  2 +-
 board/renesas/r0p7734/r0p7734.c            |  2 +-
 board/siemens/common/factoryset.c          |  4 ++--
 board/siemens/pxm2/board.c                 |  2 +-
 board/silica/pengwyn/board.c               |  2 +-
 board/tcm-bf518/tcm-bf518.c                |  4 ++--
 board/tcm-bf537/tcm-bf537.c                |  2 +-
 board/ti/am335x/board.c                    |  6 ++---
 board/ti/am43xx/board.c                    |  4 ++--
 board/ti/beagle_x15/board.c                |  4 ++--
 board/ti/dra7xx/evm.c                      |  4 ++--
 board/ti/ti814x/evm.c                      |  2 +-
 doc/README.enetaddr                        |  2 +-
 drivers/net/cpsw.c                         | 13 +++++-----
 drivers/net/dm9000x.c                      |  4 ++--
 drivers/net/e1000.c                        |  2 +-
 drivers/net/fec_mxc.c                      |  2 +-
 drivers/net/ftmac110.c                     |  2 +-
 drivers/net/macb.c                         |  2 +-
 drivers/net/netconsole.c                   |  4 ++--
 drivers/usb/eth/smsc95xx.c                 |  2 +-
 drivers/usb/gadget/ether.c                 |  8 +++----
 include/net.h                              | 38 +++++++++++++++---------------
 net/arp.c                                  |  8 +++----
 net/bootp.c                                | 19 ++++++++-------
 net/cdp.c                                  |  8 +++----
 net/dns.c                                  |  4 ++--
 net/eth.c                                  | 22 ++++++++---------
 net/link_local.c                           | 18 +++++++-------
 net/net.c                                  | 24 +++++++++----------
 net/nfs.c                                  |  4 ++--
 net/ping.c                                 |  2 +-
 net/rarp.c                                 |  8 +++----
 net/sntp.c                                 |  4 ++--
 net/tftp.c                                 |  6 ++---
 65 files changed, 171 insertions(+), 173 deletions(-)

diff --git a/arch/arm/mach-davinci/misc.c b/arch/arm/mach-davinci/misc.c
index e18bdfc..e699d61 100644
--- a/arch/arm/mach-davinci/misc.c
+++ b/arch/arm/mach-davinci/misc.c
@@ -49,7 +49,7 @@ int dvevm_read_mac_address(uint8_t *buf)
 		goto i2cerr;
 
 	/* Check that MAC address is valid. */
-	if (!is_valid_ether_addr(buf))
+	if (!is_valid_ethaddr(buf))
 		goto err;
 
 	return 1; /* Found */
diff --git a/arch/powerpc/cpu/mpc8260/ether_fcc.c b/arch/powerpc/cpu/mpc8260/ether_fcc.c
index f777ba1..240e7ae 100644
--- a/arch/powerpc/cpu/mpc8260/ether_fcc.c
+++ b/arch/powerpc/cpu/mpc8260/ether_fcc.c
@@ -637,7 +637,7 @@ eth_loopback_test (void)
 
 	puts ("FCC Ethernet External loopback test\n");
 
-	eth_getenv_enetaddr("ethaddr", NetOurEther);
+	eth_getenv_enetaddr("ethaddr", net_ethaddr);
 
 	/*
 	 * global initialisations for all FCC channels
@@ -721,7 +721,7 @@ eth_loopback_test (void)
 				BD_ENET_TX_LAST | BD_ENET_TX_TC;
 
 			memset ((void *)bp, patbytes[i], ELBT_BUFSZ);
-			NetSetEther (bp, NetBcastAddr, 0x8000);
+			NetSetEther(bp, net_bcast_ethaddr, 0x8000);
 		}
 		ecp->txbd[ELBT_NTXBD - 1].cbd_sc |= BD_ENET_TX_WRAP;
 
@@ -799,11 +799,9 @@ eth_loopback_test (void)
 		 * So, far we have only been given one Ethernet address. We use
 		 * the same address for all channels
 		 */
-#define ea NetOurEther
-		fpp->fen_paddrh = (ea[5] << 8) + ea[4];
-		fpp->fen_paddrm = (ea[3] << 8) + ea[2];
-		fpp->fen_paddrl = (ea[1] << 8) + ea[0];
-#undef ea
+		fpp->fen_paddrh = (net_ethaddr[5] << 8) + net_ethaddr[4];
+		fpp->fen_paddrm = (net_ethaddr[3] << 8) + net_ethaddr[2];
+		fpp->fen_paddrl = (net_ethaddr[1] << 8) + net_ethaddr[0];
 
 		fpp->fen_minflr = PKT_MINBUF_SIZE; /* min frame len register */
 		/*
@@ -1016,7 +1014,7 @@ eth_loopback_test (void)
 							&ecp->rxbufs[i][0];
 
 						ours = memcmp (ehp->et_src, \
-							NetOurEther, 6);
+							net_ethaddr, 6);
 
 						prot = swap16 (ehp->et_protlen);
 						tb = prot & 0x8000;
diff --git a/arch/powerpc/cpu/mpc8xx/fec.c b/arch/powerpc/cpu/mpc8xx/fec.c
index 22b8ec7..454e77a 100644
--- a/arch/powerpc/cpu/mpc8xx/fec.c
+++ b/arch/powerpc/cpu/mpc8xx/fec.c
@@ -252,9 +252,9 @@ static int fec_recv (struct eth_device *dev)
 			length -= 4;
 
 #if defined(CONFIG_CMD_CDP)
-			if ((rx[0] & 1) != 0
-			    && memcmp ((uchar *) rx, NetBcastAddr, 6) != 0
-			    && !is_cdp_packet((uchar *)rx))
+			if ((rx[0] & 1) != 0 &&
+			    memcmp((uchar *)rx, net_bcast_ethaddr, 6) != 0 &&
+			    !is_cdp_packet((uchar *)rx))
 				rx = NULL;
 #endif
 			/*
diff --git a/board/BuR/common/common.c b/board/BuR/common/common.c
index ccaa9c6..13f23fd 100644
--- a/board/BuR/common/common.c
+++ b/board/BuR/common/common.c
@@ -216,7 +216,7 @@ static const char *dtbmacaddr(u32 ifno)
 
 	node = fdt_path_offset((void *)dtbaddr, path);
 	mac = fdt_getprop((void *)dtbaddr, node, "mac-address", &len);
-	if (mac && is_valid_ether_addr((u8 *)mac))
+	if (mac && is_valid_ethaddr((u8 *)mac))
 		return mac;
 
 	return NULL;
@@ -595,7 +595,7 @@ int board_eth_init(bd_t *bis)
 		#endif
 		if (!mac) {
 			printf("<ethaddr> not set. validating E-fuse MAC ... ");
-			if (is_valid_ether_addr((const u8 *)mac_addr))
+			if (is_valid_ethaddr((const u8 *)mac_addr))
 				mac = (const char *)mac_addr;
 		}
 
diff --git a/board/ait/cam_enc_4xx/cam_enc_4xx.c b/board/ait/cam_enc_4xx/cam_enc_4xx.c
index 290dc19..c5687ba 100644
--- a/board/ait/cam_enc_4xx/cam_enc_4xx.c
+++ b/board/ait/cam_enc_4xx/cam_enc_4xx.c
@@ -70,7 +70,7 @@ static int cam_enc_4xx_check_network(void)
 	if (!s)
 		return -EINVAL;
 
-	if (!is_valid_ether_addr((const u8 *)s))
+	if (!is_valid_ethaddr((const u8 *)s))
 		return -EINVAL;
 
 	s = getenv("ipaddr");
diff --git a/board/alphaproject/ap_sh4a_4a/ap_sh4a_4a.c b/board/alphaproject/ap_sh4a_4a/ap_sh4a_4a.c
index b81a68d..e65befc 100644
--- a/board/alphaproject/ap_sh4a_4a/ap_sh4a_4a.c
+++ b/board/alphaproject/ap_sh4a_4a/ap_sh4a_4a.c
@@ -167,7 +167,7 @@ int board_late_init(void)
 	/* Read MAC address */
 	i2c_read(0x50, 0x0, 0, mac, 6);
 
-	if (is_valid_ether_addr(mac))
+	if (is_valid_ethaddr(mac))
 		eth_setenv_enetaddr("ethaddr", mac);
 
 	return 0;
diff --git a/board/bct-brettl2/bct-brettl2.c b/board/bct-brettl2/bct-brettl2.c
index 6be9b18..1f0dfb4 100644
--- a/board/bct-brettl2/bct-brettl2.c
+++ b/board/bct-brettl2/bct-brettl2.c
@@ -32,7 +32,7 @@ int checkboard(void)
 static void board_init_enetaddr(uchar *mac_addr)
 {
 	puts("Warning: Generating 'random' MAC address\n");
-	eth_random_addr(mac_addr);
+	net_random_ethaddr(mac_addr);
 	eth_setenv_enetaddr("ethaddr", mac_addr);
 }
 
diff --git a/board/bf518f-ezbrd/bf518f-ezbrd.c b/board/bf518f-ezbrd/bf518f-ezbrd.c
index 3a94a57..8ecfbb2 100644
--- a/board/bf518f-ezbrd/bf518f-ezbrd.c
+++ b/board/bf518f-ezbrd/bf518f-ezbrd.c
@@ -39,7 +39,7 @@ static void board_init_enetaddr(uchar *mac_addr)
 	if (USE_MAC_IN_FLASH) {
 		/* we cram the MAC in the last flash sector */
 		uchar *board_mac_addr = (uchar *)0x203F0096;
-		if (is_valid_ether_addr(board_mac_addr)) {
+		if (is_valid_ethaddr(board_mac_addr)) {
 			memcpy(mac_addr, board_mac_addr, 6);
 			valid_mac = true;
 		}
@@ -47,7 +47,7 @@ static void board_init_enetaddr(uchar *mac_addr)
 
 	if (!valid_mac) {
 		puts("Warning: Generating 'random' MAC address\n");
-		eth_random_addr(mac_addr);
+		net_random_ethaddr(mac_addr);
 	}
 
 	eth_setenv_enetaddr("ethaddr", mac_addr);
diff --git a/board/bf526-ezbrd/bf526-ezbrd.c b/board/bf526-ezbrd/bf526-ezbrd.c
index 368d6be..0a88491 100644
--- a/board/bf526-ezbrd/bf526-ezbrd.c
+++ b/board/bf526-ezbrd/bf526-ezbrd.c
@@ -36,7 +36,7 @@ static void board_init_enetaddr(uchar *mac_addr)
 	if (USE_MAC_IN_FLASH) {
 		/* we cram the MAC in the last flash sector */
 		uchar *board_mac_addr = (uchar *)0x203F0096;
-		if (is_valid_ether_addr(board_mac_addr)) {
+		if (is_valid_ethaddr(board_mac_addr)) {
 			memcpy(mac_addr, board_mac_addr, 6);
 			valid_mac = true;
 		}
@@ -44,7 +44,7 @@ static void board_init_enetaddr(uchar *mac_addr)
 
 	if (!valid_mac) {
 		puts("Warning: Generating 'random' MAC address\n");
-		eth_random_addr(mac_addr);
+		net_random_ethaddr(mac_addr);
 	}
 
 	eth_setenv_enetaddr("ethaddr", mac_addr);
diff --git a/board/bf527-ezkit/bf527-ezkit.c b/board/bf527-ezkit/bf527-ezkit.c
index 88e1869..257775f 100644
--- a/board/bf527-ezkit/bf527-ezkit.c
+++ b/board/bf527-ezkit/bf527-ezkit.c
@@ -40,13 +40,13 @@ static void board_init_enetaddr(uchar *mac_addr)
 		for (ret = 0; ret < 6; ++ret)
 			mac_addr[ret] = otp_mac_p[5 - ret];
 
-		if (is_valid_ether_addr(mac_addr))
+		if (is_valid_ethaddr(mac_addr))
 			valid_mac = true;
 	}
 
 	if (!valid_mac) {
 		puts("Warning: Generating 'random' MAC address\n");
-		eth_random_addr(mac_addr);
+		net_random_ethaddr(mac_addr);
 	}
 
 	eth_setenv_enetaddr("ethaddr", mac_addr);
diff --git a/board/bf537-minotaur/bf537-minotaur.c b/board/bf537-minotaur/bf537-minotaur.c
index ca61ef9..71b4293 100644
--- a/board/bf537-minotaur/bf537-minotaur.c
+++ b/board/bf537-minotaur/bf537-minotaur.c
@@ -26,7 +26,7 @@ int checkboard(void)
 static void board_init_enetaddr(uchar *mac_addr)
 {
 	puts("Warning: Generating 'random' MAC address\n");
-	eth_random_addr(mac_addr);
+	net_random_ethaddr(mac_addr);
 	eth_setenv_enetaddr("ethaddr", mac_addr);
 }
 
diff --git a/board/bf537-pnav/bf537-pnav.c b/board/bf537-pnav/bf537-pnav.c
index df00110..93522df 100644
--- a/board/bf537-pnav/bf537-pnav.c
+++ b/board/bf537-pnav/bf537-pnav.c
@@ -26,7 +26,7 @@ int checkboard(void)
 static void board_init_enetaddr(uchar *mac_addr)
 {
 	puts("Warning: Generating 'random' MAC address\n");
-	eth_random_addr(mac_addr);
+	net_random_ethaddr(mac_addr);
 	eth_setenv_enetaddr("ethaddr", mac_addr);
 }
 
diff --git a/board/bf537-srv1/bf537-srv1.c b/board/bf537-srv1/bf537-srv1.c
index 725296a..6581028 100644
--- a/board/bf537-srv1/bf537-srv1.c
+++ b/board/bf537-srv1/bf537-srv1.c
@@ -26,7 +26,7 @@ int checkboard(void)
 static void board_init_enetaddr(uchar *mac_addr)
 {
 	puts("Warning: Generating 'random' MAC address\n");
-	eth_random_addr(mac_addr);
+	net_random_ethaddr(mac_addr);
 	eth_setenv_enetaddr("ethaddr", mac_addr);
 }
 
diff --git a/board/bf537-stamp/bf537-stamp.c b/board/bf537-stamp/bf537-stamp.c
index 32045a9..66e5492 100644
--- a/board/bf537-stamp/bf537-stamp.c
+++ b/board/bf537-stamp/bf537-stamp.c
@@ -39,7 +39,7 @@ static void board_init_enetaddr(uchar *mac_addr)
 	if (USE_MAC_IN_FLASH) {
 		/* we cram the MAC in the last flash sector */
 		uchar *board_mac_addr = (uchar *)0x203F0000;
-		if (is_valid_ether_addr(board_mac_addr)) {
+		if (is_valid_ethaddr(board_mac_addr)) {
 			memcpy(mac_addr, board_mac_addr, 6);
 			valid_mac = true;
 		}
@@ -47,7 +47,7 @@ static void board_init_enetaddr(uchar *mac_addr)
 
 	if (!valid_mac) {
 		puts("Warning: Generating 'random' MAC address\n");
-		eth_random_addr(mac_addr);
+		net_random_ethaddr(mac_addr);
 	}
 
 	eth_setenv_enetaddr("ethaddr", mac_addr);
diff --git a/board/birdland/bav335x/board.c b/board/birdland/bav335x/board.c
index d1e1c8c..32ff7a4 100644
--- a/board/birdland/bav335x/board.c
+++ b/board/birdland/bav335x/board.c
@@ -384,7 +384,7 @@ int board_eth_init(bd_t *bis)
 	ecode = read_eeprom(&header);
 	/* if we have a valid EE, get mac address from there */
 	if ((ecode == 0) &&
-	    is_valid_ether_addr((const u8 *)&header.mac_addr[0][0])) {
+	    is_valid_ethaddr((const u8 *)&header.mac_addr[0][0])) {
 		memcpy(mac_addr, (const void *)&header.mac_addr[0][0], 6);
 	}
 
@@ -395,7 +395,7 @@ int board_eth_init(bd_t *bis)
 	if (!getenv("ethaddr")) {
 		printf("<ethaddr> not set. Validating first E-fuse MAC\n");
 
-		if (is_valid_ether_addr(mac_addr))
+		if (is_valid_ethaddr(mac_addr))
 			eth_setenv_enetaddr("ethaddr", mac_addr);
 	}
 
diff --git a/board/buffalo/lsxl/lsxl.c b/board/buffalo/lsxl/lsxl.c
index b0d49c4..487875c 100644
--- a/board/buffalo/lsxl/lsxl.c
+++ b/board/buffalo/lsxl/lsxl.c
@@ -232,7 +232,7 @@ static void rescue_mode(void)
 	printf("Entering rescue mode..\n");
 #ifdef CONFIG_RANDOM_MACADDR
 	if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
-		eth_random_addr(enetaddr);
+		net_random_ethaddr(enetaddr);
 		if (eth_setenv_enetaddr("ethaddr", enetaddr)) {
 			printf("Failed to set ethernet address\n");
 				set_led(LED_ALARM_BLINKING);
diff --git a/board/cm-bf527/cm-bf527.c b/board/cm-bf527/cm-bf527.c
index 1533eb9..2871fa2 100644
--- a/board/cm-bf527/cm-bf527.c
+++ b/board/cm-bf527/cm-bf527.c
@@ -39,13 +39,13 @@ static void board_init_enetaddr(uchar *mac_addr)
 		for (ret = 0; ret < 6; ++ret)
 			mac_addr[ret] = otp_mac_p[5 - ret];
 
-		if (is_valid_ether_addr(mac_addr))
+		if (is_valid_ethaddr(mac_addr))
 			valid_mac = true;
 	}
 
 	if (!valid_mac) {
 		puts("Warning: Generating 'random' MAC address\n");
-		eth_random_addr(mac_addr);
+		net_random_ethaddr(mac_addr);
 	}
 
 	eth_setenv_enetaddr("ethaddr", mac_addr);
diff --git a/board/cm-bf537e/cm-bf537e.c b/board/cm-bf537e/cm-bf537e.c
index e79f90f..902611e 100644
--- a/board/cm-bf537e/cm-bf537e.c
+++ b/board/cm-bf537e/cm-bf537e.c
@@ -31,7 +31,7 @@ static void board_init_enetaddr(char *var)
 		return;
 
 	printf("Warning: %s: generating 'random' MAC address\n", var);
-	eth_random_addr(enetaddr);
+	net_random_ethaddr(enetaddr);
 	eth_setenv_enetaddr(var, enetaddr);
 }
 
diff --git a/board/cm-bf537u/cm-bf537u.c b/board/cm-bf537u/cm-bf537u.c
index 632cbda..69bffd7 100644
--- a/board/cm-bf537u/cm-bf537u.c
+++ b/board/cm-bf537u/cm-bf537u.c
@@ -31,7 +31,7 @@ static void board_init_enetaddr(char *var)
 		return;
 
 	printf("Warning: %s: generating 'random' MAC address\n", var);
-	eth_random_addr(enetaddr);
+	net_random_ethaddr(enetaddr);
 	eth_setenv_enetaddr(var, enetaddr);
 }
 
diff --git a/board/compulab/cm_fx6/cm_fx6.c b/board/compulab/cm_fx6/cm_fx6.c
index ae6945b..7a1bbaf 100644
--- a/board/compulab/cm_fx6/cm_fx6.c
+++ b/board/compulab/cm_fx6/cm_fx6.c
@@ -425,7 +425,7 @@ static int handle_mac_address(char *env_var, uint eeprom_bus)
 	if (rc)
 		return rc;
 
-	if (!is_valid_ether_addr(enetaddr))
+	if (!is_valid_ethaddr(enetaddr))
 		return -1;
 
 	return eth_setenv_enetaddr(env_var, enetaddr);
diff --git a/board/compulab/cm_t335/cm_t335.c b/board/compulab/cm_t335/cm_t335.c
index 592ef3d..428aee6 100644
--- a/board/compulab/cm_t335/cm_t335.c
+++ b/board/compulab/cm_t335/cm_t335.c
@@ -114,7 +114,7 @@ static int handle_mac_address(void)
 	if (rv)
 		get_efuse_mac_addr(enetaddr);
 
-	if (!is_valid_ether_addr(enetaddr))
+	if (!is_valid_ethaddr(enetaddr))
 		return -1;
 
 	return eth_setenv_enetaddr("ethaddr", enetaddr);
diff --git a/board/compulab/cm_t35/cm_t35.c b/board/compulab/cm_t35/cm_t35.c
index c4ea8ea..374edbc 100644
--- a/board/compulab/cm_t35/cm_t35.c
+++ b/board/compulab/cm_t35/cm_t35.c
@@ -441,7 +441,7 @@ static int handle_mac_address(void)
 	if (rc)
 		return rc;
 
-	if (!is_valid_ether_addr(enetaddr))
+	if (!is_valid_ethaddr(enetaddr))
 		return -1;
 
 	return eth_setenv_enetaddr("ethaddr", enetaddr);
diff --git a/board/compulab/cm_t3517/cm_t3517.c b/board/compulab/cm_t3517/cm_t3517.c
index 624cf4c..03b2bad 100644
--- a/board/compulab/cm_t3517/cm_t3517.c
+++ b/board/compulab/cm_t3517/cm_t3517.c
@@ -132,7 +132,7 @@ static int am3517_get_efuse_enetaddr(u8 *enetaddr)
 	enetaddr[4] = (u8)((lsb >> 8)  & 0xff);
 	enetaddr[5] = (u8)(lsb & 0xff);
 
-	return is_valid_ether_addr(enetaddr);
+	return is_valid_ethaddr(enetaddr);
 }
 
 static inline int cm_t3517_init_emac(bd_t *bis)
@@ -170,7 +170,7 @@ static int cm_t3517_handle_mac_address(void)
 			return ret;
 	}
 
-	if (!is_valid_ether_addr(enetaddr))
+	if (!is_valid_ethaddr(enetaddr))
 		return -1;
 
 	return eth_setenv_enetaddr("ethaddr", enetaddr);
diff --git a/board/compulab/cm_t54/cm_t54.c b/board/compulab/cm_t54/cm_t54.c
index fdea909..fad0551 100644
--- a/board/compulab/cm_t54/cm_t54.c
+++ b/board/compulab/cm_t54/cm_t54.c
@@ -166,10 +166,10 @@ static int handle_mac_address(void)
 		return 0;
 
 	ret = cl_eeprom_read_mac_addr(enetaddr, CONFIG_SYS_I2C_EEPROM_BUS);
-	if (ret || !is_valid_ether_addr(enetaddr))
+	if (ret || !is_valid_ethaddr(enetaddr))
 		generate_mac_addr(enetaddr);
 
-	if (!is_valid_ether_addr(enetaddr))
+	if (!is_valid_ethaddr(enetaddr))
 		return -1;
 
 	return eth_setenv_enetaddr("usbethaddr", enetaddr);
diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c
index b9ca38e..b82385a 100644
--- a/board/davinci/da8xxevm/da850evm.c
+++ b/board/davinci/da8xxevm/da850evm.c
@@ -145,7 +145,7 @@ int misc_init_r(void)
 	 */
 	if (!enetaddr_found) {
 		if (!spi_mac_read) {
-			if (is_valid_ether_addr(buff)) {
+			if (is_valid_ethaddr(buff)) {
 				if (eth_setenv_enetaddr("ethaddr", buff)) {
 					printf("Warning: Failed to "
 					"set MAC address from SPI flash\n");
@@ -160,8 +160,8 @@ int misc_init_r(void)
 		 * MAC address present in environment compare it with
 		 * the MAC address in SPI flash and warn on mismatch
 		 */
-		if (!spi_mac_read && is_valid_ether_addr(buff) &&
-						memcmp(env_enetaddr, buff, 6))
+		if (!spi_mac_read && is_valid_ethaddr(buff) &&
+		    memcmp(env_enetaddr, buff, 6))
 			printf("Warning: MAC address in SPI flash don't match "
 					"with the MAC address in the environment\n");
 			printf("Default using MAC address from environment\n");
diff --git a/board/dnp5370/dnp5370.c b/board/dnp5370/dnp5370.c
index df721c9..655fcac 100644
--- a/board/dnp5370/dnp5370.c
+++ b/board/dnp5370/dnp5370.c
@@ -46,7 +46,7 @@ static void board_init_enetaddr(uchar *mac_addr)
 	if (USE_MAC_IN_FLASH) {
 		/* we cram the MAC in the last flash sector */
 		uchar *board_mac_addr = (uchar *)0x202F0000;
-		if (is_valid_ether_addr(board_mac_addr)) {
+		if (is_valid_ethaddr(board_mac_addr)) {
 			memcpy(mac_addr, board_mac_addr, 6);
 			valid_mac = true;
 		}
@@ -54,7 +54,7 @@ static void board_init_enetaddr(uchar *mac_addr)
 
 	if (!valid_mac) {
 		puts("Warning: Generating 'random' MAC address\n");
-		eth_random_addr(mac_addr);
+		net_random_ethaddr(mac_addr);
 	}
 
 	eth_setenv_enetaddr("ethaddr", mac_addr);
diff --git a/board/gumstix/pepper/board.c b/board/gumstix/pepper/board.c
index f644f81..beb2fac 100644
--- a/board/gumstix/pepper/board.c
+++ b/board/gumstix/pepper/board.c
@@ -165,7 +165,7 @@ int board_eth_init(bd_t *bis)
 		mac_addr[3] = (mac_hi & 0xFF000000) >> 24;
 		mac_addr[4] = mac_lo & 0xFF;
 		mac_addr[5] = (mac_lo & 0xFF00) >> 8;
-		if (is_valid_ether_addr(mac_addr))
+		if (is_valid_ethaddr(mac_addr))
 			eth_setenv_enetaddr("ethaddr", mac_addr);
 	}
 
diff --git a/board/ifm/ac14xx/ac14xx.c b/board/ifm/ac14xx/ac14xx.c
index 5d2ab2f..72932ca 100644
--- a/board/ifm/ac14xx/ac14xx.c
+++ b/board/ifm/ac14xx/ac14xx.c
@@ -225,7 +225,7 @@ int mac_read_from_eeprom(void)
 		break;
 	}
 
-	if (mac && is_valid_ether_addr(mac)) {
+	if (mac && is_valid_ethaddr(mac)) {
 		eth_setenv_enetaddr("ethaddr", mac);
 		if (mac_diag) {
 			mac_txt = getenv("ethaddr");
diff --git a/board/ip04/ip04.c b/board/ip04/ip04.c
index ae52633..d20500f 100644
--- a/board/ip04/ip04.c
+++ b/board/ip04/ip04.c
@@ -32,7 +32,7 @@ int misc_init_r(void)
 	uchar enetaddr[6];
 	if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
 		puts("Warning: Generating 'random' MAC address\n");
-		eth_random_addr(enetaddr);
+		net_random_ethaddr(enetaddr);
 		eth_setenv_enetaddr("ethaddr", enetaddr);
 	}
 
diff --git a/board/isee/igep0033/board.c b/board/isee/igep0033/board.c
index 9f8fcf2..5fea7ff 100644
--- a/board/isee/igep0033/board.c
+++ b/board/isee/igep0033/board.c
@@ -156,7 +156,7 @@ int board_eth_init(bd_t *bis)
 		mac_addr[3] = (mac_hi & 0xFF000000) >> 24;
 		mac_addr[4] = mac_lo & 0xFF;
 		mac_addr[5] = (mac_lo & 0xFF00) >> 8;
-		if (is_valid_ether_addr(mac_addr))
+		if (is_valid_ethaddr(mac_addr))
 			eth_setenv_enetaddr("ethaddr", mac_addr);
 	}
 
diff --git a/board/phytec/pcm051/board.c b/board/phytec/pcm051/board.c
index 1071662..1bf9d73 100644
--- a/board/phytec/pcm051/board.c
+++ b/board/phytec/pcm051/board.c
@@ -228,7 +228,7 @@ int board_eth_init(bd_t *bis)
 		mac_addr[4] = mac_lo & 0xFF;
 		mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 
-		if (is_valid_ether_addr(mac_addr))
+		if (is_valid_ethaddr(mac_addr))
 			eth_setenv_enetaddr("ethaddr", mac_addr);
 		else
 			goto try_usbether;
diff --git a/board/renesas/r0p7734/r0p7734.c b/board/renesas/r0p7734/r0p7734.c
index 5687ad4..2e31ba6 100644
--- a/board/renesas/r0p7734/r0p7734.c
+++ b/board/renesas/r0p7734/r0p7734.c
@@ -55,7 +55,7 @@ int board_late_init(void)
 	/* Read MAC address */
 	i2c_read(0x50, 0x10, 0, mac, 6);
 
-	if (is_valid_ether_addr(mac))
+	if (is_valid_ethaddr(mac))
 		eth_setenv_enetaddr("ethaddr", mac);
 
 	return 0;
diff --git a/board/siemens/common/factoryset.c b/board/siemens/common/factoryset.c
index 7baac3d..d81f548 100644
--- a/board/siemens/common/factoryset.c
+++ b/board/siemens/common/factoryset.c
@@ -271,7 +271,7 @@ static int factoryset_mac_setenv(void)
 	uint8_t mac_addr[6];
 
 	debug("FactorySet: Set mac address\n");
-	if (is_valid_ether_addr(factory_dat.mac)) {
+	if (is_valid_ethaddr(factory_dat.mac)) {
 		memcpy(mac_addr, factory_dat.mac, 6);
 	} else {
 		uint32_t mac_hi, mac_lo;
@@ -286,7 +286,7 @@ static int factoryset_mac_setenv(void)
 		mac_addr[3] = (mac_hi & 0xFF000000) >> 24;
 		mac_addr[4] = mac_lo & 0xFF;
 		mac_addr[5] = (mac_lo & 0xFF00) >> 8;
-		if (!is_valid_ether_addr(mac_addr)) {
+		if (!is_valid_ethaddr(mac_addr)) {
 			printf("Warning: ethaddr not set by FactorySet or E-fuse. Set <ethaddr> variable to overcome this.\n");
 			return -1;
 		}
diff --git a/board/siemens/pxm2/board.c b/board/siemens/pxm2/board.c
index 264ba02..4d8ba3c 100644
--- a/board/siemens/pxm2/board.c
+++ b/board/siemens/pxm2/board.c
@@ -222,7 +222,7 @@ int board_eth_init(bd_t *bis)
 	struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
 #ifdef CONFIG_FACTORYSET
 	int rv;
-	if (!is_valid_ether_addr(factory_dat.mac))
+	if (!is_valid_ethaddr(factory_dat.mac))
 		printf("Error: no valid mac address\n");
 	else
 		eth_setenv_enetaddr("ethaddr", factory_dat.mac);
diff --git a/board/silica/pengwyn/board.c b/board/silica/pengwyn/board.c
index ee88b6f..815c9a7 100644
--- a/board/silica/pengwyn/board.c
+++ b/board/silica/pengwyn/board.c
@@ -189,7 +189,7 @@ int board_eth_init(bd_t *bis)
 		mac_addr[4] = mac_lo & 0xFF;
 		mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 
-		if (is_valid_ether_addr(mac_addr))
+		if (is_valid_ethaddr(mac_addr))
 			eth_setenv_enetaddr("ethaddr", mac_addr);
 		else
 			return n;
diff --git a/board/tcm-bf518/tcm-bf518.c b/board/tcm-bf518/tcm-bf518.c
index 5d25fcd..3fa7d97 100644
--- a/board/tcm-bf518/tcm-bf518.c
+++ b/board/tcm-bf518/tcm-bf518.c
@@ -39,14 +39,14 @@ static void board_init_enetaddr(uchar *mac_addr)
 		for (ret = 0; ret < 6; ++ret)
 			mac_addr[ret] = otp_mac_p[5 - ret];
 
-		if (is_valid_ether_addr(mac_addr))
+		if (is_valid_ethaddr(mac_addr))
 			valid_mac = true;
 	}
 #endif
 
 	if (!valid_mac) {
 		puts("Warning: Generating 'random' MAC address\n");
-		eth_random_addr(mac_addr);
+		net_random_ethaddr(mac_addr);
 	}
 
 	eth_setenv_enetaddr("ethaddr", mac_addr);
diff --git a/board/tcm-bf537/tcm-bf537.c b/board/tcm-bf537/tcm-bf537.c
index a4f0f71..2531a44 100644
--- a/board/tcm-bf537/tcm-bf537.c
+++ b/board/tcm-bf537/tcm-bf537.c
@@ -31,7 +31,7 @@ static void board_init_enetaddr(char *var)
 		return;
 
 	printf("Warning: %s: generating 'random' MAC address\n", var);
-	eth_random_addr(enetaddr);
+	net_random_ethaddr(enetaddr);
 	eth_setenv_enetaddr(var, enetaddr);
 }
 
diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c
index 0739e60..96245a3 100644
--- a/board/ti/am335x/board.c
+++ b/board/ti/am335x/board.c
@@ -593,7 +593,7 @@ int board_eth_init(bd_t *bis)
 	if (!getenv("ethaddr")) {
 		printf("<ethaddr> not set. Validating first E-fuse MAC\n");
 
-		if (is_valid_ether_addr(mac_addr))
+		if (is_valid_ethaddr(mac_addr))
 			eth_setenv_enetaddr("ethaddr", mac_addr);
 	}
 
@@ -609,7 +609,7 @@ int board_eth_init(bd_t *bis)
 	mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 
 	if (!getenv("eth1addr")) {
-		if (is_valid_ether_addr(mac_addr))
+		if (is_valid_ethaddr(mac_addr))
 			eth_setenv_enetaddr("eth1addr", mac_addr);
 	}
 
@@ -658,7 +658,7 @@ int board_eth_init(bd_t *bis)
 #endif
 #if defined(CONFIG_USB_ETHER) && \
 	(!defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_USBETH_SUPPORT))
-	if (is_valid_ether_addr(mac_addr))
+	if (is_valid_ethaddr(mac_addr))
 		eth_setenv_enetaddr("usbnet_devaddr", mac_addr);
 
 	rv = usb_eth_initialize(bis);
diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c
index 6703670..e58024d 100644
--- a/board/ti/am43xx/board.c
+++ b/board/ti/am43xx/board.c
@@ -694,7 +694,7 @@ int board_eth_init(bd_t *bis)
 
 	if (!getenv("ethaddr")) {
 		puts("<ethaddr> not set. Validating first E-fuse MAC\n");
-		if (is_valid_ether_addr(mac_addr))
+		if (is_valid_ethaddr(mac_addr))
 			eth_setenv_enetaddr("ethaddr", mac_addr);
 	}
 
@@ -708,7 +708,7 @@ int board_eth_init(bd_t *bis)
 	mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 
 	if (!getenv("eth1addr")) {
-		if (is_valid_ether_addr(mac_addr))
+		if (is_valid_ethaddr(mac_addr))
 			eth_setenv_enetaddr("eth1addr", mac_addr);
 	}
 
diff --git a/board/ti/beagle_x15/board.c b/board/ti/beagle_x15/board.c
index 3a7e04d..79c5c3d 100644
--- a/board/ti/beagle_x15/board.c
+++ b/board/ti/beagle_x15/board.c
@@ -356,7 +356,7 @@ int board_eth_init(bd_t *bis)
 	if (!getenv("ethaddr")) {
 		printf("<ethaddr> not set. Validating first E-fuse MAC\n");
 
-		if (is_valid_ether_addr(mac_addr))
+		if (is_valid_ethaddr(mac_addr))
 			eth_setenv_enetaddr("ethaddr", mac_addr);
 	}
 
@@ -370,7 +370,7 @@ int board_eth_init(bd_t *bis)
 	mac_addr[5] = mac_lo & 0xFF;
 
 	if (!getenv("eth1addr")) {
-		if (is_valid_ether_addr(mac_addr))
+		if (is_valid_ethaddr(mac_addr))
 			eth_setenv_enetaddr("eth1addr", mac_addr);
 	}
 
diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c
index 6522241..ff4fc02 100644
--- a/board/ti/dra7xx/evm.c
+++ b/board/ti/dra7xx/evm.c
@@ -232,7 +232,7 @@ int board_eth_init(bd_t *bis)
 	if (!getenv("ethaddr")) {
 		printf("<ethaddr> not set. Validating first E-fuse MAC\n");
 
-		if (is_valid_ether_addr(mac_addr))
+		if (is_valid_ethaddr(mac_addr))
 			eth_setenv_enetaddr("ethaddr", mac_addr);
 	}
 
@@ -246,7 +246,7 @@ int board_eth_init(bd_t *bis)
 	mac_addr[5] = mac_lo & 0xFF;
 
 	if (!getenv("eth1addr")) {
-		if (is_valid_ether_addr(mac_addr))
+		if (is_valid_ethaddr(mac_addr))
 			eth_setenv_enetaddr("eth1addr", mac_addr);
 	}
 
diff --git a/board/ti/ti814x/evm.c b/board/ti/ti814x/evm.c
index 54b3dfb..e406dab 100644
--- a/board/ti/ti814x/evm.c
+++ b/board/ti/ti814x/evm.c
@@ -178,7 +178,7 @@ int board_eth_init(bd_t *bis)
 		mac_addr[4] = mac_lo & 0xFF;
 		mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 
-		if (is_valid_ether_addr(mac_addr))
+		if (is_valid_ethaddr(mac_addr))
 			eth_setenv_enetaddr("ethaddr", mac_addr);
 		else
 			printf("Unable to read MAC address. Set <ethaddr>\n");
diff --git a/doc/README.enetaddr b/doc/README.enetaddr
index 1eaeaf9..0fafd2c 100644
--- a/doc/README.enetaddr
+++ b/doc/README.enetaddr
@@ -87,7 +87,7 @@ eth_parse_enetaddr(addr, enetaddr);
 Look up an environment variable and convert the stored address.  If the address
 is valid, then the function returns 1.  Otherwise, the function returns 0.  In
 all cases, the enetaddr memory is initialized.  If the env var is not found,
-then it is set to all zeros.  The common function is_valid_ether_addr() is used
+then it is set to all zeros.  The common function is_valid_ethaddr() is used
 to determine address validity.
 uchar enetaddr[6];
 if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c
index 52f8da6..d4b0cb9 100644
--- a/drivers/net/cpsw.c
+++ b/drivers/net/cpsw.c
@@ -289,7 +289,7 @@ static inline void cpsw_ale_get_addr(u32 *ale_entry, u8 *addr)
 		addr[i] = cpsw_ale_get_field(ale_entry, 40 - 8*i, 8);
 }
 
-static inline void cpsw_ale_set_addr(u32 *ale_entry, u8 *addr)
+static inline void cpsw_ale_set_addr(u32 *ale_entry, const u8 *addr)
 {
 	int i;
 
@@ -321,7 +321,7 @@ static int cpsw_ale_write(struct cpsw_priv *priv, int idx, u32 *ale_entry)
 	return idx;
 }
 
-static int cpsw_ale_match_addr(struct cpsw_priv *priv, u8* addr)
+static int cpsw_ale_match_addr(struct cpsw_priv *priv, const u8 *addr)
 {
 	u32 ale_entry[ALE_ENTRY_WORDS];
 	int type, idx;
@@ -374,7 +374,7 @@ static int cpsw_ale_find_ageable(struct cpsw_priv *priv)
 	return -ENOENT;
 }
 
-static int cpsw_ale_add_ucast(struct cpsw_priv *priv, u8 *addr,
+static int cpsw_ale_add_ucast(struct cpsw_priv *priv, const u8 *addr,
 			      int port, int flags)
 {
 	u32 ale_entry[ALE_ENTRY_WORDS] = {0, 0, 0};
@@ -399,7 +399,8 @@ static int cpsw_ale_add_ucast(struct cpsw_priv *priv, u8 *addr,
 	return 0;
 }
 
-static int cpsw_ale_add_mcast(struct cpsw_priv *priv, u8 *addr, int port_mask)
+static int cpsw_ale_add_mcast(struct cpsw_priv *priv, const u8 *addr,
+			      int port_mask)
 {
 	u32 ale_entry[ALE_ENTRY_WORDS] = {0, 0, 0};
 	int idx, mask;
@@ -644,7 +645,7 @@ static void cpsw_slave_init(struct cpsw_slave *slave, struct cpsw_priv *priv)
 	slave_port = cpsw_get_slave_port(priv, slave->slave_num);
 	cpsw_ale_port_state(priv, slave_port, ALE_PORT_STATE_FORWARD);
 
-	cpsw_ale_add_mcast(priv, NetBcastAddr, 1 << slave_port);
+	cpsw_ale_add_mcast(priv, net_bcast_ethaddr, 1 << slave_port);
 
 	priv->phy_mask |= 1 << slave->data->phy_addr;
 }
@@ -773,7 +774,7 @@ static int cpsw_init(struct eth_device *dev, bd_t *bis)
 
 	cpsw_ale_add_ucast(priv, priv->dev->enetaddr, priv->host_port,
 			   ALE_SECURE);
-	cpsw_ale_add_mcast(priv, NetBcastAddr, 1 << priv->host_port);
+	cpsw_ale_add_mcast(priv, net_bcast_ethaddr, 1 << priv->host_port);
 
 	for_active_slave(slave, priv)
 		cpsw_slave_init(slave, priv);
diff --git a/drivers/net/dm9000x.c b/drivers/net/dm9000x.c
index 4de9d41..d1c6f4c 100644
--- a/drivers/net/dm9000x.c
+++ b/drivers/net/dm9000x.c
@@ -342,10 +342,10 @@ static int dm9000_init(struct eth_device *dev, bd_t *bd)
 	DM9000_iow(DM9000_ISR, ISR_ROOS | ISR_ROS | ISR_PTS | ISR_PRS);
 
 	printf("MAC: %pM\n", dev->enetaddr);
-	if (!is_valid_ether_addr(dev->enetaddr)) {
+	if (!is_valid_ethaddr(dev->enetaddr)) {
 #ifdef CONFIG_RANDOM_MACADDR
 		printf("Bad MAC address (uninitialized EEPROM?), randomizing\n");
-		eth_random_addr(dev->enetaddr);
+		net_random_ethaddr(dev->enetaddr);
 		printf("MAC: %pM\n", dev->enetaddr);
 #else
 		printf("WARNING: Bad MAC address (uninitialized EEPROM?)\n");
diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c
index cd44222..6a2e0d2 100644
--- a/drivers/net/e1000.c
+++ b/drivers/net/e1000.c
@@ -1197,7 +1197,7 @@ e1000_read_mac_addr(struct eth_device *nic)
 		nic->enetaddr[5] ^= 1;
 
 #ifdef CONFIG_E1000_FALLBACK_MAC
-	if (!is_valid_ether_addr(nic->enetaddr)) {
+	if (!is_valid_ethaddr(nic->enetaddr)) {
 		unsigned char fb_mac[NODE_ADDRESS_SIZE] = CONFIG_E1000_FALLBACK_MAC;
 
 		memcpy (nic->enetaddr, fb_mac, NODE_ADDRESS_SIZE);
diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index b572470..1146d3b 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -357,7 +357,7 @@ static int fec_get_hwaddr(struct eth_device *dev, int dev_id,
 						unsigned char *mac)
 {
 	imx_get_mac_from_fuse(dev_id, mac);
-	return !is_valid_ether_addr(mac);
+	return !is_valid_ethaddr(mac);
 }
 
 static int fec_set_hwaddr(struct eth_device *dev)
diff --git a/drivers/net/ftmac110.c b/drivers/net/ftmac110.c
index 98c4f09..aef89a2 100644
--- a/drivers/net/ftmac110.c
+++ b/drivers/net/ftmac110.c
@@ -425,7 +425,7 @@ int ftmac110_initialize(bd_t *bis)
 	dev->recv = ftmac110_recv;
 
 	if (!eth_getenv_enetaddr_by_index("eth", card_nr, dev->enetaddr))
-		eth_random_addr(dev->enetaddr);
+		net_random_ethaddr(dev->enetaddr);
 
 	/* allocate tx descriptors (it must be 16 bytes aligned) */
 	chip->txd = dma_alloc_coherent(
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 170ff06..1fe408c 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -595,7 +595,7 @@ static int macb_init(struct eth_device *netdev, bd_t *bd)
 	}
 
 	/* update the ethaddr */
-	if (is_valid_ether_addr(netdev->enetaddr)) {
+	if (is_valid_ethaddr(netdev->enetaddr)) {
 		macb_write_hwaddr(netdev);
 	} else {
 		printf("%s: mac address is not valid\n", netdev->name);
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index 55f383f..0d81b44 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -117,7 +117,7 @@ static int refresh_settings_from_env(void)
 void NcStart(void)
 {
 	refresh_settings_from_env();
-	if (!output_packet_len || memcmp(nc_ether, NetEtherNullAddr, 6)) {
+	if (!output_packet_len || memcmp(nc_ether, net_null_ethaddr, 6)) {
 		/* going to check for input packet */
 		net_set_udp_handler(nc_handler);
 		NetSetTimeout(net_timeout, nc_timeout);
@@ -180,7 +180,7 @@ static void nc_send_packet(const char *buf, int len)
 	if (eth == NULL)
 		return;
 
-	if (!memcmp(nc_ether, NetEtherNullAddr, 6)) {
+	if (!memcmp(nc_ether, net_null_ethaddr, 6)) {
 		if (eth->state == ETH_STATE_ACTIVE)
 			return;	/* inside net loop */
 		output_packet = buf;
diff --git a/drivers/usb/eth/smsc95xx.c b/drivers/usb/eth/smsc95xx.c
index 6bca34d..78b469f 100644
--- a/drivers/usb/eth/smsc95xx.c
+++ b/drivers/usb/eth/smsc95xx.c
@@ -355,7 +355,7 @@ static int smsc95xx_init_mac_address(struct eth_device *eth,
 	/* try reading mac address from EEPROM */
 	if (smsc95xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN,
 			eth->enetaddr) == 0) {
-		if (is_valid_ether_addr(eth->enetaddr)) {
+		if (is_valid_ethaddr(eth->enetaddr)) {
 			/* eeprom values are valid so use them */
 			debug("MAC address read from EEPROM\n");
 			return 0;
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index 8f03a6b..c01163c 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -1644,13 +1644,13 @@ static int eth_start_xmit (struct sk_buff *skb, struct net_device *net)
 	if (!eth_is_promisc (dev)) {
 		u8		*dest = skb->data;
 
-		if (is_multicast_ether_addr(dest)) {
+		if (is_multicast_ethaddr(dest)) {
 			u16	type;
 
 			/* ignores USB_CDC_PACKET_TYPE_MULTICAST and host
 			 * SET_ETHERNET_MULTICAST_FILTERS requests
 			 */
-			if (is_broadcast_ether_addr(dest))
+			if (is_broadcast_ethaddr(dest))
 				type = USB_CDC_PACKET_TYPE_BROADCAST;
 			else
 				type = USB_CDC_PACKET_TYPE_ALL_MULTICAST;
@@ -1941,7 +1941,7 @@ static int is_eth_addr_valid(char *str)
 		}
 
 		/* Now check the contents. */
-		return is_valid_ether_addr(ea);
+		return is_valid_ethaddr(ea);
 	}
 	return 0;
 }
@@ -1970,7 +1970,7 @@ static int get_ether_addr(const char *str, u8 *dev_addr)
 			num |= (nibble(*str++));
 			dev_addr[i] = num;
 		}
-		if (is_valid_ether_addr(dev_addr))
+		if (is_valid_ethaddr(dev_addr))
 			return 0;
 	}
 	return 1;
diff --git a/include/net.h b/include/net.h
index 2664865..33e542f 100644
--- a/include/net.h
+++ b/include/net.h
@@ -471,8 +471,8 @@ extern char	net_nis_domain[32];	/* Our IS domain */
 extern char	net_hostname[32];	/* Our hostname */
 extern char	net_root_path[64];	/* Our root path */
 /** END OF BOOTP EXTENTIONS **/
-extern uchar		NetOurEther[6];		/* Our ethernet address */
-extern uchar		NetServerEther[6];	/* Boot server enet address */
+extern u8		net_ethaddr[6];		/* Our ethernet address */
+extern u8		net_server_ethaddr[6];	/* Boot server enet address */
 extern struct in_addr	net_ip;		/* Our    IP addr (0 = unknown) */
 extern struct in_addr	net_server_ip;	/* Server IP addr (0 = unknown) */
 extern uchar		*NetTxPacket;		/* THE transmit packet */
@@ -484,8 +484,8 @@ extern uchar		*NetRxPackets[PKTBUFSRX]; /* Receive packets */
 extern uchar		*NetRxPacket;		/* Current receive packet */
 extern int		NetRxPacketLen;		/* Current rx packet length */
 extern unsigned		NetIPID;		/* IP ID (counting) */
-extern uchar		NetBcastAddr[6];	/* Ethernet boardcast address */
-extern uchar		NetEtherNullAddr[6];
+extern const u8		net_bcast_ethaddr[6];	/* Ethernet broadcast address */
+extern const u8		net_null_ethaddr[6];
 
 #define VLAN_NONE	4095			/* untagged */
 #define VLAN_IDMASK	0x0fff			/* mask of valid vlan id */
@@ -522,11 +522,11 @@ extern ushort CDPApplianceVLAN;		/* CDP returned appliance VLAN */
 /*
  * Check for a CDP packet by examining the received MAC address field
  */
-static inline int is_cdp_packet(const uchar *et_addr)
+static inline int is_cdp_packet(const uchar *ethaddr)
 {
-	extern const uchar NetCDPAddr[6];
+	extern const u8 net_cdp_ethaddr[6];
 
-	return memcmp(et_addr, NetCDPAddr, 6) == 0;
+	return memcmp(ethaddr, net_cdp_ethaddr, 6) == 0;
 }
 #endif
 
@@ -553,7 +553,7 @@ int	NetStartAgain(void);
 int	NetEthHdrSize(void);
 
 /* Set ethernet header; returns the size of the header */
-int NetSetEther(uchar *, uchar *, uint);
+int NetSetEther(uchar *xet, const uchar *dest_ethaddr, uint prot);
 int net_update_ether(struct ethernet_hdr *et, uchar *addr, uint prot);
 
 /* Set IP header */
@@ -716,42 +716,42 @@ static inline void NetCopyLong(ulong *to, ulong *from)
 }
 
 /**
- * is_zero_ether_addr - Determine if give Ethernet address is all zeros.
+ * is_zero_ethaddr - Determine if give Ethernet address is all zeros.
  * @addr: Pointer to a six-byte array containing the Ethernet address
  *
  * Return true if the address is all zeroes.
  */
-static inline int is_zero_ether_addr(const u8 *addr)
+static inline int is_zero_ethaddr(const u8 *addr)
 {
 	return !(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5]);
 }
 
 /**
- * is_multicast_ether_addr - Determine if the Ethernet address is a multicast.
+ * is_multicast_ethaddr - Determine if the Ethernet address is a multicast.
  * @addr: Pointer to a six-byte array containing the Ethernet address
  *
  * Return true if the address is a multicast address.
  * By definition the broadcast address is also a multicast address.
  */
-static inline int is_multicast_ether_addr(const u8 *addr)
+static inline int is_multicast_ethaddr(const u8 *addr)
 {
 	return 0x01 & addr[0];
 }
 
 /*
- * is_broadcast_ether_addr - Determine if the Ethernet address is broadcast
+ * is_broadcast_ethaddr - Determine if the Ethernet address is broadcast
  * @addr: Pointer to a six-byte array containing the Ethernet address
  *
  * Return true if the address is the broadcast address.
  */
-static inline int is_broadcast_ether_addr(const u8 *addr)
+static inline int is_broadcast_ethaddr(const u8 *addr)
 {
 	return (addr[0] & addr[1] & addr[2] & addr[3] & addr[4] & addr[5]) ==
 		0xff;
 }
 
 /*
- * is_valid_ether_addr - Determine if the given Ethernet address is valid
+ * is_valid_ethaddr - Determine if the given Ethernet address is valid
  * @addr: Pointer to a six-byte array containing the Ethernet address
  *
  * Check that the Ethernet address (MAC) is not 00:00:00:00:00:00, is not
@@ -759,21 +759,21 @@ static inline int is_broadcast_ether_addr(const u8 *addr)
  *
  * Return true if the address is valid.
  */
-static inline int is_valid_ether_addr(const u8 *addr)
+static inline int is_valid_ethaddr(const u8 *addr)
 {
 	/* FF:FF:FF:FF:FF:FF is a multicast address so we don't need to
 	 * explicitly check for it here. */
-	return !is_multicast_ether_addr(addr) && !is_zero_ether_addr(addr);
+	return !is_multicast_ethaddr(addr) && !is_zero_ethaddr(addr);
 }
 
 /**
- * eth_random_addr - Generate software assigned random Ethernet address
+ * net_random_ethaddr - Generate software assigned random Ethernet address
  * @addr: Pointer to a six-byte array containing the Ethernet address
  *
  * Generate a random Ethernet address (MAC) that is not multicast
  * and has the local assigned bit set.
  */
-static inline void eth_random_addr(uchar *addr)
+static inline void net_random_ethaddr(uchar *addr)
 {
 	int i;
 	unsigned int seed = get_timer(0);
diff --git a/net/arp.c b/net/arp.c
index 4971a53..c613609 100644
--- a/net/arp.c
+++ b/net/arp.c
@@ -60,7 +60,7 @@ void arp_raw_request(struct in_addr source_ip, const uchar *targetEther,
 
 	pkt = NetArpTxPacket;
 
-	eth_hdr_size = NetSetEther(pkt, NetBcastAddr, PROT_ARP);
+	eth_hdr_size = NetSetEther(pkt, net_bcast_ethaddr, PROT_ARP);
 	pkt += eth_hdr_size;
 
 	arp = (struct arp_hdr *) pkt;
@@ -71,7 +71,7 @@ void arp_raw_request(struct in_addr source_ip, const uchar *targetEther,
 	arp->ar_pln = ARP_PLEN;
 	arp->ar_op = htons(ARPOP_REQUEST);
 
-	memcpy(&arp->ar_sha, NetOurEther, ARP_HLEN);	/* source ET addr */
+	memcpy(&arp->ar_sha, net_ethaddr, ARP_HLEN);	/* source ET addr */
 	net_write_ip(&arp->ar_spa, source_ip);		/* source IP addr */
 	memcpy(&arp->ar_tha, targetEther, ARP_HLEN);	/* target ET addr */
 	net_write_ip(&arp->ar_tpa, target_ip);		/* target IP addr */
@@ -93,7 +93,7 @@ void ArpRequest(void)
 		net_arp_wait_reply_ip = net_arp_wait_packet_ip;
 	}
 
-	arp_raw_request(net_ip, NetEtherNullAddr, net_arp_wait_reply_ip);
+	arp_raw_request(net_ip, net_null_ethaddr, net_arp_wait_reply_ip);
 }
 
 void ArpTimeoutCheck(void)
@@ -168,7 +168,7 @@ void ArpReceive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
 		arp->ar_op = htons(ARPOP_REPLY);
 		memcpy(&arp->ar_tha, &arp->ar_sha, ARP_HLEN);
 		net_copy_ip(&arp->ar_tpa, &arp->ar_spa);
-		memcpy(&arp->ar_sha, NetOurEther, ARP_HLEN);
+		memcpy(&arp->ar_sha, net_ethaddr, ARP_HLEN);
 		net_copy_ip(&arp->ar_spa, &net_ip);
 
 #ifdef CONFIG_CMD_LINK_LOCAL
diff --git a/net/bootp.c b/net/bootp.c
index 9251e91..9b27d4c 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -147,7 +147,8 @@ static void BootpCopyNetParams(struct Bootp_t *bp)
 	net_copy_ip(&tmp_ip, &bp->bp_siaddr);
 	if (tmp_ip.s_addr != 0)
 		net_copy_ip(&net_server_ip, &bp->bp_siaddr);
-	memcpy(NetServerEther, ((struct ethernet_hdr *)NetRxPacket)->et_src, 6);
+	memcpy(net_server_ethaddr, ((struct ethernet_hdr *)NetRxPacket)->et_src,
+	       6);
 	if (strlen(bp->bp_file) > 0)
 		copy_filename(net_boot_file_name, bp->bp_file,
 			      sizeof(net_boot_file_name));
@@ -693,7 +694,7 @@ BootpRequest(void)
 	pkt = NetTxPacket;
 	memset((void *)pkt, 0, PKTSIZE);
 
-	eth_hdr_size = NetSetEther(pkt, NetBcastAddr, PROT_IP);
+	eth_hdr_size = NetSetEther(pkt, net_bcast_ethaddr, PROT_IP);
 	pkt += eth_hdr_size;
 
 	/*
@@ -719,7 +720,7 @@ BootpRequest(void)
 	net_write_ip(&bp->bp_yiaddr, zero_ip);
 	net_write_ip(&bp->bp_siaddr, zero_ip);
 	net_write_ip(&bp->bp_giaddr, zero_ip);
-	memcpy(bp->bp_chaddr, NetOurEther, 6);
+	memcpy(bp->bp_chaddr, net_ethaddr, 6);
 	copy_filename(bp->bp_file, net_boot_file_name, sizeof(bp->bp_file));
 
 	/* Request additional information from the BOOTP/DHCP server */
@@ -734,10 +735,10 @@ BootpRequest(void)
 	 *	Bootp ID is the lower 4 bytes of our ethernet address
 	 *	plus the current time in ms.
 	 */
-	BootpID = ((ulong)NetOurEther[2] << 24)
-		| ((ulong)NetOurEther[3] << 16)
-		| ((ulong)NetOurEther[4] << 8)
-		| (ulong)NetOurEther[5];
+	BootpID = ((ulong)net_ethaddr[2] << 24)
+		| ((ulong)net_ethaddr[3] << 16)
+		| ((ulong)net_ethaddr[4] << 8)
+		| (ulong)net_ethaddr[5];
 	BootpID += get_timer(0);
 	BootpID = htonl(BootpID);
 	bootp_add_id(BootpID);
@@ -896,7 +897,7 @@ static void DhcpSendRequestPkt(struct Bootp_t *bp_offer)
 	pkt = NetTxPacket;
 	memset((void *)pkt, 0, PKTSIZE);
 
-	eth_hdr_size = NetSetEther(pkt, NetBcastAddr, PROT_IP);
+	eth_hdr_size = NetSetEther(pkt, net_bcast_ethaddr, PROT_IP);
 	pkt += eth_hdr_size;
 
 	iphdr = pkt;	/* We'll need this later to set proper pkt size */
@@ -918,7 +919,7 @@ static void DhcpSendRequestPkt(struct Bootp_t *bp_offer)
 	zero_ip.s_addr = 0;
 	net_write_ip(&bp->bp_giaddr, zero_ip);
 
-	memcpy(bp->bp_chaddr, NetOurEther, 6);
+	memcpy(bp->bp_chaddr, net_ethaddr, 6);
 
 	/*
 	 * ID is the id of the OFFER packet
diff --git a/net/cdp.c b/net/cdp.c
index 2d8fa03..e8e7a67 100644
--- a/net/cdp.c
+++ b/net/cdp.c
@@ -18,7 +18,7 @@
 #include "cdp.h"
 
 /* Ethernet bcast address */
-const uchar NetCDPAddr[6] = { 0x01, 0x00, 0x0c, 0xcc, 0xcc, 0xcc };
+const u8 net_cdp_ethaddr[6] = { 0x01, 0x00, 0x0c, 0xcc, 0xcc, 0xcc };
 
 #define CDP_DEVICE_ID_TLV		0x0001
 #define CDP_ADDRESS_TLV			0x0002
@@ -124,8 +124,8 @@ CDPSendTrigger(void)
 	/* NOTE: trigger sent not on any VLAN */
 
 	/* form ethernet header */
-	memcpy(et->et_dest, NetCDPAddr, 6);
-	memcpy(et->et_src, NetOurEther, 6);
+	memcpy(et->et_dest, net_cdp_ethaddr, 6);
+	memcpy(et->et_src, net_ethaddr, 6);
 
 	pkt += ETHER_HDR_SIZE;
 
@@ -145,7 +145,7 @@ CDPSendTrigger(void)
 #ifdef CONFIG_CDP_DEVICE_ID
 	*s++ = htons(CDP_DEVICE_ID_TLV);
 	*s++ = htons(CONFIG_CDP_DEVICE_ID);
-	sprintf(buf, CONFIG_CDP_DEVICE_ID_PREFIX "%pm", NetOurEther);
+	sprintf(buf, CONFIG_CDP_DEVICE_ID_PREFIX "%pm", net_ethaddr);
 	memcpy((uchar *)s, buf, 16);
 	s += 16 / 2;
 #endif
diff --git a/net/dns.c b/net/dns.c
index 6f8b1f2..0ff2b75 100644
--- a/net/dns.c
+++ b/net/dns.c
@@ -89,7 +89,7 @@ DnsSend(void)
 
 	DnsOurPort = random_port();
 
-	NetSendUDPPacket(NetServerEther, net_dns_server, DNS_SERVICE_PORT,
+	NetSendUDPPacket(net_server_ethaddr, net_dns_server, DNS_SERVICE_PORT,
 			 DnsOurPort, n);
 	debug("DNS packet sent\n");
 }
@@ -203,7 +203,7 @@ DnsStart(void)
 	net_set_udp_handler(dns_handler);
 
 	/* Clear a previous MAC address, the server IP might have changed. */
-	memset(NetServerEther, 0, sizeof(NetServerEther));
+	memset(net_server_ethaddr, 0, sizeof(net_server_ethaddr));
 
 	DnsSend();
 }
diff --git a/net/eth.c b/net/eth.c
index cc81eb7..e936ca0 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -32,7 +32,7 @@ void eth_parse_enetaddr(const char *addr, uchar *enetaddr)
 int eth_getenv_enetaddr(char *name, uchar *enetaddr)
 {
 	eth_parse_enetaddr(getenv(name), enetaddr);
-	return is_valid_ether_addr(enetaddr);
+	return is_valid_ethaddr(enetaddr);
 }
 
 int eth_setenv_enetaddr(char *name, const uchar *enetaddr)
@@ -367,7 +367,7 @@ static int eth_write_hwaddr(struct udevice *dev)
 
 	/* seq is valid since the device is active */
 	if (eth_get_ops(dev)->write_hwaddr && !eth_mac_skip(dev->seq)) {
-		if (!is_valid_ether_addr(pdata->enetaddr)) {
+		if (!is_valid_ethaddr(pdata->enetaddr)) {
 			printf("\nError: %s address %pM illegal value\n",
 			       dev->name, pdata->enetaddr);
 			return -EINVAL;
@@ -468,8 +468,8 @@ static int eth_post_probe(struct udevice *dev)
 		eth_get_ops(dev)->read_rom_hwaddr(dev);
 
 	eth_getenv_enetaddr_by_index("eth", dev->seq, env_enetaddr);
-	if (!is_zero_ether_addr(env_enetaddr)) {
-		if (!is_zero_ether_addr(pdata->enetaddr) &&
+	if (!is_zero_ethaddr(env_enetaddr)) {
+		if (!is_zero_ethaddr(pdata->enetaddr) &&
 		    memcmp(pdata->enetaddr, env_enetaddr, 6)) {
 			printf("\nWarning: %s MAC addresses don't match:\n",
 			       dev->name);
@@ -481,11 +481,11 @@ static int eth_post_probe(struct udevice *dev)
 
 		/* Override the ROM MAC address */
 		memcpy(pdata->enetaddr, env_enetaddr, 6);
-	} else if (is_valid_ether_addr(pdata->enetaddr)) {
+	} else if (is_valid_ethaddr(pdata->enetaddr)) {
 		eth_setenv_enetaddr_by_index("eth", dev->seq, pdata->enetaddr);
 		printf("\nWarning: %s using MAC address from ROM\n",
 		       dev->name);
-	} else if (is_zero_ether_addr(pdata->enetaddr)) {
+	} else if (is_zero_ethaddr(pdata->enetaddr)) {
 		printf("\nError: %s address not set.\n",
 		       dev->name);
 		return -EINVAL;
@@ -606,8 +606,8 @@ int eth_write_hwaddr(struct eth_device *dev, const char *base_name,
 
 	eth_getenv_enetaddr_by_index(base_name, eth_number, env_enetaddr);
 
-	if (!is_zero_ether_addr(env_enetaddr)) {
-		if (!is_zero_ether_addr(dev->enetaddr) &&
+	if (!is_zero_ethaddr(env_enetaddr)) {
+		if (!is_zero_ethaddr(dev->enetaddr) &&
 		    memcmp(dev->enetaddr, env_enetaddr, 6)) {
 			printf("\nWarning: %s MAC addresses don't match:\n",
 				dev->name);
@@ -618,19 +618,19 @@ int eth_write_hwaddr(struct eth_device *dev, const char *base_name,
 		}
 
 		memcpy(dev->enetaddr, env_enetaddr, 6);
-	} else if (is_valid_ether_addr(dev->enetaddr)) {
+	} else if (is_valid_ethaddr(dev->enetaddr)) {
 		eth_setenv_enetaddr_by_index(base_name, eth_number,
 					     dev->enetaddr);
 		printf("\nWarning: %s using MAC address from net device\n",
 			dev->name);
-	} else if (is_zero_ether_addr(dev->enetaddr)) {
+	} else if (is_zero_ethaddr(dev->enetaddr)) {
 		printf("\nError: %s address not set.\n",
 		       dev->name);
 		return -EINVAL;
 	}
 
 	if (dev->write_hwaddr && !eth_mac_skip(eth_number)) {
-		if (!is_valid_ether_addr(dev->enetaddr)) {
+		if (!is_valid_ethaddr(dev->enetaddr)) {
 			printf("\nError: %s address %pM illegal value\n",
 				 dev->name, dev->enetaddr);
 			return -EINVAL;
diff --git a/net/link_local.c b/net/link_local.c
index 6d92c55..2bca7de 100644
--- a/net/link_local.c
+++ b/net/link_local.c
@@ -139,7 +139,7 @@ static void link_local_timeout(void)
 			nprobes++;
 			debug_cond(DEBUG_LL_STATE, "probe/%u %s@%pI4\n",
 					nprobes, eth_get_name(), &ip);
-			arp_raw_request(zero_ip, NetEtherNullAddr, ip);
+			arp_raw_request(zero_ip, net_null_ethaddr, ip);
 			timeout_ms = PROBE_MIN * 1000;
 			timeout_ms += random_delay_ms(PROBE_MAX - PROBE_MIN);
 		} else {
@@ -148,7 +148,7 @@ static void link_local_timeout(void)
 			nclaims = 0;
 			debug_cond(DEBUG_LL_STATE, "announce/%u %s@%pI4\n",
 					nclaims, eth_get_name(), &ip);
-			arp_raw_request(ip, NetOurEther, ip);
+			arp_raw_request(ip, net_ethaddr, ip);
 			timeout_ms = ANNOUNCE_INTERVAL * 1000;
 		}
 		break;
@@ -160,7 +160,7 @@ static void link_local_timeout(void)
 		nclaims = 0;
 		debug_cond(DEBUG_LL_STATE, "announce/%u %s@%pI4\n",
 				nclaims, eth_get_name(), &ip);
-		arp_raw_request(ip, NetOurEther, ip);
+		arp_raw_request(ip, net_ethaddr, ip);
 		timeout_ms = ANNOUNCE_INTERVAL * 1000;
 		break;
 	case ANNOUNCE:
@@ -171,7 +171,7 @@ static void link_local_timeout(void)
 			nclaims++;
 			debug_cond(DEBUG_LL_STATE, "announce/%u %s@%pI4\n",
 					nclaims, eth_get_name(), &ip);
-			arp_raw_request(ip, NetOurEther, ip);
+			arp_raw_request(ip, net_ethaddr, ip);
 			timeout_ms = ANNOUNCE_INTERVAL * 1000;
 		} else {
 			/* Switch to monitor state */
@@ -268,11 +268,9 @@ void link_local_receive_arp(struct arp_hdr *arp, int len)
 	source_ip_conflict = 0;
 	target_ip_conflict = 0;
 
-	if (memcmp(&arp->ar_spa, &ip, ARP_PLEN) == 0
-	 && memcmp(&arp->ar_sha, NetOurEther, ARP_HLEN) != 0
-	) {
+	if (memcmp(&arp->ar_spa, &ip, ARP_PLEN) == 0 &&
+	    memcmp(&arp->ar_sha, net_ethaddr, ARP_HLEN) != 0)
 		source_ip_conflict = 1;
-	}
 
 	/*
 	 * According to RFC 3927, section 2.2.1:
@@ -284,7 +282,7 @@ void link_local_receive_arp(struct arp_hdr *arp, int len)
 	if (arp->ar_op == htons(ARPOP_REQUEST) &&
 	    memcmp(&arp->ar_spa, &null_ip, ARP_PLEN) == 0 &&
 	    memcmp(&arp->ar_tpa, &ip, ARP_PLEN) == 0 &&
-	    memcmp(&arp->ar_sha, NetOurEther, ARP_HLEN) != 0) {
+	    memcmp(&arp->ar_sha, net_ethaddr, ARP_HLEN) != 0) {
 		target_ip_conflict = 1;
 	}
 
@@ -318,7 +316,7 @@ void link_local_receive_arp(struct arp_hdr *arp, int len)
 			debug("monitor conflict -- defending\n");
 			state = DEFEND;
 			timeout_ms = DEFEND_INTERVAL * 1000;
-			arp_raw_request(ip, NetOurEther, ip);
+			arp_raw_request(ip, net_ethaddr, ip);
 		}
 		break;
 	case DEFEND:
diff --git a/net/net.c b/net/net.c
index bfa326e..6db2b9c 100644
--- a/net/net.c
+++ b/net/net.c
@@ -129,9 +129,9 @@ struct in_addr net_mcast_addr;
 /** END OF BOOTP EXTENTIONS **/
 
 /* Our ethernet address */
-uchar		NetOurEther[6];
+u8 net_ethaddr[6];
 /* Boot server enet address */
-uchar		NetServerEther[6];
+u8 net_server_ethaddr[6];
 /* Our IP addr (0 = unknown) */
 struct in_addr	net_ip;
 /* Server IP addr (0 = unknown) */
@@ -143,8 +143,8 @@ int		NetRxPacketLen;
 /* IP packet ID */
 unsigned	NetIPID;
 /* Ethernet bcast address */
-uchar		NetBcastAddr[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
-uchar		NetEtherNullAddr[6];
+const u8 net_bcast_ethaddr[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
+const u8 net_null_ethaddr[6];
 #ifdef CONFIG_API
 void		(*push_packet)(void *, int len) = 0;
 #endif
@@ -274,7 +274,7 @@ static void NetInitLoop(void)
 		env_changed_id = env_id;
 	}
 	if (eth_get_dev())
-		memcpy(NetOurEther, eth_get_ethaddr(), 6);
+		memcpy(net_ethaddr, eth_get_ethaddr(), 6);
 
 	return;
 }
@@ -728,7 +728,7 @@ int NetSendUDPPacket(uchar *ether, struct in_addr dest, int dport, int sport,
 
 	/* if broadcast, make the ether address a broadcast and don't do ARP */
 	if (dest.s_addr == 0xFFFFFFFF)
-		ether = NetBcastAddr;
+		ether = (uchar *)net_bcast_ethaddr;
 
 	pkt = (uchar *)NetTxPacket;
 
@@ -738,7 +738,7 @@ int NetSendUDPPacket(uchar *ether, struct in_addr dest, int dport, int sport,
 	pkt_hdr_size = eth_hdr_size + IP_UDP_HDR_SIZE;
 
 	/* if MAC address was not discovered yet, do an ARP request */
-	if (memcmp(ether, NetEtherNullAddr, 6) == 0) {
+	if (memcmp(ether, net_null_ethaddr, 6) == 0) {
 		debug_cond(DEBUG_DEV_PKT, "sending ARP for %pI4\n", &dest);
 
 		/* save the ip and eth addr for the packet to send after arp */
@@ -1279,7 +1279,7 @@ common:
 	case CDP:
 	case DHCP:
 	case LINKLOCAL:
-		if (memcmp(NetOurEther, "\0\0\0\0\0\0", 6) == 0) {
+		if (memcmp(net_ethaddr, "\0\0\0\0\0\0", 6) == 0) {
 			int num = eth_get_dev_index();
 
 			switch (num) {
@@ -1320,7 +1320,7 @@ NetEthHdrSize(void)
 }
 
 int
-NetSetEther(uchar *xet, uchar * addr, uint prot)
+NetSetEther(uchar *xet, const uchar *dest_ethaddr, uint prot)
 {
 	struct ethernet_hdr *et = (struct ethernet_hdr *)xet;
 	ushort myvlanid;
@@ -1329,8 +1329,8 @@ NetSetEther(uchar *xet, uchar * addr, uint prot)
 	if (myvlanid == (ushort)-1)
 		myvlanid = VLAN_NONE;
 
-	memcpy(et->et_dest, addr, 6);
-	memcpy(et->et_src, NetOurEther, 6);
+	memcpy(et->et_dest, dest_ethaddr, 6);
+	memcpy(et->et_src, net_ethaddr, 6);
 	if ((myvlanid & VLAN_IDMASK) == VLAN_NONE) {
 		et->et_protlen = htons(prot);
 		return ETHER_HDR_SIZE;
@@ -1350,7 +1350,7 @@ int net_update_ether(struct ethernet_hdr *et, uchar *addr, uint prot)
 	ushort protlen;
 
 	memcpy(et->et_dest, addr, 6);
-	memcpy(et->et_src, NetOurEther, 6);
+	memcpy(et->et_src, net_ethaddr, 6);
 	protlen = ntohs(et->et_protlen);
 	if (protlen == PROT_VLAN) {
 		struct vlan_ethernet_hdr *vet =
diff --git a/net/nfs.c b/net/nfs.c
index 1e5c1c3..23a9cc3 100644
--- a/net/nfs.c
+++ b/net/nfs.c
@@ -211,7 +211,7 @@ rpc_req(int rpc_prog, int rpc_proc, uint32_t *data, int datalen)
 	else
 		sport = NfsSrvNfsPort;
 
-	NetSendUDPPacket(NetServerEther, nfs_server_ip, sport, NfsOurPort,
+	NetSendUDPPacket(net_server_ethaddr, nfs_server_ip, sport, NfsOurPort,
 			 pktlen);
 }
 
@@ -788,7 +788,7 @@ NfsStart(void)
 	NfsOurPort = 1000;
 
 	/* zero out server ether in case the server ip has changed */
-	memset(NetServerEther, 0, 6);
+	memset(net_server_ethaddr, 0, 6);
 
 	NfsSend();
 }
diff --git a/net/ping.c b/net/ping.c
index 4918a1c..e4e3086 100644
--- a/net/ping.c
+++ b/net/ping.c
@@ -50,7 +50,7 @@ static int ping_send(void)
 
 	net_arp_wait_packet_ip = net_ping_ip;
 
-	eth_hdr_size = NetSetEther(NetTxPacket, NetEtherNullAddr, PROT_IP);
+	eth_hdr_size = NetSetEther(NetTxPacket, net_null_ethaddr, PROT_IP);
 	pkt = (uchar *)NetTxPacket + eth_hdr_size;
 
 	set_icmp_header(pkt, net_ping_ip);
diff --git a/net/rarp.c b/net/rarp.c
index 3e1c74c..2f5c104 100644
--- a/net/rarp.c
+++ b/net/rarp.c
@@ -46,7 +46,7 @@ void rarp_receive(struct ip_udp_hdr *ip, unsigned len)
 		net_copy_ip(&net_ip, &arp->ar_data[16]);
 		if (net_server_ip.s_addr == 0)
 			net_copy_ip(&net_server_ip, &arp->ar_data[6]);
-		memcpy(NetServerEther, &arp->ar_data[0], 6);
+		memcpy(net_server_ethaddr, &arp->ar_data[0], 6);
 		debug_cond(DEBUG_DEV_PKT, "Got good RARP\n");
 		net_auto_load();
 	}
@@ -77,7 +77,7 @@ void RarpRequest(void)
 	printf("RARP broadcast %d\n", ++RarpTry);
 	pkt = NetTxPacket;
 
-	eth_hdr_size = NetSetEther(pkt, NetBcastAddr, PROT_RARP);
+	eth_hdr_size = NetSetEther(pkt, net_bcast_ethaddr, PROT_RARP);
 	pkt += eth_hdr_size;
 
 	rarp = (struct arp_hdr *)pkt;
@@ -87,10 +87,10 @@ void RarpRequest(void)
 	rarp->ar_hln = 6;
 	rarp->ar_pln = 4;
 	rarp->ar_op  = htons(RARPOP_REQUEST);
-	memcpy(&rarp->ar_data[0],  NetOurEther, 6);	/* source ET addr */
+	memcpy(&rarp->ar_data[0],  net_ethaddr, 6);	/* source ET addr */
 	memcpy(&rarp->ar_data[6],  &net_ip,   4);	/* source IP addr */
 	/* dest ET addr = source ET addr ??*/
-	memcpy(&rarp->ar_data[10], NetOurEther, 6);
+	memcpy(&rarp->ar_data[10], net_ethaddr, 6);
 	/* dest IP addr set to broadcast */
 	memset(&rarp->ar_data[16], 0xff,        4);
 
diff --git a/net/sntp.c b/net/sntp.c
index 3e45a83..b99aa3e 100644
--- a/net/sntp.c
+++ b/net/sntp.c
@@ -37,7 +37,7 @@ SntpSend(void)
 	SntpOurPort = 10000 + (get_timer(0) % 4096);
 	sport = NTP_SERVICE_PORT;
 
-	NetSendUDPPacket(NetServerEther, net_ntp_server, sport, SntpOurPort,
+	NetSendUDPPacket(net_server_ethaddr, net_ntp_server, sport, SntpOurPort,
 			 pktlen);
 }
 
@@ -85,7 +85,7 @@ SntpStart(void)
 
 	NetSetTimeout(SNTP_TIMEOUT, SntpTimeout);
 	net_set_udp_handler(sntp_handler);
-	memset(NetServerEther, 0, sizeof(NetServerEther));
+	memset(net_server_ethaddr, 0, sizeof(net_server_ethaddr));
 
 	SntpSend();
 }
diff --git a/net/tftp.c b/net/tftp.c
index bafc354..8ddc7be 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -435,7 +435,7 @@ TftpSend(void)
 		break;
 	}
 
-	NetSendUDPPacket(NetServerEther, tftp_remote_ip, TftpRemotePort,
+	NetSendUDPPacket(net_server_ethaddr, tftp_remote_ip, TftpRemotePort,
 			 TftpOurPort, len);
 }
 
@@ -816,7 +816,7 @@ void TftpStart(enum proto_t protocol)
 	TftpBlock = 0;
 
 	/* zero out server ether in case the server ip has changed */
-	memset(NetServerEther, 0, 6);
+	memset(net_server_ethaddr, 0, 6);
 	/* Revert TftpBlkSize to dflt */
 	TftpBlkSize = TFTP_BLOCK_SIZE;
 #ifdef CONFIG_MCAST_TFTP
@@ -861,7 +861,7 @@ TftpStartServer(void)
 	net_set_udp_handler(tftp_handler);
 
 	/* zero out server ether in case the server ip has changed */
-	memset(NetServerEther, 0, 6);
+	memset(net_server_ethaddr, 0, 6);
 }
 #endif /* CONFIG_CMD_TFTPSRV */
 
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 05/25] net: cosmetic: Cleanup internal packet buffer names
  2015-04-08  6:41 ` [U-Boot] [PATCH v2 0/25] " Joe Hershberger
                     ` (3 preceding siblings ...)
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 04/25] net: cosmetic: Name ethaddr variables consistently Joe Hershberger
@ 2015-04-08  6:41   ` Joe Hershberger
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 06/25] net: cosmetic: Fix var naming net <-> eth drivers Joe Hershberger
                     ` (20 subsequent siblings)
  25 siblings, 0 replies; 103+ messages in thread
From: Joe Hershberger @ 2015-04-08  6:41 UTC (permalink / raw)
  To: u-boot

This patch cleans up the names of internal packet buffer names that are
used within the network stack and the functions that use them.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

Changes in v2: None

 arch/powerpc/cpu/mpc8260/ether_fcc.c |  4 ++--
 drivers/net/netconsole.c             | 13 +++++------
 include/net.h                        | 16 +++++++-------
 net/arp.c                            | 20 ++++++++---------
 net/bootp.c                          | 16 +++++++-------
 net/cdp.c                            | 10 ++++-----
 net/dns.c                            |  7 +++---
 net/net.c                            | 42 ++++++++++++++++++------------------
 net/nfs.c                            |  8 +++----
 net/ping.c                           |  6 +++---
 net/rarp.c                           |  6 +++---
 net/sntp.c                           |  8 +++----
 net/tftp.c                           |  6 +++---
 13 files changed, 82 insertions(+), 80 deletions(-)

diff --git a/arch/powerpc/cpu/mpc8260/ether_fcc.c b/arch/powerpc/cpu/mpc8260/ether_fcc.c
index 240e7ae..50d1654 100644
--- a/arch/powerpc/cpu/mpc8260/ether_fcc.c
+++ b/arch/powerpc/cpu/mpc8260/ether_fcc.c
@@ -720,8 +720,8 @@ eth_loopback_test (void)
 			bdp->cbd_sc = BD_ENET_TX_READY | BD_ENET_TX_PAD | \
 				BD_ENET_TX_LAST | BD_ENET_TX_TC;
 
-			memset ((void *)bp, patbytes[i], ELBT_BUFSZ);
-			NetSetEther(bp, net_bcast_ethaddr, 0x8000);
+			memset((void *)bp, patbytes[i], ELBT_BUFSZ);
+			net_set_ether(bp, net_bcast_ethaddr, 0x8000);
 		}
 		ecp->txbd[ELBT_NTXBD - 1].cbd_sc |= BD_ENET_TX_WRAP;
 
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index 0d81b44..9aba0c5 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -125,10 +125,11 @@ void NcStart(void)
 		/* send arp request */
 		uchar *pkt;
 		net_set_arp_handler(nc_wait_arp_handler);
-		pkt = (uchar *)NetTxPacket + NetEthHdrSize() + IP_UDP_HDR_SIZE;
+		pkt = (uchar *)net_tx_packet + net_eth_hdr_size() +
+			IP_UDP_HDR_SIZE;
 		memcpy(pkt, output_packet, output_packet_len);
-		NetSendUDPPacket(nc_ether, nc_ip, nc_out_port, nc_in_port,
-			output_packet_len);
+		net_send_udp_packet(nc_ether, nc_ip, nc_out_port, nc_in_port,
+				    output_packet_len);
 	}
 }
 
@@ -202,11 +203,11 @@ static void nc_send_packet(const char *buf, int len)
 
 		inited = 1;
 	}
-	pkt = (uchar *)NetTxPacket + NetEthHdrSize() + IP_UDP_HDR_SIZE;
+	pkt = (uchar *)net_tx_packet + net_eth_hdr_size() + IP_UDP_HDR_SIZE;
 	memcpy(pkt, buf, len);
 	ether = nc_ether;
 	ip = nc_ip;
-	NetSendUDPPacket(ether, ip, nc_out_port, nc_in_port, len);
+	net_send_udp_packet(ether, ip, nc_out_port, nc_in_port, len);
 
 	if (inited) {
 		if (eth_is_on_demand_init())
@@ -229,7 +230,7 @@ static int nc_start(struct stdio_dev *dev)
 
 	/*
 	 * Initialize the static IP settings and buffer pointers
-	 * incase we call NetSendUDPPacket before NetLoop
+	 * incase we call net_send_udp_packet before NetLoop
 	 */
 	net_init();
 
diff --git a/include/net.h b/include/net.h
index 33e542f..18ae7d2 100644
--- a/include/net.h
+++ b/include/net.h
@@ -475,14 +475,14 @@ extern u8		net_ethaddr[6];		/* Our ethernet address */
 extern u8		net_server_ethaddr[6];	/* Boot server enet address */
 extern struct in_addr	net_ip;		/* Our    IP addr (0 = unknown) */
 extern struct in_addr	net_server_ip;	/* Server IP addr (0 = unknown) */
-extern uchar		*NetTxPacket;		/* THE transmit packet */
+extern uchar		*net_tx_packet;		/* THE transmit packet */
 #ifdef CONFIG_DM_ETH
 extern uchar		*net_rx_packets[PKTBUFSRX]; /* Receive packets */
 #else
 extern uchar		*NetRxPackets[PKTBUFSRX]; /* Receive packets */
 #endif
-extern uchar		*NetRxPacket;		/* Current receive packet */
-extern int		NetRxPacketLen;		/* Current rx packet length */
+extern uchar		*net_rx_packet;		/* Current receive packet */
+extern int		net_rx_packet_len;	/* Current rx packet length */
 extern unsigned		NetIPID;		/* IP ID (counting) */
 extern const u8		net_bcast_ethaddr[6];	/* Ethernet broadcast address */
 extern const u8		net_null_ethaddr[6];
@@ -550,10 +550,10 @@ void	NetStop(void);
 int	NetStartAgain(void);
 
 /* Get size of the ethernet header when we send */
-int	NetEthHdrSize(void);
+int net_eth_hdr_size(void);
 
 /* Set ethernet header; returns the size of the header */
-int NetSetEther(uchar *xet, const uchar *dest_ethaddr, uint prot);
+int net_set_ether(uchar *xet, const uchar *dest_ethaddr, uint prot);
 int net_update_ether(struct ethernet_hdr *et, uchar *addr, uint prot);
 
 /* Set IP header */
@@ -615,14 +615,14 @@ static inline void net_set_state(enum net_loop_state state)
 }
 
 /* Transmit a packet */
-static inline void NetSendPacket(uchar *pkt, int len)
+static inline void net_send_packet(uchar *pkt, int len)
 {
 	/* Currently no way to return errors from eth_send() */
 	(void) eth_send(pkt, len);
 }
 
 /*
- * Transmit "NetTxPacket" as UDP packet, performing ARP request if needed
+ * Transmit "net_tx_packet" as UDP packet, performing ARP request if needed
  *  (ether will be populated)
  *
  * @param ether Raw packet buffer
@@ -631,7 +631,7 @@ static inline void NetSendPacket(uchar *pkt, int len)
  * @param sport Source UDP port
  * @param payload_len Length of data after the UDP header
  */
-int NetSendUDPPacket(uchar *ether, struct in_addr dest, int dport,
+int net_send_udp_packet(uchar *ether, struct in_addr dest, int dport,
 			int sport, int payload_len);
 
 #ifndef CONFIG_DM_ETH
diff --git a/net/arp.c b/net/arp.c
index c613609..6841b61 100644
--- a/net/arp.c
+++ b/net/arp.c
@@ -35,7 +35,7 @@ int		NetArpWaitTxPacketSize;
 ulong		NetArpWaitTimerStart;
 int		NetArpWaitTry;
 
-static uchar   *NetArpTxPacket;	/* THE ARP transmit packet */
+static uchar   *net_arp_tx_packet;	/* THE ARP transmit packet */
 static uchar	NetArpPacketBuf[PKTSIZE_ALIGN + PKTALIGN];
 
 void ArpInit(void)
@@ -45,8 +45,8 @@ void ArpInit(void)
 	net_arp_wait_packet_ip.s_addr = 0;
 	net_arp_wait_reply_ip.s_addr = 0;
 	NetArpWaitTxPacketSize = 0;
-	NetArpTxPacket = &NetArpPacketBuf[0] + (PKTALIGN - 1);
-	NetArpTxPacket -= (ulong)NetArpTxPacket % PKTALIGN;
+	net_arp_tx_packet = &NetArpPacketBuf[0] + (PKTALIGN - 1);
+	net_arp_tx_packet -= (ulong)net_arp_tx_packet % PKTALIGN;
 }
 
 void arp_raw_request(struct in_addr source_ip, const uchar *targetEther,
@@ -58,9 +58,9 @@ void arp_raw_request(struct in_addr source_ip, const uchar *targetEther,
 
 	debug_cond(DEBUG_DEV_PKT, "ARP broadcast %d\n", NetArpWaitTry);
 
-	pkt = NetArpTxPacket;
+	pkt = net_arp_tx_packet;
 
-	eth_hdr_size = NetSetEther(pkt, net_bcast_ethaddr, PROT_ARP);
+	eth_hdr_size = net_set_ether(pkt, net_bcast_ethaddr, PROT_ARP);
 	pkt += eth_hdr_size;
 
 	arp = (struct arp_hdr *) pkt;
@@ -76,7 +76,7 @@ void arp_raw_request(struct in_addr source_ip, const uchar *targetEther,
 	memcpy(&arp->ar_tha, targetEther, ARP_HLEN);	/* target ET addr */
 	net_write_ip(&arp->ar_tpa, target_ip);		/* target IP addr */
 
-	NetSendPacket(NetArpTxPacket, eth_hdr_size + ARP_HDR_SIZE);
+	net_send_packet(net_arp_tx_packet, eth_hdr_size + ARP_HDR_SIZE);
 }
 
 void ArpRequest(void)
@@ -184,7 +184,7 @@ void ArpReceive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
 		    (net_read_ip(&arp->ar_spa).s_addr & net_netmask.s_addr))
 			udelay(5000);
 #endif
-		NetSendPacket((uchar *)et, eth_hdr_size + ARP_HDR_SIZE);
+		net_send_packet((uchar *)et, eth_hdr_size + ARP_HDR_SIZE);
 		return;
 
 	case ARPOP_REPLY:		/* arp reply */
@@ -218,9 +218,9 @@ void ArpReceive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
 
 			/* set the mac address in the waiting packet's header
 			   and transmit it */
-			memcpy(((struct ethernet_hdr *)NetTxPacket)->et_dest,
-				&arp->ar_sha, ARP_HLEN);
-			NetSendPacket(NetTxPacket, NetArpWaitTxPacketSize);
+			memcpy(((struct ethernet_hdr *)net_tx_packet)->et_dest,
+			       &arp->ar_sha, ARP_HLEN);
+			net_send_packet(net_tx_packet, NetArpWaitTxPacketSize);
 
 			/* no arp request pending now */
 			net_arp_wait_packet_ip.s_addr = 0;
diff --git a/net/bootp.c b/net/bootp.c
index 9b27d4c..9788b52 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -147,8 +147,8 @@ static void BootpCopyNetParams(struct Bootp_t *bp)
 	net_copy_ip(&tmp_ip, &bp->bp_siaddr);
 	if (tmp_ip.s_addr != 0)
 		net_copy_ip(&net_server_ip, &bp->bp_siaddr);
-	memcpy(net_server_ethaddr, ((struct ethernet_hdr *)NetRxPacket)->et_src,
-	       6);
+	memcpy(net_server_ethaddr,
+	       ((struct ethernet_hdr *)net_rx_packet)->et_src, 6);
 	if (strlen(bp->bp_file) > 0)
 		copy_filename(net_boot_file_name, bp->bp_file,
 			      sizeof(net_boot_file_name));
@@ -691,10 +691,10 @@ BootpRequest(void)
 #endif	/* CONFIG_BOOTP_RANDOM_DELAY */
 
 	printf("BOOTP broadcast %d\n", ++BootpTry);
-	pkt = NetTxPacket;
+	pkt = net_tx_packet;
 	memset((void *)pkt, 0, PKTSIZE);
 
-	eth_hdr_size = NetSetEther(pkt, net_bcast_ethaddr, PROT_IP);
+	eth_hdr_size = net_set_ether(pkt, net_bcast_ethaddr, PROT_IP);
 	pkt += eth_hdr_size;
 
 	/*
@@ -760,7 +760,7 @@ BootpRequest(void)
 #else
 	net_set_udp_handler(bootp_handler);
 #endif
-	NetSendPacket(NetTxPacket, pktlen);
+	net_send_packet(net_tx_packet, pktlen);
 }
 
 #if defined(CONFIG_CMD_DHCP)
@@ -894,10 +894,10 @@ static void DhcpSendRequestPkt(struct Bootp_t *bp_offer)
 	struct in_addr bcast_ip;
 
 	debug("DhcpSendRequestPkt: Sending DHCPREQUEST\n");
-	pkt = NetTxPacket;
+	pkt = net_tx_packet;
 	memset((void *)pkt, 0, PKTSIZE);
 
-	eth_hdr_size = NetSetEther(pkt, net_bcast_ethaddr, PROT_IP);
+	eth_hdr_size = net_set_ether(pkt, net_bcast_ethaddr, PROT_IP);
 	pkt += eth_hdr_size;
 
 	iphdr = pkt;	/* We'll need this later to set proper pkt size */
@@ -945,7 +945,7 @@ static void DhcpSendRequestPkt(struct Bootp_t *bp_offer)
 	udelay(CONFIG_BOOTP_DHCP_REQUEST_DELAY);
 #endif	/* CONFIG_BOOTP_DHCP_REQUEST_DELAY */
 	debug("Transmitting DHCPREQUEST packet: len = %d\n", pktlen);
-	NetSendPacket(NetTxPacket, pktlen);
+	net_send_packet(net_tx_packet, pktlen);
 }
 
 /*
diff --git a/net/cdp.c b/net/cdp.c
index e8e7a67..392437d 100644
--- a/net/cdp.c
+++ b/net/cdp.c
@@ -118,7 +118,7 @@ CDPSendTrigger(void)
 	char buf[32];
 #endif
 
-	pkt = NetTxPacket;
+	pkt = net_tx_packet;
 	et = (struct ethernet_hdr *)pkt;
 
 	/* NOTE: trigger sent not on any VLAN */
@@ -207,17 +207,17 @@ CDPSendTrigger(void)
 #endif
 
 	/* length of ethernet packet */
-	len = (uchar *)s - ((uchar *)NetTxPacket + ETHER_HDR_SIZE);
+	len = (uchar *)s - ((uchar *)net_tx_packet + ETHER_HDR_SIZE);
 	et->et_protlen = htons(len);
 
 	len = ETHER_HDR_SIZE + sizeof(CDP_SNAP_hdr);
-	chksum = CDP_compute_csum((uchar *)NetTxPacket + len,
-				  (uchar *)s - (NetTxPacket + len));
+	chksum = CDP_compute_csum((uchar *)net_tx_packet + len,
+				  (uchar *)s - (net_tx_packet + len));
 	if (chksum == 0)
 		chksum = 0xFFFF;
 	*cp = htons(chksum);
 
-	NetSendPacket(NetTxPacket, (uchar *)s - NetTxPacket);
+	net_send_packet(net_tx_packet, (uchar *)s - net_tx_packet);
 	return 0;
 }
 
diff --git a/net/dns.c b/net/dns.c
index 0ff2b75..50d78ae 100644
--- a/net/dns.c
+++ b/net/dns.c
@@ -45,7 +45,8 @@ DnsSend(void)
 	enum dns_query_type qtype = DNS_A_RECORD;
 
 	name = NetDNSResolve;
-	pkt = p = (uchar *)(NetTxPacket + NetEthHdrSize() + IP_UDP_HDR_SIZE);
+	pkt = (uchar *)(net_tx_packet + net_eth_hdr_size() + IP_UDP_HDR_SIZE);
+	p = pkt;
 
 	/* Prepare DNS packet header */
 	header           = (struct header *) pkt;
@@ -89,8 +90,8 @@ DnsSend(void)
 
 	DnsOurPort = random_port();
 
-	NetSendUDPPacket(net_server_ethaddr, net_dns_server, DNS_SERVICE_PORT,
-			 DnsOurPort, n);
+	net_send_udp_packet(net_server_ethaddr, net_dns_server,
+			    DNS_SERVICE_PORT, DnsOurPort, n);
 	debug("DNS packet sent\n");
 }
 
diff --git a/net/net.c b/net/net.c
index 6db2b9c..0e8e9c9 100644
--- a/net/net.c
+++ b/net/net.c
@@ -137,9 +137,9 @@ struct in_addr	net_ip;
 /* Server IP addr (0 = unknown) */
 struct in_addr	net_server_ip;
 /* Current receive packet */
-uchar *NetRxPacket;
+uchar *net_rx_packet;
 /* Current rx packet length */
-int		NetRxPacketLen;
+int		net_rx_packet_len;
 /* IP packet ID */
 unsigned	NetIPID;
 /* Ethernet bcast address */
@@ -177,7 +177,7 @@ struct in_addr	net_ntp_server;
 int		NetTimeOffset;
 #endif
 
-static uchar PktBuf[(PKTBUFSRX+1) * PKTSIZE_ALIGN + PKTALIGN];
+static uchar net_pkt_buf[(PKTBUFSRX+1) * PKTSIZE_ALIGN + PKTALIGN];
 #ifdef CONFIG_DM_ETH
 /* Receive packets */
 uchar *net_rx_packets[PKTBUFSRX];
@@ -200,7 +200,7 @@ static ulong	timeStart;
 /* Current timeout value */
 static ulong	timeDelta;
 /* THE transmit packet */
-uchar *NetTxPacket;
+uchar *net_tx_packet;
 
 static int net_check_prereq(enum proto_t protocol);
 
@@ -301,16 +301,17 @@ void net_init(void)
 		 */
 		int i;
 
-		NetTxPacket = &PktBuf[0] + (PKTALIGN - 1);
-		NetTxPacket -= (ulong)NetTxPacket % PKTALIGN;
+		net_tx_packet = &net_pkt_buf[0] + (PKTALIGN - 1);
+		net_tx_packet -= (ulong)net_tx_packet % PKTALIGN;
 #ifdef CONFIG_DM_ETH
 		for (i = 0; i < PKTBUFSRX; i++) {
-			net_rx_packets[i] = NetTxPacket + (i + 1) *
-				PKTSIZE_ALIGN;
+			net_rx_packets[i] = net_tx_packet +
+				(i + 1) * PKTSIZE_ALIGN;
 		}
 #else
 		for (i = 0; i < PKTBUFSRX; i++)
-			NetRxPackets[i] = NetTxPacket + (i + 1) * PKTSIZE_ALIGN;
+			NetRxPackets[i] = net_tx_packet +
+				(i + 1) * PKTSIZE_ALIGN;
 #endif
 		ArpInit();
 		net_clear_handlers();
@@ -710,16 +711,16 @@ NetSetTimeout(ulong iv, thand_f *f)
 	}
 }
 
-int NetSendUDPPacket(uchar *ether, struct in_addr dest, int dport, int sport,
+int net_send_udp_packet(uchar *ether, struct in_addr dest, int dport, int sport,
 		int payload_len)
 {
 	uchar *pkt;
 	int eth_hdr_size;
 	int pkt_hdr_size;
 
-	/* make sure the NetTxPacket is initialized (NetInit() was called) */
-	assert(NetTxPacket != NULL);
-	if (NetTxPacket == NULL)
+	/* make sure the net_tx_packet is initialized (NetInit() was called) */
+	assert(net_tx_packet != NULL);
+	if (net_tx_packet == NULL)
 		return -1;
 
 	/* convert to new style broadcast */
@@ -730,9 +731,9 @@ int NetSendUDPPacket(uchar *ether, struct in_addr dest, int dport, int sport,
 	if (dest.s_addr == 0xFFFFFFFF)
 		ether = (uchar *)net_bcast_ethaddr;
 
-	pkt = (uchar *)NetTxPacket;
+	pkt = (uchar *)net_tx_packet;
 
-	eth_hdr_size = NetSetEther(pkt, ether, PROT_IP);
+	eth_hdr_size = net_set_ether(pkt, ether, PROT_IP);
 	pkt += eth_hdr_size;
 	net_set_udp_header(pkt, dest, dport, sport, payload_len);
 	pkt_hdr_size = eth_hdr_size + IP_UDP_HDR_SIZE;
@@ -756,7 +757,7 @@ int NetSendUDPPacket(uchar *ether, struct in_addr dest, int dport, int sport,
 	} else {
 		debug_cond(DEBUG_DEV_PKT, "sending UDP to %pI4/%pM\n",
 			&dest, ether);
-		NetSendPacket(NetTxPacket, pkt_hdr_size + payload_len);
+		net_send_packet(net_tx_packet, pkt_hdr_size + payload_len);
 		return 0;	/* transmitted */
 	}
 }
@@ -979,8 +980,8 @@ void net_process_received_packet(uchar *in_packet, int len)
 
 	debug_cond(DEBUG_NET_PKT, "packet received\n");
 
-	NetRxPacket = in_packet;
-	NetRxPacketLen = len;
+	net_rx_packet = in_packet;
+	net_rx_packet_len = len;
 	et = (struct ethernet_hdr *)in_packet;
 
 	/* too small packet? */
@@ -1307,7 +1308,7 @@ common:
 /**********************************************************************/
 
 int
-NetEthHdrSize(void)
+net_eth_hdr_size(void)
 {
 	ushort myvlanid;
 
@@ -1319,8 +1320,7 @@ NetEthHdrSize(void)
 		VLAN_ETHER_HDR_SIZE;
 }
 
-int
-NetSetEther(uchar *xet, const uchar *dest_ethaddr, uint prot)
+int net_set_ether(uchar *xet, const uchar *dest_ethaddr, uint prot)
 {
 	struct ethernet_hdr *et = (struct ethernet_hdr *)xet;
 	ushort myvlanid;
diff --git a/net/nfs.c b/net/nfs.c
index 23a9cc3..6899265 100644
--- a/net/nfs.c
+++ b/net/nfs.c
@@ -201,8 +201,8 @@ rpc_req(int rpc_prog, int rpc_proc, uint32_t *data, int datalen)
 
 	pktlen = (char *)p + datalen*sizeof(uint32_t) - (char *)&pkt;
 
-	memcpy((char *)NetTxPacket + NetEthHdrSize() + IP_UDP_HDR_SIZE,
-		(char *)&pkt, pktlen);
+	memcpy((char *)net_tx_packet + net_eth_hdr_size() + IP_UDP_HDR_SIZE,
+	       (char *)&pkt, pktlen);
 
 	if (rpc_prog == PROG_PORTMAP)
 		sport = SUNRPC_PORT;
@@ -211,8 +211,8 @@ rpc_req(int rpc_prog, int rpc_proc, uint32_t *data, int datalen)
 	else
 		sport = NfsSrvNfsPort;
 
-	NetSendUDPPacket(net_server_ethaddr, nfs_server_ip, sport, NfsOurPort,
-			 pktlen);
+	net_send_udp_packet(net_server_ethaddr, nfs_server_ip, sport,
+			    NfsOurPort, pktlen);
 }
 
 /**************************************************************************
diff --git a/net/ping.c b/net/ping.c
index e4e3086..7c6084c 100644
--- a/net/ping.c
+++ b/net/ping.c
@@ -50,8 +50,8 @@ static int ping_send(void)
 
 	net_arp_wait_packet_ip = net_ping_ip;
 
-	eth_hdr_size = NetSetEther(NetTxPacket, net_null_ethaddr, PROT_IP);
-	pkt = (uchar *)NetTxPacket + eth_hdr_size;
+	eth_hdr_size = net_set_ether(net_tx_packet, net_null_ethaddr, PROT_IP);
+	pkt = (uchar *)net_tx_packet + eth_hdr_size;
 
 	set_icmp_header(pkt, net_ping_ip);
 
@@ -106,7 +106,7 @@ void ping_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
 		icmph->type = ICMP_ECHO_REPLY;
 		icmph->checksum = 0;
 		icmph->checksum = compute_ip_checksum(icmph, len - IP_HDR_SIZE);
-		NetSendPacket((uchar *)et, eth_hdr_size + len);
+		net_send_packet((uchar *)et, eth_hdr_size + len);
 		return;
 /*	default:
 		return;*/
diff --git a/net/rarp.c b/net/rarp.c
index 2f5c104..f50d2fb 100644
--- a/net/rarp.c
+++ b/net/rarp.c
@@ -75,9 +75,9 @@ void RarpRequest(void)
 	int eth_hdr_size;
 
 	printf("RARP broadcast %d\n", ++RarpTry);
-	pkt = NetTxPacket;
+	pkt = net_tx_packet;
 
-	eth_hdr_size = NetSetEther(pkt, net_bcast_ethaddr, PROT_RARP);
+	eth_hdr_size = net_set_ether(pkt, net_bcast_ethaddr, PROT_RARP);
 	pkt += eth_hdr_size;
 
 	rarp = (struct arp_hdr *)pkt;
@@ -94,7 +94,7 @@ void RarpRequest(void)
 	/* dest IP addr set to broadcast */
 	memset(&rarp->ar_data[16], 0xff,        4);
 
-	NetSendPacket(NetTxPacket, eth_hdr_size + ARP_HDR_SIZE);
+	net_send_packet(net_tx_packet, eth_hdr_size + ARP_HDR_SIZE);
 
 	NetSetTimeout(TIMEOUT, RarpTimeout);
 }
diff --git a/net/sntp.c b/net/sntp.c
index b99aa3e..1e2b678 100644
--- a/net/sntp.c
+++ b/net/sntp.c
@@ -31,14 +31,14 @@ SntpSend(void)
 	pkt.vn = NTP_VERSION;
 	pkt.mode = NTP_MODE_CLIENT;
 
-	memcpy((char *)NetTxPacket + NetEthHdrSize() + IP_UDP_HDR_SIZE,
-		(char *)&pkt, pktlen);
+	memcpy((char *)net_tx_packet + net_eth_hdr_size() + IP_UDP_HDR_SIZE,
+	       (char *)&pkt, pktlen);
 
 	SntpOurPort = 10000 + (get_timer(0) % 4096);
 	sport = NTP_SERVICE_PORT;
 
-	NetSendUDPPacket(net_server_ethaddr, net_ntp_server, sport, SntpOurPort,
-			 pktlen);
+	net_send_udp_packet(net_server_ethaddr, net_ntp_server, sport,
+			    SntpOurPort, pktlen);
 }
 
 static void
diff --git a/net/tftp.c b/net/tftp.c
index 8ddc7be..f25abaa 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -337,7 +337,7 @@ TftpSend(void)
 	 *	We will always be sending some sort of packet, so
 	 *	cobble together the packet headers now.
 	 */
-	pkt = NetTxPacket + NetEthHdrSize() + IP_UDP_HDR_SIZE;
+	pkt = net_tx_packet + net_eth_hdr_size() + IP_UDP_HDR_SIZE;
 
 	switch (TftpState) {
 	case STATE_SEND_RRQ:
@@ -435,8 +435,8 @@ TftpSend(void)
 		break;
 	}
 
-	NetSendUDPPacket(net_server_ethaddr, tftp_remote_ip, TftpRemotePort,
-			 TftpOurPort, len);
+	net_send_udp_packet(net_server_ethaddr, tftp_remote_ip, TftpRemotePort,
+			    TftpOurPort, len);
 }
 
 #ifdef CONFIG_CMD_TFTPPUT
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 06/25] net: cosmetic: Fix var naming net <-> eth drivers
  2015-04-08  6:41 ` [U-Boot] [PATCH v2 0/25] " Joe Hershberger
                     ` (4 preceding siblings ...)
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 05/25] net: cosmetic: Cleanup internal packet buffer names Joe Hershberger
@ 2015-04-08  6:41   ` Joe Hershberger
  2015-04-08 12:46     ` Simon Glass
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 07/25] net: cosmetic: Clean up TFTP variables and functions Joe Hershberger
                     ` (19 subsequent siblings)
  25 siblings, 1 reply; 103+ messages in thread
From: Joe Hershberger @ 2015-04-08  6:41 UTC (permalink / raw)
  To: u-boot

Update the naming convention used in the network stack functions and
variables that Ethernet drivers use to interact with it.

This cleans up the temporary hacks that were added to this interface
along with the DM support.

This patch has a few remaining checkpatch.pl failures that would be out
of the scope of this patch to fix (drivers that are in gross violation
of checkpatch.pl).

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

Changes in v2: None

 arch/mips/mach-au1x00/au1x00_eth.c   | 12 ++++++-----
 arch/powerpc/cpu/mpc8260/ether_fcc.c |  4 ++--
 arch/powerpc/cpu/mpc8260/ether_scc.c |  4 ++--
 arch/powerpc/cpu/mpc85xx/ether_fcc.c |  4 ++--
 arch/powerpc/cpu/mpc8xx/fec.c        |  6 +++---
 arch/powerpc/cpu/mpc8xx/scc.c        |  5 +++--
 doc/README.drivers.eth               | 12 +++++------
 drivers/net/4xx_enet.c               | 14 +++++++-----
 drivers/net/altera_tse.c             | 15 +++++++------
 drivers/net/armada100_fec.c          |  7 +++---
 drivers/net/at91_emac.c              |  4 ++--
 drivers/net/ax88180.c                |  6 +++---
 drivers/net/bcm-sf2-eth.c            |  6 +++---
 drivers/net/bfin_mac.c               |  4 ++--
 drivers/net/calxedaxgmac.c           |  2 +-
 drivers/net/cpsw.c                   |  4 ++--
 drivers/net/cs8900.c                 |  5 ++---
 drivers/net/davinci_emac.c           |  5 +++--
 drivers/net/dc2114x.c                |  9 +++++---
 drivers/net/designware.c             |  2 +-
 drivers/net/dm9000x.c                |  5 +++--
 drivers/net/dnet.c                   |  5 +++--
 drivers/net/e1000.c                  |  2 +-
 drivers/net/eepro100.c               |  3 ++-
 drivers/net/enc28j60.c               | 13 ++++++------
 drivers/net/ep93xx_eth.c             | 11 +++++-----
 drivers/net/ethoc.c                  |  4 ++--
 drivers/net/fec_mxc.c                |  2 +-
 drivers/net/fm/eth.c                 |  2 +-
 drivers/net/fsl_mcdmafec.c           | 23 ++++++++++----------
 drivers/net/ftgmac100.c              |  4 ++--
 drivers/net/ftmac100.c               |  4 ++--
 drivers/net/ftmac110.c               |  2 +-
 drivers/net/greth.c                  |  2 +-
 drivers/net/keystone_net.c           |  2 +-
 drivers/net/ks8851_mll.c             |  6 +++---
 drivers/net/lan91c96.c               | 19 +++++++++--------
 drivers/net/macb.c                   |  8 +++----
 drivers/net/mcffec.c                 |  5 +++--
 drivers/net/mpc512x_fec.c            |  3 ++-
 drivers/net/mpc5xxx_fec.c            |  2 +-
 drivers/net/mvgbe.c                  | 41 +++++++++++++++++++-----------------
 drivers/net/mvneta.c                 |  2 +-
 drivers/net/natsemi.c                |  3 ++-
 drivers/net/ne2000_base.c            |  2 +-
 drivers/net/ns8382x.c                |  6 ++++--
 drivers/net/pch_gbe.c                |  2 +-
 drivers/net/pcnet.c                  |  2 +-
 drivers/net/rtl8139.c                |  4 ++--
 drivers/net/rtl8169.c                |  2 +-
 drivers/net/sh_eth.c                 |  2 +-
 drivers/net/smc91111.c               | 18 ++++++++--------
 drivers/net/smc911x.c                |  4 ++--
 drivers/net/sunxi_emac.c             |  4 ++--
 drivers/net/tsec.c                   |  7 +++---
 drivers/net/tsi108_eth.c             |  8 +++----
 drivers/net/uli526x.c                |  5 +++--
 drivers/net/xilinx_axi_emac.c        |  2 +-
 drivers/net/xilinx_emaclite.c        |  2 +-
 drivers/net/xilinx_ll_temac_fifo.c   |  4 ++--
 drivers/net/xilinx_ll_temac_sdma.c   |  4 ++--
 drivers/net/zynq_gem.c               |  2 +-
 drivers/qe/uec.c                     |  2 +-
 drivers/usb/eth/asix.c               |  3 ++-
 drivers/usb/eth/asix88179.c          |  2 +-
 drivers/usb/eth/mcs7830.c            |  2 +-
 drivers/usb/eth/smsc95xx.c           |  3 ++-
 drivers/usb/gadget/ether.c           |  5 +++--
 include/net.h                        |  7 ------
 net/net.c                            | 11 ----------
 post/cpu/mpc8xx/ether.c              |  6 +++---
 71 files changed, 219 insertions(+), 205 deletions(-)

diff --git a/arch/mips/mach-au1x00/au1x00_eth.c b/arch/mips/mach-au1x00/au1x00_eth.c
index a47f088..d6ebe07 100644
--- a/arch/mips/mach-au1x00/au1x00_eth.c
+++ b/arch/mips/mach-au1x00/au1x00_eth.c
@@ -187,13 +187,14 @@ static int au1x00_recv(struct eth_device* dev){
 
 		if(status&RX_ERROR){
 			printf("Rx error 0x%x\n", status);
-		}
-		else{
+		} else {
 			/* Pass the packet up to the protocol layers. */
-			NetReceive(NetRxPackets[next_rx], length - 4);
+			net_process_received_packet(net_rx_packets[next_rx],
+						    length - 4);
 		}
 
-		fifo_rx[next_rx].addr = (virt_to_phys(NetRxPackets[next_rx]))|RX_DMA_ENABLE;
+		fifo_rx[next_rx].addr =
+			(virt_to_phys(net_rx_packets[next_rx])) | RX_DMA_ENABLE;
 
 		next_rx++;
 		if(next_rx>=NO_OF_FIFOS){
@@ -234,7 +235,8 @@ static int au1x00_init(struct eth_device* dev, bd_t * bd){
 	for(i=0;i<NO_OF_FIFOS;i++){
 		fifo_tx[i].len = 0;
 		fifo_tx[i].addr = virt_to_phys(&txbuf[0]);
-		fifo_rx[i].addr = (virt_to_phys(NetRxPackets[i]))|RX_DMA_ENABLE;
+		fifo_rx[i].addr = (virt_to_phys(net_rx_packets[i])) |
+			RX_DMA_ENABLE;
 	}
 
 	/* Put mac addr in little endian */
diff --git a/arch/powerpc/cpu/mpc8260/ether_fcc.c b/arch/powerpc/cpu/mpc8260/ether_fcc.c
index 50d1654..30ea3de 100644
--- a/arch/powerpc/cpu/mpc8260/ether_fcc.c
+++ b/arch/powerpc/cpu/mpc8260/ether_fcc.c
@@ -183,7 +183,7 @@ static int fec_recv(struct eth_device* dev)
 	}
 	else {
 	    /* Pass the packet up to the protocol layers. */
-	    NetReceive(NetRxPackets[rxIdx], length - 4);
+	    net_process_received_packet(net_rx_packets[rxIdx], length - 4);
 	}
 
 
@@ -243,7 +243,7 @@ static int fec_init(struct eth_device* dev, bd_t *bis)
     {
       rtx.rxbd[i].cbd_sc = BD_ENET_RX_EMPTY;
       rtx.rxbd[i].cbd_datlen = 0;
-      rtx.rxbd[i].cbd_bufaddr = (uint)NetRxPackets[i];
+      rtx.rxbd[i].cbd_bufaddr = (uint)net_rx_packets[i];
     }
     rtx.rxbd[PKTBUFSRX - 1].cbd_sc |= BD_ENET_RX_WRAP;
 
diff --git a/arch/powerpc/cpu/mpc8260/ether_scc.c b/arch/powerpc/cpu/mpc8260/ether_scc.c
index c988def..5ba8bed 100644
--- a/arch/powerpc/cpu/mpc8260/ether_scc.c
+++ b/arch/powerpc/cpu/mpc8260/ether_scc.c
@@ -146,7 +146,7 @@ static int sec_rx(struct eth_device *dev)
 	else
 	{
 	    /* Pass the packet up to the protocol layers. */
-	    NetReceive(NetRxPackets[rxIdx], length - 4);
+	    net_process_received_packet(net_rx_packets[rxIdx], length - 4);
 	}
 
 
@@ -263,7 +263,7 @@ static int sec_init(struct eth_device *dev, bd_t *bis)
     {
 	rtx->rxbd[i].cbd_sc = BD_ENET_RX_EMPTY;
 	rtx->rxbd[i].cbd_datlen = 0;                  /* Reset */
-	rtx->rxbd[i].cbd_bufaddr = (uint)NetRxPackets[i];
+	rtx->rxbd[i].cbd_bufaddr = (uint)net_rx_packets[i];
     }
 
     rtx->rxbd[PKTBUFSRX - 1].cbd_sc |= BD_ENET_RX_WRAP;
diff --git a/arch/powerpc/cpu/mpc85xx/ether_fcc.c b/arch/powerpc/cpu/mpc85xx/ether_fcc.c
index 58d4bfb..14358ae 100644
--- a/arch/powerpc/cpu/mpc85xx/ether_fcc.c
+++ b/arch/powerpc/cpu/mpc85xx/ether_fcc.c
@@ -186,7 +186,7 @@ static int fec_recv(struct eth_device* dev)
 	}
 	else {
 	    /* Pass the packet up to the protocol layers. */
-	    NetReceive(NetRxPackets[rxIdx], length - 4);
+	    net_process_received_packet(net_rx_packets[rxIdx], length - 4);
 	}
 
 
@@ -263,7 +263,7 @@ static int fec_init(struct eth_device* dev, bd_t *bis)
     {
       rtx.rxbd[i].cbd_sc = BD_ENET_RX_EMPTY;
       rtx.rxbd[i].cbd_datlen = 0;
-      rtx.rxbd[i].cbd_bufaddr = (uint)NetRxPackets[i];
+      rtx.rxbd[i].cbd_bufaddr = (uint)net_rx_packets[i];
     }
     rtx.rxbd[PKTBUFSRX - 1].cbd_sc |= BD_ENET_RX_WRAP;
 
diff --git a/arch/powerpc/cpu/mpc8xx/fec.c b/arch/powerpc/cpu/mpc8xx/fec.c
index 454e77a..2e19603 100644
--- a/arch/powerpc/cpu/mpc8xx/fec.c
+++ b/arch/powerpc/cpu/mpc8xx/fec.c
@@ -247,7 +247,7 @@ static int fec_recv (struct eth_device *dev)
 				rtx->rxbd[rxIdx].cbd_sc);
 #endif
 		} else {
-			uchar *rx = NetRxPackets[rxIdx];
+			uchar *rx = net_rx_packets[rxIdx];
 
 			length -= 4;
 
@@ -261,7 +261,7 @@ static int fec_recv (struct eth_device *dev)
 			 * Pass the packet up to the protocol layers.
 			 */
 			if (rx != NULL)
-				NetReceive (rx, length);
+				net_process_received_packet(rx, length);
 		}
 
 		/* Give the buffer back to the FEC. */
@@ -576,7 +576,7 @@ static int fec_init (struct eth_device *dev, bd_t * bd)
 	for (i = 0; i < PKTBUFSRX; i++) {
 		rtx->rxbd[i].cbd_sc = BD_ENET_RX_EMPTY;
 		rtx->rxbd[i].cbd_datlen = 0;	/* Reset */
-		rtx->rxbd[i].cbd_bufaddr = (uint) NetRxPackets[i];
+		rtx->rxbd[i].cbd_bufaddr = (uint) net_rx_packets[i];
 	}
 	rtx->rxbd[PKTBUFSRX - 1].cbd_sc |= BD_ENET_RX_WRAP;
 
diff --git a/arch/powerpc/cpu/mpc8xx/scc.c b/arch/powerpc/cpu/mpc8xx/scc.c
index 66e4014..5498440 100644
--- a/arch/powerpc/cpu/mpc8xx/scc.c
+++ b/arch/powerpc/cpu/mpc8xx/scc.c
@@ -159,7 +159,8 @@ static int scc_recv (struct eth_device *dev)
 #endif
 		} else {
 			/* Pass the packet up to the protocol layers. */
-			NetReceive (NetRxPackets[rxIdx], length - 4);
+			net_process_received_packet(net_rx_packets[rxIdx],
+						    length - 4);
 		}
 
 
@@ -280,7 +281,7 @@ static int scc_init (struct eth_device *dev, bd_t * bis)
 	for (i = 0; i < PKTBUFSRX; i++) {
 		rtx->rxbd[i].cbd_sc = BD_ENET_RX_EMPTY;
 		rtx->rxbd[i].cbd_datlen = 0;	/* Reset */
-		rtx->rxbd[i].cbd_bufaddr = (uint) NetRxPackets[i];
+		rtx->rxbd[i].cbd_bufaddr = (uint) net_rx_packets[i];
 	}
 
 	rtx->rxbd[PKTBUFSRX - 1].cbd_sc |= BD_ENET_RX_WRAP;
diff --git a/doc/README.drivers.eth b/doc/README.drivers.eth
index 8b4d352..1a9a23b 100644
--- a/doc/README.drivers.eth
+++ b/doc/README.drivers.eth
@@ -141,11 +141,11 @@ function can be called multiple times in a row.
 
 The recv function should process packets as long as the hardware has them
 readily available before returning.  i.e. you should drain the hardware fifo.
-For each packet you receive, you should call the NetReceive() function on it
+For each packet you receive, you should call the net_process_received_packet() function on it
 along with the packet length.  The common code sets up packet buffers for you
-already in the .bss (NetRxPackets), so there should be no need to allocate your
-own.  This doesn't mean you must use the NetRxPackets array however; you're
-free to call the NetReceive() function with any buffer you wish.  So the pseudo
+already in the .bss (net_rx_packets), so there should be no need to allocate your
+own.  This doesn't mean you must use the net_rx_packets array however; you're
+free to call the net_process_received_packet() function with any buffer you wish.  So the pseudo
 code here would look something like:
 int ape_recv(struct eth_device *dev)
 {
@@ -153,9 +153,9 @@ int ape_recv(struct eth_device *dev)
 	...
 	while (packets_are_available()) {
 		...
-		length = ape_get_packet(&NetRxPackets[i]);
+		length = ape_get_packet(&net_rx_packets[i]);
 		...
-		NetReceive(&NetRxPackets[i], length);
+		net_process_received_packet(&net_rx_packets[i], length);
 		...
 		if (++i >= PKTBUFSRX)
 			i = 0;
diff --git a/drivers/net/4xx_enet.c b/drivers/net/4xx_enet.c
index 878f1b2..3c30f42 100644
--- a/drivers/net/4xx_enet.c
+++ b/drivers/net/4xx_enet.c
@@ -1350,7 +1350,7 @@ get_speed:
 	for (i = 0; i < NUM_RX_BUFF; i++) {
 		hw_p->rx[i].ctrl = 0;
 		hw_p->rx[i].data_len = 0;
-		hw_p->rx[i].data_ptr = (char *)NetRxPackets[i];
+		hw_p->rx[i].data_ptr = (char *)net_rx_packets[i];
 		if ((NUM_RX_BUFF - 1) == i)
 			hw_p->rx[i].ctrl |= MAL_RX_CTRL_WRAP;
 		hw_p->rx[i].ctrl |= MAL_RX_CTRL_EMPTY | MAL_RX_CTRL_INTR;
@@ -1858,13 +1858,17 @@ static int ppc_4xx_eth_rx (struct eth_device *dev)
 
 		length = hw_p->rx[user_index].data_len & 0x0fff;
 
-		/* Pass the packet up to the protocol layers. */
-		/*	 NetReceive(NetRxPackets[rxIdx], length - 4); */
-		/*	 NetReceive(NetRxPackets[i], length); */
+		/*
+		 * Pass the packet up to the protocol layers.
+		 * net_process_received_packet(net_rx_packets[rxIdx],
+		 *			       length - 4);
+		 * net_process_received_packet(net_rx_packets[i], length);
+		 */
 		invalidate_dcache_range((u32)hw_p->rx[user_index].data_ptr,
 					(u32)hw_p->rx[user_index].data_ptr +
 					length - 4);
-		NetReceive (NetRxPackets[user_index], length - 4);
+		net_process_received_packet(net_rx_packets[user_index],
+					    length - 4);
 		/* Free Recv Buffer */
 		hw_p->rx[user_index].ctrl |= MAL_RX_CTRL_EMPTY;
 		/* Free rx buffer descriptor queue */
diff --git a/drivers/net/altera_tse.c b/drivers/net/altera_tse.c
index de517f8..c4fd6ec 100644
--- a/drivers/net/altera_tse.c
+++ b/drivers/net/altera_tse.c
@@ -303,16 +303,17 @@ static int tse_eth_rx(struct eth_device *dev)
 	    ALT_SGDMA_DESCRIPTOR_STATUS_TERMINATED_BY_EOP_MSK) {
 		debug("got packet\n");
 		packet_length = rx_desc->actual_bytes_transferred;
-		NetReceive(NetRxPackets[0], packet_length);
+		net_process_received_packet(net_rx_packets[0], packet_length);
 
 		/* start descriptor again */
-		flush_dcache_range((unsigned long)(NetRxPackets[0]),
-			(unsigned long)(NetRxPackets[0]) + PKTSIZE_ALIGN);
+		flush_dcache_range((unsigned long)(net_rx_packets[0]),
+				   (unsigned long)(net_rx_packets[0] +
+						   PKTSIZE_ALIGN));
 		alt_sgdma_construct_descriptor_burst(
 			(volatile struct alt_sgdma_descriptor *)&rx_desc[0],
 			(volatile struct alt_sgdma_descriptor *)&rx_desc[1],
 			(unsigned int)0x0,	/* read addr */
-			(unsigned int *)NetRxPackets[0],
+			(unsigned int *)net_rx_packets[0],
 			0x0,	/* length or EOP */
 			0x0,	/* gen eop */
 			0x0,	/* read fixed */
@@ -835,13 +836,13 @@ static int tse_eth_init(struct eth_device *dev, bd_t * bd)
 		0x0	/* channel */
 		);
 	debug("Configuring rx desc\n");
-	flush_dcache_range((unsigned long)(NetRxPackets[0]),
-			(unsigned long)(NetRxPackets[0]) + PKTSIZE_ALIGN);
+	flush_dcache_range((unsigned long)(net_rx_packets[0]),
+			   (unsigned long)(net_rx_packets[0]) + PKTSIZE_ALIGN);
 	alt_sgdma_construct_descriptor_burst(
 		(volatile struct alt_sgdma_descriptor *)&rx_desc[0],
 		(volatile struct alt_sgdma_descriptor *)&rx_desc[1],
 		(unsigned int)0x0,	/* read addr */
-		(unsigned int *)NetRxPackets[0],
+		(unsigned int *)net_rx_packets[0],
 		0x0,	/* length or EOP */
 		0x0,	/* gen eop */
 		0x0,	/* read fixed */
diff --git a/drivers/net/armada100_fec.c b/drivers/net/armada100_fec.c
index a8da6b1..e6a6252 100644
--- a/drivers/net/armada100_fec.c
+++ b/drivers/net/armada100_fec.c
@@ -639,15 +639,16 @@ static int armdfec_recv(struct eth_device *dev)
 	} else {
 		/* !!! call higher layer processing */
 		debug("ARMD100 FEC: (%s) Sending Received packet to"
-			" upper layer (NetReceive)\n", __func__);
+		      " upper layer (net_process_received_packet)\n", __func__);
 
 		/*
 		 * let the upper layer handle the packet, subtract offset
 		 * as two dummy bytes are added in received buffer see
 		 * PORT_CONFIG_EXT register bit TWO_Byte_Stuff_Mode bit.
 		 */
-		NetReceive((p_rxdesc_curr->buf_ptr + RX_BUF_OFFSET),
-			   (int)(p_rxdesc_curr->byte_cnt - RX_BUF_OFFSET));
+		net_process_received_packet(
+			p_rxdesc_curr->buf_ptr + RX_BUF_OFFSET,
+			(int)(p_rxdesc_curr->byte_cnt - RX_BUF_OFFSET));
 	}
 	/*
 	 * free these descriptors and point next in the ring
diff --git a/drivers/net/at91_emac.c b/drivers/net/at91_emac.c
index 64d4c56..d51e098 100644
--- a/drivers/net/at91_emac.c
+++ b/drivers/net/at91_emac.c
@@ -352,7 +352,7 @@ static int at91emac_init(struct eth_device *netdev, bd_t *bd)
 
 	/* Init Ethernet buffers */
 	for (i = 0; i < RBF_FRAMEMAX; i++) {
-		dev->rbfdt[i].addr = (unsigned long) NetRxPackets[i];
+		dev->rbfdt[i].addr = (unsigned long) net_rx_packets[i];
 		dev->rbfdt[i].size = 0;
 	}
 	dev->rbfdt[RBF_FRAMEMAX - 1].addr |= RBF_WRAP;
@@ -420,7 +420,7 @@ static int at91emac_recv(struct eth_device *netdev)
 	rbfp = &dev->rbfdt[dev->rbindex];
 	while (rbfp->addr & RBF_OWNER)	{
 		size = rbfp->size & RBF_SIZE;
-		NetReceive(NetRxPackets[dev->rbindex], size);
+		net_process_received_packet(net_rx_packets[dev->rbindex], size);
 
 		debug_cond(DEBUG_AT91EMAC, "Recv[%ld]: %d bytes @ %lx\n",
 			dev->rbindex, size, rbfp->addr);
diff --git a/drivers/net/ax88180.c b/drivers/net/ax88180.c
index 7f0cfe5..ded9e06 100644
--- a/drivers/net/ax88180.c
+++ b/drivers/net/ax88180.c
@@ -192,9 +192,9 @@ static void ax88180_rx_handler (struct eth_device *dev)
 	unsigned short rxcurt_ptr, rxbound_ptr, next_ptr;
 	int i;
 #if defined (CONFIG_DRIVER_AX88180_16BIT)
-	unsigned short *rxdata = (unsigned short *)NetRxPackets[0];
+	unsigned short *rxdata = (unsigned short *)net_rx_packets[0];
 #else
-	unsigned long *rxdata = (unsigned long *)NetRxPackets[0];
+	unsigned long *rxdata = (unsigned long *)net_rx_packets[0];
 #endif
 	unsigned short count;
 
@@ -237,7 +237,7 @@ static void ax88180_rx_handler (struct eth_device *dev)
 		OUTW (dev, RX_STOP_READ, RXINDICATOR);
 
 		/* Pass the packet up to the protocol layers. */
-		NetReceive (NetRxPackets[0], data_size);
+		net_process_received_packet(net_rx_packets[0], data_size);
 
 		OUTW (dev, rxbound_ptr, RXBOUND);
 
diff --git a/drivers/net/bcm-sf2-eth.c b/drivers/net/bcm-sf2-eth.c
index 5252d49..51d5146 100644
--- a/drivers/net/bcm-sf2-eth.c
+++ b/drivers/net/bcm-sf2-eth.c
@@ -103,7 +103,7 @@ static int bcm_sf2_eth_send(struct eth_device *dev, void *packet, int length)
 static int bcm_sf2_eth_receive(struct eth_device *dev)
 {
 	struct eth_dma *dma = &(((struct eth_info *)(dev->priv))->dma);
-	uint8_t *buf = (uint8_t *)NetRxPackets[0];
+	uint8_t *buf = (uint8_t *)net_rx_packets[0];
 	int rcvlen;
 	int rc = 0;
 	int i = 0;
@@ -124,11 +124,11 @@ static int bcm_sf2_eth_receive(struct eth_device *dev)
 			debug("recieved\n");
 
 			/* Forward received packet to uboot network handler */
-			NetReceive(buf, rcvlen);
+			net_process_received_packet(buf, rcvlen);
 
 			if (++i >= PKTBUFSRX)
 				i = 0;
-			buf = NetRxPackets[i];
+			buf = net_rx_packets[i];
 		}
 	}
 
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index 0c2d2ef..61cb1b0 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -189,8 +189,8 @@ static int bfin_EMAC_recv(struct eth_device *dev)
 
 		debug("%s: len = %d\n", __func__, length - 4);
 
-		NetRxPackets[rxIdx] = rxbuf[rxIdx]->FrmData->Dest;
-		NetReceive(NetRxPackets[rxIdx], length - 4);
+		net_rx_packets[rxIdx] = rxbuf[rxIdx]->FrmData->Dest;
+		net_process_received_packet(net_rx_packets[rxIdx], length - 4);
 		bfin_write_DMA1_IRQ_STATUS(DMA_DONE | DMA_ERR);
 		rxbuf[rxIdx]->StatusWord = 0x00000000;
 		if ((rxIdx + 1) >= PKTBUFSRX)
diff --git a/drivers/net/calxedaxgmac.c b/drivers/net/calxedaxgmac.c
index ff94865..c02b397 100644
--- a/drivers/net/calxedaxgmac.c
+++ b/drivers/net/calxedaxgmac.c
@@ -466,7 +466,7 @@ static int xgmac_rx(struct eth_device *dev)
 
 	length = desc_get_rx_frame_len(rxdesc);
 
-	NetReceive(desc_get_buf_addr(rxdesc), length);
+	net_process_received_packet(desc_get_buf_addr(rxdesc), length);
 
 	/* set descriptor back to owned by XGMAC */
 	desc_set_rx_owner(rxdesc);
diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c
index d4b0cb9..fb4d621 100644
--- a/drivers/net/cpsw.c
+++ b/drivers/net/cpsw.c
@@ -846,7 +846,7 @@ static int cpsw_init(struct eth_device *dev, bd_t *bis)
 
 	/* submit rx descs */
 	for (i = 0; i < PKTBUFSRX; i++) {
-		ret = cpdma_submit(priv, &priv->rx_chan, NetRxPackets[i],
+		ret = cpdma_submit(priv, &priv->rx_chan, net_rx_packets[i],
 				   PKTSIZE);
 		if (ret < 0) {
 			printf("error %d submitting rx desc\n", ret);
@@ -905,7 +905,7 @@ static int cpsw_recv(struct eth_device *dev)
 	while (cpdma_process(priv, &priv->rx_chan, &buffer, &len) >= 0) {
 		invalidate_dcache_range((unsigned long)buffer,
 					(unsigned long)buffer + PKTSIZE_ALIGN);
-		NetReceive(buffer, len);
+		net_process_received_packet(buffer, len);
 		cpdma_submit(priv, &priv->rx_chan, buffer, PKTSIZE);
 	}
 
diff --git a/drivers/net/cs8900.c b/drivers/net/cs8900.c
index 84963c1..0713464 100644
--- a/drivers/net/cs8900.c
+++ b/drivers/net/cs8900.c
@@ -188,14 +188,13 @@ static int cs8900_recv(struct eth_device *dev)
 
 	if (rxlen > PKTSIZE_ALIGN + PKTALIGN)
 		debug("packet too big!\n");
-	for (addr = (u16 *) NetRxPackets[0], i = rxlen >> 1; i > 0;
-		 i--)
+	for (addr = (u16 *)net_rx_packets[0], i = rxlen >> 1; i > 0; i--)
 		*addr++ = REG_READ(&priv->regs->rtdata);
 	if (rxlen & 1)
 		*addr++ = REG_READ(&priv->regs->rtdata);
 
 	/* Pass the packet up to the protocol layers. */
-	NetReceive (NetRxPackets[0], rxlen);
+	net_process_received_packet(net_rx_packets[0], rxlen);
 	return rxlen;
 }
 
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index 08bc1af..427ad3e 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -700,8 +700,9 @@ static int davinci_eth_rcv_packet (struct eth_device *dev)
 			unsigned long tmp = (unsigned long)rx_curr_desc->buffer;
 
 			invalidate_dcache_range(tmp, tmp + EMAC_RXBUF_SIZE);
-			NetReceive (rx_curr_desc->buffer,
-				    (rx_curr_desc->buff_off_len & 0xffff));
+			net_process_received_packet(
+				rx_curr_desc->buffer,
+				rx_curr_desc->buff_off_len & 0xffff);
 			ret = rx_curr_desc->buff_off_len & 0xffff;
 		}
 
diff --git a/drivers/net/dc2114x.c b/drivers/net/dc2114x.c
index 799839c..8245cf5 100644
--- a/drivers/net/dc2114x.c
+++ b/drivers/net/dc2114x.c
@@ -333,9 +333,11 @@ static int dc21x4x_init(struct eth_device* dev, bd_t* bis)
 	for (i = 0; i < NUM_RX_DESC; i++) {
 		rx_ring[i].status = cpu_to_le32(R_OWN);
 		rx_ring[i].des1 = cpu_to_le32(RX_BUFF_SZ);
-		rx_ring[i].buf = cpu_to_le32(phys_to_bus((u32) NetRxPackets[i]));
+		rx_ring[i].buf = cpu_to_le32(
+			phys_to_bus((u32)net_rx_packets[i]));
 #ifdef CONFIG_TULIP_FIX_DAVICOM
-		rx_ring[i].next = cpu_to_le32(phys_to_bus((u32) &rx_ring[(i+1) % NUM_RX_DESC]));
+		rx_ring[i].next = cpu_to_le32(
+			phys_to_bus((u32)&rx_ring[(i + 1) % NUM_RX_DESC]));
 #else
 		rx_ring[i].next = 0;
 #endif
@@ -448,7 +450,8 @@ static int dc21x4x_recv(struct eth_device* dev)
 				/* Pass the packet up to the protocol
 				 * layers.
 				 */
-				NetReceive(NetRxPackets[rx_new], length - 4);
+				net_process_received_packet(
+					net_rx_packets[rx_new], length - 4);
 			}
 
 			/* Change buffer ownership for this frame, back
diff --git a/drivers/net/designware.c b/drivers/net/designware.c
index cc01604..bbf01f7 100644
--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c
@@ -374,7 +374,7 @@ static int dw_eth_recv(struct eth_device *dev)
 		data_end = data_start + roundup(length, ARCH_DMA_MINALIGN);
 		invalidate_dcache_range(data_start, data_end);
 
-		NetReceive(desc_p->dmamac_addr, length);
+		net_process_received_packet(desc_p->dmamac_addr, length);
 
 		/*
 		 * Make the current descriptor valid again and go to
diff --git a/drivers/net/dm9000x.c b/drivers/net/dm9000x.c
index d1c6f4c..ccd2131 100644
--- a/drivers/net/dm9000x.c
+++ b/drivers/net/dm9000x.c
@@ -464,7 +464,8 @@ static void dm9000_halt(struct eth_device *netdev)
 */
 static int dm9000_rx(struct eth_device *netdev)
 {
-	u8 rxbyte, *rdptr = (u8 *) NetRxPackets[0];
+	u8 rxbyte;
+	u8 *rdptr = (u8 *)net_rx_packets[0];
 	u16 RxStatus, RxLen = 0;
 	struct board_info *db = &dm9000_info;
 
@@ -525,7 +526,7 @@ static int dm9000_rx(struct eth_device *netdev)
 			DM9000_DMP_PACKET(__func__ , rdptr, RxLen);
 
 			DM9000_DBG("passing packet to upper layer\n");
-			NetReceive(NetRxPackets[0], RxLen);
+			net_process_received_packet(net_rx_packets[0], RxLen);
 		}
 	}
 	return 0;
diff --git a/drivers/net/dnet.c b/drivers/net/dnet.c
index 944a0c0..933d1fc 100644
--- a/drivers/net/dnet.c
+++ b/drivers/net/dnet.c
@@ -188,12 +188,13 @@ static int dnet_recv(struct eth_device *netdev)
 	if (cmd_word & 0xDF180000)
 		printf("%s packet receive error %x\n", __func__, cmd_word);
 
-	data_ptr = (unsigned int *) NetRxPackets[0];
+	data_ptr = (unsigned int *)net_rx_packets[0];
 
 	for (i = 0; i < (pkt_len + 3) >> 2; i++)
 		*data_ptr++ = readl(&dnet->regs->RX_DATA_FIFO);
 
-	NetReceive(NetRxPackets[0], pkt_len + 5); /* ok + 5 ?? */
+	/* ok + 5 ?? */
+	net_process_received_packet(net_rx_packets[0], pkt_len + 5);
 
 	return 0;
 }
diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c
index 6a2e0d2..2d66690 100644
--- a/drivers/net/e1000.c
+++ b/drivers/net/e1000.c
@@ -5158,7 +5158,7 @@ e1000_poll(struct eth_device *nic)
 	invalidate_dcache_range((unsigned long)packet,
 				(unsigned long)packet +
 				roundup(len, ARCH_DMA_MINALIGN));
-	NetReceive((uchar *)packet, len);
+	net_process_received_packet((uchar *)packet, len);
 	fill_rx(hw);
 	return 1;
 }
diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c
index a23a585..f2cd32c 100644
--- a/drivers/net/eepro100.c
+++ b/drivers/net/eepro100.c
@@ -674,7 +674,8 @@ static int eepro100_recv (struct eth_device *dev)
 			/* Pass the packet up to the protocol
 			 * layers.
 			 */
-			NetReceive((u8 *)rx_ring[rx_next].data, length);
+			net_process_received_packet((u8 *)rx_ring[rx_next].data,
+						    length);
 		} else {
 			/* There was an error.
 			 */
diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c
index ec33764..59ea11c 100644
--- a/drivers/net/enc28j60.c
+++ b/drivers/net/enc28j60.c
@@ -21,8 +21,8 @@
  * enc_miiphy_read(), enc_miiphy_write(), enc_write_hwaddr(),
  * enc_init(), enc_recv(), enc_send(), enc_halt()
  * ALL other functions assume that the bus has already been claimed!
- * Since NetReceive() might call enc_send() in return, the bus must be
- * released, NetReceive() called and claimed again.
+ * Since net_process_received_packet() might call enc_send() in return, the bus
+ * must be released, net_process_received_packet() called and claimed again.
  */
 
 /*
@@ -415,7 +415,7 @@ static void enc_reset_rx_call(enc_dev_t *enc)
  */
 static void enc_receive(enc_dev_t *enc)
 {
-	u8 *packet = (u8 *)NetRxPackets[0];
+	u8 *packet = (u8 *)net_rx_packets[0];
 	u16 pkt_len;
 	u16 copy_len;
 	u16 status;
@@ -468,11 +468,12 @@ static void enc_receive(enc_dev_t *enc)
 			continue;
 		}
 		/*
-		 * Because NetReceive() might call enc_send(), we need to
-		 * release the SPI bus, call NetReceive(), reclaim the bus
+		 * Because net_process_received_packet() might call enc_send(),
+		 * we need to release the SPI bus, call
+		 * net_process_received_packet(), reclaim the bus.
 		 */
 		enc_release_bus(enc);
-		NetReceive(packet, pkt_len);
+		net_process_received_packet(packet, pkt_len);
 		if (enc_claim_bus(enc))
 			return;
 		(void)enc_r8(enc, CTL_REG_EIR);
diff --git a/drivers/net/ep93xx_eth.c b/drivers/net/ep93xx_eth.c
index 1c09f10..a3721c5 100644
--- a/drivers/net/ep93xx_eth.c
+++ b/drivers/net/ep93xx_eth.c
@@ -53,7 +53,7 @@ static void dump_dev(struct eth_device *dev)
 	printf("  rx_sq.end	     %p\n", priv->rx_sq.end);
 
 	for (i = 0; i < NUMRXDESC; i++)
-		printf("  rx_buffer[%2.d]      %p\n", i, NetRxPackets[i]);
+		printf("  rx_buffer[%2.d]      %p\n", i, net_rx_packets[i]);
 
 	printf("  tx_dq.base	     %p\n", priv->tx_dq.base);
 	printf("  tx_dq.current	     %p\n", priv->tx_dq.current);
@@ -237,7 +237,7 @@ static int ep93xx_eth_open(struct eth_device *dev, bd_t *bd)
 	 */
 	for (i = 0; i < NUMRXDESC; i++) {
 		/* set buffer address */
-		(priv->rx_dq.base + i)->word1 = (uint32_t)NetRxPackets[i];
+		(priv->rx_dq.base + i)->word1 = (uint32_t)net_rx_packets[i];
 
 		/* set buffer length, clear buffer index and NSOF */
 		(priv->rx_dq.base + i)->word2 = PKTSIZE_ALIGN;
@@ -310,15 +310,16 @@ static int ep93xx_eth_rcv_packet(struct eth_device *dev)
 			/*
 			 * We have a good frame. Extract the frame's length
 			 * from the current rx_status_queue entry, and copy
-			 * the frame's data into NetRxPackets[] of the
+			 * the frame's data into net_rx_packets[] of the
 			 * protocol stack. We track the total number of
 			 * bytes in the frame (nbytes_frame) which will be
 			 * used when we pass the data off to the protocol
-			 * layer via NetReceive().
+			 * layer via net_process_received_packet().
 			 */
 			len = RX_STATUS_FRAME_LEN(priv->rx_sq.current);
 
-			NetReceive((uchar *)priv->rx_dq.current->word1,	len);
+			net_process_received_packet(
+				(uchar *)priv->rx_dq.current->word1, len);
 
 			debug("reporting %d bytes...\n", len);
 		} else {
diff --git a/drivers/net/ethoc.c b/drivers/net/ethoc.c
index 46c82bb..edb3c80 100644
--- a/drivers/net/ethoc.c
+++ b/drivers/net/ethoc.c
@@ -267,7 +267,7 @@ static int ethoc_init_ring(struct eth_device *dev)
 	bd.stat = RX_BD_EMPTY | RX_BD_IRQ;
 
 	for (i = 0; i < priv->num_rx; i++) {
-		bd.addr = (u32)NetRxPackets[i];
+		bd.addr = (u32)net_rx_packets[i];
 		if (i == priv->num_rx - 1)
 			bd.stat |= RX_BD_WRAP;
 
@@ -372,7 +372,7 @@ static int ethoc_rx(struct eth_device *dev, int limit)
 		if (ethoc_update_rx_stats(&bd) == 0) {
 			int size = bd.stat >> 16;
 			size -= 4;	/* strip the CRC */
-			NetReceive((void *)bd.addr, size);
+			net_process_received_packet((void *)bd.addr, size);
 		}
 
 		/* clear the buffer descriptor so it can be reused */
diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 1146d3b..9225d37 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -852,7 +852,7 @@ static int fec_recv(struct eth_device *dev)
 			swap_packet((uint32_t *)frame->data, frame_length);
 #endif
 			memcpy(buff, frame->data, frame_length);
-			NetReceive(buff, frame_length);
+			net_process_received_packet(buff, frame_length);
 			len = frame_length;
 		} else {
 			if (bd_status & FEC_RBD_ERR)
diff --git a/drivers/net/fm/eth.c b/drivers/net/fm/eth.c
index 1d1089d..55e76a7 100644
--- a/drivers/net/fm/eth.c
+++ b/drivers/net/fm/eth.c
@@ -530,7 +530,7 @@ static int fm_eth_recv(struct eth_device *dev)
 		if (!(status & RxBD_ERROR)) {
 			data = (u8 *)rxbd->buf_ptr_lo;
 			len = rxbd->len;
-			NetReceive(data, len);
+			net_process_received_packet(data, len);
 		} else {
 			printf("%s: Rx error\n", dev->name);
 			return 0;
diff --git a/drivers/net/fsl_mcdmafec.c b/drivers/net/fsl_mcdmafec.c
index 6391f9b..792534b 100644
--- a/drivers/net/fsl_mcdmafec.c
+++ b/drivers/net/fsl_mcdmafec.c
@@ -244,7 +244,7 @@ static int fec_recv(struct eth_device *dev)
 	struct fec_info_dma *info = dev->priv;
 	volatile fecdma_t *fecp = (fecdma_t *) (info->iobase);
 
-	cbd_t *pRbd = &info->rxbd[info->rxIdx];
+	cbd_t *prbd = &info->rxbd[info->rxIdx];
 	u32 ievent;
 	int frame_length, len = 0;
 
@@ -276,26 +276,27 @@ static int fec_recv(struct eth_device *dev)
 		}
 	}
 
-	if (!(pRbd->cbd_sc & BD_ENET_RX_EMPTY)) {
-		if ((pRbd->cbd_sc & BD_ENET_RX_LAST)
-		    && !(pRbd->cbd_sc & BD_ENET_RX_ERR)
-		    && ((pRbd->cbd_datlen - 4) > 14)) {
+	if (!(prbd->cbd_sc & BD_ENET_RX_EMPTY)) {
+		if ((prbd->cbd_sc & BD_ENET_RX_LAST) &&
+		    !(prbd->cbd_sc & BD_ENET_RX_ERR) &&
+		    ((prbd->cbd_datlen - 4) > 14)) {
 
 			/* Get buffer address and size */
-			frame_length = pRbd->cbd_datlen - 4;
+			frame_length = prbd->cbd_datlen - 4;
 
 			/* Fill the buffer and pass it to upper layers */
-			NetReceive((uchar *)pRbd->cbd_bufaddr, frame_length);
+			net_process_received_packet((uchar *)prbd->cbd_bufaddr,
+						    frame_length);
 			len = frame_length;
 		}
 
 		/* Reset buffer descriptor as empty */
 		if ((info->rxIdx) == (PKTBUFSRX - 1))
-			pRbd->cbd_sc = (BD_ENET_RX_WRAP | BD_ENET_RX_EMPTY);
+			prbd->cbd_sc = (BD_ENET_RX_WRAP | BD_ENET_RX_EMPTY);
 		else
-			pRbd->cbd_sc = BD_ENET_RX_EMPTY;
+			prbd->cbd_sc = BD_ENET_RX_EMPTY;
 
-		pRbd->cbd_datlen = PKTSIZE_ALIGN;
+		prbd->cbd_datlen = PKTSIZE_ALIGN;
 
 		/* Now, we have an empty RxBD, restart the DMA receive task */
 		MCD_continDma(info->rxTask);
@@ -399,7 +400,7 @@ static int fec_init(struct eth_device *dev, bd_t * bd)
 	for (i = 0; i < PKTBUFSRX; i++) {
 		info->rxbd[i].cbd_sc = BD_ENET_RX_EMPTY;
 		info->rxbd[i].cbd_datlen = PKTSIZE_ALIGN;
-		info->rxbd[i].cbd_bufaddr = (uint) NetRxPackets[i];
+		info->rxbd[i].cbd_bufaddr = (uint) net_rx_packets[i];
 	}
 	info->rxbd[PKTBUFSRX - 1].cbd_sc |= BD_ENET_RX_WRAP;
 
diff --git a/drivers/net/ftgmac100.c b/drivers/net/ftgmac100.c
index 8519314..515f0b2 100644
--- a/drivers/net/ftgmac100.c
+++ b/drivers/net/ftgmac100.c
@@ -423,7 +423,7 @@ static int ftgmac100_init(struct eth_device *dev, bd_t *bd)
 	for (i = 0; i < PKTBUFSRX; i++) {
 		/* RXBUF_BADR */
 		if (!rxdes[i].rxdes2) {
-			buf = NetRxPackets[i];
+			buf = net_rx_packets[i];
 			rxdes[i].rxdes3 = virt_to_phys(buf);
 			rxdes[i].rxdes2 = (uint)buf;
 		}
@@ -493,7 +493,7 @@ static int ftgmac100_recv(struct eth_device *dev)
 	dma_map_single((void *)curr_des->rxdes2, rxlen, DMA_FROM_DEVICE);
 
 	/* pass the packet up to the protocol layers. */
-	NetReceive((void *)curr_des->rxdes2, rxlen);
+	net_process_received_packet((void *)curr_des->rxdes2, rxlen);
 
 	/* release buffer to DMA */
 	curr_des->rxdes0 &= ~FTGMAC100_RXDES0_RXPKT_RDY;
diff --git a/drivers/net/ftmac100.c b/drivers/net/ftmac100.c
index 3e148db..bd94f83 100644
--- a/drivers/net/ftmac100.c
+++ b/drivers/net/ftmac100.c
@@ -102,7 +102,7 @@ static int ftmac100_init (struct eth_device *dev, bd_t *bd)
 
 	for (i = 0; i < PKTBUFSRX; i++) {
 		/* RXBUF_BADR */
-		rxdes[i].rxdes2 = (unsigned int)NetRxPackets[i];
+		rxdes[i].rxdes2 = (unsigned int)net_rx_packets[i];
 		rxdes[i].rxdes1 |= FTMAC100_RXDES1_RXBUF_SIZE (PKTSIZE_ALIGN);
 		rxdes[i].rxdes0 = FTMAC100_RXDES0_RXDMA_OWN;
 	}
@@ -164,7 +164,7 @@ static int ftmac100_recv (struct eth_device *dev)
 
 	/* pass the packet up to the protocol layers. */
 
-	NetReceive ((void *)curr_des->rxdes2, rxlen);
+	net_process_received_packet((void *)curr_des->rxdes2, rxlen);
 
 	/* release buffer to DMA */
 
diff --git a/drivers/net/ftmac110.c b/drivers/net/ftmac110.c
index aef89a2..4bae9ad 100644
--- a/drivers/net/ftmac110.c
+++ b/drivers/net/ftmac110.c
@@ -347,7 +347,7 @@ static int ftmac110_recv(struct eth_device *dev)
 			printf("ftmac110: rx error\n");
 		} else {
 			dma_map_single(buf, len, DMA_FROM_DEVICE);
-			NetReceive(buf, len);
+			net_process_received_packet(buf, len);
 			rlen += len;
 		}
 
diff --git a/drivers/net/greth.c b/drivers/net/greth.c
index c817af4..a93b37a 100644
--- a/drivers/net/greth.c
+++ b/drivers/net/greth.c
@@ -533,7 +533,7 @@ int greth_recv(struct eth_device *dev)
 			sparc_dcache_flush_all();
 
 			/* pass packet on to network subsystem */
-			NetReceive((void *)d, len);
+			net_process_received_packet((void *)d, len);
 
 			/* bump stats counters */
 			greth->stats.rx_packets++;
diff --git a/drivers/net/keystone_net.c b/drivers/net/keystone_net.c
index 35f1a57..0c5fdee 100644
--- a/drivers/net/keystone_net.c
+++ b/drivers/net/keystone_net.c
@@ -505,7 +505,7 @@ static int keystone2_eth_rcv_packet(struct eth_device *dev)
 	if (hd == NULL)
 		return 0;
 
-	NetReceive((uchar *)pkt, pkt_size);
+	net_process_received_packet((uchar *)pkt, pkt_size);
 
 	ksnav_release_rxhd(&netcp_pktdma, hd);
 
diff --git a/drivers/net/ks8851_mll.c b/drivers/net/ks8851_mll.c
index 05e5b14..5b4c5b0 100644
--- a/drivers/net/ks8851_mll.c
+++ b/drivers/net/ks8851_mll.c
@@ -321,8 +321,8 @@ static void ks_rcv(struct eth_device *dev, uchar **pv_data)
 			/* read data block including CRC 4 bytes */
 			ks_read_qmu(dev, (u16 *)(*pv_data), frame_hdr->len);
 
-			/* NetRxPackets buffer size is ok (*pv_data pointer) */
-			NetReceive(*pv_data, frame_hdr->len);
+			/* net_rx_packets buffer size is ok (*pv_data) */
+			net_process_received_packet(*pv_data, frame_hdr->len);
 			pv_data++;
 		} else {
 			ks_wrreg16(dev, KS_RXQCR, (ks->rc_rxqcr | RXQCR_RRXEF));
@@ -573,7 +573,7 @@ static int ks8851_mll_recv(struct eth_device *dev)
 	ks_wrreg16(dev, KS_ISR, status);
 
 	if ((status & IRQ_RXI))
-		ks_rcv(dev, (uchar **)NetRxPackets);
+		ks_rcv(dev, (uchar **)net_rx_packets);
 
 	if ((status & IRQ_LDI)) {
 		u16 pmecr = ks_rdreg16(dev, KS_PMECR);
diff --git a/drivers/net/lan91c96.c b/drivers/net/lan91c96.c
index 229658a..495c088 100644
--- a/drivers/net/lan91c96.c
+++ b/drivers/net/lan91c96.c
@@ -568,29 +568,30 @@ static int smc_rcv(struct eth_device *dev)
 		   to send the DWORDs or the bytes first, or some
 		   mixture.  A mixture might improve already slow PIO
 		   performance  */
-		SMC_insl(dev, LAN91C96_DATA_HIGH, NetRxPackets[0],
-				packet_length >> 2);
+		SMC_insl(dev, LAN91C96_DATA_HIGH, net_rx_packets[0],
+			 packet_length >> 2);
 		/* read the left over bytes */
 		if (packet_length & 3) {
 			int i;
 
-			byte *tail = (byte *) (NetRxPackets[0] + (packet_length & ~3));
+			byte *tail = (byte *)(net_rx_packets[0] +
+				(packet_length & ~3));
 			dword leftover = SMC_inl(dev, LAN91C96_DATA_HIGH);
 
 			for (i = 0; i < (packet_length & 3); i++)
 				*tail++ = (byte) (leftover >> (8 * i)) & 0xff;
 		}
 #else
-		PRINTK3 (" Reading %d words and %d byte(s) \n",
-				 (packet_length >> 1), packet_length & 1);
-		SMC_insw(dev, LAN91C96_DATA_HIGH, NetRxPackets[0],
-				packet_length >> 1);
+		PRINTK3(" Reading %d words and %d byte(s)\n",
+			(packet_length >> 1), packet_length & 1);
+		SMC_insw(dev, LAN91C96_DATA_HIGH, net_rx_packets[0],
+			 packet_length >> 1);
 
 #endif /* USE_32_BIT */
 
 #if	SMC_DEBUG > 2
 		printf ("Receiving Packet\n");
-		print_packet((byte *)NetRxPackets[0], packet_length);
+		print_packet((byte *)net_rx_packets[0], packet_length);
 #endif
 	} else {
 		/* error ... */
@@ -609,7 +610,7 @@ static int smc_rcv(struct eth_device *dev)
 
 	if (!is_error) {
 		/* Pass the packet up to the protocol layers. */
-		NetReceive (NetRxPackets[0], packet_length);
+		net_process_received_packet(net_rx_packets[0], packet_length);
 		return packet_length;
 	} else {
 		return 0;
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 1fe408c..4e1a7fe 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -347,14 +347,14 @@ static int macb_recv(struct eth_device *netdev)
 				headlen = 128 * (MACB_RX_RING_SIZE
 						 - macb->rx_tail);
 				taillen = length - headlen;
-				memcpy((void *)NetRxPackets[0],
+				memcpy((void *)net_rx_packets[0],
 				       buffer, headlen);
-				memcpy((void *)NetRxPackets[0] + headlen,
+				memcpy((void *)net_rx_packets[0] + headlen,
 				       macb->rx_buffer, taillen);
-				buffer = (void *)NetRxPackets[0];
+				buffer = (void *)net_rx_packets[0];
 			}
 
-			NetReceive(buffer, length);
+			net_process_received_packet(buffer, length);
 			if (++rx_tail >= MACB_RX_RING_SIZE)
 				rx_tail = 0;
 			reclaim_rx_buffers(macb, rx_tail);
diff --git a/drivers/net/mcffec.c b/drivers/net/mcffec.c
index 7c4b210..fd73099 100644
--- a/drivers/net/mcffec.c
+++ b/drivers/net/mcffec.c
@@ -219,7 +219,8 @@ int fec_recv(struct eth_device *dev)
 
 			length -= 4;
 			/* Pass the packet up to the protocol layers. */
-			NetReceive(NetRxPackets[info->rxIdx], length);
+			net_process_received_packet(net_rx_packets[info->rxIdx],
+						    length);
 
 			fecp->eir |= FEC_EIR_RXF;
 		}
@@ -477,7 +478,7 @@ int fec_init(struct eth_device *dev, bd_t * bd)
 	for (i = 0; i < PKTBUFSRX; i++) {
 		info->rxbd[i].cbd_sc = BD_ENET_RX_EMPTY;
 		info->rxbd[i].cbd_datlen = 0;	/* Reset */
-		info->rxbd[i].cbd_bufaddr = (uint) NetRxPackets[i];
+		info->rxbd[i].cbd_bufaddr = (uint) net_rx_packets[i];
 	}
 	info->rxbd[PKTBUFSRX - 1].cbd_sc |= BD_ENET_RX_WRAP;
 
diff --git a/drivers/net/mpc512x_fec.c b/drivers/net/mpc512x_fec.c
index 427e0b8..22ea114 100644
--- a/drivers/net/mpc512x_fec.c
+++ b/drivers/net/mpc512x_fec.c
@@ -591,7 +591,8 @@ static int mpc512x_fec_recv (struct eth_device *dev)
 			rx_buff_idx = frame_length;
 
 			if (pRbd->status & FEC_RBD_LAST) {
-				NetReceive ((uchar*)rx_buff, frame_length);
+				net_process_received_packet((uchar *)rx_buff,
+							    frame_length);
 				rx_buff_idx = 0;
 			}
 		}
diff --git a/drivers/net/mpc5xxx_fec.c b/drivers/net/mpc5xxx_fec.c
index d2a8ae0..2ebd176 100644
--- a/drivers/net/mpc5xxx_fec.c
+++ b/drivers/net/mpc5xxx_fec.c
@@ -859,7 +859,7 @@ static int mpc5xxx_fec_recv(struct eth_device *dev)
 			 */
 			memcpy(buff, frame->head, 14);
 			memcpy(buff + 14, frame->data, frame_length);
-			NetReceive(buff, frame_length);
+			net_process_received_packet(buff, frame_length);
 			len = frame_length;
 		}
 		/*
diff --git a/drivers/net/mvgbe.c b/drivers/net/mvgbe.c
index 6b31a82..ab5aa68 100644
--- a/drivers/net/mvgbe.c
+++ b/drivers/net/mvgbe.c
@@ -66,12 +66,12 @@ static int smi_reg_read(const char *devname, u8 phy_adr, u8 reg_ofs, u16 * data)
 	/* check parameters */
 	if (phy_adr > PHYADR_MASK) {
 		printf("Err..(%s) Invalid PHY address %d\n",
-			__FUNCTION__, phy_adr);
+			__func__, phy_adr);
 		return -EFAULT;
 	}
 	if (reg_ofs > PHYREG_MASK) {
 		printf("Err..(%s) Invalid register offset %d\n",
-			__FUNCTION__, reg_ofs);
+			__func__, reg_ofs);
 		return -EFAULT;
 	}
 
@@ -81,7 +81,7 @@ static int smi_reg_read(const char *devname, u8 phy_adr, u8 reg_ofs, u16 * data)
 		/* read smi register */
 		smi_reg = MVGBE_REG_RD(MVGBE_SMI_REG);
 		if (timeout-- == 0) {
-			printf("Err..(%s) SMI busy timeout\n", __FUNCTION__);
+			printf("Err..(%s) SMI busy timeout\n", __func__);
 			return -EFAULT;
 		}
 	} while (smi_reg & MVGBE_PHY_SMI_BUSY_MASK);
@@ -102,7 +102,7 @@ static int smi_reg_read(const char *devname, u8 phy_adr, u8 reg_ofs, u16 * data)
 		smi_reg = MVGBE_REG_RD(MVGBE_SMI_REG);
 		if (timeout-- == 0) {
 			printf("Err..(%s) SMI read ready timeout\n",
-				__FUNCTION__);
+				__func__);
 			return -EFAULT;
 		}
 	} while (!(smi_reg & MVGBE_PHY_SMI_READ_VALID_MASK));
@@ -113,8 +113,8 @@ static int smi_reg_read(const char *devname, u8 phy_adr, u8 reg_ofs, u16 * data)
 
 	*data = (u16) (MVGBE_REG_RD(MVGBE_SMI_REG) & MVGBE_PHY_SMI_DATA_MASK);
 
-	debug("%s:(adr %d, off %d) value= %04x\n", __FUNCTION__, phy_adr,
-		reg_ofs, *data);
+	debug("%s:(adr %d, off %d) value= %04x\n", __func__, phy_adr, reg_ofs,
+	      *data);
 
 	return 0;
 }
@@ -142,11 +142,11 @@ static int smi_reg_write(const char *devname, u8 phy_adr, u8 reg_ofs, u16 data)
 
 	/* check parameters */
 	if (phy_adr > PHYADR_MASK) {
-		printf("Err..(%s) Invalid phy address\n", __FUNCTION__);
+		printf("Err..(%s) Invalid phy address\n", __func__);
 		return -EINVAL;
 	}
 	if (reg_ofs > PHYREG_MASK) {
-		printf("Err..(%s) Invalid register offset\n", __FUNCTION__);
+		printf("Err..(%s) Invalid register offset\n", __func__);
 		return -EINVAL;
 	}
 
@@ -156,7 +156,7 @@ static int smi_reg_write(const char *devname, u8 phy_adr, u8 reg_ofs, u16 data)
 		/* read smi register */
 		smi_reg = MVGBE_REG_RD(MVGBE_SMI_REG);
 		if (timeout-- == 0) {
-			printf("Err..(%s) SMI busy timeout\n", __FUNCTION__);
+			printf("Err..(%s) SMI busy timeout\n", __func__);
 			return -ETIME;
 		}
 	} while (smi_reg & MVGBE_PHY_SMI_BUSY_MASK);
@@ -583,7 +583,7 @@ static int mvgbe_send(struct eth_device *dev, void *dataptr, int datasize)
 		if ((cmd_sts & (MVGBE_ERROR_SUMMARY | MVGBE_TX_LAST_FRAME)) ==
 				(MVGBE_ERROR_SUMMARY | MVGBE_TX_LAST_FRAME) &&
 				cmd_sts & (MVGBE_UR_ERROR | MVGBE_RL_ERROR)) {
-			printf("Err..(%s) in xmit packet\n", __FUNCTION__);
+			printf("Err..(%s) in xmit packet\n", __func__);
 			return -1;
 		}
 		cmd_sts = readl(&p_txdesc->cmd_sts);
@@ -604,14 +604,14 @@ static int mvgbe_recv(struct eth_device *dev)
 		if (timeout < MVGBE_PHY_SMI_TIMEOUT)
 			timeout++;
 		else {
-			debug("%s time out...\n", __FUNCTION__);
+			debug("%s time out...\n", __func__);
 			return -1;
 		}
 	} while (readl(&p_rxdesc_curr->cmd_sts) & MVGBE_BUFFER_OWNED_BY_DMA);
 
 	if (p_rxdesc_curr->byte_cnt != 0) {
 		debug("%s: Received %d byte Packet @ 0x%x (cmd_sts= %08x)\n",
-			__FUNCTION__, (u32) p_rxdesc_curr->byte_cnt,
+			__func__, (u32) p_rxdesc_curr->byte_cnt,
 			(u32) p_rxdesc_curr->buf_ptr,
 			(u32) p_rxdesc_curr->cmd_sts);
 	}
@@ -628,21 +628,24 @@ static int mvgbe_recv(struct eth_device *dev)
 		!= (MVGBE_RX_FIRST_DESC | MVGBE_RX_LAST_DESC)) {
 
 		printf("Err..(%s) Dropping packet spread on"
-			" multiple descriptors\n", __FUNCTION__);
+			" multiple descriptors\n", __func__);
 
 	} else if (cmd_sts & MVGBE_ERROR_SUMMARY) {
 
 		printf("Err..(%s) Dropping packet with errors\n",
-			__FUNCTION__);
+			__func__);
 
 	} else {
 		/* !!! call higher layer processing */
 		debug("%s: Sending Received packet to"
-			" upper layer (NetReceive)\n", __FUNCTION__);
+		      " upper layer (net_process_received_packet)\n",
+		      __func__);
 
 		/* let the upper layer handle the packet */
-		NetReceive((p_rxdesc_curr->buf_ptr + RX_BUF_OFFSET),
-			(int)(p_rxdesc_curr->byte_cnt - RX_BUF_OFFSET));
+		net_process_received_packet((p_rxdesc_curr->buf_ptr +
+					     RX_BUF_OFFSET),
+					    (int)(p_rxdesc_curr->byte_cnt -
+						  RX_BUF_OFFSET));
 	}
 	/*
 	 * free these descriptors and point next in the ring
@@ -747,7 +750,7 @@ error2:
 			free(dmvgbe);
 error1:
 			printf("Err.. %s Failed to allocate memory\n",
-				__FUNCTION__);
+				__func__);
 			return -1;
 		}
 
@@ -767,7 +770,7 @@ error1:
 #endif
 		default:	/* this should never happen */
 			printf("Err..(%s) Invalid device number %d\n",
-				__FUNCTION__, devnum);
+				__func__, devnum);
 			return -1;
 		}
 
diff --git a/drivers/net/mvneta.c b/drivers/net/mvneta.c
index a2a69b4..efaae16 100644
--- a/drivers/net/mvneta.c
+++ b/drivers/net/mvneta.c
@@ -1572,7 +1572,7 @@ static int mvneta_recv(struct eth_device *dev)
 		 * No cache invalidation needed here, since the rx_buffer's are
 		 * located in a uncached memory region
 		 */
-		NetReceive(data, rx_bytes);
+		net_process_received_packet(data, rx_bytes);
 	}
 
 	/* Update rxq management counters */
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index 04743bd..0ed9bb5 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -841,7 +841,8 @@ natsemi_poll(struct eth_device *dev)
 		     rx_status);
 		retstat = 0;
 	} else {		/* give packet to higher level routine */
-		NetReceive((rxb + cur_rx * RX_BUF_SIZE), length);
+		net_process_received_packet((rxb + cur_rx * RX_BUF_SIZE),
+					    length);
 		retstat = 1;
 	}
 
diff --git a/drivers/net/ne2000_base.c b/drivers/net/ne2000_base.c
index ef35922..07a7cec 100644
--- a/drivers/net/ne2000_base.c
+++ b/drivers/net/ne2000_base.c
@@ -665,7 +665,7 @@ void uboot_push_packet_len(int len) {
 	dp83902a_recv(&pbuf[0], len);
 
 	/*Just pass it to the upper layer*/
-	NetReceive(&pbuf[0], len);
+	net_process_received_packet(&pbuf[0], len);
 }
 
 void uboot_push_tx_done(int key, int val) {
diff --git a/drivers/net/ns8382x.c b/drivers/net/ns8382x.c
index cfe1f34..f941c15 100644
--- a/drivers/net/ns8382x.c
+++ b/drivers/net/ns8382x.c
@@ -809,11 +809,13 @@ ns8382x_poll(struct eth_device *dev)
 
 	if ((rx_status & (DescMore | DescPktOK | DescRxLong)) != DescPktOK) {
 		/* corrupted packet received */
-		printf("ns8382x_poll: Corrupted packet, status:%lx\n", rx_status);
+		printf("ns8382x_poll: Corrupted packet, status:%lx\n",
+		       rx_status);
 		retstat = 0;
 	} else {
 		/* give packet to higher level routine */
-		NetReceive((rxb + cur_rx * RX_BUF_SIZE), length);
+		net_process_received_packet((rxb + cur_rx * RX_BUF_SIZE),
+					    length);
 		retstat = 1;
 	}
 
diff --git a/drivers/net/pch_gbe.c b/drivers/net/pch_gbe.c
index 976848d..15c9cdc 100644
--- a/drivers/net/pch_gbe.c
+++ b/drivers/net/pch_gbe.c
@@ -297,7 +297,7 @@ static int pch_gbe_recv(struct eth_device *dev)
 
 	buffer_addr = pci_mem_to_phys(priv->bdf, rx_desc->buffer_addr);
 	length = rx_desc->rx_words_eob - 3 - ETH_FCS_LEN;
-	NetReceive((uchar *)buffer_addr, length);
+	net_process_received_packet((uchar *)buffer_addr, length);
 
 	/* Test the wrap-around condition */
 	if (++priv->rx_idx >= PCH_GBE_DESC_NUM)
diff --git a/drivers/net/pcnet.c b/drivers/net/pcnet.c
index 237fbba..cfcb1b4 100644
--- a/drivers/net/pcnet.c
+++ b/drivers/net/pcnet.c
@@ -507,7 +507,7 @@ static int pcnet_recv (struct eth_device *dev)
 				buf = (*lp->rx_buf)[lp->cur_rx];
 				invalidate_dcache_range((unsigned long)buf,
 					(unsigned long)buf + pkt_len);
-				NetReceive(buf, pkt_len);
+				net_process_received_packet(buf, pkt_len);
 				PCNET_DEBUG2("Rx%d: %d bytes from 0x%p\n",
 					     lp->cur_rx, pkt_len, buf);
 			}
diff --git a/drivers/net/rtl8139.c b/drivers/net/rtl8139.c
index 208ce5c..ea52343 100644
--- a/drivers/net/rtl8139.c
+++ b/drivers/net/rtl8139.c
@@ -504,11 +504,11 @@ static int rtl_poll(struct eth_device *dev)
 		memcpy(rxdata, rx_ring + ring_offs + 4, semi_count);
 		memcpy(&(rxdata[semi_count]), rx_ring, rx_size-4-semi_count);
 
-		NetReceive(rxdata, length);
+		net_process_received_packet(rxdata, length);
 		debug_cond(DEBUG_RX, "rx packet %d+%d bytes",
 			semi_count, rx_size-4-semi_count);
 	} else {
-		NetReceive(rx_ring + ring_offs + 4, length);
+		net_process_received_packet(rx_ring + ring_offs + 4, length);
 		debug_cond(DEBUG_RX, "rx packet %d bytes", rx_size-4);
 	}
 	flush_cache((unsigned long)rx_ring, RX_BUF_LEN);
diff --git a/drivers/net/rtl8169.c b/drivers/net/rtl8169.c
index cea6701..4a53710 100644
--- a/drivers/net/rtl8169.c
+++ b/drivers/net/rtl8169.c
@@ -538,7 +538,7 @@ static int rtl_recv(struct eth_device *dev)
 				cpu_to_le32(bus_to_phys(tpc->RxBufferRing[cur_rx]));
 			rtl_flush_rx_desc(&tpc->RxDescArray[cur_rx]);
 
-			NetReceive(rxdata, length);
+			net_process_received_packet(rxdata, length);
 		} else {
 			puts("Error Rx");
 		}
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c
index 4bf493e..a320b4d 100644
--- a/drivers/net/sh_eth.c
+++ b/drivers/net/sh_eth.c
@@ -127,7 +127,7 @@ int sh_eth_recv(struct eth_device *dev)
 			packet = (uchar *)
 				ADDR_TO_P2(port_info->rx_desc_cur->rd2);
 			invalidate_cache(packet, len);
-			NetReceive(packet, len);
+			net_process_received_packet(packet, len);
 		}
 
 		/* Make current descriptor available again */
diff --git a/drivers/net/smc91111.c b/drivers/net/smc91111.c
index 57c667a..ade14cd 100644
--- a/drivers/net/smc91111.c
+++ b/drivers/net/smc91111.c
@@ -756,35 +756,35 @@ static int smc_rcv(struct eth_device *dev)
 
 
 #ifdef USE_32_BIT
-		PRINTK3(" Reading %d dwords (and %d bytes) \n",
+		PRINTK3(" Reading %d dwords (and %d bytes)\n",
 			packet_length >> 2, packet_length & 3 );
 		/* QUESTION:  Like in the TX routine, do I want
 		   to send the DWORDs or the bytes first, or some
 		   mixture.  A mixture might improve already slow PIO
 		   performance	*/
-		SMC_insl( dev, SMC91111_DATA_REG, NetRxPackets[0],
-			packet_length >> 2 );
+		SMC_insl(dev, SMC91111_DATA_REG, net_rx_packets[0],
+			 packet_length >> 2);
 		/* read the left over bytes */
 		if (packet_length & 3) {
 			int i;
 
-			byte *tail = (byte *)(NetRxPackets[0] +
+			byte *tail = (byte *)(net_rx_packets[0] +
 				(packet_length & ~3));
 			dword leftover = SMC_inl(dev, SMC91111_DATA_REG);
 			for (i=0; i<(packet_length & 3); i++)
 				*tail++ = (byte) (leftover >> (8*i)) & 0xff;
 		}
 #else
-		PRINTK3(" Reading %d words and %d byte(s) \n",
+		PRINTK3(" Reading %d words and %d byte(s)\n",
 			(packet_length >> 1 ), packet_length & 1 );
-		SMC_insw(dev, SMC91111_DATA_REG , NetRxPackets[0],
-			packet_length >> 1);
+		SMC_insw(dev, SMC91111_DATA_REG , net_rx_packets[0],
+			 packet_length >> 1);
 
 #endif /* USE_32_BIT */
 
 #if	SMC_DEBUG > 2
 		printf("Receiving Packet\n");
-		print_packet( NetRxPackets[0], packet_length );
+		print_packet(net_rx_packets[0], packet_length);
 #endif
 	} else {
 		/* error ... */
@@ -815,7 +815,7 @@ static int smc_rcv(struct eth_device *dev)
 
 	if (!is_error) {
 		/* Pass the packet up to the protocol layers. */
-		NetReceive(NetRxPackets[0], packet_length);
+		net_process_received_packet(net_rx_packets[0], packet_length);
 		return packet_length;
 	} else {
 		return 0;
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index 5959672..c85a178 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -192,7 +192,7 @@ static void smc911x_halt(struct eth_device *dev)
 
 static int smc911x_rx(struct eth_device *dev)
 {
-	u32 *data = (u32 *)NetRxPackets[0];
+	u32 *data = (u32 *)net_rx_packets[0];
 	u32 pktlen, tmplen;
 	u32 status;
 
@@ -211,7 +211,7 @@ static int smc911x_rx(struct eth_device *dev)
 				": dropped bad packet. Status: 0x%08x\n",
 				status);
 		else
-			NetReceive(NetRxPackets[0], pktlen);
+			net_process_received_packet(net_rx_packets[0], pktlen);
 	}
 
 	return 0;
diff --git a/drivers/net/sunxi_emac.c b/drivers/net/sunxi_emac.c
index 5a06d68..46fb34f 100644
--- a/drivers/net/sunxi_emac.c
+++ b/drivers/net/sunxi_emac.c
@@ -437,10 +437,10 @@ static int sunxi_emac_eth_recv(struct eth_device *dev)
 			printf("Received packet is too big (len=%d)\n", rx_len);
 		} else {
 			emac_inblk_32bit((void *)&regs->rx_io_data,
-					 NetRxPackets[0], rx_len);
+					 net_rx_packets[0], rx_len);
 
 			/* Pass to upper layer */
-			NetReceive(NetRxPackets[0], rx_len);
+			net_process_received_packet(net_rx_packets[0], rx_len);
 			return rx_len;
 		}
 	}
diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
index dcdba4e..42d0374 100644
--- a/drivers/net/tsec.c
+++ b/drivers/net/tsec.c
@@ -287,7 +287,7 @@ void redundant_init(struct eth_device *dev)
 			}
 		}
 
-		if (!memcmp(pkt, (void *)NetRxPackets[rx_idx], sizeof(pkt)))
+		if (!memcmp(pkt, (void *)net_rx_packets[rx_idx], sizeof(pkt)))
 			fail = 0;
 
 		out_be16(&rxbd[rx_idx].length, 0);
@@ -343,7 +343,7 @@ static void startup_tsec(struct eth_device *dev)
 	for (i = 0; i < PKTBUFSRX; i++) {
 		out_be16(&rxbd[i].status, RXBD_EMPTY);
 		out_be16(&rxbd[i].length, 0);
-		out_be32(&rxbd[i].bufptr, (u32)NetRxPackets[i]);
+		out_be32(&rxbd[i].bufptr, (u32)net_rx_packets[i]);
 	}
 	status = in_be16(&rxbd[PKTBUFSRX - 1].status);
 	out_be16(&rxbd[PKTBUFSRX - 1].status, status | RXBD_WRAP);
@@ -430,7 +430,8 @@ static int tsec_recv(struct eth_device *dev)
 
 		/* Send the packet up if there were no errors */
 		if (!(status & RXBD_STATS))
-			NetReceive(NetRxPackets[rx_idx], length - 4);
+			net_process_received_packet(net_rx_packets[rx_idx],
+						    length - 4);
 		else
 			printf("Got error %x\n", (status & RXBD_STATS));
 
diff --git a/drivers/net/tsi108_eth.c b/drivers/net/tsi108_eth.c
index 72b8159..9da59a0 100644
--- a/drivers/net/tsi108_eth.c
+++ b/drivers/net/tsi108_eth.c
@@ -804,11 +804,11 @@ static int tsi108_eth_probe (struct eth_device *dev, bd_t * bis)
 	rx_descr_current = rx_descr;
 	for (index = 0; index < NUM_RX_DESC; index++) {
 		/* make sure the receive buffers are not in cache */
-		invalidate_dcache_range((unsigned long)NetRxPackets[index],
-					(unsigned long)NetRxPackets[index] +
+		invalidate_dcache_range((unsigned long)net_rx_packets[index],
+					(unsigned long)net_rx_packets[index] +
 					RX_BUFFER_SIZE);
 		rx_descr->start_addr0 =
-		    cpu_to_le32((vuint32) NetRxPackets[index]);
+		    cpu_to_le32((vuint32) net_rx_packets[index]);
 		rx_descr->start_addr1 = 0;
 		rx_descr->next_descr_addr0 =
 		    cpu_to_le32((vuint32) (rx_descr + 1));
@@ -966,7 +966,7 @@ static int tsi108_eth_recv (struct eth_device *dev)
 
 			/*** process packet ***/
 			buffer = (uchar *)(le32_to_cpu(rx_descr->start_addr0));
-			NetReceive(buffer, length);
+			net_process_received_packet(buffer, length);
 
 			invalidate_dcache_range ((unsigned long)buffer,
 						(unsigned long)buffer +
diff --git a/drivers/net/uli526x.c b/drivers/net/uli526x.c
index 9526faa..47cdb85 100644
--- a/drivers/net/uli526x.c
+++ b/drivers/net/uli526x.c
@@ -587,7 +587,8 @@ static int uli526x_rx_packet(struct eth_device *dev)
 					__FUNCTION__, i, rxptr->rx_buf_ptr[i]);
 #endif
 
-				NetReceive((uchar *)rxptr->rx_buf_ptr, rxlen);
+				net_process_received_packet(
+					(uchar *)rxptr->rx_buf_ptr, rxlen);
 				uli526x_reuse_buf(rxptr);
 
 			} else {
@@ -709,7 +710,7 @@ static void allocate_rx_buffer(struct uli526x_board_info *db)
 	u32 addr;
 
 	for (index = 0; index < RX_DESC_CNT; index++) {
-		addr = (u32)NetRxPackets[index];
+		addr = (u32)net_rx_packets[index];
 		addr += (16 - (addr & 15));
 		rxptr->rx_buf_ptr = (char *) addr;
 		rxptr->rdes2 = cpu_to_le32(addr);
diff --git a/drivers/net/xilinx_axi_emac.c b/drivers/net/xilinx_axi_emac.c
index 262b67b..df053fe 100644
--- a/drivers/net/xilinx_axi_emac.c
+++ b/drivers/net/xilinx_axi_emac.c
@@ -556,7 +556,7 @@ static int axiemac_recv(struct eth_device *dev)
 #endif
 	/* Pass the received frame up for processing */
 	if (length)
-		NetReceive(rxframe, length);
+		net_process_received_packet(rxframe, length);
 
 #ifdef DEBUG
 	/* It is useful to clear buffer to be sure that it is consistent */
diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c
index 2a5cc44..c9afa99 100644
--- a/drivers/net/xilinx_emaclite.c
+++ b/drivers/net/xilinx_emaclite.c
@@ -322,7 +322,7 @@ static int emaclite_recv(struct eth_device *dev)
 	out_be32 (baseaddress + XEL_RSR_OFFSET, reg);
 
 	debug("Packet receive from 0x%x, length %dB\n", baseaddress, length);
-	NetReceive((uchar *) etherrxbuff, length);
+	net_process_received_packet((uchar *)etherrxbuff, length);
 	return length;
 
 }
diff --git a/drivers/net/xilinx_ll_temac_fifo.c b/drivers/net/xilinx_ll_temac_fifo.c
index b8993cd..78319d7 100644
--- a/drivers/net/xilinx_ll_temac_fifo.c
+++ b/drivers/net/xilinx_ll_temac_fifo.c
@@ -48,7 +48,7 @@ int ll_temac_reset_fifo(struct eth_device *dev)
 int ll_temac_recv_fifo(struct eth_device *dev)
 {
 	int i, length = 0;
-	u32 *buf = (u32 *)NetRxPackets[0];
+	u32 *buf = (u32 *)net_rx_packets[0];
 	struct ll_temac *ll_temac = dev->priv;
 	struct fifo_ctrl *fifo_ctrl = (void *)ll_temac->ctrladdr;
 
@@ -93,7 +93,7 @@ int ll_temac_recv_fifo(struct eth_device *dev)
 		for (i = 0; i < length; i += 4)
 			*buf++ = in_be32(&fifo_ctrl->rdfd);
 
-		NetReceive(NetRxPackets[0], length);
+		net_process_received_packet(net_rx_packets[0], length);
 	}
 
 	return 0;
diff --git a/drivers/net/xilinx_ll_temac_sdma.c b/drivers/net/xilinx_ll_temac_sdma.c
index 32a822e..07c5f6b 100644
--- a/drivers/net/xilinx_ll_temac_sdma.c
+++ b/drivers/net/xilinx_ll_temac_sdma.c
@@ -180,7 +180,7 @@ int ll_temac_init_sdma(struct eth_device *dev)
 		memset(rx_dp, 0, sizeof(*rx_dp));
 		rx_dp->next_p = rx_dp;
 		rx_dp->buf_len = PKTSIZE_ALIGN;
-		rx_dp->phys_buf_p = (u8 *)NetRxPackets[i];
+		rx_dp->phys_buf_p = (u8 *)net_rx_packets[i];
 		flush_cache((u32)rx_dp->phys_buf_p, PKTSIZE_ALIGN);
 	}
 	flush_cache((u32)cdmac_bd.rx, sizeof(cdmac_bd.rx));
@@ -316,7 +316,7 @@ int ll_temac_recv_sdma(struct eth_device *dev)
 	ll_temac->out32(ra[RX_TAILDESC_PTR], (int)&cdmac_bd.rx[rx_idx]);
 
 	if (length > 0 && pb_idx != -1)
-		NetReceive(NetRxPackets[pb_idx], length);
+		net_process_received_packet(net_rx_packets[pb_idx], length);
 
 	return 0;
 }
diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
index 430e228..74fda70 100644
--- a/drivers/net/zynq_gem.c
+++ b/drivers/net/zynq_gem.c
@@ -439,7 +439,7 @@ static int zynq_gem_recv(struct eth_device *dev)
 		u32 size = roundup(frame_len, ARCH_DMA_MINALIGN);
 		invalidate_dcache_range(addr, addr + size);
 
-		NetReceive((u8 *)addr, frame_len);
+		net_process_received_packet((u8 *)addr, frame_len);
 
 		if (current_bd->status & ZYNQ_GEM_RXBUF_SOF_MASK)
 			priv->rx_first_buf = priv->rxbd_current;
diff --git a/drivers/qe/uec.c b/drivers/qe/uec.c
index c91f084..e0ab04a 100644
--- a/drivers/qe/uec.c
+++ b/drivers/qe/uec.c
@@ -1333,7 +1333,7 @@ static int uec_recv(struct eth_device* dev)
 		if (!(status & RxBD_ERROR)) {
 			data = BD_DATA(bd);
 			len = BD_LENGTH(bd);
-			NetReceive(data, len);
+			net_process_received_packet(data, len);
 		} else {
 			printf("%s: Rx error\n", dev->name);
 		}
diff --git a/drivers/usb/eth/asix.c b/drivers/usb/eth/asix.c
index 1181109..3f0c814 100644
--- a/drivers/usb/eth/asix.c
+++ b/drivers/usb/eth/asix.c
@@ -534,7 +534,8 @@ static int asix_recv(struct eth_device *eth)
 		}
 
 		/* Notify net stack */
-		NetReceive(buf_ptr + sizeof(packet_len), packet_len);
+		net_process_received_packet(buf_ptr + sizeof(packet_len),
+					    packet_len);
 
 		/* Adjust for next iteration. Packets are padded to 16-bits */
 		if (packet_len & 1)
diff --git a/drivers/usb/eth/asix88179.c b/drivers/usb/eth/asix88179.c
index 0ef85db..94dfe85 100644
--- a/drivers/usb/eth/asix88179.c
+++ b/drivers/usb/eth/asix88179.c
@@ -558,7 +558,7 @@ static int asix_recv(struct eth_device *eth)
 
 		frame_pos += 2;
 
-		NetReceive(recv_buf + frame_pos, pkt_len);
+		net_process_received_packet(recv_buf + frame_pos, pkt_len);
 
 		pkt_hdr++;
 		frame_pos += ((pkt_len + 7) & 0xFFF8)-2;
diff --git a/drivers/usb/eth/mcs7830.c b/drivers/usb/eth/mcs7830.c
index 8e738d4..c1b7086 100644
--- a/drivers/usb/eth/mcs7830.c
+++ b/drivers/usb/eth/mcs7830.c
@@ -600,7 +600,7 @@ static int mcs7830_recv(struct eth_device *eth)
 
 	if (sts == STAT_RX_FRAME_CORRECT) {
 		debug("%s() got a frame, len=%d\n", __func__, gotlen);
-		NetReceive(buf, gotlen);
+		net_process_received_packet(buf, gotlen);
 		return 0;
 	}
 
diff --git a/drivers/usb/eth/smsc95xx.c b/drivers/usb/eth/smsc95xx.c
index 78b469f..a7e50d6 100644
--- a/drivers/usb/eth/smsc95xx.c
+++ b/drivers/usb/eth/smsc95xx.c
@@ -760,7 +760,8 @@ static int smsc95xx_recv(struct eth_device *eth)
 		}
 
 		/* Notify net stack */
-		NetReceive(buf_ptr + sizeof(packet_len), packet_len - 4);
+		net_process_received_packet(buf_ptr + sizeof(packet_len),
+					    packet_len - 4);
 
 		/* Adjust for next iteration */
 		actual_len -= sizeof(packet_len) + packet_len;
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index c01163c..52c6c1a 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -1521,7 +1521,7 @@ static int rx_submit(struct eth_dev *dev, struct usb_request *req,
 	 * RNDIS headers involve variable numbers of LE32 values.
 	 */
 
-	req->buf = (u8 *) NetRxPackets[0];
+	req->buf = (u8 *)net_rx_packets[0];
 	req->length = size;
 	req->complete = rx_complete;
 
@@ -2446,7 +2446,8 @@ static int usb_eth_recv(struct eth_device *netdev)
 	if (packet_received) {
 		debug("%s: packet received\n", __func__);
 		if (dev->rx_req) {
-			NetReceive(NetRxPackets[0], dev->rx_req->length);
+			net_process_received_packet(net_rx_packets[0],
+						    dev->rx_req->length);
 			packet_received = 0;
 
 			rx_submit(dev, dev->rx_req, 0);
diff --git a/include/net.h b/include/net.h
index 18ae7d2..1dc54ce 100644
--- a/include/net.h
+++ b/include/net.h
@@ -476,11 +476,7 @@ extern u8		net_server_ethaddr[6];	/* Boot server enet address */
 extern struct in_addr	net_ip;		/* Our    IP addr (0 = unknown) */
 extern struct in_addr	net_server_ip;	/* Server IP addr (0 = unknown) */
 extern uchar		*net_tx_packet;		/* THE transmit packet */
-#ifdef CONFIG_DM_ETH
 extern uchar		*net_rx_packets[PKTBUFSRX]; /* Receive packets */
-#else
-extern uchar		*NetRxPackets[PKTBUFSRX]; /* Receive packets */
-#endif
 extern uchar		*net_rx_packet;		/* Current receive packet */
 extern int		net_rx_packet_len;	/* Current rx packet length */
 extern unsigned		NetIPID;		/* IP ID (counting) */
@@ -634,9 +630,6 @@ static inline void net_send_packet(uchar *pkt, int len)
 int net_send_udp_packet(uchar *ether, struct in_addr dest, int dport,
 			int sport, int payload_len);
 
-#ifndef CONFIG_DM_ETH
-#define NetReceive(in_packet, len) net_process_received_packet(in_packet, len)
-#endif
 /* Processes a received packet */
 void net_process_received_packet(uchar *in_packet, int len);
 
diff --git a/net/net.c b/net/net.c
index 0e8e9c9..5898260 100644
--- a/net/net.c
+++ b/net/net.c
@@ -178,13 +178,8 @@ int		NetTimeOffset;
 #endif
 
 static uchar net_pkt_buf[(PKTBUFSRX+1) * PKTSIZE_ALIGN + PKTALIGN];
-#ifdef CONFIG_DM_ETH
 /* Receive packets */
 uchar *net_rx_packets[PKTBUFSRX];
-#else
-/* Receive packet */
-uchar *NetRxPackets[PKTBUFSRX];
-#endif
 /* Current UDP RX packet handler */
 static rxhand_f *udp_packet_handler;
 /* Current ARP RX packet handler */
@@ -303,16 +298,10 @@ void net_init(void)
 
 		net_tx_packet = &net_pkt_buf[0] + (PKTALIGN - 1);
 		net_tx_packet -= (ulong)net_tx_packet % PKTALIGN;
-#ifdef CONFIG_DM_ETH
 		for (i = 0; i < PKTBUFSRX; i++) {
 			net_rx_packets[i] = net_tx_packet +
 				(i + 1) * PKTSIZE_ALIGN;
 		}
-#else
-		for (i = 0; i < PKTBUFSRX; i++)
-			NetRxPackets[i] = net_tx_packet +
-				(i + 1) * PKTSIZE_ALIGN;
-#endif
 		ArpInit();
 		net_clear_handlers();
 
diff --git a/post/cpu/mpc8xx/ether.c b/post/cpu/mpc8xx/ether.c
index 3a8b483..1b75eb6 100644
--- a/post/cpu/mpc8xx/ether.c
+++ b/post/cpu/mpc8xx/ether.c
@@ -212,7 +212,7 @@ static void scc_init (int scc_index)
 	for (i = 0; i < PKTBUFSRX; i++) {
 		rtx->rxbd[i].cbd_sc = BD_ENET_RX_EMPTY;
 		rtx->rxbd[i].cbd_datlen = 0;	/* Reset */
-		rtx->rxbd[i].cbd_bufaddr = (uint) NetRxPackets[i];
+		rtx->rxbd[i].cbd_bufaddr = (uint) net_rx_packets[i];
 	}
 
 	rtx->rxbd[PKTBUFSRX - 1].cbd_sc |= BD_ENET_RX_WRAP;
@@ -405,8 +405,8 @@ static int scc_recv (int index, void *packet, int max_length)
 	if (!(rtx->rxbd[rxIdx].cbd_sc & 0x003f)) {
 		length = rtx->rxbd[rxIdx].cbd_datlen - 4;
 		memcpy (packet,
-				(void *) (NetRxPackets[rxIdx]),
-				length < max_length ? length : max_length);
+			(void *)(net_rx_packets[rxIdx]),
+			length < max_length ? length : max_length);
 	}
 
 	/* Give the buffer back to the SCC. */
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 07/25] net: cosmetic: Clean up TFTP variables and functions
  2015-04-08  6:41 ` [U-Boot] [PATCH v2 0/25] " Joe Hershberger
                     ` (5 preceding siblings ...)
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 06/25] net: cosmetic: Fix var naming net <-> eth drivers Joe Hershberger
@ 2015-04-08  6:41   ` Joe Hershberger
  2015-04-08 12:46     ` Simon Glass
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 08/25] net: cosmetic: Clean up ARP " Joe Hershberger
                     ` (18 subsequent siblings)
  25 siblings, 1 reply; 103+ messages in thread
From: Joe Hershberger @ 2015-04-08  6:41 UTC (permalink / raw)
  To: u-boot

Make a thorough pass through all variables and function names contained
within tftp and remove CamelCase and improve naming.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

Changes in v2: None

 common/update.c |  16 +-
 net/net.c       |   6 +-
 net/tftp.c      | 483 ++++++++++++++++++++++++++++----------------------------
 net/tftp.h      |   8 +-
 4 files changed, 259 insertions(+), 254 deletions(-)

diff --git a/common/update.c b/common/update.c
index bc0c48f..1bf2f82 100644
--- a/common/update.c
+++ b/common/update.c
@@ -39,8 +39,8 @@
 #define CONFIG_UPDATE_TFTP_CNT_MAX	0
 #endif
 
-extern ulong TftpRRQTimeoutMSecs;
-extern int TftpRRQTimeoutCountMax;
+extern ulong tftp_timeout_ms;
+extern int tftp_timeout_count_max;
 extern flash_info_t flash_info[];
 extern ulong load_addr;
 
@@ -55,14 +55,14 @@ static int update_load(char *filename, ulong msec_max, int cnt_max, ulong addr)
 
 	rv = 0;
 	/* save used globals and env variable */
-	saved_timeout_msecs = TftpRRQTimeoutMSecs;
-	saved_timeout_count = TftpRRQTimeoutCountMax;
+	saved_timeout_msecs = tftp_timeout_ms;
+	saved_timeout_count = tftp_timeout_count_max;
 	saved_netretry = strdup(getenv("netretry"));
 	saved_bootfile = strdup(net_boot_file_name);
 
 	/* set timeouts for auto-update */
-	TftpRRQTimeoutMSecs = msec_max;
-	TftpRRQTimeoutCountMax = cnt_max;
+	tftp_timeout_ms = msec_max;
+	tftp_timeout_count_max = cnt_max;
 
 	/* we don't want to retry the connection if errors occur */
 	setenv("netretry", "no");
@@ -78,8 +78,8 @@ static int update_load(char *filename, ulong msec_max, int cnt_max, ulong addr)
 		flush_cache(addr, size);
 
 	/* restore changed globals and env variable */
-	TftpRRQTimeoutMSecs = saved_timeout_msecs;
-	TftpRRQTimeoutCountMax = saved_timeout_count;
+	tftp_timeout_ms = saved_timeout_msecs;
+	tftp_timeout_count_max = saved_timeout_count;
 
 	setenv("netretry", saved_netretry);
 	if (saved_netretry != NULL)
diff --git a/net/net.c b/net/net.c
index 5898260..b8acbb4 100644
--- a/net/net.c
+++ b/net/net.c
@@ -247,7 +247,7 @@ void net_auto_load(void)
 		net_set_state(NETLOOP_SUCCESS);
 		return;
 	}
-	TftpStart(TFTPGET);
+	tftp_start(TFTPGET);
 }
 
 static void NetInitLoop(void)
@@ -372,11 +372,11 @@ restart:
 		case TFTPPUT:
 #endif
 			/* always use ARP to get server ethernet address */
-			TftpStart(protocol);
+			tftp_start(protocol);
 			break;
 #ifdef CONFIG_CMD_TFTPSRV
 		case TFTPSRV:
-			TftpStartServer();
+			tftp_start_server();
 			break;
 #endif
 #if defined(CONFIG_CMD_DHCP)
diff --git a/net/tftp.c b/net/tftp.c
index f25abaa..14acf04 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -39,21 +39,21 @@
 #define TFTP_ERROR	5
 #define TFTP_OACK	6
 
-static ulong TftpTimeoutMSecs = TIMEOUT;
-static int TftpTimeoutCountMax = TIMEOUT_COUNT;
+static ulong timeout_ms = TIMEOUT;
+static int timeout_count_max = TIMEOUT_COUNT;
 static ulong time_start;   /* Record time we started tftp */
 
 /*
  * These globals govern the timeout behavior when attempting a connection to a
- * TFTP server. TftpRRQTimeoutMSecs specifies the number of milliseconds to
+ * TFTP server. tftp_timeout_ms specifies the number of milliseconds to
  * wait for the server to respond to initial connection. Second global,
- * TftpRRQTimeoutCountMax, gives the number of such connection retries.
- * TftpRRQTimeoutCountMax must be non-negative and TftpRRQTimeoutMSecs must be
+ * tftp_timeout_count_max, gives the number of such connection retries.
+ * tftp_timeout_count_max must be non-negative and tftp_timeout_ms must be
  * positive. The globals are meant to be set (and restored) by code needing
  * non-standard timeout behavior when initiating a TFTP transfer.
  */
-ulong TftpRRQTimeoutMSecs = TIMEOUT;
-int TftpRRQTimeoutCountMax = TIMEOUT_COUNT;
+ulong tftp_timeout_ms = TIMEOUT;
+int tftp_timeout_count_max = TIMEOUT_COUNT;
 
 enum {
 	TFTP_ERR_UNDEFINED           = 0,
@@ -67,30 +67,32 @@ enum {
 
 static struct in_addr tftp_remote_ip;
 /* The UDP port at their end */
-static int	TftpRemotePort;
+static int	tftp_remote_port;
 /* The UDP port at our end */
-static int	TftpOurPort;
-static int	TftpTimeoutCount;
+static int	tftp_our_port;
+static int	timeout_count;
 /* packet sequence number */
-static ulong	TftpBlock;
+static ulong	tftp_cur_block;
 /* last packet sequence number received */
-static ulong	TftpLastBlock;
+static ulong	tftp_prev_block;
 /* count of sequence number wraparounds */
-static ulong	TftpBlockWrap;
+static ulong	tftp_block_wrap;
 /* memory offset due to wrapping */
-static ulong	TftpBlockWrapOffset;
-static int	TftpState;
+static ulong	tftp_block_wrap_offset;
+static int	tftp_state;
 #ifdef CONFIG_TFTP_TSIZE
 /* The file size reported by the server */
-static int	TftpTsize;
+static int	tftp_tsize;
 /* The number of hashes we printed */
-static short	TftpNumchars;
+static short	tftp_tsize_num_hash;
 #endif
 #ifdef CONFIG_CMD_TFTPPUT
-static int	TftpWriting;	/* 1 if writing, else 0 */
-static int	TftpFinalBlock;	/* 1 if we have sent the last block */
+/* 1 if writing, else 0 */
+static int	tftp_put_active;
+/* 1 if we have sent the last block */
+static int	tftp_put_final_block_sent;
 #else
-#define TftpWriting	0
+#define tftp_put_active	0
 #endif
 
 #define STATE_SEND_RRQ	1
@@ -128,41 +130,42 @@ static char tftp_filename[MAX_LEN];
 #define TFTP_MTU_BLOCKSIZE 1468
 #endif
 
-static unsigned short TftpBlkSize = TFTP_BLOCK_SIZE;
-static unsigned short TftpBlkSizeOption = TFTP_MTU_BLOCKSIZE;
+static unsigned short tftp_block_size = TFTP_BLOCK_SIZE;
+static unsigned short tftp_block_size_option = TFTP_MTU_BLOCKSIZE;
 
 #ifdef CONFIG_MCAST_TFTP
 #include <malloc.h>
 #define MTFTP_BITMAPSIZE	0x1000
-static unsigned *Bitmap;
-static int PrevBitmapHole, Mapsize = MTFTP_BITMAPSIZE;
-static uchar ProhibitMcast, MasterClient;
-static uchar Multicast;
-static int Mcast_port;
-static ulong TftpEndingBlock; /* can get 'last' block before done..*/
+static unsigned *tftp_mcast_bitmap;
+static int tftp_mcast_prev_hole;
+static int tftp_mcast_bitmap_size = MTFTP_BITMAPSIZE;
+static int tftp_mcast_disabled;
+static int tftp_mcast_master_client;
+static int tftp_mcast_active;
+static int tftp_mcast_port;
+/* can get 'last' block before done..*/
+static ulong tftp_mcast_ending_block;
 
 static void parse_multicast_oack(char *pkt, int len);
 
-static void
-mcast_cleanup(void)
+static void mcast_cleanup(void)
 {
 	if (net_mcast_addr)
 		eth_mcast_join(net_mcast_addr, 0);
-	if (Bitmap)
-		free(Bitmap);
-	Bitmap = NULL;
+	if (tftp_mcast_bitmap)
+		free(tftp_mcast_bitmap);
+	tftp_mcast_bitmap = NULL;
 	net_mcast_addr.s_addr = 0;
-	Multicast = 0;
-	Mcast_port = 0;
-	TftpEndingBlock = -1;
+	tftp_mcast_active = 0;
+	tftp_mcast_port = 0;
+	tftp_mcast_ending_block = -1;
 }
 
 #endif	/* CONFIG_MCAST_TFTP */
 
-static inline void
-store_block(int block, uchar *src, unsigned len)
+static inline void store_block(int block, uchar *src, unsigned len)
 {
-	ulong offset = block * TftpBlkSize + TftpBlockWrapOffset;
+	ulong offset = block * tftp_block_size + tftp_block_wrap_offset;
 	ulong newsize = offset + len;
 #ifdef CONFIG_SYS_DIRECT_FLASH_TFTP
 	int i, rc = 0;
@@ -193,8 +196,8 @@ store_block(int block, uchar *src, unsigned len)
 		unmap_sysmem(ptr);
 	}
 #ifdef CONFIG_MCAST_TFTP
-	if (Multicast)
-		ext2_set_bit(block, Bitmap);
+	if (tftp_mcast_active)
+		ext2_set_bit(block, tftp_mcast_bitmap);
 #endif
 
 	if (net_boot_file_size < newsize)
@@ -204,11 +207,11 @@ store_block(int block, uchar *src, unsigned len)
 /* Clear our state ready for a new transfer */
 static void new_transfer(void)
 {
-	TftpLastBlock = 0;
-	TftpBlockWrap = 0;
-	TftpBlockWrapOffset = 0;
+	tftp_prev_block = 0;
+	tftp_block_wrap = 0;
+	tftp_block_wrap_offset = 0;
 #ifdef CONFIG_CMD_TFTPPUT
-	TftpFinalBlock = 0;
+	tftp_put_final_block_sent = 0;
 #endif
 }
 
@@ -224,38 +227,39 @@ static void new_transfer(void)
 static int load_block(unsigned block, uchar *dst, unsigned len)
 {
 	/* We may want to get the final block from the previous set */
-	ulong offset = ((int)block - 1) * len + TftpBlockWrapOffset;
+	ulong offset = ((int)block - 1) * len + tftp_block_wrap_offset;
 	ulong tosend = len;
 
 	tosend = min(net_boot_file_size - offset, tosend);
 	(void)memcpy(dst, (void *)(save_addr + offset), tosend);
 	debug("%s: block=%d, offset=%ld, len=%d, tosend=%ld\n", __func__,
-		block, offset, len, tosend);
+	      block, offset, len, tosend);
 	return tosend;
 }
 #endif
 
-static void TftpSend(void);
-static void TftpTimeout(void);
+static void tftp_send(void);
+static void tftp_timeout_handler(void);
 
 /**********************************************************************/
 
 static void show_block_marker(void)
 {
 #ifdef CONFIG_TFTP_TSIZE
-	if (TftpTsize) {
-		ulong pos = TftpBlock * TftpBlkSize + TftpBlockWrapOffset;
+	if (tftp_tsize) {
+		ulong pos = tftp_cur_block * tftp_block_size +
+			tftp_block_wrap_offset;
 
-		while (TftpNumchars < pos * 50 / TftpTsize) {
+		while (tftp_tsize_num_hash < pos * 50 / tftp_tsize) {
 			putc('#');
-			TftpNumchars++;
+			tftp_tsize_num_hash++;
 		}
 	} else
 #endif
 	{
-		if (((TftpBlock - 1) % 10) == 0)
+		if (((tftp_cur_block - 1) % 10) == 0)
 			putc('#');
-		else if ((TftpBlock % (10 * HASHES_PER_LINE)) == 0)
+		else if ((tftp_cur_block % (10 * HASHES_PER_LINE)) == 0)
 			puts("\n\t ");
 	}
 }
@@ -287,10 +291,10 @@ static void update_block_number(void)
 	 * number of 0 this means that there was a wrap
 	 * around of the (16 bit) counter.
 	 */
-	if (TftpBlock == 0 && TftpLastBlock != 0) {
-		TftpBlockWrap++;
-		TftpBlockWrapOffset += TftpBlkSize * TFTP_SEQUENCE_SIZE;
-		TftpTimeoutCount = 0; /* we've done well, reset thhe timeout */
+	if (tftp_cur_block == 0 && tftp_prev_block != 0) {
+		tftp_block_wrap++;
+		tftp_block_wrap_offset += tftp_block_size * TFTP_SEQUENCE_SIZE;
+		timeout_count = 0; /* we've done well, reset the timeout */
 	} else {
 		show_block_marker();
 	}
@@ -301,12 +305,12 @@ static void tftp_complete(void)
 {
 #ifdef CONFIG_TFTP_TSIZE
 	/* Print hash marks for the last packet received */
-	while (TftpTsize && TftpNumchars < 49) {
+	while (tftp_tsize && tftp_tsize_num_hash < 49) {
 		putc('#');
-		TftpNumchars++;
+		tftp_tsize_num_hash++;
 	}
 	puts("  ");
-	print_size(TftpTsize, "");
+	print_size(tftp_tsize, "");
 #endif
 	time_start = get_timer(time_start);
 	if (time_start > 0) {
@@ -318,8 +322,7 @@ static void tftp_complete(void)
 	net_set_state(NETLOOP_SUCCESS);
 }
 
-static void
-TftpSend(void)
+static void tftp_send(void)
 {
 	uchar *pkt;
 	uchar *xp;
@@ -328,9 +331,8 @@ TftpSend(void)
 
 #ifdef CONFIG_MCAST_TFTP
 	/* Multicast TFTP.. non-MasterClients do not ACK data. */
-	if (Multicast
-	 && (TftpState == STATE_DATA)
-	 && (MasterClient == 0))
+	if (tftp_mcast_active && tftp_state == STATE_DATA &&
+	    tftp_mcast_master_client == 0)
 		return;
 #endif
 	/*
@@ -339,13 +341,13 @@ TftpSend(void)
 	 */
 	pkt = net_tx_packet + net_eth_hdr_size() + IP_UDP_HDR_SIZE;
 
-	switch (TftpState) {
+	switch (tftp_state) {
 	case STATE_SEND_RRQ:
 	case STATE_SEND_WRQ:
 		xp = pkt;
 		s = (ushort *)pkt;
 #ifdef CONFIG_CMD_TFTPPUT
-		*s++ = htons(TftpState == STATE_SEND_RRQ ? TFTP_RRQ :
+		*s++ = htons(tftp_state == STATE_SEND_RRQ ? TFTP_RRQ :
 			TFTP_WRQ);
 #else
 		*s++ = htons(TFTP_RRQ);
@@ -357,7 +359,7 @@ TftpSend(void)
 		pkt += 5 /*strlen("octet")*/ + 1;
 		strcpy((char *)pkt, "timeout");
 		pkt += 7 /*strlen("timeout")*/ + 1;
-		sprintf((char *)pkt, "%lu", TftpTimeoutMSecs / 1000);
+		sprintf((char *)pkt, "%lu", timeout_ms / 1000);
 		debug("send option \"timeout %s\"\n", (char *)pkt);
 		pkt += strlen((char *)pkt) + 1;
 #ifdef CONFIG_TFTP_TSIZE
@@ -366,14 +368,14 @@ TftpSend(void)
 #endif
 		/* try for more effic. blk size */
 		pkt += sprintf((char *)pkt, "blksize%c%d%c",
-				0, TftpBlkSizeOption, 0);
+				0, tftp_block_size_option, 0);
 #ifdef CONFIG_MCAST_TFTP
 		/* Check all preconditions before even trying the option */
-		if (!ProhibitMcast) {
-			Bitmap = malloc(Mapsize);
-			if (Bitmap && eth_get_dev()->mcast) {
-				free(Bitmap);
-				Bitmap = NULL;
+		if (!tftp_mcast_disabled) {
+			tftp_mcast_bitmap = malloc(tftp_mcast_bitmap_size);
+			if (tftp_mcast_bitmap && eth_get_dev()->mcast) {
+				free(tftp_mcast_bitmap);
+				tftp_mcast_bitmap = NULL;
 				pkt += sprintf((char *)pkt, "multicast%c%c",
 					0, 0);
 			}
@@ -384,11 +386,12 @@ TftpSend(void)
 
 	case STATE_OACK:
 #ifdef CONFIG_MCAST_TFTP
-		/* My turn!  Start at where I need blocks I missed.*/
-		if (Multicast)
-			TftpBlock = ext2_find_next_zero_bit(Bitmap,
-							    (Mapsize*8), 0);
-		/*..falling..*/
+		/* My turn!  Start at where I need blocks I missed. */
+		if (tftp_mcast_active)
+			tftp_cur_block = ext2_find_next_zero_bit(
+				tftp_mcast_bitmap,
+				tftp_mcast_bitmap_size * 8, 0);
+		/* fall through */
 #endif
 
 	case STATE_RECV_WRQ:
@@ -396,16 +399,16 @@ TftpSend(void)
 		xp = pkt;
 		s = (ushort *)pkt;
 		s[0] = htons(TFTP_ACK);
-		s[1] = htons(TftpBlock);
+		s[1] = htons(tftp_cur_block);
 		pkt = (uchar *)(s + 2);
 #ifdef CONFIG_CMD_TFTPPUT
-		if (TftpWriting) {
-			int toload = TftpBlkSize;
-			int loaded = load_block(TftpBlock, pkt, toload);
+		if (tftp_put_active) {
+			int toload = tftp_block_size;
+			int loaded = load_block(tftp_cur_block, pkt, toload);
 
 			s[0] = htons(TFTP_DATA);
 			pkt += loaded;
-			TftpFinalBlock = (loaded < toload);
+			tftp_put_final_block_sent = (loaded < toload);
 		}
 #endif
 		len = pkt - xp;
@@ -435,8 +438,8 @@ TftpSend(void)
 		break;
 	}
 
-	net_send_udp_packet(net_server_ethaddr, tftp_remote_ip, TftpRemotePort,
-			    TftpOurPort, len);
+	net_send_udp_packet(net_server_ethaddr, tftp_remote_ip,
+			    tftp_remote_port, tftp_our_port, len);
 }
 
 #ifdef CONFIG_CMD_TFTPPUT
@@ -458,15 +461,15 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 	__be16 *s;
 	int i;
 
-	if (dest != TftpOurPort) {
+	if (dest != tftp_our_port) {
 #ifdef CONFIG_MCAST_TFTP
-		if (Multicast
-		 && (!Mcast_port || (dest != Mcast_port)))
+		if (tftp_mcast_active &&
+		    (!tftp_mcast_port || dest != tftp_mcast_port))
 #endif
 			return;
 	}
-	if (TftpState != STATE_SEND_RRQ && src != TftpRemotePort &&
-	    TftpState != STATE_RECV_WRQ && TftpState != STATE_SEND_WRQ)
+	if (tftp_state != STATE_SEND_RRQ && src != tftp_remote_port &&
+	    tftp_state != STATE_RECV_WRQ && tftp_state != STATE_SEND_WRQ)
 		return;
 
 	if (len < 2)
@@ -477,14 +480,13 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 	proto = *s++;
 	pkt = (uchar *)s;
 	switch (ntohs(proto)) {
-
 	case TFTP_RRQ:
 		break;
 
 	case TFTP_ACK:
 #ifdef CONFIG_CMD_TFTPPUT
-		if (TftpWriting) {
-			if (TftpFinalBlock) {
+		if (tftp_put_active) {
+			if (tftp_put_final_block_sent) {
 				tftp_complete();
 			} else {
 				/*
@@ -492,12 +494,12 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 				 * count to wrap just like the other end!
 				 */
 				int block = ntohs(*s);
-				int ack_ok = (TftpBlock == block);
+				int ack_ok = (tftp_cur_block == block);
 
-				TftpBlock = (unsigned short)(block + 1);
+				tftp_cur_block = (unsigned short)(block + 1);
 				update_block_number();
 				if (ack_ok)
-					TftpSend(); /* Send next data block */
+					tftp_send(); /* Send next data block */
 			}
 		}
 #endif
@@ -510,101 +512,98 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 	case TFTP_WRQ:
 		debug("Got WRQ\n");
 		tftp_remote_ip = sip;
-		TftpRemotePort = src;
-		TftpOurPort = 1024 + (get_timer(0) % 3072);
+		tftp_remote_port = src;
+		tftp_our_port = 1024 + (get_timer(0) % 3072);
 		new_transfer();
-		TftpSend(); /* Send ACK(0) */
+		tftp_send(); /* Send ACK(0) */
 		break;
 #endif
 
 	case TFTP_OACK:
 		debug("Got OACK: %s %s\n",
-			pkt,
-			pkt + strlen((char *)pkt) + 1);
-		TftpState = STATE_OACK;
-		TftpRemotePort = src;
+		      pkt, pkt + strlen((char *)pkt) + 1);
+		tftp_state = STATE_OACK;
+		tftp_remote_port = src;
 		/*
 		 * Check for 'blksize' option.
 		 * Careful: "i" is signed, "len" is unsigned, thus
 		 * something like "len-8" may give a *huge* number
 		 */
 		for (i = 0; i+8 < len; i++) {
-			if (strcmp((char *)pkt+i, "blksize") == 0) {
-				TftpBlkSize = (unsigned short)
-					simple_strtoul((char *)pkt+i+8, NULL,
-						       10);
+			if (strcmp((char *)pkt + i, "blksize") == 0) {
+				tftp_block_size = (unsigned short)
+					simple_strtoul((char *)pkt + i + 8,
+						       NULL, 10);
 				debug("Blocksize ack: %s, %d\n",
-					(char *)pkt+i+8, TftpBlkSize);
+				      (char *)pkt + i + 8, tftp_block_size);
 			}
 #ifdef CONFIG_TFTP_TSIZE
 			if (strcmp((char *)pkt+i, "tsize") == 0) {
-				TftpTsize = simple_strtoul((char *)pkt+i+6,
+				tftp_tsize = simple_strtoul((char *)pkt + i + 6,
 							   NULL, 10);
 				debug("size = %s, %d\n",
-					 (char *)pkt+i+6, TftpTsize);
+				      (char *)pkt + i + 6, tftp_tsize);
 			}
 #endif
 		}
 #ifdef CONFIG_MCAST_TFTP
-		parse_multicast_oack((char *)pkt, len-1);
-		if ((Multicast) && (!MasterClient))
-			TftpState = STATE_DATA;	/* passive.. */
+		parse_multicast_oack((char *)pkt, len - 1);
+		if ((tftp_mcast_active) && (!tftp_mcast_master_client))
+			tftp_state = STATE_DATA;	/* passive.. */
 		else
 #endif
 #ifdef CONFIG_CMD_TFTPPUT
-		if (TftpWriting) {
+		if (tftp_put_active) {
 			/* Get ready to send the first block */
-			TftpState = STATE_DATA;
-			TftpBlock++;
+			tftp_state = STATE_DATA;
+			tftp_cur_block++;
 		}
 #endif
-		TftpSend(); /* Send ACK or first data block */
+		tftp_send(); /* Send ACK or first data block */
 		break;
 	case TFTP_DATA:
 		if (len < 2)
 			return;
 		len -= 2;
-		TftpBlock = ntohs(*(__be16 *)pkt);
+		tftp_cur_block = ntohs(*(__be16 *)pkt);
 
 		update_block_number();
 
-		if (TftpState == STATE_SEND_RRQ)
+		if (tftp_state == STATE_SEND_RRQ)
 			debug("Server did not acknowledge timeout option!\n");
 
-		if (TftpState == STATE_SEND_RRQ || TftpState == STATE_OACK ||
-		    TftpState == STATE_RECV_WRQ) {
+		if (tftp_state == STATE_SEND_RRQ || tftp_state == STATE_OACK ||
+		    tftp_state == STATE_RECV_WRQ) {
 			/* first block received */
-			TftpState = STATE_DATA;
-			TftpRemotePort = src;
+			tftp_state = STATE_DATA;
+			tftp_remote_port = src;
 			new_transfer();
 
 #ifdef CONFIG_MCAST_TFTP
-			if (Multicast) { /* start!=1 common if mcast */
-				TftpLastBlock = TftpBlock - 1;
+			if (tftp_mcast_active) { /* start!=1 common if mcast */
+				tftp_prev_block = tftp_cur_block - 1;
 			} else
 #endif
-			if (TftpBlock != 1) {	/* Assertion */
-				printf("\nTFTP error: "
-				       "First block is not block 1 (%ld)\n"
-				       "Starting again\n\n",
-					TftpBlock);
+			if (tftp_cur_block != 1) {	/* Assertion */
+				puts("\nTFTP error: ");
+				printf("First block is not block 1 (%ld)\n",
+				       tftp_cur_block);
+				puts("Starting again\n\n");
 				NetStartAgain();
 				break;
 			}
 		}
 
-		if (TftpBlock == TftpLastBlock) {
-			/*
-			 *	Same block again; ignore it.
-			 */
+		if (tftp_cur_block == tftp_prev_block) {
+			/* Same block again; ignore it. */
 			break;
 		}
 
-		TftpLastBlock = TftpBlock;
-		TftpTimeoutCountMax = TIMEOUT_COUNT;
-		NetSetTimeout(TftpTimeoutMSecs, TftpTimeout);
+		tftp_prev_block = tftp_cur_block;
+		timeout_count_max = TIMEOUT_COUNT;
+		NetSetTimeout(timeout_ms, tftp_timeout_handler);
 
-		store_block(TftpBlock - 1, pkt + 2, len);
+		store_block(tftp_cur_block - 1, pkt + 2, len);
 
 		/*
 		 *	Acknowledge the block just received, which will prompt
@@ -614,39 +613,41 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 		/* if I am the MasterClient, actively calculate what my next
 		 * needed block is; else I'm passive; not ACKING
 		 */
-		if (Multicast) {
-			if (len < TftpBlkSize)  {
-				TftpEndingBlock = TftpBlock;
-			} else if (MasterClient) {
-				TftpBlock = PrevBitmapHole =
-					ext2_find_next_zero_bit(
-						Bitmap,
-						(Mapsize*8),
-						PrevBitmapHole);
-				if (TftpBlock > ((Mapsize*8) - 1)) {
-					printf("tftpfile too big\n");
+		if (tftp_mcast_active) {
+			if (len < tftp_block_size)  {
+				tftp_mcast_ending_block = tftp_cur_block;
+			} else if (tftp_mcast_master_client) {
+				tftp_mcast_prev_hole = ext2_find_next_zero_bit(
+					tftp_mcast_bitmap,
+					tftp_mcast_bitmap_size * 8,
+					tftp_mcast_prev_hole);
+				tftp_cur_block = tftp_mcast_prev_hole;
+				if (tftp_cur_block >
+				    ((tftp_mcast_bitmap_size * 8) - 1)) {
+					debug("tftpfile too big\n");
 					/* try to double it and retry */
-					Mapsize <<= 1;
+					tftp_mcast_bitmap_size <<= 1;
 					mcast_cleanup();
 					NetStartAgain();
 					return;
 				}
-				TftpLastBlock = TftpBlock;
+				tftp_prev_block = tftp_cur_block;
 			}
 		}
 #endif
-		TftpSend();
+		tftp_send();
 
 #ifdef CONFIG_MCAST_TFTP
-		if (Multicast) {
-			if (MasterClient && (TftpBlock >= TftpEndingBlock)) {
+		if (tftp_mcast_active) {
+			if (tftp_mcast_master_client &&
+			    (tftp_cur_block >= tftp_mcast_ending_block)) {
 				puts("\nMulticast tftp done\n");
 				mcast_cleanup();
 				net_set_state(NETLOOP_SUCCESS);
 			}
 		} else
 #endif
-		if (len < TftpBlkSize)
+		if (len < tftp_block_size)
 			tftp_complete();
 		break;
 
@@ -679,21 +680,20 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 }
 
 
-static void
-TftpTimeout(void)
+static void tftp_timeout_handler(void)
 {
-	if (++TftpTimeoutCount > TftpTimeoutCountMax) {
+	if (++timeout_count > timeout_count_max) {
 		restart("Retry count exceeded");
 	} else {
 		puts("T ");
-		NetSetTimeout(TftpTimeoutMSecs, TftpTimeout);
-		if (TftpState != STATE_RECV_WRQ)
-			TftpSend();
+		NetSetTimeout(timeout_ms, tftp_timeout_handler);
+		if (tftp_state != STATE_RECV_WRQ)
+			tftp_send();
 	}
 }
 
 
-void TftpStart(enum proto_t protocol)
+void tftp_start(enum proto_t protocol)
 {
 	char *ep;             /* Environment pointer */
 
@@ -703,21 +703,20 @@ void TftpStart(enum proto_t protocol)
 	 */
 	ep = getenv("tftpblocksize");
 	if (ep != NULL)
-		TftpBlkSizeOption = simple_strtol(ep, NULL, 10);
+		tftp_block_size_option = simple_strtol(ep, NULL, 10);
 
 	ep = getenv("tftptimeout");
 	if (ep != NULL)
-		TftpTimeoutMSecs = simple_strtol(ep, NULL, 10);
+		timeout_ms = simple_strtol(ep, NULL, 10);
 
-	if (TftpTimeoutMSecs < 1000) {
-		printf("TFTP timeout (%ld ms) too low, "
-			"set minimum = 1000 ms\n",
-			TftpTimeoutMSecs);
-		TftpTimeoutMSecs = 1000;
+	if (timeout_ms < 1000) {
+		printf("TFTP timeout (%ld ms) too low, set min = 1000 ms\n",
+		       timeout_ms);
+		timeout_ms = 1000;
 	}
 
 	debug("TFTP blocksize = %i, timeout = %ld ms\n",
-		TftpBlkSizeOption, TftpTimeoutMSecs);
+	      tftp_block_size_option, timeout_ms);
 
 	tftp_remote_ip = net_server_ip;
 	if (net_boot_file_name[0] == '\0') {
@@ -728,20 +727,20 @@ void TftpStart(enum proto_t protocol)
 			(net_ip.s_addr >> 24) & 0xFF);
 
 		strncpy(tftp_filename, default_filename, MAX_LEN);
-		tftp_filename[MAX_LEN-1] = 0;
+		tftp_filename[MAX_LEN - 1] = 0;
 
 		printf("*** Warning: no boot file name; using '%s'\n",
-			tftp_filename);
+		       tftp_filename);
 	} else {
 		char *p = strchr(net_boot_file_name, ':');
 
 		if (p == NULL) {
 			strncpy(tftp_filename, net_boot_file_name, MAX_LEN);
-			tftp_filename[MAX_LEN-1] = 0;
+			tftp_filename[MAX_LEN - 1] = 0;
 		} else {
 			tftp_remote_ip = string_to_ip(net_boot_file_name);
 			strncpy(tftp_filename, p + 1, MAX_LEN);
-			tftp_filename[MAX_LEN-1] = 0;
+			tftp_filename[MAX_LEN - 1] = 0;
 		}
 	}
 
@@ -750,9 +749,9 @@ void TftpStart(enum proto_t protocol)
 #ifdef CONFIG_CMD_TFTPPUT
 	       protocol == TFTPPUT ? "to" : "from",
 #else
-		"from",
+	       "from",
 #endif
-		&tftp_remote_ip, &net_ip);
+	       &tftp_remote_ip, &net_ip);
 
 	/* Check if we need to send across this subnet */
 	if (net_gateway.s_addr && net_netmask.s_addr) {
@@ -776,63 +775,62 @@ void TftpStart(enum proto_t protocol)
 
 	putc('\n');
 #ifdef CONFIG_CMD_TFTPPUT
-	TftpWriting = (protocol == TFTPPUT);
-	if (TftpWriting) {
+	tftp_put_active = (protocol == TFTPPUT);
+	if (tftp_put_active) {
 		printf("Save address: 0x%lx\n", save_addr);
 		printf("Save size:    0x%lx\n", save_size);
 		net_boot_file_size = save_size;
 		puts("Saving: *\b");
-		TftpState = STATE_SEND_WRQ;
+		tftp_state = STATE_SEND_WRQ;
 		new_transfer();
 	} else
 #endif
 	{
 		printf("Load address: 0x%lx\n", load_addr);
 		puts("Loading: *\b");
-		TftpState = STATE_SEND_RRQ;
+		tftp_state = STATE_SEND_RRQ;
 	}
 
 	time_start = get_timer(0);
-	TftpTimeoutCountMax = TftpRRQTimeoutCountMax;
+	timeout_count_max = tftp_timeout_count_max;
 
-	NetSetTimeout(TftpTimeoutMSecs, TftpTimeout);
+	NetSetTimeout(timeout_ms, tftp_timeout_handler);
 	net_set_udp_handler(tftp_handler);
 #ifdef CONFIG_CMD_TFTPPUT
 	net_set_icmp_handler(icmp_handler);
 #endif
-	TftpRemotePort = WELL_KNOWN_PORT;
-	TftpTimeoutCount = 0;
+	tftp_remote_port = WELL_KNOWN_PORT;
+	timeout_count = 0;
 	/* Use a pseudo-random port unless a specific port is set */
-	TftpOurPort = 1024 + (get_timer(0) % 3072);
+	tftp_our_port = 1024 + (get_timer(0) % 3072);
 
 #ifdef CONFIG_TFTP_PORT
 	ep = getenv("tftpdstp");
 	if (ep != NULL)
-		TftpRemotePort = simple_strtol(ep, NULL, 10);
+		tftp_remote_port = simple_strtol(ep, NULL, 10);
 	ep = getenv("tftpsrcp");
 	if (ep != NULL)
-		TftpOurPort = simple_strtol(ep, NULL, 10);
+		tftp_our_port = simple_strtol(ep, NULL, 10);
 #endif
-	TftpBlock = 0;
+	tftp_cur_block = 0;
 
 	/* zero out server ether in case the server ip has changed */
 	memset(net_server_ethaddr, 0, 6);
-	/* Revert TftpBlkSize to dflt */
-	TftpBlkSize = TFTP_BLOCK_SIZE;
+	/* Revert tftp_block_size to dflt */
+	tftp_block_size = TFTP_BLOCK_SIZE;
 #ifdef CONFIG_MCAST_TFTP
 	mcast_cleanup();
 #endif
 #ifdef CONFIG_TFTP_TSIZE
-	TftpTsize = 0;
-	TftpNumchars = 0;
+	tftp_tsize = 0;
+	tftp_tsize_num_hash = 0;
 #endif
 
-	TftpSend();
+	tftp_send();
 }
 
 #ifdef CONFIG_CMD_TFTPSRV
-void
-TftpStartServer(void)
+void tftp_start_server(void)
 {
 	tftp_filename[0] = 0;
 
@@ -842,22 +840,22 @@ TftpStartServer(void)
 
 	puts("Loading: *\b");
 
-	TftpTimeoutCountMax = TIMEOUT_COUNT;
-	TftpTimeoutCount = 0;
-	TftpTimeoutMSecs = TIMEOUT;
-	NetSetTimeout(TftpTimeoutMSecs, TftpTimeout);
+	timeout_count_max = TIMEOUT_COUNT;
+	timeout_count = 0;
+	timeout_ms = TIMEOUT;
+	NetSetTimeout(timeout_ms, tftp_timeout_handler);
 
-	/* Revert TftpBlkSize to dflt */
-	TftpBlkSize = TFTP_BLOCK_SIZE;
-	TftpBlock = 0;
-	TftpOurPort = WELL_KNOWN_PORT;
+	/* Revert tftp_block_size to dflt */
+	tftp_block_size = TFTP_BLOCK_SIZE;
+	tftp_cur_block = 0;
+	tftp_our_port = WELL_KNOWN_PORT;
 
 #ifdef CONFIG_TFTP_TSIZE
-	TftpTsize = 0;
-	TftpNumchars = 0;
+	tftp_tsize = 0;
+	tftp_tsize_num_hash = 0;
 #endif
 
-	TftpState = STATE_RECV_WRQ;
+	tftp_state = STATE_RECV_WRQ;
 	net_set_udp_handler(tftp_handler);
 
 	/* zero out server ether in case the server ip has changed */
@@ -866,10 +864,12 @@ TftpStartServer(void)
 #endif /* CONFIG_CMD_TFTPSRV */
 
 #ifdef CONFIG_MCAST_TFTP
-/* Credits: atftp project.
+/*
+ * Credits: atftp project.
  */
 
-/* pick up BcastAddr, Port, and whether I am [now] the master-client. *
+/*
+ * Pick up BcastAddr, Port, and whether I am [now] the master-client.
  * Frame:
  *    +-------+-----------+---+-------~~-------+---+
  *    |  opc  | multicast | 0 | addr, port, mc | 0 |
@@ -885,58 +885,62 @@ static void parse_multicast_oack(char *pkt, int len)
 {
 	int i;
 	struct in_addr addr;
-	char *mc_adr, *port,  *mc;
+	char *mc_adr;
+	char *port;
+	char *mc;
 
-	mc_adr = port = mc = NULL;
+	mc_adr = NULL;
+	port = NULL;
+	mc = NULL;
 	/* march along looking for 'multicast\0', which has to start at least
 	 * 14 bytes back from the end.
 	 */
-	for (i = 0; i < len-14; i++)
-		if (strcmp(pkt+i, "multicast") == 0)
+	for (i = 0; i < len - 14; i++)
+		if (strcmp(pkt + i, "multicast") == 0)
 			break;
-	if (i >= (len-14)) /* non-Multicast OACK, ign. */
+	if (i >= (len - 14)) /* non-Multicast OACK, ign. */
 		return;
 
 	i += 10; /* strlen multicast */
-	mc_adr = pkt+i;
+	mc_adr = pkt + i;
 	for (; i < len; i++) {
-		if (*(pkt+i) == ',') {
-			*(pkt+i) = '\0';
+		if (*(pkt + i) == ',') {
+			*(pkt + i) = '\0';
 			if (port) {
-				mc = pkt+i+1;
+				mc = pkt + i + 1;
 				break;
 			} else {
-				port = pkt+i+1;
+				port = pkt + i + 1;
 			}
 		}
 	}
 	if (!port || !mc_adr || !mc)
 		return;
-	if (Multicast && MasterClient) {
+	if (tftp_mcast_active && tftp_mcast_master_client) {
 		printf("I got a OACK as master Client, WRONG!\n");
 		return;
 	}
 	/* ..I now accept packets destined for this MCAST addr, port */
-	if (!Multicast) {
-		if (Bitmap) {
+	if (!tftp_mcast_active) {
+		if (tftp_mcast_bitmap) {
 			printf("Internal failure! no mcast.\n");
-			free(Bitmap);
-			Bitmap = NULL;
-			ProhibitMcast = 1;
-			return ;
+			free(tftp_mcast_bitmap);
+			tftp_mcast_bitmap = NULL;
+			tftp_mcast_disabled = 1;
+			return;
 		}
 		/* I malloc instead of pre-declare; so that if the file ends
 		 * up being too big for this bitmap I can retry
 		 */
-		Bitmap = malloc(Mapsize);
-		if (!Bitmap) {
-			printf("No Bitmap, no multicast. Sorry.\n");
-			ProhibitMcast = 1;
+		tftp_mcast_bitmap = malloc(tftp_mcast_bitmap_size);
+		if (!tftp_mcast_bitmap) {
+			printf("No bitmap, no multicast. Sorry.\n");
+			tftp_mcast_disabled = 1;
 			return;
 		}
-		memset(Bitmap, 0, Mapsize);
-		PrevBitmapHole = 0;
-		Multicast = 1;
+		memset(tftp_mcast_bitmap, 0, tftp_mcast_bitmap_size);
+		tftp_mcast_prev_hole = 0;
+		tftp_mcast_active = 1;
 	}
 	addr = string_to_ip(mc_adr);
 	if (net_mcast_addr.s_addr != addr.s_addr) {
@@ -945,14 +949,15 @@ static void parse_multicast_oack(char *pkt, int len)
 		net_mcast_addr = addr;
 		if (eth_mcast_join(net_mcast_addr, 1)) {
 			printf("Fail to set mcast, revert to TFTP\n");
-			ProhibitMcast = 1;
+			tftp_mcast_disabled = 1;
 			mcast_cleanup();
 			NetStartAgain();
 		}
 	}
-	MasterClient = (unsigned char)simple_strtoul((char *)mc, NULL, 10);
-	Mcast_port = (unsigned short)simple_strtoul(port, NULL, 10);
-	printf("Multicast: %s:%d [%d]\n", mc_adr, Mcast_port, MasterClient);
+	tftp_mcast_master_client = simple_strtoul((char *)mc, NULL, 10);
+	tftp_mcast_port = (unsigned short)simple_strtoul(port, NULL, 10);
+	printf("Multicast: %s:%d [%d]\n", mc_adr, tftp_mcast_port,
+	       tftp_mcast_master_client);
 	return;
 }
 
diff --git a/net/tftp.h b/net/tftp.h
index 2b686e3..c411c9b 100644
--- a/net/tftp.h
+++ b/net/tftp.h
@@ -16,14 +16,14 @@
  */
 
 /* tftp.c */
-void TftpStart(enum proto_t protocol);	/* Begin TFTP get/put */
+void tftp_start(enum proto_t protocol);	/* Begin TFTP get/put */
 
 #ifdef CONFIG_CMD_TFTPSRV
-extern void TftpStartServer(void);	/* Wait for incoming TFTP put */
+void tftp_start_server(void);	/* Wait for incoming TFTP put */
 #endif
 
-extern ulong TftpRRQTimeoutMSecs;
-extern int TftpRRQTimeoutCountMax;
+extern ulong tftp_timeout_ms;
+extern int tftp_timeout_count_max;
 
 /**********************************************************************/
 
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 08/25] net: cosmetic: Clean up ARP variables and functions
  2015-04-08  6:41 ` [U-Boot] [PATCH v2 0/25] " Joe Hershberger
                     ` (6 preceding siblings ...)
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 07/25] net: cosmetic: Clean up TFTP variables and functions Joe Hershberger
@ 2015-04-08  6:41   ` Joe Hershberger
  2015-04-08 12:46     ` Simon Glass
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 09/25] net: cosmetic: Clean up DHCP " Joe Hershberger
                     ` (17 subsequent siblings)
  25 siblings, 1 reply; 103+ messages in thread
From: Joe Hershberger @ 2015-04-08  6:41 UTC (permalink / raw)
  To: u-boot

Make a thorough pass through all variables and function names contained
within arp and remove CamelCase and improve naming.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

Changes in v2: None

 net/arp.c  | 69 +++++++++++++++++++++++++++++++-------------------------------
 net/arp.h  | 16 +++++++--------
 net/net.c  | 16 +++++++--------
 net/ping.c |  8 ++++----
 4 files changed, 54 insertions(+), 55 deletions(-)

diff --git a/net/arp.c b/net/arp.c
index 6841b61..953f312 100644
--- a/net/arp.c
+++ b/net/arp.c
@@ -30,40 +30,40 @@
 struct in_addr net_arp_wait_packet_ip;
 static struct in_addr net_arp_wait_reply_ip;
 /* MAC address of waiting packet's destination */
-uchar	       *NetArpWaitPacketMAC;
-int		NetArpWaitTxPacketSize;
-ulong		NetArpWaitTimerStart;
-int		NetArpWaitTry;
+uchar	       *arp_wait_packet_ethaddr;
+int		arp_wait_tx_packet_size;
+ulong		arp_wait_timer_start;
+int		arp_wait_try;
 
-static uchar   *net_arp_tx_packet;	/* THE ARP transmit packet */
-static uchar	NetArpPacketBuf[PKTSIZE_ALIGN + PKTALIGN];
+static uchar   *arp_tx_packet;	/* THE ARP transmit packet */
+static uchar	arp_tx_packet_buf[PKTSIZE_ALIGN + PKTALIGN];
 
-void ArpInit(void)
+void arp_init(void)
 {
 	/* XXX problem with bss workaround */
-	NetArpWaitPacketMAC = NULL;
+	arp_wait_packet_ethaddr = NULL;
 	net_arp_wait_packet_ip.s_addr = 0;
 	net_arp_wait_reply_ip.s_addr = 0;
-	NetArpWaitTxPacketSize = 0;
-	net_arp_tx_packet = &NetArpPacketBuf[0] + (PKTALIGN - 1);
-	net_arp_tx_packet -= (ulong)net_arp_tx_packet % PKTALIGN;
+	arp_wait_tx_packet_size = 0;
+	arp_tx_packet = &arp_tx_packet_buf[0] + (PKTALIGN - 1);
+	arp_tx_packet -= (ulong)arp_tx_packet % PKTALIGN;
 }
 
-void arp_raw_request(struct in_addr source_ip, const uchar *targetEther,
+void arp_raw_request(struct in_addr source_ip, const uchar *target_ethaddr,
 	struct in_addr target_ip)
 {
 	uchar *pkt;
 	struct arp_hdr *arp;
 	int eth_hdr_size;
 
-	debug_cond(DEBUG_DEV_PKT, "ARP broadcast %d\n", NetArpWaitTry);
+	debug_cond(DEBUG_DEV_PKT, "ARP broadcast %d\n", arp_wait_try);
 
-	pkt = net_arp_tx_packet;
+	pkt = arp_tx_packet;
 
 	eth_hdr_size = net_set_ether(pkt, net_bcast_ethaddr, PROT_ARP);
 	pkt += eth_hdr_size;
 
-	arp = (struct arp_hdr *) pkt;
+	arp = (struct arp_hdr *)pkt;
 
 	arp->ar_hrd = htons(ARP_ETHER);
 	arp->ar_pro = htons(PROT_IP);
@@ -73,13 +73,13 @@ void arp_raw_request(struct in_addr source_ip, const uchar *targetEther,
 
 	memcpy(&arp->ar_sha, net_ethaddr, ARP_HLEN);	/* source ET addr */
 	net_write_ip(&arp->ar_spa, source_ip);		/* source IP addr */
-	memcpy(&arp->ar_tha, targetEther, ARP_HLEN);	/* target ET addr */
+	memcpy(&arp->ar_tha, target_ethaddr, ARP_HLEN);	/* target ET addr */
 	net_write_ip(&arp->ar_tpa, target_ip);		/* target IP addr */
 
-	net_send_packet(net_arp_tx_packet, eth_hdr_size + ARP_HDR_SIZE);
+	net_send_packet(arp_tx_packet, eth_hdr_size + ARP_HDR_SIZE);
 }
 
-void ArpRequest(void)
+void arp_request(void)
 {
 	if ((net_arp_wait_packet_ip.s_addr & net_netmask.s_addr) !=
 	    (net_ip.s_addr & net_netmask.s_addr)) {
@@ -96,7 +96,7 @@ void ArpRequest(void)
 	arp_raw_request(net_ip, net_null_ethaddr, net_arp_wait_reply_ip);
 }
 
-void ArpTimeoutCheck(void)
+void arp_timeout_check(void)
 {
 	ulong t;
 
@@ -106,21 +106,21 @@ void ArpTimeoutCheck(void)
 	t = get_timer(0);
 
 	/* check for arp timeout */
-	if ((t - NetArpWaitTimerStart) > ARP_TIMEOUT) {
-		NetArpWaitTry++;
+	if ((t - arp_wait_timer_start) > ARP_TIMEOUT) {
+		arp_wait_try++;
 
-		if (NetArpWaitTry >= ARP_TIMEOUT_COUNT) {
+		if (arp_wait_try >= ARP_TIMEOUT_COUNT) {
 			puts("\nARP Retry count exceeded; starting again\n");
-			NetArpWaitTry = 0;
+			arp_wait_try = 0;
 			NetStartAgain();
 		} else {
-			NetArpWaitTimerStart = t;
-			ArpRequest();
+			arp_wait_timer_start = t;
+			arp_request();
 		}
 	}
 }
 
-void ArpReceive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
+void arp_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
 {
 	struct arp_hdr *arp;
 	struct in_addr reply_ip_addr;
@@ -205,28 +205,27 @@ void ArpReceive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
 		/* matched waiting packet's address */
 		if (reply_ip_addr.s_addr == net_arp_wait_reply_ip.s_addr) {
 			debug_cond(DEBUG_DEV_PKT,
-				"Got ARP REPLY, set eth addr (%pM)\n",
-				arp->ar_data);
+				   "Got ARP REPLY, set eth addr (%pM)\n",
+				   arp->ar_data);
 
 			/* save address for later use */
-			if (NetArpWaitPacketMAC != NULL)
-				memcpy(NetArpWaitPacketMAC,
+			if (arp_wait_packet_ethaddr != NULL)
+				memcpy(arp_wait_packet_ethaddr,
 				       &arp->ar_sha, ARP_HLEN);
 
 			net_get_arp_handler()((uchar *)arp, 0, reply_ip_addr,
-				0, len);
+					      0, len);
 
 			/* set the mac address in the waiting packet's header
 			   and transmit it */
 			memcpy(((struct ethernet_hdr *)net_tx_packet)->et_dest,
 			       &arp->ar_sha, ARP_HLEN);
-			net_send_packet(net_tx_packet, NetArpWaitTxPacketSize);
+			net_send_packet(net_tx_packet, arp_wait_tx_packet_size);
 
 			/* no arp request pending now */
 			net_arp_wait_packet_ip.s_addr = 0;
-			NetArpWaitTxPacketSize = 0;
-			NetArpWaitPacketMAC = NULL;
-
+			arp_wait_tx_packet_size = 0;
+			arp_wait_packet_ethaddr = NULL;
 		}
 		return;
 	default:
diff --git a/net/arp.h b/net/arp.h
index 718342b..43c6296 100644
--- a/net/arp.h
+++ b/net/arp.h
@@ -16,16 +16,16 @@
 
 extern struct in_addr net_arp_wait_packet_ip;
 /* MAC address of waiting packet's destination */
-extern uchar *NetArpWaitPacketMAC;
-extern int NetArpWaitTxPacketSize;
-extern ulong NetArpWaitTimerStart;
-extern int NetArpWaitTry;
+extern uchar *arp_wait_packet_ethaddr;
+extern int arp_wait_tx_packet_size;
+extern ulong arp_wait_timer_start;
+extern int arp_wait_try;
 
-void ArpInit(void);
-void ArpRequest(void);
+void arp_init(void);
+void arp_request(void);
 void arp_raw_request(struct in_addr source_ip, const uchar *targetEther,
 	struct in_addr target_ip);
-void ArpTimeoutCheck(void);
-void ArpReceive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len);
+void arp_timeout_check(void);
+void arp_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len);
 
 #endif /* __ARP_H__ */
diff --git a/net/net.c b/net/net.c
index b8acbb4..9a4290b 100644
--- a/net/net.c
+++ b/net/net.c
@@ -302,7 +302,7 @@ void net_init(void)
 			net_rx_packets[i] = net_tx_packet +
 				(i + 1) * PKTSIZE_ALIGN;
 		}
-		ArpInit();
+		arp_init();
 		net_clear_handlers();
 
 		/* Only need to setup buffer pointers once. */
@@ -495,7 +495,7 @@ restart:
 			goto done;
 		}
 
-		ArpTimeoutCheck();
+		arp_timeout_check();
 
 		/*
 		 *	Check for a timeout, and run the timeout handler
@@ -733,15 +733,15 @@ int net_send_udp_packet(uchar *ether, struct in_addr dest, int dport, int sport,
 
 		/* save the ip and eth addr for the packet to send after arp */
 		net_arp_wait_packet_ip = dest;
-		NetArpWaitPacketMAC = ether;
+		arp_wait_packet_ethaddr = ether;
 
 		/* size of the waiting packet */
-		NetArpWaitTxPacketSize = pkt_hdr_size + payload_len;
+		arp_wait_tx_packet_size = pkt_hdr_size + payload_len;
 
 		/* and do the ARP request */
-		NetArpWaitTry = 1;
-		NetArpWaitTimerStart = get_timer(0);
-		ArpRequest();
+		arp_wait_try = 1;
+		arp_wait_timer_start = get_timer(0);
+		arp_request();
 		return 1;	/* waiting */
 	} else {
 		debug_cond(DEBUG_DEV_PKT, "sending UDP to %pI4/%pM\n",
@@ -1059,7 +1059,7 @@ void net_process_received_packet(uchar *in_packet, int len)
 	switch (eth_proto) {
 
 	case PROT_ARP:
-		ArpReceive(et, ip, len);
+		arp_receive(et, ip, len);
 		break;
 
 #ifdef CONFIG_CMD_RARP
diff --git a/net/ping.c b/net/ping.c
index 7c6084c..76e8749 100644
--- a/net/ping.c
+++ b/net/ping.c
@@ -56,12 +56,12 @@ static int ping_send(void)
 	set_icmp_header(pkt, net_ping_ip);
 
 	/* size of the waiting packet */
-	NetArpWaitTxPacketSize = eth_hdr_size + IP_ICMP_HDR_SIZE;
+	arp_wait_tx_packet_size = eth_hdr_size + IP_ICMP_HDR_SIZE;
 
 	/* and do the ARP request */
-	NetArpWaitTry = 1;
-	NetArpWaitTimerStart = get_timer(0);
-	ArpRequest();
+	arp_wait_try = 1;
+	arp_wait_timer_start = get_timer(0);
+	arp_request();
 	return 1;	/* waiting */
 }
 
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 09/25] net: cosmetic: Clean up DHCP variables and functions
  2015-04-08  6:41 ` [U-Boot] [PATCH v2 0/25] " Joe Hershberger
                     ` (7 preceding siblings ...)
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 08/25] net: cosmetic: Clean up ARP " Joe Hershberger
@ 2015-04-08  6:41   ` Joe Hershberger
  2015-04-08 12:46     ` Simon Glass
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 10/25] net: cosmetic: Clean up NFS " Joe Hershberger
                     ` (16 subsequent siblings)
  25 siblings, 1 reply; 103+ messages in thread
From: Joe Hershberger @ 2015-04-08  6:41 UTC (permalink / raw)
  To: u-boot

Make a thorough pass through all variables and function names contained
within bootp.c and remove CamelCase and improve naming.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

Changes in v2: None

 net/bootp.c | 119 +++++++++++++++++++++++++++++-------------------------------
 net/bootp.h |  14 +++----
 net/net.c   |   8 ++--
 3 files changed, 69 insertions(+), 72 deletions(-)

diff --git a/net/bootp.c b/net/bootp.c
index 9788b52..fa75125 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -53,7 +53,7 @@
 
 ulong		bootp_ids[CONFIG_BOOTP_ID_CACHE_SIZE];
 unsigned int	bootp_num_ids;
-int		BootpTry;
+int		bootp_try;
 ulong		bootp_start;
 ulong		bootp_timeout;
 char net_nis_domain[32] = {0,}; /* Our NIS domain */
@@ -109,14 +109,14 @@ static bool bootp_match_id(ulong id)
 	return false;
 }
 
-static int BootpCheckPkt(uchar *pkt, unsigned dest, unsigned src, unsigned len)
+static int check_packet(uchar *pkt, unsigned dest, unsigned src, unsigned len)
 {
-	struct Bootp_t *bp = (struct Bootp_t *) pkt;
+	struct bootp_hdr *bp = (struct bootp_hdr *)pkt;
 	int retval = 0;
 
 	if (dest != PORT_BOOTPC || src != PORT_BOOTPS)
 		retval = -1;
-	else if (len < sizeof(struct Bootp_t) - OPT_FIELD_SIZE)
+	else if (len < sizeof(struct bootp_hdr) - OPT_FIELD_SIZE)
 		retval = -2;
 	else if (bp->bp_op != OP_BOOTREQUEST &&
 			bp->bp_op != OP_BOOTREPLY &&
@@ -139,7 +139,7 @@ static int BootpCheckPkt(uchar *pkt, unsigned dest, unsigned src, unsigned len)
 /*
  * Copy parameters of interest from BOOTP_REPLY/DHCP_OFFER packet
  */
-static void BootpCopyNetParams(struct Bootp_t *bp)
+static void store_net_params(struct bootp_hdr *bp)
 {
 #if !defined(CONFIG_BOOTP_SERVERIP)
 	struct in_addr tmp_ip;
@@ -177,12 +177,12 @@ static int truncate_sz(const char *name, int maxlen, int curlen)
 
 #if !defined(CONFIG_CMD_DHCP)
 
-static void BootpVendorFieldProcess(u8 *ext)
+static void bootp_process_vendor_field(u8 *ext)
 {
 	int size = *(ext + 1);
 
 	debug("[BOOTP] Processing extension %d... (%d bytes)\n", *ext,
-		*(ext + 1));
+	      *(ext + 1));
 
 	net_boot_file_expected_size_in_blocks = 0;
 
@@ -285,7 +285,7 @@ static void BootpVendorFieldProcess(u8 *ext)
 	}
 }
 
-static void BootpVendorProcess(u8 *ext, int size)
+static void bootp_process_vendor(u8 *ext, int size)
 {
 	u8 *end = ext + size;
 
@@ -299,7 +299,7 @@ static void BootpVendorProcess(u8 *ext, int size)
 
 			ext += ext[1] + 2;
 			if (ext <= end)
-				BootpVendorFieldProcess(opt);
+				bootp_process_vendor_field(opt);
 		}
 	}
 
@@ -335,15 +335,15 @@ static void BootpVendorProcess(u8 *ext, int size)
 static void bootp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 			  unsigned src, unsigned len)
 {
-	struct Bootp_t *bp;
+	struct bootp_hdr *bp;
 
 	debug("got BOOTP packet (src=%d, dst=%d, len=%d want_len=%zu)\n",
-		src, dest, len, sizeof(struct Bootp_t));
+	      src, dest, len, sizeof(struct bootp_hdr));
 
-	bp = (struct Bootp_t *)pkt;
+	bp = (struct bootp_hdr *)pkt;
 
 	/* Filter out pkts we don't want */
-	if (BootpCheckPkt(pkt, dest, src, len))
+	if (check_packet(pkt, dest, src, len))
 		return;
 
 	/*
@@ -353,11 +353,11 @@ static void bootp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 	status_led_set(STATUS_LED_BOOT, STATUS_LED_OFF);
 #endif
 
-	BootpCopyNetParams(bp);		/* Store net parameters from reply */
+	store_net_params(bp);		/* Store net parameters from reply */
 
 	/* Retrieve extended information (we must parse the vendor area) */
 	if (NetReadLong((ulong *)&bp->bp_vend[0]) == htonl(BOOTP_VENDOR_MAGIC))
-		BootpVendorProcess((uchar *)&bp->bp_vend[4], len);
+		bootp_process_vendor((uchar *)&bp->bp_vend[4], len);
 
 	NetSetTimeout(0, (thand_f *)0);
 	bootstage_mark_name(BOOTSTAGE_ID_BOOTP_STOP, "bootp_stop");
@@ -371,8 +371,7 @@ static void bootp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 /*
  *	Timeout on BOOTP/DHCP request.
  */
-static void
-BootpTimeout(void)
+static void bootp_timeout_handler(void)
 {
 	ulong time_taken = get_timer(bootp_start);
 
@@ -388,8 +387,8 @@ BootpTimeout(void)
 		bootp_timeout *= 2;
 		if (bootp_timeout > 2000)
 			bootp_timeout = 2000;
-		NetSetTimeout(bootp_timeout, BootpTimeout);
-		BootpRequest();
+		NetSetTimeout(bootp_timeout, bootp_timeout_handler);
+		bootp_request();
 	}
 }
 
@@ -649,25 +648,24 @@ static int bootp_extended(u8 *e)
 }
 #endif
 
-void BootpReset(void)
+void bootp_reset(void)
 {
 	bootp_num_ids = 0;
-	BootpTry = 0;
+	bootp_try = 0;
 	bootp_start = get_timer(0);
 	bootp_timeout = 250;
 }
 
-void
-BootpRequest(void)
+void bootp_request(void)
 {
 	uchar *pkt, *iphdr;
-	struct Bootp_t *bp;
+	struct bootp_hdr *bp;
 	int extlen, pktlen, iplen;
 	int eth_hdr_size;
 #ifdef CONFIG_BOOTP_RANDOM_DELAY
 	ulong rand_ms;
 #endif
-	ulong BootpID;
+	ulong bootp_id;
 	struct in_addr zero_ip;
 	struct in_addr bcast_ip;
 
@@ -677,11 +675,11 @@ BootpRequest(void)
 #endif
 
 #ifdef CONFIG_BOOTP_RANDOM_DELAY		/* Random BOOTP delay */
-	if (BootpTry == 0)
+	if (bootp_try == 0)
 		srand_mac();
 
-	if (BootpTry <= 2)	/* Start with max 1024 * 1ms */
-		rand_ms = rand() >> (22 - BootpTry);
+	if (bootp_try <= 2)	/* Start with max 1024 * 1ms */
+		rand_ms = rand() >> (22 - bootp_try);
 	else		/* After 3rd BOOTP request max 8192 * 1ms */
 		rand_ms = rand() >> 19;
 
@@ -690,7 +688,7 @@ BootpRequest(void)
 
 #endif	/* CONFIG_BOOTP_RANDOM_DELAY */
 
-	printf("BOOTP broadcast %d\n", ++BootpTry);
+	printf("BOOTP broadcast %d\n", ++bootp_try);
 	pkt = net_tx_packet;
 	memset((void *)pkt, 0, PKTSIZE);
 
@@ -705,11 +703,11 @@ BootpRequest(void)
 	 * C. Hallinan, DS4.COM, Inc.
 	 */
 	/* net_set_udp_header(pkt, 0xFFFFFFFFL, PORT_BOOTPS, PORT_BOOTPC,
-		sizeof (struct Bootp_t)); */
+		sizeof (struct bootp_hdr)); */
 	iphdr = pkt;	/* We need this later for net_set_udp_header() */
 	pkt += IP_UDP_HDR_SIZE;
 
-	bp = (struct Bootp_t *)pkt;
+	bp = (struct bootp_hdr *)pkt;
 	bp->bp_op = OP_BOOTREQUEST;
 	bp->bp_htype = HWT_ETHER;
 	bp->bp_hlen = HWL_ETHER;
@@ -735,14 +733,14 @@ BootpRequest(void)
 	 *	Bootp ID is the lower 4 bytes of our ethernet address
 	 *	plus the current time in ms.
 	 */
-	BootpID = ((ulong)net_ethaddr[2] << 24)
+	bootp_id = ((ulong)net_ethaddr[2] << 24)
 		| ((ulong)net_ethaddr[3] << 16)
 		| ((ulong)net_ethaddr[4] << 8)
 		| (ulong)net_ethaddr[5];
-	BootpID += get_timer(0);
-	BootpID = htonl(BootpID);
-	bootp_add_id(BootpID);
-	NetCopyLong(&bp->bp_id, &BootpID);
+	bootp_id += get_timer(0);
+	bootp_id = htonl(bootp_id);
+	bootp_add_id(bootp_id);
+	NetCopyLong(&bp->bp_id, &bootp_id);
 
 	/*
 	 * Calculate proper packet lengths taking into account the
@@ -752,7 +750,7 @@ BootpRequest(void)
 	pktlen = eth_hdr_size + IP_UDP_HDR_SIZE + iplen;
 	bcast_ip.s_addr = 0xFFFFFFFFL;
 	net_set_udp_header(iphdr, bcast_ip, PORT_BOOTPS, PORT_BOOTPC, iplen);
-	NetSetTimeout(bootp_timeout, BootpTimeout);
+	NetSetTimeout(bootp_timeout, bootp_timeout_handler);
 
 #if defined(CONFIG_CMD_DHCP)
 	dhcp_state = SELECTING;
@@ -764,7 +762,7 @@ BootpRequest(void)
 }
 
 #if defined(CONFIG_CMD_DHCP)
-static void DhcpOptionsProcess(uchar *popt, struct Bootp_t *bp)
+static void dhcp_process_options(uchar *popt, struct bootp_hdr *bp)
 {
 	uchar *end = popt + BOOTP_HDR_SIZE;
 	int oplen, size;
@@ -851,7 +849,7 @@ static void DhcpOptionsProcess(uchar *popt, struct Bootp_t *bp)
 				 * to me
 				 */
 				printf("*** WARNING: using vendor "
-					"optional boot file\n");
+				       "optional boot file\n");
 				memcpy(bp->bp_file, popt + 2, size);
 				bp->bp_file[size] = '\0';
 			}
@@ -862,14 +860,14 @@ static void DhcpOptionsProcess(uchar *popt, struct Bootp_t *bp)
 				break;
 #endif
 			printf("*** Unhandled DHCP Option in OFFER/ACK:"
-				" %d\n", *popt);
+			       " %d\n", *popt);
 			break;
 		}
 		popt += oplen + 2;	/* Process next option */
 	}
 }
 
-static int DhcpMessageType(unsigned char *popt)
+static int dhcp_message_type(unsigned char *popt)
 {
 	if (NetReadLong((ulong *)popt) != htonl(BOOTP_VENDOR_MAGIC))
 		return -1;
@@ -883,17 +881,17 @@ static int DhcpMessageType(unsigned char *popt)
 	return -1;
 }
 
-static void DhcpSendRequestPkt(struct Bootp_t *bp_offer)
+static void dhcp_send_request_packet(struct bootp_hdr *bp_offer)
 {
 	uchar *pkt, *iphdr;
-	struct Bootp_t *bp;
+	struct bootp_hdr *bp;
 	int pktlen, iplen, extlen;
 	int eth_hdr_size;
 	struct in_addr offered_ip;
 	struct in_addr zero_ip;
 	struct in_addr bcast_ip;
 
-	debug("DhcpSendRequestPkt: Sending DHCPREQUEST\n");
+	debug("dhcp_send_request_packet: Sending DHCPREQUEST\n");
 	pkt = net_tx_packet;
 	memset((void *)pkt, 0, PKTSIZE);
 
@@ -903,7 +901,7 @@ static void DhcpSendRequestPkt(struct Bootp_t *bp_offer)
 	iphdr = pkt;	/* We'll need this later to set proper pkt size */
 	pkt += IP_UDP_HDR_SIZE;
 
-	bp = (struct Bootp_t *)pkt;
+	bp = (struct bootp_hdr *)pkt;
 	bp->bp_op = OP_BOOTREQUEST;
 	bp->bp_htype = HWT_ETHER;
 	bp->bp_hlen = HWL_ETHER;
@@ -954,17 +952,17 @@ static void DhcpSendRequestPkt(struct Bootp_t *bp_offer)
 static void dhcp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 			 unsigned src, unsigned len)
 {
-	struct Bootp_t *bp = (struct Bootp_t *)pkt;
+	struct bootp_hdr *bp = (struct bootp_hdr *)pkt;
 
 	debug("DHCPHandler: got packet: (src=%d, dst=%d, len=%d) state: %d\n",
-		src, dest, len, dhcp_state);
+	      src, dest, len, dhcp_state);
 
 	/* Filter out pkts we don't want */
-	if (BootpCheckPkt(pkt, dest, src, len))
+	if (check_packet(pkt, dest, src, len))
 		return;
 
-	debug("DHCPHandler: got DHCP packet: (src=%d, dst=%d, len=%d) state:"
-		" %d\n", src, dest, len, dhcp_state);
+	debug("DHCPHandler: got DHCP packet: (src=%d, dst=%d, len=%d) state: "
+	      "%d\n", src, dest, len, dhcp_state);
 
 	switch (dhcp_state) {
 	case SELECTING:
@@ -986,10 +984,10 @@ static void dhcp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 
 			if (NetReadLong((ulong *)&bp->bp_vend[0]) ==
 						htonl(BOOTP_VENDOR_MAGIC))
-				DhcpOptionsProcess((u8 *)&bp->bp_vend[4], bp);
+				dhcp_process_options((u8 *)&bp->bp_vend[4], bp);
 
-			NetSetTimeout(5000, BootpTimeout);
-			DhcpSendRequestPkt(bp);
+			NetSetTimeout(5000, bootp_timeout_handler);
+			dhcp_send_request_packet(bp);
 #ifdef CONFIG_SYS_BOOTFILE_PREFIX
 		}
 #endif	/* CONFIG_SYS_BOOTFILE_PREFIX */
@@ -999,17 +997,17 @@ static void dhcp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 	case REQUESTING:
 		debug("DHCP State: REQUESTING\n");
 
-		if (DhcpMessageType((u8 *)bp->bp_vend) == DHCP_ACK) {
+		if (dhcp_message_type((u8 *)bp->bp_vend) == DHCP_ACK) {
 			if (NetReadLong((ulong *)&bp->bp_vend[0]) ==
 						htonl(BOOTP_VENDOR_MAGIC))
-				DhcpOptionsProcess((u8 *)&bp->bp_vend[4], bp);
+				dhcp_process_options((u8 *)&bp->bp_vend[4], bp);
 			/* Store net params from reply */
-			BootpCopyNetParams(bp);
+			store_net_params(bp);
 			dhcp_state = BOUND;
 			printf("DHCP client bound to address %pI4 (%lu ms)\n",
-				&net_ip, get_timer(bootp_start));
+			       &net_ip, get_timer(bootp_start));
 			bootstage_mark_name(BOOTSTAGE_ID_BOOTP_STOP,
-				"bootp_stop");
+					    "bootp_stop");
 
 			net_auto_load();
 			return;
@@ -1022,11 +1020,10 @@ static void dhcp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 		puts("DHCP: INVALID STATE\n");
 		break;
 	}
-
 }
 
-void DhcpRequest(void)
+void dhcp_request(void)
 {
-	BootpRequest();
+	bootp_request();
 }
 #endif	/* CONFIG_CMD_DHCP */
diff --git a/net/bootp.h b/net/bootp.h
index 8c591a6..efc2100 100644
--- a/net/bootp.h
+++ b/net/bootp.h
@@ -29,7 +29,7 @@ extern u8 *dhcp_vendorex_proc(u8 *e); /*rtn next e if mine,else NULL  */
 #define OPT_FIELD_SIZE 64
 #endif
 
-struct Bootp_t {
+struct bootp_hdr {
 	uchar		bp_op;		/* Operation			*/
 # define OP_BOOTREQUEST	1
 # define OP_BOOTREPLY	2
@@ -51,7 +51,7 @@ struct Bootp_t {
 	char		bp_vend[OPT_FIELD_SIZE]; /* Vendor information	*/
 };
 
-#define BOOTP_HDR_SIZE	sizeof(struct Bootp_t)
+#define BOOTP_HDR_SIZE	sizeof(struct bootp_hdr)
 
 /**********************************************************************/
 /*
@@ -59,16 +59,16 @@ struct Bootp_t {
  */
 
 /* bootp.c */
-extern ulong	BootpID;		/* ID of cur BOOTP request	*/
-extern int	BootpTry;
+extern ulong	bootp_id;		/* ID of cur BOOTP request	*/
+extern int	bootp_try;
 
 
 /* Send a BOOTP request */
-extern void BootpReset(void);
-extern void BootpRequest(void);
+void bootp_reset(void);
+void bootp_request(void);
 
 /****************** DHCP Support *********************/
-extern void DhcpRequest(void);
+void dhcp_request(void);
 
 /* DHCP States */
 typedef enum { INIT,
diff --git a/net/net.c b/net/net.c
index 9a4290b..f740052 100644
--- a/net/net.c
+++ b/net/net.c
@@ -381,16 +381,16 @@ restart:
 #endif
 #if defined(CONFIG_CMD_DHCP)
 		case DHCP:
-			BootpReset();
+			bootp_reset();
 			net_ip.s_addr = 0;
-			DhcpRequest();		/* Basically same as BOOTP */
+			dhcp_request();		/* Basically same as BOOTP */
 			break;
 #endif
 
 		case BOOTP:
-			BootpReset();
+			bootp_reset();
 			net_ip.s_addr = 0;
-			BootpRequest();
+			bootp_request();
 			break;
 
 #if defined(CONFIG_CMD_RARP)
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 10/25] net: cosmetic: Clean up NFS variables and functions
  2015-04-08  6:41 ` [U-Boot] [PATCH v2 0/25] " Joe Hershberger
                     ` (8 preceding siblings ...)
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 09/25] net: cosmetic: Clean up DHCP " Joe Hershberger
@ 2015-04-08  6:41   ` Joe Hershberger
  2015-04-08 12:46     ` Simon Glass
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 11/25] net: cosmetic: Clean up RARP " Joe Hershberger
                     ` (15 subsequent siblings)
  25 siblings, 1 reply; 103+ messages in thread
From: Joe Hershberger @ 2015-04-08  6:41 UTC (permalink / raw)
  To: u-boot

Make a thorough pass through all variables and function names contained
within nfs.c and remove CamelCase and improve naming.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

Changes in v2: None

 net/net.c |   4 +-
 net/nfs.c | 173 +++++++++++++++++++++++++++-----------------------------------
 net/nfs.h |   2 +-
 3 files changed, 79 insertions(+), 100 deletions(-)

diff --git a/net/net.c b/net/net.c
index f740052..bb67884 100644
--- a/net/net.c
+++ b/net/net.c
@@ -235,7 +235,7 @@ void net_auto_load(void)
 		/*
 		 * Use NFS to load the bootfile.
 		 */
-		NfsStart();
+		nfs_start();
 		return;
 	}
 #endif
@@ -407,7 +407,7 @@ restart:
 #endif
 #if defined(CONFIG_CMD_NFS)
 		case NFS:
-			NfsStart();
+			nfs_start();
 			break;
 #endif
 #if defined(CONFIG_CMD_CDP)
diff --git a/net/nfs.c b/net/nfs.c
index 6899265..4357cc3 100644
--- a/net/nfs.c
+++ b/net/nfs.c
@@ -52,11 +52,11 @@ static char filefh[NFS_FHSIZE]; /* file handle of kernel image */
 
 static enum net_loop_state nfs_download_state;
 static struct in_addr nfs_server_ip;
-static int	NfsSrvMountPort;
-static int	NfsSrvNfsPort;
-static int	NfsOurPort;
-static int	NfsTimeoutCount;
-static int	NfsState;
+static int nfs_server_mount_port;
+static int nfs_server_port;
+static int nfs_our_port;
+static int nfs_timeout_count;
+static int nfs_state;
 #define STATE_PRCLOOKUP_PROG_MOUNT_REQ	1
 #define STATE_PRCLOOKUP_PROG_NFS_REQ	2
 #define STATE_MOUNT_REQ			3
@@ -70,8 +70,7 @@ static char *nfs_filename;
 static char *nfs_path;
 static char nfs_path_buff[2048];
 
-static inline int
-store_block(uchar *src, unsigned offset, unsigned len)
+static inline int store_block(uchar *src, unsigned offset, unsigned len)
 {
 	ulong newsize = offset + len;
 #ifdef CONFIG_SYS_DIRECT_FLASH_NFS
@@ -105,8 +104,7 @@ store_block(uchar *src, unsigned offset, unsigned len)
 	return 0;
 }
 
-static char*
-basename(char *path)
+static char *basename(char *path)
 {
 	char *fname;
 
@@ -121,8 +119,7 @@ basename(char *path)
 	return fname;
 }
 
-static char*
-dirname(char *path)
+static char *dirname(char *path)
 {
 	char *fname;
 
@@ -178,8 +175,7 @@ static long *rpc_add_credentials(long *p)
 /**************************************************************************
 RPC_LOOKUP - Lookup RPC Port numbers
 **************************************************************************/
-static void
-rpc_req(int rpc_prog, int rpc_proc, uint32_t *data, int datalen)
+static void rpc_req(int rpc_prog, int rpc_proc, uint32_t *data, int datalen)
 {
 	struct rpc_t pkt;
 	unsigned long id;
@@ -207,19 +203,18 @@ rpc_req(int rpc_prog, int rpc_proc, uint32_t *data, int datalen)
 	if (rpc_prog == PROG_PORTMAP)
 		sport = SUNRPC_PORT;
 	else if (rpc_prog == PROG_MOUNT)
-		sport = NfsSrvMountPort;
+		sport = nfs_server_mount_port;
 	else
-		sport = NfsSrvNfsPort;
+		sport = nfs_server_port;
 
 	net_send_udp_packet(net_server_ethaddr, nfs_server_ip, sport,
-			    NfsOurPort, pktlen);
+			    nfs_our_port, pktlen);
 }
 
 /**************************************************************************
 RPC_LOOKUP - Lookup RPC Port numbers
 **************************************************************************/
-static void
-rpc_lookup_req(int prog, int ver)
+static void rpc_lookup_req(int prog, int ver)
 {
 	uint32_t data[16];
 
@@ -236,8 +231,7 @@ rpc_lookup_req(int prog, int ver)
 /**************************************************************************
 NFS_MOUNT - Mount an NFS Filesystem
 **************************************************************************/
-static void
-nfs_mount_req(char *path)
+static void nfs_mount_req(char *path)
 {
 	uint32_t data[1024];
 	uint32_t *p;
@@ -263,14 +257,13 @@ nfs_mount_req(char *path)
 /**************************************************************************
 NFS_UMOUNTALL - Unmount all our NFS Filesystems on the Server
 **************************************************************************/
-static void
-nfs_umountall_req(void)
+static void nfs_umountall_req(void)
 {
 	uint32_t data[1024];
 	uint32_t *p;
 	int len;
 
-	if ((NfsSrvMountPort == -1) || (!fs_mounted))
+	if ((nfs_server_mount_port == -1) || (!fs_mounted))
 		/* Nothing mounted, nothing to umount */
 		return;
 
@@ -289,8 +282,7 @@ nfs_umountall_req(void)
  * In case of successful readlink(), the dirname is manipulated,
  * so that inside the nfs() function a recursion can be done.
  **************************************************************************/
-static void
-nfs_readlink_req(void)
+static void nfs_readlink_req(void)
 {
 	uint32_t data[1024];
 	uint32_t *p;
@@ -310,8 +302,7 @@ nfs_readlink_req(void)
 /**************************************************************************
 NFS_LOOKUP - Lookup Pathname
 **************************************************************************/
-static void
-nfs_lookup_req(char *fname)
+static void nfs_lookup_req(char *fname)
 {
 	uint32_t data[1024];
 	uint32_t *p;
@@ -339,8 +330,7 @@ nfs_lookup_req(char *fname)
 /**************************************************************************
 NFS_READ - Read File on NFS Server
 **************************************************************************/
-static void
-nfs_read_req(int offset, int readlen)
+static void nfs_read_req(int offset, int readlen)
 {
 	uint32_t data[1024];
 	uint32_t *p;
@@ -363,13 +353,11 @@ nfs_read_req(int offset, int readlen)
 /**************************************************************************
 RPC request dispatcher
 **************************************************************************/
-
-static void
-NfsSend(void)
+static void nfs_send(void)
 {
 	debug("%s\n", __func__);
 
-	switch (NfsState) {
+	switch (nfs_state) {
 	case STATE_PRCLOOKUP_PROG_MOUNT_REQ:
 		rpc_lookup_req(PROG_MOUNT, 1);
 		break;
@@ -398,8 +386,7 @@ NfsSend(void)
 Handlers for the reply from server
 **************************************************************************/
 
-static int
-rpc_lookup_reply(int prog, uchar *pkt, unsigned len)
+static int rpc_lookup_reply(int prog, uchar *pkt, unsigned len)
 {
 	struct rpc_t rpc_pkt;
 
@@ -419,18 +406,17 @@ rpc_lookup_reply(int prog, uchar *pkt, unsigned len)
 
 	switch (prog) {
 	case PROG_MOUNT:
-		NfsSrvMountPort = ntohl(rpc_pkt.u.reply.data[0]);
+		nfs_server_mount_port = ntohl(rpc_pkt.u.reply.data[0]);
 		break;
 	case PROG_NFS:
-		NfsSrvNfsPort = ntohl(rpc_pkt.u.reply.data[0]);
+		nfs_server_port = ntohl(rpc_pkt.u.reply.data[0]);
 		break;
 	}
 
 	return 0;
 }
 
-static int
-nfs_mount_reply(uchar *pkt, unsigned len)
+static int nfs_mount_reply(uchar *pkt, unsigned len)
 {
 	struct rpc_t rpc_pkt;
 
@@ -455,8 +441,7 @@ nfs_mount_reply(uchar *pkt, unsigned len)
 	return 0;
 }
 
-static int
-nfs_umountall_reply(uchar *pkt, unsigned len)
+static int nfs_umountall_reply(uchar *pkt, unsigned len)
 {
 	struct rpc_t rpc_pkt;
 
@@ -480,8 +465,7 @@ nfs_umountall_reply(uchar *pkt, unsigned len)
 	return 0;
 }
 
-static int
-nfs_lookup_reply(uchar *pkt, unsigned len)
+static int nfs_lookup_reply(uchar *pkt, unsigned len)
 {
 	struct rpc_t rpc_pkt;
 
@@ -505,8 +489,7 @@ nfs_lookup_reply(uchar *pkt, unsigned len)
 	return 0;
 }
 
-static int
-nfs_readlink_reply(uchar *pkt, unsigned len)
+static int nfs_readlink_reply(uchar *pkt, unsigned len)
 {
 	struct rpc_t rpc_pkt;
 	int rlen;
@@ -533,7 +516,7 @@ nfs_readlink_reply(uchar *pkt, unsigned len)
 		strcat(nfs_path, "/");
 		pathlen = strlen(nfs_path);
 		memcpy(nfs_path + pathlen, (uchar *)&(rpc_pkt.u.reply.data[2]),
-			rlen);
+		       rlen);
 		nfs_path[pathlen + rlen] = 0;
 	} else {
 		memcpy(nfs_path, (uchar *)&(rpc_pkt.u.reply.data[2]), rlen);
@@ -542,8 +525,7 @@ nfs_readlink_reply(uchar *pkt, unsigned len)
 	return 0;
 }
 
-static int
-nfs_read_reply(uchar *pkt, unsigned len)
+static int nfs_read_reply(uchar *pkt, unsigned len)
 {
 	struct rpc_t rpc_pkt;
 	int rlen;
@@ -585,18 +567,16 @@ nfs_read_reply(uchar *pkt, unsigned len)
 /**************************************************************************
 Interfaces of U-BOOT
 **************************************************************************/
-
-static void
-NfsTimeout(void)
+static void nfs_timeout_handler(void)
 {
-	if (++NfsTimeoutCount > NFS_RETRY_COUNT) {
+	if (++nfs_timeout_count > NFS_RETRY_COUNT) {
 		puts("\nRetry count exceeded; starting again\n");
 		NetStartAgain();
 	} else {
 		puts("T ");
-		NetSetTimeout(nfs_timeout + NFS_TIMEOUT * NfsTimeoutCount,
-			      NfsTimeout);
-		NfsSend();
+		NetSetTimeout(nfs_timeout + NFS_TIMEOUT * nfs_timeout_count,
+			      nfs_timeout_handler);
+		nfs_send();
 	}
 }
 
@@ -608,44 +588,44 @@ static void nfs_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 
 	debug("%s\n", __func__);
 
-	if (dest != NfsOurPort)
+	if (dest != nfs_our_port)
 		return;
 
-	switch (NfsState) {
+	switch (nfs_state) {
 	case STATE_PRCLOOKUP_PROG_MOUNT_REQ:
 		if (rpc_lookup_reply(PROG_MOUNT, pkt, len) == -NFS_RPC_DROP)
 			break;
-		NfsState = STATE_PRCLOOKUP_PROG_NFS_REQ;
-		NfsSend();
+		nfs_state = STATE_PRCLOOKUP_PROG_NFS_REQ;
+		nfs_send();
 		break;
 
 	case STATE_PRCLOOKUP_PROG_NFS_REQ:
 		if (rpc_lookup_reply(PROG_NFS, pkt, len) == -NFS_RPC_DROP)
 			break;
-		NfsState = STATE_MOUNT_REQ;
-		NfsSend();
+		nfs_state = STATE_MOUNT_REQ;
+		nfs_send();
 		break;
 
 	case STATE_MOUNT_REQ:
 		reply = nfs_mount_reply(pkt, len);
-		if (reply == -NFS_RPC_DROP)
+		if (reply == -NFS_RPC_DROP) {
 			break;
-		else if (reply == -NFS_RPC_ERR) {
+		} else if (reply == -NFS_RPC_ERR) {
 			puts("*** ERROR: Cannot mount\n");
 			/* just to be sure... */
-			NfsState = STATE_UMOUNT_REQ;
-			NfsSend();
+			nfs_state = STATE_UMOUNT_REQ;
+			nfs_send();
 		} else {
-			NfsState = STATE_LOOKUP_REQ;
-			NfsSend();
+			nfs_state = STATE_LOOKUP_REQ;
+			nfs_send();
 		}
 		break;
 
 	case STATE_UMOUNT_REQ:
 		reply = nfs_umountall_reply(pkt, len);
-		if (reply == -NFS_RPC_DROP)
+		if (reply == -NFS_RPC_DROP) {
 			break;
-		else if (reply == -NFS_RPC_ERR) {
+		} else if (reply == -NFS_RPC_ERR) {
 			puts("*** ERROR: Cannot umount\n");
 			net_set_state(NETLOOP_FAIL);
 		} else {
@@ -656,61 +636,60 @@ static void nfs_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 
 	case STATE_LOOKUP_REQ:
 		reply = nfs_lookup_reply(pkt, len);
-		if (reply == -NFS_RPC_DROP)
+		if (reply == -NFS_RPC_DROP) {
 			break;
-		else if (reply == -NFS_RPC_ERR) {
+		} else if (reply == -NFS_RPC_ERR) {
 			puts("*** ERROR: File lookup fail\n");
-			NfsState = STATE_UMOUNT_REQ;
-			NfsSend();
+			nfs_state = STATE_UMOUNT_REQ;
+			nfs_send();
 		} else {
-			NfsState = STATE_READ_REQ;
+			nfs_state = STATE_READ_REQ;
 			nfs_offset = 0;
 			nfs_len = NFS_READ_SIZE;
-			NfsSend();
+			nfs_send();
 		}
 		break;
 
 	case STATE_READLINK_REQ:
 		reply = nfs_readlink_reply(pkt, len);
-		if (reply == -NFS_RPC_DROP)
+		if (reply == -NFS_RPC_DROP) {
 			break;
-		else if (reply == -NFS_RPC_ERR) {
+		} else if (reply == -NFS_RPC_ERR) {
 			puts("*** ERROR: Symlink fail\n");
-			NfsState = STATE_UMOUNT_REQ;
-			NfsSend();
+			nfs_state = STATE_UMOUNT_REQ;
+			nfs_send();
 		} else {
 			debug("Symlink --> %s\n", nfs_path);
 			nfs_filename = basename(nfs_path);
 			nfs_path     = dirname(nfs_path);
 
-			NfsState = STATE_MOUNT_REQ;
-			NfsSend();
+			nfs_state = STATE_MOUNT_REQ;
+			nfs_send();
 		}
 		break;
 
 	case STATE_READ_REQ:
 		rlen = nfs_read_reply(pkt, len);
-		NetSetTimeout(nfs_timeout, NfsTimeout);
+		NetSetTimeout(nfs_timeout, nfs_timeout_handler);
 		if (rlen > 0) {
 			nfs_offset += rlen;
-			NfsSend();
+			nfs_send();
 		} else if ((rlen == -NFSERR_ISDIR) || (rlen == -NFSERR_INVAL)) {
 			/* symbolic link */
-			NfsState = STATE_READLINK_REQ;
-			NfsSend();
+			nfs_state = STATE_READLINK_REQ;
+			nfs_send();
 		} else {
 			if (!rlen)
 				nfs_download_state = NETLOOP_SUCCESS;
-			NfsState = STATE_UMOUNT_REQ;
-			NfsSend();
+			nfs_state = STATE_UMOUNT_REQ;
+			nfs_send();
 		}
 		break;
 	}
 }
 
 
-void
-NfsStart(void)
+void nfs_start(void)
 {
 	debug("%s\n", __func__);
 	nfs_download_state = NETLOOP_FAIL;
@@ -733,7 +712,7 @@ NfsStart(void)
 		strcpy(nfs_path, default_filename);
 
 		printf("*** Warning: no boot file name; using '%s'\n",
-			nfs_path);
+		       nfs_path);
 	} else {
 		char *p = net_boot_file_name;
 
@@ -765,7 +744,7 @@ NfsStart(void)
 		server_net.s_addr = net_server_ip.s_addr & net_netmask.s_addr;
 		if (our_net.s_addr != server_net.s_addr)
 			printf("; sending through gateway %pI4",
-				&net_gateway);
+			       &net_gateway);
 	}
 	printf("\nFilename '%s/%s'.", nfs_path, nfs_filename);
 
@@ -777,18 +756,18 @@ NfsStart(void)
 	printf("\nLoad address: 0x%lx\n"
 		"Loading: *\b", load_addr);
 
-	NetSetTimeout(nfs_timeout, NfsTimeout);
+	NetSetTimeout(nfs_timeout, nfs_timeout_handler);
 	net_set_udp_handler(nfs_handler);
 
-	NfsTimeoutCount = 0;
-	NfsState = STATE_PRCLOOKUP_PROG_MOUNT_REQ;
+	nfs_timeout_count = 0;
+	nfs_state = STATE_PRCLOOKUP_PROG_MOUNT_REQ;
 
-	/*NfsOurPort = 4096 + (get_ticks() % 3072);*/
+	/*nfs_our_port = 4096 + (get_ticks() % 3072);*/
 	/*FIX ME !!!*/
-	NfsOurPort = 1000;
+	nfs_our_port = 1000;
 
 	/* zero out server ether in case the server ip has changed */
 	memset(net_server_ethaddr, 0, 6);
 
-	NfsSend();
+	nfs_send();
 }
diff --git a/net/nfs.h b/net/nfs.h
index 53451db..d69b422 100644
--- a/net/nfs.h
+++ b/net/nfs.h
@@ -69,7 +69,7 @@ struct rpc_t {
 		} reply;
 	} u;
 };
-extern void NfsStart(void);	/* Begin NFS */
+void nfs_start(void);	/* Begin NFS */
 
 
 /**********************************************************************/
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 11/25] net: cosmetic: Clean up RARP variables and functions
  2015-04-08  6:41 ` [U-Boot] [PATCH v2 0/25] " Joe Hershberger
                     ` (9 preceding siblings ...)
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 10/25] net: cosmetic: Clean up NFS " Joe Hershberger
@ 2015-04-08  6:41   ` Joe Hershberger
  2015-04-08 12:46     ` Simon Glass
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 12/25] net: cosmetic: Clean up SNTP " Joe Hershberger
                     ` (14 subsequent siblings)
  25 siblings, 1 reply; 103+ messages in thread
From: Joe Hershberger @ 2015-04-08  6:41 UTC (permalink / raw)
  To: u-boot

Make a thorough pass through all variables and function names contained
within rarp.c and remove CamelCase and improve naming.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

Changes in v2: None

 net/net.c  |  4 ++--
 net/rarp.c | 23 +++++++++++------------
 net/rarp.h |  6 +++---
 3 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/net/net.c b/net/net.c
index bb67884..6c23293 100644
--- a/net/net.c
+++ b/net/net.c
@@ -395,9 +395,9 @@ restart:
 
 #if defined(CONFIG_CMD_RARP)
 		case RARP:
-			RarpTry = 0;
+			rarp_try = 0;
 			net_ip.s_addr = 0;
-			RarpRequest();
+			rarp_request();
 			break;
 #endif
 #if defined(CONFIG_CMD_PING)
diff --git a/net/rarp.c b/net/rarp.c
index f50d2fb..204e03c 100644
--- a/net/rarp.c
+++ b/net/rarp.c
@@ -20,7 +20,7 @@
 #define TIMEOUT_COUNT (CONFIG_NET_RETRY_COUNT)
 #endif
 
-int RarpTry;
+int rarp_try;
 
 /*
  *	Handle a RARP received packet.
@@ -37,10 +37,9 @@ void rarp_receive(struct ip_udp_hdr *ip, unsigned len)
 	}
 
 	if ((ntohs(arp->ar_op) != RARPOP_REPLY) ||
-		(ntohs(arp->ar_hrd) != ARP_ETHER)   ||
-		(ntohs(arp->ar_pro) != PROT_IP)     ||
-		(arp->ar_hln != 6) || (arp->ar_pln != 4)) {
-
+	    (ntohs(arp->ar_hrd) != ARP_ETHER)   ||
+	    (ntohs(arp->ar_pro) != PROT_IP)     ||
+	    (arp->ar_hln != 6) || (arp->ar_pln != 4)) {
 		puts("invalid RARP header\n");
 	} else {
 		net_copy_ip(&net_ip, &arp->ar_data[16]);
@@ -56,25 +55,25 @@ void rarp_receive(struct ip_udp_hdr *ip, unsigned len)
 /*
  *	Timeout on BOOTP request.
  */
-static void RarpTimeout(void)
+static void rarp_timeout_handler(void)
 {
-	if (RarpTry >= TIMEOUT_COUNT) {
+	if (rarp_try >= TIMEOUT_COUNT) {
 		puts("\nRetry count exceeded; starting again\n");
 		NetStartAgain();
 	} else {
-		NetSetTimeout(TIMEOUT, RarpTimeout);
-		RarpRequest();
+		NetSetTimeout(TIMEOUT, rarp_timeout_handler);
+		rarp_request();
 	}
 }
 
 
-void RarpRequest(void)
+void rarp_request(void)
 {
 	uchar *pkt;
 	struct arp_hdr *rarp;
 	int eth_hdr_size;
 
-	printf("RARP broadcast %d\n", ++RarpTry);
+	printf("RARP broadcast %d\n", ++rarp_try);
 	pkt = net_tx_packet;
 
 	eth_hdr_size = net_set_ether(pkt, net_bcast_ethaddr, PROT_RARP);
@@ -96,5 +95,5 @@ void RarpRequest(void)
 
 	net_send_packet(net_tx_packet, eth_hdr_size + ARP_HDR_SIZE);
 
-	NetSetTimeout(TIMEOUT, RarpTimeout);
+	NetSetTimeout(TIMEOUT, rarp_timeout_handler);
 }
diff --git a/net/rarp.h b/net/rarp.h
index 93e1889..1ca8833 100644
--- a/net/rarp.h
+++ b/net/rarp.h
@@ -17,11 +17,11 @@
  *	Global functions and variables.
  */
 
-extern int RarpTry;
+extern int rarp_try;
 
 /* Process the receipt of a RARP packet */
-extern void rarp_receive(struct ip_udp_hdr *ip, unsigned len);
-extern void RarpRequest(void);	/* Send a RARP request */
+void rarp_receive(struct ip_udp_hdr *ip, unsigned len);
+void rarp_request(void);	/* Send a RARP request */
 
 /**********************************************************************/
 
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 12/25] net: cosmetic: Clean up SNTP variables and functions
  2015-04-08  6:41 ` [U-Boot] [PATCH v2 0/25] " Joe Hershberger
                     ` (10 preceding siblings ...)
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 11/25] net: cosmetic: Clean up RARP " Joe Hershberger
@ 2015-04-08  6:41   ` Joe Hershberger
  2015-04-08 12:46     ` Simon Glass
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 13/25] net: cosmetic: Clean up ping " Joe Hershberger
                     ` (13 subsequent siblings)
  25 siblings, 1 reply; 103+ messages in thread
From: Joe Hershberger @ 2015-04-08  6:41 UTC (permalink / raw)
  To: u-boot

Make a thorough pass through all variables and function names contained
within sntp.c and remove CamelCase and improve naming.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

Changes in v2: None

 net/net.c  |  2 +-
 net/sntp.c | 25 +++++++++++--------------
 net/sntp.h |  2 +-
 3 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/net/net.c b/net/net.c
index 6c23293..a159432 100644
--- a/net/net.c
+++ b/net/net.c
@@ -422,7 +422,7 @@ restart:
 #endif
 #if defined(CONFIG_CMD_SNTP)
 		case SNTP:
-			SntpStart();
+			sntp_start();
 			break;
 #endif
 #if defined(CONFIG_CMD_DNS)
diff --git a/net/sntp.c b/net/sntp.c
index 1e2b678..8073ca6 100644
--- a/net/sntp.c
+++ b/net/sntp.c
@@ -14,10 +14,9 @@
 
 #define SNTP_TIMEOUT 10000UL
 
-static int SntpOurPort;
+static int sntp_our_port;
 
-static void
-SntpSend(void)
+static void sntp_send(void)
 {
 	struct sntp_pkt_t pkt;
 	int pktlen = SNTP_PACKET_LEN;
@@ -34,15 +33,14 @@ SntpSend(void)
 	memcpy((char *)net_tx_packet + net_eth_hdr_size() + IP_UDP_HDR_SIZE,
 	       (char *)&pkt, pktlen);
 
-	SntpOurPort = 10000 + (get_timer(0) % 4096);
+	sntp_our_port = 10000 + (get_timer(0) % 4096);
 	sport = NTP_SERVICE_PORT;
 
 	net_send_udp_packet(net_server_ethaddr, net_ntp_server, sport,
-			    SntpOurPort, pktlen);
+			    sntp_our_port, pktlen);
 }
 
-static void
-SntpTimeout(void)
+static void sntp_timeout_handler(void)
 {
 	puts("Timeout\n");
 	net_set_state(NETLOOP_FAIL);
@@ -58,7 +56,7 @@ static void sntp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 
 	debug("%s\n", __func__);
 
-	if (dest != SntpOurPort)
+	if (dest != sntp_our_port)
 		return;
 
 	/*
@@ -72,20 +70,19 @@ static void sntp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 	rtc_set(&tm);
 #endif
 	printf("Date: %4d-%02d-%02d Time: %2d:%02d:%02d\n",
-		tm.tm_year, tm.tm_mon, tm.tm_mday,
-		tm.tm_hour, tm.tm_min, tm.tm_sec);
+	       tm.tm_year, tm.tm_mon, tm.tm_mday,
+	       tm.tm_hour, tm.tm_min, tm.tm_sec);
 
 	net_set_state(NETLOOP_SUCCESS);
 }
 
-void
-SntpStart(void)
+void sntp_start(void)
 {
 	debug("%s\n", __func__);
 
-	NetSetTimeout(SNTP_TIMEOUT, SntpTimeout);
+	NetSetTimeout(SNTP_TIMEOUT, sntp_timeout_handler);
 	net_set_udp_handler(sntp_handler);
 	memset(net_server_ethaddr, 0, sizeof(net_server_ethaddr));
 
-	SntpSend();
+	sntp_send();
 }
diff --git a/net/sntp.h b/net/sntp.h
index bf5bf0b..6a9c6bb 100644
--- a/net/sntp.h
+++ b/net/sntp.h
@@ -53,6 +53,6 @@ struct sntp_pkt_t {
 	unsigned long long transmit_timestamp;
 };
 
-extern void SntpStart(void);	/* Begin SNTP */
+void sntp_start(void);	/* Begin SNTP */
 
 #endif /* __SNTP_H__ */
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 13/25] net: cosmetic: Clean up ping variables and functions
  2015-04-08  6:41 ` [U-Boot] [PATCH v2 0/25] " Joe Hershberger
                     ` (11 preceding siblings ...)
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 12/25] net: cosmetic: Clean up SNTP " Joe Hershberger
@ 2015-04-08  6:41   ` Joe Hershberger
  2015-04-08 12:46     ` Simon Glass
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 14/25] net: cosmetic: Clean up CDP " Joe Hershberger
                     ` (12 subsequent siblings)
  25 siblings, 1 reply; 103+ messages in thread
From: Joe Hershberger @ 2015-04-08  6:41 UTC (permalink / raw)
  To: u-boot

Make a thorough pass through all variables and function names contained
within ping.c and remove CamelCase and improve naming.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

Changes in v2: None

 net/ping.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/net/ping.c b/net/ping.c
index 76e8749..87da555 100644
--- a/net/ping.c
+++ b/net/ping.c
@@ -12,7 +12,7 @@
 #include "ping.h"
 #include "arp.h"
 
-static ushort PingSeqNo;
+static ushort ping_seq_number;
 
 /* The ip address to ping */
 struct in_addr net_ping_ip;
@@ -35,7 +35,7 @@ static void set_icmp_header(uchar *pkt, struct in_addr dest)
 	icmp->code = 0;
 	icmp->checksum = 0;
 	icmp->un.echo.id = 0;
-	icmp->un.echo.sequence = htons(PingSeqNo++);
+	icmp->un.echo.sequence = htons(ping_seq_number++);
 	icmp->checksum = compute_ip_checksum(icmp, ICMP_HDR_SIZE);
 }
 
@@ -65,7 +65,7 @@ static int ping_send(void)
 	return 1;	/* waiting */
 }
 
-static void ping_timeout(void)
+static void ping_timeout_handler(void)
 {
 	eth_halt();
 	net_set_state(NETLOOP_FAIL);	/* we did not get the reply */
@@ -74,7 +74,7 @@ static void ping_timeout(void)
 void ping_start(void)
 {
 	printf("Using %s device\n", eth_get_name());
-	NetSetTimeout(10000UL, ping_timeout);
+	NetSetTimeout(10000UL, ping_timeout_handler);
 
 	ping_send();
 }
@@ -94,8 +94,9 @@ void ping_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
 	case ICMP_ECHO_REQUEST:
 		eth_hdr_size = net_update_ether(et, et->et_src, PROT_IP);
 
-		debug_cond(DEBUG_DEV_PKT, "Got ICMP ECHO REQUEST, return "
-			"%d bytes\n", eth_hdr_size + len);
+		debug_cond(DEBUG_DEV_PKT,
+			   "Got ICMP ECHO REQUEST, return %d bytes\n",
+			   eth_hdr_size + len);
 
 		ip->ip_sum = 0;
 		ip->ip_off = 0;
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 14/25] net: cosmetic: Clean up CDP variables and functions
  2015-04-08  6:41 ` [U-Boot] [PATCH v2 0/25] " Joe Hershberger
                     ` (12 preceding siblings ...)
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 13/25] net: cosmetic: Clean up ping " Joe Hershberger
@ 2015-04-08  6:41   ` Joe Hershberger
  2015-04-08 12:46     ` Simon Glass
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 15/25] net: cosmetic: Clean up DNS " Joe Hershberger
                     ` (11 subsequent siblings)
  25 siblings, 1 reply; 103+ messages in thread
From: Joe Hershberger @ 2015-04-08  6:41 UTC (permalink / raw)
  To: u-boot

Make a thorough pass through all variables and function names contained
within cdp.c and remove CamelCase and improve naming.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

Changes in v2: None

 common/cmd_net.c | 17 +++++++-------
 include/net.h    |  4 ++--
 net/cdp.c        | 70 ++++++++++++++++++++++++++------------------------------
 net/cdp.h        |  2 +-
 net/net.c        |  2 +-
 5 files changed, 46 insertions(+), 49 deletions(-)

diff --git a/common/cmd_net.c b/common/cmd_net.c
index 87c4ed1..1deebf2 100644
--- a/common/cmd_net.c
+++ b/common/cmd_net.c
@@ -290,18 +290,19 @@ static void cdp_update_env(void)
 {
 	char tmp[16];
 
-	if (CDPApplianceVLAN != htons(-1)) {
-		printf("CDP offered appliance VLAN %d\n", ntohs(CDPApplianceVLAN));
-		VLAN_to_string(CDPApplianceVLAN, tmp);
+	if (cdp_appliance_vlan != htons(-1)) {
+		printf("CDP offered appliance VLAN %d\n",
+		       ntohs(cdp_appliance_vlan));
+		VLAN_to_string(cdp_appliance_vlan, tmp);
 		setenv("vlan", tmp);
-		NetOurVLAN = CDPApplianceVLAN;
+		NetOurVLAN = cdp_appliance_vlan;
 	}
 
-	if (CDPNativeVLAN != htons(-1)) {
-		printf("CDP offered native VLAN %d\n", ntohs(CDPNativeVLAN));
-		VLAN_to_string(CDPNativeVLAN, tmp);
+	if (cdp_native_vlan != htons(-1)) {
+		printf("CDP offered native VLAN %d\n", ntohs(cdp_native_vlan));
+		VLAN_to_string(cdp_native_vlan, tmp);
 		setenv("nvlan", tmp);
-		NetOurNativeVLAN = CDPNativeVLAN;
+		NetOurNativeVLAN = cdp_native_vlan;
 	}
 
 }
diff --git a/include/net.h b/include/net.h
index 1dc54ce..9343ade 100644
--- a/include/net.h
+++ b/include/net.h
@@ -512,8 +512,8 @@ extern struct in_addr net_ping_ip;	/* the ip address to ping */
 
 #if defined(CONFIG_CMD_CDP)
 /* when CDP completes these hold the return values */
-extern ushort CDPNativeVLAN;		/* CDP returned native VLAN */
-extern ushort CDPApplianceVLAN;		/* CDP returned appliance VLAN */
+extern ushort cdp_native_vlan;		/* CDP returned native VLAN */
+extern ushort cdp_appliance_vlan;	/* CDP returned appliance VLAN */
 
 /*
  * Check for a CDP packet by examining the received MAC address field
diff --git a/net/cdp.c b/net/cdp.c
index 392437d..d8df3ea 100644
--- a/net/cdp.c
+++ b/net/cdp.c
@@ -36,17 +36,16 @@ const u8 net_cdp_ethaddr[6] = { 0x01, 0x00, 0x0c, 0xcc, 0xcc, 0xcc };
 
 #define CDP_TIMEOUT			250UL	/* one packet every 250ms */
 
-static int CDPSeq;
-static int CDPOK;
+static int cdp_seq;
+static int cdp_ok;
 
-ushort CDPNativeVLAN;
-ushort CDPApplianceVLAN;
+ushort cdp_native_vlan;
+ushort cdp_appliance_vlan;
 
-static const uchar CDP_SNAP_hdr[8] = {
+static const uchar cdp_snap_hdr[8] = {
 	0xAA, 0xAA, 0x03, 0x00, 0x00, 0x0C, 0x20, 0x00 };
 
-static ushort
-CDP_compute_csum(const uchar *buff, ushort len)
+static ushort cdp_compute_csum(const uchar *buff, ushort len)
 {
 	ushort csum;
 	int     odd;
@@ -104,8 +103,7 @@ CDP_compute_csum(const uchar *buff, ushort len)
 	return csum;
 }
 
-static int
-CDPSendTrigger(void)
+static int cdp_send_trigger(void)
 {
 	uchar *pkt;
 	ushort *s;
@@ -130,8 +128,8 @@ CDPSendTrigger(void)
 	pkt += ETHER_HDR_SIZE;
 
 	/* SNAP header */
-	memcpy((uchar *)pkt, CDP_SNAP_hdr, sizeof(CDP_SNAP_hdr));
-	pkt += sizeof(CDP_SNAP_hdr);
+	memcpy((uchar *)pkt, cdp_snap_hdr, sizeof(cdp_snap_hdr));
+	pkt += sizeof(cdp_snap_hdr);
 
 	/* CDP header */
 	*pkt++ = 0x02;				/* CDP version 2 */
@@ -210,8 +208,8 @@ CDPSendTrigger(void)
 	len = (uchar *)s - ((uchar *)net_tx_packet + ETHER_HDR_SIZE);
 	et->et_protlen = htons(len);
 
-	len = ETHER_HDR_SIZE + sizeof(CDP_SNAP_hdr);
-	chksum = CDP_compute_csum((uchar *)net_tx_packet + len,
+	len = ETHER_HDR_SIZE + sizeof(cdp_snap_hdr);
+	chksum = cdp_compute_csum((uchar *)net_tx_packet + len,
 				  (uchar *)s - (net_tx_packet + len));
 	if (chksum == 0)
 		chksum = 0xFFFF;
@@ -221,19 +219,18 @@ CDPSendTrigger(void)
 	return 0;
 }
 
-static void
-CDPTimeout(void)
+static void cdp_timeout_handler(void)
 {
-	CDPSeq++;
+	cdp_seq++;
 
-	if (CDPSeq < 3) {
-		NetSetTimeout(CDP_TIMEOUT, CDPTimeout);
-		CDPSendTrigger();
+	if (cdp_seq < 3) {
+		NetSetTimeout(CDP_TIMEOUT, cdp_timeout_handler);
+		cdp_send_trigger();
 		return;
 	}
 
 	/* if not OK try again */
-	if (!CDPOK)
+	if (!cdp_ok)
 		NetStartAgain();
 	else
 		net_set_state(NETLOOP_SUCCESS);
@@ -247,15 +244,15 @@ void cdp_receive(const uchar *pkt, unsigned len)
 	ushort vlan, nvlan;
 
 	/* minimum size? */
-	if (len < sizeof(CDP_SNAP_hdr) + 4)
+	if (len < sizeof(cdp_snap_hdr) + 4)
 		goto pkt_short;
 
 	/* check for valid CDP SNAP header */
-	if (memcmp(pkt, CDP_SNAP_hdr, sizeof(CDP_SNAP_hdr)) != 0)
+	if (memcmp(pkt, cdp_snap_hdr, sizeof(cdp_snap_hdr)) != 0)
 		return;
 
-	pkt += sizeof(CDP_SNAP_hdr);
-	len -= sizeof(CDP_SNAP_hdr);
+	pkt += sizeof(cdp_snap_hdr);
+	len -= sizeof(cdp_snap_hdr);
 
 	/* Version of CDP protocol must be >= 2 and TTL != 0 */
 	if (pkt[0] < 0x02 || pkt[1] == 0)
@@ -269,7 +266,7 @@ void cdp_receive(const uchar *pkt, unsigned len)
 		printf("**WARNING: CDP packet received with a protocol version "
 				"%d > 2\n", pkt[0] & 0xff);
 
-	if (CDP_compute_csum(pkt, len) != 0)
+	if (cdp_compute_csum(pkt, len) != 0)
 		return;
 
 	pkt += 4;
@@ -340,28 +337,27 @@ void cdp_receive(const uchar *pkt, unsigned len)
 		}
 	}
 
-	CDPApplianceVLAN = vlan;
-	CDPNativeVLAN = nvlan;
+	cdp_appliance_vlan = vlan;
+	cdp_native_vlan = nvlan;
 
-	CDPOK = 1;
+	cdp_ok = 1;
 	return;
 
- pkt_short:
+pkt_short:
 	printf("** CDP packet is too short\n");
 	return;
 }
 
-void
-CDPStart(void)
+void cdp_start(void)
 {
 	printf("Using %s device\n", eth_get_name());
-	CDPSeq = 0;
-	CDPOK = 0;
+	cdp_seq = 0;
+	cdp_ok = 0;
 
-	CDPNativeVLAN = htons(-1);
-	CDPApplianceVLAN = htons(-1);
+	cdp_native_vlan = htons(-1);
+	cdp_appliance_vlan = htons(-1);
 
-	NetSetTimeout(CDP_TIMEOUT, CDPTimeout);
+	NetSetTimeout(CDP_TIMEOUT, cdp_timeout_handler);
 
-	CDPSendTrigger();
+	cdp_send_trigger();
 }
diff --git a/net/cdp.h b/net/cdp.h
index 95e4ce0..83475c9 100644
--- a/net/cdp.h
+++ b/net/cdp.h
@@ -14,7 +14,7 @@
 #ifndef __CDP_H__
 #define __CDP_H__
 
-void CDPStart(void);
+void cdp_start(void);
 /* Process a received CDP packet */
 void cdp_receive(const uchar *pkt, unsigned len);
 
diff --git a/net/net.c b/net/net.c
index a159432..3c8b608 100644
--- a/net/net.c
+++ b/net/net.c
@@ -412,7 +412,7 @@ restart:
 #endif
 #if defined(CONFIG_CMD_CDP)
 		case CDP:
-			CDPStart();
+			cdp_start();
 			break;
 #endif
 #if defined (CONFIG_NETCONSOLE) && !(CONFIG_SPL_BUILD)
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 15/25] net: cosmetic: Clean up DNS variables and functions
  2015-04-08  6:41 ` [U-Boot] [PATCH v2 0/25] " Joe Hershberger
                     ` (13 preceding siblings ...)
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 14/25] net: cosmetic: Clean up CDP " Joe Hershberger
@ 2015-04-08  6:41   ` Joe Hershberger
  2015-04-08 12:46     ` Simon Glass
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 16/25] net: cosmetic: Clean up netconsole " Joe Hershberger
                     ` (10 subsequent siblings)
  25 siblings, 1 reply; 103+ messages in thread
From: Joe Hershberger @ 2015-04-08  6:41 UTC (permalink / raw)
  To: u-boot

Make a thorough pass through all variables and function names contained
within dns.c and remove CamelCase and improve naming.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

Changes in v2: None

 common/cmd_net.c |  6 +++---
 include/net.h    |  4 ++--
 net/dns.c        | 53 +++++++++++++++++++++++++----------------------------
 net/dns.h        |  2 +-
 net/net.c        |  2 +-
 5 files changed, 32 insertions(+), 35 deletions(-)

diff --git a/common/cmd_net.c b/common/cmd_net.c
index 1deebf2..0270ac3 100644
--- a/common/cmd_net.c
+++ b/common/cmd_net.c
@@ -393,12 +393,12 @@ int do_dns(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		return CMD_RET_FAILURE;
 	}
 
-	NetDNSResolve = argv[1];
+	net_dns_resolve = argv[1];
 
 	if (argc == 3)
-		NetDNSenvvar = argv[2];
+		net_dns_env_var = argv[2];
 	else
-		NetDNSenvvar = NULL;
+		net_dns_env_var = NULL;
 
 	if (NetLoop(DNS) < 0) {
 		printf("dns lookup of %s failed, check setup\n", argv[1]);
diff --git a/include/net.h b/include/net.h
index 9343ade..1275ffe 100644
--- a/include/net.h
+++ b/include/net.h
@@ -502,8 +502,8 @@ extern u32	net_boot_file_size;
 extern u32	net_boot_file_expected_size_in_blocks;
 
 #if defined(CONFIG_CMD_DNS)
-extern char *NetDNSResolve;		/* The host to resolve  */
-extern char *NetDNSenvvar;		/* the env var to put the ip into */
+extern char *net_dns_resolve;		/* The host to resolve  */
+extern char *net_dns_env_var;		/* the env var to put the ip into */
 #endif
 
 #if defined(CONFIG_CMD_PING)
diff --git a/net/dns.c b/net/dns.c
index 50d78ae..cf4ed86 100644
--- a/net/dns.c
+++ b/net/dns.c
@@ -29,13 +29,12 @@
 
 #include "dns.h"
 
-char *NetDNSResolve;	/* The host to resolve  */
-char *NetDNSenvvar;	/* The envvar to store the answer in */
+char *net_dns_resolve;	/* The host to resolve  */
+char *net_dns_env_var;	/* The envvar to store the answer in */
 
-static int DnsOurPort;
+static int dns_our_port;
 
-static void
-DnsSend(void)
+static void dns_send(void)
 {
 	struct header *header;
 	int n, name_len;
@@ -44,12 +43,12 @@ DnsSend(void)
 	const char *name;
 	enum dns_query_type qtype = DNS_A_RECORD;
 
-	name = NetDNSResolve;
+	name = net_dns_resolve;
 	pkt = (uchar *)(net_tx_packet + net_eth_hdr_size() + IP_UDP_HDR_SIZE);
 	p = pkt;
 
 	/* Prepare DNS packet header */
-	header           = (struct header *) pkt;
+	header           = (struct header *)pkt;
 	header->tid      = 1;
 	header->flags    = htons(0x100);	/* standard query */
 	header->nqueries = htons(1);		/* Just one query */
@@ -59,7 +58,7 @@ DnsSend(void)
 
 	/* Encode DNS name */
 	name_len = strlen(name);
-	p = (uchar *) &header->data;	/* For encoding host name into packet */
+	p = (uchar *)&header->data;	/* For encoding host name into packet */
 
 	do {
 		s = strchr(name, '.');
@@ -88,15 +87,14 @@ DnsSend(void)
 	n = p - pkt;				/* Total packet length */
 	debug("Packet size %d\n", n);
 
-	DnsOurPort = random_port();
+	dns_our_port = random_port();
 
 	net_send_udp_packet(net_server_ethaddr, net_dns_server,
-			    DNS_SERVICE_PORT, DnsOurPort, n);
+			    DNS_SERVICE_PORT, dns_our_port, n);
 	debug("DNS packet sent\n");
 }
 
-static void
-DnsTimeout(void)
+static void dns_timeout_handler(void)
 {
 	puts("Timeout\n");
 	net_set_state(NETLOOP_FAIL);
@@ -109,20 +107,20 @@ static void dns_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 	const unsigned char *p, *e, *s;
 	u16 type, i;
 	int found, stop, dlen;
-	char IPStr[22];
+	char ip_str[22];
 	struct in_addr ip_addr;
 
 
 	debug("%s\n", __func__);
-	if (dest != DnsOurPort)
+	if (dest != dns_our_port)
 		return;
 
 	for (i = 0; i < len; i += 4)
 		debug("0x%p - 0x%.2x  0x%.2x  0x%.2x  0x%.2x\n",
-			pkt+i, pkt[i], pkt[i+1], pkt[i+2], pkt[i+3]);
+		      pkt+i, pkt[i], pkt[i+1], pkt[i+2], pkt[i+3]);
 
 	/* We sent one query. We want to have a single answer: */
-	header = (struct header *) pkt;
+	header = (struct header *)pkt;
 	if (ntohs(header->nqueries) != 1)
 		return;
 
@@ -151,7 +149,6 @@ static void dns_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 
 	/* Loop through the answers, we want A type answer */
 	for (found = stop = 0; !stop && &p[12] < e; ) {
-
 		/* Skip possible name in CNAME answer */
 		if (*p != 0xc0) {
 			while (*p && &p[12] < e)
@@ -170,7 +167,8 @@ static void dns_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 			p += 12 + dlen;
 		} else if (type == DNS_A_RECORD) {
 			debug("Found A-record\n");
-			found = stop = 1;
+			found = 1;
+			stop = 1;
 		} else {
 			debug("Unknown type\n");
 			stop = 1;
@@ -178,33 +176,32 @@ static void dns_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 	}
 
 	if (found && &p[12] < e) {
-
 		dlen = get_unaligned_be16(p+10);
 		p += 12;
 		memcpy(&ip_addr, p, 4);
 
 		if (p + dlen <= e) {
-			ip_to_string(ip_addr, IPStr);
-			printf("%s\n", IPStr);
-			if (NetDNSenvvar)
-				setenv(NetDNSenvvar, IPStr);
-		} else
+			ip_to_string(ip_addr, ip_str);
+			printf("%s\n", ip_str);
+			if (net_dns_env_var)
+				setenv(net_dns_env_var, ip_str);
+		} else {
 			puts("server responded with invalid IP number\n");
+		}
 	}
 
 	net_set_state(NETLOOP_SUCCESS);
 }
 
-void
-DnsStart(void)
+void dns_start(void)
 {
 	debug("%s\n", __func__);
 
-	NetSetTimeout(DNS_TIMEOUT, DnsTimeout);
+	NetSetTimeout(DNS_TIMEOUT, dns_timeout_handler);
 	net_set_udp_handler(dns_handler);
 
 	/* Clear a previous MAC address, the server IP might have changed. */
 	memset(net_server_ethaddr, 0, sizeof(net_server_ethaddr));
 
-	DnsSend();
+	dns_send();
 }
diff --git a/net/dns.h b/net/dns.h
index dbc3890..c4e96af 100644
--- a/net/dns.h
+++ b/net/dns.h
@@ -31,6 +31,6 @@ struct header {
 	unsigned char	data[1];	/* Data, variable length */
 };
 
-extern void DnsStart(void);		/* Begin DNS */
+void dns_start(void);		/* Begin DNS */
 
 #endif
diff --git a/net/net.c b/net/net.c
index 3c8b608..1133f79 100644
--- a/net/net.c
+++ b/net/net.c
@@ -427,7 +427,7 @@ restart:
 #endif
 #if defined(CONFIG_CMD_DNS)
 		case DNS:
-			DnsStart();
+			dns_start();
 			break;
 #endif
 #if defined(CONFIG_CMD_LINK_LOCAL)
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 16/25] net: cosmetic: Clean up netconsole variables and functions
  2015-04-08  6:41 ` [U-Boot] [PATCH v2 0/25] " Joe Hershberger
                     ` (14 preceding siblings ...)
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 15/25] net: cosmetic: Clean up DNS " Joe Hershberger
@ 2015-04-08  6:41   ` Joe Hershberger
  2015-04-08 12:46     ` Simon Glass
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 17/25] net: cosmetic: Clean up cmd_net " Joe Hershberger
                     ` (9 subsequent siblings)
  25 siblings, 1 reply; 103+ messages in thread
From: Joe Hershberger @ 2015-04-08  6:41 UTC (permalink / raw)
  To: u-boot

Make a thorough pass through all variables and function names contained
within netconsole.c and remove CamelCase and improve naming.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

Changes in v2: None

 drivers/net/netconsole.c | 32 +++++++++++++++++---------------
 include/net.h            |  2 +-
 net/net.c                |  2 +-
 3 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index 9aba0c5..c2e0184 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -48,7 +48,7 @@ static void nc_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 		net_set_state(NETLOOP_SUCCESS); /* got input - quit net loop */
 }
 
-static void nc_timeout(void)
+static void nc_timeout_handler(void)
 {
 	net_set_state(NETLOOP_SUCCESS);
 }
@@ -91,8 +91,9 @@ static int refresh_settings_from_env(void)
 				nc_out_port = simple_strtoul(p + 1, NULL, 10);
 				nc_in_port = nc_out_port;
 			}
-		} else
+		} else {
 			nc_ip.s_addr = ~0; /* ncip is not set, so broadcast */
+		}
 
 		p = getenv("ncoutport");
 		if (p != NULL)
@@ -114,13 +115,13 @@ static int refresh_settings_from_env(void)
 /**
  * Called from NetLoop in net/net.c before each packet
  */
-void NcStart(void)
+void nc_start(void)
 {
 	refresh_settings_from_env();
 	if (!output_packet_len || memcmp(nc_ether, net_null_ethaddr, 6)) {
 		/* going to check for input packet */
 		net_set_udp_handler(nc_handler);
-		NetSetTimeout(net_timeout, nc_timeout);
+		NetSetTimeout(net_timeout, nc_timeout_handler);
 	} else {
 		/* send arp request */
 		uchar *pkt;
@@ -198,8 +199,9 @@ static void nc_send_packet(const char *buf, int len)
 			if (eth_init() < 0)
 				return;
 			eth_set_last_protocol(NETCONS);
-		} else
+		} else {
 			eth_init_state_only();
+		}
 
 		inited = 1;
 	}
@@ -217,7 +219,7 @@ static void nc_send_packet(const char *buf, int len)
 	}
 }
 
-static int nc_start(struct stdio_dev *dev)
+static int nc_stdio_start(struct stdio_dev *dev)
 {
 	int retval;
 
@@ -237,7 +239,7 @@ static int nc_start(struct stdio_dev *dev)
 	return 0;
 }
 
-static void nc_putc(struct stdio_dev *dev, char c)
+static void nc_stdio_putc(struct stdio_dev *dev, char c)
 {
 	if (output_recursion)
 		return;
@@ -248,7 +250,7 @@ static void nc_putc(struct stdio_dev *dev, char c)
 	output_recursion = 0;
 }
 
-static void nc_puts(struct stdio_dev *dev, const char *s)
+static void nc_stdio_puts(struct stdio_dev *dev, const char *s)
 {
 	int len;
 
@@ -267,7 +269,7 @@ static void nc_puts(struct stdio_dev *dev, const char *s)
 	output_recursion = 0;
 }
 
-static int nc_getc(struct stdio_dev *dev)
+static int nc_stdio_getc(struct stdio_dev *dev)
 {
 	uchar c;
 
@@ -288,7 +290,7 @@ static int nc_getc(struct stdio_dev *dev)
 	return c;
 }
 
-static int nc_tstc(struct stdio_dev *dev)
+static int nc_stdio_tstc(struct stdio_dev *dev)
 {
 	struct eth_device *eth;
 
@@ -321,11 +323,11 @@ int drv_nc_init(void)
 
 	strcpy(dev.name, "nc");
 	dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_INPUT | DEV_FLAGS_SYSTEM;
-	dev.start = nc_start;
-	dev.putc = nc_putc;
-	dev.puts = nc_puts;
-	dev.getc = nc_getc;
-	dev.tstc = nc_tstc;
+	dev.start = nc_stdio_start;
+	dev.putc = nc_stdio_putc;
+	dev.puts = nc_stdio_puts;
+	dev.getc = nc_stdio_getc;
+	dev.tstc = nc_stdio_tstc;
 
 	rc = stdio_register(&dev);
 
diff --git a/include/net.h b/include/net.h
index 1275ffe..a7aefbc 100644
--- a/include/net.h
+++ b/include/net.h
@@ -634,7 +634,7 @@ int net_send_udp_packet(uchar *ether, struct in_addr dest, int dport,
 void net_process_received_packet(uchar *in_packet, int len);
 
 #ifdef CONFIG_NETCONSOLE
-void NcStart(void);
+void nc_start(void);
 int nc_input_packet(uchar *pkt, struct in_addr src_ip, unsigned dest_port,
 	unsigned src_port, unsigned len);
 #endif
diff --git a/net/net.c b/net/net.c
index 1133f79..1395276 100644
--- a/net/net.c
+++ b/net/net.c
@@ -417,7 +417,7 @@ restart:
 #endif
 #if defined (CONFIG_NETCONSOLE) && !(CONFIG_SPL_BUILD)
 		case NETCONS:
-			NcStart();
+			nc_start();
 			break;
 #endif
 #if defined(CONFIG_CMD_SNTP)
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 17/25] net: cosmetic: Clean up cmd_net variables and functions
  2015-04-08  6:41 ` [U-Boot] [PATCH v2 0/25] " Joe Hershberger
                     ` (15 preceding siblings ...)
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 16/25] net: cosmetic: Clean up netconsole " Joe Hershberger
@ 2015-04-08  6:41   ` Joe Hershberger
  2015-04-08 12:46     ` Simon Glass
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 18/25] net: cosmetic: Fix checkpatch.pl failures in linklocal Joe Hershberger
                     ` (8 subsequent siblings)
  25 siblings, 1 reply; 103+ messages in thread
From: Joe Hershberger @ 2015-04-08  6:41 UTC (permalink / raw)
  To: u-boot

Make a thorough pass through all variables and function names contained
within common/cmd_net.c and remove CamelCase and improve naming.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

Changes in v2: None

 common/cmd_net.c | 29 ++++++++++++++---------------
 include/net.h    | 10 +++++-----
 net/net.c        | 26 +++++++++++++-------------
 3 files changed, 32 insertions(+), 33 deletions(-)

diff --git a/common/cmd_net.c b/common/cmd_net.c
index 0270ac3..a672d77 100644
--- a/common/cmd_net.c
+++ b/common/cmd_net.c
@@ -157,15 +157,13 @@ static void netboot_update_env(void)
 	if (net_nis_domain[0])
 		setenv("domain", net_nis_domain);
 
-#if defined(CONFIG_CMD_SNTP) \
-    && defined(CONFIG_BOOTP_TIMEOFFSET)
+#if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_TIMEOFFSET)
 	if (NetTimeOffset) {
 		sprintf(tmp, "%d", NetTimeOffset);
 		setenv("timeoffset", tmp);
 	}
 #endif
-#if defined(CONFIG_CMD_SNTP) \
-    && defined(CONFIG_BOOTP_NTPSERVER)
+#if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_NTPSERVER)
 	if (net_ntp_server.s_addr) {
 		ip_to_string(net_ntp_server, tmp);
 		setenv("ntpserverip", tmp);
@@ -183,9 +181,9 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc,
 	ulong addr;
 
 	/* pre-set load_addr */
-	if ((s = getenv("loadaddr")) != NULL) {
+	s = getenv("loadaddr");
+	if (s != NULL)
 		load_addr = simple_strtoul(s, NULL, 16);
-	}
 
 	switch (argc) {
 	case 1:
@@ -205,7 +203,8 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc,
 				      sizeof(net_boot_file_name));
 		break;
 
-	case 3:	load_addr = simple_strtoul(argv[1], NULL, 16);
+	case 3:
+		load_addr = simple_strtoul(argv[1], NULL, 16);
 		copy_filename(net_boot_file_name, argv[2],
 			      sizeof(net_boot_file_name));
 
@@ -214,7 +213,7 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc,
 #ifdef CONFIG_CMD_TFTPPUT
 	case 4:
 		if (strict_strtoul(argv[1], 16, &save_addr) < 0 ||
-			strict_strtoul(argv[2], 16, &save_size) < 0) {
+		    strict_strtoul(argv[2], 16, &save_size) < 0) {
 			printf("Invalid address/size\n");
 			return CMD_RET_USAGE;
 		}
@@ -228,7 +227,8 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc,
 	}
 	bootstage_mark(BOOTSTAGE_ID_NET_START);
 
-	if ((size = NetLoop(proto)) < 0) {
+	size = NetLoop(proto);
+	if (size < 0) {
 		bootstage_error(BOOTSTAGE_ID_NET_NETLOOP_OK);
 		return CMD_RET_FAILURE;
 	}
@@ -293,18 +293,17 @@ static void cdp_update_env(void)
 	if (cdp_appliance_vlan != htons(-1)) {
 		printf("CDP offered appliance VLAN %d\n",
 		       ntohs(cdp_appliance_vlan));
-		VLAN_to_string(cdp_appliance_vlan, tmp);
+		vlan_to_string(cdp_appliance_vlan, tmp);
 		setenv("vlan", tmp);
-		NetOurVLAN = cdp_appliance_vlan;
+		net_our_vlan = cdp_appliance_vlan;
 	}
 
 	if (cdp_native_vlan != htons(-1)) {
 		printf("CDP offered native VLAN %d\n", ntohs(cdp_native_vlan));
-		VLAN_to_string(cdp_native_vlan, tmp);
+		vlan_to_string(cdp_native_vlan, tmp);
 		setenv("nvlan", tmp);
-		NetOurNativeVLAN = cdp_native_vlan;
+		net_native_vlan = cdp_native_vlan;
 	}
-
 }
 
 int do_cdp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
@@ -356,7 +355,7 @@ int do_sntp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 	if (NetLoop(SNTP) < 0) {
 		printf("SNTP failed: host %pI4 not responding\n",
-			&net_ntp_server);
+		       &net_ntp_server);
 		return CMD_RET_FAILURE;
 	}
 
diff --git a/include/net.h b/include/net.h
index a7aefbc..c4a534c 100644
--- a/include/net.h
+++ b/include/net.h
@@ -485,8 +485,8 @@ extern const u8		net_null_ethaddr[6];
 
 #define VLAN_NONE	4095			/* untagged */
 #define VLAN_IDMASK	0x0fff			/* mask of valid vlan id */
-extern ushort		NetOurVLAN;		/* Our VLAN */
-extern ushort		NetOurNativeVLAN;	/* Our Native VLAN */
+extern ushort		net_our_vlan;		/* Our VLAN */
+extern ushort		net_native_vlan;	/* Our Native VLAN */
 
 extern int		NetRestartWrap;		/* Tried all network devices */
 
@@ -785,13 +785,13 @@ void ip_to_string(struct in_addr x, char *s);
 struct in_addr string_to_ip(const char *s);
 
 /* Convert a VLAN id to a string */
-void VLAN_to_string(ushort x, char *s);
+void vlan_to_string(ushort x, char *s);
 
 /* Convert a string to a vlan id */
-ushort string_to_VLAN(const char *s);
+ushort string_to_vlan(const char *s);
 
 /* read a VLAN id from an environment variable */
-ushort getenv_VLAN(char *);
+ushort getenv_vlan(char *);
 
 /* copy a filename (allow for "..." notation, limit length) */
 void copy_filename(char *dst, const char *src, int size);
diff --git a/net/net.c b/net/net.c
index 1395276..8c09529 100644
--- a/net/net.c
+++ b/net/net.c
@@ -159,9 +159,9 @@ static int	NetDevExists;
 
 /* XXX in both little & big endian machines 0xFFFF == ntohs(-1) */
 /* default is without VLAN */
-ushort		NetOurVLAN = 0xFFFF;
+ushort		net_our_vlan = 0xFFFF;
 /* ditto */
-ushort		NetOurNativeVLAN = 0xFFFF;
+ushort		net_native_vlan = 0xFFFF;
 
 /* Boot File name */
 char net_boot_file_name[128];
@@ -261,8 +261,8 @@ static void NetInitLoop(void)
 		net_gateway = getenv_ip("gatewayip");
 		net_netmask = getenv_ip("netmask");
 		net_server_ip = getenv_ip("serverip");
-		NetOurNativeVLAN = getenv_VLAN("nvlan");
-		NetOurVLAN = getenv_VLAN("vlan");
+		net_native_vlan = getenv_vlan("nvlan");
+		net_our_vlan = getenv_vlan("vlan");
 #if defined(CONFIG_CMD_DNS)
 		net_dns_server = getenv_ip("dnsip");
 #endif
@@ -989,10 +989,10 @@ void net_process_received_packet(uchar *in_packet, int len)
 	iscdp = is_cdp_packet(et->et_dest);
 #endif
 
-	myvlanid = ntohs(NetOurVLAN);
+	myvlanid = ntohs(net_our_vlan);
 	if (myvlanid == (ushort)-1)
 		myvlanid = VLAN_NONE;
-	mynvlanid = ntohs(NetOurNativeVLAN);
+	mynvlanid = ntohs(net_native_vlan);
 	if (mynvlanid == (ushort)-1)
 		mynvlanid = VLAN_NONE;
 
@@ -1024,7 +1024,7 @@ void net_process_received_packet(uchar *in_packet, int len)
 			return;
 
 		/* if no VLAN active */
-		if ((ntohs(NetOurVLAN) & VLAN_IDMASK) == VLAN_NONE
+		if ((ntohs(net_our_vlan) & VLAN_IDMASK) == VLAN_NONE
 #if defined(CONFIG_CMD_CDP)
 				&& iscdp == 0
 #endif
@@ -1301,7 +1301,7 @@ net_eth_hdr_size(void)
 {
 	ushort myvlanid;
 
-	myvlanid = ntohs(NetOurVLAN);
+	myvlanid = ntohs(net_our_vlan);
 	if (myvlanid == (ushort)-1)
 		myvlanid = VLAN_NONE;
 
@@ -1314,7 +1314,7 @@ int net_set_ether(uchar *xet, const uchar *dest_ethaddr, uint prot)
 	struct ethernet_hdr *et = (struct ethernet_hdr *)xet;
 	ushort myvlanid;
 
-	myvlanid = ntohs(NetOurVLAN);
+	myvlanid = ntohs(net_our_vlan);
 	if (myvlanid == (ushort)-1)
 		myvlanid = VLAN_NONE;
 
@@ -1439,7 +1439,7 @@ void ip_to_string(struct in_addr x, char *s)
 	);
 }
 
-void VLAN_to_string(ushort x, char *s)
+void vlan_to_string(ushort x, char *s)
 {
 	x = ntohs(x);
 
@@ -1452,7 +1452,7 @@ void VLAN_to_string(ushort x, char *s)
 		sprintf(s, "%d", x & VLAN_IDMASK);
 }
 
-ushort string_to_VLAN(const char *s)
+ushort string_to_vlan(const char *s)
 {
 	ushort id;
 
@@ -1467,7 +1467,7 @@ ushort string_to_VLAN(const char *s)
 	return htons(id);
 }
 
-ushort getenv_VLAN(char *var)
+ushort getenv_vlan(char *var)
 {
-	return string_to_VLAN(getenv(var));
+	return string_to_vlan(getenv(var));
 }
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 18/25] net: cosmetic: Fix checkpatch.pl failures in linklocal
  2015-04-08  6:41 ` [U-Boot] [PATCH v2 0/25] " Joe Hershberger
                     ` (16 preceding siblings ...)
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 17/25] net: cosmetic: Clean up cmd_net " Joe Hershberger
@ 2015-04-08  6:41   ` Joe Hershberger
  2015-04-08 12:46     ` Simon Glass
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 19/25] net: cosmetic: Fix checkpatch.pl failures in eth.c Joe Hershberger
                     ` (7 subsequent siblings)
  25 siblings, 1 reply; 103+ messages in thread
From: Joe Hershberger @ 2015-04-08  6:41 UTC (permalink / raw)
  To: u-boot

A few new rules in checkpatch.pl since linklocal.c was added.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

Changes in v2: None

 net/link_local.c | 36 +++++++++++++++++-------------------
 1 file changed, 17 insertions(+), 19 deletions(-)

diff --git a/net/link_local.c b/net/link_local.c
index 2bca7de..ea5b4f4 100644
--- a/net/link_local.c
+++ b/net/link_local.c
@@ -97,7 +97,7 @@ static void configure_wait(void)
 	deadline_ms = MONOTONIC_MS() + timeout_ms;
 
 	debug_cond(DEBUG_DEV_PKT, "...wait %d %s nprobes=%u, nclaims=%u\n",
-			timeout_ms, eth_get_name(), nprobes, nclaims);
+		   timeout_ms, eth_get_name(), nprobes, nclaims);
 
 	NetSetTimeout(timeout_ms, link_local_timeout);
 }
@@ -138,7 +138,7 @@ static void link_local_timeout(void)
 
 			nprobes++;
 			debug_cond(DEBUG_LL_STATE, "probe/%u %s@%pI4\n",
-					nprobes, eth_get_name(), &ip);
+				   nprobes, eth_get_name(), &ip);
 			arp_raw_request(zero_ip, net_null_ethaddr, ip);
 			timeout_ms = PROBE_MIN * 1000;
 			timeout_ms += random_delay_ms(PROBE_MAX - PROBE_MIN);
@@ -147,7 +147,7 @@ static void link_local_timeout(void)
 			state = ANNOUNCE;
 			nclaims = 0;
 			debug_cond(DEBUG_LL_STATE, "announce/%u %s@%pI4\n",
-					nclaims, eth_get_name(), &ip);
+				   nclaims, eth_get_name(), &ip);
 			arp_raw_request(ip, net_ethaddr, ip);
 			timeout_ms = ANNOUNCE_INTERVAL * 1000;
 		}
@@ -159,7 +159,7 @@ static void link_local_timeout(void)
 		state = ANNOUNCE;
 		nclaims = 0;
 		debug_cond(DEBUG_LL_STATE, "announce/%u %s@%pI4\n",
-				nclaims, eth_get_name(), &ip);
+			   nclaims, eth_get_name(), &ip);
 		arp_raw_request(ip, net_ethaddr, ip);
 		timeout_ms = ANNOUNCE_INTERVAL * 1000;
 		break;
@@ -170,7 +170,7 @@ static void link_local_timeout(void)
 		if (nclaims < ANNOUNCE_NUM) {
 			nclaims++;
 			debug_cond(DEBUG_LL_STATE, "announce/%u %s@%pI4\n",
-					nclaims, eth_get_name(), &ip);
+				   nclaims, eth_get_name(), &ip);
 			arp_raw_request(ip, net_ethaddr, ip);
 			timeout_ms = ANNOUNCE_INTERVAL * 1000;
 		} else {
@@ -224,7 +224,7 @@ void link_local_receive_arp(struct arp_hdr *arp, int len)
 			/* Current time is greater than the expected timeout
 			   time. This should never happen */
 			debug_cond(DEBUG_LL_STATE,
-				"missed an expected timeout\n");
+				   "missed an expected timeout\n");
 			timeout_ms = 0;
 		} else {
 			debug_cond(DEBUG_INT_STATE, "adjusting timeout\n");
@@ -239,9 +239,8 @@ void link_local_receive_arp(struct arp_hdr *arp, int len)
 			 * FIXME: links routinely go down;
 			 */
 			bb_error_msg("iface %s is down", eth_get_name());
-			if (ready) {
+			if (ready)
 				run(argv, "deconfig", &ip);
-			}
 			return EXIT_FAILURE;
 		}
 		continue;
@@ -249,18 +248,17 @@ void link_local_receive_arp(struct arp_hdr *arp, int len)
 #endif
 
 	debug_cond(DEBUG_INT_STATE, "%s recv arp type=%d, op=%d,\n",
-		eth_get_name(), ntohs(arp->ar_pro),
-		ntohs(arp->ar_op));
+		   eth_get_name(), ntohs(arp->ar_pro),
+		   ntohs(arp->ar_op));
 	debug_cond(DEBUG_INT_STATE, "\tsource=%pM %pI4\n",
-		&arp->ar_sha,
-		&arp->ar_spa);
+		   &arp->ar_sha,
+		   &arp->ar_spa);
 	debug_cond(DEBUG_INT_STATE, "\ttarget=%pM %pI4\n",
-		&arp->ar_tha,
-		&arp->ar_tpa);
+		   &arp->ar_tha,
+		   &arp->ar_tpa);
 
-	if (arp->ar_op != htons(ARPOP_REQUEST)
-	 && arp->ar_op != htons(ARPOP_REPLY)
-	) {
+	if (arp->ar_op != htons(ARPOP_REQUEST) &&
+	    arp->ar_op != htons(ARPOP_REPLY)) {
 		configure_wait();
 		return;
 	}
@@ -287,8 +285,8 @@ void link_local_receive_arp(struct arp_hdr *arp, int len)
 	}
 
 	debug_cond(DEBUG_NET_PKT,
-		"state = %d, source ip conflict = %d, target ip conflict = "
-		"%d\n", state, source_ip_conflict, target_ip_conflict);
+		   "state = %d, source ip conflict = %d, target ip conflict = "
+		   "%d\n", state, source_ip_conflict, target_ip_conflict);
 	switch (state) {
 	case PROBE:
 	case ANNOUNCE:
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 19/25] net: cosmetic: Fix checkpatch.pl failures in eth.c
  2015-04-08  6:41 ` [U-Boot] [PATCH v2 0/25] " Joe Hershberger
                     ` (17 preceding siblings ...)
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 18/25] net: cosmetic: Fix checkpatch.pl failures in linklocal Joe Hershberger
@ 2015-04-08  6:41   ` Joe Hershberger
  2015-04-08 12:46     ` Simon Glass
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 20/25] net: cosmetic: Fix checkpatch.pl failures in net.h Joe Hershberger
                     ` (6 subsequent siblings)
  25 siblings, 1 reply; 103+ messages in thread
From: Joe Hershberger @ 2015-04-08  6:41 UTC (permalink / raw)
  To: u-boot

There were still a few failures in net/eth.c, especially in the legacy
part of the code.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

Changes in v2: None

 net/eth.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/net/eth.c b/net/eth.c
index e936ca0..953b6a6 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -74,8 +74,10 @@ static int eth_mac_skip(int index)
 {
 	char enetvar[15];
 	char *skip_state;
+
 	sprintf(enetvar, index ? "eth%dmacskip" : "ethmacskip", index);
-	return ((skip_state = getenv(enetvar)) != NULL);
+	skip_state = getenv(enetvar);
+	return skip_state != NULL;
 }
 
 static void eth_current_changed(void);
@@ -275,8 +277,9 @@ int eth_init(void)
 				priv->state = ETH_STATE_ACTIVE;
 				return 0;
 			}
-		} else
+		} else {
 			ret = eth_errno;
+		}
 
 		debug("FAIL\n");
 
@@ -610,11 +613,11 @@ int eth_write_hwaddr(struct eth_device *dev, const char *base_name,
 		if (!is_zero_ethaddr(dev->enetaddr) &&
 		    memcmp(dev->enetaddr, env_enetaddr, 6)) {
 			printf("\nWarning: %s MAC addresses don't match:\n",
-				dev->name);
+			       dev->name);
 			printf("Address in SROM is         %pM\n",
-				dev->enetaddr);
+			       dev->enetaddr);
 			printf("Address in environment is  %pM\n",
-				env_enetaddr);
+			       env_enetaddr);
 		}
 
 		memcpy(dev->enetaddr, env_enetaddr, 6);
@@ -622,7 +625,7 @@ int eth_write_hwaddr(struct eth_device *dev, const char *base_name,
 		eth_setenv_enetaddr_by_index(base_name, eth_number,
 					     dev->enetaddr);
 		printf("\nWarning: %s using MAC address from net device\n",
-			dev->name);
+		       dev->name);
 	} else if (is_zero_ethaddr(dev->enetaddr)) {
 		printf("\nError: %s address not set.\n",
 		       dev->name);
@@ -632,13 +635,14 @@ int eth_write_hwaddr(struct eth_device *dev, const char *base_name,
 	if (dev->write_hwaddr && !eth_mac_skip(eth_number)) {
 		if (!is_valid_ethaddr(dev->enetaddr)) {
 			printf("\nError: %s address %pM illegal value\n",
-				 dev->name, dev->enetaddr);
+			       dev->name, dev->enetaddr);
 			return -EINVAL;
 		}
 
 		ret = dev->write_hwaddr(dev);
 		if (ret)
-			printf("\nWarning: %s failed to set MAC address\n", dev->name);
+			printf("\nWarning: %s failed to set MAC address\n",
+			       dev->name);
 	}
 
 	return ret;
@@ -652,7 +656,8 @@ int eth_register(struct eth_device *dev)
 	assert(strlen(dev->name) < sizeof(dev->name));
 
 	if (!eth_devices) {
-		eth_current = eth_devices = dev;
+		eth_devices = dev;
+		eth_current = dev;
 		eth_current_changed();
 	} else {
 		for (d = eth_devices; d->next != eth_devices; d = d->next)
@@ -723,8 +728,9 @@ int eth_initialize(void)
 	} else if (cpu_eth_init != __def_eth_init) {
 		if (cpu_eth_init(gd->bd) < 0)
 			printf("CPU Net Initialization Failed\n");
-	} else
+	} else {
 		printf("Net Initialization Skipped\n");
+	}
 
 	if (!eth_devices) {
 		puts("No ethernet found.\n");
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 20/25] net: cosmetic: Fix checkpatch.pl failures in net.h
  2015-04-08  6:41 ` [U-Boot] [PATCH v2 0/25] " Joe Hershberger
                     ` (18 preceding siblings ...)
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 19/25] net: cosmetic: Fix checkpatch.pl failures in eth.c Joe Hershberger
@ 2015-04-08  6:41   ` Joe Hershberger
  2015-04-08 12:47     ` Simon Glass
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 21/25] net: cosmetic: Fix checkpatch.pl failures in net.c Joe Hershberger
                     ` (5 subsequent siblings)
  25 siblings, 1 reply; 103+ messages in thread
From: Joe Hershberger @ 2015-04-08  6:41 UTC (permalink / raw)
  To: u-boot

There were still a few remaining complains in the legacy eth_device
definition that hadn't been addressed.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

Changes in v2: None

 include/net.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/net.h b/include/net.h
index c4a534c..069b688 100644
--- a/include/net.h
+++ b/include/net.h
@@ -143,14 +143,14 @@ struct eth_device {
 	phys_addr_t iobase;
 	int state;
 
-	int  (*init) (struct eth_device *, bd_t *);
-	int  (*send) (struct eth_device *, void *packet, int length);
-	int  (*recv) (struct eth_device *);
-	void (*halt) (struct eth_device *);
+	int (*init)(struct eth_device *, bd_t *);
+	int (*send)(struct eth_device *, void *packet, int length);
+	int (*recv)(struct eth_device *);
+	void (*halt)(struct eth_device *);
 #ifdef CONFIG_MCAST_TFTP
-	int (*mcast) (struct eth_device *, const u8 *enetaddr, u8 set);
+	int (*mcast)(struct eth_device *, const u8 *enetaddr, u8 set);
 #endif
-	int  (*write_hwaddr) (struct eth_device *);
+	int (*write_hwaddr)(struct eth_device *);
 	struct eth_device *next;
 	int index;
 	void *priv;
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 21/25] net: cosmetic: Fix checkpatch.pl failures in net.c
  2015-04-08  6:41 ` [U-Boot] [PATCH v2 0/25] " Joe Hershberger
                     ` (19 preceding siblings ...)
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 20/25] net: cosmetic: Fix checkpatch.pl failures in net.h Joe Hershberger
@ 2015-04-08  6:41   ` Joe Hershberger
  2015-04-08 12:47     ` Simon Glass
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 22/25] net: Fix incorrect DHCP/BOOTP packets on 64-bit systems Joe Hershberger
                     ` (4 subsequent siblings)
  25 siblings, 1 reply; 103+ messages in thread
From: Joe Hershberger @ 2015-04-08  6:41 UTC (permalink / raw)
  To: u-boot

Finish eliminating CamelCase from net.c and other failures

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

Changes in v2: None

 README                   |   6 +-
 common/cmd_elf.c         |   2 +-
 common/cmd_net.c         |  22 +++---
 common/spl/spl_net.c     |   2 +-
 common/update.c          |   2 +-
 doc/README.link-local    |   4 +-
 drivers/net/netconsole.c |  12 ++--
 include/net.h            |  18 ++---
 net/arp.c                |   2 +-
 net/bootp.c              |  33 ++++-----
 net/cdp.c                |   6 +-
 net/dns.c                |   2 +-
 net/eth.c                |   2 +-
 net/link_local.c         |   4 +-
 net/net.c                | 179 +++++++++++++++++++++++------------------------
 net/nfs.c                |  11 +--
 net/ping.c               |   2 +-
 net/rarp.c               |   6 +-
 net/sntp.c               |   4 +-
 net/tftp.c               |  18 ++---
 test/dm/eth.c            |  28 ++++----
 21 files changed, 181 insertions(+), 184 deletions(-)

diff --git a/README b/README
index 5d57eb9..25aebbc 100644
--- a/README
+++ b/README
@@ -3340,9 +3340,9 @@ Legacy uImage format:
    65	net/eth.c		Ethernet found.
 
   -80	common/cmd_net.c	usage wrong
-   80	common/cmd_net.c	before calling NetLoop()
-  -81	common/cmd_net.c	some error in NetLoop() occurred
-   81	common/cmd_net.c	NetLoop() back without error
+   80	common/cmd_net.c	before calling net_loop()
+  -81	common/cmd_net.c	some error in net_loop() occurred
+   81	common/cmd_net.c	net_loop() back without error
   -82	common/cmd_net.c	size == 0 (File with size 0 loaded)
    82	common/cmd_net.c	trying automatic boot
    83	common/cmd_net.c	running "source" command
diff --git a/common/cmd_elf.c b/common/cmd_elf.c
index c745371..22475dc 100644
--- a/common/cmd_elf.c
+++ b/common/cmd_elf.c
@@ -170,7 +170,7 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	 * Check to see if we need to tftp the image ourselves before starting
 	 */
 	if ((argc == 2) && (strcmp(argv[1], "tftp") == 0)) {
-		if (NetLoop(TFTPGET) <= 0)
+		if (net_loop(TFTPGET) <= 0)
 			return 1;
 		printf("Automatic boot of VxWorks image@address 0x%08lx ...\n",
 			addr);
diff --git a/common/cmd_net.c b/common/cmd_net.c
index a672d77..b2f3c7b 100644
--- a/common/cmd_net.c
+++ b/common/cmd_net.c
@@ -158,8 +158,8 @@ static void netboot_update_env(void)
 		setenv("domain", net_nis_domain);
 
 #if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_TIMEOFFSET)
-	if (NetTimeOffset) {
-		sprintf(tmp, "%d", NetTimeOffset);
+	if (net_ntp_time_offset) {
+		sprintf(tmp, "%d", net_ntp_time_offset);
 		setenv("timeoffset", tmp);
 	}
 #endif
@@ -227,14 +227,14 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc,
 	}
 	bootstage_mark(BOOTSTAGE_ID_NET_START);
 
-	size = NetLoop(proto);
+	size = net_loop(proto);
 	if (size < 0) {
 		bootstage_error(BOOTSTAGE_ID_NET_NETLOOP_OK);
 		return CMD_RET_FAILURE;
 	}
 	bootstage_mark(BOOTSTAGE_ID_NET_NETLOOP_OK);
 
-	/* NetLoop ok, update environment */
+	/* net_loop ok, update environment */
 	netboot_update_env();
 
 	/* done if no file was loaded (no errors though) */
@@ -267,7 +267,7 @@ static int do_ping(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	if (net_ping_ip.s_addr == 0)
 		return CMD_RET_USAGE;
 
-	if (NetLoop(PING) < 0) {
+	if (net_loop(PING) < 0) {
 		printf("ping failed; host %s is not alive\n", argv[1]);
 		return CMD_RET_FAILURE;
 	}
@@ -310,7 +310,7 @@ int do_cdp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	int r;
 
-	r = NetLoop(CDP);
+	r = net_loop(CDP);
 	if (r < 0) {
 		printf("cdp failed; perhaps not a CISCO switch?\n");
 		return CMD_RET_FAILURE;
@@ -349,11 +349,11 @@ int do_sntp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 	toff = getenv("timeoffset");
 	if (toff == NULL)
-		NetTimeOffset = 0;
+		net_ntp_time_offset = 0;
 	else
-		NetTimeOffset = simple_strtol(toff, NULL, 10);
+		net_ntp_time_offset = simple_strtol(toff, NULL, 10);
 
-	if (NetLoop(SNTP) < 0) {
+	if (net_loop(SNTP) < 0) {
 		printf("SNTP failed: host %pI4 not responding\n",
 		       &net_ntp_server);
 		return CMD_RET_FAILURE;
@@ -399,7 +399,7 @@ int do_dns(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	else
 		net_dns_env_var = NULL;
 
-	if (NetLoop(DNS) < 0) {
+	if (net_loop(DNS) < 0) {
 		printf("dns lookup of %s failed, check setup\n", argv[1]);
 		return CMD_RET_FAILURE;
 	}
@@ -421,7 +421,7 @@ static int do_link_local(cmd_tbl_t *cmdtp, int flag, int argc,
 {
 	char tmp[22];
 
-	if (NetLoop(LINKLOCAL) < 0)
+	if (net_loop(LINKLOCAL) < 0)
 		return CMD_RET_FAILURE;
 
 	net_gateway.s_addr = 0;
diff --git a/common/spl/spl_net.c b/common/spl/spl_net.c
index af4952f..217a435 100644
--- a/common/spl/spl_net.c
+++ b/common/spl/spl_net.c
@@ -28,7 +28,7 @@ void spl_net_load_image(const char *device)
 	}
 	if (device)
 		setenv("ethact", device);
-	rv = NetLoop(BOOTP);
+	rv = net_loop(BOOTP);
 	if (rv < 0) {
 		printf("Problem booting with BOOTP\n");
 		hang();
diff --git a/common/update.c b/common/update.c
index 1bf2f82..1c6aa18 100644
--- a/common/update.c
+++ b/common/update.c
@@ -70,7 +70,7 @@ static int update_load(char *filename, ulong msec_max, int cnt_max, ulong addr)
 	/* download the update file */
 	load_addr = addr;
 	copy_filename(net_boot_file_name, filename, sizeof(net_boot_file_name));
-	size = NetLoop(TFTPGET);
+	size = net_loop(TFTPGET);
 
 	if (size < 0)
 		rv = 1;
diff --git a/doc/README.link-local b/doc/README.link-local
index 9586eca..148b498 100644
--- a/doc/README.link-local
+++ b/doc/README.link-local
@@ -32,11 +32,11 @@ after successful negotiation to enable network access.
 -------------
 
 RFC3927 requires that addresses are continuously checked to
-avoid conflicts, however this can only happen when the NetLoop
+avoid conflicts, however this can only happen when the net_loop
 is getting called.  It is possible for a conflict to go undetected
 until a command that accesses the network is executed.
 
-Using NetConsole is one way to ensure that NetLoop is always
+Using NetConsole is one way to ensure that net_loop is always
 processing packets and monitoring for conflicts.
 
 This is also not a concern if the feature is use to connect
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index c2e0184..31042a6 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -113,7 +113,7 @@ static int refresh_settings_from_env(void)
 }
 
 /**
- * Called from NetLoop in net/net.c before each packet
+ * Called from net_loop in net/net.c before each packet
  */
 void nc_start(void)
 {
@@ -121,7 +121,7 @@ void nc_start(void)
 	if (!output_packet_len || memcmp(nc_ether, net_null_ethaddr, 6)) {
 		/* going to check for input packet */
 		net_set_udp_handler(nc_handler);
-		NetSetTimeout(net_timeout, nc_timeout_handler);
+		net_set_timeout_handler(net_timeout, nc_timeout_handler);
 	} else {
 		/* send arp request */
 		uchar *pkt;
@@ -188,7 +188,7 @@ static void nc_send_packet(const char *buf, int len)
 		output_packet = buf;
 		output_packet_len = len;
 		input_recursion = 1;
-		NetLoop(NETCONS); /* wait for arp reply and send packet */
+		net_loop(NETCONS); /* wait for arp reply and send packet */
 		input_recursion = 0;
 		output_packet_len = 0;
 		return;
@@ -232,7 +232,7 @@ static int nc_stdio_start(struct stdio_dev *dev)
 
 	/*
 	 * Initialize the static IP settings and buffer pointers
-	 * incase we call net_send_udp_packet before NetLoop
+	 * incase we call net_send_udp_packet before net_loop
 	 */
 	net_init();
 
@@ -277,7 +277,7 @@ static int nc_stdio_getc(struct stdio_dev *dev)
 
 	net_timeout = 0;	/* no timeout */
 	while (!input_size)
-		NetLoop(NETCONS);
+		net_loop(NETCONS);
 
 	input_recursion = 0;
 
@@ -307,7 +307,7 @@ static int nc_stdio_tstc(struct stdio_dev *dev)
 	input_recursion = 1;
 
 	net_timeout = 1;
-	NetLoop(NETCONS);	/* kind of poll */
+	net_loop(NETCONS);	/* kind of poll */
 
 	input_recursion = 0;
 
diff --git a/include/net.h b/include/net.h
index 069b688..e9131f7 100644
--- a/include/net.h
+++ b/include/net.h
@@ -479,7 +479,6 @@ extern uchar		*net_tx_packet;		/* THE transmit packet */
 extern uchar		*net_rx_packets[PKTBUFSRX]; /* Receive packets */
 extern uchar		*net_rx_packet;		/* Current receive packet */
 extern int		net_rx_packet_len;	/* Current rx packet length */
-extern unsigned		NetIPID;		/* IP ID (counting) */
 extern const u8		net_bcast_ethaddr[6];	/* Ethernet broadcast address */
 extern const u8		net_null_ethaddr[6];
 
@@ -488,7 +487,7 @@ extern const u8		net_null_ethaddr[6];
 extern ushort		net_our_vlan;		/* Our VLAN */
 extern ushort		net_native_vlan;	/* Our Native VLAN */
 
-extern int		NetRestartWrap;		/* Tried all network devices */
+extern int		net_restart_wrap;	/* Tried all network devices */
 
 enum proto_t {
 	BOOTP, RARP, ARP, TFTPGET, DHCP, PING, DNS, NFS, CDP, NETCONS, SNTP,
@@ -528,7 +527,7 @@ static inline int is_cdp_packet(const uchar *ethaddr)
 
 #if defined(CONFIG_CMD_SNTP)
 extern struct in_addr	net_ntp_server;		/* the ip address to NTP */
-extern int NetTimeOffset;			/* offset time from UTC */
+extern int net_ntp_time_offset;			/* offset time from UTC */
 #endif
 
 #if defined(CONFIG_MCAST_TFTP)
@@ -537,13 +536,10 @@ extern struct in_addr net_mcast_addr;
 
 /* Initialize the network adapter */
 void net_init(void);
-int NetLoop(enum proto_t);
-
-/* Shutdown adapters and cleanup */
-void	NetStop(void);
+int net_loop(enum proto_t);
 
 /* Load failed.	 Start again. */
-int	NetStartAgain(void);
+int net_start_again(void);
 
 /* Get size of the ethernet header when we send */
 int net_eth_hdr_size(void);
@@ -593,7 +589,7 @@ void net_set_udp_handler(rxhand_f *);	/* Set UDP RX packet handler */
 rxhand_f *net_get_arp_handler(void);	/* Get ARP RX packet handler */
 void net_set_arp_handler(rxhand_f *);	/* Set ARP RX packet handler */
 void net_set_icmp_handler(rxhand_icmp_f *f); /* Set ICMP RX handler */
-void	NetSetTimeout(ulong, thand_f *);/* Set timeout handler */
+void net_set_timeout_handler(ulong, thand_f *);/* Set timeout handler */
 
 /* Network loop state */
 enum net_loop_state {
@@ -682,7 +678,7 @@ static inline struct in_addr net_read_ip(void *from)
 }
 
 /* return ulong *in network byteorder* */
-static inline ulong NetReadLong(ulong *from)
+static inline ulong net_read_long(ulong *from)
 {
 	ulong l;
 
@@ -703,7 +699,7 @@ static inline void net_copy_ip(void *to, void *from)
 }
 
 /* copy ulong */
-static inline void NetCopyLong(ulong *to, ulong *from)
+static inline void net_copy_long(ulong *to, ulong *from)
 {
 	memcpy((void *)to, (void *)from, sizeof(ulong));
 }
diff --git a/net/arp.c b/net/arp.c
index 953f312..b865570 100644
--- a/net/arp.c
+++ b/net/arp.c
@@ -112,7 +112,7 @@ void arp_timeout_check(void)
 		if (arp_wait_try >= ARP_TIMEOUT_COUNT) {
 			puts("\nARP Retry count exceeded; starting again\n");
 			arp_wait_try = 0;
-			NetStartAgain();
+			net_start_again();
 		} else {
 			arp_wait_timer_start = t;
 			arp_request();
diff --git a/net/bootp.c b/net/bootp.c
index fa75125..500850c 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -128,7 +128,7 @@ static int check_packet(uchar *pkt, unsigned dest, unsigned src, unsigned len)
 		retval = -4;
 	else if (bp->bp_hlen != HWL_ETHER)
 		retval = -5;
-	else if (!bootp_match_id(NetReadLong((ulong *)&bp->bp_id)))
+	else if (!bootp_match_id(net_read_long((ulong *)&bp->bp_id)))
 		retval = -6;
 
 	debug("Filtering pkt = %d\n", retval);
@@ -356,10 +356,11 @@ static void bootp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 	store_net_params(bp);		/* Store net parameters from reply */
 
 	/* Retrieve extended information (we must parse the vendor area) */
-	if (NetReadLong((ulong *)&bp->bp_vend[0]) == htonl(BOOTP_VENDOR_MAGIC))
+	if (net_read_long((ulong *)&bp->bp_vend[0]) ==
+	    htonl(BOOTP_VENDOR_MAGIC))
 		bootp_process_vendor((uchar *)&bp->bp_vend[4], len);
 
-	NetSetTimeout(0, (thand_f *)0);
+	net_set_timeout_handler(0, (thand_f *)0);
 	bootstage_mark_name(BOOTSTAGE_ID_BOOTP_STOP, "bootp_stop");
 
 	debug("Got good BOOTP\n");
@@ -381,13 +382,13 @@ static void bootp_timeout_handler(void)
 		net_set_state(NETLOOP_FAIL);
 #else
 		puts("\nRetry time exceeded; starting again\n");
-		NetStartAgain();
+		net_start_again();
 #endif
 	} else {
 		bootp_timeout *= 2;
 		if (bootp_timeout > 2000)
 			bootp_timeout = 2000;
-		NetSetTimeout(bootp_timeout, bootp_timeout_handler);
+		net_set_timeout_handler(bootp_timeout, bootp_timeout_handler);
 		bootp_request();
 	}
 }
@@ -740,7 +741,7 @@ void bootp_request(void)
 	bootp_id += get_timer(0);
 	bootp_id = htonl(bootp_id);
 	bootp_add_id(bootp_id);
-	NetCopyLong(&bp->bp_id, &bootp_id);
+	net_copy_long(&bp->bp_id, &bootp_id);
 
 	/*
 	 * Calculate proper packet lengths taking into account the
@@ -750,7 +751,7 @@ void bootp_request(void)
 	pktlen = eth_hdr_size + IP_UDP_HDR_SIZE + iplen;
 	bcast_ip.s_addr = 0xFFFFFFFFL;
 	net_set_udp_header(iphdr, bcast_ip, PORT_BOOTPS, PORT_BOOTPC, iplen);
-	NetSetTimeout(bootp_timeout, bootp_timeout_handler);
+	net_set_timeout_handler(bootp_timeout, bootp_timeout_handler);
 
 #if defined(CONFIG_CMD_DHCP)
 	dhcp_state = SELECTING;
@@ -778,9 +779,9 @@ static void dhcp_process_options(uchar *popt, struct bootp_hdr *bp)
 			break;
 #if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_TIMEOFFSET)
 		case 2:		/* Time offset	*/
-			to_ptr = &NetTimeOffset;
-			NetCopyLong((ulong *)to_ptr, (ulong *)(popt + 2));
-			NetTimeOffset = ntohl(NetTimeOffset);
+			to_ptr = &net_ntp_time_offset;
+			net_copy_long((ulong *)to_ptr, (ulong *)(popt + 2));
+			net_ntp_time_offset = ntohl(net_ntp_time_offset);
 			break;
 #endif
 		case 3:
@@ -815,7 +816,7 @@ static void dhcp_process_options(uchar *popt, struct bootp_hdr *bp)
 			break;
 #endif
 		case 51:
-			NetCopyLong(&dhcp_leasetime, (ulong *) (popt + 2));
+			net_copy_long(&dhcp_leasetime, (ulong *)(popt + 2));
 			break;
 		case 53:	/* Ignore Message Type Option */
 			break;
@@ -869,7 +870,7 @@ static void dhcp_process_options(uchar *popt, struct bootp_hdr *bp)
 
 static int dhcp_message_type(unsigned char *popt)
 {
-	if (NetReadLong((ulong *)popt) != htonl(BOOTP_VENDOR_MAGIC))
+	if (net_read_long((ulong *)popt) != htonl(BOOTP_VENDOR_MAGIC))
 		return -1;
 
 	popt += 4;
@@ -923,7 +924,7 @@ static void dhcp_send_request_packet(struct bootp_hdr *bp_offer)
 	 * ID is the id of the OFFER packet
 	 */
 
-	NetCopyLong(&bp->bp_id, &bp_offer->bp_id);
+	net_copy_long(&bp->bp_id, &bp_offer->bp_id);
 
 	/*
 	 * Copy options from OFFER packet if present
@@ -982,11 +983,11 @@ static void dhcp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 			debug("TRANSITIONING TO REQUESTING STATE\n");
 			dhcp_state = REQUESTING;
 
-			if (NetReadLong((ulong *)&bp->bp_vend[0]) ==
+			if (net_read_long((ulong *)&bp->bp_vend[0]) ==
 						htonl(BOOTP_VENDOR_MAGIC))
 				dhcp_process_options((u8 *)&bp->bp_vend[4], bp);
 
-			NetSetTimeout(5000, bootp_timeout_handler);
+			net_set_timeout_handler(5000, bootp_timeout_handler);
 			dhcp_send_request_packet(bp);
 #ifdef CONFIG_SYS_BOOTFILE_PREFIX
 		}
@@ -998,7 +999,7 @@ static void dhcp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 		debug("DHCP State: REQUESTING\n");
 
 		if (dhcp_message_type((u8 *)bp->bp_vend) == DHCP_ACK) {
-			if (NetReadLong((ulong *)&bp->bp_vend[0]) ==
+			if (net_read_long((ulong *)&bp->bp_vend[0]) ==
 						htonl(BOOTP_VENDOR_MAGIC))
 				dhcp_process_options((u8 *)&bp->bp_vend[4], bp);
 			/* Store net params from reply */
diff --git a/net/cdp.c b/net/cdp.c
index d8df3ea..f9ccf53 100644
--- a/net/cdp.c
+++ b/net/cdp.c
@@ -224,14 +224,14 @@ static void cdp_timeout_handler(void)
 	cdp_seq++;
 
 	if (cdp_seq < 3) {
-		NetSetTimeout(CDP_TIMEOUT, cdp_timeout_handler);
+		net_set_timeout_handler(CDP_TIMEOUT, cdp_timeout_handler);
 		cdp_send_trigger();
 		return;
 	}
 
 	/* if not OK try again */
 	if (!cdp_ok)
-		NetStartAgain();
+		net_start_again();
 	else
 		net_set_state(NETLOOP_SUCCESS);
 }
@@ -357,7 +357,7 @@ void cdp_start(void)
 	cdp_native_vlan = htons(-1);
 	cdp_appliance_vlan = htons(-1);
 
-	NetSetTimeout(CDP_TIMEOUT, cdp_timeout_handler);
+	net_set_timeout_handler(CDP_TIMEOUT, cdp_timeout_handler);
 
 	cdp_send_trigger();
 }
diff --git a/net/dns.c b/net/dns.c
index cf4ed86..7017bac 100644
--- a/net/dns.c
+++ b/net/dns.c
@@ -197,7 +197,7 @@ void dns_start(void)
 {
 	debug("%s\n", __func__);
 
-	NetSetTimeout(DNS_TIMEOUT, dns_timeout_handler);
+	net_set_timeout_handler(DNS_TIMEOUT, dns_timeout_handler);
 	net_set_udp_handler(dns_handler);
 
 	/* Clear a previous MAC address, the server IP might have changed. */
diff --git a/net/eth.c b/net/eth.c
index 953b6a6..6ea1b13 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -963,7 +963,7 @@ void eth_try_another(int first_restart)
 	eth_current_changed();
 
 	if (first_failed == eth_get_dev())
-		NetRestartWrap = 1;
+		net_restart_wrap = 1;
 }
 
 void eth_set_current(void)
diff --git a/net/link_local.c b/net/link_local.c
index ea5b4f4..27851b6 100644
--- a/net/link_local.c
+++ b/net/link_local.c
@@ -99,7 +99,7 @@ static void configure_wait(void)
 	debug_cond(DEBUG_DEV_PKT, "...wait %d %s nprobes=%u, nclaims=%u\n",
 		   timeout_ms, eth_get_name(), nprobes, nclaims);
 
-	NetSetTimeout(timeout_ms, link_local_timeout);
+	net_set_timeout_handler(timeout_ms, link_local_timeout);
 }
 
 void link_local_start(void)
@@ -182,7 +182,7 @@ static void link_local_timeout(void)
 			conflicts = 0;
 			timeout_ms = -1;
 			/* Never timeout in the monitor state */
-			NetSetTimeout(0, NULL);
+			net_set_timeout_handler(0, NULL);
 
 			/* NOTE: all other exit paths should deconfig ... */
 			net_set_state(NETLOOP_SUCCESS);
diff --git a/net/net.c b/net/net.c
index 8c09529..a365df0 100644
--- a/net/net.c
+++ b/net/net.c
@@ -141,21 +141,21 @@ uchar *net_rx_packet;
 /* Current rx packet length */
 int		net_rx_packet_len;
 /* IP packet ID */
-unsigned	NetIPID;
+static unsigned	net_ip_id;
 /* Ethernet bcast address */
 const u8 net_bcast_ethaddr[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
 const u8 net_null_ethaddr[6];
 #ifdef CONFIG_API
-void		(*push_packet)(void *, int len) = 0;
+void (*push_packet)(void *, int len) = 0;
 #endif
 /* Network loop state */
 enum net_loop_state net_state;
 /* Tried all network devices */
-int		NetRestartWrap;
+int		net_restart_wrap;
 /* Network loop restarted */
-static int	NetRestarted;
+static int	net_restarted;
 /* At least one device configured */
-static int	NetDevExists;
+static int	net_dev_exists;
 
 /* XXX in both little & big endian machines 0xFFFF == ntohs(-1) */
 /* default is without VLAN */
@@ -174,7 +174,7 @@ u32 net_boot_file_expected_size_in_blocks;
 /* NTP server IP address */
 struct in_addr	net_ntp_server;
 /* offset time from UTC */
-int		NetTimeOffset;
+int		net_ntp_time_offset;
 #endif
 
 static uchar net_pkt_buf[(PKTBUFSRX+1) * PKTSIZE_ALIGN + PKTALIGN];
@@ -189,17 +189,17 @@ static rxhand_f *arp_packet_handler;
 static rxhand_icmp_f *packet_icmp_handler;
 #endif
 /* Current timeout handler */
-static thand_f *timeHandler;
+static thand_f *time_handler;
 /* Time base value */
-static ulong	timeStart;
+static ulong	time_start;
 /* Current timeout value */
-static ulong	timeDelta;
+static ulong	time_delta;
 /* THE transmit packet */
 uchar *net_tx_packet;
 
 static int net_check_prereq(enum proto_t protocol);
 
-static int NetTryCount;
+static int net_try_count;
 
 int __maybe_unused net_busy_flag;
 
@@ -250,7 +250,7 @@ void net_auto_load(void)
 	tftp_start(TFTPGET);
 }
 
-static void NetInitLoop(void)
+static void net_init_loop(void)
 {
 	static int env_changed_id;
 	int env_id = get_env_id();
@@ -278,7 +278,7 @@ static void net_clear_handlers(void)
 {
 	net_set_udp_handler(NULL);
 	net_set_arp_handler(NULL);
-	NetSetTimeout(0, NULL);
+	net_set_timeout_handler(0, NULL);
 }
 
 static void net_cleanup_loop(void)
@@ -309,7 +309,7 @@ void net_init(void)
 		first_call = 0;
 	}
 
-	NetInitLoop();
+	net_init_loop();
 }
 
 /**********************************************************************/
@@ -317,14 +317,14 @@ void net_init(void)
  *	Main network processing loop.
  */
 
-int NetLoop(enum proto_t protocol)
+int net_loop(enum proto_t protocol)
 {
 	int ret = -EINVAL;
 
-	NetRestarted = 0;
-	NetDevExists = 0;
-	NetTryCount = 1;
-	debug_cond(DEBUG_INT_STATE, "--- NetLoop Entry\n");
+	net_restarted = 0;
+	net_dev_exists = 0;
+	net_try_count = 1;
+	debug_cond(DEBUG_INT_STATE, "--- net_loop Entry\n");
 
 	bootstage_mark_name(BOOTSTAGE_ID_ETH_START, "eth_start");
 	net_init();
@@ -336,9 +336,9 @@ int NetLoop(enum proto_t protocol)
 			eth_halt();
 			return ret;
 		}
-	} else
+	} else {
 		eth_init_state_only();
-
+	}
 restart:
 #ifdef CONFIG_USB_KEYBOARD
 	net_busy_flag = 0;
@@ -350,8 +350,8 @@ restart:
 	 *	here on, this code is a state machine driven by received
 	 *	packets and timer events.
 	 */
-	debug_cond(DEBUG_INT_STATE, "--- NetLoop Init\n");
-	NetInitLoop();
+	debug_cond(DEBUG_INT_STATE, "--- net_loop Init\n");
+	net_init_loop();
 
 	switch (net_check_prereq(protocol)) {
 	case 1:
@@ -364,7 +364,7 @@ restart:
 		break;
 
 	case 0:
-		NetDevExists = 1;
+		net_dev_exists = 1;
 		net_boot_file_size = 0;
 		switch (protocol) {
 		case TFTPGET:
@@ -415,7 +415,7 @@ restart:
 			cdp_start();
 			break;
 #endif
-#if defined (CONFIG_NETCONSOLE) && !(CONFIG_SPL_BUILD)
+#if defined(CONFIG_NETCONSOLE) && !(CONFIG_SPL_BUILD)
 		case NETCONS:
 			nc_start();
 			break;
@@ -491,7 +491,7 @@ restart:
 			puts("\nAbort\n");
 			/* include a debug print as well incase the debug
 			   messages are directed to stderr */
-			debug_cond(DEBUG_INT_STATE, "--- NetLoop Abort!\n");
+			debug_cond(DEBUG_INT_STATE, "--- net_loop Abort!\n");
 			goto done;
 		}
 
@@ -501,7 +501,8 @@ restart:
 		 *	Check for a timeout, and run the timeout handler
 		 *	if we have one.
 		 */
-		if (timeHandler && ((get_timer(0) - timeStart) > timeDelta)) {
+		if (time_handler &&
+		    ((get_timer(0) - time_start) > time_delta)) {
 			thand_f *x;
 
 #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
@@ -512,26 +513,24 @@ restart:
 			 * Echo the inverted link state to the fault LED.
 			 */
 			if (miiphy_link(eth_get_dev()->name,
-				       CONFIG_SYS_FAULT_MII_ADDR)) {
+					CONFIG_SYS_FAULT_MII_ADDR))
 				status_led_set(STATUS_LED_RED, STATUS_LED_OFF);
-			} else {
+			else
 				status_led_set(STATUS_LED_RED, STATUS_LED_ON);
-			}
 #endif /* CONFIG_SYS_FAULT_ECHO_LINK_DOWN, ... */
 #endif /* CONFIG_MII, ... */
-			debug_cond(DEBUG_INT_STATE, "--- NetLoop timeout\n");
-			x = timeHandler;
-			timeHandler = (thand_f *)0;
+			debug_cond(DEBUG_INT_STATE, "--- net_loop timeout\n");
+			x = time_handler;
+			time_handler = (thand_f *)0;
 			(*x)();
 		}
 
 		if (net_state == NETLOOP_FAIL)
-			ret = NetStartAgain();
+			ret = net_start_again();
 
 		switch (net_state) {
-
 		case NETLOOP_RESTART:
-			NetRestarted = 1;
+			net_restarted = 1;
 			goto restart;
 
 		case NETLOOP_SUCCESS:
@@ -550,14 +549,14 @@ restart:
 			eth_set_last_protocol(protocol);
 
 			ret = net_boot_file_size;
-			debug_cond(DEBUG_INT_STATE, "--- NetLoop Success!\n");
+			debug_cond(DEBUG_INT_STATE, "--- net_loop Success!\n");
 			goto done;
 
 		case NETLOOP_FAIL:
 			net_cleanup_loop();
 			/* Invalidate the last protocol */
 			eth_set_last_protocol(BOOTP);
-			debug_cond(DEBUG_INT_STATE, "--- NetLoop Fail!\n");
+			debug_cond(DEBUG_INT_STATE, "--- net_loop Fail!\n");
 			goto done;
 
 		case NETLOOP_CONTINUE:
@@ -579,13 +578,12 @@ done:
 
 /**********************************************************************/
 
-static void
-startAgainTimeout(void)
+static void start_again_timeout_handler(void)
 {
 	net_set_state(NETLOOP_RESTART);
 }
 
-int NetStartAgain(void)
+int net_start_again(void)
 {
 	char *nretry;
 	int retry_forever = 0;
@@ -607,7 +605,7 @@ int NetStartAgain(void)
 		retry_forever = 0;
 	}
 
-	if ((!retry_forever) && (NetTryCount >= retrycnt)) {
+	if ((!retry_forever) && (net_try_count >= retrycnt)) {
 		eth_halt();
 		net_set_state(NETLOOP_FAIL);
 		/*
@@ -617,17 +615,18 @@ int NetStartAgain(void)
 		return -ETIMEDOUT;
 	}
 
-	NetTryCount++;
+	net_try_count++;
 
 	eth_halt();
 #if !defined(CONFIG_NET_DO_NOT_TRY_ANOTHER)
-	eth_try_another(!NetRestarted);
+	eth_try_another(!net_restarted);
 #endif
 	ret = eth_init();
-	if (NetRestartWrap) {
-		NetRestartWrap = 0;
-		if (NetDevExists) {
-			NetSetTimeout(10000UL, startAgainTimeout);
+	if (net_restart_wrap) {
+		net_restart_wrap = 0;
+		if (net_dev_exists) {
+			net_set_timeout_handler(10000UL,
+						start_again_timeout_handler);
 			net_set_udp_handler(NULL);
 		} else {
 			net_set_state(NETLOOP_FAIL);
@@ -656,7 +655,7 @@ rxhand_f *net_get_udp_handler(void)
 
 void net_set_udp_handler(rxhand_f *f)
 {
-	debug_cond(DEBUG_INT_STATE, "--- NetLoop UDP handler set (%p)\n", f);
+	debug_cond(DEBUG_INT_STATE, "--- net_loop UDP handler set (%p)\n", f);
 	if (f == NULL)
 		udp_packet_handler = dummy_handler;
 	else
@@ -670,7 +669,7 @@ rxhand_f *net_get_arp_handler(void)
 
 void net_set_arp_handler(rxhand_f *f)
 {
-	debug_cond(DEBUG_INT_STATE, "--- NetLoop ARP handler set (%p)\n", f);
+	debug_cond(DEBUG_INT_STATE, "--- net_loop ARP handler set (%p)\n", f);
 	if (f == NULL)
 		arp_packet_handler = dummy_handler;
 	else
@@ -684,19 +683,18 @@ void net_set_icmp_handler(rxhand_icmp_f *f)
 }
 #endif
 
-void
-NetSetTimeout(ulong iv, thand_f *f)
+void net_set_timeout_handler(ulong iv, thand_f *f)
 {
 	if (iv == 0) {
 		debug_cond(DEBUG_INT_STATE,
-			"--- NetLoop timeout handler cancelled\n");
-		timeHandler = (thand_f *)0;
+			   "--- net_loop timeout handler cancelled\n");
+		time_handler = (thand_f *)0;
 	} else {
 		debug_cond(DEBUG_INT_STATE,
-			"--- NetLoop timeout handler set (%p)\n", f);
-		timeHandler = f;
-		timeStart = get_timer(0);
-		timeDelta = iv * CONFIG_SYS_HZ / 1000;
+			   "--- net_loop timeout handler set (%p)\n", f);
+		time_handler = f;
+		time_start = get_timer(0);
+		time_delta = iv * CONFIG_SYS_HZ / 1000;
 	}
 }
 
@@ -707,7 +705,7 @@ int net_send_udp_packet(uchar *ether, struct in_addr dest, int dport, int sport,
 	int eth_hdr_size;
 	int pkt_hdr_size;
 
-	/* make sure the net_tx_packet is initialized (NetInit() was called) */
+	/* make sure the net_tx_packet is initialized (net_init() was called) */
 	assert(net_tx_packet != NULL);
 	if (net_tx_packet == NULL)
 		return -1;
@@ -745,7 +743,7 @@ int net_send_udp_packet(uchar *ether, struct in_addr dest, int dport, int sport,
 		return 1;	/* waiting */
 	} else {
 		debug_cond(DEBUG_DEV_PKT, "sending UDP to %pI4/%pM\n",
-			&dest, ether);
+			   &dest, ether);
 		net_send_packet(net_tx_packet, pkt_hdr_size + payload_len);
 		return 0;	/* transmitted */
 	}
@@ -784,7 +782,7 @@ struct hole {
 	u16 unused;
 };
 
-static struct ip_udp_hdr *__NetDefragment(struct ip_udp_hdr *ip, int *lenp)
+static struct ip_udp_hdr *__net_defragment(struct ip_udp_hdr *ip, int *lenp)
 {
 	static uchar pkt_buff[IP_PKTSIZE] __aligned(PKTALIGN);
 	static u16 first_hole, total_len;
@@ -904,17 +902,19 @@ static struct ip_udp_hdr *__NetDefragment(struct ip_udp_hdr *ip, int *lenp)
 	return localip;
 }
 
-static inline struct ip_udp_hdr *NetDefragment(struct ip_udp_hdr *ip, int *lenp)
+static inline struct ip_udp_hdr *net_defragment(struct ip_udp_hdr *ip,
+	int *lenp)
 {
 	u16 ip_off = ntohs(ip->ip_off);
 	if (!(ip_off & (IP_OFFS | IP_FLAGS_MFRAG)))
 		return ip; /* not a fragment */
-	return __NetDefragment(ip, lenp);
+	return __net_defragment(ip, lenp);
 }
 
 #else /* !CONFIG_IP_DEFRAG */
 
-static inline struct ip_udp_hdr *NetDefragment(struct ip_udp_hdr *ip, int *lenp)
+static inline struct ip_udp_hdr *net_defragment(struct ip_udp_hdr *ip,
+	int *lenp)
 {
 	u16 ip_off = ntohs(ip->ip_off);
 	if (!(ip_off & (IP_OFFS | IP_FLAGS_MFRAG)))
@@ -939,7 +939,7 @@ static void receive_icmp(struct ip_udp_hdr *ip, int len,
 		if (icmph->code != ICMP_REDIR_HOST)
 			return;
 		printf(" ICMP Host Redirect to %pI4 ",
-			&icmph->un.gateway);
+		       &icmph->un.gateway);
 		break;
 	default:
 #if defined(CONFIG_CMD_PING)
@@ -948,8 +948,9 @@ static void receive_icmp(struct ip_udp_hdr *ip, int len,
 #ifdef CONFIG_CMD_TFTPPUT
 		if (packet_icmp_handler)
 			packet_icmp_handler(icmph->type, icmph->code,
-				ntohs(ip->udp_dst), src_ip, ntohs(ip->udp_src),
-				icmph->un.data, ntohs(ip->udp_len));
+					    ntohs(ip->udp_dst), src_ip,
+					    ntohs(ip->udp_src), icmph->un.data,
+					    ntohs(ip->udp_len));
 #endif
 		break;
 	}
@@ -1057,7 +1058,6 @@ void net_process_received_packet(uchar *in_packet, int len)
 	}
 
 	switch (eth_proto) {
-
 	case PROT_ARP:
 		arp_receive(et, ip, len);
 		break;
@@ -1072,7 +1072,7 @@ void net_process_received_packet(uchar *in_packet, int len)
 		/* Before we start poking the header, make sure it is there */
 		if (len < IP_UDP_HDR_SIZE) {
 			debug("len bad %d < %lu\n", len,
-				(ulong)IP_UDP_HDR_SIZE);
+			      (ulong)IP_UDP_HDR_SIZE);
 			return;
 		}
 		/* Check the packet length */
@@ -1082,7 +1082,7 @@ void net_process_received_packet(uchar *in_packet, int len)
 		}
 		len = ntohs(ip->ip_len);
 		debug_cond(DEBUG_NET_PKT, "len=%d, v=%02x\n",
-			len, ip->ip_hl_v & 0xff);
+			   len, ip->ip_hl_v & 0xff);
 
 		/* Can't deal with anything except IPv4 */
 		if ((ip->ip_hl_v & 0xf0) != 0x40)
@@ -1111,7 +1111,7 @@ void net_process_received_packet(uchar *in_packet, int len)
 		 * a fragment, and either the complete packet or NULL if
 		 * it is a fragment (if !CONFIG_IP_DEFRAG, it returns NULL)
 		 */
-		ip = NetDefragment(ip, &len);
+		ip = net_defragment(ip, &len);
 		if (!ip)
 			return;
 		/*
@@ -1143,8 +1143,8 @@ void net_process_received_packet(uchar *in_packet, int len)
 		}
 
 		debug_cond(DEBUG_DEV_PKT,
-			"received UDP (to=%pI4, from=%pI4, len=%d)\n",
-			&dst_ip, &src_ip, len);
+			   "received UDP (to=%pI4, from=%pI4, len=%d)\n",
+			   &dst_ip, &src_ip, len);
 
 #ifdef CONFIG_UDP_CHECKSUM
 		if (ip->udp_xsum != 0) {
@@ -1160,7 +1160,7 @@ void net_process_received_packet(uchar *in_packet, int len)
 			xsum += (ntohl(ip->ip_dst.s_addr) >>  0) & 0x0000ffff;
 
 			sumlen = ntohs(ip->udp_len);
-			sumptr = (ushort *) &(ip->udp_src);
+			sumptr = (ushort *)&(ip->udp_src);
 
 			while (sumlen > 1) {
 				ushort sumdata;
@@ -1172,7 +1172,7 @@ void net_process_received_packet(uchar *in_packet, int len)
 			if (sumlen > 0) {
 				ushort sumdata;
 
-				sumdata = *(unsigned char *) sumptr;
+				sumdata = *(unsigned char *)sumptr;
 				sumdata = (sumdata << 8) & 0xff00;
 				xsum += sumdata;
 			}
@@ -1182,33 +1182,31 @@ void net_process_received_packet(uchar *in_packet, int len)
 			}
 			if ((xsum != 0x00000000) && (xsum != 0x0000ffff)) {
 				printf(" UDP wrong checksum %08lx %08x\n",
-					xsum, ntohs(ip->udp_xsum));
+				       xsum, ntohs(ip->udp_xsum));
 				return;
 			}
 		}
 #endif
 
-
-#if defined (CONFIG_NETCONSOLE) && !(CONFIG_SPL_BUILD)
+#if defined(CONFIG_NETCONSOLE) && !(CONFIG_SPL_BUILD)
 		nc_input_packet((uchar *)ip + IP_UDP_HDR_SIZE,
-					src_ip,
-					ntohs(ip->udp_dst),
-					ntohs(ip->udp_src),
-					ntohs(ip->udp_len) - UDP_HDR_SIZE);
+				src_ip,
+				ntohs(ip->udp_dst),
+				ntohs(ip->udp_src),
+				ntohs(ip->udp_len) - UDP_HDR_SIZE);
 #endif
 		/*
-		 *	IP header OK.  Pass the packet to the current handler.
+		 * IP header OK.  Pass the packet to the current handler.
 		 */
 		(*udp_packet_handler)((uchar *)ip + IP_UDP_HDR_SIZE,
-				ntohs(ip->udp_dst),
-				src_ip,
-				ntohs(ip->udp_src),
-				ntohs(ip->udp_len) - UDP_HDR_SIZE);
+				      ntohs(ip->udp_dst),
+				      src_ip,
+				      ntohs(ip->udp_src),
+				      ntohs(ip->udp_len) - UDP_HDR_SIZE);
 		break;
 	}
 }
 
-
 /**********************************************************************/
 
 static int net_check_prereq(enum proto_t protocol)
@@ -1242,6 +1240,7 @@ static int net_check_prereq(enum proto_t protocol)
 #if defined(CONFIG_CMD_NFS)
 	case NFS:
 #endif
+		/* Fall through */
 	case TFTPGET:
 	case TFTPPUT:
 		if (net_server_ip.s_addr == 0) {
@@ -1281,11 +1280,11 @@ common:
 				break;
 			default:
 				printf("*** ERROR: `eth%daddr' not set\n",
-					num);
+				       num);
 				break;
 			}
 
-			NetStartAgain();
+			net_start_again();
 			return 2;
 		}
 		/* Fall through */
@@ -1368,7 +1367,7 @@ void net_set_ip_header(uchar *pkt, struct in_addr dest, struct in_addr source)
 	ip->ip_hl_v  = 0x45;
 	ip->ip_tos   = 0;
 	ip->ip_len   = htons(IP_HDR_SIZE);
-	ip->ip_id    = htons(NetIPID++);
+	ip->ip_id    = htons(net_ip_id++);
 	ip->ip_off   = htons(IP_FLAGS_DFRAG);	/* Don't fragment */
 	ip->ip_ttl   = 255;
 	ip->ip_sum   = 0;
diff --git a/net/nfs.c b/net/nfs.c
index 4357cc3..78968d8 100644
--- a/net/nfs.c
+++ b/net/nfs.c
@@ -571,11 +571,12 @@ static void nfs_timeout_handler(void)
 {
 	if (++nfs_timeout_count > NFS_RETRY_COUNT) {
 		puts("\nRetry count exceeded; starting again\n");
-		NetStartAgain();
+		net_start_again();
 	} else {
 		puts("T ");
-		NetSetTimeout(nfs_timeout + NFS_TIMEOUT * nfs_timeout_count,
-			      nfs_timeout_handler);
+		net_set_timeout_handler(nfs_timeout +
+					NFS_TIMEOUT * nfs_timeout_count,
+					nfs_timeout_handler);
 		nfs_send();
 	}
 }
@@ -670,7 +671,7 @@ static void nfs_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 
 	case STATE_READ_REQ:
 		rlen = nfs_read_reply(pkt, len);
-		NetSetTimeout(nfs_timeout, nfs_timeout_handler);
+		net_set_timeout_handler(nfs_timeout, nfs_timeout_handler);
 		if (rlen > 0) {
 			nfs_offset += rlen;
 			nfs_send();
@@ -756,7 +757,7 @@ void nfs_start(void)
 	printf("\nLoad address: 0x%lx\n"
 		"Loading: *\b", load_addr);
 
-	NetSetTimeout(nfs_timeout, nfs_timeout_handler);
+	net_set_timeout_handler(nfs_timeout, nfs_timeout_handler);
 	net_set_udp_handler(nfs_handler);
 
 	nfs_timeout_count = 0;
diff --git a/net/ping.c b/net/ping.c
index 87da555..9508cf1 100644
--- a/net/ping.c
+++ b/net/ping.c
@@ -74,7 +74,7 @@ static void ping_timeout_handler(void)
 void ping_start(void)
 {
 	printf("Using %s device\n", eth_get_name());
-	NetSetTimeout(10000UL, ping_timeout_handler);
+	net_set_timeout_handler(10000UL, ping_timeout_handler);
 
 	ping_send();
 }
diff --git a/net/rarp.c b/net/rarp.c
index 204e03c..4ce2f37 100644
--- a/net/rarp.c
+++ b/net/rarp.c
@@ -59,9 +59,9 @@ static void rarp_timeout_handler(void)
 {
 	if (rarp_try >= TIMEOUT_COUNT) {
 		puts("\nRetry count exceeded; starting again\n");
-		NetStartAgain();
+		net_start_again();
 	} else {
-		NetSetTimeout(TIMEOUT, rarp_timeout_handler);
+		net_set_timeout_handler(TIMEOUT, rarp_timeout_handler);
 		rarp_request();
 	}
 }
@@ -95,5 +95,5 @@ void rarp_request(void)
 
 	net_send_packet(net_tx_packet, eth_hdr_size + ARP_HDR_SIZE);
 
-	NetSetTimeout(TIMEOUT, rarp_timeout_handler);
+	net_set_timeout_handler(TIMEOUT, rarp_timeout_handler);
 }
diff --git a/net/sntp.c b/net/sntp.c
index 8073ca6..d3427d8 100644
--- a/net/sntp.c
+++ b/net/sntp.c
@@ -65,7 +65,7 @@ static void sntp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 	 */
 	memcpy(&seconds, &rpktp->transmit_timestamp, sizeof(ulong));
 
-	to_tm(ntohl(seconds) - 2208988800UL + NetTimeOffset, &tm);
+	to_tm(ntohl(seconds) - 2208988800UL + net_ntp_time_offset, &tm);
 #if defined(CONFIG_CMD_DATE)
 	rtc_set(&tm);
 #endif
@@ -80,7 +80,7 @@ void sntp_start(void)
 {
 	debug("%s\n", __func__);
 
-	NetSetTimeout(SNTP_TIMEOUT, sntp_timeout_handler);
+	net_set_timeout_handler(SNTP_TIMEOUT, sntp_timeout_handler);
 	net_set_udp_handler(sntp_handler);
 	memset(net_server_ethaddr, 0, sizeof(net_server_ethaddr));
 
diff --git a/net/tftp.c b/net/tftp.c
index 14acf04..3e99e73 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -275,7 +275,7 @@ static void restart(const char *msg)
 #ifdef CONFIG_MCAST_TFTP
 	mcast_cleanup();
 #endif
-	NetStartAgain();
+	net_start_again();
 }
 
 /*
@@ -589,7 +589,7 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 				printf("First block is not block 1 (%ld)\n",
 				       tftp_cur_block);
 				puts("Starting again\n\n");
-				NetStartAgain();
+				net_start_again();
 				break;
 			}
 		}
@@ -601,7 +601,7 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 
 		tftp_prev_block = tftp_cur_block;
 		timeout_count_max = TIMEOUT_COUNT;
-		NetSetTimeout(timeout_ms, tftp_timeout_handler);
+		net_set_timeout_handler(timeout_ms, tftp_timeout_handler);
 
 		store_block(tftp_cur_block - 1, pkt + 2, len);
 
@@ -628,7 +628,7 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 					/* try to double it and retry */
 					tftp_mcast_bitmap_size <<= 1;
 					mcast_cleanup();
-					NetStartAgain();
+					net_start_again();
 					return;
 				}
 				tftp_prev_block = tftp_cur_block;
@@ -672,7 +672,7 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 #ifdef CONFIG_MCAST_TFTP
 			mcast_cleanup();
 #endif
-			NetStartAgain();
+			net_start_again();
 			break;
 		}
 		break;
@@ -686,7 +686,7 @@ static void tftp_timeout_handler(void)
 		restart("Retry count exceeded");
 	} else {
 		puts("T ");
-		NetSetTimeout(timeout_ms, tftp_timeout_handler);
+		net_set_timeout_handler(timeout_ms, tftp_timeout_handler);
 		if (tftp_state != STATE_RECV_WRQ)
 			tftp_send();
 	}
@@ -794,7 +794,7 @@ void tftp_start(enum proto_t protocol)
 	time_start = get_timer(0);
 	timeout_count_max = tftp_timeout_count_max;
 
-	NetSetTimeout(timeout_ms, tftp_timeout_handler);
+	net_set_timeout_handler(timeout_ms, tftp_timeout_handler);
 	net_set_udp_handler(tftp_handler);
 #ifdef CONFIG_CMD_TFTPPUT
 	net_set_icmp_handler(icmp_handler);
@@ -843,7 +843,7 @@ void tftp_start_server(void)
 	timeout_count_max = TIMEOUT_COUNT;
 	timeout_count = 0;
 	timeout_ms = TIMEOUT;
-	NetSetTimeout(timeout_ms, tftp_timeout_handler);
+	net_set_timeout_handler(timeout_ms, tftp_timeout_handler);
 
 	/* Revert tftp_block_size to dflt */
 	tftp_block_size = TFTP_BLOCK_SIZE;
@@ -951,7 +951,7 @@ static void parse_multicast_oack(char *pkt, int len)
 			printf("Fail to set mcast, revert to TFTP\n");
 			tftp_mcast_disabled = 1;
 			mcast_cleanup();
-			NetStartAgain();
+			net_start_again();
 		}
 	}
 	tftp_mcast_master_client = simple_strtoul((char *)mc, NULL, 10);
diff --git a/test/dm/eth.c b/test/dm/eth.c
index 22fd26e..4891f3a 100644
--- a/test/dm/eth.c
+++ b/test/dm/eth.c
@@ -23,15 +23,15 @@ static int dm_test_eth(struct dm_test_state *dms)
 	net_ping_ip = string_to_ip("1.1.2.2");
 
 	setenv("ethact", "eth at 10002000");
-	ut_assertok(NetLoop(PING));
+	ut_assertok(net_loop(PING));
 	ut_asserteq_str("eth at 10002000", getenv("ethact"));
 
 	setenv("ethact", "eth at 10003000");
-	ut_assertok(NetLoop(PING));
+	ut_assertok(net_loop(PING));
 	ut_asserteq_str("eth at 10003000", getenv("ethact"));
 
 	setenv("ethact", "eth at 10004000");
-	ut_assertok(NetLoop(PING));
+	ut_assertok(net_loop(PING));
 	ut_asserteq_str("eth at 10004000", getenv("ethact"));
 
 	return 0;
@@ -42,20 +42,20 @@ static int dm_test_eth_alias(struct dm_test_state *dms)
 {
 	net_ping_ip = string_to_ip("1.1.2.2");
 	setenv("ethact", "eth0");
-	ut_assertok(NetLoop(PING));
+	ut_assertok(net_loop(PING));
 	ut_asserteq_str("eth at 10002000", getenv("ethact"));
 
 	setenv("ethact", "eth1");
-	ut_assertok(NetLoop(PING));
+	ut_assertok(net_loop(PING));
 	ut_asserteq_str("eth at 10004000", getenv("ethact"));
 
 	/* Expected to fail since eth2 is not defined in the device tree */
 	setenv("ethact", "eth2");
-	ut_assertok(NetLoop(PING));
+	ut_assertok(net_loop(PING));
 	ut_asserteq_str("eth at 10002000", getenv("ethact"));
 
 	setenv("ethact", "eth5");
-	ut_assertok(NetLoop(PING));
+	ut_assertok(net_loop(PING));
 	ut_asserteq_str("eth at 10003000", getenv("ethact"));
 
 	return 0;
@@ -69,13 +69,13 @@ static int dm_test_eth_prime(struct dm_test_state *dms)
 	/* Expected to be "eth at 10003000" because of ethprime variable */
 	setenv("ethact", NULL);
 	setenv("ethprime", "eth5");
-	ut_assertok(NetLoop(PING));
+	ut_assertok(net_loop(PING));
 	ut_asserteq_str("eth at 10003000", getenv("ethact"));
 
 	/* Expected to be "eth at 10002000" because it is first */
 	setenv("ethact", NULL);
 	setenv("ethprime", NULL);
-	ut_assertok(NetLoop(PING));
+	ut_assertok(net_loop(PING));
 	ut_asserteq_str("eth at 10002000", getenv("ethact"));
 
 	return 0;
@@ -93,13 +93,13 @@ static int dm_test_eth_rotate(struct dm_test_state *dms)
 
 	/* Make sure that the default is to rotate to the next interface */
 	setenv("ethact", "eth at 10004000");
-	ut_assertok(NetLoop(PING));
+	ut_assertok(net_loop(PING));
 	ut_asserteq_str("eth at 10002000", getenv("ethact"));
 
 	/* If ethrotate is no, then we should fail on a bad MAC */
 	setenv("ethact", "eth at 10004000");
 	setenv("ethrotate", "no");
-	ut_asserteq(-EINVAL, NetLoop(PING));
+	ut_asserteq(-EINVAL, net_loop(PING));
 	ut_asserteq_str("eth at 10004000", getenv("ethact"));
 
 	/* Restore the env */
@@ -113,7 +113,7 @@ static int dm_test_eth_rotate(struct dm_test_state *dms)
 
 	/* Make sure we can skip invalid devices */
 	setenv("ethact", "eth at 10004000");
-	ut_assertok(NetLoop(PING));
+	ut_assertok(net_loop(PING));
 	ut_asserteq_str("eth at 10004000", getenv("ethact"));
 
 	/* Restore the env */
@@ -135,7 +135,7 @@ static int dm_test_net_retry(struct dm_test_state *dms)
 	sandbox_eth_disable_response(1, true);
 	setenv("ethact", "eth at 10004000");
 	setenv("netretry", "yes");
-	ut_assertok(NetLoop(PING));
+	ut_assertok(net_loop(PING));
 	ut_asserteq_str("eth at 10002000", getenv("ethact"));
 
 	/*
@@ -144,7 +144,7 @@ static int dm_test_net_retry(struct dm_test_state *dms)
 	 */
 	setenv("ethact", "eth at 10004000");
 	setenv("netretry", "no");
-	ut_asserteq(-ETIMEDOUT, NetLoop(PING));
+	ut_asserteq(-ETIMEDOUT, net_loop(PING));
 	ut_asserteq_str("eth@10004000", getenv("ethact"));
 
 	/* Restore the env */
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 22/25] net: Fix incorrect DHCP/BOOTP packets on 64-bit systems
  2015-04-08  6:41 ` [U-Boot] [PATCH v2 0/25] " Joe Hershberger
                     ` (20 preceding siblings ...)
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 21/25] net: cosmetic: Fix checkpatch.pl failures in net.c Joe Hershberger
@ 2015-04-08  6:41   ` Joe Hershberger
  2015-04-08 12:47     ` Simon Glass
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 23/25] net: Convert protocol structures to use explicit sizes Joe Hershberger
                     ` (3 subsequent siblings)
  25 siblings, 1 reply; 103+ messages in thread
From: Joe Hershberger @ 2015-04-08  6:41 UTC (permalink / raw)
  To: u-boot

From: Sergey Temerkhanov <s.temerkhanov@gmail.com>

This commit fixes incorrect DHCP/BOOTP packet layout caused by
'ulong' type size difference on 64 and 32-bit architectures.
It also renames NetReadLong()/NetCopyLong() to
net_read_u32/net_copy_u32() accordingly.


Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com>
Signed-off-by: Sergey Temerkhanov <s.temerkhanov@gmail.com>
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

Changes in v2: None

 include/net.h | 10 +++++-----
 net/bootp.c   | 33 ++++++++++++++++-----------------
 net/bootp.h   |  4 ++--
 3 files changed, 23 insertions(+), 24 deletions(-)

diff --git a/include/net.h b/include/net.h
index e9131f7..def1fd9 100644
--- a/include/net.h
+++ b/include/net.h
@@ -410,7 +410,7 @@ struct icmp_hdr {
 			ushort	id;
 			ushort	sequence;
 		} echo;
-		ulong	gateway;
+		u32	gateway;
 		struct {
 			ushort	unused;
 			ushort	mtu;
@@ -678,9 +678,9 @@ static inline struct in_addr net_read_ip(void *from)
 }
 
 /* return ulong *in network byteorder* */
-static inline ulong net_read_long(ulong *from)
+static inline u32 net_read_u32(u32 *from)
 {
-	ulong l;
+	u32 l;
 
 	memcpy((void *)&l, (void *)from, sizeof(l));
 	return l;
@@ -699,9 +699,9 @@ static inline void net_copy_ip(void *to, void *from)
 }
 
 /* copy ulong */
-static inline void net_copy_long(ulong *to, ulong *from)
+static inline void net_copy_u32(u32 *to, u32 *from)
 {
-	memcpy((void *)to, (void *)from, sizeof(ulong));
+	memcpy((void *)to, (void *)from, sizeof(u32));
 }
 
 /**
diff --git a/net/bootp.c b/net/bootp.c
index 500850c..43466af 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -51,7 +51,7 @@
 #define CONFIG_BOOTP_ID_CACHE_SIZE 4
 #endif
 
-ulong		bootp_ids[CONFIG_BOOTP_ID_CACHE_SIZE];
+u32		bootp_ids[CONFIG_BOOTP_ID_CACHE_SIZE];
 unsigned int	bootp_num_ids;
 int		bootp_try;
 ulong		bootp_start;
@@ -62,7 +62,7 @@ char net_root_path[64] = {0,}; /* Our bootpath */
 
 #if defined(CONFIG_CMD_DHCP)
 static dhcp_state_t dhcp_state = INIT;
-static unsigned long dhcp_leasetime;
+static u32 dhcp_leasetime;
 static struct in_addr dhcp_server_ip;
 static void dhcp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 			unsigned src, unsigned len);
@@ -128,7 +128,7 @@ static int check_packet(uchar *pkt, unsigned dest, unsigned src, unsigned len)
 		retval = -4;
 	else if (bp->bp_hlen != HWL_ETHER)
 		retval = -5;
-	else if (!bootp_match_id(net_read_long((ulong *)&bp->bp_id)))
+	else if (!bootp_match_id(net_read_u32(&bp->bp_id)))
 		retval = -6;
 
 	debug("Filtering pkt = %d\n", retval);
@@ -356,8 +356,7 @@ static void bootp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 	store_net_params(bp);		/* Store net parameters from reply */
 
 	/* Retrieve extended information (we must parse the vendor area) */
-	if (net_read_long((ulong *)&bp->bp_vend[0]) ==
-	    htonl(BOOTP_VENDOR_MAGIC))
+	if (net_read_u32((u32 *)&bp->bp_vend[0]) == htonl(BOOTP_VENDOR_MAGIC))
 		bootp_process_vendor((uchar *)&bp->bp_vend[4], len);
 
 	net_set_timeout_handler(0, (thand_f *)0);
@@ -666,7 +665,7 @@ void bootp_request(void)
 #ifdef CONFIG_BOOTP_RANDOM_DELAY
 	ulong rand_ms;
 #endif
-	ulong bootp_id;
+	u32 bootp_id;
 	struct in_addr zero_ip;
 	struct in_addr bcast_ip;
 
@@ -734,14 +733,14 @@ void bootp_request(void)
 	 *	Bootp ID is the lower 4 bytes of our ethernet address
 	 *	plus the current time in ms.
 	 */
-	bootp_id = ((ulong)net_ethaddr[2] << 24)
-		| ((ulong)net_ethaddr[3] << 16)
-		| ((ulong)net_ethaddr[4] << 8)
-		| (ulong)net_ethaddr[5];
+	bootp_id = ((u32)net_ethaddr[2] << 24)
+		| ((u32)net_ethaddr[3] << 16)
+		| ((u32)net_ethaddr[4] << 8)
+		| (u32)net_ethaddr[5];
 	bootp_id += get_timer(0);
 	bootp_id = htonl(bootp_id);
 	bootp_add_id(bootp_id);
-	net_copy_long(&bp->bp_id, &bootp_id);
+	net_copy_u32(&bp->bp_id, &bootp_id);
 
 	/*
 	 * Calculate proper packet lengths taking into account the
@@ -780,7 +779,7 @@ static void dhcp_process_options(uchar *popt, struct bootp_hdr *bp)
 #if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_TIMEOFFSET)
 		case 2:		/* Time offset	*/
 			to_ptr = &net_ntp_time_offset;
-			net_copy_long((ulong *)to_ptr, (ulong *)(popt + 2));
+			net_copy_u32((u32 *)to_ptr, (u32 *)(popt + 2));
 			net_ntp_time_offset = ntohl(net_ntp_time_offset);
 			break;
 #endif
@@ -816,7 +815,7 @@ static void dhcp_process_options(uchar *popt, struct bootp_hdr *bp)
 			break;
 #endif
 		case 51:
-			net_copy_long(&dhcp_leasetime, (ulong *)(popt + 2));
+			net_copy_u32(&dhcp_leasetime, (u32 *)(popt + 2));
 			break;
 		case 53:	/* Ignore Message Type Option */
 			break;
@@ -870,7 +869,7 @@ static void dhcp_process_options(uchar *popt, struct bootp_hdr *bp)
 
 static int dhcp_message_type(unsigned char *popt)
 {
-	if (net_read_long((ulong *)popt) != htonl(BOOTP_VENDOR_MAGIC))
+	if (net_read_u32((u32 *)popt) != htonl(BOOTP_VENDOR_MAGIC))
 		return -1;
 
 	popt += 4;
@@ -924,7 +923,7 @@ static void dhcp_send_request_packet(struct bootp_hdr *bp_offer)
 	 * ID is the id of the OFFER packet
 	 */
 
-	net_copy_long(&bp->bp_id, &bp_offer->bp_id);
+	net_copy_u32(&bp->bp_id, &bp_offer->bp_id);
 
 	/*
 	 * Copy options from OFFER packet if present
@@ -983,7 +982,7 @@ static void dhcp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 			debug("TRANSITIONING TO REQUESTING STATE\n");
 			dhcp_state = REQUESTING;
 
-			if (net_read_long((ulong *)&bp->bp_vend[0]) ==
+			if (net_read_u32((u32 *)&bp->bp_vend[0]) ==
 						htonl(BOOTP_VENDOR_MAGIC))
 				dhcp_process_options((u8 *)&bp->bp_vend[4], bp);
 
@@ -999,7 +998,7 @@ static void dhcp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 		debug("DHCP State: REQUESTING\n");
 
 		if (dhcp_message_type((u8 *)bp->bp_vend) == DHCP_ACK) {
-			if (net_read_long((ulong *)&bp->bp_vend[0]) ==
+			if (net_read_u32((u32 *)&bp->bp_vend[0]) ==
 						htonl(BOOTP_VENDOR_MAGIC))
 				dhcp_process_options((u8 *)&bp->bp_vend[4], bp);
 			/* Store net params from reply */
diff --git a/net/bootp.h b/net/bootp.h
index efc2100..1a59286 100644
--- a/net/bootp.h
+++ b/net/bootp.h
@@ -38,7 +38,7 @@ struct bootp_hdr {
 	uchar		bp_hlen;	/* Hardware address length	*/
 # define HWL_ETHER	6
 	uchar		bp_hops;	/* Hop count (gateway thing)	*/
-	ulong		bp_id;		/* Transaction ID		*/
+	u32		bp_id;		/* Transaction ID		*/
 	ushort		bp_secs;	/* Seconds since boot		*/
 	ushort		bp_spare1;	/* Alignment			*/
 	struct in_addr	bp_ciaddr;	/* Client IP address		*/
@@ -59,7 +59,7 @@ struct bootp_hdr {
  */
 
 /* bootp.c */
-extern ulong	bootp_id;		/* ID of cur BOOTP request	*/
+extern u32	bootp_id;		/* ID of cur BOOTP request	*/
 extern int	bootp_try;
 
 
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 23/25] net: Convert protocol structures to use explicit sizes
  2015-04-08  6:41 ` [U-Boot] [PATCH v2 0/25] " Joe Hershberger
                     ` (21 preceding siblings ...)
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 22/25] net: Fix incorrect DHCP/BOOTP packets on 64-bit systems Joe Hershberger
@ 2015-04-08  6:41   ` Joe Hershberger
  2015-04-08 12:47     ` Simon Glass
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 24/25] net: Fix compile errors when SNTP enabled and not DATE Joe Hershberger
                     ` (2 subsequent siblings)
  25 siblings, 1 reply; 103+ messages in thread
From: Joe Hershberger @ 2015-04-08  6:41 UTC (permalink / raw)
  To: u-boot

From: Sergey Temerkhanov <s.temerkhanov@gmail.com>

Convert uchar/ushort to u8/u16 respectively.


Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com>
Signed-off-by: Sergey Temerkhanov <s.temerkhanov@gmail.com>
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

Changes in v2: None

 include/net.h | 112 +++++++++++++++++++++++++++++-----------------------------
 net/bootp.h   |  14 ++++----
 2 files changed, 63 insertions(+), 63 deletions(-)

diff --git a/include/net.h b/include/net.h
index def1fd9..62e213d 100644
--- a/include/net.h
+++ b/include/net.h
@@ -253,9 +253,9 @@ u32 ether_crc(size_t len, unsigned char const *p);
  */
 
 struct ethernet_hdr {
-	uchar		et_dest[6];	/* Destination node		*/
-	uchar		et_src[6];	/* Source node			*/
-	ushort		et_protlen;	/* Protocol or length		*/
+	u8		et_dest[6];	/* Destination node		*/
+	u8		et_src[6];	/* Source node			*/
+	u16		et_protlen;	/* Protocol or length		*/
 };
 
 /* Ethernet header size */
@@ -264,16 +264,16 @@ struct ethernet_hdr {
 #define ETH_FCS_LEN	4		/* Octets in the FCS		*/
 
 struct e802_hdr {
-	uchar		et_dest[6];	/* Destination node		*/
-	uchar		et_src[6];	/* Source node			*/
-	ushort		et_protlen;	/* Protocol or length		*/
-	uchar		et_dsap;	/* 802 DSAP			*/
-	uchar		et_ssap;	/* 802 SSAP			*/
-	uchar		et_ctl;		/* 802 control			*/
-	uchar		et_snap1;	/* SNAP				*/
-	uchar		et_snap2;
-	uchar		et_snap3;
-	ushort		et_prot;	/* 802 protocol			*/
+	u8		et_dest[6];	/* Destination node		*/
+	u8		et_src[6];	/* Source node			*/
+	u16		et_protlen;	/* Protocol or length		*/
+	u8		et_dsap;	/* 802 DSAP			*/
+	u8		et_ssap;	/* 802 SSAP			*/
+	u8		et_ctl;		/* 802 control			*/
+	u8		et_snap1;	/* SNAP				*/
+	u8		et_snap2;
+	u8		et_snap3;
+	u16		et_prot;	/* 802 protocol			*/
 };
 
 /* 802 + SNAP + ethernet header size */
@@ -283,11 +283,11 @@ struct e802_hdr {
  *	Virtual LAN Ethernet header
  */
 struct vlan_ethernet_hdr {
-	uchar		vet_dest[6];	/* Destination node		*/
-	uchar		vet_src[6];	/* Source node			*/
-	ushort		vet_vlan_type;	/* PROT_VLAN			*/
-	ushort		vet_tag;	/* TAG of VLAN			*/
-	ushort		vet_type;	/* protocol type		*/
+	u8		vet_dest[6];	/* Destination node		*/
+	u8		vet_src[6];	/* Source node			*/
+	u16		vet_vlan_type;	/* PROT_VLAN			*/
+	u16		vet_tag;	/* TAG of VLAN			*/
+	u16		vet_type;	/* protocol type		*/
 };
 
 /* VLAN Ethernet header size */
@@ -305,14 +305,14 @@ struct vlan_ethernet_hdr {
  *	Internet Protocol (IP) header.
  */
 struct ip_hdr {
-	uchar		ip_hl_v;	/* header length and version	*/
-	uchar		ip_tos;		/* type of service		*/
-	ushort		ip_len;		/* total length			*/
-	ushort		ip_id;		/* identification		*/
-	ushort		ip_off;		/* fragment offset field	*/
-	uchar		ip_ttl;		/* time to live			*/
-	uchar		ip_p;		/* protocol			*/
-	ushort		ip_sum;		/* checksum			*/
+	u8		ip_hl_v;	/* header length and version	*/
+	u8		ip_tos;		/* type of service		*/
+	u16		ip_len;		/* total length			*/
+	u16		ip_id;		/* identification		*/
+	u16		ip_off;		/* fragment offset field	*/
+	u8		ip_ttl;		/* time to live			*/
+	u8		ip_p;		/* protocol			*/
+	u16		ip_sum;		/* checksum			*/
 	struct in_addr	ip_src;		/* Source IP address		*/
 	struct in_addr	ip_dst;		/* Destination IP address	*/
 };
@@ -329,20 +329,20 @@ struct ip_hdr {
  *	Internet Protocol (IP) + UDP header.
  */
 struct ip_udp_hdr {
-	uchar		ip_hl_v;	/* header length and version	*/
-	uchar		ip_tos;		/* type of service		*/
-	ushort		ip_len;		/* total length			*/
-	ushort		ip_id;		/* identification		*/
-	ushort		ip_off;		/* fragment offset field	*/
-	uchar		ip_ttl;		/* time to live			*/
-	uchar		ip_p;		/* protocol			*/
-	ushort		ip_sum;		/* checksum			*/
+	u8		ip_hl_v;	/* header length and version	*/
+	u8		ip_tos;		/* type of service		*/
+	u16		ip_len;		/* total length			*/
+	u16		ip_id;		/* identification		*/
+	u16		ip_off;		/* fragment offset field	*/
+	u8		ip_ttl;		/* time to live			*/
+	u8		ip_p;		/* protocol			*/
+	u16		ip_sum;		/* checksum			*/
 	struct in_addr	ip_src;		/* Source IP address		*/
 	struct in_addr	ip_dst;		/* Destination IP address	*/
-	ushort		udp_src;	/* UDP source port		*/
-	ushort		udp_dst;	/* UDP destination port		*/
-	ushort		udp_len;	/* Length of UDP packet		*/
-	ushort		udp_xsum;	/* Checksum			*/
+	u16		udp_src;	/* UDP source port		*/
+	u16		udp_dst;	/* UDP destination port		*/
+	u16		udp_len;	/* Length of UDP packet		*/
+	u16		udp_xsum;	/* Checksum			*/
 };
 
 #define IP_UDP_HDR_SIZE		(sizeof(struct ip_udp_hdr))
@@ -352,14 +352,14 @@ struct ip_udp_hdr {
  *	Address Resolution Protocol (ARP) header.
  */
 struct arp_hdr {
-	ushort		ar_hrd;		/* Format of hardware address	*/
+	u16		ar_hrd;		/* Format of hardware address	*/
 #   define ARP_ETHER	    1		/* Ethernet  hardware address	*/
-	ushort		ar_pro;		/* Format of protocol address	*/
-	uchar		ar_hln;		/* Length of hardware address	*/
+	u16		ar_pro;		/* Format of protocol address	*/
+	u8		ar_hln;		/* Length of hardware address	*/
 #   define ARP_HLEN	6
-	uchar		ar_pln;		/* Length of protocol address	*/
+	u8		ar_pln;		/* Length of protocol address	*/
 #   define ARP_PLEN	4
-	ushort		ar_op;		/* Operation			*/
+	u16		ar_op;		/* Operation			*/
 #   define ARPOP_REQUEST    1		/* Request  to resolve  address	*/
 #   define ARPOP_REPLY	    2		/* Response to previous request	*/
 
@@ -371,16 +371,16 @@ struct arp_hdr {
 	 * the sizes above, and are defined as appropriate for
 	 * specific hardware/protocol combinations.
 	 */
-	uchar		ar_data[0];
+	u8		ar_data[0];
 #define ar_sha		ar_data[0]
 #define ar_spa		ar_data[ARP_HLEN]
 #define ar_tha		ar_data[ARP_HLEN + ARP_PLEN]
 #define ar_tpa		ar_data[ARP_HLEN + ARP_PLEN + ARP_HLEN]
 #if 0
-	uchar		ar_sha[];	/* Sender hardware address	*/
-	uchar		ar_spa[];	/* Sender protocol address	*/
-	uchar		ar_tha[];	/* Target hardware address	*/
-	uchar		ar_tpa[];	/* Target protocol address	*/
+	u8		ar_sha[];	/* Sender hardware address	*/
+	u8		ar_spa[];	/* Sender protocol address	*/
+	u8		ar_tha[];	/* Target hardware address	*/
+	u8		ar_tpa[];	/* Target protocol address	*/
 #endif /* 0 */
 };
 
@@ -402,20 +402,20 @@ struct arp_hdr {
 #define ICMP_NOT_REACH_PORT	3	/* Port unreachable		*/
 
 struct icmp_hdr {
-	uchar		type;
-	uchar		code;
-	ushort		checksum;
+	u8		type;
+	u8		code;
+	u16		checksum;
 	union {
 		struct {
-			ushort	id;
-			ushort	sequence;
+			u16	id;
+			u16	sequence;
 		} echo;
 		u32	gateway;
 		struct {
-			ushort	unused;
-			ushort	mtu;
+			u16	unused;
+			u16	mtu;
 		} frag;
-		uchar data[0];
+		u8 data[0];
 	} un;
 };
 
diff --git a/net/bootp.h b/net/bootp.h
index 1a59286..fcb0a64 100644
--- a/net/bootp.h
+++ b/net/bootp.h
@@ -30,22 +30,22 @@ extern u8 *dhcp_vendorex_proc(u8 *e); /*rtn next e if mine,else NULL  */
 #endif
 
 struct bootp_hdr {
-	uchar		bp_op;		/* Operation			*/
+	u8		bp_op;		/* Operation			*/
 # define OP_BOOTREQUEST	1
 # define OP_BOOTREPLY	2
-	uchar		bp_htype;	/* Hardware type		*/
+	u8		bp_htype;	/* Hardware type		*/
 # define HWT_ETHER	1
-	uchar		bp_hlen;	/* Hardware address length	*/
+	u8		bp_hlen;	/* Hardware address length	*/
 # define HWL_ETHER	6
-	uchar		bp_hops;	/* Hop count (gateway thing)	*/
+	u8		bp_hops;	/* Hop count (gateway thing)	*/
 	u32		bp_id;		/* Transaction ID		*/
-	ushort		bp_secs;	/* Seconds since boot		*/
-	ushort		bp_spare1;	/* Alignment			*/
+	u16		bp_secs;	/* Seconds since boot		*/
+	u16		bp_spare1;	/* Alignment			*/
 	struct in_addr	bp_ciaddr;	/* Client IP address		*/
 	struct in_addr	bp_yiaddr;	/* Your (client) IP address	*/
 	struct in_addr	bp_siaddr;	/* Server IP address		*/
 	struct in_addr	bp_giaddr;	/* Gateway IP address		*/
-	uchar		bp_chaddr[16];	/* Client hardware address	*/
+	u8		bp_chaddr[16];	/* Client hardware address	*/
 	char		bp_sname[64];	/* Server host name		*/
 	char		bp_file[128];	/* Boot file name		*/
 	char		bp_vend[OPT_FIELD_SIZE]; /* Vendor information	*/
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 24/25] net: Fix compile errors when SNTP enabled and not DATE
  2015-04-08  6:41 ` [U-Boot] [PATCH v2 0/25] " Joe Hershberger
                     ` (22 preceding siblings ...)
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 23/25] net: Convert protocol structures to use explicit sizes Joe Hershberger
@ 2015-04-08  6:41   ` Joe Hershberger
  2015-04-08 12:47     ` Simon Glass
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 25/25] sandbox: Enable more network features for sandbox Joe Hershberger
  2015-04-08 12:46   ` [U-Boot] [PATCH v2 0/25] net: cosmetic: Fix naming and other checkpatch.pl issues in net/ Simon Glass
  25 siblings, 1 reply; 103+ messages in thread
From: Joe Hershberger @ 2015-04-08  6:41 UTC (permalink / raw)
  To: u-boot

When SNTP is enabled and DATE is not, to_tm() is not built in. It could
be defined when TIMESTAMP is defined, so check for that.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

Changes in v2:
-New to series

 net/sntp.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/net/sntp.c b/net/sntp.c
index d3427d8..6422eef 100644
--- a/net/sntp.c
+++ b/net/sntp.c
@@ -50,17 +50,20 @@ static void sntp_timeout_handler(void)
 static void sntp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 			 unsigned src, unsigned len)
 {
+#ifdef CONFIG_TIMESTAMP
 	struct sntp_pkt_t *rpktp = (struct sntp_pkt_t *)pkt;
 	struct rtc_time tm;
 	ulong seconds;
+#endif
 
 	debug("%s\n", __func__);
 
 	if (dest != sntp_our_port)
 		return;
 
+#ifdef CONFIG_TIMESTAMP
 	/*
-	 * As the RTC's used in U-Boot sepport second resolution only
+	 * As the RTC's used in U-Boot support second resolution only
 	 * we simply ignore the sub-second field.
 	 */
 	memcpy(&seconds, &rpktp->transmit_timestamp, sizeof(ulong));
@@ -72,6 +75,7 @@ static void sntp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 	printf("Date: %4d-%02d-%02d Time: %2d:%02d:%02d\n",
 	       tm.tm_year, tm.tm_mon, tm.tm_mday,
 	       tm.tm_hour, tm.tm_min, tm.tm_sec);
+#endif
 
 	net_set_state(NETLOOP_SUCCESS);
 }
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 25/25] sandbox: Enable more network features for sandbox
  2015-04-08  6:41 ` [U-Boot] [PATCH v2 0/25] " Joe Hershberger
                     ` (23 preceding siblings ...)
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 24/25] net: Fix compile errors when SNTP enabled and not DATE Joe Hershberger
@ 2015-04-08  6:41   ` Joe Hershberger
  2015-04-08 12:47     ` Simon Glass
  2015-04-08 12:46   ` [U-Boot] [PATCH v2 0/25] net: cosmetic: Fix naming and other checkpatch.pl issues in net/ Simon Glass
  25 siblings, 1 reply; 103+ messages in thread
From: Joe Hershberger @ 2015-04-08  6:41 UTC (permalink / raw)
  To: u-boot

More net features enabled and supported on sandbox to allow more testing

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---

Changes in v2:
-New to series

 include/configs/sandbox.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h
index c49a847..a9ac106 100644
--- a/include/configs/sandbox.h
+++ b/include/configs/sandbox.h
@@ -130,6 +130,15 @@
 /* include default commands */
 #include <config_cmd_default.h>
 
+#define CONFIG_KEEP_SERVERADDR
+#define CONFIG_UDP_CHECKSUM
+#define CONFIG_CMD_LINK_LOCAL
+#define CONFIG_CMD_CDP
+#define CONFIG_CMD_DNS
+#define CONFIG_CMD_NFS
+#define CONFIG_CMD_SNTP
+#define CONFIG_TIMESTAMP
+#define CONFIG_CMD_RARP
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_DHCP
 #define CONFIG_BOOTP_DNS
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH 01/23] net: cosmetic: Change IPaddr_t to struct in_addr
  2015-04-08  1:26   ` Simon Glass
@ 2015-04-08  6:57     ` Joe Hershberger
  0 siblings, 0 replies; 103+ messages in thread
From: Joe Hershberger @ 2015-04-08  6:57 UTC (permalink / raw)
  To: u-boot

Hi Simon,

On Tue, Apr 7, 2015 at 8:26 PM, Simon Glass <sjg@chromium.org> wrote:
>
> Hi Joe,
>
> On 3 April 2015 at 15:14, Joe Hershberger <joe.hershberger@ni.com> wrote:
> > This patch is simply clean-up to make the IPv4 type that is used match
> > what Linux uses. It also attempts to move all variables that are IP
> > addresses use good naming instead of CamelCase. No functional change.
> >
> > Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> > ---
>
> I see the following breakage on this patch (my build is incomplete,
> but it looks like it is just one problem in cmd_net.c).

Oops... looks like a few errors as a result of the not having some of the
net features enabled on any of the boards I built.

I added most net features to sandbox to prevent such misses in the future.

Thanks,
-Joe

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 01/25] net: cosmetic: Change IPaddr_t to struct in_addr
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 01/25] net: cosmetic: Change IPaddr_t to struct in_addr Joe Hershberger
@ 2015-04-08 12:45     ` Simon Glass
  2015-04-08 14:37       ` Simon Glass
  0 siblings, 1 reply; 103+ messages in thread
From: Simon Glass @ 2015-04-08 12:45 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
> This patch is simply clean-up to make the IPv4 type that is used match
> what Linux uses. It also attempts to move all variables that are IP
> addresses use good naming instead of CamelCase. No functional change.
>
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> ---
>
> Changes in v2:
> -Fixed build failures in ip conversion patch

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 02/25] net: cosmetic: Fixup var names related to boot file
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 02/25] net: cosmetic: Fixup var names related to boot file Joe Hershberger
@ 2015-04-08 12:45     ` Simon Glass
  2015-04-08 14:37       ` Simon Glass
  0 siblings, 1 reply; 103+ messages in thread
From: Simon Glass @ 2015-04-08 12:45 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
> The variables around the bootfile were inconsistent and used CamelCase.
> Update them to make the code more readable.
>
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> ---
>
> Changes in v2: None
>
>  common/cmd_net.c |  9 ++++++---
>  common/cmd_pxe.c |  2 +-
>  common/update.c  |  7 ++++---
>  include/net.h    |  9 +++++----
>  net/bootp.c      | 27 ++++++++++++++-------------
>  net/bootp.h      |  1 -
>  net/eth.c        |  3 ++-
>  net/net.c        | 26 +++++++++++++-------------
>  net/nfs.c        | 19 ++++++++++---------
>  net/tftp.c       | 29 +++++++++++++++--------------
>  10 files changed, 70 insertions(+), 62 deletions(-)

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 03/25] net: cosmetic: Fixup var names for DHCP strings
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 03/25] net: cosmetic: Fixup var names for DHCP strings Joe Hershberger
@ 2015-04-08 12:45     ` Simon Glass
  2015-04-08 14:37       ` Simon Glass
  0 siblings, 1 reply; 103+ messages in thread
From: Simon Glass @ 2015-04-08 12:45 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
> Remove CamelCase variable naming.
> Move the definition to the same compilation unit as the primary use.
>
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> ---
>
> Changes in v2: None
>
>  common/cmd_net.c | 12 ++++++------
>  include/net.h    |  6 +++---
>  net/bootp.c      | 51 +++++++++++++++++++++++++++------------------------
>  net/net.c        |  6 ------
>  4 files changed, 36 insertions(+), 39 deletions(-)

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 04/25] net: cosmetic: Name ethaddr variables consistently
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 04/25] net: cosmetic: Name ethaddr variables consistently Joe Hershberger
@ 2015-04-08 12:46     ` Simon Glass
  2015-04-08 14:37       ` Simon Glass
  0 siblings, 1 reply; 103+ messages in thread
From: Simon Glass @ 2015-04-08 12:46 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
> Use "_ethaddr" at the end of variables and drop CamelCase.
> Make constant values actually 'const'.
>
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> ---
>
> Changes in v2: None

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 0/25] net: cosmetic: Fix naming and other checkpatch.pl issues in net/
  2015-04-08  6:41 ` [U-Boot] [PATCH v2 0/25] " Joe Hershberger
                     ` (24 preceding siblings ...)
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 25/25] sandbox: Enable more network features for sandbox Joe Hershberger
@ 2015-04-08 12:46   ` Simon Glass
  25 siblings, 0 replies; 103+ messages in thread
From: Simon Glass @ 2015-04-08 12:46 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
> This series is fairly disruptive in naming, so hopefully there aren't
> many network stack changes in flight that will conflict with this. This
> is based on top of dm/next for now so that the dm/eth series is assumed.
> This will be rebased when that is, but will likely not have issues.
>
> Like ripping off a bandage, do it quick and all at once.
>
> Changes in v2:
> -Fixed build failures in ip conversion patch
> -New to series
>
> Joe Hershberger (23):
>   net: cosmetic: Change IPaddr_t to struct in_addr
>   net: cosmetic: Fixup var names related to boot file
>   net: cosmetic: Fixup var names for DHCP strings
>   net: cosmetic: Name ethaddr variables consistently
>   net: cosmetic: Cleanup internal packet buffer names
>   net: cosmetic: Fix var naming net <-> eth drivers
>   net: cosmetic: Clean up TFTP variables and functions
>   net: cosmetic: Clean up ARP variables and functions
>   net: cosmetic: Clean up DHCP variables and functions
>   net: cosmetic: Clean up NFS variables and functions
>   net: cosmetic: Clean up RARP variables and functions
>   net: cosmetic: Clean up SNTP variables and functions
>   net: cosmetic: Clean up ping variables and functions
>   net: cosmetic: Clean up CDP variables and functions
>   net: cosmetic: Clean up DNS variables and functions
>   net: cosmetic: Clean up netconsole variables and functions
>   net: cosmetic: Clean up cmd_net variables and functions
>   net: cosmetic: Fix checkpatch.pl failures in linklocal
>   net: cosmetic: Fix checkpatch.pl failures in eth.c
>   net: cosmetic: Fix checkpatch.pl failures in net.h
>   net: cosmetic: Fix checkpatch.pl failures in net.c
>   net: Fix compile errors when SNTP enabled and not DATE
>   sandbox: Enable more network features for sandbox
>
> Sergey Temerkhanov (2):
>   net: Fix incorrect DHCP/BOOTP packets on 64-bit systems
>   net: Convert protocol structures to use explicit sizes
>
>  README                                     |   6 +-
>  arch/arm/mach-davinci/misc.c               |   2 +-
>  arch/mips/mach-au1x00/au1x00_eth.c         |  12 +-
>  arch/powerpc/cpu/mpc8260/ether_fcc.c       |  20 +-
>  arch/powerpc/cpu/mpc8260/ether_scc.c       |   4 +-
>  arch/powerpc/cpu/mpc85xx/ether_fcc.c       |   4 +-
>  arch/powerpc/cpu/mpc8xx/fec.c              |  12 +-
>  arch/powerpc/cpu/mpc8xx/scc.c              |   5 +-
>  board/BuR/common/common.c                  |   4 +-
>  board/ait/cam_enc_4xx/cam_enc_4xx.c        |   2 +-
>  board/alphaproject/ap_sh4a_4a/ap_sh4a_4a.c |   2 +-
>  board/bct-brettl2/bct-brettl2.c            |   2 +-
>  board/bf518f-ezbrd/bf518f-ezbrd.c          |   4 +-
>  board/bf526-ezbrd/bf526-ezbrd.c            |   4 +-
>  board/bf527-ezkit/bf527-ezkit.c            |   4 +-
>  board/bf537-minotaur/bf537-minotaur.c      |   2 +-
>  board/bf537-pnav/bf537-pnav.c              |   2 +-
>  board/bf537-srv1/bf537-srv1.c              |   2 +-
>  board/bf537-stamp/bf537-stamp.c            |   4 +-
>  board/birdland/bav335x/board.c             |   4 +-
>  board/buffalo/lsxl/lsxl.c                  |   2 +-
>  board/cm-bf527/cm-bf527.c                  |   4 +-
>  board/cm-bf537e/cm-bf537e.c                |   2 +-
>  board/cm-bf537u/cm-bf537u.c                |   2 +-
>  board/compulab/cm_fx6/cm_fx6.c             |   2 +-
>  board/compulab/cm_t335/cm_t335.c           |   2 +-
>  board/compulab/cm_t35/cm_t35.c             |   2 +-
>  board/compulab/cm_t3517/cm_t3517.c         |   4 +-
>  board/compulab/cm_t54/cm_t54.c             |   4 +-
>  board/davinci/da8xxevm/da850evm.c          |   6 +-
>  board/dnp5370/dnp5370.c                    |   4 +-
>  board/gumstix/pepper/board.c               |   2 +-
>  board/ifm/ac14xx/ac14xx.c                  |   2 +-
>  board/ip04/ip04.c                          |   2 +-
>  board/isee/igep0033/board.c                |   2 +-
>  board/phytec/pcm051/board.c                |   2 +-
>  board/renesas/r0p7734/r0p7734.c            |   2 +-
>  board/siemens/common/factoryset.c          |   4 +-
>  board/siemens/pxm2/board.c                 |   2 +-
>  board/silica/pengwyn/board.c               |   2 +-
>  board/tcm-bf518/tcm-bf518.c                |   4 +-
>  board/tcm-bf537/tcm-bf537.c                |   2 +-
>  board/ti/am335x/board.c                    |   6 +-
>  board/ti/am43xx/board.c                    |   4 +-
>  board/ti/beagle_x15/board.c                |   4 +-
>  board/ti/dra7xx/evm.c                      |   4 +-
>  board/ti/ti814x/evm.c                      |   2 +-
>  common/cmd_elf.c                           |   2 +-
>  common/cmd_net.c                           | 133 +++----
>  common/cmd_pxe.c                           |   4 +-
>  common/spl/spl_net.c                       |   2 +-
>  common/update.c                            |  25 +-
>  doc/README.drivers.eth                     |  12 +-
>  doc/README.enetaddr                        |   2 +-
>  doc/README.link-local                      |   4 +-
>  drivers/net/4xx_enet.c                     |  14 +-
>  drivers/net/altera_tse.c                   |  15 +-
>  drivers/net/armada100_fec.c                |   7 +-
>  drivers/net/at91_emac.c                    |   4 +-
>  drivers/net/ax88180.c                      |   6 +-
>  drivers/net/bcm-sf2-eth.c                  |   6 +-
>  drivers/net/bfin_mac.c                     |   4 +-
>  drivers/net/calxedaxgmac.c                 |   2 +-
>  drivers/net/cpsw.c                         |  17 +-
>  drivers/net/cs8900.c                       |   5 +-
>  drivers/net/davinci_emac.c                 |   5 +-
>  drivers/net/dc2114x.c                      |   9 +-
>  drivers/net/designware.c                   |   2 +-
>  drivers/net/dm9000x.c                      |   9 +-
>  drivers/net/dnet.c                         |   5 +-
>  drivers/net/e1000.c                        |   4 +-
>  drivers/net/eepro100.c                     |   3 +-
>  drivers/net/enc28j60.c                     |  13 +-
>  drivers/net/ep93xx_eth.c                   |  11 +-
>  drivers/net/ethoc.c                        |   4 +-
>  drivers/net/fec_mxc.c                      |   4 +-
>  drivers/net/fm/eth.c                       |   2 +-
>  drivers/net/fsl_mcdmafec.c                 |  23 +-
>  drivers/net/ftgmac100.c                    |   4 +-
>  drivers/net/ftmac100.c                     |   4 +-
>  drivers/net/ftmac110.c                     |   4 +-
>  drivers/net/greth.c                        |   2 +-
>  drivers/net/keystone_net.c                 |   2 +-
>  drivers/net/ks8851_mll.c                   |   6 +-
>  drivers/net/lan91c96.c                     |  19 +-
>  drivers/net/macb.c                         |  10 +-
>  drivers/net/mcffec.c                       |   5 +-
>  drivers/net/mpc512x_fec.c                  |   3 +-
>  drivers/net/mpc5xxx_fec.c                  |   2 +-
>  drivers/net/mvgbe.c                        |  41 +-
>  drivers/net/mvneta.c                       |   2 +-
>  drivers/net/natsemi.c                      |   3 +-
>  drivers/net/ne2000_base.c                  |   2 +-
>  drivers/net/netconsole.c                   |  94 ++---
>  drivers/net/ns8382x.c                      |   6 +-
>  drivers/net/pch_gbe.c                      |   2 +-
>  drivers/net/pcnet.c                        |   2 +-
>  drivers/net/rtl8139.c                      |   4 +-
>  drivers/net/rtl8169.c                      |   2 +-
>  drivers/net/sandbox-raw.c                  |   8 +-
>  drivers/net/sandbox.c                      |  14 +-
>  drivers/net/sh_eth.c                       |   2 +-
>  drivers/net/smc91111.c                     |  18 +-
>  drivers/net/smc911x.c                      |   4 +-
>  drivers/net/sunxi_emac.c                   |   4 +-
>  drivers/net/tsec.c                         |   7 +-
>  drivers/net/tsi108_eth.c                   |   8 +-
>  drivers/net/uli526x.c                      |   5 +-
>  drivers/net/xilinx_axi_emac.c              |   2 +-
>  drivers/net/xilinx_emaclite.c              |   2 +-
>  drivers/net/xilinx_ll_temac_fifo.c         |   4 +-
>  drivers/net/xilinx_ll_temac_sdma.c         |   4 +-
>  drivers/net/zynq_gem.c                     |   2 +-
>  drivers/qe/uec.c                           |   2 +-
>  drivers/usb/eth/asix.c                     |   3 +-
>  drivers/usb/eth/asix88179.c                |   2 +-
>  drivers/usb/eth/mcs7830.c                  |   2 +-
>  drivers/usb/eth/smsc95xx.c                 |   5 +-
>  drivers/usb/gadget/ether.c                 |  13 +-
>  include/common.h                           |   2 +-
>  include/configs/sandbox.h                  |   9 +
>  include/net.h                              | 303 ++++++++-------
>  lib/net_utils.c                            |  16 +-
>  net/arp.c                                  | 137 ++++---
>  net/arp.h                                  |  22 +-
>  net/bootp.c                                | 373 +++++++++---------
>  net/bootp.h                                |  39 +-
>  net/cdp.c                                  |  88 ++---
>  net/cdp.h                                  |   2 +-
>  net/dns.c                                  |  72 ++--
>  net/dns.h                                  |   2 +-
>  net/eth.c                                  |  61 +--
>  net/link_local.c                           |  83 ++--
>  net/net.c                                  | 450 +++++++++++-----------
>  net/nfs.c                                  | 235 ++++++------
>  net/nfs.h                                  |   2 +-
>  net/ping.c                                 |  49 +--
>  net/rarp.c                                 |  45 ++-
>  net/rarp.h                                 |   6 +-
>  net/sntp.c                                 |  48 +--
>  net/sntp.h                                 |   2 +-
>  net/tftp.c                                 | 589 +++++++++++++++--------------
>  net/tftp.h                                 |   8 +-
>  post/cpu/mpc8xx/ether.c                    |   6 +-
>  test/dm/eth.c                              |  38 +-
>  145 files changed, 1793 insertions(+), 1763 deletions(-)

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 06/25] net: cosmetic: Fix var naming net <-> eth drivers
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 06/25] net: cosmetic: Fix var naming net <-> eth drivers Joe Hershberger
@ 2015-04-08 12:46     ` Simon Glass
  2015-04-08 14:37       ` Simon Glass
  0 siblings, 1 reply; 103+ messages in thread
From: Simon Glass @ 2015-04-08 12:46 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
> Update the naming convention used in the network stack functions and
> variables that Ethernet drivers use to interact with it.
>
> This cleans up the temporary hacks that were added to this interface
> along with the DM support.
>
> This patch has a few remaining checkpatch.pl failures that would be out
> of the scope of this patch to fix (drivers that are in gross violation
> of checkpatch.pl).
>
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> ---
>
> Changes in v2: None

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 07/25] net: cosmetic: Clean up TFTP variables and functions
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 07/25] net: cosmetic: Clean up TFTP variables and functions Joe Hershberger
@ 2015-04-08 12:46     ` Simon Glass
  2015-04-08 14:37       ` Simon Glass
  0 siblings, 1 reply; 103+ messages in thread
From: Simon Glass @ 2015-04-08 12:46 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
> Make a thorough pass through all variables and function names contained
> within tftp and remove CamelCase and improve naming.
>
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> ---
>
> Changes in v2: None

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 08/25] net: cosmetic: Clean up ARP variables and functions
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 08/25] net: cosmetic: Clean up ARP " Joe Hershberger
@ 2015-04-08 12:46     ` Simon Glass
  2015-04-08 14:37       ` Simon Glass
  0 siblings, 1 reply; 103+ messages in thread
From: Simon Glass @ 2015-04-08 12:46 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
> Make a thorough pass through all variables and function names contained
> within arp and remove CamelCase and improve naming.
>
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> ---
>
> Changes in v2: None
>
>  net/arp.c  | 69 +++++++++++++++++++++++++++++++-------------------------------
>  net/arp.h  | 16 +++++++--------
>  net/net.c  | 16 +++++++--------
>  net/ping.c |  8 ++++----
>  4 files changed, 54 insertions(+), 55 deletions(-)

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 09/25] net: cosmetic: Clean up DHCP variables and functions
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 09/25] net: cosmetic: Clean up DHCP " Joe Hershberger
@ 2015-04-08 12:46     ` Simon Glass
  2015-04-08 14:37       ` Simon Glass
  0 siblings, 1 reply; 103+ messages in thread
From: Simon Glass @ 2015-04-08 12:46 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
> Make a thorough pass through all variables and function names contained
> within bootp.c and remove CamelCase and improve naming.
>
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> ---
>
> Changes in v2: None

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 10/25] net: cosmetic: Clean up NFS variables and functions
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 10/25] net: cosmetic: Clean up NFS " Joe Hershberger
@ 2015-04-08 12:46     ` Simon Glass
  2015-04-08 14:37       ` Simon Glass
  0 siblings, 1 reply; 103+ messages in thread
From: Simon Glass @ 2015-04-08 12:46 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
> Make a thorough pass through all variables and function names contained
> within nfs.c and remove CamelCase and improve naming.
>
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> ---
>
> Changes in v2: None
>
>  net/net.c |   4 +-
>  net/nfs.c | 173 +++++++++++++++++++++++++++-----------------------------------
>  net/nfs.h |   2 +-
>  3 files changed, 79 insertions(+), 100 deletions(-)

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 11/25] net: cosmetic: Clean up RARP variables and functions
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 11/25] net: cosmetic: Clean up RARP " Joe Hershberger
@ 2015-04-08 12:46     ` Simon Glass
  2015-04-08 14:37       ` Simon Glass
  0 siblings, 1 reply; 103+ messages in thread
From: Simon Glass @ 2015-04-08 12:46 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
> Make a thorough pass through all variables and function names contained
> within rarp.c and remove CamelCase and improve naming.
>
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> ---
>
> Changes in v2: None
>
>  net/net.c  |  4 ++--
>  net/rarp.c | 23 +++++++++++------------
>  net/rarp.h |  6 +++---
>  3 files changed, 16 insertions(+), 17 deletions(-)

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 12/25] net: cosmetic: Clean up SNTP variables and functions
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 12/25] net: cosmetic: Clean up SNTP " Joe Hershberger
@ 2015-04-08 12:46     ` Simon Glass
  2015-04-08 14:37       ` Simon Glass
  0 siblings, 1 reply; 103+ messages in thread
From: Simon Glass @ 2015-04-08 12:46 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
> Make a thorough pass through all variables and function names contained
> within sntp.c and remove CamelCase and improve naming.
>
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> ---
>
> Changes in v2: None
>
>  net/net.c  |  2 +-
>  net/sntp.c | 25 +++++++++++--------------
>  net/sntp.h |  2 +-
>  3 files changed, 13 insertions(+), 16 deletions(-)

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 13/25] net: cosmetic: Clean up ping variables and functions
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 13/25] net: cosmetic: Clean up ping " Joe Hershberger
@ 2015-04-08 12:46     ` Simon Glass
  2015-04-08 14:37       ` Simon Glass
  0 siblings, 1 reply; 103+ messages in thread
From: Simon Glass @ 2015-04-08 12:46 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
> Make a thorough pass through all variables and function names contained
> within ping.c and remove CamelCase and improve naming.
>
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> ---
>
> Changes in v2: None
>
>  net/ping.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 14/25] net: cosmetic: Clean up CDP variables and functions
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 14/25] net: cosmetic: Clean up CDP " Joe Hershberger
@ 2015-04-08 12:46     ` Simon Glass
  2015-04-08 14:37       ` Simon Glass
  0 siblings, 1 reply; 103+ messages in thread
From: Simon Glass @ 2015-04-08 12:46 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
> Make a thorough pass through all variables and function names contained
> within cdp.c and remove CamelCase and improve naming.
>
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> ---
>
> Changes in v2: None
>
>  common/cmd_net.c | 17 +++++++-------
>  include/net.h    |  4 ++--
>  net/cdp.c        | 70 ++++++++++++++++++++++++++------------------------------
>  net/cdp.h        |  2 +-
>  net/net.c        |  2 +-
>  5 files changed, 46 insertions(+), 49 deletions(-)

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 15/25] net: cosmetic: Clean up DNS variables and functions
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 15/25] net: cosmetic: Clean up DNS " Joe Hershberger
@ 2015-04-08 12:46     ` Simon Glass
  2015-04-08 14:37       ` Simon Glass
  0 siblings, 1 reply; 103+ messages in thread
From: Simon Glass @ 2015-04-08 12:46 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
> Make a thorough pass through all variables and function names contained
> within dns.c and remove CamelCase and improve naming.
>
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> ---
>
> Changes in v2: None
>
>  common/cmd_net.c |  6 +++---
>  include/net.h    |  4 ++--
>  net/dns.c        | 53 +++++++++++++++++++++++++----------------------------
>  net/dns.h        |  2 +-
>  net/net.c        |  2 +-
>  5 files changed, 32 insertions(+), 35 deletions(-)

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 16/25] net: cosmetic: Clean up netconsole variables and functions
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 16/25] net: cosmetic: Clean up netconsole " Joe Hershberger
@ 2015-04-08 12:46     ` Simon Glass
  2015-04-08 14:37       ` Simon Glass
  0 siblings, 1 reply; 103+ messages in thread
From: Simon Glass @ 2015-04-08 12:46 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
> Make a thorough pass through all variables and function names contained
> within netconsole.c and remove CamelCase and improve naming.
>
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> ---
>
> Changes in v2: None
>
>  drivers/net/netconsole.c | 32 +++++++++++++++++---------------
>  include/net.h            |  2 +-
>  net/net.c                |  2 +-
>  3 files changed, 19 insertions(+), 17 deletions(-)

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 17/25] net: cosmetic: Clean up cmd_net variables and functions
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 17/25] net: cosmetic: Clean up cmd_net " Joe Hershberger
@ 2015-04-08 12:46     ` Simon Glass
  2015-04-08 14:37       ` Simon Glass
  0 siblings, 1 reply; 103+ messages in thread
From: Simon Glass @ 2015-04-08 12:46 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
> Make a thorough pass through all variables and function names contained
> within common/cmd_net.c and remove CamelCase and improve naming.
>
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> ---
>
> Changes in v2: None
>
>  common/cmd_net.c | 29 ++++++++++++++---------------
>  include/net.h    | 10 +++++-----
>  net/net.c        | 26 +++++++++++++-------------
>  3 files changed, 32 insertions(+), 33 deletions(-)

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 18/25] net: cosmetic: Fix checkpatch.pl failures in linklocal
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 18/25] net: cosmetic: Fix checkpatch.pl failures in linklocal Joe Hershberger
@ 2015-04-08 12:46     ` Simon Glass
  2015-04-08 14:37       ` Simon Glass
  0 siblings, 1 reply; 103+ messages in thread
From: Simon Glass @ 2015-04-08 12:46 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
> A few new rules in checkpatch.pl since linklocal.c was added.
>
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> ---
>
> Changes in v2: None
>
>  net/link_local.c | 36 +++++++++++++++++-------------------
>  1 file changed, 17 insertions(+), 19 deletions(-)

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 19/25] net: cosmetic: Fix checkpatch.pl failures in eth.c
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 19/25] net: cosmetic: Fix checkpatch.pl failures in eth.c Joe Hershberger
@ 2015-04-08 12:46     ` Simon Glass
  2015-04-08 14:37       ` Simon Glass
  0 siblings, 1 reply; 103+ messages in thread
From: Simon Glass @ 2015-04-08 12:46 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
> There were still a few failures in net/eth.c, especially in the legacy
> part of the code.
>
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> ---
>
> Changes in v2: None
>
>  net/eth.c | 26 ++++++++++++++++----------
>  1 file changed, 16 insertions(+), 10 deletions(-)

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 20/25] net: cosmetic: Fix checkpatch.pl failures in net.h
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 20/25] net: cosmetic: Fix checkpatch.pl failures in net.h Joe Hershberger
@ 2015-04-08 12:47     ` Simon Glass
  2015-04-08 14:37       ` Simon Glass
  0 siblings, 1 reply; 103+ messages in thread
From: Simon Glass @ 2015-04-08 12:47 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
> There were still a few remaining complains in the legacy eth_device
> definition that hadn't been addressed.
>
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> ---
>
> Changes in v2: None
>
>  include/net.h | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 21/25] net: cosmetic: Fix checkpatch.pl failures in net.c
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 21/25] net: cosmetic: Fix checkpatch.pl failures in net.c Joe Hershberger
@ 2015-04-08 12:47     ` Simon Glass
  2015-04-08 14:37       ` Simon Glass
  0 siblings, 1 reply; 103+ messages in thread
From: Simon Glass @ 2015-04-08 12:47 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
> Finish eliminating CamelCase from net.c and other failures
>
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> ---
>
> Changes in v2: None
>
>  README                   |   6 +-
>  common/cmd_elf.c         |   2 +-
>  common/cmd_net.c         |  22 +++---
>  common/spl/spl_net.c     |   2 +-
>  common/update.c          |   2 +-
>  doc/README.link-local    |   4 +-
>  drivers/net/netconsole.c |  12 ++--
>  include/net.h            |  18 ++---
>  net/arp.c                |   2 +-
>  net/bootp.c              |  33 ++++-----
>  net/cdp.c                |   6 +-
>  net/dns.c                |   2 +-
>  net/eth.c                |   2 +-
>  net/link_local.c         |   4 +-
>  net/net.c                | 179 +++++++++++++++++++++++------------------------
>  net/nfs.c                |  11 +--
>  net/ping.c               |   2 +-
>  net/rarp.c               |   6 +-
>  net/sntp.c               |   4 +-
>  net/tftp.c               |  18 ++---
>  test/dm/eth.c            |  28 ++++----
>  21 files changed, 181 insertions(+), 184 deletions(-)

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 22/25] net: Fix incorrect DHCP/BOOTP packets on 64-bit systems
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 22/25] net: Fix incorrect DHCP/BOOTP packets on 64-bit systems Joe Hershberger
@ 2015-04-08 12:47     ` Simon Glass
  2015-04-08 14:37       ` Simon Glass
  0 siblings, 1 reply; 103+ messages in thread
From: Simon Glass @ 2015-04-08 12:47 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
> From: Sergey Temerkhanov <s.temerkhanov@gmail.com>
>
> This commit fixes incorrect DHCP/BOOTP packet layout caused by
> 'ulong' type size difference on 64 and 32-bit architectures.
> It also renames NetReadLong()/NetCopyLong() to
> net_read_u32/net_copy_u32() accordingly.
>
>
> Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com>
> Signed-off-by: Sergey Temerkhanov <s.temerkhanov@gmail.com>
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> ---
>
> Changes in v2: None
>
>  include/net.h | 10 +++++-----
>  net/bootp.c   | 33 ++++++++++++++++-----------------
>  net/bootp.h   |  4 ++--
>  3 files changed, 23 insertions(+), 24 deletions(-)

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 23/25] net: Convert protocol structures to use explicit sizes
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 23/25] net: Convert protocol structures to use explicit sizes Joe Hershberger
@ 2015-04-08 12:47     ` Simon Glass
  2015-04-08 14:38       ` Simon Glass
  0 siblings, 1 reply; 103+ messages in thread
From: Simon Glass @ 2015-04-08 12:47 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
> From: Sergey Temerkhanov <s.temerkhanov@gmail.com>
>
> Convert uchar/ushort to u8/u16 respectively.
>
>
> Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com>
> Signed-off-by: Sergey Temerkhanov <s.temerkhanov@gmail.com>
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> ---
>
> Changes in v2: None
>
>  include/net.h | 112 +++++++++++++++++++++++++++++-----------------------------
>  net/bootp.h   |  14 ++++----
>  2 files changed, 63 insertions(+), 63 deletions(-)

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 24/25] net: Fix compile errors when SNTP enabled and not DATE
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 24/25] net: Fix compile errors when SNTP enabled and not DATE Joe Hershberger
@ 2015-04-08 12:47     ` Simon Glass
  2015-04-08 14:38       ` Simon Glass
  0 siblings, 1 reply; 103+ messages in thread
From: Simon Glass @ 2015-04-08 12:47 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
> When SNTP is enabled and DATE is not, to_tm() is not built in. It could
> be defined when TIMESTAMP is defined, so check for that.
>
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> ---
>
> Changes in v2:
> -New to series
>
>  net/sntp.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 25/25] sandbox: Enable more network features for sandbox
  2015-04-08  6:41   ` [U-Boot] [PATCH v2 25/25] sandbox: Enable more network features for sandbox Joe Hershberger
@ 2015-04-08 12:47     ` Simon Glass
  2015-04-08 14:38       ` Simon Glass
  0 siblings, 1 reply; 103+ messages in thread
From: Simon Glass @ 2015-04-08 12:47 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
> More net features enabled and supported on sandbox to allow more testing
>
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> ---
>
> Changes in v2:
> -New to series
>
>  include/configs/sandbox.h | 9 +++++++++
>  1 file changed, 9 insertions(+)

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 01/25] net: cosmetic: Change IPaddr_t to struct in_addr
  2015-04-08 12:45     ` Simon Glass
@ 2015-04-08 14:37       ` Simon Glass
  0 siblings, 0 replies; 103+ messages in thread
From: Simon Glass @ 2015-04-08 14:37 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 06:45, Simon Glass <sjg@chromium.org> wrote:
> On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
>> This patch is simply clean-up to make the IPv4 type that is used match
>> what Linux uses. It also attempts to move all variables that are IP
>> addresses use good naming instead of CamelCase. No functional change.
>>
>> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
>> ---
>>
>> Changes in v2:
>> -Fixed build failures in ip conversion patch
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm/next, thanks!

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 02/25] net: cosmetic: Fixup var names related to boot file
  2015-04-08 12:45     ` Simon Glass
@ 2015-04-08 14:37       ` Simon Glass
  0 siblings, 0 replies; 103+ messages in thread
From: Simon Glass @ 2015-04-08 14:37 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 06:45, Simon Glass <sjg@chromium.org> wrote:
> On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
>> The variables around the bootfile were inconsistent and used CamelCase.
>> Update them to make the code more readable.
>>
>> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
>> ---
>>
>> Changes in v2: None
>>
>>  common/cmd_net.c |  9 ++++++---
>>  common/cmd_pxe.c |  2 +-
>>  common/update.c  |  7 ++++---
>>  include/net.h    |  9 +++++----
>>  net/bootp.c      | 27 ++++++++++++++-------------
>>  net/bootp.h      |  1 -
>>  net/eth.c        |  3 ++-
>>  net/net.c        | 26 +++++++++++++-------------
>>  net/nfs.c        | 19 ++++++++++---------
>>  net/tftp.c       | 29 +++++++++++++++--------------
>>  10 files changed, 70 insertions(+), 62 deletions(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm/next, thanks!

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 03/25] net: cosmetic: Fixup var names for DHCP strings
  2015-04-08 12:45     ` Simon Glass
@ 2015-04-08 14:37       ` Simon Glass
  0 siblings, 0 replies; 103+ messages in thread
From: Simon Glass @ 2015-04-08 14:37 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 06:45, Simon Glass <sjg@chromium.org> wrote:
> On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
>> Remove CamelCase variable naming.
>> Move the definition to the same compilation unit as the primary use.
>>
>> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
>> ---
>>
>> Changes in v2: None
>>
>>  common/cmd_net.c | 12 ++++++------
>>  include/net.h    |  6 +++---
>>  net/bootp.c      | 51 +++++++++++++++++++++++++++------------------------
>>  net/net.c        |  6 ------
>>  4 files changed, 36 insertions(+), 39 deletions(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm/next, thanks!

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 04/25] net: cosmetic: Name ethaddr variables consistently
  2015-04-08 12:46     ` Simon Glass
@ 2015-04-08 14:37       ` Simon Glass
  0 siblings, 0 replies; 103+ messages in thread
From: Simon Glass @ 2015-04-08 14:37 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 06:46, Simon Glass <sjg@chromium.org> wrote:
> On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
>> Use "_ethaddr" at the end of variables and drop CamelCase.
>> Make constant values actually 'const'.
>>
>> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
>> ---
>>
>> Changes in v2: None
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm/next, thanks!

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 06/25] net: cosmetic: Fix var naming net <-> eth drivers
  2015-04-08 12:46     ` Simon Glass
@ 2015-04-08 14:37       ` Simon Glass
  0 siblings, 0 replies; 103+ messages in thread
From: Simon Glass @ 2015-04-08 14:37 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 06:46, Simon Glass <sjg@chromium.org> wrote:
> On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
>> Update the naming convention used in the network stack functions and
>> variables that Ethernet drivers use to interact with it.
>>
>> This cleans up the temporary hacks that were added to this interface
>> along with the DM support.
>>
>> This patch has a few remaining checkpatch.pl failures that would be out
>> of the scope of this patch to fix (drivers that are in gross violation
>> of checkpatch.pl).
>>
>> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
>> ---
>>
>> Changes in v2: None
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm/next, thanks!

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 07/25] net: cosmetic: Clean up TFTP variables and functions
  2015-04-08 12:46     ` Simon Glass
@ 2015-04-08 14:37       ` Simon Glass
  0 siblings, 0 replies; 103+ messages in thread
From: Simon Glass @ 2015-04-08 14:37 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 06:46, Simon Glass <sjg@chromium.org> wrote:
> On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
>> Make a thorough pass through all variables and function names contained
>> within tftp and remove CamelCase and improve naming.
>>
>> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
>> ---
>>
>> Changes in v2: None
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm/next, thanks!

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 08/25] net: cosmetic: Clean up ARP variables and functions
  2015-04-08 12:46     ` Simon Glass
@ 2015-04-08 14:37       ` Simon Glass
  0 siblings, 0 replies; 103+ messages in thread
From: Simon Glass @ 2015-04-08 14:37 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 06:46, Simon Glass <sjg@chromium.org> wrote:
> On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
>> Make a thorough pass through all variables and function names contained
>> within arp and remove CamelCase and improve naming.
>>
>> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
>> ---
>>
>> Changes in v2: None
>>
>>  net/arp.c  | 69 +++++++++++++++++++++++++++++++-------------------------------
>>  net/arp.h  | 16 +++++++--------
>>  net/net.c  | 16 +++++++--------
>>  net/ping.c |  8 ++++----
>>  4 files changed, 54 insertions(+), 55 deletions(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm/next, thanks!

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 09/25] net: cosmetic: Clean up DHCP variables and functions
  2015-04-08 12:46     ` Simon Glass
@ 2015-04-08 14:37       ` Simon Glass
  0 siblings, 0 replies; 103+ messages in thread
From: Simon Glass @ 2015-04-08 14:37 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 06:46, Simon Glass <sjg@chromium.org> wrote:
> On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
>> Make a thorough pass through all variables and function names contained
>> within bootp.c and remove CamelCase and improve naming.
>>
>> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
>> ---
>>
>> Changes in v2: None
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm/next, thanks!

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 10/25] net: cosmetic: Clean up NFS variables and functions
  2015-04-08 12:46     ` Simon Glass
@ 2015-04-08 14:37       ` Simon Glass
  0 siblings, 0 replies; 103+ messages in thread
From: Simon Glass @ 2015-04-08 14:37 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 06:46, Simon Glass <sjg@chromium.org> wrote:
> On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
>> Make a thorough pass through all variables and function names contained
>> within nfs.c and remove CamelCase and improve naming.
>>
>> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
>> ---
>>
>> Changes in v2: None
>>
>>  net/net.c |   4 +-
>>  net/nfs.c | 173 +++++++++++++++++++++++++++-----------------------------------
>>  net/nfs.h |   2 +-
>>  3 files changed, 79 insertions(+), 100 deletions(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm/next, thanks!

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 11/25] net: cosmetic: Clean up RARP variables and functions
  2015-04-08 12:46     ` Simon Glass
@ 2015-04-08 14:37       ` Simon Glass
  0 siblings, 0 replies; 103+ messages in thread
From: Simon Glass @ 2015-04-08 14:37 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 06:46, Simon Glass <sjg@chromium.org> wrote:
> On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
>> Make a thorough pass through all variables and function names contained
>> within rarp.c and remove CamelCase and improve naming.
>>
>> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
>> ---
>>
>> Changes in v2: None
>>
>>  net/net.c  |  4 ++--
>>  net/rarp.c | 23 +++++++++++------------
>>  net/rarp.h |  6 +++---
>>  3 files changed, 16 insertions(+), 17 deletions(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm/next, thanks!

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 12/25] net: cosmetic: Clean up SNTP variables and functions
  2015-04-08 12:46     ` Simon Glass
@ 2015-04-08 14:37       ` Simon Glass
  0 siblings, 0 replies; 103+ messages in thread
From: Simon Glass @ 2015-04-08 14:37 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 06:46, Simon Glass <sjg@chromium.org> wrote:
> On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
>> Make a thorough pass through all variables and function names contained
>> within sntp.c and remove CamelCase and improve naming.
>>
>> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
>> ---
>>
>> Changes in v2: None
>>
>>  net/net.c  |  2 +-
>>  net/sntp.c | 25 +++++++++++--------------
>>  net/sntp.h |  2 +-
>>  3 files changed, 13 insertions(+), 16 deletions(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm/next, thanks!

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 13/25] net: cosmetic: Clean up ping variables and functions
  2015-04-08 12:46     ` Simon Glass
@ 2015-04-08 14:37       ` Simon Glass
  0 siblings, 0 replies; 103+ messages in thread
From: Simon Glass @ 2015-04-08 14:37 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 06:46, Simon Glass <sjg@chromium.org> wrote:
> On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
>> Make a thorough pass through all variables and function names contained
>> within ping.c and remove CamelCase and improve naming.
>>
>> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
>> ---
>>
>> Changes in v2: None
>>
>>  net/ping.c | 13 +++++++------
>>  1 file changed, 7 insertions(+), 6 deletions(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm/next, thanks!

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 14/25] net: cosmetic: Clean up CDP variables and functions
  2015-04-08 12:46     ` Simon Glass
@ 2015-04-08 14:37       ` Simon Glass
  0 siblings, 0 replies; 103+ messages in thread
From: Simon Glass @ 2015-04-08 14:37 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 06:46, Simon Glass <sjg@chromium.org> wrote:
> On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
>> Make a thorough pass through all variables and function names contained
>> within cdp.c and remove CamelCase and improve naming.
>>
>> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
>> ---
>>
>> Changes in v2: None
>>
>>  common/cmd_net.c | 17 +++++++-------
>>  include/net.h    |  4 ++--
>>  net/cdp.c        | 70 ++++++++++++++++++++++++++------------------------------
>>  net/cdp.h        |  2 +-
>>  net/net.c        |  2 +-
>>  5 files changed, 46 insertions(+), 49 deletions(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm/next, thanks!

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 15/25] net: cosmetic: Clean up DNS variables and functions
  2015-04-08 12:46     ` Simon Glass
@ 2015-04-08 14:37       ` Simon Glass
  0 siblings, 0 replies; 103+ messages in thread
From: Simon Glass @ 2015-04-08 14:37 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 06:46, Simon Glass <sjg@chromium.org> wrote:
> On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
>> Make a thorough pass through all variables and function names contained
>> within dns.c and remove CamelCase and improve naming.
>>
>> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
>> ---
>>
>> Changes in v2: None
>>
>>  common/cmd_net.c |  6 +++---
>>  include/net.h    |  4 ++--
>>  net/dns.c        | 53 +++++++++++++++++++++++++----------------------------
>>  net/dns.h        |  2 +-
>>  net/net.c        |  2 +-
>>  5 files changed, 32 insertions(+), 35 deletions(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm/next, thanks!

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 16/25] net: cosmetic: Clean up netconsole variables and functions
  2015-04-08 12:46     ` Simon Glass
@ 2015-04-08 14:37       ` Simon Glass
  0 siblings, 0 replies; 103+ messages in thread
From: Simon Glass @ 2015-04-08 14:37 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 06:46, Simon Glass <sjg@chromium.org> wrote:
> On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
>> Make a thorough pass through all variables and function names contained
>> within netconsole.c and remove CamelCase and improve naming.
>>
>> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
>> ---
>>
>> Changes in v2: None
>>
>>  drivers/net/netconsole.c | 32 +++++++++++++++++---------------
>>  include/net.h            |  2 +-
>>  net/net.c                |  2 +-
>>  3 files changed, 19 insertions(+), 17 deletions(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm/next, thanks!

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 17/25] net: cosmetic: Clean up cmd_net variables and functions
  2015-04-08 12:46     ` Simon Glass
@ 2015-04-08 14:37       ` Simon Glass
  0 siblings, 0 replies; 103+ messages in thread
From: Simon Glass @ 2015-04-08 14:37 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 06:46, Simon Glass <sjg@chromium.org> wrote:
> On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
>> Make a thorough pass through all variables and function names contained
>> within common/cmd_net.c and remove CamelCase and improve naming.
>>
>> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
>> ---
>>
>> Changes in v2: None
>>
>>  common/cmd_net.c | 29 ++++++++++++++---------------
>>  include/net.h    | 10 +++++-----
>>  net/net.c        | 26 +++++++++++++-------------
>>  3 files changed, 32 insertions(+), 33 deletions(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm/next, thanks!

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 18/25] net: cosmetic: Fix checkpatch.pl failures in linklocal
  2015-04-08 12:46     ` Simon Glass
@ 2015-04-08 14:37       ` Simon Glass
  0 siblings, 0 replies; 103+ messages in thread
From: Simon Glass @ 2015-04-08 14:37 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 06:46, Simon Glass <sjg@chromium.org> wrote:
> On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
>> A few new rules in checkpatch.pl since linklocal.c was added.
>>
>> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
>> ---
>>
>> Changes in v2: None
>>
>>  net/link_local.c | 36 +++++++++++++++++-------------------
>>  1 file changed, 17 insertions(+), 19 deletions(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm/next, thanks!

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 19/25] net: cosmetic: Fix checkpatch.pl failures in eth.c
  2015-04-08 12:46     ` Simon Glass
@ 2015-04-08 14:37       ` Simon Glass
  0 siblings, 0 replies; 103+ messages in thread
From: Simon Glass @ 2015-04-08 14:37 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 06:46, Simon Glass <sjg@chromium.org> wrote:
> On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
>> There were still a few failures in net/eth.c, especially in the legacy
>> part of the code.
>>
>> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
>> ---
>>
>> Changes in v2: None
>>
>>  net/eth.c | 26 ++++++++++++++++----------
>>  1 file changed, 16 insertions(+), 10 deletions(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm/next, thanks!

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 20/25] net: cosmetic: Fix checkpatch.pl failures in net.h
  2015-04-08 12:47     ` Simon Glass
@ 2015-04-08 14:37       ` Simon Glass
  0 siblings, 0 replies; 103+ messages in thread
From: Simon Glass @ 2015-04-08 14:37 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 06:47, Simon Glass <sjg@chromium.org> wrote:
> On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
>> There were still a few remaining complains in the legacy eth_device
>> definition that hadn't been addressed.
>>
>> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
>> ---
>>
>> Changes in v2: None
>>
>>  include/net.h | 12 ++++++------
>>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm/next, thanks!

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 21/25] net: cosmetic: Fix checkpatch.pl failures in net.c
  2015-04-08 12:47     ` Simon Glass
@ 2015-04-08 14:37       ` Simon Glass
  0 siblings, 0 replies; 103+ messages in thread
From: Simon Glass @ 2015-04-08 14:37 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 06:47, Simon Glass <sjg@chromium.org> wrote:
> On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
>> Finish eliminating CamelCase from net.c and other failures
>>
>> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
>> ---
>>
>> Changes in v2: None
>>
>>  README                   |   6 +-
>>  common/cmd_elf.c         |   2 +-
>>  common/cmd_net.c         |  22 +++---
>>  common/spl/spl_net.c     |   2 +-
>>  common/update.c          |   2 +-
>>  doc/README.link-local    |   4 +-
>>  drivers/net/netconsole.c |  12 ++--
>>  include/net.h            |  18 ++---
>>  net/arp.c                |   2 +-
>>  net/bootp.c              |  33 ++++-----
>>  net/cdp.c                |   6 +-
>>  net/dns.c                |   2 +-
>>  net/eth.c                |   2 +-
>>  net/link_local.c         |   4 +-
>>  net/net.c                | 179 +++++++++++++++++++++++------------------------
>>  net/nfs.c                |  11 +--
>>  net/ping.c               |   2 +-
>>  net/rarp.c               |   6 +-
>>  net/sntp.c               |   4 +-
>>  net/tftp.c               |  18 ++---
>>  test/dm/eth.c            |  28 ++++----
>>  21 files changed, 181 insertions(+), 184 deletions(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm/next, thanks!

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 22/25] net: Fix incorrect DHCP/BOOTP packets on 64-bit systems
  2015-04-08 12:47     ` Simon Glass
@ 2015-04-08 14:37       ` Simon Glass
  0 siblings, 0 replies; 103+ messages in thread
From: Simon Glass @ 2015-04-08 14:37 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 06:47, Simon Glass <sjg@chromium.org> wrote:
> On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
>> From: Sergey Temerkhanov <s.temerkhanov@gmail.com>
>>
>> This commit fixes incorrect DHCP/BOOTP packet layout caused by
>> 'ulong' type size difference on 64 and 32-bit architectures.
>> It also renames NetReadLong()/NetCopyLong() to
>> net_read_u32/net_copy_u32() accordingly.
>>
>>
>> Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com>
>> Signed-off-by: Sergey Temerkhanov <s.temerkhanov@gmail.com>
>> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
>> ---
>>
>> Changes in v2: None
>>
>>  include/net.h | 10 +++++-----
>>  net/bootp.c   | 33 ++++++++++++++++-----------------
>>  net/bootp.h   |  4 ++--
>>  3 files changed, 23 insertions(+), 24 deletions(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm/next, thanks!

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 23/25] net: Convert protocol structures to use explicit sizes
  2015-04-08 12:47     ` Simon Glass
@ 2015-04-08 14:38       ` Simon Glass
  0 siblings, 0 replies; 103+ messages in thread
From: Simon Glass @ 2015-04-08 14:38 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 06:47, Simon Glass <sjg@chromium.org> wrote:
> On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
>> From: Sergey Temerkhanov <s.temerkhanov@gmail.com>
>>
>> Convert uchar/ushort to u8/u16 respectively.
>>
>>
>> Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com>
>> Signed-off-by: Sergey Temerkhanov <s.temerkhanov@gmail.com>
>> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
>> ---
>>
>> Changes in v2: None
>>
>>  include/net.h | 112 +++++++++++++++++++++++++++++-----------------------------
>>  net/bootp.h   |  14 ++++----
>>  2 files changed, 63 insertions(+), 63 deletions(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm/next, thanks!

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 24/25] net: Fix compile errors when SNTP enabled and not DATE
  2015-04-08 12:47     ` Simon Glass
@ 2015-04-08 14:38       ` Simon Glass
  0 siblings, 0 replies; 103+ messages in thread
From: Simon Glass @ 2015-04-08 14:38 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 06:47, Simon Glass <sjg@chromium.org> wrote:
> On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
>> When SNTP is enabled and DATE is not, to_tm() is not built in. It could
>> be defined when TIMESTAMP is defined, so check for that.
>>
>> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
>> ---
>>
>> Changes in v2:
>> -New to series
>>
>>  net/sntp.c | 6 +++++-
>>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm/next, thanks!

^ permalink raw reply	[flat|nested] 103+ messages in thread

* [U-Boot] [PATCH v2 25/25] sandbox: Enable more network features for sandbox
  2015-04-08 12:47     ` Simon Glass
@ 2015-04-08 14:38       ` Simon Glass
  0 siblings, 0 replies; 103+ messages in thread
From: Simon Glass @ 2015-04-08 14:38 UTC (permalink / raw)
  To: u-boot

On 8 April 2015 at 06:47, Simon Glass <sjg@chromium.org> wrote:
> On 8 April 2015 at 00:41, Joe Hershberger <joe.hershberger@ni.com> wrote:
>> More net features enabled and supported on sandbox to allow more testing
>>
>> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
>> ---
>>
>> Changes in v2:
>> -New to series
>>
>>  include/configs/sandbox.h | 9 +++++++++
>>  1 file changed, 9 insertions(+)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm/next, thanks!

^ permalink raw reply	[flat|nested] 103+ messages in thread

end of thread, other threads:[~2015-04-08 14:38 UTC | newest]

Thread overview: 103+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-03 21:14 [U-Boot] [PATCH 0/23] net: cosmetic: Fix naming and other checkpatch.pl issues in net/ Joe Hershberger
2015-04-03 21:14 ` [U-Boot] [PATCH 01/23] net: cosmetic: Change IPaddr_t to struct in_addr Joe Hershberger
2015-04-08  1:26   ` Simon Glass
2015-04-08  6:57     ` Joe Hershberger
2015-04-03 21:14 ` [U-Boot] [PATCH 02/23] net: cosmetic: Fixup var names related to boot file Joe Hershberger
2015-04-03 21:14 ` [U-Boot] [PATCH 03/23] net: cosmetic: Fixup var names for DHCP strings Joe Hershberger
2015-04-03 21:14 ` [U-Boot] [PATCH 04/23] net: cosmetic: Name ethaddr variables consistently Joe Hershberger
2015-04-03 21:14 ` [U-Boot] [PATCH 05/23] net: cosmetic: Cleanup internal packet buffer names Joe Hershberger
2015-04-03 21:14 ` [U-Boot] [PATCH 06/23] net: cosmetic: Fix var naming net <-> eth drivers Joe Hershberger
2015-04-03 21:14 ` [U-Boot] [PATCH 07/23] net: cosmetic: Clean up TFTP variables and functions Joe Hershberger
2015-04-03 21:14 ` [U-Boot] [PATCH 08/23] net: cosmetic: Clean up ARP " Joe Hershberger
2015-04-03 21:14 ` [U-Boot] [PATCH 09/23] net: cosmetic: Clean up DHCP " Joe Hershberger
2015-04-03 21:14 ` [U-Boot] [PATCH 10/23] net: cosmetic: Clean up NFS " Joe Hershberger
2015-04-03 21:14 ` [U-Boot] [PATCH 11/23] net: cosmetic: Clean up RARP " Joe Hershberger
2015-04-03 21:14 ` [U-Boot] [PATCH 12/23] net: cosmetic: Clean up SNTP " Joe Hershberger
2015-04-03 21:14 ` [U-Boot] [PATCH 13/23] net: cosmetic: Clean up ping " Joe Hershberger
2015-04-03 21:14 ` [U-Boot] [PATCH 14/23] net: cosmetic: Clean up CDP " Joe Hershberger
2015-04-03 21:14 ` [U-Boot] [PATCH 15/23] net: cosmetic: Clean up DNS " Joe Hershberger
2015-04-03 21:14 ` [U-Boot] [PATCH 16/23] net: cosmetic: Clean up netconsole " Joe Hershberger
2015-04-03 21:14 ` [U-Boot] [PATCH 17/23] net: cosmetic: Clean up cmd_net " Joe Hershberger
2015-04-03 21:14 ` [U-Boot] [PATCH 18/23] net: cosmetic: Fix checkpatch.pl failures in linklocal Joe Hershberger
2015-04-03 21:14 ` [U-Boot] [PATCH 19/23] net: cosmetic: Fix checkpatch.pl failures in eth.c Joe Hershberger
2015-04-03 21:14 ` [U-Boot] [PATCH 20/23] net: cosmetic: Fix checkpatch.pl failures in net.h Joe Hershberger
2015-04-03 21:14 ` [U-Boot] [PATCH 21/23] net: cosmetic: Fix checkpatch.pl failures in net.c Joe Hershberger
2015-04-03 21:14 ` [U-Boot] [PATCH 22/23] net: Fix incorrect DHCP/BOOTP packets on 64-bit systems Joe Hershberger
2015-04-03 21:14 ` [U-Boot] [PATCH 23/23] net: Convert protocol structures to use explicit sizes Joe Hershberger
2015-04-06 20:41 ` [U-Boot] [PATCH 0/23] net: cosmetic: Fix naming and other checkpatch.pl issues in net/ Joe Hershberger
2015-04-06 21:54   ` Simon Glass
2015-04-08  6:41 ` [U-Boot] [PATCH v2 0/25] " Joe Hershberger
2015-04-08  6:41   ` [U-Boot] [PATCH v2 01/25] net: cosmetic: Change IPaddr_t to struct in_addr Joe Hershberger
2015-04-08 12:45     ` Simon Glass
2015-04-08 14:37       ` Simon Glass
2015-04-08  6:41   ` [U-Boot] [PATCH v2 02/25] net: cosmetic: Fixup var names related to boot file Joe Hershberger
2015-04-08 12:45     ` Simon Glass
2015-04-08 14:37       ` Simon Glass
2015-04-08  6:41   ` [U-Boot] [PATCH v2 03/25] net: cosmetic: Fixup var names for DHCP strings Joe Hershberger
2015-04-08 12:45     ` Simon Glass
2015-04-08 14:37       ` Simon Glass
2015-04-08  6:41   ` [U-Boot] [PATCH v2 04/25] net: cosmetic: Name ethaddr variables consistently Joe Hershberger
2015-04-08 12:46     ` Simon Glass
2015-04-08 14:37       ` Simon Glass
2015-04-08  6:41   ` [U-Boot] [PATCH v2 05/25] net: cosmetic: Cleanup internal packet buffer names Joe Hershberger
2015-04-08  6:41   ` [U-Boot] [PATCH v2 06/25] net: cosmetic: Fix var naming net <-> eth drivers Joe Hershberger
2015-04-08 12:46     ` Simon Glass
2015-04-08 14:37       ` Simon Glass
2015-04-08  6:41   ` [U-Boot] [PATCH v2 07/25] net: cosmetic: Clean up TFTP variables and functions Joe Hershberger
2015-04-08 12:46     ` Simon Glass
2015-04-08 14:37       ` Simon Glass
2015-04-08  6:41   ` [U-Boot] [PATCH v2 08/25] net: cosmetic: Clean up ARP " Joe Hershberger
2015-04-08 12:46     ` Simon Glass
2015-04-08 14:37       ` Simon Glass
2015-04-08  6:41   ` [U-Boot] [PATCH v2 09/25] net: cosmetic: Clean up DHCP " Joe Hershberger
2015-04-08 12:46     ` Simon Glass
2015-04-08 14:37       ` Simon Glass
2015-04-08  6:41   ` [U-Boot] [PATCH v2 10/25] net: cosmetic: Clean up NFS " Joe Hershberger
2015-04-08 12:46     ` Simon Glass
2015-04-08 14:37       ` Simon Glass
2015-04-08  6:41   ` [U-Boot] [PATCH v2 11/25] net: cosmetic: Clean up RARP " Joe Hershberger
2015-04-08 12:46     ` Simon Glass
2015-04-08 14:37       ` Simon Glass
2015-04-08  6:41   ` [U-Boot] [PATCH v2 12/25] net: cosmetic: Clean up SNTP " Joe Hershberger
2015-04-08 12:46     ` Simon Glass
2015-04-08 14:37       ` Simon Glass
2015-04-08  6:41   ` [U-Boot] [PATCH v2 13/25] net: cosmetic: Clean up ping " Joe Hershberger
2015-04-08 12:46     ` Simon Glass
2015-04-08 14:37       ` Simon Glass
2015-04-08  6:41   ` [U-Boot] [PATCH v2 14/25] net: cosmetic: Clean up CDP " Joe Hershberger
2015-04-08 12:46     ` Simon Glass
2015-04-08 14:37       ` Simon Glass
2015-04-08  6:41   ` [U-Boot] [PATCH v2 15/25] net: cosmetic: Clean up DNS " Joe Hershberger
2015-04-08 12:46     ` Simon Glass
2015-04-08 14:37       ` Simon Glass
2015-04-08  6:41   ` [U-Boot] [PATCH v2 16/25] net: cosmetic: Clean up netconsole " Joe Hershberger
2015-04-08 12:46     ` Simon Glass
2015-04-08 14:37       ` Simon Glass
2015-04-08  6:41   ` [U-Boot] [PATCH v2 17/25] net: cosmetic: Clean up cmd_net " Joe Hershberger
2015-04-08 12:46     ` Simon Glass
2015-04-08 14:37       ` Simon Glass
2015-04-08  6:41   ` [U-Boot] [PATCH v2 18/25] net: cosmetic: Fix checkpatch.pl failures in linklocal Joe Hershberger
2015-04-08 12:46     ` Simon Glass
2015-04-08 14:37       ` Simon Glass
2015-04-08  6:41   ` [U-Boot] [PATCH v2 19/25] net: cosmetic: Fix checkpatch.pl failures in eth.c Joe Hershberger
2015-04-08 12:46     ` Simon Glass
2015-04-08 14:37       ` Simon Glass
2015-04-08  6:41   ` [U-Boot] [PATCH v2 20/25] net: cosmetic: Fix checkpatch.pl failures in net.h Joe Hershberger
2015-04-08 12:47     ` Simon Glass
2015-04-08 14:37       ` Simon Glass
2015-04-08  6:41   ` [U-Boot] [PATCH v2 21/25] net: cosmetic: Fix checkpatch.pl failures in net.c Joe Hershberger
2015-04-08 12:47     ` Simon Glass
2015-04-08 14:37       ` Simon Glass
2015-04-08  6:41   ` [U-Boot] [PATCH v2 22/25] net: Fix incorrect DHCP/BOOTP packets on 64-bit systems Joe Hershberger
2015-04-08 12:47     ` Simon Glass
2015-04-08 14:37       ` Simon Glass
2015-04-08  6:41   ` [U-Boot] [PATCH v2 23/25] net: Convert protocol structures to use explicit sizes Joe Hershberger
2015-04-08 12:47     ` Simon Glass
2015-04-08 14:38       ` Simon Glass
2015-04-08  6:41   ` [U-Boot] [PATCH v2 24/25] net: Fix compile errors when SNTP enabled and not DATE Joe Hershberger
2015-04-08 12:47     ` Simon Glass
2015-04-08 14:38       ` Simon Glass
2015-04-08  6:41   ` [U-Boot] [PATCH v2 25/25] sandbox: Enable more network features for sandbox Joe Hershberger
2015-04-08 12:47     ` Simon Glass
2015-04-08 14:38       ` Simon Glass
2015-04-08 12:46   ` [U-Boot] [PATCH v2 0/25] net: cosmetic: Fix naming and other checkpatch.pl issues in net/ Simon Glass

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.