1
0
Fork 0

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>
utp
Joe Hershberger 2015-04-08 01:41:05 -05:00 committed by Simon Glass
parent 0adb5b761f
commit 1203fcceec
13 changed files with 82 additions and 80 deletions

View File

@ -721,7 +721,7 @@ eth_loopback_test (void)
BD_ENET_TX_LAST | BD_ENET_TX_TC; BD_ENET_TX_LAST | BD_ENET_TX_TC;
memset((void *)bp, patbytes[i], ELBT_BUFSZ); memset((void *)bp, patbytes[i], ELBT_BUFSZ);
NetSetEther(bp, net_bcast_ethaddr, 0x8000); net_set_ether(bp, net_bcast_ethaddr, 0x8000);
} }
ecp->txbd[ELBT_NTXBD - 1].cbd_sc |= BD_ENET_TX_WRAP; ecp->txbd[ELBT_NTXBD - 1].cbd_sc |= BD_ENET_TX_WRAP;

View File

@ -125,9 +125,10 @@ void NcStart(void)
/* send arp request */ /* send arp request */
uchar *pkt; uchar *pkt;
net_set_arp_handler(nc_wait_arp_handler); 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); memcpy(pkt, output_packet, output_packet_len);
NetSendUDPPacket(nc_ether, nc_ip, nc_out_port, nc_in_port, net_send_udp_packet(nc_ether, nc_ip, nc_out_port, nc_in_port,
output_packet_len); output_packet_len);
} }
} }
@ -202,11 +203,11 @@ static void nc_send_packet(const char *buf, int len)
inited = 1; 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); memcpy(pkt, buf, len);
ether = nc_ether; ether = nc_ether;
ip = nc_ip; 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 (inited) {
if (eth_is_on_demand_init()) 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 * 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(); net_init();

View File

@ -481,14 +481,14 @@ extern u8 net_ethaddr[6]; /* Our ethernet address */
extern u8 net_server_ethaddr[6]; /* Boot server enet 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_ip; /* Our IP addr (0 = unknown) */
extern struct in_addr net_server_ip; /* Server 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 #ifdef CONFIG_DM_ETH
extern uchar *net_rx_packets[PKTBUFSRX]; /* Receive packets */ extern uchar *net_rx_packets[PKTBUFSRX]; /* Receive packets */
#else #else
extern uchar *NetRxPackets[PKTBUFSRX]; /* Receive packets */ extern uchar *NetRxPackets[PKTBUFSRX]; /* Receive packets */
#endif #endif
extern uchar *NetRxPacket; /* Current receive packet */ extern uchar *net_rx_packet; /* Current receive packet */
extern int NetRxPacketLen; /* Current rx packet length */ extern int net_rx_packet_len; /* Current rx packet length */
extern unsigned NetIPID; /* IP ID (counting) */ extern unsigned NetIPID; /* IP ID (counting) */
extern const u8 net_bcast_ethaddr[6]; /* Ethernet broadcast address */ extern const u8 net_bcast_ethaddr[6]; /* Ethernet broadcast address */
extern const u8 net_null_ethaddr[6]; extern const u8 net_null_ethaddr[6];
@ -556,10 +556,10 @@ void NetStop(void);
int NetStartAgain(void); int NetStartAgain(void);
/* Get size of the ethernet header when we send */ /* 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 */ /* 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); int net_update_ether(struct ethernet_hdr *et, uchar *addr, uint prot);
/* Set IP header */ /* Set IP header */
@ -621,14 +621,14 @@ static inline void net_set_state(enum net_loop_state state)
} }
/* Transmit a packet */ /* 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() */ /* Currently no way to return errors from eth_send() */
(void) eth_send(pkt, len); (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) * (ether will be populated)
* *
* @param ether Raw packet buffer * @param ether Raw packet buffer
@ -637,7 +637,7 @@ static inline void NetSendPacket(uchar *pkt, int len)
* @param sport Source UDP port * @param sport Source UDP port
* @param payload_len Length of data after the UDP header * @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); int sport, int payload_len);
#ifndef CONFIG_DM_ETH #ifndef CONFIG_DM_ETH

View File

