diff options
author | Steven Whitehouse <steve@chygwyn.com> | 2006-03-21 01:42:39 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-03-21 01:42:39 -0500 |
commit | c4ea94ab3710eb2434abe2eab1a479c2dc01f8ac (patch) | |
tree | 72e07ca7d2d5fe2de31b3f5a4e64fa411efdf18d /include | |
parent | 2c7946a7bf45ae86736ab3b43d0085e43947945c (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')
-rw-r--r-- | include/linux/dn.h | 44 | ||||
-rw-r--r-- | include/net/dn.h | 105 | ||||
-rw-r--r-- | include/net/dn_dev.h | 88 | ||||
-rw-r--r-- | include/net/dn_fib.h | 22 | ||||
-rw-r--r-- | include/net/dn_neigh.h | 4 | ||||
-rw-r--r-- | include/net/dn_nsp.h | 72 | ||||
-rw-r--r-- | include/net/dn_route.h | 12 | ||||
-rw-r--r-- | include/net/flow.h | 8 |
8 files changed, 177 insertions, 178 deletions
diff --git a/include/linux/dn.h b/include/linux/dn.h index 782cae49e64c..10b6a6fd5837 100644 --- a/include/linux/dn.h +++ b/include/linux/dn.h | |||
@@ -71,17 +71,17 @@ | |||
71 | 71 | ||
72 | struct dn_naddr | 72 | struct dn_naddr |
73 | { | 73 | { |
74 | unsigned short a_len; | 74 | __le16 a_len; |
75 | unsigned char a_addr[DN_MAXADDL]; | 75 | __u8 a_addr[DN_MAXADDL]; /* Two bytes little endian */ |
76 | }; | 76 | }; |
77 | 77 | ||
78 | struct sockaddr_dn | 78 | struct sockaddr_dn |
79 | { | 79 | { |
80 | unsigned short sdn_family; | 80 | __u16 sdn_family; |
81 | unsigned char sdn_flags; | 81 | __u8 sdn_flags; |
82 | unsigned char sdn_objnum; | 82 | __u8 sdn_objnum; |
83 | unsigned short sdn_objnamel; | 83 | __le16 sdn_objnamel; |
84 | unsigned char sdn_objname[DN_MAXOBJL]; | 84 | __u8 sdn_objname[DN_MAXOBJL]; |
85 | struct dn_naddr sdn_add; | 85 | struct dn_naddr sdn_add; |
86 | }; | 86 | }; |
87 | #define sdn_nodeaddrl sdn_add.a_len /* Node address length */ | 87 | #define sdn_nodeaddrl sdn_add.a_len /* Node address length */ |
@@ -93,38 +93,38 @@ struct sockaddr_dn | |||
93 | * DECnet set/get DSO_CONDATA, DSO_DISDATA (optional data) structure | 93 | * DECnet set/get DSO_CONDATA, DSO_DISDATA (optional data) structure |
94 | */ | 94 | */ |
95 | struct optdata_dn { | 95 | struct optdata_dn { |
96 | unsigned short opt_status; /* Extended status return */ | 96 | __le16 opt_status; /* Extended status return */ |
97 | #define opt_sts opt_status | 97 | #define opt_sts opt_status |
98 | unsigned short opt_optl; /* Length of user data */ | 98 | __le16 opt_optl; /* Length of user data */ |
99 | unsigned char opt_data[16]; /* User data */ | 99 | __u8 opt_data[16]; /* User data */ |
100 | }; | 100 | }; |
101 | 101 | ||
102 | struct accessdata_dn | 102 | struct accessdata_dn |
103 | { | 103 | { |
104 | unsigned char acc_accl; | 104 | __u8 acc_accl; |
105 | unsigned char acc_acc[DN_MAXACCL]; | 105 | __u8 acc_acc[DN_MAXACCL]; |
106 | unsigned char acc_passl; | 106 | __u8 acc_passl; |
107 | unsigned char acc_pass[DN_MAXACCL]; | 107 | __u8 acc_pass[DN_MAXACCL]; |
108 | unsigned char acc_userl; | 108 | __u8 acc_userl; |
109 | unsigned char acc_user[DN_MAXACCL]; | 109 | __u8 acc_user[DN_MAXACCL]; |
110 | }; | 110 | }; |
111 | 111 | ||
112 | /* | 112 | /* |
113 | * DECnet logical link information structure | 113 | * DECnet logical link information structure |
114 | */ | 114 | */ |
115 | struct linkinfo_dn { | 115 | struct linkinfo_dn { |
116 | unsigned short idn_segsize; /* Segment size for link */ | 116 | __le16 idn_segsize; /* Segment size for link */ |
117 | unsigned char idn_linkstate; /* Logical link state */ | 117 | __u8 idn_linkstate; /* Logical link state */ |
118 | }; | 118 | }; |
119 | 119 | ||
120 | /* | 120 | /* |
121 | * Ethernet address format (for DECnet) | 121 | * Ethernet address format (for DECnet) |
122 | */ | 122 | */ |
123 | union etheraddress { | 123 | union etheraddress { |
124 | unsigned char dne_addr[6]; /* Full ethernet address */ | 124 | __u8 dne_addr[6]; /* Full ethernet address */ |
125 | struct { | 125 | struct { |
126 | unsigned char dne_hiord[4]; /* DECnet HIORD prefix */ | 126 | __u8 dne_hiord[4]; /* DECnet HIORD prefix */ |
127 | unsigned char dne_nodeaddr[2]; /* DECnet node address */ | 127 | __u8 dne_nodeaddr[2]; /* DECnet node address */ |
128 | } dne_remote; | 128 | } dne_remote; |
129 | }; | 129 | }; |
130 | 130 | ||
@@ -133,7 +133,7 @@ union etheraddress { | |||
133 | * DECnet physical socket address format | 133 | * DECnet physical socket address format |
134 | */ | 134 | */ |
135 | struct dn_addr { | 135 | struct dn_addr { |
136 | unsigned short dna_family; /* AF_DECnet */ | 136 | __le16 dna_family; /* AF_DECnet */ |
137 | union etheraddress dna_netaddr; /* DECnet ethernet address */ | 137 | union etheraddress dna_netaddr; /* DECnet ethernet address */ |
138 | }; | 138 | }; |
139 | 139 | ||
diff --git a/include/net/dn.h b/include/net/dn.h index a4b6168e1e25..465b78302782 100644 --- a/include/net/dn.h +++ b/include/net/dn.h | |||
@@ -6,10 +6,8 @@ | |||
6 | #include <net/tcp.h> | 6 | #include <net/tcp.h> |
7 | #include <asm/byteorder.h> | 7 | #include <asm/byteorder.h> |
8 | 8 | ||
9 | typedef unsigned short dn_address; | 9 | #define dn_ntohs(x) le16_to_cpu(x) |
10 | 10 | #define dn_htons(x) cpu_to_le16(x) | |
11 | #define dn_ntohs(x) le16_to_cpu((unsigned short)(x)) | ||
12 | #define dn_htons(x) cpu_to_le16((unsigned short)(x)) | ||
13 | 11 | ||
14 | struct dn_scp /* Session Control Port */ | 12 | struct dn_scp /* Session Control Port */ |
15 | { | 13 | { |
@@ -31,36 +29,36 @@ struct dn_scp /* Session Control Port */ | |||
31 | #define DN_CL 15 /* Closed */ | 29 | #define DN_CL 15 /* Closed */ |
32 | #define DN_CN 16 /* Closed Notification */ | 30 | #define DN_CN 16 /* Closed Notification */ |
33 | 31 | ||
34 | unsigned short addrloc; | 32 | __le16 addrloc; |
35 | unsigned short addrrem; | 33 | __le16 addrrem; |
36 | unsigned short numdat; | 34 | __u16 numdat; |
37 | unsigned short numoth; | 35 | __u16 numoth; |
38 | unsigned short numoth_rcv; | 36 | __u16 numoth_rcv; |
39 | unsigned short numdat_rcv; | 37 | __u16 numdat_rcv; |
40 | unsigned short ackxmt_dat; | 38 | __u16 ackxmt_dat; |
41 | unsigned short ackxmt_oth; | 39 | __u16 ackxmt_oth; |
42 | unsigned short ackrcv_dat; | 40 | __u16 ackrcv_dat; |
43 | unsigned short ackrcv_oth; | 41 | __u16 ackrcv_oth; |
44 | unsigned char flowrem_sw; | 42 | __u8 flowrem_sw; |
45 | unsigned char flowloc_sw; | 43 | __u8 flowloc_sw; |
46 | #define DN_SEND 2 | 44 | #define DN_SEND 2 |
47 | #define DN_DONTSEND 1 | 45 | #define DN_DONTSEND 1 |
48 | #define DN_NOCHANGE 0 | 46 | #define DN_NOCHANGE 0 |
49 | unsigned short flowrem_dat; | 47 | __u16 flowrem_dat; |
50 | unsigned short flowrem_oth; | 48 | __u16 flowrem_oth; |
51 | unsigned short flowloc_dat; | 49 | __u16 flowloc_dat; |
52 | unsigned short flowloc_oth; | 50 | __u16 flowloc_oth; |
53 | unsigned char services_rem; | 51 | __u8 services_rem; |
54 | unsigned char services_loc; | 52 | __u8 services_loc; |
55 | unsigned char info_rem; | 53 | __u8 info_rem; |
56 | unsigned char info_loc; | 54 | __u8 info_loc; |
57 | 55 | ||
58 | unsigned short segsize_rem; | 56 | __u16 segsize_rem; |
59 | unsigned short segsize_loc; | 57 | __u16 segsize_loc; |
60 | 58 | ||
61 | unsigned char nonagle; | 59 | __u8 nonagle; |
62 | unsigned char multi_ireq; | 60 | __u8 multi_ireq; |
63 | unsigned char accept_mode; | 61 | __u8 accept_mode; |
64 | unsigned long seg_total; /* Running total of current segment */ | 62 | unsigned long seg_total; /* Running total of current segment */ |
65 | 63 | ||
66 | struct optdata_dn conndata_in; | 64 | struct optdata_dn conndata_in; |
@@ -160,40 +158,41 @@ static inline struct dn_scp *DN_SK(struct sock *sk) | |||
160 | */ | 158 | */ |
161 | #define DN_SKB_CB(skb) ((struct dn_skb_cb *)(skb)->cb) | 159 | #define DN_SKB_CB(skb) ((struct dn_skb_cb *)(skb)->cb) |
162 | struct dn_skb_cb { | 160 | struct dn_skb_cb { |
163 | unsigned short dst; | 161 | __le16 dst; |
164 | unsigned short src; | 162 | __le16 src; |
165 | unsigned short hops; | 163 | __u16 hops; |
166 | unsigned short dst_port; | 164 | __le16 dst_port; |
167 | unsigned short src_port; | 165 | __le16 src_port; |
168 | unsigned char services; | 166 | __u8 services; |
169 | unsigned char info; | 167 | __u8 info; |
170 | unsigned char rt_flags; | 168 | __u8 rt_flags; |
171 | unsigned char nsp_flags; | 169 | __u8 nsp_flags; |
172 | unsigned short segsize; | 170 | __u16 segsize; |
173 | unsigned short segnum; | 171 | __u16 segnum; |
174 | unsigned short xmit_count; | 172 | __u16 xmit_count; |
175 | unsigned long stamp; | 173 | unsigned long stamp; |
176 | int iif; | 174 | int iif; |
177 | }; | 175 | }; |
178 | 176 | ||
179 | static inline dn_address dn_eth2dn(unsigned char *ethaddr) | 177 | static inline __le16 dn_eth2dn(unsigned char *ethaddr) |
180 | { | 178 | { |
181 | return ethaddr[4] | (ethaddr[5] << 8); | 179 | return dn_htons(ethaddr[4] | (ethaddr[5] << 8)); |
182 | } | 180 | } |
183 | 181 | ||
184 | static inline dn_address dn_saddr2dn(struct sockaddr_dn *saddr) | 182 | static inline __le16 dn_saddr2dn(struct sockaddr_dn *saddr) |
185 | { | 183 | { |
186 | return *(dn_address *)saddr->sdn_nodeaddr; | 184 | return *(__le16 *)saddr->sdn_nodeaddr; |
187 | } | 185 | } |
188 | 186 | ||
189 | static inline void dn_dn2eth(unsigned char *ethaddr, dn_address addr) | 187 | static inline void dn_dn2eth(unsigned char *ethaddr, __le16 addr) |
190 | { | 188 | { |
189 | __u16 a = dn_ntohs(addr); | ||
191 | ethaddr[0] = 0xAA; | 190 | ethaddr[0] = 0xAA; |
192 | ethaddr[1] = 0x00; | 191 | ethaddr[1] = 0x00; |
193 | ethaddr[2] = 0x04; | 192 | ethaddr[2] = 0x04; |
194 | ethaddr[3] = 0x00; | 193 | ethaddr[3] = 0x00; |
195 | ethaddr[4] = (unsigned char)(addr & 0xff); | 194 | ethaddr[4] = (__u8)(a & 0xff); |
196 | ethaddr[5] = (unsigned char)(addr >> 8); | 195 | ethaddr[5] = (__u8)(a >> 8); |
197 | } | 196 | } |
198 | 197 | ||
199 | static inline void dn_sk_ports_copy(struct flowi *fl, struct dn_scp *scp) | 198 | 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) | |||
202 | fl->uli_u.dnports.dport = scp->addrrem; | 201 | fl->uli_u.dnports.dport = scp->addrrem; |
203 | fl->uli_u.dnports.objnum = scp->addr.sdn_objnum; | 202 | fl->uli_u.dnports.objnum = scp->addr.sdn_objnum; |
204 | if (fl->uli_u.dnports.objnum == 0) { | 203 | if (fl->uli_u.dnports.objnum == 0) { |
205 | fl->uli_u.dnports.objnamel = scp->addr.sdn_objnamel; | 204 | fl->uli_u.dnports.objnamel = (__u8)dn_ntohs(scp->addr.sdn_objnamel); |
206 | memcpy(fl->uli_u.dnports.objname, scp->addr.sdn_objname, 16); | 205 | memcpy(fl->uli_u.dnports.objname, scp->addr.sdn_objname, 16); |
207 | } | 206 | } |
208 | } | 207 | } |
@@ -217,7 +216,7 @@ extern unsigned dn_mss_from_pmtu(struct net_device *dev, int mtu); | |||
217 | extern struct sock *dn_sklist_find_listener(struct sockaddr_dn *addr); | 216 | extern struct sock *dn_sklist_find_listener(struct sockaddr_dn *addr); |
218 | extern struct sock *dn_find_by_skb(struct sk_buff *skb); | 217 | extern struct sock *dn_find_by_skb(struct sk_buff *skb); |
219 | #define DN_ASCBUF_LEN 9 | 218 | #define DN_ASCBUF_LEN 9 |
220 | extern char *dn_addr2asc(dn_address, char *); | 219 | extern char *dn_addr2asc(__u16, char *); |
221 | extern int dn_destroy_timer(struct sock *sk); | 220 | extern int dn_destroy_timer(struct sock *sk); |
222 | 221 | ||
223 | extern int dn_sockaddr2username(struct sockaddr_dn *addr, unsigned char *buf, unsigned char type); | 222 | 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 | |||
226 | extern void dn_start_slow_timer(struct sock *sk); | 225 | extern void dn_start_slow_timer(struct sock *sk); |
227 | extern void dn_stop_slow_timer(struct sock *sk); | 226 | extern void dn_stop_slow_timer(struct sock *sk); |
228 | 227 | ||
229 | extern dn_address decnet_address; | 228 | extern __le16 decnet_address; |
230 | extern int decnet_debug_level; | 229 | extern int decnet_debug_level; |
231 | extern int decnet_time_wait; | 230 | extern int decnet_time_wait; |
232 | extern int decnet_dn_count; | 231 | extern int decnet_dn_count; |
diff --git a/include/net/dn_dev.h b/include/net/dn_dev.h index 5a86e78081bf..cee46821dc53 100644 --- a/include/net/dn_dev.h +++ b/include/net/dn_dev.h | |||
@@ -7,11 +7,11 @@ struct dn_dev; | |||
7 | struct dn_ifaddr { | 7 | struct dn_ifaddr { |
8 | struct dn_ifaddr *ifa_next; | 8 | struct dn_ifaddr *ifa_next; |
9 | struct dn_dev *ifa_dev; | 9 | struct dn_dev *ifa_dev; |
10 | dn_address ifa_local; | 10 | __le16 ifa_local; |
11 | dn_address ifa_address; | 11 | __le16 ifa_address; |
12 | unsigned char ifa_flags; | 12 | __u8 ifa_flags; |
13 | unsigned char ifa_scope; | 13 | __u8 ifa_scope; |
14 | char ifa_label[IFNAMSIZ]; | 14 | char ifa_label[IFNAMSIZ]; |
15 | }; | 15 | }; |
16 | 16 | ||
17 | #define DN_DEV_S_RU 0 /* Run - working normally */ | 17 | #define DN_DEV_S_RU 0 /* Run - working normally */ |
@@ -91,7 +91,7 @@ struct dn_dev { | |||
91 | struct timer_list timer; | 91 | struct timer_list timer; |
92 | unsigned long t3; | 92 | unsigned long t3; |
93 | struct neigh_parms *neigh_parms; | 93 | struct neigh_parms *neigh_parms; |
94 | unsigned char addr[ETH_ALEN]; | 94 | __u8 addr[ETH_ALEN]; |
95 | struct neighbour *router; /* Default router on circuit */ | 95 | struct neighbour *router; /* Default router on circuit */ |
96 | struct neighbour *peer; /* Peer on pointopoint links */ | 96 | struct neighbour *peer; /* Peer on pointopoint links */ |
97 | unsigned long uptime; /* Time device went up in jiffies */ | 97 | unsigned long uptime; /* Time device went up in jiffies */ |
@@ -99,56 +99,56 @@ struct dn_dev { | |||
99 | 99 | ||
100 | struct dn_short_packet | 100 | struct dn_short_packet |
101 | { | 101 | { |
102 | unsigned char msgflg; | 102 | __u8 msgflg; |
103 | unsigned short dstnode; | 103 | __le16 dstnode; |
104 | unsigned short srcnode; | 104 | __le16 srcnode; |
105 | unsigned char forward; | 105 | __u8 forward; |
106 | } __attribute__((packed)); | 106 | } __attribute__((packed)); |
107 | 107 | ||
108 | struct dn_long_packet | 108 | struct dn_long_packet |
109 | { | 109 | { |
110 | unsigned char msgflg; | 110 | __u8 msgflg; |
111 | unsigned char d_area; | 111 | __u8 d_area; |
112 | unsigned char d_subarea; | 112 | __u8 d_subarea; |
113 | unsigned char d_id[6]; | 113 | __u8 d_id[6]; |
114 | unsigned char s_area; | 114 | __u8 s_area; |
115 | unsigned char s_subarea; | 115 | __u8 s_subarea; |
116 | unsigned char s_id[6]; | 116 | __u8 s_id[6]; |
117 | unsigned char nl2; | 117 | __u8 nl2; |
118 | unsigned char visit_ct; | 118 | __u8 visit_ct; |
119 | unsigned char s_class; | 119 | __u8 s_class; |
120 | unsigned char pt; | 120 | __u8 pt; |
121 | } __attribute__((packed)); | 121 | } __attribute__((packed)); |
122 | 122 | ||
123 | /*------------------------- DRP - Routing messages ---------------------*/ | 123 | /*------------------------- DRP - Routing messages ---------------------*/ |
124 | 124 | ||
125 | struct endnode_hello_message | 125 | struct endnode_hello_message |
126 | { | 126 | { |
127 | unsigned char msgflg; | 127 | __u8 msgflg; |
128 | unsigned char tiver[3]; | 128 | __u8 tiver[3]; |
129 | unsigned char id[6]; | 129 | __u8 id[6]; |
130 | unsigned char iinfo; | 130 | __u8 iinfo; |
131 | unsigned short blksize; | 131 | __le16 blksize; |
132 | unsigned char area; | 132 | __u8 area; |
133 | unsigned char seed[8]; | 133 | __u8 seed[8]; |
134 | unsigned char neighbor[6]; | 134 | __u8 neighbor[6]; |
135 | unsigned short timer; | 135 | __le16 timer; |
136 | unsigned char mpd; | 136 | __u8 mpd; |
137 | unsigned char datalen; | 137 | __u8 datalen; |
138 | unsigned char data[2]; | 138 | __u8 data[2]; |
139 | } __attribute__((packed)); | 139 | } __attribute__((packed)); |
140 | 140 | ||
141 | struct rtnode_hello_message | 141 | struct rtnode_hello_message |
142 | { | 142 | { |
143 | unsigned char msgflg; | 143 | __u8 msgflg; |
144 | unsigned char tiver[3]; | 144 | __u8 tiver[3]; |
145 | unsigned char id[6]; | 145 | __u8 id[6]; |
146 | unsigned char iinfo; | 146 | __u8 iinfo; |
147 | unsigned short blksize; | 147 | __le16 blksize; |
148 | unsigned char priority; | 148 | __u8 priority; |
149 | unsigned char area; | 149 | __u8 area; |
150 | unsigned short timer; | 150 | __le16 timer; |
151 | unsigned char mpd; | 151 | __u8 mpd; |
152 | } __attribute__((packed)); | 152 | } __attribute__((packed)); |
153 | 153 | ||
154 | 154 | ||
@@ -169,12 +169,12 @@ extern void dn_dev_down(struct net_device *); | |||
169 | 169 | ||
170 | extern int dn_dev_set_default(struct net_device *dev, int force); | 170 | extern int dn_dev_set_default(struct net_device *dev, int force); |
171 | extern struct net_device *dn_dev_get_default(void); | 171 | extern struct net_device *dn_dev_get_default(void); |
172 | extern int dn_dev_bind_default(dn_address *addr); | 172 | extern int dn_dev_bind_default(__le16 *addr); |
173 | 173 | ||
174 | extern int register_dnaddr_notifier(struct notifier_block *nb); | 174 | extern int register_dnaddr_notifier(struct notifier_block *nb); |
175 | extern int unregister_dnaddr_notifier(struct notifier_block *nb); | 175 | extern int unregister_dnaddr_notifier(struct notifier_block *nb); |
176 | 176 | ||
177 | static inline int dn_dev_islocal(struct net_device *dev, dn_address addr) | 177 | static inline int dn_dev_islocal(struct net_device *dev, __le16 addr) |
178 | { | 178 | { |
179 | struct dn_dev *dn_db = dev->dn_ptr; | 179 | struct dn_dev *dn_db = dev->dn_ptr; |
180 | struct dn_ifaddr *ifa; | 180 | struct dn_ifaddr *ifa; |
diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h index cd3c96d9601b..a15dcf0d5c1e 100644 --- a/include/net/dn_fib.h +++ b/include/net/dn_fib.h | |||
@@ -37,7 +37,7 @@ struct dn_fib_nh { | |||
37 | int nh_weight; | 37 | int nh_weight; |
38 | int nh_power; | 38 | int nh_power; |
39 | int nh_oif; | 39 | int nh_oif; |
40 | u32 nh_gw; | 40 | __le16 nh_gw; |
41 | }; | 41 | }; |
42 | 42 | ||
43 | struct dn_fib_info { | 43 | struct dn_fib_info { |
@@ -48,7 +48,7 @@ struct dn_fib_info { | |||
48 | int fib_dead; | 48 | int fib_dead; |
49 | unsigned fib_flags; | 49 | unsigned fib_flags; |
50 | int fib_protocol; | 50 | int fib_protocol; |
51 | dn_address fib_prefsrc; | 51 | __le16 fib_prefsrc; |
52 | __u32 fib_priority; | 52 | __u32 fib_priority; |
53 | __u32 fib_metrics[RTAX_MAX]; | 53 | __u32 fib_metrics[RTAX_MAX]; |
54 | #define dn_fib_mtu fib_metrics[RTAX_MTU-1] | 54 | #define dn_fib_mtu fib_metrics[RTAX_MTU-1] |
@@ -71,15 +71,15 @@ struct dn_fib_info { | |||
71 | #define DN_FIB_RES_OIF(res) (DN_FIB_RES_NH(res).nh_oif) | 71 | #define DN_FIB_RES_OIF(res) (DN_FIB_RES_NH(res).nh_oif) |
72 | 72 | ||
73 | typedef struct { | 73 | typedef struct { |
74 | u16 datum; | 74 | __le16 datum; |
75 | } dn_fib_key_t; | 75 | } dn_fib_key_t; |
76 | 76 | ||
77 | typedef struct { | 77 | typedef struct { |
78 | u16 datum; | 78 | __le16 datum; |
79 | } dn_fib_hash_t; | 79 | } dn_fib_hash_t; |
80 | 80 | ||
81 | typedef struct { | 81 | typedef struct { |
82 | u16 datum; | 82 | __u16 datum; |
83 | } dn_fib_idx_t; | 83 | } dn_fib_idx_t; |
84 | 84 | ||
85 | struct dn_fib_node { | 85 | struct dn_fib_node { |
@@ -126,11 +126,11 @@ extern int dn_fib_semantic_match(int type, struct dn_fib_info *fi, | |||
126 | const struct flowi *fl, | 126 | const struct flowi *fl, |
127 | struct dn_fib_res *res); | 127 | struct dn_fib_res *res); |
128 | extern void dn_fib_release_info(struct dn_fib_info *fi); | 128 | extern void dn_fib_release_info(struct dn_fib_info *fi); |
129 | extern u16 dn_fib_get_attr16(struct rtattr *attr, int attrlen, int type); | 129 | extern __le16 dn_fib_get_attr16(struct rtattr *attr, int attrlen, int type); |
130 | extern void dn_fib_flush(void); | 130 | extern void dn_fib_flush(void); |
131 | extern void dn_fib_select_multipath(const struct flowi *fl, | 131 | extern void dn_fib_select_multipath(const struct flowi *fl, |
132 | struct dn_fib_res *res); | 132 | struct dn_fib_res *res); |
133 | extern int dn_fib_sync_down(dn_address local, struct net_device *dev, | 133 | extern int dn_fib_sync_down(__le16 local, struct net_device *dev, |
134 | int force); | 134 | int force); |
135 | extern int dn_fib_sync_up(struct net_device *dev); | 135 | extern int dn_fib_sync_up(struct net_device *dev); |
136 | 136 | ||
@@ -148,8 +148,8 @@ extern void dn_fib_table_cleanup(void); | |||
148 | extern void dn_fib_rules_init(void); | 148 | extern void dn_fib_rules_init(void); |
149 | extern void dn_fib_rules_cleanup(void); | 149 | extern void dn_fib_rules_cleanup(void); |
150 | extern void dn_fib_rule_put(struct dn_fib_rule *); | 150 | extern void dn_fib_rule_put(struct dn_fib_rule *); |
151 | extern __u16 dn_fib_rules_policy(__u16 saddr, struct dn_fib_res *res, unsigned *flags); | 151 | extern __le16 dn_fib_rules_policy(__le16 saddr, struct dn_fib_res *res, unsigned *flags); |
152 | extern unsigned dnet_addr_type(__u16 addr); | 152 | extern unsigned dnet_addr_type(__le16 addr); |
153 | extern int dn_fib_lookup(const struct flowi *fl, struct dn_fib_res *res); | 153 | extern int dn_fib_lookup(const struct flowi *fl, struct dn_fib_res *res); |
154 | 154 | ||
155 | /* | 155 | /* |
@@ -194,10 +194,10 @@ extern struct dn_fib_table *dn_fib_tables[]; | |||
194 | 194 | ||
195 | #endif /* CONFIG_DECNET_ROUTER */ | 195 | #endif /* CONFIG_DECNET_ROUTER */ |
196 | 196 | ||
197 | static inline u16 dnet_make_mask(int n) | 197 | static inline __le16 dnet_make_mask(int n) |
198 | { | 198 | { |
199 | if (n) | 199 | if (n) |
200 | return htons(~((1<<(16-n))-1)); | 200 | return dn_htons(~((1<<(16-n))-1)); |
201 | return 0; | 201 | return 0; |
202 | } | 202 | } |
203 | 203 | ||
diff --git a/include/net/dn_neigh.h b/include/net/dn_neigh.h index 4b1eb038d637..4cb4ae7fb81f 100644 --- a/include/net/dn_neigh.h +++ b/include/net/dn_neigh.h | |||
@@ -7,13 +7,13 @@ | |||
7 | */ | 7 | */ |
8 | struct dn_neigh { | 8 | struct dn_neigh { |
9 | struct neighbour n; | 9 | struct neighbour n; |
10 | dn_address addr; | 10 | __le16 addr; |
11 | unsigned long flags; | 11 | unsigned long flags; |
12 | #define DN_NDFLAG_R1 0x0001 /* Router L1 */ | 12 | #define DN_NDFLAG_R1 0x0001 /* Router L1 */ |
13 | #define DN_NDFLAG_R2 0x0002 /* Router L2 */ | 13 | #define DN_NDFLAG_R2 0x0002 /* Router L2 */ |
14 | #define DN_NDFLAG_P3 0x0004 /* Phase III Node */ | 14 | #define DN_NDFLAG_P3 0x0004 /* Phase III Node */ |
15 | unsigned long blksize; | 15 | unsigned long blksize; |
16 | unsigned char priority; | 16 | __u8 priority; |
17 | }; | 17 | }; |
18 | 18 | ||
19 | extern void dn_neigh_init(void); | 19 | extern void dn_neigh_init(void); |
diff --git a/include/net/dn_nsp.h b/include/net/dn_nsp.h index e6182b86262b..96e816b6974d 100644 --- a/include/net/dn_nsp.h +++ b/include/net/dn_nsp.h | |||
@@ -72,77 +72,77 @@ extern struct sk_buff *dn_alloc_send_skb(struct sock *sk, size_t *size, int nobl | |||
72 | 72 | ||
73 | struct nsp_data_seg_msg | 73 | struct nsp_data_seg_msg |
74 | { | 74 | { |
75 | unsigned char msgflg; | 75 | __u8 msgflg; |
76 | unsigned short dstaddr; | 76 | __le16 dstaddr; |
77 | unsigned short srcaddr; | 77 | __le16 srcaddr; |
78 | } __attribute__((packed)); | 78 | } __attribute__((packed)); |
79 | 79 | ||
80 | struct nsp_data_opt_msg | 80 | struct nsp_data_opt_msg |
81 | { | 81 | { |
82 | unsigned short acknum; | 82 | __le16 acknum; |
83 | unsigned short segnum; | 83 | __le16 segnum; |
84 | unsigned short lsflgs; | 84 | __le16 lsflgs; |
85 | } __attribute__((packed)); | 85 | } __attribute__((packed)); |
86 | 86 | ||
87 | struct nsp_data_opt_msg1 | 87 | struct nsp_data_opt_msg1 |
88 | { | 88 | { |
89 | unsigned short acknum; | 89 | __le16 acknum; |
90 | unsigned short segnum; | 90 | __le16 segnum; |
91 | } __attribute__((packed)); | 91 | } __attribute__((packed)); |
92 | 92 | ||
93 | 93 | ||
94 | /* Acknowledgment Message (data/other data) */ | 94 | /* Acknowledgment Message (data/other data) */ |
95 | struct nsp_data_ack_msg | 95 | struct nsp_data_ack_msg |
96 | { | 96 | { |
97 | unsigned char msgflg; | 97 | __u8 msgflg; |
98 | unsigned short dstaddr; | 98 | __le16 dstaddr; |
99 | unsigned short srcaddr; | 99 | __le16 srcaddr; |
100 | unsigned short acknum; | 100 | __le16 acknum; |
101 | } __attribute__((packed)); | 101 | } __attribute__((packed)); |
102 | 102 | ||
103 | /* Connect Acknowledgment Message */ | 103 | /* Connect Acknowledgment Message */ |
104 | struct nsp_conn_ack_msg | 104 | struct nsp_conn_ack_msg |
105 | { | 105 | { |
106 | unsigned char msgflg; | 106 | __u8 msgflg; |
107 | unsigned short dstaddr; | 107 | __le16 dstaddr; |
108 | } __attribute__((packed)); | 108 | } __attribute__((packed)); |
109 | 109 | ||
110 | 110 | ||
111 | /* Connect Initiate/Retransmit Initiate/Connect Confirm */ | 111 | /* Connect Initiate/Retransmit Initiate/Connect Confirm */ |
112 | struct nsp_conn_init_msg | 112 | struct nsp_conn_init_msg |
113 | { | 113 | { |
114 | unsigned char msgflg; | 114 | __u8 msgflg; |
115 | #define NSP_CI 0x18 /* Connect Initiate */ | 115 | #define NSP_CI 0x18 /* Connect Initiate */ |
116 | #define NSP_RCI 0x68 /* Retrans. Conn Init */ | 116 | #define NSP_RCI 0x68 /* Retrans. Conn Init */ |
117 | unsigned short dstaddr; | 117 | __le16 dstaddr; |
118 | unsigned short srcaddr; | 118 | __le16 srcaddr; |
119 | unsigned char services; | 119 | __u8 services; |
120 | #define NSP_FC_NONE 0x00 /* Flow Control None */ | 120 | #define NSP_FC_NONE 0x00 /* Flow Control None */ |
121 | #define NSP_FC_SRC 0x04 /* Seg Req. Count */ | 121 | #define NSP_FC_SRC 0x04 /* Seg Req. Count */ |
122 | #define NSP_FC_SCMC 0x08 /* Sess. Control Mess */ | 122 | #define NSP_FC_SCMC 0x08 /* Sess. Control Mess */ |
123 | #define NSP_FC_MASK 0x0c /* FC type mask */ | 123 | #define NSP_FC_MASK 0x0c /* FC type mask */ |
124 | unsigned char info; | 124 | __u8 info; |
125 | unsigned short segsize; | 125 | __le16 segsize; |
126 | } __attribute__((packed)); | 126 | } __attribute__((packed)); |
127 | 127 | ||
128 | /* Disconnect Initiate/Disconnect Confirm */ | 128 | /* Disconnect Initiate/Disconnect Confirm */ |
129 | struct nsp_disconn_init_msg | 129 | struct nsp_disconn_init_msg |
130 | { | 130 | { |
131 | unsigned char msgflg; | 131 | __u8 msgflg; |
132 | unsigned short dstaddr; | 132 | __le16 dstaddr; |
133 | unsigned short srcaddr; | 133 | __le16 srcaddr; |
134 | unsigned short reason; | 134 | __le16 reason; |
135 | } __attribute__((packed)); | 135 | } __attribute__((packed)); |
136 | 136 | ||
137 | 137 | ||
138 | 138 | ||
139 | struct srcobj_fmt | 139 | struct srcobj_fmt |
140 | { | 140 | { |
141 | char format; | 141 | __u8 format; |
142 | unsigned char task; | 142 | __u8 task; |
143 | unsigned short grpcode; | 143 | __le16 grpcode; |
144 | unsigned short usrcode; | 144 | __le16 usrcode; |
145 | char dlen; | 145 | __u8 dlen; |
146 | } __attribute__((packed)); | 146 | } __attribute__((packed)); |
147 | 147 | ||
148 | /* | 148 | /* |
@@ -150,7 +150,7 @@ struct srcobj_fmt | |||
150 | * numbers used in NSP. Similar in operation to the functions | 150 | * numbers used in NSP. Similar in operation to the functions |
151 | * of the same name in TCP. | 151 | * of the same name in TCP. |
152 | */ | 152 | */ |
153 | static __inline__ int dn_before(unsigned short seq1, unsigned short seq2) | 153 | static __inline__ int dn_before(__u16 seq1, __u16 seq2) |
154 | { | 154 | { |
155 | seq1 &= 0x0fff; | 155 | seq1 &= 0x0fff; |
156 | seq2 &= 0x0fff; | 156 | seq2 &= 0x0fff; |
@@ -159,7 +159,7 @@ static __inline__ int dn_before(unsigned short seq1, unsigned short seq2) | |||
159 | } | 159 | } |
160 | 160 | ||
161 | 161 | ||
162 | static __inline__ int dn_after(unsigned short seq1, unsigned short seq2) | 162 | static __inline__ int dn_after(__u16 seq1, __u16 seq2) |
163 | { | 163 | { |
164 | seq1 &= 0x0fff; | 164 | seq1 &= 0x0fff; |
165 | seq2 &= 0x0fff; | 165 | seq2 &= 0x0fff; |
@@ -167,23 +167,23 @@ static __inline__ int dn_after(unsigned short seq1, unsigned short seq2) | |||
167 | return (int)((seq2 - seq1) & 0x0fff) > 2048; | 167 | return (int)((seq2 - seq1) & 0x0fff) > 2048; |
168 | } | 168 | } |
169 | 169 | ||
170 | static __inline__ int dn_equal(unsigned short seq1, unsigned short seq2) | 170 | static __inline__ int dn_equal(__u16 seq1, __u16 seq2) |
171 | { | 171 | { |
172 | return ((seq1 ^ seq2) & 0x0fff) == 0; | 172 | return ((seq1 ^ seq2) & 0x0fff) == 0; |
173 | } | 173 | } |
174 | 174 | ||
175 | static __inline__ int dn_before_or_equal(unsigned short seq1, unsigned short seq2) | 175 | static __inline__ int dn_before_or_equal(__u16 seq1, __u16 seq2) |
176 | { | 176 | { |
177 | return (dn_before(seq1, seq2) || dn_equal(seq1, seq2)); | 177 | return (dn_before(seq1, seq2) || dn_equal(seq1, seq2)); |
178 | } | 178 | } |
179 | 179 | ||
180 | static __inline__ void seq_add(unsigned short *seq, unsigned short off) | 180 | static __inline__ void seq_add(__u16 *seq, __u16 off) |
181 | { | 181 | { |
182 | (*seq) += off; | 182 | (*seq) += off; |
183 | (*seq) &= 0x0fff; | 183 | (*seq) &= 0x0fff; |
184 | } | 184 | } |
185 | 185 | ||
186 | static __inline__ int seq_next(unsigned short seq1, unsigned short seq2) | 186 | static __inline__ int seq_next(__u16 seq1, __u16 seq2) |
187 | { | 187 | { |
188 | return dn_equal(seq1 + 1, seq2); | 188 | return dn_equal(seq1 + 1, seq2); |
189 | } | 189 | } |
@@ -191,7 +191,7 @@ static __inline__ int seq_next(unsigned short seq1, unsigned short seq2) | |||
191 | /* | 191 | /* |
192 | * Can we delay the ack ? | 192 | * Can we delay the ack ? |
193 | */ | 193 | */ |
194 | static __inline__ int sendack(unsigned short seq) | 194 | static __inline__ int sendack(__u16 seq) |
195 | { | 195 | { |
196 | return (int)((seq & 0x1000) ? 0 : 1); | 196 | return (int)((seq & 0x1000) ? 0 : 1); |
197 | } | 197 | } |
diff --git a/include/net/dn_route.h b/include/net/dn_route.h index 5122da3f2eb3..76f957e258b0 100644 --- a/include/net/dn_route.h +++ b/include/net/dn_route.h | |||
@@ -71,12 +71,12 @@ struct dn_route { | |||
71 | struct dn_route *rt_next; | 71 | struct dn_route *rt_next; |
72 | } u; | 72 | } u; |
73 | 73 | ||
74 | __u16 rt_saddr; | 74 | __le16 rt_saddr; |
75 | __u16 rt_daddr; | 75 | __le16 rt_daddr; |
76 | __u16 rt_gateway; | 76 | __le16 rt_gateway; |
77 | __u16 rt_local_src; /* Source used for forwarding packets */ | 77 | __le16 rt_local_src; /* Source used for forwarding packets */ |
78 | __u16 rt_src_map; | 78 | __le16 rt_src_map; |
79 | __u16 rt_dst_map; | 79 | __le16 rt_dst_map; |
80 | 80 | ||
81 | unsigned rt_flags; | 81 | unsigned rt_flags; |
82 | unsigned rt_type; | 82 | unsigned rt_type; |
diff --git a/include/net/flow.h b/include/net/flow.h index ec7eb86eb203..04d89f763451 100644 --- a/include/net/flow.h +++ b/include/net/flow.h | |||
@@ -30,8 +30,8 @@ struct flowi { | |||
30 | } ip6_u; | 30 | } ip6_u; |
31 | 31 | ||
32 | struct { | 32 | struct { |
33 | __u16 daddr; | 33 | __le16 daddr; |
34 | __u16 saddr; | 34 | __le16 saddr; |
35 | __u32 fwmark; | 35 | __u32 fwmark; |
36 | __u8 scope; | 36 | __u8 scope; |
37 | } dn_u; | 37 | } dn_u; |
@@ -64,8 +64,8 @@ struct flowi { | |||
64 | } icmpt; | 64 | } icmpt; |
65 | 65 | ||
66 | struct { | 66 | struct { |
67 | __u16 sport; | 67 | __le16 sport; |
68 | __u16 dport; | 68 | __le16 dport; |
69 | __u8 objnum; | 69 | __u8 objnum; |
70 | __u8 objnamel; /* Not 16 bits since max val is 16 */ | 70 | __u8 objnamel; /* Not 16 bits since max val is 16 */ |
71 | __u8 objname[16]; /* Not zero terminated */ | 71 | __u8 objname[16]; /* Not zero terminated */ |