History

[ETH]: indentation and cleanup

Run ethernet support through Lindent and fix up. Applies after docbook comments patch

Stephen Hemminger committed 20 years ago

Commit 2e4ca751 parent d3e01f71 file · +46 −50Browse files

Showing the changes to net/ethernet (1 of 1 file). Show all

Unified · Split

net/ethernet/eth.c+46−50
@@ -78,39 +78,37 @@ __setup("ether=", netdev_boot_setup); · 77 unmodified lines
7878 * in here instead. It is up to the 802.2 layer to carry protocol information.
7979 */
8080 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)
8282 {
83− struct ethhdr *eth = (struct ethhdr *)skb_push(skb,ETH_HLEN);
83+ struct ethhdr *eth = (struct ethhdr *)skb_push(skb, ETH_HLEN);
8484
85− if(type!=ETH_P_802_3)
85+ if (type != ETH_P_802_3)
8686 eth->h_proto = htons(type);
8787 else
8888 eth->h_proto = htons(len);
8989
9090 /*
91− * Set the source hardware address.
91+ * Set the source hardware address.
9292 */
93−
94− if(!saddr)
93+
94+ if (!saddr)
9595 saddr = dev->dev_addr;
96− memcpy(eth->h_source,saddr,dev->addr_len);
96+ memcpy(eth->h_source, saddr, dev->addr_len);
9797
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);
101100 return ETH_HLEN;
102101 }
103−
102+
104103 /*
105− * Anyway, the loopback-device should never use this function...
104+ * Anyway, the loopback-device should never use this function...
106105 */
107106
108− if (dev->flags & (IFF_LOOPBACK|IFF_NOARP))
109− {
107+ if (dev->flags & (IFF_LOOPBACK | IFF_NOARP)) {
110108 memset(eth->h_dest, 0, dev->addr_len);
111109 return ETH_HLEN;
112110 }
113−
111+
114112 return -ETH_HLEN;
115113 }
116114
@@ -129,17 +127,16 @@ int eth_rebuild_header(struct sk_buff *skb) · 12 unmodified lines
129127 struct ethhdr *eth = (struct ethhdr *)skb->data;
130128 struct net_device *dev = skb->dev;
131129
132− switch (eth->h_proto)
133− {
130+ switch (eth->h_proto) {
134131 #ifdef CONFIG_INET
135132 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
138135 default:
139136 printk(KERN_DEBUG
140− "%s: unable to resolve type %X addresses.\n",
137+ "%s: unable to resolve type %X addresses.\n",
141138 dev->name, (int)eth->h_proto);
142−
139+
143140 memcpy(eth->h_source, dev->dev_addr, dev->addr_len);
144141 break;
145142 }
@@ -147,7 +144,6 @@ int eth_rebuild_header(struct sk_buff *skb) · 1 unmodified line
147144 return 0;
148145 }
149146
150−
151147 /**
152148 * eth_type_trans - determine the packet's protocol ID.
153149 * @skb: received socket data
@@ -161,50 +157,51 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev) · 7 unmodified lines
161157 {
162158 struct ethhdr *eth;
163159 unsigned char *rawp;
164−
160+
165161 skb->mac.raw = skb->data;
166− skb_pull(skb,ETH_HLEN);
162+ skb_pull(skb, ETH_HLEN);
167163 eth = eth_hdr(skb);
168−
164+
169165 if (is_multicast_ether_addr(eth->h_dest)) {
170166 if (!compare_ether_addr(eth->h_dest, dev->broadcast))
171167 skb->pkt_type = PACKET_BROADCAST;
172168 else
173169 skb->pkt_type = PACKET_MULTICAST;
174170 }
175−
171+
176172 /*
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.
179175 *
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.
182178 */
183−
184− else if(1 /*dev->flags&IFF_PROMISC*/) {
179+
180+ else if (1 /*dev->flags&IFF_PROMISC */ ) {
185181 if (unlikely(compare_ether_addr(eth->h_dest, dev->dev_addr)))
186182 skb->pkt_type = PACKET_OTHERHOST;
187183 }
188−
184+
189185 if (ntohs(eth->h_proto) >= 1536)
190186 return eth->h_proto;
191−
187+
192188 rawp = skb->data;
193−
189+
194190 /*
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.
199195 */
200196 if (*(unsigned short *)rawp == 0xFFFF)
201197 return htons(ETH_P_802_3);
202−
198+
203199 /*
204− * Real 802.2 LLC
200+ * Real 802.2 LLC
205201 */
206202 return htons(ETH_P_802_2);
207203 }
204+EXPORT_SYMBOL(eth_type_trans);
208205
209206 /**
210207 * eth_header_parse - extract hardware address from packet
@@ -230,8 +227,8 @@ int eth_header_cache(struct neighbour *neigh, struct hh_cache *hh) · 19 unmodified lines
230227 struct ethhdr *eth;
231228 struct net_device *dev = neigh->dev;
232229
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))));
235232
236233 if (type == __constant_htons(ETH_P_802_3))
237234 return -1;
@@ -251,14 +248,13 @@ int eth_header_cache(struct neighbour *neigh, struct hh_cache *hh) · 13 unmodified lines
251248 *
252249 * Called by Address Resolution module to notify changes in address.
253250 */
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)
255253 {
256− memcpy(((u8*)hh->hh_data) + HH_DATA_OFF(sizeof(struct ethhdr)),
254+ memcpy(((u8 *) hh->hh_data) + HH_DATA_OFF(sizeof(struct ethhdr)),
257255 haddr, dev->addr_len);
258256 }
259257
260−EXPORT_SYMBOL(eth_type_trans);
261−
262258 /**
263259 * eth_mac_addr - set new Ethernet hardware address
264260 * @dev: network device
@@ -270,10 +266,10 @@ EXPORT_SYMBOL(eth_type_trans); · 5 unmodified lines
270266 */
271267 static int eth_mac_addr(struct net_device *dev, void *p)
272268 {
273− struct sockaddr *addr=p;
269+ struct sockaddr *addr = p;
274270 if (netif_running(dev))
275271 return -EBUSY;
276− memcpy(dev->dev_addr, addr->sa_data,dev->addr_len);
272+ memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
277273 return 0;
278274 }
279275
@@ -315,7 +311,7 @@ void ether_setup(struct net_device *dev) · 35 unmodified lines
315311 dev->tx_queue_len = 1000; /* Ethernet wants good queues */
316312 dev->flags = IFF_BROADCAST|IFF_MULTICAST;
317313
318− memset(dev->broadcast,0xFF, ETH_ALEN);
314+ memset(dev->broadcast, 0xFF, ETH_ALEN);
319315
320316 }
321317 EXPORT_SYMBOL(ether_setup);