@ -35,7 +35,7 @@ int NetArpWaitTxPacketSize;
ulong NetArpWaitTimerStart; ulong NetArpWaitTimerStart;
int NetArpWaitTry; 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]; static uchar NetArpPacketBuf[PKTSIZE_ALIGN + PKTALIGN];
void ArpInit(void) void ArpInit(void)
@ -45,8 +45,8 @@ void ArpInit(void)
net_arp_wait_packet_ip.s_addr = 0; net_arp_wait_packet_ip.s_addr = 0;
net_arp_wait_reply_ip.s_addr = 0; net_arp_wait_reply_ip.s_addr = 0;
NetArpWaitTxPacketSize = 0; NetArpWaitTxPacketSize = 0;
NetArpTxPacket = &NetArpPacketBuf[0] + (PKTALIGN - 1); net_arp_tx_packet = &NetArpPacketBuf[0] + (PKTALIGN - 1);
NetArpTxPacket -= (ulong)NetArpTxPacket % PKTALIGN; net_arp_tx_packet -= (ulong)net_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 *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); 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; pkt += eth_hdr_size;
arp = (struct arp_hdr *) pkt; 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 */ memcpy(&arp->ar_tha, targetEther, ARP_HLEN); /* target ET addr */
net_write_ip(&arp->ar_tpa, target_ip); /* target IP 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) 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)) (net_read_ip(&arp->ar_spa).s_addr & net_netmask.s_addr))
udelay(5000); udelay(5000);
#endif #endif
NetSendPacket((uchar *)et, eth_hdr_size + ARP_HDR_SIZE); net_send_packet((uchar *)et, eth_hdr_size + ARP_HDR_SIZE);
return; return;
case ARPOP_REPLY: /* arp reply */ 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 /* set the mac address in the waiting packet's header
and transmit it */ and transmit it */
memcpy(((struct ethernet_hdr *)NetTxPacket)->et_dest, memcpy(((struct ethernet_hdr *)net_tx_packet)->et_dest,
&arp->ar_sha, ARP_HLEN); &arp->ar_sha, ARP_HLEN);
NetSendPacket(NetTxPacket, NetArpWaitTxPacketSize); net_send_packet(net_tx_packet, NetArpWaitTxPacketSize);
/* no arp request pending now */ /* no arp request pending now */
net_arp_wait_packet_ip.s_addr = 0; net_arp_wait_packet_ip.s_addr = 0;

View File

