Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

endianness annotations drivers/net/bonding/

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jeff Garzik <jeff@garzik.org>

authored by

Al Viro and committed by
David S. Miller
d3bb52b0 dd96df2c

+48 -73
+9 -33
drivers/net/bonding/bond_3ad.c
··· 101 101 static u8 __get_duplex(struct port *port); 102 102 static inline void __initialize_port_locks(struct port *port); 103 103 //conversions 104 - static void __htons_lacpdu(struct lacpdu *lacpdu); 105 104 static u16 __ad_timer_to_ticks(u16 timer_type, u16 Par); 106 105 107 106 ··· 419 420 } 420 421 421 422 //conversions 422 - /** 423 - * __htons_lacpdu - convert the contents of a LACPDU to network byte order 424 - * @lacpdu: the speicifed lacpdu 425 - * 426 - * For each multi-byte field in the lacpdu, convert its content 427 - */ 428 - static void __htons_lacpdu(struct lacpdu *lacpdu) 429 - { 430 - if (lacpdu) { 431 - lacpdu->actor_system_priority = htons(lacpdu->actor_system_priority); 432 - lacpdu->actor_key = htons(lacpdu->actor_key); 433 - lacpdu->actor_port_priority = htons(lacpdu->actor_port_priority); 434 - lacpdu->actor_port = htons(lacpdu->actor_port); 435 - lacpdu->partner_system_priority = htons(lacpdu->partner_system_priority); 436 - lacpdu->partner_key = htons(lacpdu->partner_key); 437 - lacpdu->partner_port_priority = htons(lacpdu->partner_port_priority); 438 - lacpdu->partner_port = htons(lacpdu->partner_port); 439 - lacpdu->collector_max_delay = htons(lacpdu->collector_max_delay); 440 - } 441 - } 442 423 443 424 /** 444 425 * __ad_timer_to_ticks - convert a given timer type to AD module ticks ··· 806 827 * lacpdu->actor_information_length initialized 807 828 */ 808 829 809 - lacpdu->actor_system_priority = port->actor_system_priority; 830 + lacpdu->actor_system_priority = htons(port->actor_system_priority); 810 831 lacpdu->actor_system = port->actor_system; 811 - lacpdu->actor_key = port->actor_oper_port_key; 812 - lacpdu->actor_port_priority = port->actor_port_priority; 813 - lacpdu->actor_port = port->actor_port_number; 832 + lacpdu->actor_key = htons(port->actor_oper_port_key); 833 + lacpdu->actor_port_priority = htons(port->actor_port_priority); 834 + lacpdu->actor_port = htons(port->actor_port_number); 814 835 lacpdu->actor_state = port->actor_oper_port_state; 815 836 816 837 /* lacpdu->reserved_3_1 initialized ··· 818 839 * lacpdu->partner_information_length initialized 819 840 */ 820 841 821 - lacpdu->partner_system_priority = port->partner_oper_system_priority; 842 + lacpdu->partner_system_priority = htons(port->partner_oper_system_priority); 822 843 lacpdu->partner_system = port->partner_oper_system; 823 - lacpdu->partner_key = port->partner_oper_key; 824 - lacpdu->partner_port_priority = port->partner_oper_port_priority; 825 - lacpdu->partner_port = port->partner_oper_port_number; 844 + lacpdu->partner_key = htons(port->partner_oper_key); 845 + lacpdu->partner_port_priority = htons(port->partner_oper_port_priority); 846 + lacpdu->partner_port = htons(port->partner_oper_port_number); 826 847 lacpdu->partner_state = port->partner_oper_port_state; 827 848 828 849 /* lacpdu->reserved_3_2 initialized ··· 834 855 * terminator_length initialized 835 856 * reserved_50[50] initialized 836 857 */ 837 - 838 - /* Convert all non u8 parameters to Big Endian for transmit */ 839 - __htons_lacpdu(lacpdu); 840 858 } 841 859 842 860 ////////////////////////////////////////////////////////////////////////////////////// ··· 1810 1834 } 1811 1835 lacpdu->tlv_type_collector_info = 0x03; 1812 1836 lacpdu->collector_information_length= 0x10; 1813 - lacpdu->collector_max_delay = AD_COLLECTOR_MAX_DELAY; 1837 + lacpdu->collector_max_delay = htons(AD_COLLECTOR_MAX_DELAY); 1814 1838 for (index=0; index<=11; index++) { 1815 1839 lacpdu->reserved_12[index]=0; 1816 1840 }
+10 -10
drivers/net/bonding/bond_3ad.h
··· 108 108 typedef struct ad_header { 109 109 struct mac_addr destination_address; 110 110 struct mac_addr source_address; 111 - u16 length_type; 111 + __be16 length_type; 112 112 } ad_header_t; 113 113 114 114 // Link Aggregation Control Protocol(LACP) data unit structure(43.4.2.2 in the 802.3ad standard) ··· 117 117 u8 version_number; 118 118 u8 tlv_type_actor_info; // = actor information(type/length/value) 119 119 u8 actor_information_length; // = 20 120 - u16 actor_system_priority; 120 + __be16 actor_system_priority; 121 121 struct mac_addr actor_system; 122 - u16 actor_key; 123 - u16 actor_port_priority; 124 - u16 actor_port; 122 + __be16 actor_key; 123 + __be16 actor_port_priority; 124 + __be16 actor_port; 125 125 u8 actor_state; 126 126 u8 reserved_3_1[3]; // = 0 127 127 u8 tlv_type_partner_info; // = partner information 128 128 u8 partner_information_length; // = 20 129 - u16 partner_system_priority; 129 + __be16 partner_system_priority; 130 130 struct mac_addr partner_system; 131 - u16 partner_key; 132 - u16 partner_port_priority; 133 - u16 partner_port; 131 + __be16 partner_key; 132 + __be16 partner_port_priority; 133 + __be16 partner_port; 134 134 u8 partner_state; 135 135 u8 reserved_3_2[3]; // = 0 136 136 u8 tlv_type_collector_info; // = collector information 137 137 u8 collector_information_length; // = 16 138 - u16 collector_max_delay; 138 + __be16 collector_max_delay; 139 139 u8 reserved_12[12]; 140 140 u8 tlv_type_terminator; // = terminator 141 141 u8 terminator_length; // = 0
+9 -10
drivers/net/bonding/bond_alb.c
··· 87 87 struct learning_pkt { 88 88 u8 mac_dst[ETH_ALEN]; 89 89 u8 mac_src[ETH_ALEN]; 90 - u16 type; 90 + __be16 type; 91 91 u8 padding[ETH_ZLEN - ETH_HLEN]; 92 92 }; 93 93 94 94 struct arp_pkt { 95 - u16 hw_addr_space; 96 - u16 prot_addr_space; 95 + __be16 hw_addr_space; 96 + __be16 prot_addr_space; 97 97 u8 hw_addr_len; 98 98 u8 prot_addr_len; 99 - u16 op_code; 99 + __be16 op_code; 100 100 u8 mac_src[ETH_ALEN]; /* sender hardware address */ 101 - u32 ip_src; /* sender IP address */ 101 + __be32 ip_src; /* sender IP address */ 102 102 u8 mac_dst[ETH_ALEN]; /* target hardware address */ 103 - u32 ip_dst; /* target IP address */ 103 + __be32 ip_dst; /* target IP address */ 104 104 }; 105 105 #pragma pack() 106 106 ··· 582 582 } 583 583 584 584 /* mark all clients using src_ip to be updated */ 585 - static void rlb_req_update_subnet_clients(struct bonding *bond, u32 src_ip) 585 + static void rlb_req_update_subnet_clients(struct bonding *bond, __be32 src_ip) 586 586 { 587 587 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); 588 588 struct rlb_client_info *client_info; ··· 1267 1267 struct ethhdr *eth_data; 1268 1268 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); 1269 1269 struct slave *tx_slave = NULL; 1270 - static const u32 ip_bcast = 0xffffffff; 1270 + static const __be32 ip_bcast = htonl(0xffffffff); 1271 1271 int hash_size = 0; 1272 1272 int do_tx_balance = 1; 1273 1273 u32 hash_index = 0; ··· 1311 1311 hash_size = sizeof(ipv6_hdr(skb)->daddr); 1312 1312 break; 1313 1313 case ETH_P_IPX: 1314 - if (ipx_hdr(skb)->ipx_checksum != 1315 - __constant_htons(IPX_NO_CHECKSUM)) { 1314 + if (ipx_hdr(skb)->ipx_checksum != IPX_NO_CHECKSUM) { 1316 1315 /* something is wrong with this packet */ 1317 1316 do_tx_balance = 0; 1318 1317 break;
+2 -2
drivers/net/bonding/bond_alb.h
··· 60 60 * ------------------------------------------------------------------------- 61 61 */ 62 62 struct rlb_client_info { 63 - u32 ip_src; /* the server IP address */ 64 - u32 ip_dst; /* the client IP address */ 63 + __be32 ip_src; /* the server IP address */ 64 + __be32 ip_dst; /* the client IP address */ 65 65 u8 mac_dst[ETH_ALEN]; /* the client MAC address */ 66 66 u32 next; /* The next Hash table entry index */ 67 67 u32 prev; /* The previous Hash table entry index */
+11 -11
drivers/net/bonding/bond_main.c
··· 144 144 #endif 145 145 146 146 extern struct rw_semaphore bonding_rwsem; 147 - static u32 arp_target[BOND_MAX_ARP_TARGETS] = { 0, } ; 147 + static __be32 arp_target[BOND_MAX_ARP_TARGETS] = { 0, } ; 148 148 static int arp_ip_count = 0; 149 149 static int bond_mode = BOND_MODE_ROUNDROBIN; 150 150 static int xmit_hashtype= BOND_XMIT_POLICY_LAYER2; ··· 2226 2226 } 2227 2227 2228 2228 2229 - static u32 bond_glean_dev_ip(struct net_device *dev) 2229 + static __be32 bond_glean_dev_ip(struct net_device *dev) 2230 2230 { 2231 2231 struct in_device *idev; 2232 2232 struct in_ifaddr *ifa; ··· 2269 2269 return 0; 2270 2270 } 2271 2271 2272 - static int bond_has_this_ip(struct bonding *bond, u32 ip) 2272 + static int bond_has_this_ip(struct bonding *bond, __be32 ip) 2273 2273 { 2274 2274 struct vlan_entry *vlan, *vlan_next; 2275 2275 ··· 2293 2293 * switches in VLAN mode (especially if ports are configured as 2294 2294 * "native" to a VLAN) might not pass non-tagged frames. 2295 2295 */ 2296 - static void bond_arp_send(struct net_device *slave_dev, int arp_op, u32 dest_ip, u32 src_ip, unsigned short vlan_id) 2296 + static void bond_arp_send(struct net_device *slave_dev, int arp_op, __be32 dest_ip, __be32 src_ip, unsigned short vlan_id) 2297 2297 { 2298 2298 struct sk_buff *skb; 2299 2299 ··· 2321 2321 static void bond_arp_send_all(struct bonding *bond, struct slave *slave) 2322 2322 { 2323 2323 int i, vlan_id, rv; 2324 - u32 *targets = bond->params.arp_targets; 2324 + __be32 *targets = bond->params.arp_targets; 2325 2325 struct vlan_entry *vlan, *vlan_next; 2326 2326 struct net_device *vlan_dev; 2327 2327 struct flowi fl; ··· 2426 2426 } 2427 2427 } 2428 2428 2429 - static void bond_validate_arp(struct bonding *bond, struct slave *slave, u32 sip, u32 tip) 2429 + static void bond_validate_arp(struct bonding *bond, struct slave *slave, __be32 sip, __be32 tip) 2430 2430 { 2431 2431 int i; 2432 - u32 *targets = bond->params.arp_targets; 2432 + __be32 *targets = bond->params.arp_targets; 2433 2433 2434 2434 targets = bond->params.arp_targets; 2435 2435 for (i = 0; (i < BOND_MAX_ARP_TARGETS) && targets[i]; i++) { ··· 2451 2451 struct slave *slave; 2452 2452 struct bonding *bond; 2453 2453 unsigned char *arp_ptr; 2454 - u32 sip, tip; 2454 + __be32 sip, tip; 2455 2455 2456 2456 if (dev->nd_net != &init_net) 2457 2457 goto out; ··· 3427 3427 { 3428 3428 struct ethhdr *data = (struct ethhdr *)skb->data; 3429 3429 struct iphdr *iph = ip_hdr(skb); 3430 - u16 *layer4hdr = (u16 *)((u32 *)iph + iph->ihl); 3430 + __be16 *layer4hdr = (__be16 *)((u32 *)iph + iph->ihl); 3431 3431 int layer4_xor = 0; 3432 3432 3433 3433 if (skb->protocol == __constant_htons(ETH_P_IP)) { 3434 3434 if (!(iph->frag_off & __constant_htons(IP_MF|IP_OFFSET)) && 3435 3435 (iph->protocol == IPPROTO_TCP || 3436 3436 iph->protocol == IPPROTO_UDP)) { 3437 - layer4_xor = htons((*layer4hdr ^ *(layer4hdr + 1))); 3437 + layer4_xor = ntohs((*layer4hdr ^ *(layer4hdr + 1))); 3438 3438 } 3439 3439 return (layer4_xor ^ 3440 3440 ((ntohl(iph->saddr ^ iph->daddr)) & 0xffff)) % count; ··· 4521 4521 arp_ip_target[arp_ip_count]); 4522 4522 arp_interval = 0; 4523 4523 } else { 4524 - u32 ip = in_aton(arp_ip_target[arp_ip_count]); 4524 + __be32 ip = in_aton(arp_ip_target[arp_ip_count]); 4525 4525 arp_target[arp_ip_count] = ip; 4526 4526 } 4527 4527 }
+4 -4
drivers/net/bonding/bond_sysfs.c
··· 682 682 struct device_attribute *attr, 683 683 const char *buf, size_t count) 684 684 { 685 - u32 newtarget; 685 + __be32 newtarget; 686 686 int i = 0, done = 0, ret = count; 687 687 struct bonding *bond = to_bond(d); 688 - u32 *targets; 688 + __be32 *targets; 689 689 690 690 targets = bond->params.arp_targets; 691 691 newtarget = in_aton(buf + 1); 692 692 /* look for adds */ 693 693 if (buf[0] == '+') { 694 - if ((newtarget == 0) || (newtarget == INADDR_BROADCAST)) { 694 + if ((newtarget == 0) || (newtarget == htonl(INADDR_BROADCAST))) { 695 695 printk(KERN_ERR DRV_NAME 696 696 ": %s: invalid ARP target %u.%u.%u.%u specified for addition\n", 697 697 bond->dev->name, NIPQUAD(newtarget)); ··· 727 727 728 728 } 729 729 else if (buf[0] == '-') { 730 - if ((newtarget == 0) || (newtarget == INADDR_BROADCAST)) { 730 + if ((newtarget == 0) || (newtarget == htonl(INADDR_BROADCAST))) { 731 731 printk(KERN_ERR DRV_NAME 732 732 ": %s: invalid ARP target %d.%d.%d.%d specified for removal\n", 733 733 bond->dev->name, NIPQUAD(newtarget));
+3 -3
drivers/net/bonding/bonding.h
··· 132 132 int downdelay; 133 133 int lacp_fast; 134 134 char primary[IFNAMSIZ]; 135 - u32 arp_targets[BOND_MAX_ARP_TARGETS]; 135 + __be32 arp_targets[BOND_MAX_ARP_TARGETS]; 136 136 }; 137 137 138 138 struct bond_parm_tbl { ··· 142 142 143 143 struct vlan_entry { 144 144 struct list_head vlan_list; 145 - u32 vlan_ip; 145 + __be32 vlan_ip; 146 146 unsigned short vlan_id; 147 147 }; 148 148 ··· 193 193 struct list_head bond_list; 194 194 struct dev_mc_list *mc_list; 195 195 int (*xmit_hash_policy)(struct sk_buff *, struct net_device *, int); 196 - u32 master_ip; 196 + __be32 master_ip; 197 197 u16 flags; 198 198 struct ad_bond_info ad_info; 199 199 struct alb_bond_info alb_info;