Commit 2e4ca75b31b6851dcc036c2cdebf3ecfe279a653
Committed by
David S. Miller
1 parent
d3e01f7186
Exists in
master
and in
7 other branches
[ETH]: indentation and cleanup
Run ethernet support through Lindent and fix up. Applies after docbook comments patch Signed-off-by: Stephen Hemminger <shemminger@osdl.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 1 changed file with 46 additions and 50 deletions Side-by-side Diff
net/ethernet/eth.c
... | ... | @@ -78,39 +78,37 @@ |
78 | 78 | * in here instead. It is up to the 802.2 layer to carry protocol information. |
79 | 79 | */ |
80 | 80 | int eth_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, |
81 | - void *daddr, void *saddr, unsigned len) | |
81 | + void *daddr, void *saddr, unsigned len) | |
82 | 82 | { |
83 | - struct ethhdr *eth = (struct ethhdr *)skb_push(skb,ETH_HLEN); | |
83 | + struct ethhdr *eth = (struct ethhdr *)skb_push(skb, ETH_HLEN); | |
84 | 84 | |
85 | - if(type!=ETH_P_802_3) | |
85 | + if (type != ETH_P_802_3) | |
86 | 86 | eth->h_proto = htons(type); |
87 | 87 | else |
88 | 88 | eth->h_proto = htons(len); |
89 | 89 | |
90 | 90 | /* |
91 | - * Set the source hardware address. | |
91 | + * Set the source hardware address. | |
92 | 92 | */ |
93 | - | |
94 | - if(!saddr) | |
93 | + | |
94 | + if (!saddr) | |
95 | 95 | saddr = dev->dev_addr; |
96 | - memcpy(eth->h_source,saddr,dev->addr_len); | |
96 | + memcpy(eth->h_source, saddr, dev->addr_len); | |
97 | 97 | |
98 | - if(daddr) | |
99 | - { | |
100 | - memcpy(eth->h_dest,daddr,dev->addr_len); | |
98 | + if (daddr) { | |
99 | + memcpy(eth->h_dest, daddr, dev->addr_len); | |
101 | 100 | return ETH_HLEN; |
102 | 101 | } |
103 | - | |
102 | + | |
104 | 103 | /* |
105 | - * Anyway, the loopback-device should never use this function... | |
104 | + * Anyway, the loopback-device should never use this function... | |
106 | 105 | */ |
107 | 106 | |
108 | - if (dev->flags & (IFF_LOOPBACK|IFF_NOARP)) | |
109 | - { | |
107 | + if (dev->flags & (IFF_LOOPBACK | IFF_NOARP)) { | |
110 | 108 | memset(eth->h_dest, 0, dev->addr_len); |
111 | 109 | return ETH_HLEN; |
112 | 110 | } |
113 | - | |
111 | + | |
114 | 112 | return -ETH_HLEN; |
115 | 113 | } |
116 | 114 | |
117 | 115 | |
118 | 116 | |
119 | 117 | |
... | ... | @@ -129,17 +127,16 @@ |
129 | 127 | struct ethhdr *eth = (struct ethhdr *)skb->data; |
130 | 128 | struct net_device *dev = skb->dev; |
131 | 129 | |
132 | - switch (eth->h_proto) | |
133 | - { | |
130 | + switch (eth->h_proto) { | |
134 | 131 | #ifdef CONFIG_INET |
135 | 132 | case __constant_htons(ETH_P_IP): |
136 | - return arp_find(eth->h_dest, skb); | |
137 | -#endif | |
133 | + return arp_find(eth->h_dest, skb); | |
134 | +#endif | |
138 | 135 | default: |
139 | 136 | printk(KERN_DEBUG |
140 | - "%s: unable to resolve type %X addresses.\n", | |
137 | + "%s: unable to resolve type %X addresses.\n", | |
141 | 138 | dev->name, (int)eth->h_proto); |
142 | - | |
139 | + | |
143 | 140 | memcpy(eth->h_source, dev->dev_addr, dev->addr_len); |
144 | 141 | break; |
145 | 142 | } |
... | ... | @@ -147,7 +144,6 @@ |
147 | 144 | return 0; |
148 | 145 | } |
149 | 146 | |
150 | - | |
151 | 147 | /** |
152 | 148 | * eth_type_trans - determine the packet's protocol ID. |
153 | 149 | * @skb: received socket data |
154 | 150 | |
155 | 151 | |
156 | 152 | |
157 | 153 | |
158 | 154 | |
159 | 155 | |
160 | 156 | |
161 | 157 | |
162 | 158 | |
163 | 159 | |
164 | 160 | |
165 | 161 | |
166 | 162 | |
... | ... | @@ -161,50 +157,51 @@ |
161 | 157 | { |
162 | 158 | struct ethhdr *eth; |
163 | 159 | unsigned char *rawp; |
164 | - | |
160 | + | |
165 | 161 | skb->mac.raw = skb->data; |
166 | - skb_pull(skb,ETH_HLEN); | |
162 | + skb_pull(skb, ETH_HLEN); | |
167 | 163 | eth = eth_hdr(skb); |
168 | - | |
164 | + | |
169 | 165 | if (is_multicast_ether_addr(eth->h_dest)) { |
170 | 166 | if (!compare_ether_addr(eth->h_dest, dev->broadcast)) |
171 | 167 | skb->pkt_type = PACKET_BROADCAST; |
172 | 168 | else |
173 | 169 | skb->pkt_type = PACKET_MULTICAST; |
174 | 170 | } |
175 | - | |
171 | + | |
176 | 172 | /* |
177 | - * This ALLMULTI check should be redundant by 1.4 | |
178 | - * so don't forget to remove it. | |
173 | + * This ALLMULTI check should be redundant by 1.4 | |
174 | + * so don't forget to remove it. | |
179 | 175 | * |
180 | - * Seems, you forgot to remove it. All silly devices | |
181 | - * seems to set IFF_PROMISC. | |
176 | + * Seems, you forgot to remove it. All silly devices | |
177 | + * seems to set IFF_PROMISC. | |
182 | 178 | */ |
183 | - | |
184 | - else if(1 /*dev->flags&IFF_PROMISC*/) { | |
179 | + | |
180 | + else if (1 /*dev->flags&IFF_PROMISC */ ) { | |
185 | 181 | if (unlikely(compare_ether_addr(eth->h_dest, dev->dev_addr))) |
186 | 182 | skb->pkt_type = PACKET_OTHERHOST; |
187 | 183 | } |
188 | - | |
184 | + | |
189 | 185 | if (ntohs(eth->h_proto) >= 1536) |
190 | 186 | return eth->h_proto; |
191 | - | |
187 | + | |
192 | 188 | rawp = skb->data; |
193 | - | |
189 | + | |
194 | 190 | /* |
195 | - * This is a magic hack to spot IPX packets. Older Novell breaks | |
196 | - * the protocol design and runs IPX over 802.3 without an 802.2 LLC | |
197 | - * layer. We look for FFFF which isn't a used 802.2 SSAP/DSAP. This | |
198 | - * won't work for fault tolerant netware but does for the rest. | |
191 | + * This is a magic hack to spot IPX packets. Older Novell breaks | |
192 | + * the protocol design and runs IPX over 802.3 without an 802.2 LLC | |
193 | + * layer. We look for FFFF which isn't a used 802.2 SSAP/DSAP. This | |
194 | + * won't work for fault tolerant netware but does for the rest. | |
199 | 195 | */ |
200 | 196 | if (*(unsigned short *)rawp == 0xFFFF) |
201 | 197 | return htons(ETH_P_802_3); |
202 | - | |
198 | + | |
203 | 199 | /* |
204 | - * Real 802.2 LLC | |
200 | + * Real 802.2 LLC | |
205 | 201 | */ |
206 | 202 | return htons(ETH_P_802_2); |
207 | 203 | } |
204 | +EXPORT_SYMBOL(eth_type_trans); | |
208 | 205 | |
209 | 206 | /** |
210 | 207 | * eth_header_parse - extract hardware address from packet |
... | ... | @@ -230,8 +227,8 @@ |
230 | 227 | struct ethhdr *eth; |
231 | 228 | struct net_device *dev = neigh->dev; |
232 | 229 | |
233 | - eth = (struct ethhdr*) | |
234 | - (((u8*)hh->hh_data) + (HH_DATA_OFF(sizeof(*eth)))); | |
230 | + eth = (struct ethhdr *) | |
231 | + (((u8 *) hh->hh_data) + (HH_DATA_OFF(sizeof(*eth)))); | |
235 | 232 | |
236 | 233 | if (type == __constant_htons(ETH_P_802_3)) |
237 | 234 | return -1; |
238 | 235 | |
239 | 236 | |
... | ... | @@ -251,14 +248,13 @@ |
251 | 248 | * |
252 | 249 | * Called by Address Resolution module to notify changes in address. |
253 | 250 | */ |
254 | -void eth_header_cache_update(struct hh_cache *hh, struct net_device *dev, unsigned char * haddr) | |
251 | +void eth_header_cache_update(struct hh_cache *hh, struct net_device *dev, | |
252 | + unsigned char *haddr) | |
255 | 253 | { |
256 | - memcpy(((u8*)hh->hh_data) + HH_DATA_OFF(sizeof(struct ethhdr)), | |
254 | + memcpy(((u8 *) hh->hh_data) + HH_DATA_OFF(sizeof(struct ethhdr)), | |
257 | 255 | haddr, dev->addr_len); |
258 | 256 | } |
259 | 257 | |
260 | -EXPORT_SYMBOL(eth_type_trans); | |
261 | - | |
262 | 258 | /** |
263 | 259 | * eth_mac_addr - set new Ethernet hardware address |
264 | 260 | * @dev: network device |
265 | 261 | |
... | ... | @@ -270,10 +266,10 @@ |
270 | 266 | */ |
271 | 267 | static int eth_mac_addr(struct net_device *dev, void *p) |
272 | 268 | { |
273 | - struct sockaddr *addr=p; | |
269 | + struct sockaddr *addr = p; | |
274 | 270 | if (netif_running(dev)) |
275 | 271 | return -EBUSY; |
276 | - memcpy(dev->dev_addr, addr->sa_data,dev->addr_len); | |
272 | + memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); | |
277 | 273 | return 0; |
278 | 274 | } |
279 | 275 | |
... | ... | @@ -315,7 +311,7 @@ |
315 | 311 | dev->tx_queue_len = 1000; /* Ethernet wants good queues */ |
316 | 312 | dev->flags = IFF_BROADCAST|IFF_MULTICAST; |
317 | 313 | |
318 | - memset(dev->broadcast,0xFF, ETH_ALEN); | |
314 | + memset(dev->broadcast, 0xFF, ETH_ALEN); | |
319 | 315 | |
320 | 316 | } |
321 | 317 | EXPORT_SYMBOL(ether_setup); |