@ -147,8 +147,8 @@ static void BootpCopyNetParams(struct Bootp_t *bp)
net_copy_ip(&tmp_ip, &bp->bp_siaddr); net_copy_ip(&tmp_ip, &bp->bp_siaddr);
if (tmp_ip.s_addr != 0) if (tmp_ip.s_addr != 0)
net_copy_ip(&net_server_ip, &bp->bp_siaddr); net_copy_ip(&net_server_ip, &bp->bp_siaddr);
memcpy(net_server_ethaddr, ((struct ethernet_hdr *)NetRxPacket)->et_src, memcpy(net_server_ethaddr,
6); ((struct ethernet_hdr *)net_rx_packet)->et_src, 6);
if (strlen(bp->bp_file) > 0) if (strlen(bp->bp_file) > 0)
copy_filename(net_boot_file_name, bp->bp_file, copy_filename(net_boot_file_name, bp->bp_file,
sizeof(net_boot_file_name)); sizeof(net_boot_file_name));
@ -691,10 +691,10 @@ BootpRequest(void)
#endif /* CONFIG_BOOTP_RANDOM_DELAY */ #endif /* CONFIG_BOOTP_RANDOM_DELAY */
printf("BOOTP broadcast %d\n", ++BootpTry); printf("BOOTP broadcast %d\n", ++BootpTry);
pkt = NetTxPacket; pkt = net_tx_packet;
memset((void *)pkt, 0, PKTSIZE); 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; pkt += eth_hdr_size;
/* /*
@ -760,7 +760,7 @@ BootpRequest(void)
#else #else
net_set_udp_handler(bootp_handler); net_set_udp_handler(bootp_handler);
#endif #endif
NetSendPacket(NetTxPacket, pktlen); net_send_packet(net_tx_packet, pktlen);
} }
#if defined(CONFIG_CMD_DHCP) #if defined(CONFIG_CMD_DHCP)
@ -894,10 +894,10 @@ static void DhcpSendRequestPkt(struct Bootp_t *bp_offer)
struct in_addr bcast_ip; struct in_addr bcast_ip;
debug("DhcpSendRequestPkt: Sending DHCPREQUEST\n"); debug("DhcpSendRequestPkt: Sending DHCPREQUEST\n");
pkt = NetTxPacket; pkt = net_tx_packet;
memset((void *)pkt, 0, PKTSIZE); 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; pkt += eth_hdr_size;
iphdr = pkt; /* We'll need this later to set proper pkt 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); udelay(CONFIG_BOOTP_DHCP_REQUEST_DELAY);
#endif /* CONFIG_BOOTP_DHCP_REQUEST_DELAY */ #endif /* CONFIG_BOOTP_DHCP_REQUEST_DELAY */
debug("Transmitting DHCPREQUEST packet: len = %d\n", pktlen); debug("Transmitting DHCPREQUEST packet: len = %d\n", pktlen);
NetSendPacket(NetTxPacket, pktlen); net_send_packet(net_tx_packet, pktlen);
} }
/* /*

View File

@ -118,7 +118,7 @@ CDPSendTrigger(void)
char buf[32]; char buf[32];
#endif #endif
pkt = NetTxPacket; pkt = net_tx_packet;
et = (struct ethernet_hdr *)pkt; et = (struct ethernet_hdr *)pkt;
/* NOTE: trigger sent not on any VLAN */ /* NOTE: trigger sent not on any VLAN */
@ -207,17 +207,17 @@ CDPSendTrigger(void)
#endif #endif
/* length of ethernet packet */ /* 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); et->et_protlen = htons(len);
len = ETHER_HDR_SIZE + sizeof(CDP_SNAP_hdr); len = ETHER_HDR_SIZE + sizeof(CDP_SNAP_hdr);
chksum = CDP_compute_csum((uchar *)NetTxPacket + len, chksum = CDP_compute_csum((uchar *)net_tx_packet + len,
(uchar *)s - (NetTxPacket + len)); (uchar *)s - (net_tx_packet + len));
if (chksum == 0) if (chksum == 0)
chksum = 0xFFFF; chksum = 0xFFFF;
*cp = htons(chksum); *cp = htons(chksum);
NetSendPacket(NetTxPacket, (uchar *)s - NetTxPacket); net_send_packet(net_tx_packet, (uchar *)s - net_tx_packet);
return 0; return 0;
} }

View File

@ -45,7 +45,8 @@ DnsSend(void)
enum dns_query_type qtype = DNS_A_RECORD; enum dns_query_type qtype = DNS_A_RECORD;
name = NetDNSResolve; 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 */ /* Prepare DNS packet header */
header = (struct header *) pkt; header = (struct header *) pkt;
@ -89,8 +90,8 @@ DnsSend(void)
DnsOurPort = random_port(); DnsOurPort = random_port();
NetSendUDPPacket(net_server_ethaddr, net_dns_server, DNS_SERVICE_PORT, net_send_udp_packet(net_server_ethaddr, net_dns_server,
DnsOurPort, n); DNS_SERVICE_PORT, DnsOurPort, n);
debug("DNS packet sent\n"); debug("DNS packet sent\n");
} }

View File

