--- zzzz-none-000/linux-2.6.19.2/net/ipx/af_ipx.c 2007-01-10 19:10:37.000000000 +0000 +++ davinci-8020-5505/linux-2.6.19.2/net/ipx/af_ipx.c 2007-01-11 07:38:19.000000000 +0000 @@ -83,13 +83,13 @@ struct ipx_interface *ipx_primary_net; struct ipx_interface *ipx_internal_net; -extern int ipxrtr_add_route(__be32 network, struct ipx_interface *intrfc, +extern int ipxrtr_add_route(__u32 network, struct ipx_interface *intrfc, unsigned char *node); extern void ipxrtr_del_routes(struct ipx_interface *intrfc); extern int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx, struct iovec *iov, int len, int noblock); extern int ipxrtr_route_skb(struct sk_buff *skb); -extern struct ipx_route *ipxrtr_lookup(__be32 net); +extern struct ipx_route *ipxrtr_lookup(__u32 net); extern int ipxrtr_ioctl(unsigned int cmd, void __user *arg); #undef IPX_REFCNT_DEBUG @@ -177,7 +177,7 @@ } static struct ipx_interface *__ipxitf_find_using_phys(struct net_device *dev, - __be16 datalink) + unsigned short datalink) { struct ipx_interface *i; @@ -190,7 +190,7 @@ } static struct ipx_interface *ipxitf_find_using_phys(struct net_device *dev, - __be16 datalink) + unsigned short datalink) { struct ipx_interface *i; @@ -202,7 +202,7 @@ return i; } -struct ipx_interface *ipxitf_find_using_net(__be32 net) +struct ipx_interface *ipxitf_find_using_net(__u32 net) { struct ipx_interface *i; @@ -237,7 +237,7 @@ /* caller must hold intrfc->if_sklist_lock */ static struct sock *__ipxitf_find_socket(struct ipx_interface *intrfc, - __be16 port) + unsigned short port) { struct sock *s; struct hlist_node *node; @@ -252,7 +252,7 @@ /* caller must hold a reference to intrfc */ static struct sock *ipxitf_find_socket(struct ipx_interface *intrfc, - __be16 port) + unsigned short port) { struct sock *s; @@ -268,7 +268,7 @@ #ifdef CONFIG_IPX_INTERN static struct sock *ipxitf_find_internal_socket(struct ipx_interface *intrfc, unsigned char *ipx_node, - __be16 port) + unsigned short port) { struct sock *s; struct hlist_node *node; @@ -600,10 +600,10 @@ /* see if we need to include the netnum in the route list */ if (IPX_SKB_CB(skb)->last_hop.index >= 0) { - __be32 *last_hop = (__be32 *)(((u8 *) skb->data) + + u32 *last_hop = (u32 *)(((u8 *) skb->data) + sizeof(struct ipxhdr) + IPX_SKB_CB(skb)->last_hop.index * - sizeof(__be32)); + sizeof(u32)); *last_hop = IPX_SKB_CB(skb)->last_hop.netnum; IPX_SKB_CB(skb)->last_hop.index = -1; } @@ -772,7 +772,7 @@ } else { printk(KERN_WARNING "IPX: Network number collision " "%lx\n %s %s and %s %s\n", - (unsigned long) ntohl(cb->ipx_source_net), + (unsigned long) htonl(cb->ipx_source_net), ipx_device_name(i), ipx_frame_name(i->if_dlink_type), ipx_device_name(intrfc), @@ -812,7 +812,7 @@ int i, rc = -EINVAL; struct ipx_interface *ifcs; char *c; - __be32 *l; + u32 *l; /* Illegal packet - too many hops or too short */ /* We decide to throw it away: no broadcasting, no local processing. @@ -833,7 +833,7 @@ goto out; c = ((u8 *) ipx) + sizeof(struct ipxhdr); - l = (__be32 *) c; + l = (u32 *) c; /* Don't broadcast packet if already seen this net */ for (i = 0; i < IPX_SKB_CB(skb)->ipx_tctrl; i++) @@ -855,7 +855,7 @@ /* That aren't in the list */ if (ifcs == intrfc) continue; - l = (__be32 *) c; + l = (__u32 *) c; /* don't consider the last entry in the packet list, * it is our netnum, and it is not there yet */ for (i = 0; i < IPX_SKB_CB(skb)->ipx_tctrl; i++) @@ -885,8 +885,8 @@ ipx_primary_net = intrfc; } -static struct ipx_interface *ipxitf_alloc(struct net_device *dev, __be32 netnum, - __be16 dlink_type, +static struct ipx_interface *ipxitf_alloc(struct net_device *dev, __u32 netnum, + unsigned short dlink_type, struct datalink_proto *dlink, unsigned char internal, int ipx_offset) @@ -960,7 +960,7 @@ static int ipxitf_create(struct ipx_interface_definition *idef) { struct net_device *dev; - __be16 dlink_type = 0; + unsigned short dlink_type = 0; struct datalink_proto *datalink = NULL; struct ipx_interface *intrfc; int rc; @@ -1073,7 +1073,7 @@ static int ipxitf_delete(struct ipx_interface_definition *idef) { struct net_device *dev = NULL; - __be16 dlink_type = 0; + unsigned short dlink_type = 0; struct ipx_interface *intrfc; int rc = 0; @@ -1110,7 +1110,7 @@ } static struct ipx_interface *ipxitf_auto_create(struct net_device *dev, - __be16 dlink_type) + unsigned short dlink_type) { struct ipx_interface *intrfc = NULL; struct datalink_proto *datalink; @@ -1122,7 +1122,7 @@ if (dev->addr_len > IPX_NODE_LEN) goto out; - switch (ntohs(dlink_type)) { + switch (htons(dlink_type)) { case ETH_P_IPX: datalink = pEII_datalink; break; case ETH_P_802_2: datalink = p8022_datalink; break; case ETH_P_SNAP: datalink = pSNAP_datalink; break; @@ -1234,27 +1234,27 @@ /* Note: We assume ipx_tctrl==0 and htons(length)==ipx_pktsize */ /* This functions should *not* mess with packet contents */ -__be16 ipx_cksum(struct ipxhdr *packet, int length) +__u16 ipx_cksum(struct ipxhdr *packet, int length) { /* * NOTE: sum is a net byte order quantity, which optimizes the * loop. This only works on big and little endian machines. (I * don't know of a machine that isn't.) */ - /* handle the first 3 words separately; checksum should be skipped - * and ipx_tctrl masked out */ - __u16 *p = (__u16 *)packet; - __u32 sum = p[1] + (p[2] & (__force u16)htons(0x00ff)); - __u32 i = (length >> 1) - 3; /* Number of remaining complete words */ - - /* Loop through them */ - p += 3; - while (i--) + /* start at ipx_dest - We skip the checksum field and start with + * ipx_type before the loop, not considering ipx_tctrl in the calc */ + __u16 *p = (__u16 *)&packet->ipx_dest; + __u32 i = (length >> 1) - 1; /* Number of complete words */ + __u32 sum = packet->ipx_type << sizeof(packet->ipx_tctrl); + + /* Loop through all complete words except the checksum field, + * ipx_type (accounted above) and ipx_tctrl (not used in the cksum) */ + while (--i) sum += *p++; /* Add on the last part word if it exists */ if (packet->ipx_pktsize & htons(1)) - sum += (__force u16)htons(0xff00) & *p; + sum += ntohs(0xff00) & *p; /* Do final fixup */ sum = (sum & 0xffff) + (sum >> 16); @@ -1263,17 +1263,10 @@ if (sum >= 0x10000) sum++; - /* - * Leave 0 alone; we don't want 0xffff here. Note that we can't get - * here with 0x10000, so this check is the same as ((__u16)sum) - */ - if (sum) - sum = ~sum; - - return (__force __be16)sum; + return ~sum; } -const char *ipx_frame_name(__be16 frame) +const char *ipx_frame_name(unsigned short frame) { char* rc = "None"; @@ -1408,7 +1401,7 @@ /* caller must hold a reference to intrfc */ -static __be16 ipx_first_free_socketnum(struct ipx_interface *intrfc) +static unsigned short ipx_first_free_socketnum(struct ipx_interface *intrfc) { unsigned short socketNum = intrfc->if_sknum; @@ -1417,7 +1410,7 @@ if (socketNum < IPX_MIN_EPHEMERAL_SOCKET) socketNum = IPX_MIN_EPHEMERAL_SOCKET; - while (__ipxitf_find_socket(intrfc, htons(socketNum))) + while (__ipxitf_find_socket(intrfc, ntohs(socketNum))) if (socketNum > IPX_MAX_EPHEMERAL_SOCKET) socketNum = IPX_MIN_EPHEMERAL_SOCKET; else @@ -1426,7 +1419,7 @@ spin_unlock_bh(&intrfc->if_sklist_lock); intrfc->if_sknum = socketNum; - return htons(socketNum); + return ntohs(socketNum); } static int ipx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) @@ -1480,7 +1473,7 @@ ipxs->port)) { SOCK_DEBUG(sk, "IPX: bind failed because port %X in use.\n", - ntohs(addr->sipx_port)); + ntohs((int)addr->sipx_port)); goto out_put; } } else { @@ -1495,7 +1488,7 @@ if (ipxitf_find_socket(intrfc, addr->sipx_port)) { SOCK_DEBUG(sk, "IPX: bind failed because port %X in use.\n", - ntohs(addr->sipx_port)); + ntohs((int)addr->sipx_port)); goto out_put; } } @@ -1672,7 +1665,7 @@ intrfc = ipxitf_find_using_phys(dev, pt->type); if (!intrfc) { if (ipxcfg_auto_create_interfaces && - IPX_SKB_CB(skb)->ipx_dest_net) { + ntohl(IPX_SKB_CB(skb)->ipx_dest_net)) { intrfc = ipxitf_auto_create(dev, pt->type); if (intrfc) ipxitf_hold(intrfc);