aboutsummaryrefslogtreecommitdiffstats
path: root/net/decnet/dn_dev.c
diff options
context:
space:
mode:
authorSteven Whitehouse <steve@chygwyn.com>2006-03-21 01:42:39 -0500
committerDavid S. Miller <davem@davemloft.net>2006-03-21 01:42:39 -0500
commitc4ea94ab3710eb2434abe2eab1a479c2dc01f8ac (patch)
tree72e07ca7d2d5fe2de31b3f5a4e64fa411efdf18d /net/decnet/dn_dev.c
parent2c7946a7bf45ae86736ab3b43d0085e43947945c (diff)
[DECnet]: Endian annotation and fixes for DECnet.
The typedef for dn_address has been removed in favour of using __le16 or __u16 directly as appropriate. All the DECnet header files are updated accordingly. The byte ordering of dn_eth2dn() and dn_dn2eth() are both changed since just about all their callers wanted network order rather than host order, so the conversion is now done in the functions themselves. Several missed endianess conversions have been picked up during the conversion process. The nh_gw field in struct dn_fib_info has been changed from a 32 bit field to 16 bits as it ought to be. One or two cases of using htons rather than dn_htons in the routing code have been found and fixed. There are still a few warnings to fix, but this patch deals with the important cases. Signed-off-by: Steven Whitehouse <steve@chygwyn.com> Signed-off-by: Patrick Caulfield <patrick@tykepenguin.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/decnet/dn_dev.c')
-rw-r--r--net/decnet/dn_dev.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c
index efbead83ba7f..cc7b9d9255ef 100644
--- a/net/decnet/dn_dev.c
+++ b/net/decnet/dn_dev.c
@@ -64,7 +64,7 @@ extern struct neigh_table dn_neigh_table;
64/* 64/*
65 * decnet_address is kept in network order. 65 * decnet_address is kept in network order.
66 */ 66 */
67dn_address decnet_address = 0; 67__le16 decnet_address = 0;
68 68
69static DEFINE_RWLOCK(dndev_lock); 69static DEFINE_RWLOCK(dndev_lock);
70static struct net_device *decnet_default_device; 70static struct net_device *decnet_default_device;
@@ -439,7 +439,7 @@ static void dn_dev_del_ifa(struct dn_dev *dn_db, struct dn_ifaddr **ifap, int de
439 *ifap = ifa1->ifa_next; 439 *ifap = ifa1->ifa_next;
440 440
441 if (dn_db->dev->type == ARPHRD_ETHER) { 441 if (dn_db->dev->type == ARPHRD_ETHER) {
442 if (ifa1->ifa_local != dn_htons(dn_eth2dn(dev->dev_addr))) { 442 if (ifa1->ifa_local != dn_eth2dn(dev->dev_addr)) {
443 dn_dn2eth(mac_addr, ifa1->ifa_local); 443 dn_dn2eth(mac_addr, ifa1->ifa_local);
444 dev_mc_delete(dev, mac_addr, ETH_ALEN, 0); 444 dev_mc_delete(dev, mac_addr, ETH_ALEN, 0);
445 } 445 }
@@ -470,7 +470,7 @@ static int dn_dev_insert_ifa(struct dn_dev *dn_db, struct dn_ifaddr *ifa)
470 } 470 }
471 471
472 if (dev->type == ARPHRD_ETHER) { 472 if (dev->type == ARPHRD_ETHER) {
473 if (ifa->ifa_local != dn_htons(dn_eth2dn(dev->dev_addr))) { 473 if (ifa->ifa_local != dn_eth2dn(dev->dev_addr)) {
474 dn_dn2eth(mac_addr, ifa->ifa_local); 474 dn_dn2eth(mac_addr, ifa->ifa_local);
475 dev_mc_add(dev, mac_addr, ETH_ALEN, 0); 475 dev_mc_add(dev, mac_addr, ETH_ALEN, 0);
476 dev_mc_upload(dev); 476 dev_mc_upload(dev);
@@ -561,7 +561,7 @@ int dn_dev_ioctl(unsigned int cmd, void __user *arg)
561 561
562 switch(cmd) { 562 switch(cmd) {
563 case SIOCGIFADDR: 563 case SIOCGIFADDR:
564 *((dn_address *)sdn->sdn_nodeaddr) = ifa->ifa_local; 564 *((__le16 *)sdn->sdn_nodeaddr) = ifa->ifa_local;
565 goto rarok; 565 goto rarok;
566 566
567 case SIOCSIFADDR: 567 case SIOCSIFADDR:
@@ -804,7 +804,7 @@ done:
804 return skb->len; 804 return skb->len;
805} 805}
806 806
807static int dn_dev_get_first(struct net_device *dev, dn_address *addr) 807static int dn_dev_get_first(struct net_device *dev, __le16 *addr)
808{ 808{
809 struct dn_dev *dn_db = (struct dn_dev *)dev->dn_ptr; 809 struct dn_dev *dn_db = (struct dn_dev *)dev->dn_ptr;
810 struct dn_ifaddr *ifa; 810 struct dn_ifaddr *ifa;
@@ -830,7 +830,7 @@ out:
830 * a sensible default. Eventually the routing code will take care of all the 830 * a sensible default. Eventually the routing code will take care of all the
831 * nasties for us I hope. 831 * nasties for us I hope.
832 */ 832 */
833int dn_dev_bind_default(dn_address *addr) 833int dn_dev_bind_default(__le16 *addr)
834{ 834{
835 struct net_device *dev; 835 struct net_device *dev;
836 int rv; 836 int rv;
@@ -853,7 +853,7 @@ static void dn_send_endnode_hello(struct net_device *dev, struct dn_ifaddr *ifa)
853{ 853{
854 struct endnode_hello_message *msg; 854 struct endnode_hello_message *msg;
855 struct sk_buff *skb = NULL; 855 struct sk_buff *skb = NULL;
856 unsigned short int *pktlen; 856 __le16 *pktlen;
857 struct dn_dev *dn_db = (struct dn_dev *)dev->dn_ptr; 857 struct dn_dev *dn_db = (struct dn_dev *)dev->dn_ptr;
858 858
859 if ((skb = dn_alloc_skb(NULL, sizeof(*msg), GFP_ATOMIC)) == NULL) 859 if ((skb = dn_alloc_skb(NULL, sizeof(*msg), GFP_ATOMIC)) == NULL)
@@ -882,7 +882,7 @@ static void dn_send_endnode_hello(struct net_device *dev, struct dn_ifaddr *ifa)
882 msg->datalen = 0x02; 882 msg->datalen = 0x02;
883 memset(msg->data, 0xAA, 2); 883 memset(msg->data, 0xAA, 2);
884 884
885 pktlen = (unsigned short *)skb_push(skb,2); 885 pktlen = (__le16 *)skb_push(skb,2);
886 *pktlen = dn_htons(skb->len - 2); 886 *pktlen = dn_htons(skb->len - 2);
887 887
888 skb->nh.raw = skb->data; 888 skb->nh.raw = skb->data;
@@ -926,7 +926,7 @@ static void dn_send_router_hello(struct net_device *dev, struct dn_ifaddr *ifa)
926 size_t size; 926 size_t size;
927 unsigned char *ptr; 927 unsigned char *ptr;
928 unsigned char *i1, *i2; 928 unsigned char *i1, *i2;
929 unsigned short *pktlen; 929 __le16 *pktlen;
930 char *src; 930 char *src;
931 931
932 if (mtu2blksize(dev) < (26 + 7)) 932 if (mtu2blksize(dev) < (26 + 7))
@@ -955,11 +955,11 @@ static void dn_send_router_hello(struct net_device *dev, struct dn_ifaddr *ifa)
955 ptr += ETH_ALEN; 955 ptr += ETH_ALEN;
956 *ptr++ = dn_db->parms.forwarding == 1 ? 956 *ptr++ = dn_db->parms.forwarding == 1 ?
957 DN_RT_INFO_L1RT : DN_RT_INFO_L2RT; 957 DN_RT_INFO_L1RT : DN_RT_INFO_L2RT;
958 *((unsigned short *)ptr) = dn_htons(mtu2blksize(dev)); 958 *((__le16 *)ptr) = dn_htons(mtu2blksize(dev));
959 ptr += 2; 959 ptr += 2;
960 *ptr++ = dn_db->parms.priority; /* Priority */ 960 *ptr++ = dn_db->parms.priority; /* Priority */
961 *ptr++ = 0; /* Area: Reserved */ 961 *ptr++ = 0; /* Area: Reserved */
962 *((unsigned short *)ptr) = dn_htons((unsigned short)dn_db->parms.t3); 962 *((__le16 *)ptr) = dn_htons((unsigned short)dn_db->parms.t3);
963 ptr += 2; 963 ptr += 2;
964 *ptr++ = 0; /* MPD: Reserved */ 964 *ptr++ = 0; /* MPD: Reserved */
965 i1 = ptr++; 965 i1 = ptr++;
@@ -974,7 +974,7 @@ static void dn_send_router_hello(struct net_device *dev, struct dn_ifaddr *ifa)
974 974
975 skb_trim(skb, (27 + *i2)); 975 skb_trim(skb, (27 + *i2));
976 976
977 pktlen = (unsigned short *)skb_push(skb, 2); 977 pktlen = (__le16 *)skb_push(skb, 2);
978 *pktlen = dn_htons(skb->len - 2); 978 *pktlen = dn_htons(skb->len - 2);
979 979
980 skb->nh.raw = skb->data; 980 skb->nh.raw = skb->data;
@@ -1016,7 +1016,7 @@ static void dn_send_ptp_hello(struct net_device *dev, struct dn_ifaddr *ifa)
1016 ptr = skb_put(skb, 2 + 4 + tdlen); 1016 ptr = skb_put(skb, 2 + 4 + tdlen);
1017 1017
1018 *ptr++ = DN_RT_PKT_HELO; 1018 *ptr++ = DN_RT_PKT_HELO;
1019 *((dn_address *)ptr) = ifa->ifa_local; 1019 *((__le16 *)ptr) = ifa->ifa_local;
1020 ptr += 2; 1020 ptr += 2;
1021 *ptr++ = tdlen; 1021 *ptr++ = tdlen;
1022 1022
@@ -1150,7 +1150,7 @@ struct dn_dev *dn_dev_create(struct net_device *dev, int *err)
1150void dn_dev_up(struct net_device *dev) 1150void dn_dev_up(struct net_device *dev)
1151{ 1151{
1152 struct dn_ifaddr *ifa; 1152 struct dn_ifaddr *ifa;
1153 dn_address addr = decnet_address; 1153 __le16 addr = decnet_address;
1154 int maybe_default = 0; 1154 int maybe_default = 0;
1155 struct dn_dev *dn_db = (struct dn_dev *)dev->dn_ptr; 1155 struct dn_dev *dn_db = (struct dn_dev *)dev->dn_ptr;
1156 1156
@@ -1173,7 +1173,7 @@ void dn_dev_up(struct net_device *dev)
1173 if (dev->type == ARPHRD_ETHER) { 1173 if (dev->type == ARPHRD_ETHER) {
1174 if (memcmp(dev->dev_addr, dn_hiord, 4) != 0) 1174 if (memcmp(dev->dev_addr, dn_hiord, 4) != 0)
1175 return; 1175 return;
1176 addr = dn_htons(dn_eth2dn(dev->dev_addr)); 1176 addr = dn_eth2dn(dev->dev_addr);
1177 maybe_default = 1; 1177 maybe_default = 1;
1178 } 1178 }
1179 1179
@@ -1385,8 +1385,8 @@ static int dn_dev_seq_show(struct seq_file *seq, void *v)
1385 mtu2blksize(dev), 1385 mtu2blksize(dev),
1386 dn_db->parms.priority, 1386 dn_db->parms.priority,
1387 dn_db->parms.state, dn_db->parms.name, 1387 dn_db->parms.state, dn_db->parms.name,
1388 dn_db->router ? dn_addr2asc(dn_ntohs(*(dn_address *)dn_db->router->primary_key), router_buf) : "", 1388 dn_db->router ? dn_addr2asc(dn_ntohs(*(__le16 *)dn_db->router->primary_key), router_buf) : "",
1389 dn_db->peer ? dn_addr2asc(dn_ntohs(*(dn_address *)dn_db->peer->primary_key), peer_buf) : ""); 1389 dn_db->peer ? dn_addr2asc(dn_ntohs(*(__le16 *)dn_db->peer->primary_key), peer_buf) : "");
1390 } 1390 }
1391 return 0; 1391 return 0;
1392} 1392}