@ -137,9 +137,9 @@ struct in_addr net_ip;
/* Server IP addr (0 = unknown) */ /* Server IP addr (0 = unknown) */
struct in_addr net_server_ip; struct in_addr net_server_ip;
/* Current receive packet */ /* Current receive packet */
uchar *NetRxPacket; uchar *net_rx_packet;
/* Current rx packet length */ /* Current rx packet length */
int NetRxPacketLen; int net_rx_packet_len;
/* IP packet ID */ /* IP packet ID */
unsigned NetIPID; unsigned NetIPID;
/* Ethernet bcast address */ /* Ethernet bcast address */
@ -177,7 +177,7 @@ struct in_addr net_ntp_server;
int NetTimeOffset; int NetTimeOffset;
#endif #endif
static uchar PktBuf[(PKTBUFSRX+1) * PKTSIZE_ALIGN + PKTALIGN]; static uchar net_pkt_buf[(PKTBUFSRX+1) * PKTSIZE_ALIGN + PKTALIGN];
#ifdef CONFIG_DM_ETH #ifdef CONFIG_DM_ETH
/* Receive packets */ /* Receive packets */
uchar *net_rx_packets[PKTBUFSRX]; uchar *net_rx_packets[PKTBUFSRX];
@ -200,7 +200,7 @@ static ulong timeStart;
/* Current timeout value */ /* Current timeout value */
static ulong timeDelta; static ulong timeDelta;
/* THE transmit packet */ /* THE transmit packet */
uchar *NetTxPacket; uchar *net_tx_packet;
static int net_check_prereq(enum proto_t protocol); static int net_check_prereq(enum proto_t protocol);
@ -301,16 +301,17 @@ void net_init(void)
*/ */
int i; int i;
NetTxPacket = &PktBuf[0] + (PKTALIGN - 1); net_tx_packet = &net_pkt_buf[0] + (PKTALIGN - 1);
NetTxPacket -= (ulong)NetTxPacket % PKTALIGN; net_tx_packet -= (ulong)net_tx_packet % PKTALIGN;
#ifdef CONFIG_DM_ETH #ifdef CONFIG_DM_ETH
for (i = 0; i < PKTBUFSRX; i++) { for (i = 0; i < PKTBUFSRX; i++) {
net_rx_packets[i] = NetTxPacket + (i + 1) * net_rx_packets[i] = net_tx_packet +
PKTSIZE_ALIGN; (i + 1) * PKTSIZE_ALIGN;
} }
#else #else
for (i = 0; i < PKTBUFSRX; i++) for (i = 0; i < PKTBUFSRX; i++)
NetRxPackets[i] = NetTxPacket + (i + 1) * PKTSIZE_ALIGN; NetRxPackets[i] = net_tx_packet +
(i + 1) * PKTSIZE_ALIGN;
#endif #endif
ArpInit(); ArpInit();
net_clear_handlers(); 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) int payload_len)
{ {
uchar *pkt; uchar *pkt;
int eth_hdr_size; int eth_hdr_size;
int pkt_hdr_size; int pkt_hdr_size;
/* make sure the NetTxPacket is initialized (NetInit() was called) */ /* make sure the net_tx_packet is initialized (NetInit() was called) */
assert(NetTxPacket != NULL); assert(net_tx_packet != NULL);
if (NetTxPacket == NULL) if (net_tx_packet == NULL)
return -1; return -1;
/* convert to new style broadcast */ /* 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) if (dest.s_addr == 0xFFFFFFFF)
ether = (uchar *)net_bcast_ethaddr; 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; pkt += eth_hdr_size;
net_set_udp_header(pkt, dest, dport, sport, payload_len); net_set_udp_header(pkt, dest, dport, sport, payload_len);
pkt_hdr_size = eth_hdr_size + IP_UDP_HDR_SIZE; 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 { } else {
debug_cond(DEBUG_DEV_PKT, "sending UDP to %pI4/%pM\n", debug_cond(DEBUG_DEV_PKT, "sending UDP to %pI4/%pM\n",
&dest, ether); &dest, ether);
NetSendPacket(NetTxPacket, pkt_hdr_size + payload_len); net_send_packet(net_tx_packet, pkt_hdr_size + payload_len);
return 0; /* transmitted */ 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"); debug_cond(DEBUG_NET_PKT, "packet received\n");
NetRxPacket = in_packet; net_rx_packet = in_packet;
NetRxPacketLen = len; net_rx_packet_len = len;
et = (struct ethernet_hdr *)in_packet; et = (struct ethernet_hdr *)in_packet;
/* too small packet? */ /* too small packet? */
@ -1307,7 +1308,7 @@ common:
/**********************************************************************/ /**********************************************************************/
int int
NetEthHdrSize(void) net_eth_hdr_size(void)
{ {
ushort myvlanid; ushort myvlanid;
@ -1319,8 +1320,7 @@ NetEthHdrSize(void)
VLAN_ETHER_HDR_SIZE; VLAN_ETHER_HDR_SIZE;
} }
int int net_set_ether(uchar *xet, const uchar *dest_ethaddr, uint prot)
NetSetEther(uchar *xet, const uchar *dest_ethaddr, uint prot)
{ {
struct ethernet_hdr *et = (struct ethernet_hdr *)xet; struct ethernet_hdr *et = (struct ethernet_hdr *)xet;
ushort myvlanid; ushort myvlanid;

View File

@ -201,7 +201,7 @@ rpc_req(int rpc_prog, int rpc_proc, uint32_t *data, int datalen)
pktlen = (char *)p + datalen*sizeof(uint32_t) - (char *)&pkt; pktlen = (char *)p + datalen*sizeof(uint32_t) - (char *)&pkt;
memcpy((char *)NetTxPacket + NetEthHdrSize() + IP_UDP_HDR_SIZE, memcpy((char *)net_tx_packet + net_eth_hdr_size() + IP_UDP_HDR_SIZE,
(char *)&pkt, pktlen); (char *)&pkt, pktlen);
if (rpc_prog == PROG_PORTMAP) if (rpc_prog == PROG_PORTMAP)
@ -211,8 +211,8 @@ rpc_req(int rpc_prog, int rpc_proc, uint32_t *data, int datalen)
else else
sport = NfsSrvNfsPort; sport = NfsSrvNfsPort;
NetSendUDPPacket(net_server_ethaddr, nfs_server_ip, sport, NfsOurPort, net_send_udp_packet(net_server_ethaddr, nfs_server_ip, sport,
pktlen); NfsOurPort, pktlen);
} }
/************************************************************************** /**************************************************************************

View File

@ -50,8 +50,8 @@ static int ping_send(void)
net_arp_wait_packet_ip = net_ping_ip; net_arp_wait_packet_ip = net_ping_ip;
eth_hdr_size = NetSetEther(NetTxPacket, net_null_ethaddr, PROT_IP); eth_hdr_size = net_set_ether(net_tx_packet, net_null_ethaddr, PROT_IP);
pkt = (uchar *)NetTxPacket + eth_hdr_size; pkt = (uchar *)net_tx_packet + eth_hdr_size;
set_icmp_header(pkt, net_ping_ip); 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->type = ICMP_ECHO_REPLY;
icmph->checksum = 0; icmph->checksum = 0;
icmph->checksum = compute_ip_checksum(icmph, len - IP_HDR_SIZE); 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; return;
/* default: /* default:
return;*/ return;*/

View File

@ -75,9 +75,9 @@ void RarpRequest(void)
int eth_hdr_size; int eth_hdr_size;
printf("RARP broadcast %d\n", ++RarpTry); 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; pkt += eth_hdr_size;
rarp = (struct arp_hdr *)pkt; rarp = (struct arp_hdr *)pkt;
@ -94,7 +94,7 @@ void RarpRequest(void)
/* dest IP addr set to broadcast */ /* dest IP addr set to broadcast */
memset(&rarp->ar_data[16], 0xff, 4); 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); NetSetTimeout(TIMEOUT, RarpTimeout);
} }

