net: cosmetic: Rename "x" to "eth_proto"
[platform/kernel/u-boot.git] / net / net.c
index 33de399..67921c3 100644 (file)
--- a/net/net.c
+++ b/net/net.c
@@ -591,8 +591,8 @@ NetSendPacket(uchar *pkt, int len)
        (void) eth_send(pkt, len);
 }
 
-int
-NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport, int len)
+int NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport,
+               int payload_len)
 {
        uchar *pkt;
 
@@ -618,14 +618,14 @@ NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport, int len)
                pkt = NetArpWaitTxPacket;
                pkt += NetSetEther(pkt, NetArpWaitPacketMAC, PROT_IP);
 
-               NetSetIP(pkt, dest, dport, sport, len);
+               NetSetIP(pkt, dest, dport, sport, payload_len);
                memcpy(pkt + IP_UDP_HDR_SIZE, (uchar *)NetTxPacket +
                       (pkt - (uchar *)NetArpWaitTxPacket) +
-                      IP_UDP_HDR_SIZE, len);
+                      IP_UDP_HDR_SIZE, payload_len);
 
                /* size of the waiting packet */
                NetArpWaitTxPacketSize = (pkt - NetArpWaitTxPacket) +
-                       IP_UDP_HDR_SIZE + len;
+                       IP_UDP_HDR_SIZE + payload_len;
 
                /* and do the ARP request */
                NetArpWaitTry = 1;
@@ -638,8 +638,9 @@ NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport, int len)
 
        pkt = (uchar *)NetTxPacket;
        pkt += NetSetEther(pkt, ether, PROT_IP);
-       NetSetIP(pkt, dest, dport, sport, len);
-       eth_send(NetTxPacket, (pkt - NetTxPacket) + IP_UDP_HDR_SIZE + len);
+       NetSetIP(pkt, dest, dport, sport, payload_len);
+       eth_send(NetTxPacket, (pkt - NetTxPacket) + IP_UDP_HDR_SIZE +
+               payload_len);
 
        return 0;       /* transmitted */
 }
@@ -825,7 +826,7 @@ static inline struct ip_udp_hdr *NetDefragment(struct ip_udp_hdr *ip, int *lenp)
 static void receive_icmp(struct ip_udp_hdr *ip, int len,
                        IPaddr_t src_ip, struct ethernet_hdr *et)
 {
-       ICMP_t *icmph = (ICMP_t *)&ip->udp_src;
+       struct icmp_hdr *icmph = (struct icmp_hdr *)&ip->udp_src;
 
        switch (icmph->type) {
        case ICMP_REDIRECT:
@@ -853,9 +854,9 @@ NetReceive(uchar *inpkt, int len)
 {
        struct ethernet_hdr *et;
        struct ip_udp_hdr *ip;
-       IPaddr_t tmp;
+       IPaddr_t dst_ip;
        IPaddr_t src_ip;
-       int     x;
+       int eth_proto;
 #if defined(CONFIG_CMD_CDP)
        int iscdp;
 #endif
@@ -890,26 +891,28 @@ NetReceive(uchar *inpkt, int len)
        if (mynvlanid == (ushort)-1)
                mynvlanid = VLAN_NONE;
 
-       x = ntohs(et->et_protlen);
+       eth_proto = ntohs(et->et_protlen);
 
        debug("packet received\n");
 
-       if (x < 1514) {
+       if (eth_proto < 1514) {
                struct e802_hdr *et802 = (struct e802_hdr *)et;
                /*
-                *      Got a 802 packet.  Check the other protocol field.
+                *      Got a 802.2 packet.  Check the other protocol field.
+                *      XXX VLAN over 802.2+SNAP not implemented!
                 */
-               x = ntohs(et802->et_prot);
+               eth_proto = ntohs(et802->et_prot);
 
                ip = (struct ip_udp_hdr *)(inpkt + E802_HDR_SIZE);
                len -= E802_HDR_SIZE;
 
-       } else if (x != PROT_VLAN) {    /* normal packet */
+       } else if (eth_proto != PROT_VLAN) {    /* normal packet */
                ip = (struct ip_udp_hdr *)(inpkt + ETHER_HDR_SIZE);
                len -= ETHER_HDR_SIZE;
 
        } else {                        /* VLAN packet */
-               VLAN_Ethernet_t *vet = (VLAN_Ethernet_t *)et;
+               struct vlan_ethernet_hdr *vet =
+                       (struct vlan_ethernet_hdr *)et;
 
                debug("VLAN packet received\n");
 
@@ -927,13 +930,13 @@ NetReceive(uchar *inpkt, int len)
 
                cti = ntohs(vet->vet_tag);
                vlanid = cti & VLAN_IDMASK;
-               x = ntohs(vet->vet_type);
+               eth_proto = ntohs(vet->vet_type);
 
                ip = (struct ip_udp_hdr *)(inpkt + VLAN_ETHER_HDR_SIZE);
                len -= VLAN_ETHER_HDR_SIZE;
        }
 
-       debug("Receive from protocol 0x%x\n", x);
+       debug("Receive from protocol 0x%x\n", eth_proto);
 
 #if defined(CONFIG_CMD_CDP)
        if (iscdp) {
@@ -950,7 +953,7 @@ NetReceive(uchar *inpkt, int len)
                        return;
        }
 
-       switch (x) {
+       switch (eth_proto) {
 
        case PROT_ARP:
                ArpReceive(et, ip, len);
@@ -989,10 +992,10 @@ NetReceive(uchar *inpkt, int len)
                        return;
                }
                /* If it is not for us, ignore it */
-               tmp = NetReadIP(&ip->ip_dst);
-               if (NetOurIP && tmp != NetOurIP && tmp != 0xFFFFFFFF) {
+               dst_ip = NetReadIP(&ip->ip_dst);
+               if (NetOurIP && dst_ip != NetOurIP && dst_ip != 0xFFFFFFFF) {
 #ifdef CONFIG_MCAST_TFTP
-                       if (Mcast_addr != tmp)
+                       if (Mcast_addr != dst_ip)
 #endif
                                return;
                }
@@ -1232,7 +1235,8 @@ NetSetEther(uchar *xet, uchar * addr, uint prot)
                et->et_protlen = htons(prot);
                return ETHER_HDR_SIZE;
        } else {
-               VLAN_Ethernet_t *vet = (VLAN_Ethernet_t *)xet;
+               struct vlan_ethernet_hdr *vet =
+                       (struct vlan_ethernet_hdr *)xet;
 
                vet->vet_vlan_type = htons(PROT_VLAN);
                vet->vet_tag = htons((0 << 5) | (myvlanid & VLAN_IDMASK));