diff options
-rw-r--r-- | include/net/dn.h | 8 | ||||
-rw-r--r-- | include/net/dn_fib.h | 6 | ||||
-rw-r--r-- | net/decnet/af_decnet.c | 62 | ||||
-rw-r--r-- | net/decnet/dn_dev.c | 20 | ||||
-rw-r--r-- | net/decnet/dn_neigh.c | 18 | ||||
-rw-r--r-- | net/decnet/dn_nsp_in.c | 28 | ||||
-rw-r--r-- | net/decnet/dn_nsp_out.c | 22 | ||||
-rw-r--r-- | net/decnet/dn_route.c | 18 | ||||
-rw-r--r-- | net/decnet/dn_table.c | 2 | ||||
-rw-r--r-- | net/decnet/sysctl_net_decnet.c | 4 |
10 files changed, 94 insertions, 94 deletions
diff --git a/include/net/dn.h b/include/net/dn.h index 627778384c84..7cd6bb83f7ab 100644 --- a/include/net/dn.h +++ b/include/net/dn.h | |||
@@ -4,9 +4,7 @@ | |||
4 | #include <linux/dn.h> | 4 | #include <linux/dn.h> |
5 | #include <net/sock.h> | 5 | #include <net/sock.h> |
6 | #include <asm/byteorder.h> | 6 | #include <asm/byteorder.h> |
7 | 7 | #include <asm/unalignedh> | |
8 | #define dn_ntohs(x) le16_to_cpu(x) | ||
9 | #define dn_htons(x) cpu_to_le16(x) | ||
10 | 8 | ||
11 | struct dn_scp /* Session Control Port */ | 9 | struct dn_scp /* Session Control Port */ |
12 | { | 10 | { |
@@ -175,7 +173,7 @@ struct dn_skb_cb { | |||
175 | 173 | ||
176 | static inline __le16 dn_eth2dn(unsigned char *ethaddr) | 174 | static inline __le16 dn_eth2dn(unsigned char *ethaddr) |
177 | { | 175 | { |
178 | return dn_htons(ethaddr[4] | (ethaddr[5] << 8)); | 176 | return get_unaligned((__le16 *)(ethaddr + 4)); |
179 | } | 177 | } |
180 | 178 | ||
181 | static inline __le16 dn_saddr2dn(struct sockaddr_dn *saddr) | 179 | static inline __le16 dn_saddr2dn(struct sockaddr_dn *saddr) |
@@ -185,7 +183,7 @@ static inline __le16 dn_saddr2dn(struct sockaddr_dn *saddr) | |||
185 | 183 | ||
186 | static inline void dn_dn2eth(unsigned char *ethaddr, __le16 addr) | 184 | static inline void dn_dn2eth(unsigned char *ethaddr, __le16 addr) |
187 | { | 185 | { |
188 | __u16 a = dn_ntohs(addr); | 186 | __u16 a = le16_to_cpu(addr); |
189 | ethaddr[0] = 0xAA; | 187 | ethaddr[0] = 0xAA; |
190 | ethaddr[1] = 0x00; | 188 | ethaddr[1] = 0x00; |
191 | ethaddr[2] = 0x04; | 189 | ethaddr[2] = 0x04; |
diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h index 30125119c950..c378be7bf960 100644 --- a/include/net/dn_fib.h +++ b/include/net/dn_fib.h | |||
@@ -181,9 +181,9 @@ static inline void dn_fib_res_put(struct dn_fib_res *res) | |||
181 | 181 | ||
182 | static inline __le16 dnet_make_mask(int n) | 182 | static inline __le16 dnet_make_mask(int n) |
183 | { | 183 | { |
184 | if (n) | 184 | if (n) |
185 | return dn_htons(~((1<<(16-n))-1)); | 185 | return cpu_to_le16(~((1 << (16 - n)) - 1)); |
186 | return 0; | 186 | return cpu_to_le16(0); |
187 | } | 187 | } |
188 | 188 | ||
189 | #endif /* _NET_DN_FIB_H */ | 189 | #endif /* _NET_DN_FIB_H */ |
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c index 3c23ab33dbc0..cf0e18499297 100644 --- a/net/decnet/af_decnet.c +++ b/net/decnet/af_decnet.c | |||
@@ -167,7 +167,7 @@ static struct hlist_head *dn_find_list(struct sock *sk) | |||
167 | if (scp->addr.sdn_flags & SDF_WILD) | 167 | if (scp->addr.sdn_flags & SDF_WILD) |
168 | return hlist_empty(&dn_wild_sk) ? &dn_wild_sk : NULL; | 168 | return hlist_empty(&dn_wild_sk) ? &dn_wild_sk : NULL; |
169 | 169 | ||
170 | return &dn_sk_hash[dn_ntohs(scp->addrloc) & DN_SK_HASH_MASK]; | 170 | return &dn_sk_hash[le16_to_cpu(scp->addrloc) & DN_SK_HASH_MASK]; |
171 | } | 171 | } |
172 | 172 | ||
173 | /* | 173 | /* |
@@ -181,7 +181,7 @@ static int check_port(__le16 port) | |||
181 | if (port == 0) | 181 | if (port == 0) |
182 | return -1; | 182 | return -1; |
183 | 183 | ||
184 | sk_for_each(sk, node, &dn_sk_hash[dn_ntohs(port) & DN_SK_HASH_MASK]) { | 184 | sk_for_each(sk, node, &dn_sk_hash[le16_to_cpu(port) & DN_SK_HASH_MASK]) { |
185 | struct dn_scp *scp = DN_SK(sk); | 185 | struct dn_scp *scp = DN_SK(sk); |
186 | if (scp->addrloc == port) | 186 | if (scp->addrloc == port) |
187 | return -1; | 187 | return -1; |
@@ -195,12 +195,12 @@ static unsigned short port_alloc(struct sock *sk) | |||
195 | static unsigned short port = 0x2000; | 195 | static unsigned short port = 0x2000; |
196 | unsigned short i_port = port; | 196 | unsigned short i_port = port; |
197 | 197 | ||
198 | while(check_port(dn_htons(++port)) != 0) { | 198 | while(check_port(cpu_to_le16(++port)) != 0) { |
199 | if (port == i_port) | 199 | if (port == i_port) |
200 | return 0; | 200 | return 0; |
201 | } | 201 | } |
202 | 202 | ||
203 | scp->addrloc = dn_htons(port); | 203 | scp->addrloc = cpu_to_le16(port); |
204 | 204 | ||
205 | return 1; | 205 | return 1; |
206 | } | 206 | } |
@@ -255,7 +255,7 @@ static struct hlist_head *listen_hash(struct sockaddr_dn *addr) | |||
255 | 255 | ||
256 | if (hash == 0) { | 256 | if (hash == 0) { |
257 | hash = addr->sdn_objnamel; | 257 | hash = addr->sdn_objnamel; |
258 | for(i = 0; i < dn_ntohs(addr->sdn_objnamel); i++) { | 258 | for(i = 0; i < le16_to_cpu(addr->sdn_objnamel); i++) { |
259 | hash ^= addr->sdn_objname[i]; | 259 | hash ^= addr->sdn_objname[i]; |
260 | hash ^= (hash << 3); | 260 | hash ^= (hash << 3); |
261 | } | 261 | } |
@@ -297,16 +297,16 @@ int dn_sockaddr2username(struct sockaddr_dn *sdn, unsigned char *buf, unsigned c | |||
297 | break; | 297 | break; |
298 | case 1: | 298 | case 1: |
299 | *buf++ = 0; | 299 | *buf++ = 0; |
300 | *buf++ = dn_ntohs(sdn->sdn_objnamel); | 300 | *buf++ = le16_to_cpu(sdn->sdn_objnamel); |
301 | memcpy(buf, sdn->sdn_objname, dn_ntohs(sdn->sdn_objnamel)); | 301 | memcpy(buf, sdn->sdn_objname, le16_to_cpu(sdn->sdn_objnamel)); |
302 | len = 3 + dn_ntohs(sdn->sdn_objnamel); | 302 | len = 3 + le16_to_cpu(sdn->sdn_objnamel); |
303 | break; | 303 | break; |
304 | case 2: | 304 | case 2: |
305 | memset(buf, 0, 5); | 305 | memset(buf, 0, 5); |
306 | buf += 5; | 306 | buf += 5; |
307 | *buf++ = dn_ntohs(sdn->sdn_objnamel); | 307 | *buf++ = le16_to_cpu(sdn->sdn_objnamel); |
308 | memcpy(buf, sdn->sdn_objname, dn_ntohs(sdn->sdn_objnamel)); | 308 | memcpy(buf, sdn->sdn_objname, le16_to_cpu(sdn->sdn_objnamel)); |
309 | len = 7 + dn_ntohs(sdn->sdn_objnamel); | 309 | len = 7 + le16_to_cpu(sdn->sdn_objnamel); |
310 | break; | 310 | break; |
311 | } | 311 | } |
312 | 312 | ||
@@ -327,7 +327,7 @@ int dn_username2sockaddr(unsigned char *data, int len, struct sockaddr_dn *sdn, | |||
327 | int namel = 12; | 327 | int namel = 12; |
328 | 328 | ||
329 | sdn->sdn_objnum = 0; | 329 | sdn->sdn_objnum = 0; |
330 | sdn->sdn_objnamel = dn_htons(0); | 330 | sdn->sdn_objnamel = cpu_to_le16(0); |
331 | memset(sdn->sdn_objname, 0, DN_MAXOBJL); | 331 | memset(sdn->sdn_objname, 0, DN_MAXOBJL); |
332 | 332 | ||
333 | if (len < 2) | 333 | if (len < 2) |
@@ -361,13 +361,13 @@ int dn_username2sockaddr(unsigned char *data, int len, struct sockaddr_dn *sdn, | |||
361 | if (len < 0) | 361 | if (len < 0) |
362 | return -1; | 362 | return -1; |
363 | 363 | ||
364 | sdn->sdn_objnamel = dn_htons(*data++); | 364 | sdn->sdn_objnamel = cpu_to_le16(*data++); |
365 | len -= dn_ntohs(sdn->sdn_objnamel); | 365 | len -= le16_to_cpu(sdn->sdn_objnamel); |
366 | 366 | ||
367 | if ((len < 0) || (dn_ntohs(sdn->sdn_objnamel) > namel)) | 367 | if ((len < 0) || (le16_to_cpu(sdn->sdn_objnamel) > namel)) |
368 | return -1; | 368 | return -1; |
369 | 369 | ||
370 | memcpy(sdn->sdn_objname, data, dn_ntohs(sdn->sdn_objnamel)); | 370 | memcpy(sdn->sdn_objname, data, le16_to_cpu(sdn->sdn_objnamel)); |
371 | 371 | ||
372 | return size - len; | 372 | return size - len; |
373 | } | 373 | } |
@@ -391,7 +391,7 @@ struct sock *dn_sklist_find_listener(struct sockaddr_dn *addr) | |||
391 | continue; | 391 | continue; |
392 | if (scp->addr.sdn_objnamel != addr->sdn_objnamel) | 392 | if (scp->addr.sdn_objnamel != addr->sdn_objnamel) |
393 | continue; | 393 | continue; |
394 | if (memcmp(scp->addr.sdn_objname, addr->sdn_objname, dn_ntohs(addr->sdn_objnamel)) != 0) | 394 | if (memcmp(scp->addr.sdn_objname, addr->sdn_objname, le16_to_cpu(addr->sdn_objnamel)) != 0) |
395 | continue; | 395 | continue; |
396 | } | 396 | } |
397 | sock_hold(sk); | 397 | sock_hold(sk); |
@@ -419,7 +419,7 @@ struct sock *dn_find_by_skb(struct sk_buff *skb) | |||
419 | struct dn_scp *scp; | 419 | struct dn_scp *scp; |
420 | 420 | ||
421 | read_lock(&dn_hash_lock); | 421 | read_lock(&dn_hash_lock); |
422 | sk_for_each(sk, node, &dn_sk_hash[dn_ntohs(cb->dst_port) & DN_SK_HASH_MASK]) { | 422 | sk_for_each(sk, node, &dn_sk_hash[le16_to_cpu(cb->dst_port) & DN_SK_HASH_MASK]) { |
423 | scp = DN_SK(sk); | 423 | scp = DN_SK(sk); |
424 | if (cb->src != dn_saddr2dn(&scp->peer)) | 424 | if (cb->src != dn_saddr2dn(&scp->peer)) |
425 | continue; | 425 | continue; |
@@ -734,10 +734,10 @@ static int dn_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
734 | if (saddr->sdn_family != AF_DECnet) | 734 | if (saddr->sdn_family != AF_DECnet) |
735 | return -EINVAL; | 735 | return -EINVAL; |
736 | 736 | ||
737 | if (dn_ntohs(saddr->sdn_nodeaddrl) && (dn_ntohs(saddr->sdn_nodeaddrl) != 2)) | 737 | if (le16_to_cpu(saddr->sdn_nodeaddrl) && (le16_to_cpu(saddr->sdn_nodeaddrl) != 2)) |
738 | return -EINVAL; | 738 | return -EINVAL; |
739 | 739 | ||
740 | if (dn_ntohs(saddr->sdn_objnamel) > DN_MAXOBJL) | 740 | if (le16_to_cpu(saddr->sdn_objnamel) > DN_MAXOBJL) |
741 | return -EINVAL; | 741 | return -EINVAL; |
742 | 742 | ||
743 | if (saddr->sdn_flags & ~SDF_WILD) | 743 | if (saddr->sdn_flags & ~SDF_WILD) |
@@ -748,7 +748,7 @@ static int dn_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
748 | return -EACCES; | 748 | return -EACCES; |
749 | 749 | ||
750 | if (!(saddr->sdn_flags & SDF_WILD)) { | 750 | if (!(saddr->sdn_flags & SDF_WILD)) { |
751 | if (dn_ntohs(saddr->sdn_nodeaddrl)) { | 751 | if (le16_to_cpu(saddr->sdn_nodeaddrl)) { |
752 | read_lock(&dev_base_lock); | 752 | read_lock(&dev_base_lock); |
753 | ldev = NULL; | 753 | ldev = NULL; |
754 | for_each_netdev(&init_net, dev) { | 754 | for_each_netdev(&init_net, dev) { |
@@ -799,15 +799,15 @@ static int dn_auto_bind(struct socket *sock) | |||
799 | if ((scp->accessdata.acc_accl != 0) && | 799 | if ((scp->accessdata.acc_accl != 0) && |
800 | (scp->accessdata.acc_accl <= 12)) { | 800 | (scp->accessdata.acc_accl <= 12)) { |
801 | 801 | ||
802 | scp->addr.sdn_objnamel = dn_htons(scp->accessdata.acc_accl); | 802 | scp->addr.sdn_objnamel = cpu_to_le16(scp->accessdata.acc_accl); |
803 | memcpy(scp->addr.sdn_objname, scp->accessdata.acc_acc, dn_ntohs(scp->addr.sdn_objnamel)); | 803 | memcpy(scp->addr.sdn_objname, scp->accessdata.acc_acc, le16_to_cpu(scp->addr.sdn_objnamel)); |
804 | 804 | ||
805 | scp->accessdata.acc_accl = 0; | 805 | scp->accessdata.acc_accl = 0; |
806 | memset(scp->accessdata.acc_acc, 0, 40); | 806 | memset(scp->accessdata.acc_acc, 0, 40); |
807 | } | 807 | } |
808 | /* End of compatibility stuff */ | 808 | /* End of compatibility stuff */ |
809 | 809 | ||
810 | scp->addr.sdn_add.a_len = dn_htons(2); | 810 | scp->addr.sdn_add.a_len = cpu_to_le16(2); |
811 | rv = dn_dev_bind_default((__le16 *)scp->addr.sdn_add.a_addr); | 811 | rv = dn_dev_bind_default((__le16 *)scp->addr.sdn_add.a_addr); |
812 | if (rv == 0) { | 812 | if (rv == 0) { |
813 | rv = dn_hash_sock(sk); | 813 | rv = dn_hash_sock(sk); |
@@ -1027,7 +1027,7 @@ static void dn_user_copy(struct sk_buff *skb, struct optdata_dn *opt) | |||
1027 | u16 len = *ptr++; /* yes, it's 8bit on the wire */ | 1027 | u16 len = *ptr++; /* yes, it's 8bit on the wire */ |
1028 | 1028 | ||
1029 | BUG_ON(len > 16); /* we've checked the contents earlier */ | 1029 | BUG_ON(len > 16); /* we've checked the contents earlier */ |
1030 | opt->opt_optl = dn_htons(len); | 1030 | opt->opt_optl = cpu_to_le16(len); |
1031 | opt->opt_status = 0; | 1031 | opt->opt_status = 0; |
1032 | memcpy(opt->opt_data, ptr, len); | 1032 | memcpy(opt->opt_data, ptr, len); |
1033 | skb_pull(skb, len + 1); | 1033 | skb_pull(skb, len + 1); |
@@ -1375,7 +1375,7 @@ static int __dn_setsockopt(struct socket *sock, int level,int optname, char __us | |||
1375 | if (optlen != sizeof(struct optdata_dn)) | 1375 | if (optlen != sizeof(struct optdata_dn)) |
1376 | return -EINVAL; | 1376 | return -EINVAL; |
1377 | 1377 | ||
1378 | if (dn_ntohs(u.opt.opt_optl) > 16) | 1378 | if (le16_to_cpu(u.opt.opt_optl) > 16) |
1379 | return -EINVAL; | 1379 | return -EINVAL; |
1380 | 1380 | ||
1381 | memcpy(&scp->conndata_out, &u.opt, optlen); | 1381 | memcpy(&scp->conndata_out, &u.opt, optlen); |
@@ -1388,7 +1388,7 @@ static int __dn_setsockopt(struct socket *sock, int level,int optname, char __us | |||
1388 | if (optlen != sizeof(struct optdata_dn)) | 1388 | if (optlen != sizeof(struct optdata_dn)) |
1389 | return -EINVAL; | 1389 | return -EINVAL; |
1390 | 1390 | ||
1391 | if (dn_ntohs(u.opt.opt_optl) > 16) | 1391 | if (le16_to_cpu(u.opt.opt_optl) > 16) |
1392 | return -EINVAL; | 1392 | return -EINVAL; |
1393 | 1393 | ||
1394 | memcpy(&scp->discdata_out, &u.opt, optlen); | 1394 | memcpy(&scp->discdata_out, &u.opt, optlen); |
@@ -2213,12 +2213,12 @@ static void dn_printable_object(struct sockaddr_dn *dn, unsigned char *buf) | |||
2213 | { | 2213 | { |
2214 | int i; | 2214 | int i; |
2215 | 2215 | ||
2216 | switch (dn_ntohs(dn->sdn_objnamel)) { | 2216 | switch (le16_to_cpu(dn->sdn_objnamel)) { |
2217 | case 0: | 2217 | case 0: |
2218 | sprintf(buf, "%d", dn->sdn_objnum); | 2218 | sprintf(buf, "%d", dn->sdn_objnum); |
2219 | break; | 2219 | break; |
2220 | default: | 2220 | default: |
2221 | for (i = 0; i < dn_ntohs(dn->sdn_objnamel); i++) { | 2221 | for (i = 0; i < le16_to_cpu(dn->sdn_objnamel); i++) { |
2222 | buf[i] = dn->sdn_objname[i]; | 2222 | buf[i] = dn->sdn_objname[i]; |
2223 | if (IS_NOT_PRINTABLE(buf[i])) | 2223 | if (IS_NOT_PRINTABLE(buf[i])) |
2224 | buf[i] = '.'; | 2224 | buf[i] = '.'; |
@@ -2281,7 +2281,7 @@ static inline void dn_socket_format_entry(struct seq_file *seq, struct sock *sk) | |||
2281 | seq_printf(seq, | 2281 | seq_printf(seq, |
2282 | "%6s/%04X %04d:%04d %04d:%04d %01d %-16s " | 2282 | "%6s/%04X %04d:%04d %04d:%04d %01d %-16s " |
2283 | "%6s/%04X %04d:%04d %04d:%04d %01d %-16s %4s %s\n", | 2283 | "%6s/%04X %04d:%04d %04d:%04d %01d %-16s %4s %s\n", |
2284 | dn_addr2asc(dn_ntohs(dn_saddr2dn(&scp->addr)), buf1), | 2284 | dn_addr2asc(le16_to_cpu(dn_saddr2dn(&scp->addr)), buf1), |
2285 | scp->addrloc, | 2285 | scp->addrloc, |
2286 | scp->numdat, | 2286 | scp->numdat, |
2287 | scp->numoth, | 2287 | scp->numoth, |
@@ -2289,7 +2289,7 @@ static inline void dn_socket_format_entry(struct seq_file *seq, struct sock *sk) | |||
2289 | scp->ackxmt_oth, | 2289 | scp->ackxmt_oth, |
2290 | scp->flowloc_sw, | 2290 | scp->flowloc_sw, |
2291 | local_object, | 2291 | local_object, |
2292 | dn_addr2asc(dn_ntohs(dn_saddr2dn(&scp->peer)), buf2), | 2292 | dn_addr2asc(le16_to_cpu(dn_saddr2dn(&scp->peer)), buf2), |
2293 | scp->addrrem, | 2293 | scp->addrrem, |
2294 | scp->numdat_rcv, | 2294 | scp->numdat_rcv, |
2295 | scp->numoth_rcv, | 2295 | scp->numoth_rcv, |
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c index 28e26bd08e24..424d86ac12fe 100644 --- a/net/decnet/dn_dev.c +++ b/net/decnet/dn_dev.c | |||
@@ -885,7 +885,7 @@ static void dn_send_endnode_hello(struct net_device *dev, struct dn_ifaddr *ifa) | |||
885 | memcpy(msg->tiver, dn_eco_version, 3); | 885 | memcpy(msg->tiver, dn_eco_version, 3); |
886 | dn_dn2eth(msg->id, ifa->ifa_local); | 886 | dn_dn2eth(msg->id, ifa->ifa_local); |
887 | msg->iinfo = DN_RT_INFO_ENDN; | 887 | msg->iinfo = DN_RT_INFO_ENDN; |
888 | msg->blksize = dn_htons(mtu2blksize(dev)); | 888 | msg->blksize = cpu_to_le16(mtu2blksize(dev)); |
889 | msg->area = 0x00; | 889 | msg->area = 0x00; |
890 | memset(msg->seed, 0, 8); | 890 | memset(msg->seed, 0, 8); |
891 | memcpy(msg->neighbor, dn_hiord, ETH_ALEN); | 891 | memcpy(msg->neighbor, dn_hiord, ETH_ALEN); |
@@ -895,13 +895,13 @@ static void dn_send_endnode_hello(struct net_device *dev, struct dn_ifaddr *ifa) | |||
895 | dn_dn2eth(msg->neighbor, dn->addr); | 895 | dn_dn2eth(msg->neighbor, dn->addr); |
896 | } | 896 | } |
897 | 897 | ||
898 | msg->timer = dn_htons((unsigned short)dn_db->parms.t3); | 898 | msg->timer = cpu_to_le16((unsigned short)dn_db->parms.t3); |
899 | msg->mpd = 0x00; | 899 | msg->mpd = 0x00; |
900 | msg->datalen = 0x02; | 900 | msg->datalen = 0x02; |
901 | memset(msg->data, 0xAA, 2); | 901 | memset(msg->data, 0xAA, 2); |
902 | 902 | ||
903 | pktlen = (__le16 *)skb_push(skb,2); | 903 | pktlen = (__le16 *)skb_push(skb,2); |
904 | *pktlen = dn_htons(skb->len - 2); | 904 | *pktlen = cpu_to_le16(skb->len - 2); |
905 | 905 | ||
906 | skb_reset_network_header(skb); | 906 | skb_reset_network_header(skb); |
907 | 907 | ||
@@ -929,7 +929,7 @@ static int dn_am_i_a_router(struct dn_neigh *dn, struct dn_dev *dn_db, struct dn | |||
929 | if (dn->priority != dn_db->parms.priority) | 929 | if (dn->priority != dn_db->parms.priority) |
930 | return 0; | 930 | return 0; |
931 | 931 | ||
932 | if (dn_ntohs(dn->addr) < dn_ntohs(ifa->ifa_local)) | 932 | if (le16_to_cpu(dn->addr) < le16_to_cpu(ifa->ifa_local)) |
933 | return 1; | 933 | return 1; |
934 | 934 | ||
935 | return 0; | 935 | return 0; |
@@ -973,11 +973,11 @@ static void dn_send_router_hello(struct net_device *dev, struct dn_ifaddr *ifa) | |||
973 | ptr += ETH_ALEN; | 973 | ptr += ETH_ALEN; |
974 | *ptr++ = dn_db->parms.forwarding == 1 ? | 974 | *ptr++ = dn_db->parms.forwarding == 1 ? |
975 | DN_RT_INFO_L1RT : DN_RT_INFO_L2RT; | 975 | DN_RT_INFO_L1RT : DN_RT_INFO_L2RT; |
976 | *((__le16 *)ptr) = dn_htons(mtu2blksize(dev)); | 976 | *((__le16 *)ptr) = cpu_to_le16(mtu2blksize(dev)); |
977 | ptr += 2; | 977 | ptr += 2; |
978 | *ptr++ = dn_db->parms.priority; /* Priority */ | 978 | *ptr++ = dn_db->parms.priority; /* Priority */ |
979 | *ptr++ = 0; /* Area: Reserved */ | 979 | *ptr++ = 0; /* Area: Reserved */ |
980 | *((__le16 *)ptr) = dn_htons((unsigned short)dn_db->parms.t3); | 980 | *((__le16 *)ptr) = cpu_to_le16((unsigned short)dn_db->parms.t3); |
981 | ptr += 2; | 981 | ptr += 2; |
982 | *ptr++ = 0; /* MPD: Reserved */ | 982 | *ptr++ = 0; /* MPD: Reserved */ |
983 | i1 = ptr++; | 983 | i1 = ptr++; |
@@ -993,7 +993,7 @@ static void dn_send_router_hello(struct net_device *dev, struct dn_ifaddr *ifa) | |||
993 | skb_trim(skb, (27 + *i2)); | 993 | skb_trim(skb, (27 + *i2)); |
994 | 994 | ||
995 | pktlen = (__le16 *)skb_push(skb, 2); | 995 | pktlen = (__le16 *)skb_push(skb, 2); |
996 | *pktlen = dn_htons(skb->len - 2); | 996 | *pktlen = cpu_to_le16(skb->len - 2); |
997 | 997 | ||
998 | skb_reset_network_header(skb); | 998 | skb_reset_network_header(skb); |
999 | 999 | ||
@@ -1401,8 +1401,8 @@ static int dn_dev_seq_show(struct seq_file *seq, void *v) | |||
1401 | mtu2blksize(dev), | 1401 | mtu2blksize(dev), |
1402 | dn_db->parms.priority, | 1402 | dn_db->parms.priority, |
1403 | dn_db->parms.state, dn_db->parms.name, | 1403 | dn_db->parms.state, dn_db->parms.name, |
1404 | dn_db->router ? dn_addr2asc(dn_ntohs(*(__le16 *)dn_db->router->primary_key), router_buf) : "", | 1404 | dn_db->router ? dn_addr2asc(le16_to_cpu(*(__le16 *)dn_db->router->primary_key), router_buf) : "", |
1405 | dn_db->peer ? dn_addr2asc(dn_ntohs(*(__le16 *)dn_db->peer->primary_key), peer_buf) : ""); | 1405 | dn_db->peer ? dn_addr2asc(le16_to_cpu(*(__le16 *)dn_db->peer->primary_key), peer_buf) : ""); |
1406 | } | 1406 | } |
1407 | return 0; | 1407 | return 0; |
1408 | } | 1408 | } |
@@ -1445,7 +1445,7 @@ void __init dn_dev_init(void) | |||
1445 | return; | 1445 | return; |
1446 | } | 1446 | } |
1447 | 1447 | ||
1448 | decnet_address = dn_htons((addr[0] << 10) | addr[1]); | 1448 | decnet_address = cpu_to_le16((addr[0] << 10) | addr[1]); |
1449 | 1449 | ||
1450 | dn_dev_devices_on(); | 1450 | dn_dev_devices_on(); |
1451 | 1451 | ||
diff --git a/net/decnet/dn_neigh.c b/net/decnet/dn_neigh.c index 1ca13b17974d..05b5aa05e50e 100644 --- a/net/decnet/dn_neigh.c +++ b/net/decnet/dn_neigh.c | |||
@@ -250,7 +250,7 @@ static int dn_long_output(struct sk_buff *skb) | |||
250 | data = skb_push(skb, sizeof(struct dn_long_packet) + 3); | 250 | data = skb_push(skb, sizeof(struct dn_long_packet) + 3); |
251 | lp = (struct dn_long_packet *)(data+3); | 251 | lp = (struct dn_long_packet *)(data+3); |
252 | 252 | ||
253 | *((__le16 *)data) = dn_htons(skb->len - 2); | 253 | *((__le16 *)data) = cpu_to_le16(skb->len - 2); |
254 | *(data + 2) = 1 | DN_RT_F_PF; /* Padding */ | 254 | *(data + 2) = 1 | DN_RT_F_PF; /* Padding */ |
255 | 255 | ||
256 | lp->msgflg = DN_RT_PKT_LONG|(cb->rt_flags&(DN_RT_F_IE|DN_RT_F_RQR|DN_RT_F_RTS)); | 256 | lp->msgflg = DN_RT_PKT_LONG|(cb->rt_flags&(DN_RT_F_IE|DN_RT_F_RQR|DN_RT_F_RTS)); |
@@ -294,7 +294,7 @@ static int dn_short_output(struct sk_buff *skb) | |||
294 | } | 294 | } |
295 | 295 | ||
296 | data = skb_push(skb, sizeof(struct dn_short_packet) + 2); | 296 | data = skb_push(skb, sizeof(struct dn_short_packet) + 2); |
297 | *((__le16 *)data) = dn_htons(skb->len - 2); | 297 | *((__le16 *)data) = cpu_to_le16(skb->len - 2); |
298 | sp = (struct dn_short_packet *)(data+2); | 298 | sp = (struct dn_short_packet *)(data+2); |
299 | 299 | ||
300 | sp->msgflg = DN_RT_PKT_SHORT|(cb->rt_flags&(DN_RT_F_RQR|DN_RT_F_RTS)); | 300 | sp->msgflg = DN_RT_PKT_SHORT|(cb->rt_flags&(DN_RT_F_RQR|DN_RT_F_RTS)); |
@@ -336,12 +336,12 @@ static int dn_phase3_output(struct sk_buff *skb) | |||
336 | } | 336 | } |
337 | 337 | ||
338 | data = skb_push(skb, sizeof(struct dn_short_packet) + 2); | 338 | data = skb_push(skb, sizeof(struct dn_short_packet) + 2); |
339 | *((__le16 *)data) = dn_htons(skb->len - 2); | 339 | *((__le16 *)data) = cpu_to_le16(skb->len - 2); |
340 | sp = (struct dn_short_packet *)(data + 2); | 340 | sp = (struct dn_short_packet *)(data + 2); |
341 | 341 | ||
342 | sp->msgflg = DN_RT_PKT_SHORT|(cb->rt_flags&(DN_RT_F_RQR|DN_RT_F_RTS)); | 342 | sp->msgflg = DN_RT_PKT_SHORT|(cb->rt_flags&(DN_RT_F_RQR|DN_RT_F_RTS)); |
343 | sp->dstnode = cb->dst & dn_htons(0x03ff); | 343 | sp->dstnode = cb->dst & cpu_to_le16(0x03ff); |
344 | sp->srcnode = cb->src & dn_htons(0x03ff); | 344 | sp->srcnode = cb->src & cpu_to_le16(0x03ff); |
345 | sp->forward = cb->hops & 0x3f; | 345 | sp->forward = cb->hops & 0x3f; |
346 | 346 | ||
347 | skb_reset_network_header(skb); | 347 | skb_reset_network_header(skb); |
@@ -394,7 +394,7 @@ int dn_neigh_router_hello(struct sk_buff *skb) | |||
394 | if (neigh->dev->type == ARPHRD_ETHER) | 394 | if (neigh->dev->type == ARPHRD_ETHER) |
395 | memcpy(neigh->ha, ð_hdr(skb)->h_source, ETH_ALEN); | 395 | memcpy(neigh->ha, ð_hdr(skb)->h_source, ETH_ALEN); |
396 | 396 | ||
397 | dn->blksize = dn_ntohs(msg->blksize); | 397 | dn->blksize = le16_to_cpu(msg->blksize); |
398 | dn->priority = msg->priority; | 398 | dn->priority = msg->priority; |
399 | 399 | ||
400 | dn->flags &= ~DN_NDFLAG_P3; | 400 | dn->flags &= ~DN_NDFLAG_P3; |
@@ -410,7 +410,7 @@ int dn_neigh_router_hello(struct sk_buff *skb) | |||
410 | } | 410 | } |
411 | 411 | ||
412 | /* Only use routers in our area */ | 412 | /* Only use routers in our area */ |
413 | if ((dn_ntohs(src)>>10) == (dn_ntohs((decnet_address))>>10)) { | 413 | if ((le16_to_cpu(src)>>10) == (le16_to_cpu((decnet_address))>>10)) { |
414 | if (!dn_db->router) { | 414 | if (!dn_db->router) { |
415 | dn_db->router = neigh_clone(neigh); | 415 | dn_db->router = neigh_clone(neigh); |
416 | } else { | 416 | } else { |
@@ -453,7 +453,7 @@ int dn_neigh_endnode_hello(struct sk_buff *skb) | |||
453 | if (neigh->dev->type == ARPHRD_ETHER) | 453 | if (neigh->dev->type == ARPHRD_ETHER) |
454 | memcpy(neigh->ha, ð_hdr(skb)->h_source, ETH_ALEN); | 454 | memcpy(neigh->ha, ð_hdr(skb)->h_source, ETH_ALEN); |
455 | dn->flags &= ~(DN_NDFLAG_R1 | DN_NDFLAG_R2); | 455 | dn->flags &= ~(DN_NDFLAG_R1 | DN_NDFLAG_R2); |
456 | dn->blksize = dn_ntohs(msg->blksize); | 456 | dn->blksize = le16_to_cpu(msg->blksize); |
457 | dn->priority = 0; | 457 | dn->priority = 0; |
458 | } | 458 | } |
459 | 459 | ||
@@ -543,7 +543,7 @@ static inline void dn_neigh_format_entry(struct seq_file *seq, | |||
543 | 543 | ||
544 | read_lock(&n->lock); | 544 | read_lock(&n->lock); |
545 | seq_printf(seq, "%-7s %s%s%s %02x %02d %07ld %-8s\n", | 545 | seq_printf(seq, "%-7s %s%s%s %02x %02d %07ld %-8s\n", |
546 | dn_addr2asc(dn_ntohs(dn->addr), buf), | 546 | dn_addr2asc(le16_to_cpu(dn->addr), buf), |
547 | (dn->flags&DN_NDFLAG_R1) ? "1" : "-", | 547 | (dn->flags&DN_NDFLAG_R1) ? "1" : "-", |
548 | (dn->flags&DN_NDFLAG_R2) ? "2" : "-", | 548 | (dn->flags&DN_NDFLAG_R2) ? "2" : "-", |
549 | (dn->flags&DN_NDFLAG_P3) ? "3" : "-", | 549 | (dn->flags&DN_NDFLAG_P3) ? "3" : "-", |
diff --git a/net/decnet/dn_nsp_in.c b/net/decnet/dn_nsp_in.c index 4074a6e5d0de..5d8a2a56fd39 100644 --- a/net/decnet/dn_nsp_in.c +++ b/net/decnet/dn_nsp_in.c | |||
@@ -83,7 +83,9 @@ static void dn_log_martian(struct sk_buff *skb, const char *msg) | |||
83 | if (decnet_log_martians && net_ratelimit()) { | 83 | if (decnet_log_martians && net_ratelimit()) { |
84 | char *devname = skb->dev ? skb->dev->name : "???"; | 84 | char *devname = skb->dev ? skb->dev->name : "???"; |
85 | struct dn_skb_cb *cb = DN_SKB_CB(skb); | 85 | struct dn_skb_cb *cb = DN_SKB_CB(skb); |
86 | printk(KERN_INFO "DECnet: Martian packet (%s) dev=%s src=0x%04hx dst=0x%04hx srcport=0x%04hx dstport=0x%04hx\n", msg, devname, dn_ntohs(cb->src), dn_ntohs(cb->dst), dn_ntohs(cb->src_port), dn_ntohs(cb->dst_port)); | 86 | printk(KERN_INFO "DECnet: Martian packet (%s) dev=%s src=0x%04hx dst=0x%04hx srcport=0x%04hx dstport=0x%04hx\n", |
87 | msg, devname, le16_to_cpu(cb->src), le16_to_cpu(cb->dst), | ||
88 | le16_to_cpu(cb->src_port), le16_to_cpu(cb->dst_port)); | ||
87 | } | 89 | } |
88 | } | 90 | } |
89 | 91 | ||
@@ -133,7 +135,7 @@ static int dn_process_ack(struct sock *sk, struct sk_buff *skb, int oth) | |||
133 | if (skb->len < 2) | 135 | if (skb->len < 2) |
134 | return len; | 136 | return len; |
135 | 137 | ||
136 | if ((ack = dn_ntohs(*ptr)) & 0x8000) { | 138 | if ((ack = le16_to_cpu(*ptr)) & 0x8000) { |
137 | skb_pull(skb, 2); | 139 | skb_pull(skb, 2); |
138 | ptr++; | 140 | ptr++; |
139 | len += 2; | 141 | len += 2; |
@@ -147,7 +149,7 @@ static int dn_process_ack(struct sock *sk, struct sk_buff *skb, int oth) | |||
147 | if (skb->len < 2) | 149 | if (skb->len < 2) |
148 | return len; | 150 | return len; |
149 | 151 | ||
150 | if ((ack = dn_ntohs(*ptr)) & 0x8000) { | 152 | if ((ack = le16_to_cpu(*ptr)) & 0x8000) { |
151 | skb_pull(skb, 2); | 153 | skb_pull(skb, 2); |
152 | len += 2; | 154 | len += 2; |
153 | if ((ack & 0x4000) == 0) { | 155 | if ((ack & 0x4000) == 0) { |
@@ -237,7 +239,7 @@ static struct sock *dn_find_listener(struct sk_buff *skb, unsigned short *reason | |||
237 | cb->dst_port = msg->dstaddr; | 239 | cb->dst_port = msg->dstaddr; |
238 | cb->services = msg->services; | 240 | cb->services = msg->services; |
239 | cb->info = msg->info; | 241 | cb->info = msg->info; |
240 | cb->segsize = dn_ntohs(msg->segsize); | 242 | cb->segsize = le16_to_cpu(msg->segsize); |
241 | 243 | ||
242 | if (!pskb_may_pull(skb, sizeof(*msg))) | 244 | if (!pskb_may_pull(skb, sizeof(*msg))) |
243 | goto err_out; | 245 | goto err_out; |
@@ -344,7 +346,7 @@ static void dn_nsp_conn_conf(struct sock *sk, struct sk_buff *skb) | |||
344 | ptr = skb->data; | 346 | ptr = skb->data; |
345 | cb->services = *ptr++; | 347 | cb->services = *ptr++; |
346 | cb->info = *ptr++; | 348 | cb->info = *ptr++; |
347 | cb->segsize = dn_ntohs(*(__le16 *)ptr); | 349 | cb->segsize = le16_to_cpu(*(__le16 *)ptr); |
348 | 350 | ||
349 | if ((scp->state == DN_CI) || (scp->state == DN_CD)) { | 351 | if ((scp->state == DN_CI) || (scp->state == DN_CD)) { |
350 | scp->persist = 0; | 352 | scp->persist = 0; |
@@ -361,7 +363,7 @@ static void dn_nsp_conn_conf(struct sock *sk, struct sk_buff *skb) | |||
361 | if (skb->len > 0) { | 363 | if (skb->len > 0) { |
362 | u16 dlen = *skb->data; | 364 | u16 dlen = *skb->data; |
363 | if ((dlen <= 16) && (dlen <= skb->len)) { | 365 | if ((dlen <= 16) && (dlen <= skb->len)) { |
364 | scp->conndata_in.opt_optl = dn_htons(dlen); | 366 | scp->conndata_in.opt_optl = cpu_to_le16(dlen); |
365 | skb_copy_from_linear_data_offset(skb, 1, | 367 | skb_copy_from_linear_data_offset(skb, 1, |
366 | scp->conndata_in.opt_data, dlen); | 368 | scp->conndata_in.opt_data, dlen); |
367 | } | 369 | } |
@@ -396,17 +398,17 @@ static void dn_nsp_disc_init(struct sock *sk, struct sk_buff *skb) | |||
396 | if (skb->len < 2) | 398 | if (skb->len < 2) |
397 | goto out; | 399 | goto out; |
398 | 400 | ||
399 | reason = dn_ntohs(*(__le16 *)skb->data); | 401 | reason = le16_to_cpu(*(__le16 *)skb->data); |
400 | skb_pull(skb, 2); | 402 | skb_pull(skb, 2); |
401 | 403 | ||
402 | scp->discdata_in.opt_status = dn_htons(reason); | 404 | scp->discdata_in.opt_status = cpu_to_le16(reason); |
403 | scp->discdata_in.opt_optl = 0; | 405 | scp->discdata_in.opt_optl = 0; |
404 | memset(scp->discdata_in.opt_data, 0, 16); | 406 | memset(scp->discdata_in.opt_data, 0, 16); |
405 | 407 | ||
406 | if (skb->len > 0) { | 408 | if (skb->len > 0) { |
407 | u16 dlen = *skb->data; | 409 | u16 dlen = *skb->data; |
408 | if ((dlen <= 16) && (dlen <= skb->len)) { | 410 | if ((dlen <= 16) && (dlen <= skb->len)) { |
409 | scp->discdata_in.opt_optl = dn_htons(dlen); | 411 | scp->discdata_in.opt_optl = cpu_to_le16(dlen); |
410 | skb_copy_from_linear_data_offset(skb, 1, scp->discdata_in.opt_data, dlen); | 412 | skb_copy_from_linear_data_offset(skb, 1, scp->discdata_in.opt_data, dlen); |
411 | } | 413 | } |
412 | } | 414 | } |
@@ -463,7 +465,7 @@ static void dn_nsp_disc_conf(struct sock *sk, struct sk_buff *skb) | |||
463 | if (skb->len != 2) | 465 | if (skb->len != 2) |
464 | goto out; | 466 | goto out; |
465 | 467 | ||
466 | reason = dn_ntohs(*(__le16 *)skb->data); | 468 | reason = le16_to_cpu(*(__le16 *)skb->data); |
467 | 469 | ||
468 | sk->sk_state = TCP_CLOSE; | 470 | sk->sk_state = TCP_CLOSE; |
469 | 471 | ||
@@ -512,7 +514,7 @@ static void dn_nsp_linkservice(struct sock *sk, struct sk_buff *skb) | |||
512 | if (skb->len != 4) | 514 | if (skb->len != 4) |
513 | goto out; | 515 | goto out; |
514 | 516 | ||
515 | segnum = dn_ntohs(*(__le16 *)ptr); | 517 | segnum = le16_to_cpu(*(__le16 *)ptr); |
516 | ptr += 2; | 518 | ptr += 2; |
517 | lsflags = *(unsigned char *)ptr++; | 519 | lsflags = *(unsigned char *)ptr++; |
518 | fcval = *ptr; | 520 | fcval = *ptr; |
@@ -620,7 +622,7 @@ static void dn_nsp_otherdata(struct sock *sk, struct sk_buff *skb) | |||
620 | if (skb->len < 2) | 622 | if (skb->len < 2) |
621 | goto out; | 623 | goto out; |
622 | 624 | ||
623 | cb->segnum = segnum = dn_ntohs(*(__le16 *)skb->data); | 625 | cb->segnum = segnum = le16_to_cpu(*(__le16 *)skb->data); |
624 | skb_pull(skb, 2); | 626 | skb_pull(skb, 2); |
625 | 627 | ||
626 | if (seq_next(scp->numoth_rcv, segnum)) { | 628 | if (seq_next(scp->numoth_rcv, segnum)) { |
@@ -648,7 +650,7 @@ static void dn_nsp_data(struct sock *sk, struct sk_buff *skb) | |||
648 | if (skb->len < 2) | 650 | if (skb->len < 2) |
649 | goto out; | 651 | goto out; |
650 | 652 | ||
651 | cb->segnum = segnum = dn_ntohs(*(__le16 *)skb->data); | 653 | cb->segnum = segnum = le16_to_cpu(*(__le16 *)skb->data); |
652 | skb_pull(skb, 2); | 654 | skb_pull(skb, 2); |
653 | 655 | ||
654 | if (seq_next(scp->numdat_rcv, segnum)) { | 656 | if (seq_next(scp->numdat_rcv, segnum)) { |
diff --git a/net/decnet/dn_nsp_out.c b/net/decnet/dn_nsp_out.c index 81a40ff10088..2013c25b7f5a 100644 --- a/net/decnet/dn_nsp_out.c +++ b/net/decnet/dn_nsp_out.c | |||
@@ -325,8 +325,8 @@ static __le16 *dn_mk_ack_header(struct sock *sk, struct sk_buff *skb, unsigned c | |||
325 | 325 | ||
326 | ptr = (__le16 *)dn_mk_common_header(scp, skb, msgflag, hlen); | 326 | ptr = (__le16 *)dn_mk_common_header(scp, skb, msgflag, hlen); |
327 | 327 | ||
328 | *ptr++ = dn_htons(acknum); | 328 | *ptr++ = cpu_to_le16(acknum); |
329 | *ptr++ = dn_htons(ackcrs); | 329 | *ptr++ = cpu_to_le16(ackcrs); |
330 | 330 | ||
331 | return ptr; | 331 | return ptr; |
332 | } | 332 | } |
@@ -344,7 +344,7 @@ static __le16 *dn_nsp_mk_data_header(struct sock *sk, struct sk_buff *skb, int o | |||
344 | cb->segnum = scp->numdat; | 344 | cb->segnum = scp->numdat; |
345 | seq_add(&scp->numdat, 1); | 345 | seq_add(&scp->numdat, 1); |
346 | } | 346 | } |
347 | *(ptr++) = dn_htons(cb->segnum); | 347 | *(ptr++) = cpu_to_le16(cb->segnum); |
348 | 348 | ||
349 | return ptr; | 349 | return ptr; |
350 | } | 350 | } |
@@ -522,7 +522,7 @@ void dn_send_conn_conf(struct sock *sk, gfp_t gfp) | |||
522 | struct dn_scp *scp = DN_SK(sk); | 522 | struct dn_scp *scp = DN_SK(sk); |
523 | struct sk_buff *skb = NULL; | 523 | struct sk_buff *skb = NULL; |
524 | struct nsp_conn_init_msg *msg; | 524 | struct nsp_conn_init_msg *msg; |
525 | __u8 len = (__u8)dn_ntohs(scp->conndata_out.opt_optl); | 525 | __u8 len = (__u8)le16_to_cpu(scp->conndata_out.opt_optl); |
526 | 526 | ||
527 | if ((skb = dn_alloc_skb(sk, 50 + len, gfp)) == NULL) | 527 | if ((skb = dn_alloc_skb(sk, 50 + len, gfp)) == NULL) |
528 | return; | 528 | return; |
@@ -533,7 +533,7 @@ void dn_send_conn_conf(struct sock *sk, gfp_t gfp) | |||
533 | msg->srcaddr = scp->addrloc; | 533 | msg->srcaddr = scp->addrloc; |
534 | msg->services = scp->services_loc; | 534 | msg->services = scp->services_loc; |
535 | msg->info = scp->info_loc; | 535 | msg->info = scp->info_loc; |
536 | msg->segsize = dn_htons(scp->segsize_loc); | 536 | msg->segsize = cpu_to_le16(scp->segsize_loc); |
537 | 537 | ||
538 | *skb_put(skb,1) = len; | 538 | *skb_put(skb,1) = len; |
539 | 539 | ||
@@ -559,7 +559,7 @@ static __inline__ void dn_nsp_do_disc(struct sock *sk, unsigned char msgflg, | |||
559 | 559 | ||
560 | if ((dst == NULL) || (rem == 0)) { | 560 | if ((dst == NULL) || (rem == 0)) { |
561 | if (net_ratelimit()) | 561 | if (net_ratelimit()) |
562 | printk(KERN_DEBUG "DECnet: dn_nsp_do_disc: BUG! Please report this to SteveW@ACM.org rem=%u dst=%p\n", dn_ntohs(rem), dst); | 562 | printk(KERN_DEBUG "DECnet: dn_nsp_do_disc: BUG! Please report this to SteveW@ACM.org rem=%u dst=%p\n", le16_to_cpu(rem), dst); |
563 | return; | 563 | return; |
564 | } | 564 | } |
565 | 565 | ||
@@ -572,7 +572,7 @@ static __inline__ void dn_nsp_do_disc(struct sock *sk, unsigned char msgflg, | |||
572 | msg += 2; | 572 | msg += 2; |
573 | *(__le16 *)msg = loc; | 573 | *(__le16 *)msg = loc; |
574 | msg += 2; | 574 | msg += 2; |
575 | *(__le16 *)msg = dn_htons(reason); | 575 | *(__le16 *)msg = cpu_to_le16(reason); |
576 | msg += 2; | 576 | msg += 2; |
577 | if (msgflg == NSP_DISCINIT) | 577 | if (msgflg == NSP_DISCINIT) |
578 | *msg++ = ddl; | 578 | *msg++ = ddl; |
@@ -598,10 +598,10 @@ void dn_nsp_send_disc(struct sock *sk, unsigned char msgflg, | |||
598 | int ddl = 0; | 598 | int ddl = 0; |
599 | 599 | ||
600 | if (msgflg == NSP_DISCINIT) | 600 | if (msgflg == NSP_DISCINIT) |
601 | ddl = dn_ntohs(scp->discdata_out.opt_optl); | 601 | ddl = le16_to_cpu(scp->discdata_out.opt_optl); |
602 | 602 | ||
603 | if (reason == 0) | 603 | if (reason == 0) |
604 | reason = dn_ntohs(scp->discdata_out.opt_status); | 604 | reason = le16_to_cpu(scp->discdata_out.opt_status); |
605 | 605 | ||
606 | dn_nsp_do_disc(sk, msgflg, reason, gfp, sk->sk_dst_cache, ddl, | 606 | dn_nsp_do_disc(sk, msgflg, reason, gfp, sk->sk_dst_cache, ddl, |
607 | scp->discdata_out.opt_data, scp->addrrem, scp->addrloc); | 607 | scp->discdata_out.opt_data, scp->addrrem, scp->addrloc); |
@@ -675,7 +675,7 @@ void dn_nsp_send_conninit(struct sock *sk, unsigned char msgflg) | |||
675 | msg->srcaddr = scp->addrloc; | 675 | msg->srcaddr = scp->addrloc; |
676 | msg->services = scp->services_loc; /* Requested flow control */ | 676 | msg->services = scp->services_loc; /* Requested flow control */ |
677 | msg->info = scp->info_loc; /* Version Number */ | 677 | msg->info = scp->info_loc; /* Version Number */ |
678 | msg->segsize = dn_htons(scp->segsize_loc); /* Max segment size */ | 678 | msg->segsize = cpu_to_le16(scp->segsize_loc); /* Max segment size */ |
679 | 679 | ||
680 | if (scp->peer.sdn_objnum) | 680 | if (scp->peer.sdn_objnum) |
681 | type = 0; | 681 | type = 0; |
@@ -708,7 +708,7 @@ void dn_nsp_send_conninit(struct sock *sk, unsigned char msgflg) | |||
708 | if (aux > 0) | 708 | if (aux > 0) |
709 | memcpy(skb_put(skb, aux), scp->accessdata.acc_acc, aux); | 709 | memcpy(skb_put(skb, aux), scp->accessdata.acc_acc, aux); |
710 | 710 | ||
711 | aux = (__u8)dn_ntohs(scp->conndata_out.opt_optl); | 711 | aux = (__u8)le16_to_cpu(scp->conndata_out.opt_optl); |
712 | *skb_put(skb, 1) = aux; | 712 | *skb_put(skb, 1) = aux; |
713 | if (aux > 0) | 713 | if (aux > 0) |
714 | memcpy(skb_put(skb,aux), scp->conndata_out.opt_data, aux); | 714 | memcpy(skb_put(skb,aux), scp->conndata_out.opt_data, aux); |
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index eeaa3d819f9c..b33b254c52cb 100644 --- a/net/decnet/dn_route.c +++ b/net/decnet/dn_route.c | |||
@@ -475,7 +475,7 @@ static int dn_route_rx_packet(struct sk_buff *skb) | |||
475 | printk(KERN_DEBUG | 475 | printk(KERN_DEBUG |
476 | "DECnet: dn_route_rx_packet: rt_flags=0x%02x dev=%s len=%d src=0x%04hx dst=0x%04hx err=%d type=%d\n", | 476 | "DECnet: dn_route_rx_packet: rt_flags=0x%02x dev=%s len=%d src=0x%04hx dst=0x%04hx err=%d type=%d\n", |
477 | (int)cb->rt_flags, devname, skb->len, | 477 | (int)cb->rt_flags, devname, skb->len, |
478 | dn_ntohs(cb->src), dn_ntohs(cb->dst), | 478 | le16_to_cpu(cb->src), le16_to_cpu(cb->dst), |
479 | err, skb->pkt_type); | 479 | err, skb->pkt_type); |
480 | } | 480 | } |
481 | 481 | ||
@@ -575,7 +575,7 @@ int dn_route_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type | |||
575 | { | 575 | { |
576 | struct dn_skb_cb *cb; | 576 | struct dn_skb_cb *cb; |
577 | unsigned char flags = 0; | 577 | unsigned char flags = 0; |
578 | __u16 len = dn_ntohs(*(__le16 *)skb->data); | 578 | __u16 len = le16_to_cpu(*(__le16 *)skb->data); |
579 | struct dn_dev *dn = (struct dn_dev *)dev->dn_ptr; | 579 | struct dn_dev *dn = (struct dn_dev *)dev->dn_ptr; |
580 | unsigned char padlen = 0; | 580 | unsigned char padlen = 0; |
581 | 581 | ||
@@ -773,7 +773,7 @@ static int dn_rt_bug(struct sk_buff *skb) | |||
773 | struct dn_skb_cb *cb = DN_SKB_CB(skb); | 773 | struct dn_skb_cb *cb = DN_SKB_CB(skb); |
774 | 774 | ||
775 | printk(KERN_DEBUG "dn_rt_bug: skb from:%04x to:%04x\n", | 775 | printk(KERN_DEBUG "dn_rt_bug: skb from:%04x to:%04x\n", |
776 | dn_ntohs(cb->src), dn_ntohs(cb->dst)); | 776 | le16_to_cpu(cb->src), le16_to_cpu(cb->dst)); |
777 | } | 777 | } |
778 | 778 | ||
779 | kfree_skb(skb); | 779 | kfree_skb(skb); |
@@ -816,7 +816,7 @@ static int dn_rt_set_next_hop(struct dn_route *rt, struct dn_fib_res *res) | |||
816 | 816 | ||
817 | static inline int dn_match_addr(__le16 addr1, __le16 addr2) | 817 | static inline int dn_match_addr(__le16 addr1, __le16 addr2) |
818 | { | 818 | { |
819 | __u16 tmp = dn_ntohs(addr1) ^ dn_ntohs(addr2); | 819 | __u16 tmp = le16_to_cpu(addr1) ^ le16_to_cpu(addr2); |
820 | int match = 16; | 820 | int match = 16; |
821 | while(tmp) { | 821 | while(tmp) { |
822 | tmp >>= 1; | 822 | tmp >>= 1; |
@@ -886,8 +886,8 @@ static int dn_route_output_slow(struct dst_entry **pprt, const struct flowi *old | |||
886 | if (decnet_debug_level & 16) | 886 | if (decnet_debug_level & 16) |
887 | printk(KERN_DEBUG | 887 | printk(KERN_DEBUG |
888 | "dn_route_output_slow: dst=%04x src=%04x mark=%d" | 888 | "dn_route_output_slow: dst=%04x src=%04x mark=%d" |
889 | " iif=%d oif=%d\n", dn_ntohs(oldflp->fld_dst), | 889 | " iif=%d oif=%d\n", le16_to_cpu(oldflp->fld_dst), |
890 | dn_ntohs(oldflp->fld_src), | 890 | le16_to_cpu(oldflp->fld_src), |
891 | oldflp->mark, init_net.loopback_dev->ifindex, oldflp->oif); | 891 | oldflp->mark, init_net.loopback_dev->ifindex, oldflp->oif); |
892 | 892 | ||
893 | /* If we have an output interface, verify its a DECnet device */ | 893 | /* If we have an output interface, verify its a DECnet device */ |
@@ -959,7 +959,7 @@ source_ok: | |||
959 | printk(KERN_DEBUG | 959 | printk(KERN_DEBUG |
960 | "dn_route_output_slow: initial checks complete." | 960 | "dn_route_output_slow: initial checks complete." |
961 | " dst=%o4x src=%04x oif=%d try_hard=%d\n", | 961 | " dst=%o4x src=%04x oif=%d try_hard=%d\n", |
962 | dn_ntohs(fl.fld_dst), dn_ntohs(fl.fld_src), | 962 | le16_to_cpu(fl.fld_dst), le16_to_cpu(fl.fld_src), |
963 | fl.oif, try_hard); | 963 | fl.oif, try_hard); |
964 | 964 | ||
965 | /* | 965 | /* |
@@ -1711,8 +1711,8 @@ static int dn_rt_cache_seq_show(struct seq_file *seq, void *v) | |||
1711 | 1711 | ||
1712 | seq_printf(seq, "%-8s %-7s %-7s %04d %04d %04d\n", | 1712 | seq_printf(seq, "%-8s %-7s %-7s %04d %04d %04d\n", |
1713 | rt->u.dst.dev ? rt->u.dst.dev->name : "*", | 1713 | rt->u.dst.dev ? rt->u.dst.dev->name : "*", |
1714 | dn_addr2asc(dn_ntohs(rt->rt_daddr), buf1), | 1714 | dn_addr2asc(le16_to_cpu(rt->rt_daddr), buf1), |
1715 | dn_addr2asc(dn_ntohs(rt->rt_saddr), buf2), | 1715 | dn_addr2asc(le16_to_cpu(rt->rt_saddr), buf2), |
1716 | atomic_read(&rt->u.dst.__refcnt), | 1716 | atomic_read(&rt->u.dst.__refcnt), |
1717 | rt->u.dst.__use, | 1717 | rt->u.dst.__use, |
1718 | (int) dst_metric(&rt->u.dst, RTAX_RTT)); | 1718 | (int) dst_metric(&rt->u.dst, RTAX_RTT)); |
diff --git a/net/decnet/dn_table.c b/net/decnet/dn_table.c index 3a2830ac89c2..69ad9280c693 100644 --- a/net/decnet/dn_table.c +++ b/net/decnet/dn_table.c | |||
@@ -85,7 +85,7 @@ static int dn_fib_hash_zombies; | |||
85 | 85 | ||
86 | static inline dn_fib_idx_t dn_hash(dn_fib_key_t key, struct dn_zone *dz) | 86 | static inline dn_fib_idx_t dn_hash(dn_fib_key_t key, struct dn_zone *dz) |
87 | { | 87 | { |
88 | u16 h = dn_ntohs(key.datum)>>(16 - dz->dz_order); | 88 | u16 h = le16_to_cpu(key.datum)>>(16 - dz->dz_order); |
89 | h ^= (h >> 10); | 89 | h ^= (h >> 10); |
90 | h ^= (h >> 6); | 90 | h ^= (h >> 6); |
91 | h &= DZ_HASHMASK(dz); | 91 | h &= DZ_HASHMASK(dz); |
diff --git a/net/decnet/sysctl_net_decnet.c b/net/decnet/sysctl_net_decnet.c index 2f360a1e5e49..965397af9a80 100644 --- a/net/decnet/sysctl_net_decnet.c +++ b/net/decnet/sysctl_net_decnet.c | |||
@@ -126,7 +126,7 @@ static int parse_addr(__le16 *addr, char *str) | |||
126 | if (INVALID_END_CHAR(*str)) | 126 | if (INVALID_END_CHAR(*str)) |
127 | return -1; | 127 | return -1; |
128 | 128 | ||
129 | *addr = dn_htons((area << 10) | node); | 129 | *addr = cpu_to_le16((area << 10) | node); |
130 | 130 | ||
131 | return 0; | 131 | return 0; |
132 | } | 132 | } |
@@ -201,7 +201,7 @@ static int dn_node_address_handler(ctl_table *table, int write, | |||
201 | return 0; | 201 | return 0; |
202 | } | 202 | } |
203 | 203 | ||
204 | dn_addr2asc(dn_ntohs(decnet_address), addr); | 204 | dn_addr2asc(le16_to_cpu(decnet_address), addr); |
205 | len = strlen(addr); | 205 | len = strlen(addr); |
206 | addr[len++] = '\n'; | 206 | addr[len++] = '\n'; |
207 | 207 | ||