View File

@ -31,14 +31,14 @@ SntpSend(void)
pkt.vn = NTP_VERSION; pkt.vn = NTP_VERSION;
pkt.mode = NTP_MODE_CLIENT; pkt.mode = NTP_MODE_CLIENT;
memcpy((char *)NetTxPacket + NetEthHdrSize() + IP_UDP_HDR_SIZE, memcpy((char *)net_tx_packet + net_eth_hdr_size() + IP_UDP_HDR_SIZE,
(char *)&pkt, pktlen); (char *)&pkt, pktlen);
SntpOurPort = 10000 + (get_timer(0) % 4096); SntpOurPort = 10000 + (get_timer(0) % 4096);
sport = NTP_SERVICE_PORT; sport = NTP_SERVICE_PORT;
NetSendUDPPacket(net_server_ethaddr, net_ntp_server, sport, SntpOurPort, net_send_udp_packet(net_server_ethaddr, net_ntp_server, sport,
pktlen); SntpOurPort, pktlen);
} }
static void static void

View File

@ -337,7 +337,7 @@ TftpSend(void)
* We will always be sending some sort of packet, so * We will always be sending some sort of packet, so
* cobble together the packet headers now. * 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) { switch (TftpState) {
case STATE_SEND_RRQ: case STATE_SEND_RRQ:
@ -435,7 +435,7 @@ TftpSend(void)
break; break;
} }
NetSendUDPPacket(net_server_ethaddr, tftp_remote_ip, TftpRemotePort, net_send_udp_packet(net_server_ethaddr, tftp_remote_ip, TftpRemotePort,
TftpOurPort, len); TftpOurPort, len);
} }