Commit 717234e00249960df3a252c9188fc0abe9d8f4e3

Authored by Sergey Temerkhanov
Committed by Simon Glass
1 parent 5917e7d165

net: Convert protocol structures to use explicit sizes

Convert uchar/ushort to u8/u16 respectively.

Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com>
Signed-off-by: Sergey Temerkhanov <s.temerkhanov@gmail.com>
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>

Showing 2 changed files with 63 additions and 63 deletions Side-by-side Diff

... ... @@ -259,9 +259,9 @@
259 259 */
260 260  
261 261 struct ethernet_hdr {
262   - uchar et_dest[6]; /* Destination node */
263   - uchar et_src[6]; /* Source node */
264   - ushort et_protlen; /* Protocol or length */
  262 + u8 et_dest[6]; /* Destination node */
  263 + u8 et_src[6]; /* Source node */
  264 + u16 et_protlen; /* Protocol or length */
265 265 };
266 266  
267 267 /* Ethernet header size */
... ... @@ -270,16 +270,16 @@
270 270 #define ETH_FCS_LEN 4 /* Octets in the FCS */
271 271  
272 272 struct e802_hdr {
273   - uchar et_dest[6]; /* Destination node */
274   - uchar et_src[6]; /* Source node */
275   - ushort et_protlen; /* Protocol or length */
276   - uchar et_dsap; /* 802 DSAP */
277   - uchar et_ssap; /* 802 SSAP */
278   - uchar et_ctl; /* 802 control */
279   - uchar et_snap1; /* SNAP */
280   - uchar et_snap2;
281   - uchar et_snap3;
282   - ushort et_prot; /* 802 protocol */
  273 + u8 et_dest[6]; /* Destination node */
  274 + u8 et_src[6]; /* Source node */
  275 + u16 et_protlen; /* Protocol or length */
  276 + u8 et_dsap; /* 802 DSAP */
  277 + u8 et_ssap; /* 802 SSAP */
  278 + u8 et_ctl; /* 802 control */
  279 + u8 et_snap1; /* SNAP */
  280 + u8 et_snap2;
  281 + u8 et_snap3;
  282 + u16 et_prot; /* 802 protocol */
283 283 };
284 284  
285 285 /* 802 + SNAP + ethernet header size */
... ... @@ -289,11 +289,11 @@
289 289 * Virtual LAN Ethernet header
290 290 */
291 291 struct vlan_ethernet_hdr {
292   - uchar vet_dest[6]; /* Destination node */
293   - uchar vet_src[6]; /* Source node */
294   - ushort vet_vlan_type; /* PROT_VLAN */
295   - ushort vet_tag; /* TAG of VLAN */
296   - ushort vet_type; /* protocol type */
  292 + u8 vet_dest[6]; /* Destination node */
  293 + u8 vet_src[6]; /* Source node */
  294 + u16 vet_vlan_type; /* PROT_VLAN */
  295 + u16 vet_tag; /* TAG of VLAN */
  296 + u16 vet_type; /* protocol type */
297 297 };
298 298  
299 299 /* VLAN Ethernet header size */
... ... @@ -311,14 +311,14 @@
311 311 * Internet Protocol (IP) header.
312 312 */
313 313 struct ip_hdr {
314   - uchar ip_hl_v; /* header length and version */
315   - uchar ip_tos; /* type of service */
316   - ushort ip_len; /* total length */
317   - ushort ip_id; /* identification */
318   - ushort ip_off; /* fragment offset field */
319   - uchar ip_ttl; /* time to live */
320   - uchar ip_p; /* protocol */
321   - ushort ip_sum; /* checksum */
  314 + u8 ip_hl_v; /* header length and version */
  315 + u8 ip_tos; /* type of service */
  316 + u16 ip_len; /* total length */
  317 + u16 ip_id; /* identification */
  318 + u16 ip_off; /* fragment offset field */
  319 + u8 ip_ttl; /* time to live */
  320 + u8 ip_p; /* protocol */
  321 + u16 ip_sum; /* checksum */
322 322 struct in_addr ip_src; /* Source IP address */
323 323 struct in_addr ip_dst; /* Destination IP address */
324 324 };
325 325  
... ... @@ -335,20 +335,20 @@
335 335 * Internet Protocol (IP) + UDP header.
336 336 */
337 337 struct ip_udp_hdr {
338   - uchar ip_hl_v; /* header length and version */
339   - uchar ip_tos; /* type of service */
340   - ushort ip_len; /* total length */
341   - ushort ip_id; /* identification */
342   - ushort ip_off; /* fragment offset field */
343   - uchar ip_ttl; /* time to live */
344   - uchar ip_p; /* protocol */
345   - ushort ip_sum; /* checksum */
  338 + u8 ip_hl_v; /* header length and version */
  339 + u8 ip_tos; /* type of service */
  340 + u16 ip_len; /* total length */
  341 + u16 ip_id; /* identification */
  342 + u16 ip_off; /* fragment offset field */
  343 + u8 ip_ttl; /* time to live */
  344 + u8 ip_p; /* protocol */
  345 + u16 ip_sum; /* checksum */
346 346 struct in_addr ip_src; /* Source IP address */
347 347 struct in_addr ip_dst; /* Destination IP address */
348   - ushort udp_src; /* UDP source port */
349   - ushort udp_dst; /* UDP destination port */
350   - ushort udp_len; /* Length of UDP packet */
351   - ushort udp_xsum; /* Checksum */
  348 + u16 udp_src; /* UDP source port */
  349 + u16 udp_dst; /* UDP destination port */
  350 + u16 udp_len; /* Length of UDP packet */
  351 + u16 udp_xsum; /* Checksum */
352 352 };
353 353  
354 354 #define IP_UDP_HDR_SIZE (sizeof(struct ip_udp_hdr))
355 355  
356 356  
357 357  
... ... @@ -358,14 +358,14 @@
358 358 * Address Resolution Protocol (ARP) header.
359 359 */
360 360 struct arp_hdr {
361   - ushort ar_hrd; /* Format of hardware address */
  361 + u16 ar_hrd; /* Format of hardware address */
362 362 # define ARP_ETHER 1 /* Ethernet hardware address */
363   - ushort ar_pro; /* Format of protocol address */
364   - uchar ar_hln; /* Length of hardware address */
  363 + u16 ar_pro; /* Format of protocol address */
  364 + u8 ar_hln; /* Length of hardware address */
365 365 # define ARP_HLEN 6
366   - uchar ar_pln; /* Length of protocol address */
  366 + u8 ar_pln; /* Length of protocol address */
367 367 # define ARP_PLEN 4
368   - ushort ar_op; /* Operation */
  368 + u16 ar_op; /* Operation */
369 369 # define ARPOP_REQUEST 1 /* Request to resolve address */
370 370 # define ARPOP_REPLY 2 /* Response to previous request */
371 371  
372 372  
... ... @@ -377,16 +377,16 @@
377 377 * the sizes above, and are defined as appropriate for
378 378 * specific hardware/protocol combinations.
379 379 */
380   - uchar ar_data[0];
  380 + u8 ar_data[0];
381 381 #define ar_sha ar_data[0]
382 382 #define ar_spa ar_data[ARP_HLEN]
383 383 #define ar_tha ar_data[ARP_HLEN + ARP_PLEN]
384 384 #define ar_tpa ar_data[ARP_HLEN + ARP_PLEN + ARP_HLEN]
385 385 #if 0
386   - uchar ar_sha[]; /* Sender hardware address */
387   - uchar ar_spa[]; /* Sender protocol address */
388   - uchar ar_tha[]; /* Target hardware address */
389   - uchar ar_tpa[]; /* Target protocol address */
  386 + u8 ar_sha[]; /* Sender hardware address */
  387 + u8 ar_spa[]; /* Sender protocol address */
  388 + u8 ar_tha[]; /* Target hardware address */
  389 + u8 ar_tpa[]; /* Target protocol address */
390 390 #endif /* 0 */
391 391 };
392 392  
393 393  
394 394  
395 395  
... ... @@ -408,20 +408,20 @@
408 408 #define ICMP_NOT_REACH_PORT 3 /* Port unreachable */
409 409  
410 410 struct icmp_hdr {
411   - uchar type;
412   - uchar code;
413   - ushort checksum;
  411 + u8 type;
  412 + u8 code;
  413 + u16 checksum;
414 414 union {
415 415 struct {
416   - ushort id;
417   - ushort sequence;
  416 + u16 id;
  417 + u16 sequence;
418 418 } echo;
419 419 u32 gateway;
420 420 struct {
421   - ushort unused;
422   - ushort mtu;
  421 + u16 unused;
  422 + u16 mtu;
423 423 } frag;
424   - uchar data[0];
  424 + u8 data[0];
425 425 } un;
426 426 };
427 427  
... ... @@ -30,22 +30,22 @@
30 30 #endif
31 31  
32 32 struct bootp_hdr {
33   - uchar bp_op; /* Operation */
  33 + u8 bp_op; /* Operation */
34 34 # define OP_BOOTREQUEST 1
35 35 # define OP_BOOTREPLY 2
36   - uchar bp_htype; /* Hardware type */
  36 + u8 bp_htype; /* Hardware type */
37 37 # define HWT_ETHER 1
38   - uchar bp_hlen; /* Hardware address length */
  38 + u8 bp_hlen; /* Hardware address length */
39 39 # define HWL_ETHER 6
40   - uchar bp_hops; /* Hop count (gateway thing) */
  40 + u8 bp_hops; /* Hop count (gateway thing) */
41 41 u32 bp_id; /* Transaction ID */
42   - ushort bp_secs; /* Seconds since boot */
43   - ushort bp_spare1; /* Alignment */
  42 + u16 bp_secs; /* Seconds since boot */
  43 + u16 bp_spare1; /* Alignment */
44 44 struct in_addr bp_ciaddr; /* Client IP address */
45 45 struct in_addr bp_yiaddr; /* Your (client) IP address */
46 46 struct in_addr bp_siaddr; /* Server IP address */
47 47 struct in_addr bp_giaddr; /* Gateway IP address */
48   - uchar bp_chaddr[16]; /* Client hardware address */
  48 + u8 bp_chaddr[16]; /* Client hardware address */
49 49 char bp_sname[64]; /* Server host name */
50 50 char bp_file[128]; /* Boot file name */
51 51 char bp_vend[OPT_FIELD_SIZE]; /* Vendor information */