summaryrefslogtreecommitdiffstats
path: root/include/net/dn.h
diff options
context:
space:
mode:
authorSteven Whitehouse <steve@chygwyn.com>2006-03-20 22:42:39 -0800
committerDavid S. Miller <davem@davemloft.net>2006-03-20 22:42:39 -0800
commitc4ea94ab3710eb2434abe2eab1a479c2dc01f8ac (patch)
tree72e07ca7d2d5fe2de31b3f5a4e64fa411efdf18d /include/net/dn.h
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 'include/net/dn.h')
-rw-r--r--include/net/dn.h105
1 files changed, 52 insertions, 53 deletions
diff --git a/include/net/dn.h b/include/net/dn.h
index a4b6168e1e2..465b7830278 100644
--- a/include/net/dn.h
+++ b/include/net/dn.h
@@ -6,10 +6,8 @@
#include <net/tcp.h>
#include <asm/byteorder.h>
-typedef unsigned short dn_address;
-
-#define dn_ntohs(x) le16_to_cpu((unsigned short)(x))
-#define dn_htons(x) cpu_to_le16((unsigned short)(x))
+#define dn_ntohs(x) le16_to_cpu(x)
+#define dn_htons(x) cpu_to_le16(x)
struct dn_scp /* Session Control Port */
{
@@ -31,36 +29,36 @@ struct dn_scp /* Session Control Port */
#define DN_CL 15 /* Closed */
#define DN_CN 16 /* Closed Notification */
- unsigned short addrloc;
- unsigned short addrrem;
- unsigned short numdat;
- unsigned short numoth;
- unsigned short numoth_rcv;
- unsigned short numdat_rcv;
- unsigned short ackxmt_dat;
- unsigned short ackxmt_oth;
- unsigned short ackrcv_dat;
- unsigned short ackrcv_oth;
- unsigned char flowrem_sw;
- unsigned char flowloc_sw;
+ __le16 addrloc;
+ __le16 addrrem;
+ __u16 numdat;
+ __u16 numoth;
+ __u16 numoth_rcv;
+ __u16 numdat_rcv;
+ __u16 ackxmt_dat;
+ __u16 ackxmt_oth;
+ __u16 ackrcv_dat;
+ __u16 ackrcv_oth;
+ __u8 flowrem_sw;
+ __u8 flowloc_sw;
#define DN_SEND 2
#define DN_DONTSEND 1
#define DN_NOCHANGE 0
- unsigned short flowrem_dat;
- unsigned short flowrem_oth;
- unsigned short flowloc_dat;
- unsigned short flowloc_oth;
- unsigned char services_rem;
- unsigned char services_loc;
- unsigned char info_rem;
- unsigned char info_loc;
-
- unsigned short segsize_rem;
- unsigned short segsize_loc;
-
- unsigned char nonagle;
- unsigned char multi_ireq;
- unsigned char accept_mode;
+ __u16 flowrem_dat;
+ __u16 flowrem_oth;
+ __u16 flowloc_dat;
+ __u16 flowloc_oth;
+ __u8 services_rem;
+ __u8 services_loc;
+ __u8 info_rem;
+ __u8 info_loc;
+
+ __u16 segsize_rem;
+ __u16 segsize_loc;
+
+ __u8 nonagle;
+ __u8 multi_ireq;
+ __u8 accept_mode;
unsigned long seg_total; /* Running total of current segment */
struct optdata_dn conndata_in;
@@ -160,40 +158,41 @@ static inline struct dn_scp *DN_SK(struct sock *sk)
*/
#define DN_SKB_CB(skb) ((struct dn_skb_cb *)(skb)->cb)
struct dn_skb_cb {
- unsigned short dst;
- unsigned short src;
- unsigned short hops;
- unsigned short dst_port;
- unsigned short src_port;
- unsigned char services;
- unsigned char info;
- unsigned char rt_flags;
- unsigned char nsp_flags;
- unsigned short segsize;
- unsigned short segnum;
- unsigned short xmit_count;
+ __le16 dst;
+ __le16 src;
+ __u16 hops;
+ __le16 dst_port;
+ __le16 src_port;
+ __u8 services;
+ __u8 info;
+ __u8 rt_flags;
+ __u8 nsp_flags;
+ __u16 segsize;
+ __u16 segnum;
+ __u16 xmit_count;
unsigned long stamp;
int iif;
};
-static inline dn_address dn_eth2dn(unsigned char *ethaddr)
+static inline __le16 dn_eth2dn(unsigned char *ethaddr)
{
- return ethaddr[4] | (ethaddr[5] << 8);
+ return dn_htons(ethaddr[4] | (ethaddr[5] << 8));
}
-static inline dn_address dn_saddr2dn(struct sockaddr_dn *saddr)
+static inline __le16 dn_saddr2dn(struct sockaddr_dn *saddr)
{
- return *(dn_address *)saddr->sdn_nodeaddr;
+ return *(__le16 *)saddr->sdn_nodeaddr;
}
-static inline void dn_dn2eth(unsigned char *ethaddr, dn_address addr)
+static inline void dn_dn2eth(unsigned char *ethaddr, __le16 addr)
{
+ __u16 a = dn_ntohs(addr);
ethaddr[0] = 0xAA;
ethaddr[1] = 0x00;
ethaddr[2] = 0x04;
ethaddr[3] = 0x00;
- ethaddr[4] = (unsigned char)(addr & 0xff);
- ethaddr[5] = (unsigned char)(addr >> 8);
+ ethaddr[4] = (__u8)(a & 0xff);
+ ethaddr[5] = (__u8)(a >> 8);
}
static inline void dn_sk_ports_copy(struct flowi *fl, struct dn_scp *scp)
@@ -202,7 +201,7 @@ static inline void dn_sk_ports_copy(struct flowi *fl, struct dn_scp *scp)
fl->uli_u.dnports.dport = scp->addrrem;
fl->uli_u.dnports.objnum = scp->addr.sdn_objnum;
if (fl->uli_u.dnports.objnum == 0) {
- fl->uli_u.dnports.objnamel = scp->addr.sdn_objnamel;
+ fl->uli_u.dnports.objnamel = (__u8)dn_ntohs(scp->addr.sdn_objnamel);
memcpy(fl->uli_u.dnports.objname, scp->addr.sdn_objname, 16);
}
}
@@ -217,7 +216,7 @@ extern unsigned dn_mss_from_pmtu(struct net_device *dev, int mtu);
extern struct sock *dn_sklist_find_listener(struct sockaddr_dn *addr);
extern struct sock *dn_find_by_skb(struct sk_buff *skb);
#define DN_ASCBUF_LEN 9
-extern char *dn_addr2asc(dn_address, char *);
+extern char *dn_addr2asc(__u16, char *);
extern int dn_destroy_timer(struct sock *sk);
extern int dn_sockaddr2username(struct sockaddr_dn *addr, unsigned char *buf, unsigned char type);
@@ -226,7 +225,7 @@ extern int dn_username2sockaddr(unsigned char *data, int len, struct sockaddr_dn
extern void dn_start_slow_timer(struct sock *sk);
extern void dn_stop_slow_timer(struct sock *sk);
-extern dn_address decnet_address;
+extern __le16 decnet_address;
extern int decnet_debug_level;
extern int decnet_time_wait;
extern int decnet_dn_count;