diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-08 14:25:41 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-08 14:25:41 -0800 |
commit | 5fbbf5f648a9c4ef99276854f05b2255d1b004d3 (patch) | |
tree | 59c9ae762c3df2800e894001b3de58c5f1972486 /drivers | |
parent | ce279e6ec91c49f2c5f59f7492e19d39edbf8bbd (diff) | |
parent | 56cf391a9462a4897ea660a6af3662dda5ae8c84 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (84 commits)
wimax: fix kernel-doc for debufs_dentry member of struct wimax_dev
net: convert pegasus driver to net_device_ops
bnx2x: Prevent eeprom set when driver is down
net: switch kaweth driver to netdevops
pcnet32: round off carrier watch timer
i2400m/usb: wrap USB power saving in #ifdef CONFIG_PM
wimax: testing for rfkill support should also test for CONFIG_RFKILL_MODULE
wimax: fix kconfig interactions with rfkill and input layers
wimax: fix '#ifndef CONFIG_BUG' layout to avoid warning
r6040: bump release number to 0.20
r6040: warn about MAC address being unset
r6040: check PHY status when bringing interface up
r6040: make printks consistent with DRV_NAME
gianfar: Fixup use of BUS_ID_SIZE
mlx4_en: Returning real Max in get_ringparam
mlx4_en: Consider inline packets on completion
netdev: bfin_mac: enable bfin_mac net dev driver for BF51x
qeth: convert to net_device_ops
vlan: add neigh_setup
dm9601: warn on invalid mac address
...
Diffstat (limited to 'drivers')
93 files changed, 1234 insertions, 10776 deletions
diff --git a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c index a074bfd5f82..1a919df809f 100644 --- a/drivers/ieee1394/eth1394.c +++ b/drivers/ieee1394/eth1394.c @@ -245,12 +245,6 @@ static int ether1394_stop(struct net_device *dev) return 0; } -/* Return statistics to the caller */ -static struct net_device_stats *ether1394_stats(struct net_device *dev) -{ - return &(((struct eth1394_priv *)netdev_priv(dev))->stats); -} - /* FIXME: What to do if we timeout? I think a host reset is probably in order, * so that's what we do. Should we increment the stat counters too? */ static void ether1394_tx_timeout(struct net_device *dev) @@ -516,16 +510,19 @@ static const struct header_ops ether1394_header_ops = { .parse = ether1394_header_parse, }; +static const struct net_device_ops ether1394_netdev_ops = { + .ndo_open = ether1394_open, + .ndo_stop = ether1394_stop, + .ndo_start_xmit = ether1394_tx, + .ndo_tx_timeout = ether1394_tx_timeout, + .ndo_change_mtu = ether1394_change_mtu, +}; + static void ether1394_init_dev(struct net_device *dev) { - dev->open = ether1394_open; - dev->stop = ether1394_stop; - dev->hard_start_xmit = ether1394_tx; - dev->get_stats = ether1394_stats; - dev->tx_timeout = ether1394_tx_timeout; - dev->change_mtu = ether1394_change_mtu; dev->header_ops = ðer1394_header_ops; + dev->netdev_ops = ðer1394_netdev_ops; SET_ETHTOOL_OPS(dev, ðtool_ops); @@ -1075,7 +1072,7 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid, HPSB_PRINT(KERN_ERR, "ether1394 rx: sender nodeid " "lookup failure: " NODE_BUS_FMT, NODE_BUS_ARGS(priv->host, srcid)); - priv->stats.rx_dropped++; + dev->stats.rx_dropped++; return -1; } ud = node->ud; @@ -1098,7 +1095,7 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid, skb = dev_alloc_skb(len + dev->hard_header_len + 15); if (unlikely(!skb)) { ETH1394_PRINT_G(KERN_ERR, "Out of memory\n"); - priv->stats.rx_dropped++; + dev->stats.rx_dropped++; return -1; } skb_reserve(skb, (dev->hard_header_len + 15) & ~15); @@ -1217,15 +1214,15 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid, spin_lock_irqsave(&priv->lock, flags); if (!skb->protocol) { - priv->stats.rx_errors++; - priv->stats.rx_dropped++; + dev->stats.rx_errors++; + dev->stats.rx_dropped++; dev_kfree_skb_any(skb); } else if (netif_rx(skb) == NET_RX_DROP) { - priv->stats.rx_errors++; - priv->stats.rx_dropped++; + dev->stats.rx_errors++; + dev->stats.rx_dropped++; } else { - priv->stats.rx_packets++; - priv->stats.rx_bytes += skb->len; + dev->stats.rx_packets++; + dev->stats.rx_bytes += skb->len; } spin_unlock_irqrestore(&priv->lock, flags); @@ -1234,8 +1231,6 @@ bad_proto: if (netif_queue_stopped(dev)) netif_wake_queue(dev); - dev->last_rx = jiffies; - return 0; } @@ -1509,17 +1504,18 @@ static int ether1394_send_packet(struct packet_task *ptask, unsigned int tx_len) static void ether1394_dg_complete(struct packet_task *ptask, int fail) { struct sk_buff *skb = ptask->skb; - struct eth1394_priv *priv = netdev_priv(skb->dev); + struct net_device *dev = skb->dev; + struct eth1394_priv *priv = netdev_priv(dev); unsigned long flags; /* Statistics */ spin_lock_irqsave(&priv->lock, flags); if (fail) { - priv->stats.tx_dropped++; - priv->stats.tx_errors++; + dev->stats.tx_dropped++; + dev->stats.tx_errors++; } else { - priv->stats.tx_bytes += skb->len; - priv->stats.tx_packets++; + dev->stats.tx_bytes += skb->len; + dev->stats.tx_packets++; } spin_unlock_irqrestore(&priv->lock, flags); @@ -1696,8 +1692,8 @@ fail: dev_kfree_skb(skb); spin_lock_irqsave(&priv->lock, flags); - priv->stats.tx_dropped++; - priv->stats.tx_errors++; + dev->stats.tx_dropped++; + dev->stats.tx_errors++; spin_unlock_irqrestore(&priv->lock, flags); /* diff --git a/drivers/ieee1394/eth1394.h b/drivers/ieee1394/eth1394.h index e1b5ea80f62..d53bac47b86 100644 --- a/drivers/ieee1394/eth1394.h +++ b/drivers/ieee1394/eth1394.h @@ -54,7 +54,6 @@ enum eth1394_bc_states { ETHER1394_BC_ERROR, /* Private structure for our ethernet driver */ struct eth1394_priv { - struct net_device_stats stats; /* Device stats */ struct hpsb_host *host; /* The card for this dev */ u16 bc_maxpayload; /* Max broadcast payload */ u8 bc_sspd; /* Max broadcast speed */ diff --git a/drivers/isdn/hysdn/hysdn_net.c b/drivers/isdn/hysdn/hysdn_net.c index 7ee5bd9f2bb..579974cf4c9 100644 --- a/drivers/isdn/hysdn/hysdn_net.c +++ b/drivers/isdn/hysdn/hysdn_net.c @@ -38,16 +38,12 @@ char *hysdn_net_revision = "$Revision: 1.8.6.4 $"; /* inside the definition. */ /****************************************************************************/ struct net_local { - struct net_device netdev; /* the network device */ - struct net_device_stats stats; - /* additional vars may be added here */ - char dev_name[9]; /* our own device name */ - /* Tx control lock. This protects the transmit buffer ring * state along with the "tx full" state of the driver. This * means all netif_queue flow control actions are protected * by this lock as well. */ + struct net_device *dev; spinlock_t lock; struct sk_buff *skbs[MAX_SKB_BUFFERS]; /* pointers to tx-skbs */ int in_idx, out_idx; /* indexes to buffer ring */ @@ -55,15 +51,6 @@ struct net_local { }; /* net_local */ -/*****************************************************/ -/* Get the current statistics for this card. */ -/* This may be called with the card open or closed ! */ -/*****************************************************/ -static struct net_device_stats * -net_get_stats(struct net_device *dev) -{ - return (&((struct net_local *) dev)->stats); -} /* net_device_stats */ /*********************************************************************/ /* Open/initialize the board. This is called (in the current kernel) */ @@ -182,8 +169,8 @@ hysdn_tx_netack(hysdn_card * card) if (!lp->sk_count) return; /* error condition */ - lp->stats.tx_packets++; - lp->stats.tx_bytes += lp->skbs[lp->out_idx]->len; + lp->dev->stats.tx_packets++; + lp->dev->stats.tx_bytes += lp->skbs[lp->out_idx]->len; dev_kfree_skb(lp->skbs[lp->out_idx++]); /* free skb */ if (lp->out_idx >= MAX_SKB_BUFFERS) @@ -200,29 +187,30 @@ void hysdn_rx_netpkt(hysdn_card * card, unsigned char *buf, unsigned short len) { struct net_local *lp = card->netif; + struct net_device *dev = lp->dev; struct sk_buff *skb; if (!lp) return; /* non existing device */ - lp->stats.rx_bytes += len; + dev->stats.rx_bytes += len; skb = dev_alloc_skb(len); if (skb == NULL) { printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n", - lp->netdev.name); - lp->stats.rx_dropped++; + dev->name); + dev->stats.rx_dropped++; return; } /* copy the data */ memcpy(skb_put(skb, len), buf, len); /* determine the used protocol */ - skb->protocol = eth_type_trans(skb, &lp->netdev); + skb->protocol = eth_type_trans(skb, dev); - netif_rx(skb); - lp->stats.rx_packets++; /* adjust packet count */ + dev->stats.rx_packets++; /* adjust packet count */ + netif_rx(skb); } /* hysdn_rx_netpkt */ /*****************************************************/ @@ -242,24 +230,15 @@ hysdn_tx_netget(hysdn_card * card) return (lp->skbs[lp->out_idx]); /* next packet to send */ } /* hysdn_tx_netget */ +static const struct net_device_ops hysdn_netdev_ops = { + .ndo_open = net_open, + .ndo_stop = net_close, + .ndo_start_xmit = net_send_packet, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; -/*******************************************/ -/* init function called by register device */ -/*******************************************/ -static int -net_init(struct net_device *dev) -{ - /* setup the function table */ - dev->open = net_open; - dev->stop = net_close; - dev->hard_start_xmit = net_send_packet; - dev->get_stats = net_get_stats; - - /* Fill in the fields of the device structure with ethernet values. */ - ether_setup(dev); - - return (0); /* success */ -} /* net_init */ /*****************************************************************************/ /* hysdn_net_create creates a new net device for the given card. If a device */ @@ -271,28 +250,34 @@ hysdn_net_create(hysdn_card * card) { struct net_device *dev; int i; + struct net_local *lp; + if(!card) { printk(KERN_WARNING "No card-pt in hysdn_net_create!\n"); return (-ENOMEM); } hysdn_net_release(card); /* release an existing net device */ - if ((dev = kzalloc(sizeof(struct net_local), GFP_KERNEL)) == NULL) { + + dev = alloc_etherdev(sizeof(struct net_local)); + if (!dev) { printk(KERN_WARNING "HYSDN: unable to allocate mem\n"); return (-ENOMEM); } + lp = netdev_priv(dev); + lp->dev = dev; + + dev->netdev_ops = &hysdn_netdev_ops; spin_lock_init(&((struct net_local *) dev)->lock); /* initialise necessary or informing fields */ dev->base_addr = card->iobase; /* IO address */ dev->irq = card->irq; /* irq */ - dev->init = net_init; /* the init function of the device */ - if(dev->name) { - strcpy(dev->name, ((struct net_local *) dev)->dev_name); - } + + dev->netdev_ops = &hysdn_netdev_ops; if ((i = register_netdev(dev))) { printk(KERN_WARNING "HYSDN: unable to create network device\n"); - kfree(dev); + free_netdev(dev); return (i); } dev->ml_priv = card; /* remember pointer to own data structure */ @@ -316,7 +301,7 @@ hysdn_net_release(hysdn_card * card) return (0); /* non existing */ card->netif = NULL; /* clear out pointer */ - dev->stop(dev); /* close the device */ + net_close(dev); flush_tx_buffers((struct net_local *) dev); /* empty buffers */ diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c index 023ea11d2f9..7c5f97033b9 100644 --- a/drivers/isdn/i4l/isdn_net.c +++ b/drivers/isdn/i4l/isdn_net.c @@ -1485,6 +1485,24 @@ isdn_ciscohdlck_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) return (rc); } + +static int isdn_net_ioctl(struct net_device *dev, + struct ifreq *ifr, int cmd) +{ + isdn_net_local *lp = (isdn_net_local *) netdev_priv(dev); + + switch (lp->p_encap) { +#ifdef CONFIG_ISDN_PPP + case ISDN_NET_ENCAP_SYNCPPP: + return isdn_ppp_dev_ioctl(dev, ifr, cmd); |