[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>
This commit is contained in:
Stephen Hemminger 2006-08-17 18:20:18 -07:00 committed by David S. Miller
parent d3e01f7186
commit 2e4ca75b31

View file

@ -80,9 +80,9 @@ __setup("ether=", netdev_boot_setup);
int eth_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, int eth_header(struct sk_buff *skb, struct net_device *dev, unsigned short type,
void *daddr, void *saddr, unsigned len) void *daddr, void *saddr, unsigned len)
{ {
struct ethhdr *eth = (struct ethhdr *)skb_push(skb,ETH_HLEN); struct ethhdr *eth = (struct ethhdr *)skb_push(skb, ETH_HLEN);
if(type!=ETH_P_802_3) if (type != ETH_P_802_3)
eth->h_proto = htons(type); eth->h_proto = htons(type);
else else
eth->h_proto = htons(len); eth->h_proto = htons(len);
@ -91,13 +91,12 @@ int eth_header(struct sk_buff *skb, struct net_device *dev, unsigned short type,
* Set the source hardware address. * Set the source hardware address.
*/ */
if(!saddr) if (!saddr)
saddr = dev->dev_addr; saddr = dev->dev_addr;
memcpy(eth->h_source,saddr,dev->addr_len); memcpy(eth->h_source, saddr, dev->addr_len);
if(daddr) if (daddr) {
{ memcpy(eth->h_dest, daddr, dev->addr_len);
memcpy(eth->h_dest,daddr,dev->addr_len);
return ETH_HLEN; return ETH_HLEN;
} }
@ -105,8 +104,7 @@ int eth_header(struct sk_buff *skb, struct net_device *dev, unsigned short type,
* Anyway, the loopback-device should never use this function... * Anyway, the loopback-device should never use this function...
*/ */
if (dev->flags & (IFF_LOOPBACK|IFF_NOARP)) if (dev->flags & (IFF_LOOPBACK | IFF_NOARP)) {
{
memset(eth->h_dest, 0, dev->addr_len); memset(eth->h_dest, 0, dev->addr_len);
return ETH_HLEN; return ETH_HLEN;
} }
@ -129,8 +127,7 @@ int eth_rebuild_header(struct sk_buff *skb)
struct ethhdr *eth = (struct ethhdr *)skb->data; struct ethhdr *eth = (struct ethhdr *)skb->data;
struct net_device *dev = skb->dev; struct net_device *dev = skb->dev;
switch (eth->h_proto) switch (eth->h_proto) {
{
#ifdef CONFIG_INET #ifdef CONFIG_INET
case __constant_htons(ETH_P_IP): case __constant_htons(ETH_P_IP):
return arp_find(eth->h_dest, skb); return arp_find(eth->h_dest, skb);
@ -147,7 +144,6 @@ int eth_rebuild_header(struct sk_buff *skb)
return 0; return 0;
} }
/** /**
* eth_type_trans - determine the packet's protocol ID. * eth_type_trans - determine the packet's protocol ID.
* @skb: received socket data * @skb: received socket data
@ -163,7 +159,7 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev)
unsigned char *rawp; unsigned char *rawp;
skb->mac.raw = skb->data; skb->mac.raw = skb->data;
skb_pull(skb,ETH_HLEN); skb_pull(skb, ETH_HLEN);
eth = eth_hdr(skb); eth = eth_hdr(skb);
if (is_multicast_ether_addr(eth->h_dest)) { if (is_multicast_ether_addr(eth->h_dest)) {
@ -181,7 +177,7 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev)
* seems to set IFF_PROMISC. * seems to set IFF_PROMISC.
*/ */
else if(1 /*dev->flags&IFF_PROMISC*/) { else if (1 /*dev->flags&IFF_PROMISC */ ) {
if (unlikely(compare_ether_addr(eth->h_dest, dev->dev_addr))) if (unlikely(compare_ether_addr(eth->h_dest, dev->dev_addr)))
skb->pkt_type = PACKET_OTHERHOST; skb->pkt_type = PACKET_OTHERHOST;
} }
@ -205,6 +201,7 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev)
*/ */
return htons(ETH_P_802_2); return htons(ETH_P_802_2);
} }
EXPORT_SYMBOL(eth_type_trans);
/** /**
* eth_header_parse - extract hardware address from packet * eth_header_parse - extract hardware address from packet
@ -230,8 +227,8 @@ int eth_header_cache(struct neighbour *neigh, struct hh_cache *hh)
struct ethhdr *eth; struct ethhdr *eth;
struct net_device *dev = neigh->dev; struct net_device *dev = neigh->dev;
eth = (struct ethhdr*) eth = (struct ethhdr *)
(((u8*)hh->hh_data) + (HH_DATA_OFF(sizeof(*eth)))); (((u8 *) hh->hh_data) + (HH_DATA_OFF(sizeof(*eth))));
if (type == __constant_htons(ETH_P_802_3)) if (type == __constant_htons(ETH_P_802_3))
return -1; return -1;
@ -251,14 +248,13 @@ int eth_header_cache(struct neighbour *neigh, struct hh_cache *hh)
* *
* Called by Address Resolution module to notify changes in address. * Called by Address Resolution module to notify changes in address.
*/ */
void eth_header_cache_update(struct hh_cache *hh, struct net_device *dev, unsigned char * haddr) void eth_header_cache_update(struct hh_cache *hh, struct net_device *dev,
unsigned char *haddr)
{ {
memcpy(((u8*)hh->hh_data) + HH_DATA_OFF(sizeof(struct ethhdr)), memcpy(((u8 *) hh->hh_data) + HH_DATA_OFF(sizeof(struct ethhdr)),
haddr, dev->addr_len); haddr, dev->addr_len);
} }
EXPORT_SYMBOL(eth_type_trans);
/** /**
* eth_mac_addr - set new Ethernet hardware address * eth_mac_addr - set new Ethernet hardware address
* @dev: network device * @dev: network device
@ -270,10 +266,10 @@ EXPORT_SYMBOL(eth_type_trans);
*/ */
static int eth_mac_addr(struct net_device *dev, void *p) static int eth_mac_addr(struct net_device *dev, void *p)
{ {
struct sockaddr *addr=p; struct sockaddr *addr = p;
if (netif_running(dev)) if (netif_running(dev))
return -EBUSY; return -EBUSY;
memcpy(dev->dev_addr, addr->sa_data,dev->addr_len); memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
return 0; return 0;
} }
@ -315,7 +311,7 @@ void ether_setup(struct net_device *dev)
dev->tx_queue_len = 1000; /* Ethernet wants good queues */ dev->tx_queue_len = 1000; /* Ethernet wants good queues */
dev->flags = IFF_BROADCAST|IFF_MULTICAST; dev->flags = IFF_BROADCAST|IFF_MULTICAST;
memset(dev->broadcast,0xFF, ETH_ALEN); memset(dev->broadcast, 0xFF, ETH_ALEN);
} }
EXPORT_SYMBOL(ether_setup); EXPORT_SYMBOL(ether_setup);