diff options
author | Joe Hershberger <joe.hershberger@ni.com> | 2015-04-08 01:41:05 -0500 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2015-04-18 11:11:32 -0600 |
commit | 1203fcceec113d502995f7242d7e1be09d373e80 (patch) | |
tree | 57629eda7b55239ab81c15cbb5544ff2c5b7e6db /net | |
parent | 0adb5b761f4c789ae47d8abb015f5e017263d3f2 (diff) | |
download | u-boot-1203fcceec113d502995f7242d7e1be09d373e80.tar.gz |
net: cosmetic: Cleanup internal packet buffer names
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>
Diffstat (limited to 'net')
-rw-r--r-- | net/arp.c | 20 | ||||
-rw-r--r-- | net/bootp.c | 16 | ||||
-rw-r--r-- | net/cdp.c | 10 | ||||
-rw-r--r-- | net/dns.c | 7 | ||||
-rw-r--r-- | net/net.c | 42 | ||||
-rw-r--r-- | net/nfs.c | 8 | ||||
-rw-r--r-- | net/ping.c | 6 | ||||
-rw-r--r-- | net/rarp.c | 6 | ||||
-rw-r--r-- | net/sntp.c | 8 | ||||
-rw-r--r-- | net/tftp.c | 6 |
10 files changed, 65 insertions, 64 deletions
@@ -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 9b27d4cb53..9788b52e4b 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); } /* @@ -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; } @@ -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"); } @@ -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; @@ -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 e4e3086e19..7c6084c3e3 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 2f5c104d11..f50d2fbd9d 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 b99aa3ed67..1e2b67840f 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 8ddc7be365..f25abaab49 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 |