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
  ...
This commit is contained in:
Linus Torvalds 2009-01-08 14:25:41 -08:00
commit 5fbbf5f648
123 changed files with 1820 additions and 10904 deletions

View file

@ -245,12 +245,6 @@ static int ether1394_stop(struct net_device *dev)
return 0; 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, /* 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? */ * so that's what we do. Should we increment the stat counters too? */
static void ether1394_tx_timeout(struct net_device *dev) 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, .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) 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 = &ether1394_header_ops; dev->header_ops = &ether1394_header_ops;
dev->netdev_ops = &ether1394_netdev_ops;
SET_ETHTOOL_OPS(dev, &ethtool_ops); SET_ETHTOOL_OPS(dev, &ethtool_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 " HPSB_PRINT(KERN_ERR, "ether1394 rx: sender nodeid "
"lookup failure: " NODE_BUS_FMT, "lookup failure: " NODE_BUS_FMT,
NODE_BUS_ARGS(priv->host, srcid)); NODE_BUS_ARGS(priv->host, srcid));
priv->stats.rx_dropped++; dev->stats.rx_dropped++;
return -1; return -1;
} }
ud = node->ud; 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); skb = dev_alloc_skb(len + dev->hard_header_len + 15);
if (unlikely(!skb)) { if (unlikely(!skb)) {
ETH1394_PRINT_G(KERN_ERR, "Out of memory\n"); ETH1394_PRINT_G(KERN_ERR, "Out of memory\n");
priv->stats.rx_dropped++; dev->stats.rx_dropped++;
return -1; return -1;
} }
skb_reserve(skb, (dev->hard_header_len + 15) & ~15); 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); spin_lock_irqsave(&priv->lock, flags);
if (!skb->protocol) { if (!skb->protocol) {
priv->stats.rx_errors++; dev->stats.rx_errors++;
priv->stats.rx_dropped++; dev->stats.rx_dropped++;
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
} else if (netif_rx(skb) == NET_RX_DROP) { } else if (netif_rx(skb) == NET_RX_DROP) {
priv->stats.rx_errors++; dev->stats.rx_errors++;
priv->stats.rx_dropped++; dev->stats.rx_dropped++;
} else { } else {
priv->stats.rx_packets++; dev->stats.rx_packets++;
priv->stats.rx_bytes += skb->len; dev->stats.rx_bytes += skb->len;
} }
spin_unlock_irqrestore(&priv->lock, flags); spin_unlock_irqrestore(&priv->lock, flags);
@ -1234,8 +1231,6 @@ bad_proto:
if (netif_queue_stopped(dev)) if (netif_queue_stopped(dev))
netif_wake_queue(dev); netif_wake_queue(dev);
dev->last_rx = jiffies;
return 0; 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) static void ether1394_dg_complete(struct packet_task *ptask, int fail)
{ {
struct sk_buff *skb = ptask->skb; 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; unsigned long flags;
/* Statistics */ /* Statistics */
spin_lock_irqsave(&priv->lock, flags); spin_lock_irqsave(&priv->lock, flags);
if (fail) { if (fail) {
priv->stats.tx_dropped++; dev->stats.tx_dropped++;
priv->stats.tx_errors++; dev->stats.tx_errors++;
} else { } else {
priv->stats.tx_bytes += skb->len; dev->stats.tx_bytes += skb->len;
priv->stats.tx_packets++; dev->stats.tx_packets++;
} }
spin_unlock_irqrestore(&priv->lock, flags); spin_unlock_irqrestore(&priv->lock, flags);
@ -1696,8 +1692,8 @@ fail:
dev_kfree_skb(skb); dev_kfree_skb(skb);
spin_lock_irqsave(&priv->lock, flags); spin_lock_irqsave(&priv->lock, flags);
priv->stats.tx_dropped++; dev->stats.tx_dropped++;
priv->stats.tx_errors++; dev->stats.tx_errors++;
spin_unlock_irqrestore(&priv->lock, flags); spin_unlock_irqrestore(&priv->lock, flags);
/* /*

View file

@ -54,7 +54,6 @@ enum eth1394_bc_states { ETHER1394_BC_ERROR,
/* Private structure for our ethernet driver */ /* Private structure for our ethernet driver */
struct eth1394_priv { struct eth1394_priv {
struct net_device_stats stats; /* Device stats */
struct hpsb_host *host; /* The card for this dev */ struct hpsb_host *host; /* The card for this dev */
u16 bc_maxpayload; /* Max broadcast payload */ u16 bc_maxpayload; /* Max broadcast payload */
u8 bc_sspd; /* Max broadcast speed */ u8 bc_sspd; /* Max broadcast speed */

View file

@ -38,16 +38,12 @@ char *hysdn_net_revision = "$Revision: 1.8.6.4 $";
/* inside the definition. */ /* inside the definition. */
/****************************************************************************/ /****************************************************************************/
struct net_local { 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 /* Tx control lock. This protects the transmit buffer ring
* state along with the "tx full" state of the driver. This * state along with the "tx full" state of the driver. This
* means all netif_queue flow control actions are protected * means all netif_queue flow control actions are protected
* by this lock as well. * by this lock as well.
*/ */
struct net_device *dev;
spinlock_t lock; spinlock_t lock;
struct sk_buff *skbs[MAX_SKB_BUFFERS]; /* pointers to tx-skbs */ struct sk_buff *skbs[MAX_SKB_BUFFERS]; /* pointers to tx-skbs */
int in_idx, out_idx; /* indexes to buffer ring */ int in_idx, out_idx; /* indexes to buffer ring */
@ -55,15 +51,6 @@ struct net_local {
}; /* 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) */ /* 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) if (!lp->sk_count)
return; /* error condition */ return; /* error condition */
lp->stats.tx_packets++; lp->dev->stats.tx_packets++;
lp->stats.tx_bytes += lp->skbs[lp->out_idx]->len; lp->dev->stats.tx_bytes += lp->skbs[lp->out_idx]->len;
dev_kfree_skb(lp->skbs[lp->out_idx++]); /* free skb */ dev_kfree_skb(lp->skbs[lp->out_idx++]); /* free skb */
if (lp->out_idx >= MAX_SKB_BUFFERS) if (lp->out_idx >= MAX_SKB_BUFFERS)
@ -200,29 +187,30 @@ void
hysdn_rx_netpkt(hysdn_card * card, unsigned char *buf, unsigned short len) hysdn_rx_netpkt(hysdn_card * card, unsigned char *buf, unsigned short len)
{ {
struct net_local *lp = card->netif; struct net_local *lp = card->netif;
struct net_device *dev = lp->dev;
struct sk_buff *skb; struct sk_buff *skb;
if (!lp) if (!lp)
return; /* non existing device */ return; /* non existing device */
lp->stats.rx_bytes += len; dev->stats.rx_bytes += len;
skb = dev_alloc_skb(len); skb = dev_alloc_skb(len);
if (skb == NULL) { if (skb == NULL) {
printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n", printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n",
lp->netdev.name); dev->name);
lp->stats.rx_dropped++; dev->stats.rx_dropped++;
return; return;
} }
/* copy the data */ /* copy the data */
memcpy(skb_put(skb, len), buf, len); memcpy(skb_put(skb, len), buf, len);
/* determine the used protocol */ /* determine the used protocol */
skb->protocol = eth_type_trans(skb, &lp->netdev); skb->protocol = eth_type_trans(skb, dev);
dev->stats.rx_packets++; /* adjust packet count */
netif_rx(skb); netif_rx(skb);
lp->stats.rx_packets++; /* adjust packet count */
} /* hysdn_rx_netpkt */ } /* hysdn_rx_netpkt */
/*****************************************************/ /*****************************************************/
@ -242,24 +230,15 @@ hysdn_tx_netget(hysdn_card * card)
return (lp->skbs[lp->out_idx]); /* next packet to send */ return (lp->skbs[lp->out_idx]); /* next packet to send */
} /* hysdn_tx_netget */ } /* 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 */ /* 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; struct net_device *dev;
int i; int i;
struct net_local *lp;
if(!card) { if(!card) {
printk(KERN_WARNING "No card-pt in hysdn_net_create!\n"); printk(KERN_WARNING "No card-pt in hysdn_net_create!\n");
return (-ENOMEM); return (-ENOMEM);
} }
hysdn_net_release(card); /* release an existing net device */ 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"); printk(KERN_WARNING "HYSDN: unable to allocate mem\n");
return (-ENOMEM); return (-ENOMEM);
} }
lp = netdev_priv(dev);
lp->dev = dev;
dev->netdev_ops = &hysdn_netdev_ops;
spin_lock_init(&((struct net_local *) dev)->lock); spin_lock_init(&((struct net_local *) dev)->lock);
/* initialise necessary or informing fields */ /* initialise necessary or informing fields */
dev->base_addr = card->iobase; /* IO address */ dev->base_addr = card->iobase; /* IO address */
dev->irq = card->irq; /* irq */ dev->irq = card->irq; /* irq */
dev->init = net_init; /* the init function of the device */
if(dev->name) { dev->netdev_ops = &hysdn_netdev_ops;
strcpy(dev->name, ((struct net_local *) dev)->dev_name);
}
if ((i = register_netdev(dev))) { if ((i = register_netdev(dev))) {
printk(KERN_WARNING "HYSDN: unable to create network device\n"); printk(KERN_WARNING "HYSDN: unable to create network device\n");
kfree(dev); free_netdev(dev);
return (i); return (i);
} }
dev->ml_priv = card; /* remember pointer to own data structure */ dev->ml_priv = card; /* remember pointer to own data structure */
@ -316,7 +301,7 @@ hysdn_net_release(hysdn_card * card)
return (0); /* non existing */ return (0); /* non existing */
card->netif = NULL; /* clear out pointer */ card->netif = NULL; /* clear out pointer */
dev->stop(dev); /* close the device */ net_close(dev);
flush_tx_buffers((struct net_local *) dev); /* empty buffers */ flush_tx_buffers((struct net_local *) dev); /* empty buffers */

View file

@ -1485,6 +1485,24 @@ isdn_ciscohdlck_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
return (rc); 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);
#endif
case ISDN_NET_ENCAP_CISCOHDLCK:
return isdn_ciscohdlck_dev_ioctl(dev, ifr, cmd);
default:
return -EINVAL;
}
}
/* called via cisco_timer.function */ /* called via cisco_timer.function */
static void static void
isdn_net_ciscohdlck_slarp_send_keepalive(unsigned long data) isdn_net_ciscohdlck_slarp_send_keepalive(unsigned long data)
@ -1998,23 +2016,6 @@ isdn_net_init(struct net_device *ndev)
ushort max_hlhdr_len = 0; ushort max_hlhdr_len = 0;
int drvidx; int drvidx;
ether_setup(ndev);
ndev->header_ops = NULL;
/* Setup the generic properties */
ndev->mtu = 1500;
ndev->flags = IFF_NOARP|IFF_POINTOPOINT;
ndev->type = ARPHRD_ETHER;
ndev->addr_len = ETH_ALEN;
ndev->validate_addr = NULL;
/* for clients with MPPP maybe higher values better */
ndev->tx_queue_len = 30;
/* The ISDN-specific entries in the device structure. */
ndev->open = &isdn_net_open;
ndev->hard_start_xmit = &isdn_net_start_xmit;
/* /*
* up till binding we ask the protocol layer to reserve as much * up till binding we ask the protocol layer to reserve as much
* as we might need for HL layer * as we might need for HL layer
@ -2026,9 +2027,6 @@ isdn_net_init(struct net_device *ndev)
max_hlhdr_len = dev->drv[drvidx]->interface->hl_hdrlen; max_hlhdr_len = dev->drv[drvidx]->interface->hl_hdrlen;
ndev->hard_header_len = ETH_HLEN + max_hlhdr_len; ndev->hard_header_len = ETH_HLEN + max_hlhdr_len;
ndev->stop = &isdn_net_close;
ndev->get_stats = &isdn_net_get_stats;
ndev->do_ioctl = NULL;
return 0; return 0;
} }
@ -2508,6 +2506,19 @@ isdn_net_force_dial(char *name)
return (isdn_net_force_dial_lp(p->local)); return (isdn_net_force_dial_lp(p->local));
} }
/* The ISDN-specific entries in the device structure. */
static const struct net_device_ops isdn_netdev_ops = {
.ndo_init = isdn_net_init,
.ndo_open = isdn_net_open,
.ndo_stop = isdn_net_close,
.ndo_do_ioctl = isdn_net_ioctl,
.ndo_validate_addr = NULL,
.ndo_start_xmit = isdn_net_start_xmit,
.ndo_get_stats = isdn_net_get_stats,
.ndo_tx_timeout = isdn_net_tx_timeout,
};
/* /*
* Helper for alloc_netdev() * Helper for alloc_netdev()
*/ */
@ -2515,7 +2526,20 @@ static void _isdn_setup(struct net_device *dev)
{ {
isdn_net_local *lp = netdev_priv(dev); isdn_net_local *lp = netdev_priv(dev);
ether_setup(dev);
dev->flags = IFF_NOARP | IFF_POINTOPOINT; dev->flags = IFF_NOARP | IFF_POINTOPOINT;
/* Setup the generic properties */
dev->mtu = 1500;
dev->flags = IFF_NOARP|IFF_POINTOPOINT;
dev->type = ARPHRD_ETHER;
dev->addr_len = ETH_ALEN;
dev->header_ops = NULL;
dev->netdev_ops = &isdn_netdev_ops;
/* for clients with MPPP maybe higher values better */
dev->tx_queue_len = 30;
lp->p_encap = ISDN_NET_ENCAP_RAWIP; lp->p_encap = ISDN_NET_ENCAP_RAWIP;
lp->magic = ISDN_NET_MAGIC; lp->magic = ISDN_NET_MAGIC;
lp->last = lp; lp->last = lp;
@ -2570,7 +2594,7 @@ isdn_net_new(char *name, struct net_device *master)
return NULL; return NULL;
} }
netdev->local = netdev_priv(netdev->dev); netdev->local = netdev_priv(netdev->dev);
netdev->dev->init = isdn_net_init;
if (master) { if (master) {
/* Device shall be a slave */ /* Device shall be a slave */
struct net_device *p = MASTER_TO_SLAVE(master); struct net_device *p = MASTER_TO_SLAVE(master);
@ -2588,7 +2612,6 @@ isdn_net_new(char *name, struct net_device *master)
/* /*
* Watchdog timer (currently) for master only. * Watchdog timer (currently) for master only.
*/ */
netdev->dev->tx_timeout = isdn_net_tx_timeout;
netdev->dev->watchdog_timeo = ISDN_NET_TX_TIMEOUT; netdev->dev->watchdog_timeo = ISDN_NET_TX_TIMEOUT;
if (register_netdev(netdev->dev) != 0) { if (register_netdev(netdev->dev) != 0) {
printk(KERN_WARNING "isdn_net: Could not register net-device\n"); printk(KERN_WARNING "isdn_net: Could not register net-device\n");
@ -2704,7 +2727,6 @@ isdn_net_setcfg(isdn_net_ioctl_cfg * cfg)
#else #else
p->dev->type = ARPHRD_PPP; /* change ARP type */ p->dev->type = ARPHRD_PPP; /* change ARP type */
p->dev->addr_len = 0; p->dev->addr_len = 0;
p->dev->do_ioctl = isdn_ppp_dev_ioctl;
#endif #endif
break; break;
case ISDN_NET_ENCAP_X25IFACE: case ISDN_NET_ENCAP_X25IFACE:
@ -2718,7 +2740,6 @@ isdn_net_setcfg(isdn_net_ioctl_cfg * cfg)
#endif #endif
break; break;
case ISDN_NET_ENCAP_CISCOHDLCK: case ISDN_NET_ENCAP_CISCOHDLCK:
p->dev->do_ioctl = isdn_ciscohdlck_dev_ioctl;
break; break;
default: default:
if( cfg->p_encap >= 0 && if( cfg->p_encap >= 0 &&

View file

@ -125,7 +125,6 @@ static void hexdump( const unsigned char *buf, unsigned short len )
struct dvb_net_priv { struct dvb_net_priv {
int in_use; int in_use;
struct net_device_stats stats;
u16 pid; u16 pid;
struct net_device *net; struct net_device *net;
struct dvb_net *host; struct dvb_net *host;
@ -384,8 +383,8 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
if (priv->ule_skb) { if (priv->ule_skb) {
dev_kfree_skb( priv->ule_skb ); dev_kfree_skb( priv->ule_skb );
/* Prepare for next SNDU. */ /* Prepare for next SNDU. */
priv->stats.rx_errors++; dev->stats.rx_errors++;
priv->stats.rx_frame_errors++; dev->stats.rx_frame_errors++;
} }
reset_ule(priv); reset_ule(priv);
priv->need_pusi = 1; priv->need_pusi = 1;
@ -438,8 +437,8 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
dev_kfree_skb( priv->ule_skb ); dev_kfree_skb( priv->ule_skb );
/* Prepare for next SNDU. */ /* Prepare for next SNDU. */
// reset_ule(priv); moved to below. // reset_ule(priv); moved to below.
priv->stats.rx_errors++; dev->stats.rx_errors++;
priv->stats.rx_frame_errors++; dev->stats.rx_frame_errors++;
} }
reset_ule(priv); reset_ule(priv);
/* skip to next PUSI. */ /* skip to next PUSI. */
@ -460,8 +459,8 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
/* Drop partly decoded SNDU, reset state, resync on PUSI. */ /* Drop partly decoded SNDU, reset state, resync on PUSI. */
if (priv->ule_skb) { if (priv->ule_skb) {
dev_kfree_skb( priv->ule_skb ); dev_kfree_skb( priv->ule_skb );
priv->stats.rx_errors++; dev->stats.rx_errors++;
priv->stats.rx_frame_errors++; dev->stats.rx_frame_errors++;
} }
reset_ule(priv); reset_ule(priv);
priv->need_pusi = 1; priv->need_pusi = 1;
@ -477,8 +476,8 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
if (priv->ule_sndu_remain > 183) { if (priv->ule_sndu_remain > 183) {
/* Current SNDU lacks more data than there could be available in the /* Current SNDU lacks more data than there could be available in the
* current TS cell. */ * current TS cell. */
priv->stats.rx_errors++; dev->stats.rx_errors++;
priv->stats.rx_length_errors++; dev->stats.rx_length_errors++;
printk(KERN_WARNING "%lu: Expected %d more SNDU bytes, but " printk(KERN_WARNING "%lu: Expected %d more SNDU bytes, but "
"got PUSI (pf %d, ts_remain %d). Flushing incomplete payload.\n", "got PUSI (pf %d, ts_remain %d). Flushing incomplete payload.\n",
priv->ts_count, priv->ule_sndu_remain, ts[4], ts_remain); priv->ts_count, priv->ule_sndu_remain, ts[4], ts_remain);
@ -520,8 +519,8 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
if (priv->ule_sndu_len < 5) { if (priv->ule_sndu_len < 5) {
printk(KERN_WARNING "%lu: Invalid ULE SNDU length %u. " printk(KERN_WARNING "%lu: Invalid ULE SNDU length %u. "
"Resyncing.\n", priv->ts_count, priv->ule_sndu_len); "Resyncing.\n", priv->ts_count, priv->ule_sndu_len);
priv->stats.rx_errors++; dev->stats.rx_errors++;
priv->stats.rx_length_errors++; dev->stats.rx_length_errors++;
priv->ule_sndu_len = 0; priv->ule_sndu_len = 0;
priv->need_pusi = 1; priv->need_pusi = 1;
new_ts = 1; new_ts = 1;
@ -573,7 +572,7 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
if (priv->ule_skb == NULL) { if (priv->ule_skb == NULL) {
printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n", printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n",
dev->name); dev->name);
priv->stats.rx_dropped++; dev->stats.rx_dropped++;
return; return;
} }
@ -637,8 +636,8 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
ule_dump = 1; ule_dump = 1;
#endif #endif
priv->stats.rx_errors++; dev->stats.rx_errors++;
priv->stats.rx_crc_errors++; dev->stats.rx_crc_errors++;
dev_kfree_skb(priv->ule_skb); dev_kfree_skb(priv->ule_skb);
} else { } else {
/* CRC32 verified OK. */ /* CRC32 verified OK. */
@ -744,8 +743,8 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
* receive the packet anyhow. */ * receive the packet anyhow. */
/* if (priv->ule_dbit && skb->pkt_type == PACKET_OTHERHOST) /* if (priv->ule_dbit && skb->pkt_type == PACKET_OTHERHOST)
priv->ule_skb->pkt_type = PACKET_HOST; */ priv->ule_skb->pkt_type = PACKET_HOST; */
priv->stats.rx_packets++; dev->stats.rx_packets++;
priv->stats.rx_bytes += priv->ule_skb->len; dev->stats.rx_bytes += priv->ule_skb->len;
netif_rx(priv->ule_skb); netif_rx(priv->ule_skb);
} }
sndu_done: sndu_done:
@ -800,8 +799,7 @@ static void dvb_net_sec(struct net_device *dev,
{ {
u8 *eth; u8 *eth;
struct sk_buff *skb; struct sk_buff *skb;
struct net_device_stats *stats = struct net_device_stats *stats = &dev->stats;
&((struct dvb_net_priv *) netdev_priv(dev))->stats;
int snap = 0; int snap = 0;
/* note: pkt_len includes a 32bit checksum */ /* note: pkt_len includes a 32bit checksum */
@ -1216,28 +1214,29 @@ static int dvb_net_stop(struct net_device *dev)
return dvb_net_feed_stop(dev); return dvb_net_feed_stop(dev);
} }
static struct net_device_stats * dvb_net_get_stats(struct net_device *dev)
{
return &((struct dvb_net_priv *) netdev_priv(dev))->stats;
}
static const struct header_ops dvb_header_ops = { static const struct header_ops dvb_header_ops = {
.create = eth_header, .create = eth_header,
.parse = eth_header_parse, .parse = eth_header_parse,
.rebuild = eth_rebuild_header, .rebuild = eth_rebuild_header,
}; };
static const struct net_device_ops dvb_netdev_ops = {
.ndo_open = dvb_net_open,
.ndo_stop = dvb_net_stop,
.ndo_start_xmit = dvb_net_tx,
.ndo_set_multicast_list = dvb_net_set_multicast_list,
.ndo_set_mac_address = dvb_net_set_mac,
.ndo_change_mtu = eth_change_mtu,
.ndo_validate_addr = eth_validate_addr,
};
static void dvb_net_setup(struct net_device *dev) static void dvb_net_setup(struct net_device *dev)
{ {
ether_setup(dev); ether_setup(dev);
dev->header_ops = &dvb_header_ops; dev->header_ops = &dvb_header_ops;
dev->open = dvb_net_open; dev->netdev_ops = &dvb_netdev_ops;
dev->stop = dvb_net_stop;
dev->hard_start_xmit = dvb_net_tx;
dev->get_stats = dvb_net_get_stats;
dev->set_multicast_list = dvb_net_set_multicast_list;
dev->set_mac_address = dvb_net_set_mac;
dev->mtu = 4096; dev->mtu = 4096;
dev->mc_count = 0; dev->mc_count = 0;

View file

@ -106,7 +106,6 @@ struct mpt_lan_priv {
u32 total_posted; u32 total_posted;
u32 total_received; u32 total_received;
struct net_device_stats stats; /* Per device statistics */
struct delayed_work post_buckets_task; struct delayed_work post_buckets_task;
struct net_device *dev; struct net_device *dev;
@ -547,15 +546,6 @@ mpt_lan_close(struct net_device *dev)
return 0; return 0;
} }
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
static struct net_device_stats *
mpt_lan_get_stats(struct net_device *dev)
{
struct mpt_lan_priv *priv = netdev_priv(dev);
return (struct net_device_stats *) &priv->stats;
}
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
static int static int
mpt_lan_change_mtu(struct net_device *dev, int new_mtu) mpt_lan_change_mtu(struct net_device *dev, int new_mtu)
@ -594,8 +584,8 @@ mpt_lan_send_turbo(struct net_device *dev, u32 tmsg)
ctx = GET_LAN_BUFFER_CONTEXT(tmsg); ctx = GET_LAN_BUFFER_CONTEXT(tmsg);
sent = priv->SendCtl[ctx].skb; sent = priv->SendCtl[ctx].skb;
priv->stats.tx_packets++; dev->stats.tx_packets++;
priv->stats.tx_bytes += sent->len; dev->stats.tx_bytes += sent->len;
dioprintk((KERN_INFO MYNAM ": %s/%s: @%s, skb %p sent.\n", dioprintk((KERN_INFO MYNAM ": %s/%s: @%s, skb %p sent.\n",
IOC_AND_NETDEV_NAMES_s_s(dev), IOC_AND_NETDEV_NAMES_s_s(dev),
@ -636,7 +626,7 @@ mpt_lan_send_reply(struct net_device *dev, LANSendReply_t *pSendRep)
switch (le16_to_cpu(pSendRep->IOCStatus) & MPI_IOCSTATUS_MASK) { switch (le16_to_cpu(pSendRep->IOCStatus) & MPI_IOCSTATUS_MASK) {
case MPI_IOCSTATUS_SUCCESS: case MPI_IOCSTATUS_SUCCESS:
priv->stats.tx_packets += count; dev->stats.tx_packets += count;
break; break;
case MPI_IOCSTATUS_LAN_CANCELED: case MPI_IOCSTATUS_LAN_CANCELED:
@ -644,13 +634,13 @@ mpt_lan_send_reply(struct net_device *dev, LANSendReply_t *pSendRep)
break; break;
case MPI_IOCSTATUS_INVALID_SGL: case MPI_IOCSTATUS_INVALID_SGL:
priv->stats.tx_errors += count; dev->stats.tx_errors += count;
printk (KERN_ERR MYNAM ": %s/%s: ERROR - Invalid SGL sent to IOC!\n", printk (KERN_ERR MYNAM ": %s/%s: ERROR - Invalid SGL sent to IOC!\n",
IOC_AND_NETDEV_NAMES_s_s(dev)); IOC_AND_NETDEV_NAMES_s_s(dev));
goto out; goto out;
default: default:
priv->stats.tx_errors += count; dev->stats.tx_errors += count;
break; break;
} }
@ -661,7 +651,7 @@ mpt_lan_send_reply(struct net_device *dev, LANSendReply_t *pSendRep)
ctx = GET_LAN_BUFFER_CONTEXT(le32_to_cpu(*pContext)); ctx = GET_LAN_BUFFER_CONTEXT(le32_to_cpu(*pContext));
sent = priv->SendCtl[ctx].skb; sent = priv->SendCtl[ctx].skb;
priv->stats.tx_bytes += sent->len; dev->stats.tx_bytes += sent->len;
dioprintk((KERN_INFO MYNAM ": %s/%s: @%s, skb %p sent.\n", dioprintk((KERN_INFO MYNAM ": %s/%s: @%s, skb %p sent.\n",
IOC_AND_NETDEV_NAMES_s_s(dev), IOC_AND_NETDEV_NAMES_s_s(dev),
@ -842,8 +832,8 @@ mpt_lan_receive_skb(struct net_device *dev, struct sk_buff *skb)
"delivered to upper level.\n", "delivered to upper level.\n",
IOC_AND_NETDEV_NAMES_s_s(dev), skb->len)); IOC_AND_NETDEV_NAMES_s_s(dev), skb->len));
priv->stats.rx_bytes += skb->len; dev->stats.rx_bytes += skb->len;
priv->stats.rx_packets++; dev->stats.rx_packets++;
skb->dev = dev; skb->dev = dev;
netif_rx(skb); netif_rx(skb);
@ -1308,6 +1298,14 @@ mpt_lan_post_receive_buckets_work(struct work_struct *work)
post_buckets_task.work)); post_buckets_task.work));
} }
static const struct net_device_ops mpt_netdev_ops = {
.ndo_open = mpt_lan_open,
.ndo_stop = mpt_lan_close,
.ndo_start_xmit = mpt_lan_sdu_send,
.ndo_change_mtu = mpt_lan_change_mtu,
.ndo_tx_timeout = mpt_lan_tx_timeout,
};
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
static struct net_device * static struct net_device *
mpt_register_lan_device (MPT_ADAPTER *mpt_dev, int pnum) mpt_register_lan_device (MPT_ADAPTER *mpt_dev, int pnum)
@ -1372,15 +1370,7 @@ mpt_register_lan_device (MPT_ADAPTER *mpt_dev, int pnum)
priv->tx_max_out = (tx_max_out_p <= MPT_TX_MAX_OUT_LIM) ? priv->tx_max_out = (tx_max_out_p <= MPT_TX_MAX_OUT_LIM) ?
tx_max_out_p : MPT_TX_MAX_OUT_LIM; tx_max_out_p : MPT_TX_MAX_OUT_LIM;
dev->open = mpt_lan_open; dev->netdev_ops = &mpt_netdev_ops;
dev->stop = mpt_lan_close;
dev->get_stats = mpt_lan_get_stats;
dev->set_multicast_list = NULL;
dev->change_mtu = mpt_lan_change_mtu;
dev->hard_start_xmit = mpt_lan_sdu_send;
/* Not in 2.3.42. Need 2.3.45+ */
dev->tx_timeout = mpt_lan_tx_timeout;
dev->watchdog_timeo = MPT_LAN_TX_TIMEOUT; dev->watchdog_timeo = MPT_LAN_TX_TIMEOUT;
dlprintk((KERN_INFO MYNAM ": Finished registering dev " dlprintk((KERN_INFO MYNAM ": Finished registering dev "

View file

@ -95,11 +95,6 @@ struct xpnet_pending_msg {
atomic_t use_count; atomic_t use_count;
}; };
/* driver specific structure pointed to by the device structure */
struct xpnet_dev_private {
struct net_device_stats stats;
};
struct net_device *xpnet_device; struct net_device *xpnet_device;
/* /*
@ -153,7 +148,6 @@ xpnet_receive(short partid, int channel, struct xpnet_message *msg)
struct sk_buff *skb; struct sk_buff *skb;
void *dst; void *dst;
enum xp_retval ret; enum xp_retval ret;
struct xpnet_dev_private *priv = netdev_priv(xpnet_device);
if (!XPNET_VALID_MSG(msg)) { if (!XPNET_VALID_MSG(msg)) {
/* /*
@ -161,7 +155,7 @@ xpnet_receive(short partid, int channel, struct xpnet_message *msg)
*/ */
xpc_received(partid, channel, (void *)msg); xpc_received(partid, channel, (void *)msg);
priv->stats.rx_errors++; xpnet_device->stats.rx_errors++;
return; return;
} }
@ -176,7 +170,7 @@ xpnet_receive(short partid, int channel, struct xpnet_message *msg)
xpc_received(partid, channel, (void *)msg); xpc_received(partid, channel, (void *)msg);
priv->stats.rx_errors++; xpnet_device->stats.rx_errors++;
return; return;
} }
@ -226,7 +220,7 @@ xpnet_receive(short partid, int channel, struct xpnet_message *msg)
xpc_received(partid, channel, (void *)msg); xpc_received(partid, channel, (void *)msg);
priv->stats.rx_errors++; xpnet_device->stats.rx_errors++;
return; return;
} }
@ -247,8 +241,8 @@ xpnet_receive(short partid, int channel, struct xpnet_message *msg)
skb_end_pointer(skb), skb->len); skb_end_pointer(skb), skb->len);
xpnet_device->last_rx = jiffies; xpnet_device->last_rx = jiffies;
priv->stats.rx_packets++; xpnet_device->stats.rx_packets++;
priv->stats.rx_bytes += skb->len + ETH_HLEN; xpnet_device->stats.rx_bytes += skb->len + ETH_HLEN;
netif_rx_ni(skb); netif_rx_ni(skb);
xpc_received(partid, channel, (void *)msg); xpc_received(partid, channel, (void *)msg);
@ -352,26 +346,6 @@ xpnet_dev_change_mtu(struct net_device *dev, int new_mtu)
return 0; return 0;
} }
/*
* Required for the net_device structure.
*/
static int
xpnet_dev_set_config(struct net_device *dev, struct ifmap *new_map)
{
return 0;
}
/*
* Return statistics to the caller.
*/
static struct net_device_stats *
xpnet_dev_get_stats(struct net_device *dev)
{
struct xpnet_dev_private *priv = netdev_priv(dev);
return &priv->stats;
}
/* /*
* Notification that the other end has received the message and * Notification that the other end has received the message and
* DMA'd the skb information. At this point, they are done with * DMA'd the skb information. At this point, they are done with
@ -453,7 +427,6 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
struct xpnet_pending_msg *queued_msg; struct xpnet_pending_msg *queued_msg;
u64 start_addr, end_addr; u64 start_addr, end_addr;
short dest_partid; short dest_partid;
struct xpnet_dev_private *priv = netdev_priv(dev);
u16 embedded_bytes = 0; u16 embedded_bytes = 0;
dev_dbg(xpnet, ">skb->head=0x%p skb->data=0x%p skb->tail=0x%p " dev_dbg(xpnet, ">skb->head=0x%p skb->data=0x%p skb->tail=0x%p "
@ -476,7 +449,7 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
dev_warn(xpnet, "failed to kmalloc %ld bytes; dropping " dev_warn(xpnet, "failed to kmalloc %ld bytes; dropping "
"packet\n", sizeof(struct xpnet_pending_msg)); "packet\n", sizeof(struct xpnet_pending_msg));
priv->stats.tx_errors++; dev->stats.tx_errors++;
return -ENOMEM; return -ENOMEM;
} }
@ -526,8 +499,8 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
kfree(queued_msg); kfree(queued_msg);
} }
priv->stats.tx_packets++; dev->stats.tx_packets++;
priv->stats.tx_bytes += skb->len; dev->stats.tx_bytes += skb->len;
return 0; return 0;
} }
@ -538,12 +511,19 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
static void static void
xpnet_dev_tx_timeout(struct net_device *dev) xpnet_dev_tx_timeout(struct net_device *dev)
{ {
struct xpnet_dev_private *priv = netdev_priv(dev); dev->stats.tx_errors++;
priv->stats.tx_errors++;
return;
} }
static const struct net_device_ops xpnet_netdev_ops = {
.ndo_open = xpnet_dev_open,
.ndo_stop = xpnet_dev_stop,
.ndo_start_xmit = xpnet_dev_hard_start_xmit,
.ndo_change_mtu = xpnet_dev_change_mtu,
.ndo_tx_timeout = xpnet_dev_tx_timeout,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
};
static int __init static int __init
xpnet_init(void) xpnet_init(void)
{ {
@ -563,8 +543,7 @@ xpnet_init(void)
* use ether_setup() to init the majority of our device * use ether_setup() to init the majority of our device
* structure and then override the necessary pieces. * structure and then override the necessary pieces.
*/ */
xpnet_device = alloc_netdev(sizeof(struct xpnet_dev_private), xpnet_device = alloc_netdev(0, XPNET_DEVICE_NAME, ether_setup);
XPNET_DEVICE_NAME, ether_setup);
if (xpnet_device == NULL) { if (xpnet_device == NULL) {
kfree(xpnet_broadcast_partitions); kfree(xpnet_broadcast_partitions);
return -ENOMEM; return -ENOMEM;
@ -573,13 +552,6 @@ xpnet_init(void)
netif_carrier_off(xpnet_device); netif_carrier_off(xpnet_device);
xpnet_device->mtu = XPNET_DEF_MTU; xpnet_device->mtu = XPNET_DEF_MTU;
xpnet_device->change_mtu = xpnet_dev_change_mtu;
xpnet_device->open = xpnet_dev_open;
xpnet_device->get_stats = xpnet_dev_get_stats;
xpnet_device->stop = xpnet_dev_stop;
xpnet_device->hard_start_xmit = xpnet_dev_hard_start_xmit;
xpnet_device->tx_timeout = xpnet_dev_tx_timeout;
xpnet_device->set_config = xpnet_dev_set_config;
/* /*
* Multicast assumes the LSB of the first octet is set for multicast * Multicast assumes the LSB of the first octet is set for multicast

View file

@ -830,7 +830,7 @@ config ULTRA32
config BFIN_MAC config BFIN_MAC
tristate "Blackfin on-chip MAC support" tristate "Blackfin on-chip MAC support"
depends on NET_ETHERNET && (BF526 || BF527 || BF536 || BF537) depends on NET_ETHERNET && (BF516 || BF518 || BF526 || BF527 || BF536 || BF537)
select CRC32 select CRC32
select MII select MII
select PHYLIB select PHYLIB

File diff suppressed because it is too large Load diff

View file

@ -1813,6 +1813,25 @@ static void __devinit amd8111e_probe_ext_phy(struct net_device* dev)
lp->ext_phy_addr = 1; lp->ext_phy_addr = 1;
} }
static const struct net_device_ops amd8111e_netdev_ops = {
.ndo_open = amd8111e_open,
.ndo_stop = amd8111e_close,
.ndo_start_xmit = amd8111e_start_xmit,
.ndo_tx_timeout = amd8111e_tx_timeout,
.ndo_get_stats = amd8111e_get_stats,
.ndo_set_multicast_list = amd8111e_set_multicast_list,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = amd8111e_set_mac_address,
.ndo_do_ioctl = amd8111e_ioctl,
.ndo_change_mtu = amd8111e_change_mtu,
#if AMD8111E_VLAN_TAG_USED
.ndo_vlan_rx_register = amd8111e_vlan_rx_register,
#endif
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = amd8111e_poll,
#endif
};
static int __devinit amd8111e_probe_one(struct pci_dev *pdev, static int __devinit amd8111e_probe_one(struct pci_dev *pdev,
const struct pci_device_id *ent) const struct pci_device_id *ent)
{ {
@ -1872,7 +1891,6 @@ static int __devinit amd8111e_probe_one(struct pci_dev *pdev,
#if AMD8111E_VLAN_TAG_USED #if AMD8111E_VLAN_TAG_USED
dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX ; dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX ;
dev->vlan_rx_register =amd8111e_vlan_rx_register;
#endif #endif
lp = netdev_priv(dev); lp = netdev_priv(dev);
@ -1901,27 +1919,16 @@ static int __devinit amd8111e_probe_one(struct pci_dev *pdev,
if(dynamic_ipg[card_idx++]) if(dynamic_ipg[card_idx++])
lp->options |= OPTION_DYN_IPG_ENABLE; lp->options |= OPTION_DYN_IPG_ENABLE;
/* Initialize driver entry points */ /* Initialize driver entry points */
dev->open = amd8111e_open; dev->netdev_ops = &amd8111e_netdev_ops;
dev->hard_start_xmit = amd8111e_start_xmit;
dev->stop = amd8111e_close;
dev->get_stats = amd8111e_get_stats;
dev->set_multicast_list = amd8111e_set_multicast_list;
dev->set_mac_address = amd8111e_set_mac_address;
dev->do_ioctl = amd8111e_ioctl;
dev->change_mtu = amd8111e_change_mtu;
SET_ETHTOOL_OPS(dev, &ops); SET_ETHTOOL_OPS(dev, &ops);
dev->irq =pdev->irq; dev->irq =pdev->irq;
dev->tx_timeout = amd8111e_tx_timeout;
dev->watchdog_timeo = AMD8111E_TX_TIMEOUT; dev->watchdog_timeo = AMD8111E_TX_TIMEOUT;
netif_napi_add(dev, &lp->napi, amd8111e_rx_poll, 32); netif_napi_add(dev, &lp->napi, amd8111e_rx_poll, 32);
#ifdef CONFIG_NET_POLL_CONTROLLER
dev->poll_controller = amd8111e_poll;
#endif
#if AMD8111E_VLAN_TAG_USED #if AMD8111E_VLAN_TAG_USED
dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
dev->vlan_rx_register =amd8111e_vlan_rx_register;
#endif #endif
/* Probe the external PHY */ /* Probe the external PHY */
amd8111e_probe_ext_phy(dev); amd8111e_probe_ext_phy(dev);

View file

@ -48,12 +48,18 @@ static int ipddp_mode = IPDDP_DECAP;
/* Index to functions, as function prototypes. */ /* Index to functions, as function prototypes. */
static int ipddp_xmit(struct sk_buff *skb, struct net_device *dev); static int ipddp_xmit(struct sk_buff *skb, struct net_device *dev);
static struct net_device_stats *ipddp_get_stats(struct net_device *dev);
static int ipddp_create(struct ipddp_route *new_rt); static int ipddp_create(struct ipddp_route *new_rt);
static int ipddp_delete(struct ipddp_route *rt); static int ipddp_delete(struct ipddp_route *rt);
static struct ipddp_route* ipddp_find_route(struct ipddp_route *rt); static struct ipddp_route* ipddp_find_route(struct ipddp_route *rt);
static int ipddp_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); static int ipddp_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
static const struct net_device_ops ipddp_netdev_ops = {
.ndo_start_xmit = ipddp_xmit,
.ndo_do_ioctl = ipddp_ioctl,
.ndo_change_mtu = eth_change_mtu,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
};
static struct net_device * __init ipddp_init(void) static struct net_device * __init ipddp_init(void)
{ {
@ -61,7 +67,7 @@ static struct net_device * __init ipddp_init(void)
struct net_device *dev; struct net_device *dev;
int err; int err;
dev = alloc_etherdev(sizeof(struct net_device_stats)); dev = alloc_etherdev(0);
if (!dev) if (!dev)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
@ -71,9 +77,7 @@ static struct net_device * __init ipddp_init(void)
printk(version); printk(version);
/* Initalize the device structure. */ /* Initalize the device structure. */
dev->hard_start_xmit = ipddp_xmit; dev->netdev_ops = &ipddp_netdev_ops;
dev->get_stats = ipddp_get_stats;
dev->do_ioctl = ipddp_ioctl;
dev->type = ARPHRD_IPDDP; /* IP over DDP tunnel */ dev->type = ARPHRD_IPDDP; /* IP over DDP tunnel */
dev->mtu = 585; dev->mtu = 585;
@ -103,13 +107,6 @@ static struct net_device * __init ipddp_init(void)
return dev; return dev;
} }
/*
* Get the current statistics. This may be called with the card open or closed.
*/
static struct net_device_stats *ipddp_get_stats(struct net_device *dev)
{
return netdev_priv(dev);
}
/* /*
* Transmit LLAP/ELAP frame using aarp_send_ddp. * Transmit LLAP/ELAP frame using aarp_send_ddp.
@ -170,8 +167,8 @@ static int ipddp_xmit(struct sk_buff *skb, struct net_device *dev)
skb->protocol = htons(ETH_P_ATALK); /* Protocol has changed */ skb->protocol = htons(ETH_P_ATALK); /* Protocol has changed */
((struct net_device_stats *) netdev_priv(dev))->tx_packets++; dev->stats.tx_packets++;
((struct net_device_stats *) netdev_priv(dev))->tx_bytes += skb->len; dev->stats.tx_bytes += skb->len;
if(aarp_send_ddp(rt->dev, skb, &rt->at, NULL) < 0) if(aarp_send_ddp(rt->dev, skb, &rt->at, NULL) < 0)
dev_kfree_skb(skb); dev_kfree_skb(skb);

View file

@ -204,8 +204,7 @@ static irqreturn_t atp_interrupt(int irq, void *dev_id);
static void net_rx(struct net_device *dev); static void net_rx(struct net_device *dev);
static void read_block(long ioaddr, int length, unsigned char *buffer, int data_mode); static void read_block(long ioaddr, int length, unsigned char *buffer, int data_mode);
static int net_close(struct net_device *dev); static int net_close(struct net_device *dev);
static void set_rx_mode_8002(struct net_device *dev); static void set_rx_mode(struct net_device *dev);
static void set_rx_mode_8012(struct net_device *dev);
static void tx_timeout(struct net_device *dev); static void tx_timeout(struct net_device *dev);
@ -242,6 +241,17 @@ static int __init atp_init(void)
return -ENODEV; return -ENODEV;
} }
static const struct net_device_ops atp_netdev_ops = {
.ndo_open = net_open,
.ndo_stop = net_close,
.ndo_start_xmit = atp_send_packet,
.ndo_set_multicast_list = set_rx_mode,
.ndo_tx_timeout = tx_timeout,
.ndo_change_mtu = eth_change_mtu,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
};
static int __init atp_probe1(long ioaddr) static int __init atp_probe1(long ioaddr)
{ {
struct net_device *dev = NULL; struct net_device *dev = NULL;
@ -342,12 +352,7 @@ static int __init atp_probe1(long ioaddr)
if (dev->mem_end & 0xf) if (dev->mem_end & 0xf)
net_debug = dev->mem_end & 7; net_debug = dev->mem_end & 7;
dev->open = net_open; dev->netdev_ops = &atp_netdev_ops;
dev->stop = net_close;
dev->hard_start_xmit = atp_send_packet;
dev->set_multicast_list =
lp->chip_type == RTL8002 ? &set_rx_mode_8002 : &set_rx_mode_8012;
dev->tx_timeout = tx_timeout;
dev->watchdog_timeo = TX_TIMEOUT; dev->watchdog_timeo = TX_TIMEOUT;
res = register_netdev(dev); res = register_netdev(dev);
@ -903,6 +908,17 @@ static void set_rx_mode_8012(struct net_device *dev)
write_reg(ioaddr, CMR2, CMR2_IRQOUT); /* Switch back to page 0 */ write_reg(ioaddr, CMR2, CMR2_IRQOUT); /* Switch back to page 0 */
} }
static void set_rx_mode(struct net_device *dev)
{
struct net_local *lp = netdev_priv(dev);
if (lp->chip_type == RTL8002)
return set_rx_mode_8002(dev);
else
return set_rx_mode_8012(dev);
}
static int __init atp_init_module(void) { static int __init atp_init_module(void) {
if (debug) /* Emit version even if no cards detected. */ if (debug) /* Emit version even if no cards detected. */
printk(KERN_INFO "%s", version); printk(KERN_INFO "%s", version);

View file

@ -2108,6 +2108,22 @@ static int __devinit b44_get_invariants(struct b44 *bp)
return err; return err;
} }
static const struct net_device_ops b44_netdev_ops = {
.ndo_open = b44_open,
.ndo_stop = b44_close,
.ndo_start_xmit = b44_start_xmit,
.ndo_get_stats = b44_get_stats,
.ndo_set_multicast_list = b44_set_rx_mode,
.ndo_set_mac_address = b44_set_mac_addr,
.ndo_validate_addr = eth_validate_addr,
.ndo_do_ioctl = b44_ioctl,
.ndo_tx_timeout = b44_tx_timeout,
.ndo_change_mtu = b44_change_mtu,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = b44_poll_controller,
#endif
};
static int __devinit b44_init_one(struct ssb_device *sdev, static int __devinit b44_init_one(struct ssb_device *sdev,
const struct ssb_device_id *ent) const struct ssb_device_id *ent)
{ {
@ -2145,20 +2161,9 @@ static int __devinit b44_init_one(struct ssb_device *sdev,
bp->rx_pending = B44_DEF_RX_RING_PENDING; bp->rx_pending = B44_DEF_RX_RING_PENDING;
bp->tx_pending = B44_DEF_TX_RING_PENDING; bp->tx_pending = B44_DEF_TX_RING_PENDING;
dev->open = b44_open; dev->netdev_ops = &b44_netdev_ops;
dev->stop = b44_close;
dev->hard_start_xmit = b44_start_xmit;
dev->get_stats = b44_get_stats;
dev->set_multicast_list = b44_set_rx_mode;
dev->set_mac_address = b44_set_mac_addr;
dev->do_ioctl = b44_ioctl;
dev->tx_timeout = b44_tx_timeout;
netif_napi_add(dev, &bp->napi, b44_poll, 64); netif_napi_add(dev, &bp->napi, b44_poll, 64);
dev->watchdog_timeo = B44_TX_TIMEOUT; dev->watchdog_timeo = B44_TX_TIMEOUT;
#ifdef CONFIG_NET_POLL_CONTROLLER
dev->poll_controller = b44_poll_controller;
#endif
dev->change_mtu = b44_change_mtu;
dev->irq = sdev->irq; dev->irq = sdev->irq;
SET_ETHTOOL_OPS(dev, &b44_ethtool_ops); SET_ETHTOOL_OPS(dev, &b44_ethtool_ops);

View file

@ -8243,6 +8243,9 @@ static int bnx2x_set_eeprom(struct net_device *dev,
struct bnx2x *bp = netdev_priv(dev); struct bnx2x *bp = netdev_priv(dev);
int rc; int rc;
if (!netif_running(dev))
return -EAGAIN;
DP(BNX2X_MSG_NVM, "ethtool_eeprom: cmd %d\n" DP(BNX2X_MSG_NVM, "ethtool_eeprom: cmd %d\n"
DP_LEVEL " magic 0x%x offset 0x%x (%d) len 0x%x (%d)\n", DP_LEVEL " magic 0x%x offset 0x%x (%d) len 0x%x (%d)\n",
eeprom->cmd, eeprom->magic, eeprom->offset, eeprom->offset, eeprom->cmd, eeprom->magic, eeprom->offset, eeprom->offset,

View file

@ -4148,7 +4148,7 @@ static int bond_change_mtu(struct net_device *bond_dev, int new_mtu)
bond_for_each_slave(bond, slave, i) { bond_for_each_slave(bond, slave, i) {
pr_debug("s %p s->p %p c_m %p\n", slave, pr_debug("s %p s->p %p c_m %p\n", slave,
slave->prev, slave->dev->change_mtu); slave->prev, slave->dev->netdev_ops->ndo_change_mtu);
res = dev_set_mtu(slave->dev, new_mtu); res = dev_set_mtu(slave->dev, new_mtu);

View file

@ -4977,6 +4977,22 @@ static void __devinit cas_program_bridge(struct pci_dev *cas_pdev)
pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0xff); pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0xff);
} }
static const struct net_device_ops cas_netdev_ops = {
.ndo_open = cas_open,
.ndo_stop = cas_close,
.ndo_start_xmit = cas_start_xmit,
.ndo_get_stats = cas_get_stats,
.ndo_set_multicast_list = cas_set_multicast,
.ndo_do_ioctl = cas_ioctl,
.ndo_tx_timeout = cas_tx_timeout,
.ndo_change_mtu = cas_change_mtu,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = cas_netpoll,
#endif
};
static int __devinit cas_init_one(struct pci_dev *pdev, static int __devinit cas_init_one(struct pci_dev *pdev,
const struct pci_device_id *ent) const struct pci_device_id *ent)
{ {
@ -5166,21 +5182,12 @@ static int __devinit cas_init_one(struct pci_dev *pdev,
for (i = 0; i < N_RX_FLOWS; i++) for (i = 0; i < N_RX_FLOWS; i++)
skb_queue_head_init(&cp->rx_flows[i]); skb_queue_head_init(&cp->rx_flows[i]);
dev->open = cas_open; dev->netdev_ops = &cas_netdev_ops;
dev->stop = cas_close;
dev->hard_start_xmit = cas_start_xmit;
dev->get_stats = cas_get_stats;
dev->set_multicast_list = cas_set_multicast;
dev->do_ioctl = cas_ioctl;
dev->ethtool_ops = &cas_ethtool_ops; dev->ethtool_ops = &cas_ethtool_ops;
dev->tx_timeout = cas_tx_timeout;
dev->watchdog_timeo = CAS_TX_TIMEOUT; dev->watchdog_timeo = CAS_TX_TIMEOUT;
dev->change_mtu = cas_change_mtu;
#ifdef USE_NAPI #ifdef USE_NAPI
netif_napi_add(dev, &cp->napi, cas_poll, 64); netif_napi_add(dev, &cp->napi, cas_poll, 64);
#endif
#ifdef CONFIG_NET_POLL_CONTROLLER
dev->poll_controller = cas_netpoll;
#endif #endif
dev->irq = pdev->irq; dev->irq = pdev->irq;
dev->dma = 0; dev->dma = 0;

View file

@ -378,6 +378,16 @@ static void de600_rx_intr(struct net_device *dev)
*/ */
} }
static const struct net_device_ops de600_netdev_ops = {
.ndo_open = de600_open,
.ndo_stop = de600_close,
.ndo_start_xmit = de600_start_xmit,
.ndo_change_mtu = eth_change_mtu,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
};
static struct net_device * __init de600_probe(void) static struct net_device * __init de600_probe(void)
{ {
int i; int i;
@ -439,9 +449,7 @@ static struct net_device * __init de600_probe(void)
printk(", Ethernet Address: %pM\n", dev->dev_addr); printk(", Ethernet Address: %pM\n", dev->dev_addr);
dev->open = de600_open; dev->netdev_ops = &de600_netdev_ops;
dev->stop = de600_close;
dev->hard_start_xmit = &de600_start_xmit;
dev->flags&=~IFF_MULTICAST; dev->flags&=~IFF_MULTICAST;

View file

@ -784,6 +784,17 @@ static int adapter_init(struct net_device *dev)
return 0; /* all ok */ return 0; /* all ok */
} }
static const struct net_device_ops de620_netdev_ops = {
.ndo_open = de620_open,
.ndo_stop = de620_close,
.ndo_start_xmit = de620_start_xmit,
.ndo_tx_timeout = de620_timeout,
.ndo_set_multicast_list = de620_set_multicast_list,
.ndo_change_mtu = eth_change_mtu,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
};
/****************************************************************************** /******************************************************************************
* *
* Only start-up code below * Only start-up code below
@ -861,12 +872,8 @@ struct net_device * __init de620_probe(int unit)
else else
printk(" UTP)\n"); printk(" UTP)\n");
dev->open = de620_open; dev->netdev_ops = &de620_netdev_ops;
dev->stop = de620_close;
dev->hard_start_xmit = de620_start_xmit;
dev->tx_timeout = de620_timeout;
dev->watchdog_timeo = HZ*2; dev->watchdog_timeo = HZ*2;
dev->set_multicast_list = de620_set_multicast_list;
/* base_addr and irq are already set, see above! */ /* base_addr and irq are already set, see above! */

View file

@ -161,6 +161,7 @@
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/ethtool.h> #include <linux/ethtool.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/firmware.h>
#include <asm/unaligned.h> #include <asm/unaligned.h>
@ -174,10 +175,17 @@
#define E100_WATCHDOG_PERIOD (2 * HZ) #define E100_WATCHDOG_PERIOD (2 * HZ)
#define E100_NAPI_WEIGHT 16 #define E100_NAPI_WEIGHT 16
#define FIRMWARE_D101M "e100/d101m_ucode.bin"
#define FIRMWARE_D101S "e100/d101s_ucode.bin"
#define FIRMWARE_D102E "e100/d102e_ucode.bin"
MODULE_DESCRIPTION(DRV_DESCRIPTION); MODULE_DESCRIPTION(DRV_DESCRIPTION);
MODULE_AUTHOR(DRV_COPYRIGHT); MODULE_AUTHOR(DRV_COPYRIGHT);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_VERSION(DRV_VERSION); MODULE_VERSION(DRV_VERSION);
MODULE_FIRMWARE(FIRMWARE_D101M);
MODULE_FIRMWARE(FIRMWARE_D101S);
MODULE_FIRMWARE(FIRMWARE_D102E);
static int debug = 3; static int debug = 3;
static int eeprom_bad_csum_allow = 0; static int eeprom_bad_csum_allow = 0;
@ -1049,178 +1057,6 @@ static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb)
c[16], c[17], c[18], c[19], c[20], c[21], c[22], c[23]); c[16], c[17], c[18], c[19], c[20], c[21], c[22], c[23]);
} }
/********************************************************/
/* Micro code for 8086:1229 Rev 8 */
/********************************************************/
/* Parameter values for the D101M B-step */
#define D101M_CPUSAVER_TIMER_DWORD 78
#define D101M_CPUSAVER_BUNDLE_DWORD 65
#define D101M_CPUSAVER_MIN_SIZE_DWORD 126
#define D101M_B_RCVBUNDLE_UCODE \
{\
0x00550215, 0xFFFF0437, 0xFFFFFFFF, 0x06A70789, 0xFFFFFFFF, 0x0558FFFF, \
0x000C0001, 0x00101312, 0x000C0008, 0x00380216, \
0x0010009C, 0x00204056, 0x002380CC, 0x00380056, \
0x0010009C, 0x00244C0B, 0x00000800, 0x00124818, \
0x00380438, 0x00000000, 0x00140000, 0x00380555, \
0x00308000, 0x00100662, 0x00100561, 0x000E0408, \
0x00134861, 0x000C0002, 0x00103093, 0x00308000, \
0x00100624, 0x00100561, 0x000E0408, 0x00100861, \
0x000C007E, 0x00222C21, 0x000C0002, 0x00103093, \
0x00380C7A, 0x00080000, 0x00103090, 0x00380C7A, \
0x00000000, 0x00000000, 0x00000000, 0x00000000, \
0x0010009C, 0x00244C2D, 0x00010004, 0x00041000, \
0x003A0437, 0x00044010, 0x0038078A, 0x00000000, \
0x00100099, 0x00206C7A, 0x0010009C, 0x00244C48, \
0x00130824, 0x000C0001, 0x00101213, 0x00260C75, \
0x00041000, 0x00010004, 0x00130826, 0x000C0006, \
0x002206A8, 0x0013C926, 0x00101313, 0x003806A8, \
0x00000000, 0x00000000, 0x00000000, 0x00000000, \
0x00000000, 0x00000000, 0x00000000, 0x00000000, \
0x00080600, 0x00101B10, 0x00050004, 0x00100826, \
0x00101210, 0x00380C34, 0x00000000, 0x00000000, \
0x0021155B, 0x00100099, 0x00206559, 0x0010009C, \
0x00244559, 0x00130836, 0x000C0000, 0x00220C62, \
0x000C0001, 0x00101B13, 0x00229C0E, 0x00210C0E, \
0x00226C0E, 0x00216C0E, 0x0022FC0E, 0x00215C0E, \
0x00214C0E, 0x00380555, 0x00010004, 0x00041000, \
0x00278C67, 0x00040800, 0x00018100, 0x003A0437, \
0x00130826, 0x000C0001, 0x00220559, 0x00101313, \
0x00380559, 0x00000000, 0x00000000, 0x00000000, \
0x00000000, 0x00000000, 0x00000000, 0x00000000, \
0x00000000, 0x00130831, 0x0010090B, 0x00124813, \
0x000CFF80, 0x002606AB, 0x00041000, 0x00010004, \
0x003806A8, 0x00000000, 0x00000000, 0x00000000, \
}
/********************************************************/
/* Micro code for 8086:1229 Rev 9 */
/********************************************************/
/* Parameter values for the D101S */
#define D101S_CPUSAVER_TIMER_DWORD 78
#define D101S_CPUSAVER_BUNDLE_DWORD 67
#define D101S_CPUSAVER_MIN_SIZE_DWORD 128
#define D101S_RCVBUNDLE_UCODE \
{\
0x00550242, 0xFFFF047E, 0xFFFFFFFF, 0x06FF0818, 0xFFFFFFFF, 0x05A6FFFF, \
0x000C0001, 0x00101312, 0x000C0008, 0x00380243, \
0x0010009C, 0x00204056, 0x002380D0, 0x00380056, \
0x0010009C, 0x00244F8B, 0x00000800, 0x00124818, \
0x0038047F, 0x00000000, 0x00140000, 0x003805A3, \
0x00308000, 0x00100610, 0x00100561, 0x000E0408, \
0x00134861, 0x000C0002, 0x00103093, 0x00308000, \
0x00100624, 0x00100561, 0x000E0408, 0x00100861, \
0x000C007E, 0x00222FA1, 0x000C0002, 0x00103093, \
0x00380F90, 0x00080000, 0x00103090, 0x00380F90, \
0x00000000, 0x00000000, 0x00000000, 0x00000000, \
0x0010009C, 0x00244FAD, 0x00010004, 0x00041000, \
0x003A047E, 0x00044010, 0x00380819, 0x00000000, \
0x00100099, 0x00206FFD, 0x0010009A, 0x0020AFFD, \
0x0010009C, 0x00244FC8, 0x00130824, 0x000C0001, \
0x00101213, 0x00260FF7, 0x00041000, 0x00010004, \
0x00130826, 0x000C0006, 0x00220700, 0x0013C926, \
0x00101313, 0x00380700, 0x00000000, 0x00000000, \
0x00000000, 0x00000000, 0x00000000, 0x00000000, \
0x00080600, 0x00101B10, 0x00050004, 0x00100826, \
0x00101210, 0x00380FB6, 0x00000000, 0x00000000, \
0x002115A9, 0x00100099, 0x002065A7, 0x0010009A, \
0x0020A5A7, 0x0010009C, 0x002445A7, 0x00130836, \
0x000C0000, 0x00220FE4, 0x000C0001, 0x00101B13, \
0x00229F8E, 0x00210F8E, 0x00226F8E, 0x00216F8E, \
0x0022FF8E, 0x00215F8E, 0x00214F8E, 0x003805A3, \
0x00010004, 0x00041000, 0x00278FE9, 0x00040800, \
0x00018100, 0x003A047E, 0x00130826, 0x000C0001, \
0x002205A7, 0x00101313, 0x003805A7, 0x00000000, \
0x00000000, 0x00000000, 0x00000000, 0x00000000, \
0x00000000, 0x00000000, 0x00000000, 0x00130831, \
0x0010090B, 0x00124813, 0x000CFF80, 0x00260703, \
0x00041000, 0x00010004, 0x00380700 \
}
/********************************************************/
/* Micro code for the 8086:1229 Rev F/10 */
/********************************************************/
/* Parameter values for the D102 E-step */
#define D102_E_CPUSAVER_TIMER_DWORD 42
#define D102_E_CPUSAVER_BUNDLE_DWORD 54
#define D102_E_CPUSAVER_MIN_SIZE_DWORD 46
#define D102_E_RCVBUNDLE_UCODE \
{\
0x007D028F, 0x0E4204F9, 0x14ED0C85, 0x14FA14E9, 0x0EF70E36, 0x1FFF1FFF, \
0x00E014B9, 0x00000000, 0x00000000, 0x00000000, \
0x00E014BD, 0x00000000, 0x00000000, 0x00000000, \
0x00E014D5, 0x00000000, 0x00000000, 0x00000000, \
0x00000000, 0x00000000, 0x00000000, 0x00000000, \
0x00E014C1, 0x00000000, 0x00000000, 0x00000000, \
0x00000000, 0x00000000, 0x00000000, 0x00000000, \
0x00000000, 0x00000000, 0x00000000, 0x00000000, \
0x00000000, 0x00000000, 0x00000000, 0x00000000, \
0x00E014C8, 0x00000000, 0x00000000, 0x00000000, \
0x00200600, 0x00E014EE, 0x00000000, 0x00000000, \
0x0030FF80, 0x00940E46, 0x00038200, 0x00102000, \
0x00E00E43, 0x00000000, 0x00000000, 0x00000000, \
0x00300006, 0x00E014FB, 0x00000000, 0x00000000, \
0x00000000, 0x00000000, 0x00000000, 0x00000000, \
0x00000000, 0x00000000, 0x00000000, 0x00000000, \
0x00000000, 0x00000000, 0x00000000, 0x00000000, \
0x00906E41, 0x00800E3C, 0x00E00E39, 0x00000000, \
0x00906EFD, 0x00900EFD, 0x00E00EF8, 0x00000000, \
0x00000000, 0x00000000, 0x00000000, 0x00000000, \
0x00000000, 0x00000000, 0x00000000, 0x00000000, \
0x00000000, 0x00000000, 0x00000000, 0x00000000, \
0x00000000, 0x00000000, 0x00000000, 0x00000000, \
0x00000000, 0x00000000, 0x00000000, 0x00000000, \
0x00000000, 0x00000000, 0x00000000, 0x00000000, \
0x00000000, 0x00000000, 0x00000000, 0x00000000, \
0x00000000, 0x00000000, 0x00000000, 0x00000000, \
0x00000000, 0x00000000, 0x00000000, 0x00000000, \
0x00000000, 0x00000000, 0x00000000, 0x00000000, \
0x00000000, 0x00000000, 0x00000000, 0x00000000, \
0x00000000, 0x00000000, 0x00000000, 0x00000000, \
0x00000000, 0x00000000, 0x00000000, 0x00000000, \
0x00000000, 0x00000000, 0x00000000, 0x00000000, \
}
static void e100_setup_ucode(struct nic *nic, struct cb *cb, struct sk_buff *skb)
{
/* *INDENT-OFF* */
static struct {
u32 ucode[UCODE_SIZE + 1];
u8 mac;
u8 timer_dword;
u8 bundle_dword;
u8 min_size_dword;
} ucode_opts[] = {
{ D101M_B_RCVBUNDLE_UCODE,
mac_82559_D101M,
D101M_CPUSAVER_TIMER_DWORD,
D101M_CPUSAVER_BUNDLE_DWORD,
D101M_CPUSAVER_MIN_SIZE_DWORD },
{ D101S_RCVBUNDLE_UCODE,
mac_82559_D101S,
D101S_CPUSAVER_TIMER_DWORD,
D101S_CPUSAVER_BUNDLE_DWORD,
D101S_CPUSAVER_MIN_SIZE_DWORD },
{ D102_E_RCVBUNDLE_UCODE,
mac_82551_F,
D102_E_CPUSAVER_TIMER_DWORD,
D102_E_CPUSAVER_BUNDLE_DWORD,
D102_E_CPUSAVER_MIN_SIZE_DWORD },
{ D102_E_RCVBUNDLE_UCODE,
mac_82551_10,
D102_E_CPUSAVER_TIMER_DWORD,
D102_E_CPUSAVER_BUNDLE_DWORD,
D102_E_CPUSAVER_MIN_SIZE_DWORD },
{ {0}, 0, 0, 0, 0}
}, *opts;
/* *INDENT-ON* */
/************************************************************************* /*************************************************************************
* CPUSaver parameters * CPUSaver parameters
* *
@ -1280,42 +1116,101 @@ static void e100_setup_ucode(struct nic *nic, struct cb *cb, struct sk_buff *skb
#define BUNDLEMAX (u16)6 #define BUNDLEMAX (u16)6
#define INTDELAY (u16)1536 /* 0x600 */ #define INTDELAY (u16)1536 /* 0x600 */
/* Initialize firmware */
static const struct firmware *e100_request_firmware(struct nic *nic)
{
const char *fw_name;
const struct firmware *fw;
u8 timer, bundle, min_size;
int err;
/* do not load u-code for ICH devices */ /* do not load u-code for ICH devices */
if (nic->flags & ich) if (nic->flags & ich)
goto noloaducode; return NULL;
/* Search for ucode match against h/w revision */ /* Search for ucode match against h/w revision */
for (opts = ucode_opts; opts->mac; opts++) { if (nic->mac == mac_82559_D101M)
int i; fw_name = FIRMWARE_D101M;
u32 *ucode = opts->ucode; else if (nic->mac == mac_82559_D101S)
if (nic->mac != opts->mac) fw_name = FIRMWARE_D101S;
continue; else if (nic->mac == mac_82551_F || nic->mac == mac_82551_10)
fw_name = FIRMWARE_D102E;
else /* No ucode on other devices */
return NULL;
/* Insert user-tunable settings */ err = request_firmware(&fw, fw_name, &nic->pdev->dev);
ucode[opts->timer_dword] &= 0xFFFF0000; if (err) {
ucode[opts->timer_dword] |= INTDELAY; DPRINTK(PROBE, ERR, "Failed to load firmware \"%s\": %d\n",
ucode[opts->bundle_dword] &= 0xFFFF0000; fw_name, err);
ucode[opts->bundle_dword] |= BUNDLEMAX; return ERR_PTR(err);
ucode[opts->min_size_dword] &= 0xFFFF0000; }
ucode[opts->min_size_dword] |= (BUNDLESMALL) ? 0xFFFF : 0xFF80; /* Firmware should be precisely UCODE_SIZE (words) plus three bytes
indicating the offsets for BUNDLESMALL, BUNDLEMAX, INTDELAY */
for (i = 0; i < UCODE_SIZE; i++) if (fw->size != UCODE_SIZE * 4 + 3) {
cb->u.ucode[i] = cpu_to_le32(ucode[i]); DPRINTK(PROBE, ERR, "Firmware \"%s\" has wrong size %zu\n",
cb->command = cpu_to_le16(cb_ucode | cb_el); fw_name, fw->size);
return; release_firmware(fw);
return ERR_PTR(-EINVAL);
} }
noloaducode: /* Read timer, bundle and min_size from end of firmware blob */
cb->command = cpu_to_le16(cb_nop | cb_el); timer = fw->data[UCODE_SIZE * 4];
bundle = fw->data[UCODE_SIZE * 4 + 1];
min_size = fw->data[UCODE_SIZE * 4 + 2];
if (timer >= UCODE_SIZE || bundle >= UCODE_SIZE ||
min_size >= UCODE_SIZE) {
DPRINTK(PROBE, ERR,
"\"%s\" has bogus offset values (0x%x,0x%x,0x%x)\n",
fw_name, timer, bundle, min_size);
release_firmware(fw);
return ERR_PTR(-EINVAL);
}
/* OK, firmware is validated and ready to use... */
return fw;
} }
static inline int e100_exec_cb_wait(struct nic *nic, struct sk_buff *skb, static void e100_setup_ucode(struct nic *nic, struct cb *cb,
void (*cb_prepare)(struct nic *, struct cb *, struct sk_buff *)) struct sk_buff *skb)
{ {
const struct firmware *fw = (void *)skb;
u8 timer, bundle, min_size;
/* It's not a real skb; we just abused the fact that e100_exec_cb
will pass it through to here... */
cb->skb = NULL;
/* firmware is stored as little endian already */
memcpy(cb->u.ucode, fw->data, UCODE_SIZE * 4);
/* Read timer, bundle and min_size from end of firmware blob */
timer = fw->data[UCODE_SIZE * 4];
bundle = fw->data[UCODE_SIZE * 4 + 1];
min_size = fw->data[UCODE_SIZE * 4 + 2];
/* Insert user-tunable settings in cb->u.ucode */
cb->u.ucode[timer] &= cpu_to_le32(0xFFFF0000);
cb->u.ucode[timer] |= cpu_to_le32(INTDELAY);
cb->u.ucode[bundle] &= cpu_to_le32(0xFFFF0000);
cb->u.ucode[bundle] |= cpu_to_le32(BUNDLEMAX);
cb->u.ucode[min_size] &= cpu_to_le32(0xFFFF0000);
cb->u.ucode[min_size] |= cpu_to_le32((BUNDLESMALL) ? 0xFFFF : 0xFF80);
cb->command = cpu_to_le16(cb_ucode | cb_el);
}
static inline int e100_load_ucode_wait(struct nic *nic)
{
const struct firmware *fw;
int err = 0, counter = 50; int err = 0, counter = 50;
struct cb *cb = nic->cb_to_clean; struct cb *cb = nic->cb_to_clean;
if ((err = e100_exec_cb(nic, NULL, e100_setup_ucode))) fw = e100_request_firmware(nic);
/* If it's NULL, then no ucode is required */
if (!fw || IS_ERR(fw))
return PTR_ERR(fw);
if ((err = e100_exec_cb(nic, (void *)fw, e100_setup_ucode)))
DPRINTK(PROBE,ERR, "ucode cmd failed with error %d\n", err); DPRINTK(PROBE,ERR, "ucode cmd failed with error %d\n", err);
/* must restart cuc */ /* must restart cuc */
@ -1435,7 +1330,7 @@ static int e100_hw_init(struct nic *nic)
return err; return err;
if ((err = e100_exec_cmd(nic, ruc_load_base, 0))) if ((err = e100_exec_cmd(nic, ruc_load_base, 0)))
return err; return err;
if ((err = e100_exec_cb_wait(nic, NULL, e100_setup_ucode))) if ((err = e100_load_ucode_wait(nic)))
return err; return err;
if ((err = e100_exec_cb(nic, NULL, e100_configure))) if ((err = e100_exec_cb(nic, NULL, e100_configure)))
return err; return err;

View file

@ -214,7 +214,7 @@ u64 ehea_h_alloc_resource_qp(const u64 adapter_handle,
u64 *qp_handle, struct h_epas *h_epas) u64 *qp_handle, struct h_epas *h_epas)
{ {
u64 hret; u64 hret;
u64 outs[PLPAR_HCALL9_BUFSIZE]; unsigned long outs[PLPAR_HCALL9_BUFSIZE];
u64 allocate_controls = u64 allocate_controls =
EHEA_BMASK_SET(H_ALL_RES_QP_EQPO, init_attr->low_lat_rq1 ? 1 : 0) EHEA_BMASK_SET(H_ALL_RES_QP_EQPO, init_attr->low_lat_rq1 ? 1 : 0)
@ -312,7 +312,7 @@ u64 ehea_h_alloc_resource_cq(const u64 adapter_handle,
u64 *cq_handle, struct h_epas *epas) u64 *cq_handle, struct h_epas *epas)
{ {
u64 hret; u64 hret;
u64 outs[PLPAR_HCALL9_BUFSIZE]; unsigned long outs[PLPAR_HCALL9_BUFSIZE];
hret = ehea_plpar_hcall9(H_ALLOC_HEA_RESOURCE, hret = ehea_plpar_hcall9(H_ALLOC_HEA_RESOURCE,
outs, outs,
@ -374,7 +374,7 @@ u64 ehea_h_alloc_resource_eq(const u64 adapter_handle,
struct ehea_eq_attr *eq_attr, u64 *eq_handle) struct ehea_eq_attr *eq_attr, u64 *eq_handle)
{ {
u64 hret, allocate_controls; u64 hret, allocate_controls;
u64 outs[PLPAR_HCALL9_BUFSIZE]; unsigned long outs[PLPAR_HCALL9_BUFSIZE];
/* resource type */ /* resource type */
allocate_controls = allocate_controls =
@ -407,7 +407,7 @@ u64 ehea_h_modify_ehea_qp(const u64 adapter_handle, const u8 cat,
u16 *out_swr, u16 *out_rwr) u16 *out_swr, u16 *out_rwr)
{ {
u64 hret; u64 hret;
u64 outs[PLPAR_HCALL9_BUFSIZE]; unsigned long outs[PLPAR_HCALL9_BUFSIZE];
hret = ehea_plpar_hcall9(H_MODIFY_HEA_QP, hret = ehea_plpar_hcall9(H_MODIFY_HEA_QP,
outs, outs,
@ -449,7 +449,7 @@ u64 ehea_h_register_smr(const u64 adapter_handle, const u64 orig_mr_handle,
struct ehea_mr *mr) struct ehea_mr *mr)
{ {
u64 hret; u64 hret;
u64 outs[PLPAR_HCALL9_BUFSIZE]; unsigned long outs[PLPAR_HCALL9_BUFSIZE];
hret = ehea_plpar_hcall9(H_REGISTER_SMR, hret = ehea_plpar_hcall9(H_REGISTER_SMR,
outs, outs,
@ -468,7 +468,7 @@ u64 ehea_h_register_smr(const u64 adapter_handle, const u64 orig_mr_handle,
u64 ehea_h_disable_and_get_hea(const u64 adapter_handle, const u64 qp_handle) u64 ehea_h_disable_and_get_hea(const u64 adapter_handle, const u64 qp_handle)
{ {
u64 outs[PLPAR_HCALL9_BUFSIZE]; unsigned long outs[PLPAR_HCALL9_BUFSIZE];
return ehea_plpar_hcall9(H_DISABLE_AND_GET_HEA, return ehea_plpar_hcall9(H_DISABLE_AND_GET_HEA,
outs, outs,
@ -493,7 +493,7 @@ u64 ehea_h_alloc_resource_mr(const u64 adapter_handle, const u64 vaddr,
const u32 pd, u64 *mr_handle, u32 *lkey) const u32 pd, u64 *mr_handle, u32 *lkey)
{ {
u64 hret; u64 hret;
u64 outs[PLPAR_HCALL9_BUFSIZE]; unsigned long outs[PLPAR_HCALL9_BUFSIZE];
hret = ehea_plpar_hcall9(H_ALLOC_HEA_RESOURCE, hret = ehea_plpar_hcall9(H_ALLOC_HEA_RESOURCE,
outs, outs,
@ -564,7 +564,7 @@ u64 ehea_h_modify_ehea_port(const u64 adapter_handle, const u16 port_num,
const u8 cb_cat, const u64 select_mask, const u8 cb_cat, const u64 select_mask,
void *cb_addr) void *cb_addr)
{ {
u64 outs[PLPAR_HCALL9_BUFSIZE]; unsigned long outs[PLPAR_HCALL9_BUFSIZE];
u64 port_info; u64 port_info;
u64 arr_index = 0; u64 arr_index = 0;
u64 cb_logaddr = virt_to_abs(cb_addr); u64 cb_logaddr = virt_to_abs(cb_addr);

View file

@ -1531,6 +1531,17 @@ static int enc28j60_chipset_init(struct net_device *dev)
return enc28j60_hw_init(priv); return enc28j60_hw_init(priv);
} }
static const struct net_device_ops enc28j60_netdev_ops = {
.ndo_open = enc28j60_net_open,
.ndo_stop = enc28j60_net_close,
.ndo_start_xmit = enc28j60_send_packet,
.ndo_set_multicast_list = enc28j60_set_multicast_list,
.ndo_set_mac_address = enc28j60_set_mac_address,
.ndo_tx_timeout = enc28j60_tx_timeout,
.ndo_change_mtu = eth_change_mtu,
.ndo_validate_addr = eth_validate_addr,
};
static int __devinit enc28j60_probe(struct spi_device *spi) static int __devinit enc28j60_probe(struct spi_device *spi)
{ {
struct net_device *dev; struct net_device *dev;
@ -1585,12 +1596,7 @@ static int __devinit enc28j60_probe(struct spi_device *spi)
dev->if_port = IF_PORT_10BASET; dev->if_port = IF_PORT_10BASET;
dev->irq = spi->irq; dev->irq = spi->irq;
dev->open = enc28j60_net_open; dev->netdev_ops = &enc28j60_netdev_ops;
dev->stop = enc28j60_net_close;
dev->hard_start_xmit = enc28j60_send_packet;
dev->set_multicast_list = &enc28j60_set_multicast_list;
dev->set_mac_address = enc28j60_set_mac_address;
dev->tx_timeout = &enc28j60_tx_timeout;
dev->watchdog_timeo = TX_TIMEOUT; dev->watchdog_timeo = TX_TIMEOUT;
SET_ETHTOOL_OPS(dev, &enc28j60_ethtool_ops); SET_ETHTOOL_OPS(dev, &enc28j60_ethtool_ops);

View file

@ -308,7 +308,18 @@ static int epic_close(struct net_device *dev);
static struct net_device_stats *epic_get_stats(struct net_device *dev); static struct net_device_stats *epic_get_stats(struct net_device *dev);
static void set_rx_mode(struct net_device *dev); static void set_rx_mode(struct net_device *dev);
static const struct net_device_ops epic_netdev_ops = {
.ndo_open = epic_open,
.ndo_stop = epic_close,
.ndo_start_xmit = epic_start_xmit,
.ndo_tx_timeout = epic_tx_timeout,
.ndo_get_stats = epic_get_stats,
.ndo_set_multicast_list = set_rx_mode,
.ndo_do_ioctl = netdev_ioctl,
.ndo_change_mtu = eth_change_mtu,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
};
static int __devinit epic_init_one (struct pci_dev *pdev, static int __devinit epic_init_one (struct pci_dev *pdev,
const struct pci_device_id *ent) const struct pci_device_id *ent)
@ -483,15 +494,9 @@ static int __devinit epic_init_one (struct pci_dev *pdev,
dev->if_port = ep->default_port = option; dev->if_port = ep->default_port = option;
/* The Epic-specific entries in the device structure. */ /* The Epic-specific entries in the device structure. */
dev->open = &epic_open; dev->netdev_ops = &epic_netdev_ops;
dev->hard_start_xmit = &epic_start_xmit;
dev->stop = &epic_close;
dev->get_stats = &epic_get_stats;
dev->set_multicast_list = &set_rx_mode;
dev->do_ioctl = &netdev_ioctl;
dev->ethtool_ops = &netdev_ethtool_ops; dev->ethtool_ops = &netdev_ethtool_ops;
dev->watchdog_timeo = TX_TIMEOUT; dev->watchdog_timeo = TX_TIMEOUT;
dev->tx_timeout = &epic_tx_timeout;
netif_napi_add(dev, &ep->napi, epic_poll, 64); netif_napi_add(dev, &ep->napi, epic_poll, 64);
ret = register_netdev(dev); ret = register_netdev(dev);

View file

@ -467,6 +467,18 @@ static void stop_nic_rxtx(void __iomem *ioaddr, long crvalue)
} }
} }
static const struct net_device_ops netdev_ops = {
.ndo_open = netdev_open,
.ndo_stop = netdev_close,
.ndo_start_xmit = start_tx,
.ndo_get_stats = get_stats,
.ndo_set_multicast_list = set_rx_mode,
.ndo_do_ioctl = mii_ioctl,
.ndo_tx_timeout = fealnx_tx_timeout,
.ndo_change_mtu = eth_change_mtu,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
};
static int __devinit fealnx_init_one(struct pci_dev *pdev, static int __devinit fealnx_init_one(struct pci_dev *pdev,
const struct pci_device_id *ent) const struct pci_device_id *ent)
@ -649,15 +661,8 @@ static int __devinit fealnx_init_one(struct pci_dev *pdev,
np->mii.force_media = 1; np->mii.force_media = 1;
} }
/* The chip-specific entries in the device structure. */ dev->netdev_ops = &netdev_ops;
dev->open = &netdev_open;
dev->hard_start_xmit = &start_tx;
dev->stop = &netdev_close;
dev->get_stats = &get_stats;
dev->set_multicast_list = &set_rx_mode;
dev->do_ioctl = &mii_ioctl;
dev->ethtool_ops = &netdev_ethtool_ops; dev->ethtool_ops = &netdev_ethtool_ops;
dev->tx_timeout = &fealnx_tx_timeout;
dev->watchdog_timeo = TX_TIMEOUT; dev->watchdog_timeo = TX_TIMEOUT;
err = register_netdev(dev); err = register_netdev(dev);

View file

@ -238,8 +238,8 @@ static int gfar_of_init(struct net_device *dev)
goto err_out; goto err_out;
} }
snprintf(priv->phy_bus_id, BUS_ID_SIZE, PHY_ID_FMT, "0", snprintf(priv->phy_bus_id, sizeof(priv->phy_bus_id),
fixed_link[0]); PHY_ID_FMT, "0", fixed_link[0]);
} else { } else {
phy = of_find_node_by_phandle(*ph); phy = of_find_node_by_phandle(*ph);
@ -256,7 +256,7 @@ static int gfar_of_init(struct net_device *dev)
of_node_put(mdio); of_node_put(mdio);
gfar_mdio_bus_name(bus_name, mdio); gfar_mdio_bus_name(bus_name, mdio);
snprintf(priv->phy_bus_id, BUS_ID_SIZE, "%s:%02x", snprintf(priv->phy_bus_id, sizeof(priv->phy_bus_id), "%s:%02x",
bus_name, *id); bus_name, *id);
} }
@ -1973,6 +1973,8 @@ static void adjust_link(struct net_device *dev)
case 1000: case 1000:
tempval = tempval =
((tempval & ~(MACCFG2_IF)) | MACCFG2_GMII); ((tempval & ~(MACCFG2_IF)) | MACCFG2_GMII);
ecntrl &= ~(ECNTRL_R100);
break; break;
case 100: case 100:
case 10: case 10:

View file

@ -425,6 +425,28 @@ struct net_device * __init hp100_probe(int unit)
} }
#endif /* !MODULE && CONFIG_ISA */ #endif /* !MODULE && CONFIG_ISA */
static const struct net_device_ops hp100_bm_netdev_ops = {
.ndo_open = hp100_open,
.ndo_stop = hp100_close,
.ndo_start_xmit = hp100_start_xmit_bm,
.ndo_get_stats = hp100_get_stats,
.ndo_set_multicast_list = hp100_set_multicast_list,
.ndo_change_mtu = eth_change_mtu,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
};
static const struct net_device_ops hp100_netdev_ops = {
.ndo_open = hp100_open,
.ndo_stop = hp100_close,
.ndo_start_xmit = hp100_start_xmit,
.ndo_get_stats = hp100_get_stats,
.ndo_set_multicast_list = hp100_set_multicast_list,
.ndo_change_mtu = eth_change_mtu,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
};
static int __devinit hp100_probe1(struct net_device *dev, int ioaddr, static int __devinit hp100_probe1(struct net_device *dev, int ioaddr,
u_char bus, struct pci_dev *pci_dev) u_char bus, struct pci_dev *pci_dev)
{ {
@ -657,16 +679,10 @@ static int __devinit hp100_probe1(struct net_device *dev, int ioaddr,
lp->virt_memory_size = virt_memory_size; lp->virt_memory_size = virt_memory_size;
lp->rx_ratio = hp100_rx_ratio; /* can be conf'd with insmod */ lp->rx_ratio = hp100_rx_ratio; /* can be conf'd with insmod */
dev->open = hp100_open;
dev->stop = hp100_close;
if (lp->mode == 1) /* busmaster */ if (lp->mode == 1) /* busmaster */
dev->hard_start_xmit = hp100_start_xmit_bm; dev->netdev_ops = &hp100_bm_netdev_ops;
else else
dev->hard_start_xmit = hp100_start_xmit; dev->netdev_ops = &hp100_netdev_ops;
dev->get_stats = hp100_get_stats;
dev->set_multicast_list = &hp100_set_multicast_list;
/* Ask the card for which IRQ line it is configured */ /* Ask the card for which IRQ line it is configured */
if (bus == HP100_BUS_PCI) { if (bus == HP100_BUS_PCI) {

View file

@ -754,7 +754,7 @@ static int ibmveth_set_csum_offload(struct net_device *dev, u32 data,
void (*done) (struct net_device *, u32)) void (*done) (struct net_device *, u32))
{ {
struct ibmveth_adapter *adapter = netdev_priv(dev); struct ibmveth_adapter *adapter = netdev_priv(dev);
u64 set_attr, clr_attr, ret_attr; unsigned long set_attr, clr_attr, ret_attr;
long ret; long ret;
int rc1 = 0, rc2 = 0; int rc1 = 0, rc2 = 0;
int restart = 0; int restart = 0;
@ -1209,7 +1209,7 @@ static int __devinit ibmveth_probe(struct vio_dev *dev, const struct vio_device_
long ret; long ret;
struct net_device *netdev; struct net_device *netdev;
struct ibmveth_adapter *adapter; struct ibmveth_adapter *adapter;
u64 set_attr, ret_attr; unsigned long set_attr, ret_attr;
unsigned char *mac_addr_p; unsigned char *mac_addr_p;
unsigned int *mcastFilterSize_p; unsigned int *mcastFilterSize_p;

View file

@ -39,11 +39,11 @@
#define IbmVethMcastRemoveFilter 0x2UL #define IbmVethMcastRemoveFilter 0x2UL
#define IbmVethMcastClearFilterTable 0x3UL #define IbmVethMcastClearFilterTable 0x3UL
#define IBMVETH_ILLAN_PADDED_PKT_CSUM 0x0000000000002000ULL #define IBMVETH_ILLAN_PADDED_PKT_CSUM 0x0000000000002000UL
#define IBMVETH_ILLAN_TRUNK_PRI_MASK 0x0000000000000F00ULL #define IBMVETH_ILLAN_TRUNK_PRI_MASK 0x0000000000000F00UL
#define IBMVETH_ILLAN_IPV6_TCP_CSUM 0x0000000000000004ULL #define IBMVETH_ILLAN_IPV6_TCP_CSUM 0x0000000000000004UL
#define IBMVETH_ILLAN_IPV4_TCP_CSUM 0x0000000000000002ULL #define IBMVETH_ILLAN_IPV4_TCP_CSUM 0x0000000000000002UL
#define IBMVETH_ILLAN_ACTIVE_TRUNK 0x0000000000000001ULL #define IBMVETH_ILLAN_ACTIVE_TRUNK 0x0000000000000001UL
/* hcall macros */ /* hcall macros */
#define h_register_logical_lan(ua, buflst, rxq, fltlst, mac) \ #define h_register_logical_lan(ua, buflst, rxq, fltlst, mac) \

View file

@ -2210,6 +2210,19 @@ static void __devexit ipg_remove(struct pci_dev *pdev)
pci_set_drvdata(pdev, NULL); pci_set_drvdata(pdev, NULL);
} }
static const struct net_device_ops ipg_netdev_ops = {
.ndo_open = ipg_nic_open,
.ndo_stop = ipg_nic_stop,
.ndo_start_xmit = ipg_nic_hard_start_xmit,
.ndo_get_stats = ipg_nic_get_stats,
.ndo_set_multicast_list = ipg_nic_set_multicast_list,
.ndo_do_ioctl = ipg_ioctl,
.ndo_tx_timeout = ipg_tx_timeout,
.ndo_change_mtu = ipg_nic_change_mtu,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
};
static int __devinit ipg_probe(struct pci_dev *pdev, static int __devinit ipg_probe(struct pci_dev *pdev,
const struct pci_device_id *id) const struct pci_device_id *id)
{ {
@ -2258,15 +2271,7 @@ static int __devinit ipg_probe(struct pci_dev *pdev,
/* Declare IPG NIC functions for Ethernet device methods. /* Declare IPG NIC functions for Ethernet device methods.
*/ */
dev->open = &ipg_nic_open; dev->netdev_ops = &ipg_netdev_ops;
dev->stop = &ipg_nic_stop;
dev->hard_start_xmit = &ipg_nic_hard_start_xmit;
dev->get_stats = &ipg_nic_get_stats;
dev->set_multicast_list = &ipg_nic_set_multicast_list;
dev->do_ioctl = ipg_ioctl;
dev->tx_timeout = ipg_tx_timeout;
dev->change_mtu = &ipg_nic_change_mtu;
SET_NETDEV_DEV(dev, &pdev->dev); SET_NETDEV_DEV(dev, &pdev->dev);
SET_ETHTOOL_OPS(dev, &ipg_ethtool_ops); SET_ETHTOOL_OPS(dev, &ipg_ethtool_ops);

View file

@ -109,7 +109,6 @@ static int ali_ircc_net_open(struct net_device *dev);
static int ali_ircc_net_close(struct net_device *dev); static int ali_ircc_net_close(struct net_device *dev);
static int ali_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); static int ali_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
static void ali_ircc_change_speed(struct ali_ircc_cb *self, __u32 baud); static void ali_ircc_change_speed(struct ali_ircc_cb *self, __u32 baud);
static struct net_device_stats *ali_ircc_net_get_stats(struct net_device *dev);
/* SIR function */ /* SIR function */
static int ali_ircc_sir_hard_xmit(struct sk_buff *skb, struct net_device *dev); static int ali_ircc_sir_hard_xmit(struct sk_buff *skb, struct net_device *dev);
@ -366,7 +365,6 @@ static int ali_ircc_open(int i, chipio_t *info)
dev->open = ali_ircc_net_open; dev->open = ali_ircc_net_open;
dev->stop = ali_ircc_net_close; dev->stop = ali_ircc_net_close;
dev->do_ioctl = ali_ircc_net_ioctl; dev->do_ioctl = ali_ircc_net_ioctl;
dev->get_stats = ali_ircc_net_get_stats;
err = register_netdev(dev); err = register_netdev(dev);
if (err) { if (err) {
@ -876,7 +874,7 @@ static void ali_ircc_sir_receive(struct ali_ircc_cb *self)
* async_unwrap_char will deliver all found frames * async_unwrap_char will deliver all found frames
*/ */
do { do {
async_unwrap_char(self->netdev, &self->stats, &self->rx_buff, async_unwrap_char(self->netdev, &self->netdev->stats, &self->rx_buff,
inb(iobase+UART_RX)); inb(iobase+UART_RX));
/* Make sure we don't stay here too long */ /* Make sure we don't stay here too long */
@ -943,7 +941,7 @@ static void ali_ircc_sir_write_wakeup(struct ali_ircc_cb *self)
netif_wake_queue(self->netdev); netif_wake_queue(self->netdev);
} }
self->stats.tx_packets++; self->netdev->stats.tx_packets++;
/* Turn on receive interrupts */ /* Turn on receive interrupts */
outb(UART_IER_RDI, iobase+UART_IER); outb(UART_IER_RDI, iobase+UART_IER);
@ -1467,7 +1465,7 @@ static int ali_ircc_fir_hard_xmit(struct sk_buff *skb, struct net_device *dev)
self->tx_fifo.queue[self->tx_fifo.free].len = skb->len; self->tx_fifo.queue[self->tx_fifo.free].len = skb->len;
self->tx_fifo.tail += skb->len; self->tx_fifo.tail += skb->len;
self->stats.tx_bytes += skb->len; dev->stats.tx_bytes += skb->len;
skb_copy_from_linear_data(skb, self->tx_fifo.queue[self->tx_fifo.free].start, skb_copy_from_linear_data(skb, self->tx_fifo.queue[self->tx_fifo.free].start,
skb->len); skb->len);
@ -1661,12 +1659,12 @@ static int ali_ircc_dma_xmit_complete(struct ali_ircc_cb *self)
{ {
IRDA_ERROR("%s(), ********* LSR_FRAME_ABORT *********\n", __func__); IRDA_ERROR("%s(), ********* LSR_FRAME_ABORT *********\n", __func__);
self->stats.tx_errors++; self->netdev->stats.tx_errors++;
self->stats.tx_fifo_errors++; self->netdev->stats.tx_fifo_errors++;
} }
else else
{ {
self->stats.tx_packets++; self->netdev->stats.tx_packets++;
} }
/* Check if we need to change the speed */ /* Check if we need to change the speed */
@ -1831,35 +1829,35 @@ static int ali_ircc_dma_receive_complete(struct ali_ircc_cb *self)
IRDA_DEBUG(0,"%s(), ************* RX Errors ************ \n", __func__ ); IRDA_DEBUG(0,"%s(), ************* RX Errors ************ \n", __func__ );
/* Skip frame */ /* Skip frame */
self->stats.rx_errors++; self->netdev->stats.rx_errors++;
self->rx_buff.data += len; self->rx_buff.data += len;
if (status & LSR_FIFO_UR) if (status & LSR_FIFO_UR)
{ {
self->stats.rx_frame_errors++; self->netdev->stats.rx_frame_errors++;
IRDA_DEBUG(0,"%s(), ************* FIFO Errors ************ \n", __func__ ); IRDA_DEBUG(0,"%s(), ************* FIFO Errors ************ \n", __func__ );
} }
if (status & LSR_FRAME_ERROR) if (status & LSR_FRAME_ERROR)
{ {
self->stats.rx_frame_errors++; self->netdev->stats.rx_frame_errors++;
IRDA_DEBUG(0,"%s(), ************* FRAME Errors ************ \n", __func__ ); IRDA_DEBUG(0,"%s(), ************* FRAME Errors ************ \n", __func__ );
} }
if (status & LSR_CRC_ERROR) if (status & LSR_CRC_ERROR)
{ {
self->stats.rx_crc_errors++; self->netdev->stats.rx_crc_errors++;
IRDA_DEBUG(0,"%s(), ************* CRC Errors ************ \n", __func__ ); IRDA_DEBUG(0,"%s(), ************* CRC Errors ************ \n", __func__ );
} }
if(self->rcvFramesOverflow) if(self->rcvFramesOverflow)
{ {
self->stats.rx_frame_errors++; self->netdev->stats.rx_frame_errors++;
IRDA_DEBUG(0,"%s(), ************* Overran DMA buffer ************ \n", __func__ ); IRDA_DEBUG(0,"%s(), ************* Overran DMA buffer ************ \n", __func__ );
} }
if(len == 0) if(len == 0)
{ {
self->stats.rx_frame_errors++; self->netdev->stats.rx_frame_errors++;
IRDA_DEBUG(0,"%s(), ********** Receive Frame Size = 0 ********* \n", __func__ ); IRDA_DEBUG(0,"%s(), ********** Receive Frame Size = 0 ********* \n", __func__ );
} }
} }
@ -1910,7 +1908,7 @@ static int ali_ircc_dma_receive_complete(struct ali_ircc_cb *self)
IRDA_WARNING("%s(), memory squeeze, " IRDA_WARNING("%s(), memory squeeze, "
"dropping frame.\n", "dropping frame.\n",
__func__); __func__);
self->stats.rx_dropped++; self->netdev->stats.rx_dropped++;
return FALSE; return FALSE;
} }
@ -1924,8 +1922,8 @@ static int ali_ircc_dma_receive_complete(struct ali_ircc_cb *self)
/* Move to next frame */ /* Move to next frame */
self->rx_buff.data += len; self->rx_buff.data += len;
self->stats.rx_bytes += len; self->netdev->stats.rx_bytes += len;
self->stats.rx_packets++; self->netdev->stats.rx_packets++;
skb->dev = self->netdev; skb->dev = self->netdev;
skb_reset_mac_header(skb); skb_reset_mac_header(skb);
@ -1994,7 +1992,7 @@ static int ali_ircc_sir_hard_xmit(struct sk_buff *skb, struct net_device *dev)
self->tx_buff.len = async_wrap_skb(skb, self->tx_buff.data, self->tx_buff.len = async_wrap_skb(skb, self->tx_buff.data,
self->tx_buff.truesize); self->tx_buff.truesize);
self->stats.tx_bytes += self->tx_buff.len; self->netdev->stats.tx_bytes += self->tx_buff.len;
/* Turn on transmit finished interrupt. Will fire immediately! */ /* Turn on transmit finished interrupt. Will fire immediately! */
outb(UART_IER_THRI, iobase+UART_IER); outb(UART_IER_THRI, iobase+UART_IER);
@ -2111,17 +2109,6 @@ static int ali_ircc_is_receiving(struct ali_ircc_cb *self)
return status; return status;
} }
static struct net_device_stats *ali_ircc_net_get_stats(struct net_device *dev)
{
struct ali_ircc_cb *self = netdev_priv(dev);
IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __func__ );
IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __func__ );
return &self->stats;
}
static int ali_ircc_suspend(struct platform_device *dev, pm_message_t state) static int ali_ircc_suspend(struct platform_device *dev, pm_message_t state)
{ {
struct ali_ircc_cb *self = platform_get_drvdata(dev); struct ali_ircc_cb *self = platform_get_drvdata(dev);

View file

@ -191,7 +191,6 @@ struct ali_ircc_cb {
struct tx_fifo tx_fifo; /* Info about frames to be transmitted */ struct tx_fifo tx_fifo; /* Info about frames to be transmitted */
struct net_device *netdev; /* Yes! we are some kind of netdevice */ struct net_device *netdev; /* Yes! we are some kind of netdevice */
struct net_device_stats stats;
struct irlap_cb *irlap; /* The link layer we are binded to */ struct irlap_cb *irlap; /* The link layer we are binded to */
struct qos_info qos; /* QoS capabilities for this device */ struct qos_info qos; /* QoS capabilities for this device */

View file

@ -107,7 +107,6 @@ struct au1k_private {
iobuff_t rx_buff; iobuff_t rx_buff;
struct net_device *netdev; struct net_device *netdev;
struct net_device_stats stats;
struct timeval stamp; struct timeval stamp;
struct timeval now; struct timeval now;

View file

@ -53,7 +53,6 @@ static int au1k_irda_hard_xmit(struct sk_buff *, struct net_device *);
static int au1k_irda_rx(struct net_device *); static int au1k_irda_rx(struct net_device *);
static void au1k_irda_interrupt(int, void *); static void au1k_irda_interrupt(int, void *);
static void au1k_tx_timeout(struct net_device *); static void au1k_tx_timeout(struct net_device *);
static struct net_device_stats *au1k_irda_stats(struct net_device *);
static int au1k_irda_ioctl(struct net_device *, struct ifreq *, int); static int au1k_irda_ioctl(struct net_device *, struct ifreq *, int);
static int au1k_irda_set_speed(struct net_device *dev, int speed); static int au1k_irda_set_speed(struct net_device *dev, int speed);
@ -213,7 +212,6 @@ static int au1k_irda_net_init(struct net_device *dev)
dev->open = au1k_irda_start; dev->open = au1k_irda_start;
dev->hard_start_xmit = au1k_irda_hard_xmit; dev->hard_start_xmit = au1k_irda_hard_xmit;
dev->stop = au1k_irda_stop; dev->stop = au1k_irda_stop;
dev->get_stats = au1k_irda_stats;
dev->do_ioctl = au1k_irda_ioctl; dev->do_ioctl = au1k_irda_ioctl;
dev->tx_timeout = au1k_tx_timeout; dev->tx_timeout = au1k_tx_timeout;
@ -832,13 +830,6 @@ au1k_irda_ioctl(struct net_device *dev, struct ifreq *ifreq, int cmd)
return ret; return ret;
} }
static struct net_device_stats *au1k_irda_stats(struct net_device *dev)
{
struct au1k_private *aup = netdev_priv(dev);
return &aup->stats;
}
MODULE_AUTHOR("Pete Popov <ppopov@mvista.com>"); MODULE_AUTHOR("Pete Popov <ppopov@mvista.com>");
MODULE_DESCRIPTION("Au1000 IrDA Device Driver"); MODULE_DESCRIPTION("Au1000 IrDA Device Driver");

View file

@ -308,7 +308,6 @@ struct OboeRing
struct toshoboe_cb struct toshoboe_cb
{ {
struct net_device *netdev; /* Yes! we are some kind of netdevice */ struct net_device *netdev; /* Yes! we are some kind of netdevice */
struct net_device_stats stats;
struct tty_driver ttydev; struct tty_driver ttydev;
struct irlap_cb *irlap; /* The link layer we are binded to */ struct irlap_cb *irlap; /* The link layer we are binded to */

View file

@ -122,7 +122,6 @@ static int irda_usb_net_open(struct net_device *dev);
static int irda_usb_net_close(struct net_device *dev); static int irda_usb_net_close(struct net_device *dev);
static int irda_usb_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); static int irda_usb_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
static void irda_usb_net_timeout(struct net_device *dev); static void irda_usb_net_timeout(struct net_device *dev);
static struct net_device_stats *irda_usb_net_get_stats(struct net_device *dev);
/************************ TRANSMIT ROUTINES ************************/ /************************ TRANSMIT ROUTINES ************************/
/* /*
@ -525,13 +524,13 @@ static int irda_usb_hard_xmit(struct sk_buff *skb, struct net_device *netdev)
/* Ask USB to send the packet - Irq disabled -> GFP_ATOMIC */ /* Ask USB to send the packet - Irq disabled -> GFP_ATOMIC */
if ((res = usb_submit_urb(urb, GFP_ATOMIC))) { if ((res = usb_submit_urb(urb, GFP_ATOMIC))) {
IRDA_WARNING("%s(), failed Tx URB\n", __func__); IRDA_WARNING("%s(), failed Tx URB\n", __func__);
self->stats.tx_errors++; netdev->stats.tx_errors++;
/* Let USB recover : We will catch that in the watchdog */ /* Let USB recover : We will catch that in the watchdog */
/*netif_start_queue(netdev);*/ /*netif_start_queue(netdev);*/
} else { } else {
/* Increment packet stats */ /* Increment packet stats */
self->stats.tx_packets++; netdev->stats.tx_packets++;
self->stats.tx_bytes += skb->len; netdev->stats.tx_bytes += skb->len;
netdev->trans_start = jiffies; netdev->trans_start = jiffies;
} }
@ -677,7 +676,7 @@ static void irda_usb_net_timeout(struct net_device *netdev)
IRDA_DEBUG(0, "%s: Tx timed out, urb->status=%d, urb->transfer_flags=0x%04X\n", netdev->name, urb->status, urb->transfer_flags); IRDA_DEBUG(0, "%s: Tx timed out, urb->status=%d, urb->transfer_flags=0x%04X\n", netdev->name, urb->status, urb->transfer_flags);
/* Increase error count */ /* Increase error count */
self->stats.tx_errors++; netdev->stats.tx_errors++;
#ifdef IU_BUG_KICK_TIMEOUT #ifdef IU_BUG_KICK_TIMEOUT
/* Can't be a bad idea to reset the speed ;-) - Jean II */ /* Can't be a bad idea to reset the speed ;-) - Jean II */
@ -826,7 +825,7 @@ static void irda_usb_receive(struct urb *urb)
if (urb->status != 0) { if (urb->status != 0) {
switch (urb->status) { switch (urb->status) {
case -EILSEQ: case -EILSEQ:
self->stats.rx_crc_errors++; self->netdev->stats.rx_crc_errors++;
/* Also precursor to a hot-unplug on UHCI. */ /* Also precursor to a hot-unplug on UHCI. */
/* Fallthrough... */ /* Fallthrough... */
case -ECONNRESET: case -ECONNRESET:
@ -839,7 +838,7 @@ static void irda_usb_receive(struct urb *urb)
case -ETIME: case -ETIME:
/* Usually precursor to a hot-unplug on OHCI. */ /* Usually precursor to a hot-unplug on OHCI. */
default: default:
self->stats.rx_errors++; self->netdev->stats.rx_errors++;
IRDA_DEBUG(0, "%s(), RX status %d, transfer_flags 0x%04X \n", __func__, urb->status, urb->transfer_flags); IRDA_DEBUG(0, "%s(), RX status %d, transfer_flags 0x%04X \n", __func__, urb->status, urb->transfer_flags);
break; break;
} }
@ -890,7 +889,7 @@ static void irda_usb_receive(struct urb *urb)
IRDA_SKB_MAX_MTU); IRDA_SKB_MAX_MTU);
if (!newskb) { if (!newskb) {
self->stats.rx_dropped++; self->netdev->stats.rx_dropped++;
/* We could deliver the current skb, but this would stall /* We could deliver the current skb, but this would stall
* the Rx path. Better drop the packet... Jean II */ * the Rx path. Better drop the packet... Jean II */
goto done; goto done;
@ -927,8 +926,8 @@ static void irda_usb_receive(struct urb *urb)
netif_rx(dataskb); netif_rx(dataskb);
/* Keep stats up to date */ /* Keep stats up to date */
self->stats.rx_bytes += len; self->netdev->stats.rx_bytes += len;
self->stats.rx_packets++; self->netdev->stats.rx_packets++;
done: done:
/* Note : at this point, the URB we've just received (urb) /* Note : at this point, the URB we've just received (urb)
@ -1342,14 +1341,6 @@ static int irda_usb_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
} }
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
/*
* Get device stats (for /proc/net/dev and ifconfig)
*/
static struct net_device_stats *irda_usb_net_get_stats(struct net_device *dev)
{
struct irda_usb_cb *self = netdev_priv(dev);
return &self->stats;
}
/********************* IRDA CONFIG SUBROUTINES *********************/ /********************* IRDA CONFIG SUBROUTINES *********************/
/* /*
@ -1428,7 +1419,6 @@ static inline int irda_usb_open(struct irda_usb_cb *self)
netdev->watchdog_timeo = 250*HZ/1000; /* 250 ms > USB timeout */ netdev->watchdog_timeo = 250*HZ/1000; /* 250 ms > USB timeout */
netdev->open = irda_usb_net_open; netdev->open = irda_usb_net_open;
netdev->stop = irda_usb_net_close; netdev->stop = irda_usb_net_close;
netdev->get_stats = irda_usb_net_get_stats;
netdev->do_ioctl = irda_usb_net_ioctl; netdev->do_ioctl = irda_usb_net_ioctl;
return register_netdev(netdev); return register_netdev(netdev);

View file

@ -152,7 +152,6 @@ struct irda_usb_cb {
struct urb *speed_urb; /* URB used to send speed commands */ struct urb *speed_urb; /* URB used to send speed commands */
struct net_device *netdev; /* Yes! we are some kind of netdev. */ struct net_device *netdev; /* Yes! we are some kind of netdev. */
struct net_device_stats stats;
struct irlap_cb *irlap; /* The link layer we are binded to */ struct irlap_cb *irlap; /* The link layer we are binded to */
struct qos_info qos; struct qos_info qos;
char *speed_buff; /* Buffer for speed changes */ char *speed_buff; /* Buffer for speed changes */

View file

@ -105,7 +105,7 @@ struct kingsun_cb {
struct usb_device *usbdev; /* init: probe_irda */ struct usb_device *usbdev; /* init: probe_irda */
struct net_device *netdev; /* network layer */ struct net_device *netdev; /* network layer */
struct irlap_cb *irlap; /* The link layer we are binded to */ struct irlap_cb *irlap; /* The link layer we are binded to */
struct net_device_stats stats; /* network statistics */
struct qos_info qos; struct qos_info qos;
__u8 *in_buf; /* receive buffer */ __u8 *in_buf; /* receive buffer */
@ -186,12 +186,12 @@ static int kingsun_hard_xmit(struct sk_buff *skb, struct net_device *netdev)
case -EPIPE: case -EPIPE:
break; break;
default: default:
kingsun->stats.tx_errors++; netdev->stats.tx_errors++;
netif_start_queue(netdev); netif_start_queue(netdev);
} }
} else { } else {
kingsun->stats.tx_packets++; netdev->stats.tx_packets++;
kingsun->stats.tx_bytes += skb->len; netdev->stats.tx_bytes += skb->len;
} }
dev_kfree_skb(skb); dev_kfree_skb(skb);
@ -232,7 +232,7 @@ static void kingsun_rcv_irq(struct urb *urb)
if (bytes[0] >= 1 && bytes[0] < kingsun->max_rx) { if (bytes[0] >= 1 && bytes[0] < kingsun->max_rx) {
for (i = 1; i <= bytes[0]; i++) { for (i = 1; i <= bytes[0]; i++) {
async_unwrap_char(kingsun->netdev, async_unwrap_char(kingsun->netdev,
&kingsun->stats, &kingsun->netdev->stats,
&kingsun->rx_buff, bytes[i]); &kingsun->rx_buff, bytes[i]);
} }
do_gettimeofday(&kingsun->rx_time); do_gettimeofday(&kingsun->rx_time);
@ -418,15 +418,6 @@ static int kingsun_net_ioctl(struct net_device *netdev, struct ifreq *rq,
return ret; return ret;
} }
/*
* Get device stats (for /proc/net/dev and ifconfig)
*/
static struct net_device_stats *
kingsun_net_get_stats(struct net_device *netdev)
{
struct kingsun_cb *kingsun = netdev_priv(netdev);
return &kingsun->stats;
}
/* /*
* This routine is called by the USB subsystem for each new device * This routine is called by the USB subsystem for each new device
@ -532,7 +523,6 @@ static int kingsun_probe(struct usb_interface *intf,
net->hard_start_xmit = kingsun_hard_xmit; net->hard_start_xmit = kingsun_hard_xmit;
net->open = kingsun_net_open; net->open = kingsun_net_open;
net->stop = kingsun_net_close; net->stop = kingsun_net_close;
net->get_stats = kingsun_net_get_stats;
net->do_ioctl = kingsun_net_ioctl; net->do_ioctl = kingsun_net_ioctl;
ret = register_netdev(net); ret = register_netdev(net);

View file

@ -174,7 +174,7 @@ struct ks959_cb {
struct usb_device *usbdev; /* init: probe_irda */ struct usb_device *usbdev; /* init: probe_irda */
struct net_device *netdev; /* network layer */ struct net_device *netdev; /* network layer */
struct irlap_cb *irlap; /* The link layer we are binded to */ struct irlap_cb *irlap; /* The link layer we are binded to */
struct net_device_stats stats; /* network statistics */
struct qos_info qos; struct qos_info qos;
struct usb_ctrlrequest *tx_setuprequest; struct usb_ctrlrequest *tx_setuprequest;
@ -366,7 +366,7 @@ static void ks959_send_irq(struct urb *urb)
case -EPIPE: case -EPIPE:
break; break;
default: default:
kingsun->stats.tx_errors++; netdev->stats.tx_errors++;
netif_start_queue(netdev); netif_start_queue(netdev);
} }
} }
@ -416,12 +416,12 @@ static int ks959_hard_xmit(struct sk_buff *skb, struct net_device *netdev)
case -EPIPE: case -EPIPE:
break; break;
default: default:
kingsun->stats.tx_errors++; netdev->stats.tx_errors++;
netif_start_queue(netdev); netif_start_queue(netdev);
} }
} else { } else {
kingsun->stats.tx_packets++; netdev->stats.tx_packets++;
kingsun->stats.tx_bytes += skb->len; netdev->stats.tx_bytes += skb->len;
} }
@ -469,7 +469,7 @@ static void ks959_rcv_irq(struct urb *urb)
*/ */
if (kingsun->rx_variable_xormask != 0) { if (kingsun->rx_variable_xormask != 0) {
async_unwrap_char(kingsun->netdev, async_unwrap_char(kingsun->netdev,
&kingsun->stats, &kingsun->netdev->stats,
&kingsun->rx_unwrap_buff, &kingsun->rx_unwrap_buff,
bytes[i]); bytes[i]);
} }
@ -668,15 +668,6 @@ static int ks959_net_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd)
return ret; return ret;
} }
/*
* Get device stats (for /proc/net/dev and ifconfig)
*/
static struct net_device_stats *ks959_net_get_stats(struct net_device *netdev)
{
struct ks959_cb *kingsun = netdev_priv(netdev);
return &kingsun->stats;
}
/* /*
* This routine is called by the USB subsystem for each new device * This routine is called by the USB subsystem for each new device
* in the system. We need to check if the device is ours, and in * in the system. We need to check if the device is ours, and in
@ -792,7 +783,6 @@ static int ks959_probe(struct usb_interface *intf,
net->hard_start_xmit = ks959_hard_xmit; net->hard_start_xmit = ks959_hard_xmit;
net->open = ks959_net_open; net->open = ks959_net_open;
net->stop = ks959_net_close; net->stop = ks959_net_close;
net->get_stats = ks959_net_get_stats;
net->do_ioctl = ks959_net_ioctl; net->do_ioctl = ks959_net_ioctl;
ret = register_netdev(net); ret = register_netdev(net);

View file

@ -140,7 +140,7 @@ struct ksdazzle_cb {
struct usb_device *usbdev; /* init: probe_irda */ struct usb_device *usbdev; /* init: probe_irda */
struct net_device *netdev; /* network layer */ struct net_device *netdev; /* network layer */
struct irlap_cb *irlap; /* The link layer we are binded to */ struct irlap_cb *irlap; /* The link layer we are binded to */
struct net_device_stats stats; /* network statistics */
struct qos_info qos; struct qos_info qos;
struct urb *tx_urb; struct urb *tx_urb;
@ -278,7 +278,7 @@ static void ksdazzle_send_irq(struct urb *urb)
case -EPIPE: case -EPIPE:
break; break;
default: default:
kingsun->stats.tx_errors++; netdev->stats.tx_errors++;
netif_start_queue(netdev); netif_start_queue(netdev);
} }
} }
@ -329,12 +329,12 @@ static int ksdazzle_hard_xmit(struct sk_buff *skb, struct net_device *netdev)
case -EPIPE: case -EPIPE:
break; break;
default: default:
kingsun->stats.tx_errors++; netdev->stats.tx_errors++;
netif_start_queue(netdev); netif_start_queue(netdev);
} }
} else { } else {
kingsun->stats.tx_packets++; netdev->stats.tx_packets++;
kingsun->stats.tx_bytes += skb->len; netdev->stats.tx_bytes += skb->len;
} }
@ -348,9 +348,10 @@ static int ksdazzle_hard_xmit(struct sk_buff *skb, struct net_device *netdev)
static void ksdazzle_rcv_irq(struct urb *urb) static void ksdazzle_rcv_irq(struct urb *urb)
{ {
struct ksdazzle_cb *kingsun = urb->context; struct ksdazzle_cb *kingsun = urb->context;
struct net_device *netdev = kingsun->netdev;
/* in process of stopping, just drop data */ /* in process of stopping, just drop data */
if (!netif_running(kingsun->netdev)) { if (!netif_running(netdev)) {
kingsun->receiving = 0; kingsun->receiving = 0;
return; return;
} }
@ -368,7 +369,7 @@ static void ksdazzle_rcv_irq(struct urb *urb)
unsigned int i; unsigned int i;
for (i = 0; i < urb->actual_length; i++) { for (i = 0; i < urb->actual_length; i++) {
async_unwrap_char(kingsun->netdev, &kingsun->stats, async_unwrap_char(netdev, &netdev->stats,
&kingsun->rx_unwrap_buff, bytes[i]); &kingsun->rx_unwrap_buff, bytes[i]);
} }
kingsun->receiving = kingsun->receiving =
@ -561,16 +562,6 @@ static int ksdazzle_net_ioctl(struct net_device *netdev, struct ifreq *rq,
return ret; return ret;
} }
/*
* Get device stats (for /proc/net/dev and ifconfig)
*/
static struct net_device_stats *ksdazzle_net_get_stats(struct net_device
*netdev)
{
struct ksdazzle_cb *kingsun = netdev_priv(netdev);
return &kingsun->stats;
}
/* /*
* This routine is called by the USB subsystem for each new device * This routine is called by the USB subsystem for each new device
* in the system. We need to check if the device is ours, and in * in the system. We need to check if the device is ours, and in
@ -696,7 +687,6 @@ static int ksdazzle_probe(struct usb_interface *intf,
net->hard_start_xmit = ksdazzle_hard_xmit; net->hard_start_xmit = ksdazzle_hard_xmit;
net->open = ksdazzle_net_open; net->open = ksdazzle_net_open;
net->stop = ksdazzle_net_close; net->stop = ksdazzle_net_close;
net->get_stats = ksdazzle_net_get_stats;
net->do_ioctl = ksdazzle_net_ioctl; net->do_ioctl = ksdazzle_net_ioctl;
ret = register_netdev(net); ret = register_netdev(net);

View file

@ -403,8 +403,8 @@ static void mcs_unwrap_mir(struct mcs_cb *mcs, __u8 *buf, int len)
if(unlikely(new_len <= 0)) { if(unlikely(new_len <= 0)) {
IRDA_ERROR("%s short frame length %d\n", IRDA_ERROR("%s short frame length %d\n",
mcs->netdev->name, new_len); mcs->netdev->name, new_len);
++mcs->stats.rx_errors; ++mcs->netdev->stats.rx_errors;
++mcs->stats.rx_length_errors; ++mcs->netdev->stats.rx_length_errors;
return; return;
} }
fcs = 0; fcs = 0;
@ -413,14 +413,14 @@ static void mcs_unwrap_mir(struct mcs_cb *mcs, __u8 *buf, int len)
if(fcs != GOOD_FCS) { if(fcs != GOOD_FCS) {
IRDA_ERROR("crc error calc 0x%x len %d\n", IRDA_ERROR("crc error calc 0x%x len %d\n",
fcs, new_len); fcs, new_len);
mcs->stats.rx_errors++; mcs->netdev->stats.rx_errors++;
mcs->stats.rx_crc_errors++; mcs->netdev->stats.rx_crc_errors++;
return; return;
} }
skb = dev_alloc_skb(new_len + 1); skb = dev_alloc_skb(new_len + 1);
if(unlikely(!skb)) { if(unlikely(!skb)) {
++mcs->stats.rx_dropped; ++mcs->netdev->stats.rx_dropped;
return; return;
} }
@ -433,8 +433,8 @@ static void mcs_unwrap_mir(struct mcs_cb *mcs, __u8 *buf, int len)
netif_rx(skb); netif_rx(skb);
mcs->stats.rx_packets++; mcs->netdev->stats.rx_packets++;
mcs->stats.rx_bytes += new_len; mcs->netdev->stats.rx_bytes += new_len;
return; return;
} }
@ -458,22 +458,22 @@ static void mcs_unwrap_fir(struct mcs_cb *mcs, __u8 *buf, int len)
if(unlikely(new_len <= 0)) { if(unlikely(new_len <= 0)) {
IRDA_ERROR("%s short frame length %d\n", IRDA_ERROR("%s short frame length %d\n",
mcs->netdev->name, new_len); mcs->netdev->name, new_len);
++mcs->stats.rx_errors; ++mcs->netdev->stats.rx_errors;
++mcs->stats.rx_length_errors; ++mcs->netdev->stats.rx_length_errors;
return; return;
} }
fcs = ~(crc32_le(~0, buf, new_len)); fcs = ~(crc32_le(~0, buf, new_len));
if(fcs != get_unaligned_le32(buf + new_len)) { if(fcs != get_unaligned_le32(buf + new_len)) {
IRDA_ERROR("crc error calc 0x%x len %d\n", fcs, new_len); IRDA_ERROR("crc error calc 0x%x len %d\n", fcs, new_len);
mcs->stats.rx_errors++; mcs->netdev->stats.rx_errors++;
mcs->stats.rx_crc_errors++; mcs->netdev->stats.rx_crc_errors++;
return; return;
} }
skb = dev_alloc_skb(new_len + 1); skb = dev_alloc_skb(new_len + 1);
if(unlikely(!skb)) { if(unlikely(!skb)) {
++mcs->stats.rx_dropped; ++mcs->netdev->stats.rx_dropped;
return; return;
} }
@ -486,8 +486,8 @@ static void mcs_unwrap_fir(struct mcs_cb *mcs, __u8 *buf, int len)
netif_rx(skb); netif_rx(skb);
mcs->stats.rx_packets++; mcs->netdev->stats.rx_packets++;
mcs->stats.rx_bytes += new_len; mcs->netdev->stats.rx_bytes += new_len;
return; return;
} }
@ -756,14 +756,6 @@ static int mcs_net_open(struct net_device *netdev)
return ret; return ret;
} }
/* Get device stats for /proc/net/dev and ifconfig */
static struct net_device_stats *mcs_net_get_stats(struct net_device *netdev)
{
struct mcs_cb *mcs = netdev_priv(netdev);
return &mcs->stats;
}
/* Receive callback function. */ /* Receive callback function. */
static void mcs_receive_irq(struct urb *urb) static void mcs_receive_irq(struct urb *urb)
{ {
@ -786,14 +778,14 @@ static void mcs_receive_irq(struct urb *urb)
*/ */
/* SIR speed */ /* SIR speed */
if(mcs->speed < 576000) { if(mcs->speed < 576000) {
async_unwrap_char(mcs->netdev, &mcs->stats, async_unwrap_char(mcs->netdev, &mcs->netdev->stats,
&mcs->rx_buff, 0xc0); &mcs->rx_buff, 0xc0);
for (i = 0; i < urb->actual_length; i++) for (i = 0; i < urb->actual_length; i++)
async_unwrap_char(mcs->netdev, &mcs->stats, async_unwrap_char(mcs->netdev, &mcs->netdev->stats,
&mcs->rx_buff, bytes[i]); &mcs->rx_buff, bytes[i]);
async_unwrap_char(mcs->netdev, &mcs->stats, async_unwrap_char(mcs->netdev, &mcs->netdev->stats,
&mcs->rx_buff, 0xc1); &mcs->rx_buff, 0xc1);
} }
/* MIR speed */ /* MIR speed */
@ -868,12 +860,12 @@ static int mcs_hard_xmit(struct sk_buff *skb, struct net_device *ndev)
case -EPIPE: case -EPIPE:
break; break;
default: default:
mcs->stats.tx_errors++; mcs->netdev->stats.tx_errors++;
netif_start_queue(ndev); netif_start_queue(ndev);
} }
} else { } else {
mcs->stats.tx_packets++; mcs->netdev->stats.tx_packets++;
mcs->stats.tx_bytes += skb->len; mcs->netdev->stats.tx_bytes += skb->len;
} }
dev_kfree_skb(skb); dev_kfree_skb(skb);
@ -931,7 +923,6 @@ static int mcs_probe(struct usb_interface *intf,
ndev->hard_start_xmit = mcs_hard_xmit; ndev->hard_start_xmit = mcs_hard_xmit;
ndev->open = mcs_net_open; ndev->open = mcs_net_open;
ndev->stop = mcs_net_close; ndev->stop = mcs_net_close;
ndev->get_stats = mcs_net_get_stats;
ndev->do_ioctl = mcs_net_ioctl; ndev->do_ioctl = mcs_net_ioctl;
if (!intf->cur_altsetting) if (!intf->cur_altsetting)

View file

@ -104,7 +104,6 @@ struct mcs_cb {
struct usb_device *usbdev; /* init: probe_irda */ struct usb_device *usbdev; /* init: probe_irda */
struct net_device *netdev; /* network layer */ struct net_device *netdev; /* network layer */
struct irlap_cb *irlap; /* The link layer we are binded to */ struct irlap_cb *irlap; /* The link layer we are binded to */
struct net_device_stats stats; /* network statistics */
struct qos_info qos; struct qos_info qos;
unsigned int speed; /* Current speed */ unsigned int speed; /* Current speed */
unsigned int new_speed; /* new speed */ unsigned int new_speed; /* new speed */
@ -154,7 +153,6 @@ static int mcs_speed_change(struct mcs_cb *mcs);
static int mcs_net_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd); static int mcs_net_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd);
static int mcs_net_close(struct net_device *netdev); static int mcs_net_close(struct net_device *netdev);
static int mcs_net_open(struct net_device *netdev); static int mcs_net_open(struct net_device *netdev);
static struct net_device_stats *mcs_net_get_stats(struct net_device *netdev);
static void mcs_receive_irq(struct urb *urb); static void mcs_receive_irq(struct urb *urb);
static void mcs_send_irq(struct urb *urb); static void mcs_send_irq(struct urb *urb);

View file

@ -185,7 +185,6 @@ static void nsc_ircc_init_dongle_interface (int iobase, int dongle_id);
static int nsc_ircc_net_open(struct net_device *dev); static int nsc_ircc_net_open(struct net_device *dev);
static int nsc_ircc_net_close(struct net_device *dev); static int nsc_ircc_net_close(struct net_device *dev);
static int nsc_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); static int nsc_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
static struct net_device_stats *nsc_ircc_net_get_stats(struct net_device *dev);
/* Globals */ /* Globals */
static int pnp_registered; static int pnp_registered;
@ -446,7 +445,6 @@ static int __init nsc_ircc_open(chipio_t *info)
dev->open = nsc_ircc_net_open; dev->open = nsc_ircc_net_open;
dev->stop = nsc_ircc_net_close; dev->stop = nsc_ircc_net_close;
dev->do_ioctl = nsc_ircc_net_ioctl; dev->do_ioctl = nsc_ircc_net_ioctl;
dev->get_stats = nsc_ircc_net_get_stats;
err = register_netdev(dev); err = register_netdev(dev);
if (err) { if (err) {
@ -1401,7 +1399,7 @@ static int nsc_ircc_hard_xmit_sir(struct sk_buff *skb, struct net_device *dev)
self->tx_buff.len = async_wrap_skb(skb, self->tx_buff.data, self->tx_buff.len = async_wrap_skb(skb, self->tx_buff.data,
self->tx_buff.truesize); self->tx_buff.truesize);
self->stats.tx_bytes += self->tx_buff.len; dev->stats.tx_bytes += self->tx_buff.len;
/* Add interrupt on tx low level (will fire immediately) */ /* Add interrupt on tx low level (will fire immediately) */
switch_bank(iobase, BANK0); switch_bank(iobase, BANK0);
@ -1473,7 +1471,7 @@ static int nsc_ircc_hard_xmit_fir(struct sk_buff *skb, struct net_device *dev)
self->tx_fifo.queue[self->tx_fifo.free].len = skb->len; self->tx_fifo.queue[self->tx_fifo.free].len = skb->len;
self->tx_fifo.tail += skb->len; self->tx_fifo.tail += skb->len;
self->stats.tx_bytes += skb->len; dev->stats.tx_bytes += skb->len;
skb_copy_from_linear_data(skb, self->tx_fifo.queue[self->tx_fifo.free].start, skb_copy_from_linear_data(skb, self->tx_fifo.queue[self->tx_fifo.free].start,
skb->len); skb->len);
@ -1652,13 +1650,13 @@ static int nsc_ircc_dma_xmit_complete(struct nsc_ircc_cb *self)
/* Check for underrrun! */ /* Check for underrrun! */
if (inb(iobase+ASCR) & ASCR_TXUR) { if (inb(iobase+ASCR) & ASCR_TXUR) {
self->stats.tx_errors++; self->netdev->stats.tx_errors++;
self->stats.tx_fifo_errors++; self->netdev->stats.tx_fifo_errors++;
/* Clear bit, by writing 1 into it */ /* Clear bit, by writing 1 into it */
outb(ASCR_TXUR, iobase+ASCR); outb(ASCR_TXUR, iobase+ASCR);
} else { } else {
self->stats.tx_packets++; self->netdev->stats.tx_packets++;
} }
/* Finished with this frame, so prepare for next */ /* Finished with this frame, so prepare for next */
@ -1793,28 +1791,28 @@ static int nsc_ircc_dma_receive_complete(struct nsc_ircc_cb *self, int iobase)
if (status & FRM_ST_ERR_MSK) { if (status & FRM_ST_ERR_MSK) {
if (status & FRM_ST_LOST_FR) { if (status & FRM_ST_LOST_FR) {
/* Add number of lost frames to stats */ /* Add number of lost frames to stats */
self->stats.rx_errors += len; self->netdev->stats.rx_errors += len;
} else { } else {
/* Skip frame */ /* Skip frame */
self->stats.rx_errors++; self->netdev->stats.rx_errors++;
self->rx_buff.data += len; self->rx_buff.data += len;
if (status & FRM_ST_MAX_LEN) if (status & FRM_ST_MAX_LEN)
self->stats.rx_length_errors++; self->netdev->stats.rx_length_errors++;
if (status & FRM_ST_PHY_ERR) if (status & FRM_ST_PHY_ERR)
self->stats.rx_frame_errors++; self->netdev->stats.rx_frame_errors++;
if (status & FRM_ST_BAD_CRC) if (status & FRM_ST_BAD_CRC)
self->stats.rx_crc_errors++; self->netdev->stats.rx_crc_errors++;
} }
/* The errors below can be reported in both cases */ /* The errors below can be reported in both cases */
if (status & FRM_ST_OVR1) if (status & FRM_ST_OVR1)
self->stats.rx_fifo_errors++; self->netdev->stats.rx_fifo_errors++;
if (status & FRM_ST_OVR2) if (status & FRM_ST_OVR2)
self->stats.rx_fifo_errors++; self->netdev->stats.rx_fifo_errors++;
} else { } else {
/* /*
* First we must make sure that the frame we * First we must make sure that the frame we
@ -1863,7 +1861,7 @@ static int nsc_ircc_dma_receive_complete(struct nsc_ircc_cb *self, int iobase)
IRDA_WARNING("%s(), memory squeeze, " IRDA_WARNING("%s(), memory squeeze, "
"dropping frame.\n", "dropping frame.\n",
__func__); __func__);
self->stats.rx_dropped++; self->netdev->stats.rx_dropped++;
/* Restore bank register */ /* Restore bank register */
outb(bank, iobase+BSR); outb(bank, iobase+BSR);
@ -1889,8 +1887,8 @@ static int nsc_ircc_dma_receive_complete(struct nsc_ircc_cb *self, int iobase)
/* Move to next frame */ /* Move to next frame */
self->rx_buff.data += len; self->rx_buff.data += len;
self->stats.rx_bytes += len; self->netdev->stats.rx_bytes += len;
self->stats.rx_packets++; self->netdev->stats.rx_packets++;
skb->dev = self->netdev; skb->dev = self->netdev;
skb_reset_mac_header(skb); skb_reset_mac_header(skb);
@ -1920,8 +1918,8 @@ static void nsc_ircc_pio_receive(struct nsc_ircc_cb *self)
/* Receive all characters in Rx FIFO */ /* Receive all characters in Rx FIFO */
do { do {
byte = inb(iobase+RXD); byte = inb(iobase+RXD);
async_unwrap_char(self->netdev, &self->stats, &self->rx_buff, async_unwrap_char(self->netdev, &self->netdev->stats,
byte); &self->rx_buff, byte);
} while (inb(iobase+LSR) & LSR_RXDA); /* Data available */ } while (inb(iobase+LSR) & LSR_RXDA); /* Data available */
} }
@ -1952,7 +1950,7 @@ static void nsc_ircc_sir_interrupt(struct nsc_ircc_cb *self, int eir)
self->ier = IER_TXLDL_IE; self->ier = IER_TXLDL_IE;
else { else {
self->stats.tx_packets++; self->netdev->stats.tx_packets++;
netif_wake_queue(self->netdev); netif_wake_queue(self->netdev);
self->ier = IER_TXEMP_IE; self->ier = IER_TXEMP_IE;
} }
@ -2307,13 +2305,6 @@ static int nsc_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
return ret; return ret;
} }
static struct net_device_stats *nsc_ircc_net_get_stats(struct net_device *dev)
{
struct nsc_ircc_cb *self = netdev_priv(dev);
return &self->stats;
}
static int nsc_ircc_suspend(struct platform_device *dev, pm_message_t state) static int nsc_ircc_suspend(struct platform_device *dev, pm_message_t state)
{ {
struct nsc_ircc_cb *self = platform_get_drvdata(dev); struct nsc_ircc_cb *self = platform_get_drvdata(dev);

View file

@ -251,7 +251,6 @@ struct nsc_ircc_cb {
struct tx_fifo tx_fifo; /* Info about frames to be transmitted */ struct tx_fifo tx_fifo; /* Info about frames to be transmitted */
struct net_device *netdev; /* Yes! we are some kind of netdevice */ struct net_device *netdev; /* Yes! we are some kind of netdevice */
struct net_device_stats stats;
struct irlap_cb *irlap; /* The link layer we are binded to */ struct irlap_cb *irlap; /* The link layer we are binded to */
struct qos_info qos; /* QoS capabilities for this device */ struct qos_info qos; /* QoS capabilities for this device */

View file

@ -108,7 +108,6 @@ struct pxa_irda {
int txdma; int txdma;
int rxdma; int rxdma;
struct net_device_stats stats;
struct irlap_cb *irlap; struct irlap_cb *irlap;
struct qos_info qos; struct qos_info qos;
@ -258,14 +257,15 @@ static irqreturn_t pxa_irda_sir_irq(int irq, void *dev_id)
data = STRBR; data = STRBR;
if (lsr & (LSR_OE | LSR_PE | LSR_FE | LSR_BI)) { if (lsr & (LSR_OE | LSR_PE | LSR_FE | LSR_BI)) {
printk(KERN_DEBUG "pxa_ir: sir receiving error\n"); printk(KERN_DEBUG "pxa_ir: sir receiving error\n");
si->stats.rx_errors++; dev->stats.rx_errors++;
if (lsr & LSR_FE) if (lsr & LSR_FE)
si->stats.rx_frame_errors++; dev->stats.rx_frame_errors++;
if (lsr & LSR_OE) if (lsr & LSR_OE)
si->stats.rx_fifo_errors++; dev->stats.rx_fifo_errors++;
} else { } else {
si->stats.rx_bytes++; dev->stats.rx_bytes++;
async_unwrap_char(dev, &si->stats, &si->rx_buff, data); async_unwrap_char(dev, &dev->stats,
&si->rx_buff, data);
} }
lsr = STLSR; lsr = STLSR;
} }
@ -277,8 +277,8 @@ static irqreturn_t pxa_irda_sir_irq(int irq, void *dev_id)
case 0x0C: /* Character Timeout Indication */ case 0x0C: /* Character Timeout Indication */
do { do {
si->stats.rx_bytes++; dev->stats.rx_bytes++;
async_unwrap_char(dev, &si->stats, &si->rx_buff, STRBR); async_unwrap_char(dev, &dev->stats, &si->rx_buff, STRBR);
} while (STLSR & LSR_DR); } while (STLSR & LSR_DR);
si->last_oscr = OSCR; si->last_oscr = OSCR;
break; break;
@ -290,9 +290,8 @@ static irqreturn_t pxa_irda_sir_irq(int irq, void *dev_id)
} }
if (si->tx_buff.len == 0) { if (si->tx_buff.len == 0) {
si->stats.tx_packets++; dev->stats.tx_packets++;
si->stats.tx_bytes += si->tx_buff.data - dev->stats.tx_bytes += si->tx_buff.data - si->tx_buff.head;
si->tx_buff.head;
/* We need to ensure that the transmitter has finished. */ /* We need to ensure that the transmitter has finished. */
while ((STLSR & LSR_TEMT) == 0) while ((STLSR & LSR_TEMT) == 0)
@ -343,10 +342,10 @@ static void pxa_irda_fir_dma_tx_irq(int channel, void *data)
DCSR(channel) = dcsr & ~DCSR_RUN; DCSR(channel) = dcsr & ~DCSR_RUN;
if (dcsr & DCSR_ENDINTR) { if (dcsr & DCSR_ENDINTR) {
si->stats.tx_packets++; dev->stats.tx_packets++;
si->stats.tx_bytes += si->dma_tx_buff_len; dev->stats.tx_bytes += si->dma_tx_buff_len;
} else { } else {
si->stats.tx_errors++; dev->stats.tx_errors++;
} }
while (ICSR1 & ICSR1_TBY) while (ICSR1 & ICSR1_TBY)
@ -392,14 +391,14 @@ static void pxa_irda_fir_irq_eif(struct pxa_irda *si, struct net_device *dev, in
data = ICDR; data = ICDR;
if (stat & (ICSR1_CRE | ICSR1_ROR)) { if (stat & (ICSR1_CRE | ICSR1_ROR)) {
si->stats.rx_errors++; dev->stats.rx_errors++;
if (stat & ICSR1_CRE) { if (stat & ICSR1_CRE) {
printk(KERN_DEBUG "pxa_ir: fir receive CRC error\n"); printk(KERN_DEBUG "pxa_ir: fir receive CRC error\n");
si->stats.rx_crc_errors++; dev->stats.rx_crc_errors++;
} }
if (stat & ICSR1_ROR) { if (stat & ICSR1_ROR) {
printk(KERN_DEBUG "pxa_ir: fir receive overrun\n"); printk(KERN_DEBUG "pxa_ir: fir receive overrun\n");
si->stats.rx_over_errors++; dev->stats.rx_over_errors++;
} }
} else { } else {
si->dma_rx_buff[len++] = data; si->dma_rx_buff[len++] = data;
@ -415,14 +414,14 @@ static void pxa_irda_fir_irq_eif(struct pxa_irda *si, struct net_device *dev, in
if (icsr0 & ICSR0_FRE) { if (icsr0 & ICSR0_FRE) {
printk(KERN_ERR "pxa_ir: dropping erroneous frame\n"); printk(KERN_ERR "pxa_ir: dropping erroneous frame\n");
si->stats.rx_dropped++; dev->stats.rx_dropped++;
return; return;
} }
skb = alloc_skb(len+1,GFP_ATOMIC); skb = alloc_skb(len+1,GFP_ATOMIC);
if (!skb) { if (!skb) {
printk(KERN_ERR "pxa_ir: fir out of memory for receive skb\n"); printk(KERN_ERR "pxa_ir: fir out of memory for receive skb\n");
si->stats.rx_dropped++; dev->stats.rx_dropped++;
return; return;
} }
@ -437,8 +436,8 @@ static void pxa_irda_fir_irq_eif(struct pxa_irda *si, struct net_device *dev, in
skb->protocol = htons(ETH_P_IRDA); skb->protocol = htons(ETH_P_IRDA);
netif_rx(skb); netif_rx(skb);
si->stats.rx_packets++; dev->stats.rx_packets++;
si->stats.rx_bytes += len; dev->stats.rx_bytes += len;
} }
} }
@ -457,10 +456,10 @@ static irqreturn_t pxa_irda_fir_irq(int irq, void *dev_id)
if (icsr0 & (ICSR0_FRE | ICSR0_RAB)) { if (icsr0 & (ICSR0_FRE | ICSR0_RAB)) {
if (icsr0 & ICSR0_FRE) { if (icsr0 & ICSR0_FRE) {
printk(KERN_DEBUG "pxa_ir: fir receive frame error\n"); printk(KERN_DEBUG "pxa_ir: fir receive frame error\n");
si->stats.rx_frame_errors++; dev->stats.rx_frame_errors++;
} else { } else {
printk(KERN_DEBUG "pxa_ir: fir receive abort\n"); printk(KERN_DEBUG "pxa_ir: fir receive abort\n");
si->stats.rx_errors++; dev->stats.rx_errors++;
} }
ICSR0 = icsr0 & (ICSR0_FRE | ICSR0_RAB); ICSR0 = icsr0 & (ICSR0_FRE | ICSR0_RAB);
} }
@ -589,12 +588,6 @@ static int pxa_irda_ioctl(struct net_device *dev, struct ifreq *ifreq, int cmd)
return ret; return ret;
} }
static struct net_device_stats *pxa_irda_stats(struct net_device *dev)
{
struct pxa_irda *si = netdev_priv(dev);
return &si->stats;
}
static void pxa_irda_startup(struct pxa_irda *si) static void pxa_irda_startup(struct pxa_irda *si)
{ {
/* Disable STUART interrupts */ /* Disable STUART interrupts */
@ -857,7 +850,6 @@ static int pxa_irda_probe(struct platform_device *pdev)
dev->open = pxa_irda_start; dev->open = pxa_irda_start;
dev->stop = pxa_irda_stop; dev->stop = pxa_irda_stop;
dev->do_ioctl = pxa_irda_ioctl; dev->do_ioctl = pxa_irda_ioctl;
dev->get_stats = pxa_irda_stats;
irda_init_max_qos_capabilies(&si->qos); irda_init_max_qos_capabilies(&si->qos);

View file

@ -60,7 +60,6 @@ struct sa1100_irda {
dma_regs_t *txdma; dma_regs_t *txdma;
dma_regs_t *rxdma; dma_regs_t *rxdma;
struct net_device_stats stats;
struct device *dev; struct device *dev;
struct irda_platform_data *pdata; struct irda_platform_data *pdata;
struct irlap_cb *irlap; struct irlap_cb *irlap;
@ -375,13 +374,13 @@ static void sa1100_irda_hpsir_irq(struct net_device *dev)
data = Ser2UTDR; data = Ser2UTDR;
if (stat & (UTSR1_FRE | UTSR1_ROR)) { if (stat & (UTSR1_FRE | UTSR1_ROR)) {
si->stats.rx_errors++; dev->stats.rx_errors++;
if (stat & UTSR1_FRE) if (stat & UTSR1_FRE)
si->stats.rx_frame_errors++; dev->stats.rx_frame_errors++;
if (stat & UTSR1_ROR) if (stat & UTSR1_ROR)
si->stats.rx_fifo_errors++; dev->stats.rx_fifo_errors++;
} else } else
async_unwrap_char(dev, &si->stats, &si->rx_buff, data); async_unwrap_char(dev, &dev->stats, &si->rx_buff, data);
status = Ser2UTSR0; status = Ser2UTSR0;
} }
@ -396,9 +395,9 @@ static void sa1100_irda_hpsir_irq(struct net_device *dev)
* There are at least 4 bytes in the FIFO. Read 3 bytes * There are at least 4 bytes in the FIFO. Read 3 bytes
* and leave the rest to the block below. * and leave the rest to the block below.
*/ */
async_unwrap_char(dev, &si->stats, &si->rx_buff, Ser2UTDR); async_unwrap_char(dev, &dev->stats, &si->rx_buff, Ser2UTDR);
async_unwrap_char(dev, &si->stats, &si->rx_buff, Ser2UTDR); async_unwrap_char(dev, &dev->stats, &si->rx_buff, Ser2UTDR);
async_unwrap_char(dev, &si->stats, &si->rx_buff, Ser2UTDR); async_unwrap_char(dev, &dev->stats, &si->rx_buff, Ser2UTDR);
} }
if (status & (UTSR0_RFS | UTSR0_RID)) { if (status & (UTSR0_RFS | UTSR0_RID)) {
@ -406,7 +405,7 @@ static void sa1100_irda_hpsir_irq(struct net_device *dev)
* Fifo contains more than 1 character. * Fifo contains more than 1 character.
*/ */
do { do {
async_unwrap_char(dev, &si->stats, &si->rx_buff, async_unwrap_char(dev, &dev->stats, &si->rx_buff,
Ser2UTDR); Ser2UTDR);
} while (Ser2UTSR1 & UTSR1_RNE); } while (Ser2UTSR1 & UTSR1_RNE);
@ -422,8 +421,8 @@ static void sa1100_irda_hpsir_irq(struct net_device *dev)
} while (Ser2UTSR1 & UTSR1_TNF && si->tx_buff.len); } while (Ser2UTSR1 & UTSR1_TNF && si->tx_buff.len);
if (si->tx_buff.len == 0) { if (si->tx_buff.len == 0) {
si->stats.tx_packets++; dev->stats.tx_packets++;
si->stats.tx_bytes += si->tx_buff.data - dev->stats.tx_bytes += si->tx_buff.data -
si->tx_buff.head; si->tx_buff.head;
/* /*
@ -482,11 +481,11 @@ static void sa1100_irda_fir_error(struct sa1100_irda *si, struct net_device *dev
data = Ser2HSDR; data = Ser2HSDR;
if (stat & (HSSR1_CRE | HSSR1_ROR)) { if (stat & (HSSR1_CRE | HSSR1_ROR)) {
si->stats.rx_errors++; dev->stats.rx_errors++;
if (stat & HSSR1_CRE) if (stat & HSSR1_CRE)
si->stats.rx_crc_errors++; dev->stats.rx_crc_errors++;
if (stat & HSSR1_ROR) if (stat & HSSR1_ROR)
si->stats.rx_frame_errors++; dev->stats.rx_frame_errors++;
} else } else
skb->data[len++] = data; skb->data[len++] = data;
@ -505,8 +504,8 @@ static void sa1100_irda_fir_error(struct sa1100_irda *si, struct net_device *dev
skb->dev = dev; skb->dev = dev;
skb_reset_mac_header(skb); skb_reset_mac_header(skb);
skb->protocol = htons(ETH_P_IRDA); skb->protocol = htons(ETH_P_IRDA);
si->stats.rx_packets++; dev->stats.rx_packets++;
si->stats.rx_bytes += len; dev->stats.rx_bytes += len;
/* /*
* Before we pass the buffer up, allocate a new one. * Before we pass the buffer up, allocate a new one.
@ -545,10 +544,10 @@ static void sa1100_irda_fir_irq(struct net_device *dev)
* from the fifo. * from the fifo.
*/ */
if (Ser2HSSR0 & (HSSR0_FRE | HSSR0_RAB)) { if (Ser2HSSR0 & (HSSR0_FRE | HSSR0_RAB)) {
si->stats.rx_errors++; dev->stats.rx_errors++;
if (Ser2HSSR0 & HSSR0_FRE) if (Ser2HSSR0 & HSSR0_FRE)
si->stats.rx_frame_errors++; dev->stats.rx_frame_errors++;
/* /*
* Clear out the DMA... * Clear out the DMA...
@ -633,8 +632,8 @@ static void sa1100_irda_txdma_irq(void *id)
*/ */
if (skb) { if (skb) {
dma_unmap_single(si->dev, si->txbuf_dma, skb->len, DMA_TO_DEVICE); dma_unmap_single(si->dev, si->txbuf_dma, skb->len, DMA_TO_DEVICE);
si->stats.tx_packets ++; dev->stats.tx_packets ++;
si->stats.tx_bytes += skb->len; dev->stats.tx_bytes += skb->len;
dev_kfree_skb_irq(skb); dev_kfree_skb_irq(skb);
} }
@ -762,12 +761,6 @@ sa1100_irda_ioctl(struct net_device *dev, struct ifreq *ifreq, int cmd)
return ret; return ret;
} }
static struct net_device_stats *sa1100_irda_stats(struct net_device *dev)
{
struct sa1100_irda *si = netdev_priv(dev);
return &si->stats;
}
static int sa1100_irda_start(struct net_device *dev) static int sa1100_irda_start(struct net_device *dev)
{ {
struct sa1100_irda *si = netdev_priv(dev); struct sa1100_irda *si = netdev_priv(dev);
@ -924,7 +917,6 @@ static int sa1100_irda_probe(struct platform_device *pdev)
dev->open = sa1100_irda_start; dev->open = sa1100_irda_start;
dev->stop = sa1100_irda_stop; dev->stop = sa1100_irda_stop;
dev->do_ioctl = sa1100_irda_ioctl; dev->do_ioctl = sa1100_irda_ioctl;
dev->get_stats = sa1100_irda_stats;
dev->irq = IRQ_Ser2ICP; dev->irq = IRQ_Ser2ICP;
irda_init_max_qos_capabilies(&si->qos); irda_init_max_qos_capabilies(&si->qos);

View file

@ -160,7 +160,6 @@ static inline int sirdev_schedule_mode(struct sir_dev *dev, int mode)
struct sir_dev { struct sir_dev {
struct net_device *netdev; struct net_device *netdev;
struct net_device_stats stats;
struct irlap_cb *irlap; struct irlap_cb *irlap;

View file

@ -455,8 +455,8 @@ void sirdev_write_complete(struct sir_dev *dev)
if ((skb=dev->tx_skb) != NULL) { if ((skb=dev->tx_skb) != NULL) {
dev->tx_skb = NULL; dev->tx_skb = NULL;
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
dev->stats.tx_errors++; dev->netdev->stats.tx_errors++;
dev->stats.tx_dropped++; dev->netdev->stats.tx_dropped++;
} }
dev->tx_buff.len = 0; dev->tx_buff.len = 0;
} }
@ -493,8 +493,8 @@ void sirdev_write_complete(struct sir_dev *dev)
if ((skb=dev->tx_skb) != NULL) { if ((skb=dev->tx_skb) != NULL) {
dev->tx_skb = NULL; dev->tx_skb = NULL;
dev->stats.tx_packets++; dev->netdev->stats.tx_packets++;
dev->stats.tx_bytes += skb->len; dev->netdev->stats.tx_bytes += skb->len;
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
} }
@ -548,7 +548,7 @@ int sirdev_receive(struct sir_dev *dev, const unsigned char *cp, size_t count)
* just update stats and set media busy * just update stats and set media busy
*/ */
irda_device_set_media_busy(dev->netdev, TRUE); irda_device_set_media_busy(dev->netdev, TRUE);
dev->stats.rx_dropped++; dev->netdev->stats.rx_dropped++;
IRDA_DEBUG(0, "%s; rx-drop: %zd\n", __func__, count); IRDA_DEBUG(0, "%s; rx-drop: %zd\n", __func__, count);
return 0; return 0;
} }
@ -557,7 +557,7 @@ int sirdev_receive(struct sir_dev *dev, const unsigned char *cp, size_t count)
if (likely(atomic_read(&dev->enable_rx))) { if (likely(atomic_read(&dev->enable_rx))) {
while (count--) while (count--)
/* Unwrap and destuff one byte */ /* Unwrap and destuff one byte */
async_unwrap_char(dev->netdev, &dev->stats, async_unwrap_char(dev->netdev, &dev->netdev->stats,
&dev->rx_buff, *cp++); &dev->rx_buff, *cp++);
} else { } else {
while (count--) { while (count--) {
@ -582,13 +582,6 @@ EXPORT_SYMBOL(sirdev_receive);
/* callbacks from network layer */ /* callbacks from network layer */
static struct net_device_stats *sirdev_get_stats(struct net_device *ndev)
{
struct sir_dev *dev = netdev_priv(ndev);
return (dev) ? &dev->stats : NULL;
}
static int sirdev_hard_xmit(struct sk_buff *skb, struct net_device *ndev) static int sirdev_hard_xmit(struct sk_buff *skb, struct net_device *ndev)
{ {
struct sir_dev *dev = netdev_priv(ndev); struct sir_dev *dev = netdev_priv(ndev);
@ -654,7 +647,7 @@ static int sirdev_hard_xmit(struct sk_buff *skb, struct net_device *ndev)
*/ */
atomic_set(&dev->enable_rx, 0); atomic_set(&dev->enable_rx, 0);
if (unlikely(sirdev_is_receiving(dev))) if (unlikely(sirdev_is_receiving(dev)))
dev->stats.collisions++; dev->netdev->stats.collisions++;
actual = dev->drv->do_write(dev, dev->tx_buff.data, dev->tx_buff.len); actual = dev->drv->do_write(dev, dev->tx_buff.data, dev->tx_buff.len);
@ -669,8 +662,8 @@ static int sirdev_hard_xmit(struct sk_buff *skb, struct net_device *ndev)
IRDA_ERROR("%s: drv->do_write failed (%d)\n", IRDA_ERROR("%s: drv->do_write failed (%d)\n",
__func__, actual); __func__, actual);
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
dev->stats.tx_errors++; dev->netdev->stats.tx_errors++;
dev->stats.tx_dropped++; dev->netdev->stats.tx_dropped++;
netif_wake_queue(ndev); netif_wake_queue(ndev);
} }
spin_unlock_irqrestore(&dev->tx_lock, flags); spin_unlock_irqrestore(&dev->tx_lock, flags);
@ -918,7 +911,6 @@ struct sir_dev * sirdev_get_instance(const struct sir_driver *drv, const char *n
ndev->hard_start_xmit = sirdev_hard_xmit; ndev->hard_start_xmit = sirdev_hard_xmit;
ndev->open = sirdev_open; ndev->open = sirdev_open;
ndev->stop = sirdev_close; ndev->stop = sirdev_close;
ndev->get_stats = sirdev_get_stats;
ndev->do_ioctl = sirdev_ioctl; ndev->do_ioctl = sirdev_ioctl;
if (register_netdev(ndev)) { if (register_netdev(ndev)) {

View file

@ -150,7 +150,6 @@ struct smsc_chip_address {
/* Private data for each instance */ /* Private data for each instance */
struct smsc_ircc_cb { struct smsc_ircc_cb {
struct net_device *netdev; /* Yes! we are some kind of netdevice */ struct net_device *netdev; /* Yes! we are some kind of netdevice */
struct net_device_stats stats;
struct irlap_cb *irlap; /* The link layer we are binded to */ struct irlap_cb *irlap; /* The link layer we are binded to */
chipio_t io; /* IrDA controller information */ chipio_t io; /* IrDA controller information */
@ -215,7 +214,6 @@ static int smsc_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, int cm
#if SMSC_IRCC2_C_NET_TIMEOUT #if SMSC_IRCC2_C_NET_TIMEOUT
static void smsc_ircc_timeout(struct net_device *dev); static void smsc_ircc_timeout(struct net_device *dev);
#endif #endif
static struct net_device_stats *smsc_ircc_net_get_stats(struct net_device *dev);
static int smsc_ircc_is_receiving(struct smsc_ircc_cb *self); static int smsc_ircc_is_receiving(struct smsc_ircc_cb *self);
static void smsc_ircc_probe_transceiver(struct smsc_ircc_cb *self); static void smsc_ircc_probe_transceiver(struct smsc_ircc_cb *self);
static void smsc_ircc_set_transceiver_for_speed(struct smsc_ircc_cb *self, u32 speed); static void smsc_ircc_set_transceiver_for_speed(struct smsc_ircc_cb *self, u32 speed);
@ -529,7 +527,6 @@ static int __init smsc_ircc_open(unsigned int fir_base, unsigned int sir_base, u
dev->open = smsc_ircc_net_open; dev->open = smsc_ircc_net_open;
dev->stop = smsc_ircc_net_close; dev->stop = smsc_ircc_net_close;
dev->do_ioctl = smsc_ircc_net_ioctl; dev->do_ioctl = smsc_ircc_net_ioctl;
dev->get_stats = smsc_ircc_net_get_stats;
self = netdev_priv(dev); self = netdev_priv(dev);
self->netdev = dev; self->netdev = dev;
@ -834,13 +831,6 @@ static int smsc_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd
return ret; return ret;
} }
static struct net_device_stats *smsc_ircc_net_get_stats(struct net_device *dev)
{
struct smsc_ircc_cb *self = netdev_priv(dev);
return &self->stats;
}
#if SMSC_IRCC2_C_NET_TIMEOUT #if SMSC_IRCC2_C_NET_TIMEOUT
/* /*
* Function smsc_ircc_timeout (struct net_device *dev) * Function smsc_ircc_timeout (struct net_device *dev)
@ -920,7 +910,7 @@ static int smsc_ircc_hard_xmit_sir(struct sk_buff *skb, struct net_device *dev)
self->tx_buff.len = async_wrap_skb(skb, self->tx_buff.data, self->tx_buff.len = async_wrap_skb(skb, self->tx_buff.data,
self->tx_buff.truesize); self->tx_buff.truesize);
self->stats.tx_bytes += self->tx_buff.len; dev->stats.tx_bytes += self->tx_buff.len;
/* Turn on transmit finished interrupt. Will fire immediately! */ /* Turn on transmit finished interrupt. Will fire immediately! */
outb(UART_IER_THRI, self->io.sir_base + UART_IER); outb(UART_IER_THRI, self->io.sir_base + UART_IER);
@ -1320,16 +1310,16 @@ static void smsc_ircc_dma_xmit_complete(struct smsc_ircc_cb *self)
/* Check for underrun! */ /* Check for underrun! */
register_bank(iobase, 0); register_bank(iobase, 0);
if (inb(iobase + IRCC_LSR) & IRCC_LSR_UNDERRUN) { if (inb(iobase + IRCC_LSR) & IRCC_LSR_UNDERRUN) {
self->stats.tx_errors++; self->netdev->stats.tx_errors++;
self->stats.tx_fifo_errors++; self->netdev->stats.tx_fifo_errors++;
/* Reset error condition */ /* Reset error condition */
register_bank(iobase, 0); register_bank(iobase, 0);
outb(IRCC_MASTER_ERROR_RESET, iobase + IRCC_MASTER); outb(IRCC_MASTER_ERROR_RESET, iobase + IRCC_MASTER);
outb(0x00, iobase + IRCC_MASTER); outb(0x00, iobase + IRCC_MASTER);
} else { } else {
self->stats.tx_packets++; self->netdev->stats.tx_packets++;
self->stats.tx_bytes += self->tx_buff.len; self->netdev->stats.tx_bytes += self->tx_buff.len;
} }
/* Check if it's time to change the speed */ /* Check if it's time to change the speed */
@ -1429,15 +1419,15 @@ static void smsc_ircc_dma_receive_complete(struct smsc_ircc_cb *self)
/* Look for errors */ /* Look for errors */
if (lsr & (IRCC_LSR_FRAME_ERROR | IRCC_LSR_CRC_ERROR | IRCC_LSR_SIZE_ERROR)) { if (lsr & (IRCC_LSR_FRAME_ERROR | IRCC_LSR_CRC_ERROR | IRCC_LSR_SIZE_ERROR)) {
self->stats.rx_errors++; self->netdev->stats.rx_errors++;
if (lsr & IRCC_LSR_FRAME_ERROR) if (lsr & IRCC_LSR_FRAME_ERROR)
self->stats.rx_frame_errors++; self->netdev->stats.rx_frame_errors++;
if (lsr & IRCC_LSR_CRC_ERROR) if (lsr & IRCC_LSR_CRC_ERROR)
self->stats.rx_crc_errors++; self->netdev->stats.rx_crc_errors++;
if (lsr & IRCC_LSR_SIZE_ERROR) if (lsr & IRCC_LSR_SIZE_ERROR)
self->stats.rx_length_errors++; self->netdev->stats.rx_length_errors++;
if (lsr & (IRCC_LSR_UNDERRUN | IRCC_LSR_OVERRUN)) if (lsr & (IRCC_LSR_UNDERRUN | IRCC_LSR_OVERRUN))
self->stats.rx_length_errors++; self->netdev->stats.rx_length_errors++;
return; return;
} }
@ -1460,8 +1450,8 @@ static void smsc_ircc_dma_receive_complete(struct smsc_ircc_cb *self)
skb_reserve(skb, 1); skb_reserve(skb, 1);
memcpy(skb_put(skb, len), self->rx_buff.data, len); memcpy(skb_put(skb, len), self->rx_buff.data, len);
self->stats.rx_packets++; self->netdev->stats.rx_packets++;
self->stats.rx_bytes += len; self->netdev->stats.rx_bytes += len;
skb->dev = self->netdev; skb->dev = self->netdev;
skb_reset_mac_header(skb); skb_reset_mac_header(skb);
@ -1489,7 +1479,7 @@ static void smsc_ircc_sir_receive(struct smsc_ircc_cb *self)
* async_unwrap_char will deliver all found frames * async_unwrap_char will deliver all found frames
*/ */
do { do {
async_unwrap_char(self->netdev, &self->stats, &self->rx_buff, async_unwrap_char(self->netdev, &self->netdev->stats, &self->rx_buff,
inb(iobase + UART_RX)); inb(iobase + UART_RX));
/* Make sure we don't stay here to long */ /* Make sure we don't stay here to long */
@ -1992,7 +1982,7 @@ static void smsc_ircc_sir_write_wakeup(struct smsc_ircc_cb *self)
/* Tell network layer that we want more frames */ /* Tell network layer that we want more frames */
netif_wake_queue(self->netdev); netif_wake_queue(self->netdev);
} }
self->stats.tx_packets++; self->netdev->stats.tx_packets++;
if (self->io.speed <= 115200) { if (self->io.speed <= 115200) {
/* /*

View file

@ -164,7 +164,7 @@ struct stir_cb {
struct usb_device *usbdev; /* init: probe_irda */ struct usb_device *usbdev; /* init: probe_irda */
struct net_device *netdev; /* network layer */ struct net_device *netdev; /* network layer */
struct irlap_cb *irlap; /* The link layer we are binded to */ struct irlap_cb *irlap; /* The link layer we are binded to */
struct net_device_stats stats; /* network statistics */
struct qos_info qos; struct qos_info qos;
unsigned speed; /* Current speed */ unsigned speed; /* Current speed */
@ -323,16 +323,16 @@ static void fir_eof(struct stir_cb *stir)
pr_debug("%s: short frame len %d\n", pr_debug("%s: short frame len %d\n",
stir->netdev->name, len); stir->netdev->name, len);
++stir->stats.rx_errors; ++stir->netdev->stats.rx_errors;
++stir->stats.rx_length_errors; ++stir->netdev->stats.rx_length_errors;
return; return;
} }
fcs = ~(crc32_le(~0, rx_buff->data, len)); fcs = ~(crc32_le(~0, rx_buff->data, len));
if (fcs != get_unaligned_le32(rx_buff->data + len)) { if (fcs != get_unaligned_le32(rx_buff->data + len)) {
pr_debug("crc error calc 0x%x len %d\n", fcs, len); pr_debug("crc error calc 0x%x len %d\n", fcs, len);
stir->stats.rx_errors++; stir->netdev->stats.rx_errors++;
stir->stats.rx_crc_errors++; stir->netdev->stats.rx_crc_errors++;
return; return;
} }
@ -340,7 +340,7 @@ static void fir_eof(struct stir_cb *stir)
if (len < IRDA_RX_COPY_THRESHOLD) { if (len < IRDA_RX_COPY_THRESHOLD) {
nskb = dev_alloc_skb(len + 1); nskb = dev_alloc_skb(len + 1);
if (unlikely(!nskb)) { if (unlikely(!nskb)) {
++stir->stats.rx_dropped; ++stir->netdev->stats.rx_dropped;
return; return;
} }
skb_reserve(nskb, 1); skb_reserve(nskb, 1);
@ -349,7 +349,7 @@ static void fir_eof(struct stir_cb *stir)
} else { } else {
nskb = dev_alloc_skb(rx_buff->truesize); nskb = dev_alloc_skb(rx_buff->truesize);
if (unlikely(!nskb)) { if (unlikely(!nskb)) {
++stir->stats.rx_dropped; ++stir->netdev->stats.rx_dropped;
return; return;
} }
skb_reserve(nskb, 1); skb_reserve(nskb, 1);
@ -366,8 +366,8 @@ static void fir_eof(struct stir_cb *stir)
netif_rx(skb); netif_rx(skb);
stir->stats.rx_packets++; stir->netdev->stats.rx_packets++;
stir->stats.rx_bytes += len; stir->netdev->stats.rx_bytes += len;
rx_buff->data = rx_buff->head; rx_buff->data = rx_buff->head;
rx_buff->len = 0; rx_buff->len = 0;
@ -437,7 +437,7 @@ static void stir_fir_chars(struct stir_cb *stir,
if (unlikely(rx_buff->len >= rx_buff->truesize)) { if (unlikely(rx_buff->len >= rx_buff->truesize)) {
pr_debug("%s: fir frame exceeds %d\n", pr_debug("%s: fir frame exceeds %d\n",
stir->netdev->name, rx_buff->truesize); stir->netdev->name, rx_buff->truesize);
++stir->stats.rx_over_errors; ++stir->netdev->stats.rx_over_errors;
goto error_recovery; goto error_recovery;
} }
@ -445,10 +445,10 @@ static void stir_fir_chars(struct stir_cb *stir,
continue; continue;
frame_error: frame_error:
++stir->stats.rx_frame_errors; ++stir->netdev->stats.rx_frame_errors;
error_recovery: error_recovery:
++stir->stats.rx_errors; ++stir->netdev->stats.rx_errors;
rx_buff->state = OUTSIDE_FRAME; rx_buff->state = OUTSIDE_FRAME;
rx_buff->in_frame = FALSE; rx_buff->in_frame = FALSE;
} }
@ -461,7 +461,7 @@ static void stir_sir_chars(struct stir_cb *stir,
int i; int i;
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
async_unwrap_char(stir->netdev, &stir->stats, async_unwrap_char(stir->netdev, &stir->netdev->stats,
&stir->rx_buff, bytes[i]); &stir->rx_buff, bytes[i]);
} }
@ -692,7 +692,7 @@ static void receive_stop(struct stir_cb *stir)
usb_kill_urb(stir->rx_urb); usb_kill_urb(stir->rx_urb);
if (stir->rx_buff.in_frame) if (stir->rx_buff.in_frame)
stir->stats.collisions++; stir->netdev->stats.collisions++;
} }
/* /*
* Wrap data in socket buffer and send it. * Wrap data in socket buffer and send it.
@ -718,15 +718,15 @@ static void stir_send(struct stir_cb *stir, struct sk_buff *skb)
if (!first_frame) if (!first_frame)
fifo_txwait(stir, wraplen); fifo_txwait(stir, wraplen);
stir->stats.tx_packets++; stir->netdev->stats.tx_packets++;
stir->stats.tx_bytes += skb->len; stir->netdev->stats.tx_bytes += skb->len;
stir->netdev->trans_start = jiffies; stir->netdev->trans_start = jiffies;
pr_debug("send %d (%d)\n", skb->len, wraplen); pr_debug("send %d (%d)\n", skb->len, wraplen);
if (usb_bulk_msg(stir->usbdev, usb_sndbulkpipe(stir->usbdev, 1), if (usb_bulk_msg(stir->usbdev, usb_sndbulkpipe(stir->usbdev, 1),
stir->io_buf, wraplen, stir->io_buf, wraplen,
NULL, TRANSMIT_TIMEOUT)) NULL, TRANSMIT_TIMEOUT))
stir->stats.tx_errors++; stir->netdev->stats.tx_errors++;
} }
/* /*
@ -1007,15 +1007,6 @@ static int stir_net_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd)
return ret; return ret;
} }
/*
* Get device stats (for /proc/net/dev and ifconfig)
*/
static struct net_device_stats *stir_net_get_stats(struct net_device *netdev)
{
struct stir_cb *stir = netdev_priv(netdev);
return &stir->stats;
}
/* /*
* This routine is called by the USB subsystem for each new device * This routine is called by the USB subsystem for each new device
* in the system. We need to check if the device is ours, and in * in the system. We need to check if the device is ours, and in
@ -1066,7 +1057,6 @@ static int stir_probe(struct usb_interface *intf,
net->hard_start_xmit = stir_hard_xmit; net->hard_start_xmit = stir_hard_xmit;
net->open = stir_net_open; net->open = stir_net_open;
net->stop = stir_net_close; net->stop = stir_net_close;
net->get_stats = stir_net_get_stats;
net->do_ioctl = stir_net_ioctl; net->do_ioctl = stir_net_ioctl;
ret = register_netdev(net); ret = register_netdev(net);

View file

@ -101,8 +101,6 @@ static int via_ircc_net_open(struct net_device *dev);
static int via_ircc_net_close(struct net_device *dev); static int via_ircc_net_close(struct net_device *dev);
static int via_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, static int via_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq,
int cmd); int cmd);
static struct net_device_stats *via_ircc_net_get_stats(struct net_device
*dev);
static void via_ircc_change_dongle_speed(int iobase, int speed, static void via_ircc_change_dongle_speed(int iobase, int speed,
int dongle_id); int dongle_id);
static int RxTimerHandler(struct via_ircc_cb *self, int iobase); static int RxTimerHandler(struct via_ircc_cb *self, int iobase);
@ -434,7 +432,6 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id)
dev->open = via_ircc_net_open; dev->open = via_ircc_net_open;
dev->stop = via_ircc_net_close; dev->stop = via_ircc_net_close;
dev->do_ioctl = via_ircc_net_ioctl; dev->do_ioctl = via_ircc_net_ioctl;
dev->get_stats = via_ircc_net_get_stats;
err = register_netdev(dev); err = register_netdev(dev);
if (err) if (err)
@ -855,7 +852,7 @@ static int via_ircc_hard_xmit_sir(struct sk_buff *skb,
async_wrap_skb(skb, self->tx_buff.data, async_wrap_skb(skb, self->tx_buff.data,
self->tx_buff.truesize); self->tx_buff.truesize);
self->stats.tx_bytes += self->tx_buff.len; dev->stats.tx_bytes += self->tx_buff.len;
/* Send this frame with old speed */ /* Send this frame with old speed */
SetBaudRate(iobase, self->io.speed); SetBaudRate(iobase, self->io.speed);
SetPulseWidth(iobase, 12); SetPulseWidth(iobase, 12);
@ -921,7 +918,7 @@ static int via_ircc_hard_xmit_fir(struct sk_buff *skb,
self->tx_fifo.queue[self->tx_fifo.free].len = skb->len; self->tx_fifo.queue[self->tx_fifo.free].len = skb->len;
self->tx_fifo.tail += skb->len; self->tx_fifo.tail += skb->len;
self->stats.tx_bytes += skb->len; dev->stats.tx_bytes += skb->len;
skb_copy_from_linear_data(skb, skb_copy_from_linear_data(skb,
self->tx_fifo.queue[self->tx_fifo.free].start, skb->len); self->tx_fifo.queue[self->tx_fifo.free].start, skb->len);
self->tx_fifo.len++; self->tx_fifo.len++;
@ -990,12 +987,12 @@ static int via_ircc_dma_xmit_complete(struct via_ircc_cb *self)
/* Clear bit, by writing 1 into it */ /* Clear bit, by writing 1 into it */
Tx_status = GetTXStatus(iobase); Tx_status = GetTXStatus(iobase);
if (Tx_status & 0x08) { if (Tx_status & 0x08) {
self->stats.tx_errors++; self->netdev->stats.tx_errors++;
self->stats.tx_fifo_errors++; self->netdev->stats.tx_fifo_errors++;
hwreset(self); hwreset(self);
// how to clear underrrun ? // how to clear underrrun ?
} else { } else {
self->stats.tx_packets++; self->netdev->stats.tx_packets++;
ResetChip(iobase, 3); ResetChip(iobase, 3);
ResetChip(iobase, 4); ResetChip(iobase, 4);
} }
@ -1119,8 +1116,8 @@ static int via_ircc_dma_receive_complete(struct via_ircc_cb *self,
} }
// Move to next frame // Move to next frame
self->rx_buff.data += len; self->rx_buff.data += len;
self->stats.rx_bytes += len; self->netdev->stats.rx_bytes += len;
self->stats.rx_packets++; self->netdev->stats.rx_packets++;
skb->dev = self->netdev; skb->dev = self->netdev;
skb_reset_mac_header(skb); skb_reset_mac_header(skb);
skb->protocol = htons(ETH_P_IRDA); skb->protocol = htons(ETH_P_IRDA);
@ -1180,7 +1177,7 @@ F01_E */
*/ */
if ((skb == NULL) || (skb->data == NULL) if ((skb == NULL) || (skb->data == NULL)
|| (self->rx_buff.data == NULL) || (len < 6)) { || (self->rx_buff.data == NULL) || (len < 6)) {
self->stats.rx_dropped++; self->netdev->stats.rx_dropped++;
return TRUE; return TRUE;
} }
skb_reserve(skb, 1); skb_reserve(skb, 1);
@ -1192,8 +1189,8 @@ F01_E */
// Move to next frame // Move to next frame
self->rx_buff.data += len; self->rx_buff.data += len;
self->stats.rx_bytes += len; self->netdev->stats.rx_bytes += len;
self->stats.rx_packets++; self->netdev->stats.rx_packets++;
skb->dev = self->netdev; skb->dev = self->netdev;
skb_reset_mac_header(skb); skb_reset_mac_header(skb);
skb->protocol = htons(ETH_P_IRDA); skb->protocol = htons(ETH_P_IRDA);
@ -1220,13 +1217,13 @@ static int upload_rxdata(struct via_ircc_cb *self, int iobase)
IRDA_DEBUG(2, "%s(): len=%x\n", __func__, len); IRDA_DEBUG(2, "%s(): len=%x\n", __func__, len);
if ((len - 4) < 2) { if ((len - 4) < 2) {
self->stats.rx_dropped++; self->netdev->stats.rx_dropped++;
return FALSE; return FALSE;
} }
skb = dev_alloc_skb(len + 1); skb = dev_alloc_skb(len + 1);
if (skb == NULL) { if (skb == NULL) {
self->stats.rx_dropped++; self->netdev->stats.rx_dropped++;
return FALSE; return FALSE;
} }
skb_reserve(skb, 1); skb_reserve(skb, 1);
@ -1238,8 +1235,8 @@ static int upload_rxdata(struct via_ircc_cb *self, int iobase)
st_fifo->tail = 0; st_fifo->tail = 0;
// Move to next frame // Move to next frame
self->rx_buff.data += len; self->rx_buff.data += len;
self->stats.rx_bytes += len; self->netdev->stats.rx_bytes += len;
self->stats.rx_packets++; self->netdev->stats.rx_packets++;
skb->dev = self->netdev; skb->dev = self->netdev;
skb_reset_mac_header(skb); skb_reset_mac_header(skb);
skb->protocol = htons(ETH_P_IRDA); skb->protocol = htons(ETH_P_IRDA);
@ -1295,7 +1292,7 @@ static int RxTimerHandler(struct via_ircc_cb *self, int iobase)
*/ */
if ((skb == NULL) || (skb->data == NULL) if ((skb == NULL) || (skb->data == NULL)
|| (self->rx_buff.data == NULL) || (len < 6)) { || (self->rx_buff.data == NULL) || (len < 6)) {
self->stats.rx_dropped++; self->netdev->stats.rx_dropped++;
continue; continue;
} }
skb_reserve(skb, 1); skb_reserve(skb, 1);
@ -1307,8 +1304,8 @@ static int RxTimerHandler(struct via_ircc_cb *self, int iobase)
// Move to next frame // Move to next frame
self->rx_buff.data += len; self->rx_buff.data += len;
self->stats.rx_bytes += len; self->netdev->stats.rx_bytes += len;
self->stats.rx_packets++; self->netdev->stats.rx_packets++;
skb->dev = self->netdev; skb->dev = self->netdev;
skb_reset_mac_header(skb); skb_reset_mac_header(skb);
skb->protocol = htons(ETH_P_IRDA); skb->protocol = htons(ETH_P_IRDA);
@ -1523,7 +1520,7 @@ static int via_ircc_net_open(struct net_device *dev)
IRDA_ASSERT(dev != NULL, return -1;); IRDA_ASSERT(dev != NULL, return -1;);
self = netdev_priv(dev); self = netdev_priv(dev);
self->stats.rx_packets = 0; dev->stats.rx_packets = 0;
IRDA_ASSERT(self != NULL, return 0;); IRDA_ASSERT(self != NULL, return 0;);
iobase = self->io.fir_base; iobase = self->io.fir_base;
if (request_irq(self->io.irq, via_ircc_interrupt, 0, dev->name, dev)) { if (request_irq(self->io.irq, via_ircc_interrupt, 0, dev->name, dev)) {
@ -1660,14 +1657,6 @@ static int via_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq,
return ret; return ret;
} }
static struct net_device_stats *via_ircc_net_get_stats(struct net_device
*dev)
{
struct via_ircc_cb *self = netdev_priv(dev);
return &self->stats;
}
MODULE_AUTHOR("VIA Technologies,inc"); MODULE_AUTHOR("VIA Technologies,inc");
MODULE_DESCRIPTION("VIA IrDA Device Driver"); MODULE_DESCRIPTION("VIA IrDA Device Driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");

View file

@ -95,7 +95,6 @@ struct via_ircc_cb {
struct tx_fifo tx_fifo; /* Info about frames to be transmitted */ struct tx_fifo tx_fifo; /* Info about frames to be transmitted */
struct net_device *netdev; /* Yes! we are some kind of netdevice */ struct net_device *netdev; /* Yes! we are some kind of netdevice */
struct net_device_stats stats;
struct irlap_cb *irlap; /* The link layer we are binded to */ struct irlap_cb *irlap; /* The link layer we are binded to */
struct qos_info qos; /* QoS capabilities for this device */ struct qos_info qos; /* QoS capabilities for this device */

View file

@ -291,14 +291,14 @@ static void vlsi_proc_ndev(struct seq_file *seq, struct net_device *ndev)
now.tv_sec - idev->last_rx.tv_sec - delta1, delta2); now.tv_sec - idev->last_rx.tv_sec - delta1, delta2);
seq_printf(seq, "RX: packets=%lu / bytes=%lu / errors=%lu / dropped=%lu", seq_printf(seq, "RX: packets=%lu / bytes=%lu / errors=%lu / dropped=%lu",
idev->stats.rx_packets, idev->stats.rx_bytes, idev->stats.rx_errors, ndev->stats.rx_packets, ndev->stats.rx_bytes, ndev->stats.rx_errors,
idev->stats.rx_dropped); ndev->stats.rx_dropped);
seq_printf(seq, " / overrun=%lu / length=%lu / frame=%lu / crc=%lu\n", seq_printf(seq, " / overrun=%lu / length=%lu / frame=%lu / crc=%lu\n",
idev->stats.rx_over_errors, idev->stats.rx_length_errors, ndev->stats.rx_over_errors, ndev->stats.rx_length_errors,
idev->stats.rx_frame_errors, idev->stats.rx_crc_errors); ndev->stats.rx_frame_errors, ndev->stats.rx_crc_errors);
seq_printf(seq, "TX: packets=%lu / bytes=%lu / errors=%lu / dropped=%lu / fifo=%lu\n", seq_printf(seq, "TX: packets=%lu / bytes=%lu / errors=%lu / dropped=%lu / fifo=%lu\n",
idev->stats.tx_packets, idev->stats.tx_bytes, idev->stats.tx_errors, ndev->stats.tx_packets, ndev->stats.tx_bytes, ndev->stats.tx_errors,
idev->stats.tx_dropped, idev->stats.tx_fifo_errors); ndev->stats.tx_dropped, ndev->stats.tx_fifo_errors);
} }
@ -651,21 +651,21 @@ static void vlsi_rx_interrupt(struct net_device *ndev)
if (ret < 0) { if (ret < 0) {
ret = -ret; ret = -ret;
idev->stats.rx_errors++; ndev->stats.rx_errors++;
if (ret & VLSI_RX_DROP) if (ret & VLSI_RX_DROP)
idev->stats.rx_dropped++; ndev->stats.rx_dropped++;
if (ret & VLSI_RX_OVER) if (ret & VLSI_RX_OVER)
idev->stats.rx_over_errors++; ndev->stats.rx_over_errors++;
if (ret & VLSI_RX_LENGTH) if (ret & VLSI_RX_LENGTH)
idev->stats.rx_length_errors++; ndev->stats.rx_length_errors++;
if (ret & VLSI_RX_FRAME) if (ret & VLSI_RX_FRAME)
idev->stats.rx_frame_errors++; ndev->stats.rx_frame_errors++;
if (ret & VLSI_RX_CRC) if (ret & VLSI_RX_CRC)
idev->stats.rx_crc_errors++; ndev->stats.rx_crc_errors++;
} }
else if (ret > 0) { else if (ret > 0) {
idev->stats.rx_packets++; ndev->stats.rx_packets++;
idev->stats.rx_bytes += ret; ndev->stats.rx_bytes += ret;
} }
} }
@ -686,6 +686,7 @@ static void vlsi_rx_interrupt(struct net_device *ndev)
static void vlsi_unarm_rx(vlsi_irda_dev_t *idev) static void vlsi_unarm_rx(vlsi_irda_dev_t *idev)
{ {
struct net_device *ndev = pci_get_drvdata(idev->pdev);
struct vlsi_ring *r = idev->rx_ring; struct vlsi_ring *r = idev->rx_ring;
struct ring_descr *rd; struct ring_descr *rd;
int ret; int ret;
@ -711,21 +712,21 @@ static void vlsi_unarm_rx(vlsi_irda_dev_t *idev)
if (ret < 0) { if (ret < 0) {
ret = -ret; ret = -ret;
idev->stats.rx_errors++; ndev->stats.rx_errors++;
if (ret & VLSI_RX_DROP) if (ret & VLSI_RX_DROP)
idev->stats.rx_dropped++; ndev->stats.rx_dropped++;
if (ret & VLSI_RX_OVER) if (ret & VLSI_RX_OVER)
idev->stats.rx_over_errors++; ndev->stats.rx_over_errors++;
if (ret & VLSI_RX_LENGTH) if (ret & VLSI_RX_LENGTH)
idev->stats.rx_length_errors++; ndev->stats.rx_length_errors++;
if (ret & VLSI_RX_FRAME) if (ret & VLSI_RX_FRAME)
idev->stats.rx_frame_errors++; ndev->stats.rx_frame_errors++;
if (ret & VLSI_RX_CRC) if (ret & VLSI_RX_CRC)
idev->stats.rx_crc_errors++; ndev->stats.rx_crc_errors++;
} }
else if (ret > 0) { else if (ret > 0) {
idev->stats.rx_packets++; ndev->stats.rx_packets++;
idev->stats.rx_bytes += ret; ndev->stats.rx_bytes += ret;
} }
} }
} }
@ -1050,8 +1051,8 @@ drop_unlock:
drop: drop:
IRDA_WARNING("%s: dropping packet - %s\n", __func__, msg); IRDA_WARNING("%s: dropping packet - %s\n", __func__, msg);
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
idev->stats.tx_errors++; ndev->stats.tx_errors++;
idev->stats.tx_dropped++; ndev->stats.tx_dropped++;
/* Don't even think about returning NET_XMIT_DROP (=1) here! /* Don't even think about returning NET_XMIT_DROP (=1) here!
* In fact any retval!=0 causes the packet scheduler to requeue the * In fact any retval!=0 causes the packet scheduler to requeue the
* packet for later retry of transmission - which isn't exactly * packet for later retry of transmission - which isn't exactly
@ -1078,15 +1079,15 @@ static void vlsi_tx_interrupt(struct net_device *ndev)
if (ret < 0) { if (ret < 0) {
ret = -ret; ret = -ret;
idev->stats.tx_errors++; ndev->stats.tx_errors++;
if (ret & VLSI_TX_DROP) if (ret & VLSI_TX_DROP)
idev->stats.tx_dropped++; ndev->stats.tx_dropped++;
if (ret & VLSI_TX_FIFO) if (ret & VLSI_TX_FIFO)
idev->stats.tx_fifo_errors++; ndev->stats.tx_fifo_errors++;
} }
else if (ret > 0){ else if (ret > 0){
idev->stats.tx_packets++; ndev->stats.tx_packets++;
idev->stats.tx_bytes += ret; ndev->stats.tx_bytes += ret;
} }
} }
@ -1122,6 +1123,7 @@ static void vlsi_tx_interrupt(struct net_device *ndev)
static void vlsi_unarm_tx(vlsi_irda_dev_t *idev) static void vlsi_unarm_tx(vlsi_irda_dev_t *idev)
{ {
struct net_device *ndev = pci_get_drvdata(idev->pdev);
struct vlsi_ring *r = idev->tx_ring; struct vlsi_ring *r = idev->tx_ring;
struct ring_descr *rd; struct ring_descr *rd;
int ret; int ret;
@ -1145,15 +1147,15 @@ static void vlsi_unarm_tx(vlsi_irda_dev_t *idev)
if (ret < 0) { if (ret < 0) {
ret = -ret; ret = -ret;
idev->stats.tx_errors++; ndev->stats.tx_errors++;
if (ret & VLSI_TX_DROP) if (ret & VLSI_TX_DROP)
idev->stats.tx_dropped++; ndev->stats.tx_dropped++;
if (ret & VLSI_TX_FIFO) if (ret & VLSI_TX_FIFO)
idev->stats.tx_fifo_errors++; ndev->stats.tx_fifo_errors++;
} }
else if (ret > 0){ else if (ret > 0){
idev->stats.tx_packets++; ndev->stats.tx_packets++;
idev->stats.tx_bytes += ret; ndev->stats.tx_bytes += ret;
} }
} }
@ -1373,13 +1375,6 @@ static int vlsi_stop_hw(vlsi_irda_dev_t *idev)
/**************************************************************/ /**************************************************************/
static struct net_device_stats * vlsi_get_stats(struct net_device *ndev)
{
vlsi_irda_dev_t *idev = netdev_priv(ndev);
return &idev->stats;
}
static void vlsi_tx_timeout(struct net_device *ndev) static void vlsi_tx_timeout(struct net_device *ndev)
{ {
vlsi_irda_dev_t *idev = netdev_priv(ndev); vlsi_irda_dev_t *idev = netdev_priv(ndev);
@ -1615,7 +1610,6 @@ static int vlsi_irda_init(struct net_device *ndev)
ndev->open = vlsi_open; ndev->open = vlsi_open;
ndev->stop = vlsi_close; ndev->stop = vlsi_close;
ndev->get_stats = vlsi_get_stats;
ndev->hard_start_xmit = vlsi_hard_start_xmit; ndev->hard_start_xmit = vlsi_hard_start_xmit;
ndev->do_ioctl = vlsi_ioctl; ndev->do_ioctl = vlsi_ioctl;
ndev->tx_timeout = vlsi_tx_timeout; ndev->tx_timeout = vlsi_tx_timeout;

View file

@ -712,7 +712,6 @@ static inline struct ring_descr *ring_get(struct vlsi_ring *r)
typedef struct vlsi_irda_dev { typedef struct vlsi_irda_dev {
struct pci_dev *pdev; struct pci_dev *pdev;
struct net_device_stats stats;
struct irlap_cb *irlap; struct irlap_cb *irlap;

View file

@ -102,7 +102,6 @@ static int w83977af_is_receiving(struct w83977af_ir *self);
static int w83977af_net_open(struct net_device *dev); static int w83977af_net_open(struct net_device *dev);
static int w83977af_net_close(struct net_device *dev); static int w83977af_net_close(struct net_device *dev);
static int w83977af_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); static int w83977af_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
static struct net_device_stats *w83977af_net_get_stats(struct net_device *dev);
/* /*
* Function w83977af_init () * Function w83977af_init ()
@ -237,7 +236,6 @@ static int w83977af_open(int i, unsigned int iobase, unsigned int irq,
dev->open = w83977af_net_open; dev->open = w83977af_net_open;
dev->stop = w83977af_net_close; dev->stop = w83977af_net_close;
dev->do_ioctl = w83977af_net_ioctl; dev->do_ioctl = w83977af_net_ioctl;
dev->get_stats = w83977af_net_get_stats;
err = register_netdev(dev); err = register_netdev(dev);
if (err) { if (err) {
@ -702,13 +700,13 @@ static void w83977af_dma_xmit_complete(struct w83977af_ir *self)
if (inb(iobase+AUDR) & AUDR_UNDR) { if (inb(iobase+AUDR) & AUDR_UNDR) {
IRDA_DEBUG(0, "%s(), Transmit underrun!\n", __func__ ); IRDA_DEBUG(0, "%s(), Transmit underrun!\n", __func__ );
self->stats.tx_errors++; self->netdev->stats.tx_errors++;
self->stats.tx_fifo_errors++; self->netdev->stats.tx_fifo_errors++;
/* Clear bit, by writing 1 to it */ /* Clear bit, by writing 1 to it */
outb(AUDR_UNDR, iobase+AUDR); outb(AUDR_UNDR, iobase+AUDR);
} else } else
self->stats.tx_packets++; self->netdev->stats.tx_packets++;
if (self->new_speed) { if (self->new_speed) {
@ -846,28 +844,28 @@ static int w83977af_dma_receive_complete(struct w83977af_ir *self)
if (status & FS_FO_ERR_MSK) { if (status & FS_FO_ERR_MSK) {
if (status & FS_FO_LST_FR) { if (status & FS_FO_LST_FR) {
/* Add number of lost frames to stats */ /* Add number of lost frames to stats */
self->stats.rx_errors += len; self->netdev->stats.rx_errors += len;
} else { } else {
/* Skip frame */ /* Skip frame */
self->stats.rx_errors++; self->netdev->stats.rx_errors++;
self->rx_buff.data += len; self->rx_buff.data += len;
if (status & FS_FO_MX_LEX) if (status & FS_FO_MX_LEX)
self->stats.rx_length_errors++; self->netdev->stats.rx_length_errors++;
if (status & FS_FO_PHY_ERR) if (status & FS_FO_PHY_ERR)
self->stats.rx_frame_errors++; self->netdev->stats.rx_frame_errors++;
if (status & FS_FO_CRC_ERR) if (status & FS_FO_CRC_ERR)
self->stats.rx_crc_errors++; self->netdev->stats.rx_crc_errors++;
} }
/* The errors below can be reported in both cases */ /* The errors below can be reported in both cases */
if (status & FS_FO_RX_OV) if (status & FS_FO_RX_OV)
self->stats.rx_fifo_errors++; self->netdev->stats.rx_fifo_errors++;
if (status & FS_FO_FSF_OV) if (status & FS_FO_FSF_OV)
self->stats.rx_fifo_errors++; self->netdev->stats.rx_fifo_errors++;
} else { } else {
/* Check if we have transferred all data to memory */ /* Check if we have transferred all data to memory */
@ -917,7 +915,7 @@ static int w83977af_dma_receive_complete(struct w83977af_ir *self)
/* Move to next frame */ /* Move to next frame */
self->rx_buff.data += len; self->rx_buff.data += len;
self->stats.rx_packets++; self->netdev->stats.rx_packets++;
skb->dev = self->netdev; skb->dev = self->netdev;
skb_reset_mac_header(skb); skb_reset_mac_header(skb);
@ -951,7 +949,7 @@ static void w83977af_pio_receive(struct w83977af_ir *self)
/* Receive all characters in Rx FIFO */ /* Receive all characters in Rx FIFO */
do { do {
byte = inb(iobase+RBR); byte = inb(iobase+RBR);
async_unwrap_char(self->netdev, &self->stats, &self->rx_buff, async_unwrap_char(self->netdev, &self->netdev->stats, &self->rx_buff,
byte); byte);
} while (inb(iobase+USR) & USR_RDR); /* Data available */ } while (inb(iobase+USR) & USR_RDR); /* Data available */
} }
@ -994,7 +992,7 @@ static __u8 w83977af_sir_interrupt(struct w83977af_ir *self, int isr)
outb(AUDR_SFEND, iobase+AUDR); outb(AUDR_SFEND, iobase+AUDR);
outb(set, iobase+SSR); outb(set, iobase+SSR);
self->stats.tx_packets++; self->netdev->stats.tx_packets++;
/* Feed me more packets */ /* Feed me more packets */
netif_wake_queue(self->netdev); netif_wake_queue(self->netdev);
@ -1336,13 +1334,6 @@ out:
return ret; return ret;
} }
static struct net_device_stats *w83977af_net_get_stats(struct net_device *dev)
{
struct w83977af_ir *self = netdev_priv(dev);
return &self->stats;
}
MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>"); MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
MODULE_DESCRIPTION("Winbond W83977AF IrDA Device Driver"); MODULE_DESCRIPTION("Winbond W83977AF IrDA Device Driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");

View file

@ -172,7 +172,6 @@ struct w83977af_ir {
int tx_len; /* Number of frames in tx_buff */ int tx_len; /* Number of frames in tx_buff */
struct net_device *netdev; /* Yes! we are some kind of netdevice */ struct net_device *netdev; /* Yes! we are some kind of netdevice */
struct net_device_stats stats;
struct irlap_cb *irlap; /* The link layer we are binded to */ struct irlap_cb *irlap; /* The link layer we are binded to */
struct qos_info qos; /* QoS capabilities for this device */ struct qos_info qos; /* QoS capabilities for this device */

View file

@ -399,8 +399,10 @@ static int mlx4_en_set_ringparam(struct net_device *dev,
rx_size = roundup_pow_of_two(param->rx_pending); rx_size = roundup_pow_of_two(param->rx_pending);
rx_size = max_t(u32, rx_size, MLX4_EN_MIN_RX_SIZE); rx_size = max_t(u32, rx_size, MLX4_EN_MIN_RX_SIZE);
rx_size = min_t(u32, rx_size, MLX4_EN_MAX_RX_SIZE);
tx_size = roundup_pow_of_two(param->tx_pending); tx_size = roundup_pow_of_two(param->tx_pending);
tx_size = max_t(u32, tx_size, MLX4_EN_MIN_TX_SIZE); tx_size = max_t(u32, tx_size, MLX4_EN_MIN_TX_SIZE);
tx_size = min_t(u32, tx_size, MLX4_EN_MAX_TX_SIZE);
if (rx_size == priv->prof->rx_ring_size && if (rx_size == priv->prof->rx_ring_size &&
tx_size == priv->prof->tx_ring_size) tx_size == priv->prof->tx_ring_size)
@ -440,8 +442,8 @@ static void mlx4_en_get_ringparam(struct net_device *dev,
struct mlx4_en_dev *mdev = priv->mdev; struct mlx4_en_dev *mdev = priv->mdev;
memset(param, 0, sizeof(*param)); memset(param, 0, sizeof(*param));
param->rx_max_pending = mdev->dev->caps.max_rq_sg; param->rx_max_pending = MLX4_EN_MAX_RX_SIZE;
param->tx_max_pending = mdev->dev->caps.max_sq_sg; param->tx_max_pending = MLX4_EN_MAX_TX_SIZE;
param->rx_pending = mdev->profile.prof[priv->port].rx_ring_size; param->rx_pending = mdev->profile.prof[priv->port].rx_ring_size;
param->tx_pending = mdev->profile.prof[priv->port].tx_ring_size; param->tx_pending = mdev->profile.prof[priv->port].tx_ring_size;
} }

View file

@ -203,19 +203,21 @@ static u32 mlx4_en_free_tx_desc(struct mlx4_en_priv *priv,
/* Optimize the common case when there are no wraparounds */ /* Optimize the common case when there are no wraparounds */
if (likely((void *) tx_desc + tx_info->nr_txbb * TXBB_SIZE <= end)) { if (likely((void *) tx_desc + tx_info->nr_txbb * TXBB_SIZE <= end)) {
if (tx_info->linear) { if (!tx_info->inl) {
pci_unmap_single(mdev->pdev, if (tx_info->linear) {
(dma_addr_t) be64_to_cpu(data->addr), pci_unmap_single(mdev->pdev,
(dma_addr_t) be64_to_cpu(data->addr),
be32_to_cpu(data->byte_count), be32_to_cpu(data->byte_count),
PCI_DMA_TODEVICE); PCI_DMA_TODEVICE);
++data; ++data;
} }
for (i = 0; i < frags; i++) { for (i = 0; i < frags; i++) {
frag = &skb_shinfo(skb)->frags[i]; frag = &skb_shinfo(skb)->frags[i];
pci_unmap_page(mdev->pdev, pci_unmap_page(mdev->pdev,
(dma_addr_t) be64_to_cpu(data[i].addr), (dma_addr_t) be64_to_cpu(data[i].addr),
frag->size, PCI_DMA_TODEVICE); frag->size, PCI_DMA_TODEVICE);
}
} }
/* Stamp the freed descriptor */ /* Stamp the freed descriptor */
for (i = 0; i < tx_info->nr_txbb * TXBB_SIZE; i += STAMP_STRIDE) { for (i = 0; i < tx_info->nr_txbb * TXBB_SIZE; i += STAMP_STRIDE) {
@ -224,27 +226,29 @@ static u32 mlx4_en_free_tx_desc(struct mlx4_en_priv *priv,
} }
} else { } else {
if ((void *) data >= end) { if (!tx_info->inl) {
data = (struct mlx4_wqe_data_seg *) if ((void *) data >= end) {
(ring->buf + ((void *) data - end)); data = (struct mlx4_wqe_data_seg *)
} (ring->buf + ((void *) data - end));
}
if (tx_info->linear) { if (tx_info->linear) {
pci_unmap_single(mdev->pdev, pci_unmap_single(mdev->pdev,
(dma_addr_t) be64_to_cpu(data->addr), (dma_addr_t) be64_to_cpu(data->addr),
be32_to_cpu(data->byte_count), be32_to_cpu(data->byte_count),
PCI_DMA_TODEVICE); PCI_DMA_TODEVICE);
++data; ++data;
} }
for (i = 0; i < frags; i++) { for (i = 0; i < frags; i++) {
/* Check for wraparound before unmapping */ /* Check for wraparound before unmapping */
if ((void *) data >= end) if ((void *) data >= end)
data = (struct mlx4_wqe_data_seg *) ring->buf; data = (struct mlx4_wqe_data_seg *) ring->buf;
frag = &skb_shinfo(skb)->frags[i]; frag = &skb_shinfo(skb)->frags[i];
pci_unmap_page(mdev->pdev, pci_unmap_page(mdev->pdev,
(dma_addr_t) be64_to_cpu(data->addr), (dma_addr_t) be64_to_cpu(data->addr),
frag->size, PCI_DMA_TODEVICE); frag->size, PCI_DMA_TODEVICE);
}
} }
/* Stamp the freed descriptor */ /* Stamp the freed descriptor */
for (i = 0; i < tx_info->nr_txbb * TXBB_SIZE; i += STAMP_STRIDE) { for (i = 0; i < tx_info->nr_txbb * TXBB_SIZE; i += STAMP_STRIDE) {
@ -790,8 +794,11 @@ int mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
wmb(); wmb();
data->byte_count = cpu_to_be32(skb_headlen(skb) - lso_header_size); data->byte_count = cpu_to_be32(skb_headlen(skb) - lso_header_size);
} }
} else tx_info->inl = 0;
} else {
build_inline_wqe(tx_desc, skb, real_size, &vlan_tag, tx_ind, fragptr); build_inline_wqe(tx_desc, skb, real_size, &vlan_tag, tx_ind, fragptr);
tx_info->inl = 1;
}
ring->prod += nr_txbb; ring->prod += nr_txbb;

View file

@ -115,6 +115,10 @@ enum {
}; };
#define MLX4_EN_MAX_RX_FRAGS 4 #define MLX4_EN_MAX_RX_FRAGS 4
/* Maximum ring sizes */
#define MLX4_EN_MAX_TX_SIZE 8192
#define MLX4_EN_MAX_RX_SIZE 8192
/* Minimum ring size for our page-allocation sceme to work */ /* Minimum ring size for our page-allocation sceme to work */
#define MLX4_EN_MIN_RX_SIZE (MLX4_EN_ALLOC_SIZE / SMP_CACHE_BYTES) #define MLX4_EN_MIN_RX_SIZE (MLX4_EN_ALLOC_SIZE / SMP_CACHE_BYTES)
#define MLX4_EN_MIN_TX_SIZE (4096 / TXBB_SIZE) #define MLX4_EN_MIN_TX_SIZE (4096 / TXBB_SIZE)
@ -202,6 +206,7 @@ struct mlx4_en_tx_info {
u32 nr_txbb; u32 nr_txbb;
u8 linear; u8 linear;
u8 data_offset; u8 data_offset;
u8 inl;
}; };

View file

@ -779,6 +779,22 @@ static void __devinit natsemi_init_media (struct net_device *dev)
} }
static const struct net_device_ops natsemi_netdev_ops = {
.ndo_open = netdev_open,
.ndo_stop = netdev_close,
.ndo_start_xmit = start_tx,
.ndo_get_stats = get_stats,
.ndo_set_multicast_list = set_rx_mode,
.ndo_change_mtu = natsemi_change_mtu,
.ndo_do_ioctl = netdev_ioctl,
.ndo_tx_timeout = ns_tx_timeout,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = natsemi_poll_controller,
#endif
};
static int __devinit natsemi_probe1 (struct pci_dev *pdev, static int __devinit natsemi_probe1 (struct pci_dev *pdev,
const struct pci_device_id *ent) const struct pci_device_id *ent)
{ {
@ -911,20 +927,9 @@ static int __devinit natsemi_probe1 (struct pci_dev *pdev,
if (find_cnt < MAX_UNITS && full_duplex[find_cnt]) if (find_cnt < MAX_UNITS && full_duplex[find_cnt])
np->full_duplex = 1; np->full_duplex = 1;
/* The chip-specific entries in the device structure. */ dev->netdev_ops = &natsemi_netdev_ops;
dev->open = &netdev_open;
dev->hard_start_xmit = &start_tx;
dev->stop = &netdev_close;
dev->get_stats = &get_stats;
dev->set_multicast_list = &set_rx_mode;
dev->change_mtu = &natsemi_change_mtu;
dev->do_ioctl = &netdev_ioctl;
dev->tx_timeout = &ns_tx_timeout;
dev->watchdog_timeo = TX_TIMEOUT; dev->watchdog_timeo = TX_TIMEOUT;
#ifdef CONFIG_NET_POLL_CONTROLLER
dev->poll_controller = &natsemi_poll_controller;
#endif
SET_ETHTOOL_OPS(dev, &ethtool_ops); SET_ETHTOOL_OPS(dev, &ethtool_ops);
if (mtu) if (mtu)

View file

@ -1957,6 +1957,9 @@ static const struct net_device_ops netdev_ops = {
.ndo_set_multicast_list = ns83820_set_multicast, .ndo_set_multicast_list = ns83820_set_multicast,
.ndo_validate_addr = eth_validate_addr, .ndo_validate_addr = eth_validate_addr,
.ndo_tx_timeout = ns83820_tx_timeout, .ndo_tx_timeout = ns83820_tx_timeout,
#ifdef NS83820_VLAN_ACCEL_SUPPORT
.ndo_vlan_rx_register = ns83820_vlan_rx_register,
#endif
}; };
static int __devinit ns83820_init_one(struct pci_dev *pci_dev, static int __devinit ns83820_init_one(struct pci_dev *pci_dev,
@ -2216,7 +2219,6 @@ static int __devinit ns83820_init_one(struct pci_dev *pci_dev,
#ifdef NS83820_VLAN_ACCEL_SUPPORT #ifdef NS83820_VLAN_ACCEL_SUPPORT
/* We also support hardware vlan acceleration */ /* We also support hardware vlan acceleration */
ndev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; ndev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
ndev->vlan_rx_register = ns83820_vlan_rx_register;
#endif #endif
if (using_dac) { if (using_dac) {

View file

@ -1568,6 +1568,22 @@ pcnet32_probe_pci(struct pci_dev *pdev, const struct pci_device_id *ent)
return err; return err;
} }
static const struct net_device_ops pcnet32_netdev_ops = {
.ndo_open = pcnet32_open,
.ndo_stop = pcnet32_close,
.ndo_start_xmit = pcnet32_start_xmit,
.ndo_tx_timeout = pcnet32_tx_timeout,
.ndo_get_stats = pcnet32_get_stats,
.ndo_set_multicast_list = pcnet32_set_multicast_list,
.ndo_do_ioctl = pcnet32_ioctl,
.ndo_change_mtu = eth_change_mtu,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = pcnet32_poll_controller,
#endif
};
/* pcnet32_probe1 /* pcnet32_probe1
* Called from both pcnet32_probe_vlbus and pcnet_probe_pci. * Called from both pcnet32_probe_vlbus and pcnet_probe_pci.
* pdev will be NULL when called from pcnet32_probe_vlbus. * pdev will be NULL when called from pcnet32_probe_vlbus.
@ -1934,20 +1950,10 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
lp->watchdog_timer.function = (void *)&pcnet32_watchdog; lp->watchdog_timer.function = (void *)&pcnet32_watchdog;
/* The PCNET32-specific entries in the device structure. */ /* The PCNET32-specific entries in the device structure. */
dev->open = &pcnet32_open; dev->netdev_ops = &pcnet32_netdev_ops;
dev->hard_start_xmit = &pcnet32_start_xmit;
dev->stop = &pcnet32_close;
dev->get_stats = &pcnet32_get_stats;
dev->set_multicast_list = &pcnet32_set_multicast_list;
dev->do_ioctl = &pcnet32_ioctl;
dev->ethtool_ops = &pcnet32_ethtool_ops; dev->ethtool_ops = &pcnet32_ethtool_ops;
dev->tx_timeout = pcnet32_tx_timeout;
dev->watchdog_timeo = (5 * HZ); dev->watchdog_timeo = (5 * HZ);
#ifdef CONFIG_NET_POLL_CONTROLLER
dev->poll_controller = pcnet32_poll_controller;
#endif
/* Fill in the generic fields of the device structure. */ /* Fill in the generic fields of the device structure. */
if (register_netdev(dev)) if (register_netdev(dev))
goto err_free_ring; goto err_free_ring;
@ -2276,7 +2282,7 @@ static int pcnet32_open(struct net_device *dev)
if (lp->chip_version >= PCNET32_79C970A) { if (lp->chip_version >= PCNET32_79C970A) {
/* Print the link status and start the watchdog */ /* Print the link status and start the watchdog */
pcnet32_check_media(dev, 1); pcnet32_check_media(dev, 1);
mod_timer(&(lp->watchdog_timer), PCNET32_WATCHDOG_TIMEOUT); mod_timer(&lp->watchdog_timer, PCNET32_WATCHDOG_TIMEOUT);
} }
i = 0; i = 0;
@ -2911,7 +2917,7 @@ static void pcnet32_watchdog(struct net_device *dev)
pcnet32_check_media(dev, 0); pcnet32_check_media(dev, 0);
spin_unlock_irqrestore(&lp->lock, flags); spin_unlock_irqrestore(&lp->lock, flags);
mod_timer(&(lp->watchdog_timer), PCNET32_WATCHDOG_TIMEOUT); mod_timer(&lp->watchdog_timer, round_jiffies(PCNET32_WATCHDOG_TIMEOUT));
} }
static int pcnet32_pm_suspend(struct pci_dev *pdev, pm_message_t state) static int pcnet32_pm_suspend(struct pci_dev *pdev, pm_message_t state)

View file

@ -265,6 +265,13 @@ static const struct header_ops plip_header_ops = {
.cache = plip_hard_header_cache, .cache = plip_hard_header_cache,
}; };
static const struct net_device_ops plip_netdev_ops = {
.ndo_open = plip_open,
.ndo_stop = plip_close,
.ndo_start_xmit = plip_tx_packet,
.ndo_do_ioctl = plip_ioctl,
};
/* Entry point of PLIP driver. /* Entry point of PLIP driver.
Probe the hardware, and register/initialize the driver. Probe the hardware, and register/initialize the driver.
@ -280,15 +287,11 @@ plip_init_netdev(struct net_device *dev)
struct net_local *nl = netdev_priv(dev); struct net_local *nl = netdev_priv(dev);
/* Then, override parts of it */ /* Then, override parts of it */
dev->hard_start_xmit = plip_tx_packet;
dev->open = plip_open;
dev->stop = plip_close;
dev->do_ioctl = plip_ioctl;
dev->tx_queue_len = 10; dev->tx_queue_len = 10;
dev->flags = IFF_POINTOPOINT|IFF_NOARP; dev->flags = IFF_POINTOPOINT|IFF_NOARP;
memset(dev->dev_addr, 0xfc, ETH_ALEN); memset(dev->dev_addr, 0xfc, ETH_ALEN);
dev->netdev_ops = &plip_netdev_ops;
dev->header_ops = &plip_header_ops; dev->header_ops = &plip_header_ops;

View file

@ -49,8 +49,8 @@
#include <asm/processor.h> #include <asm/processor.h>
#define DRV_NAME "r6040" #define DRV_NAME "r6040"
#define DRV_VERSION "0.19" #define DRV_VERSION "0.20"
#define DRV_RELDATE "18Dec2008" #define DRV_RELDATE "07Jan2009"
/* PHY CHIP Address */ /* PHY CHIP Address */
#define PHY1_ADDR 1 /* For MAC1 */ #define PHY1_ADDR 1 /* For MAC1 */
@ -200,7 +200,7 @@ struct r6040_private {
static char version[] __devinitdata = KERN_INFO DRV_NAME static char version[] __devinitdata = KERN_INFO DRV_NAME
": RDC R6040 NAPI net driver," ": RDC R6040 NAPI net driver,"
"version "DRV_VERSION " (" DRV_RELDATE ")\n"; "version "DRV_VERSION " (" DRV_RELDATE ")";
static int phy_table[] = { PHY1_ADDR, PHY2_ADDR }; static int phy_table[] = { PHY1_ADDR, PHY2_ADDR };
@ -330,7 +330,7 @@ static int r6040_alloc_rxbufs(struct net_device *dev)
do { do {
skb = netdev_alloc_skb(dev, MAX_BUF_SIZE); skb = netdev_alloc_skb(dev, MAX_BUF_SIZE);
if (!skb) { if (!skb) {
printk(KERN_ERR "%s: failed to alloc skb for rx\n", dev->name); printk(KERN_ERR DRV_NAME "%s: failed to alloc skb for rx\n", dev->name);
rc = -ENOMEM; rc = -ENOMEM;
goto err_exit; goto err_exit;
} }
@ -1077,20 +1077,20 @@ static int __devinit r6040_init_one(struct pci_dev *pdev,
/* this should always be supported */ /* this should always be supported */
err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); err = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
if (err) { if (err) {
printk(KERN_ERR DRV_NAME "32-bit PCI DMA addresses" printk(KERN_ERR DRV_NAME ": 32-bit PCI DMA addresses"
"not supported by the card\n"); "not supported by the card\n");
goto err_out; goto err_out;
} }
err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK);
if (err) { if (err) {
printk(KERN_ERR DRV_NAME "32-bit PCI DMA addresses" printk(KERN_ERR DRV_NAME ": 32-bit PCI DMA addresses"
"not supported by the card\n"); "not supported by the card\n");
goto err_out; goto err_out;
} }
/* IO Size check */ /* IO Size check */
if (pci_resource_len(pdev, 0) < io_size) { if (pci_resource_len(pdev, 0) < io_size) {
printk(KERN_ERR DRV_NAME "Insufficient PCI resources, aborting\n"); printk(KERN_ERR DRV_NAME ": Insufficient PCI resources, aborting\n");
err = -EIO; err = -EIO;
goto err_out; goto err_out;
} }
@ -1100,7 +1100,7 @@ static int __devinit r6040_init_one(struct pci_dev *pdev,
dev = alloc_etherdev(sizeof(struct r6040_private)); dev = alloc_etherdev(sizeof(struct r6040_private));
if (!dev) { if (!dev) {
printk(KERN_ERR DRV_NAME "Failed to allocate etherdev\n"); printk(KERN_ERR DRV_NAME ": Failed to allocate etherdev\n");
err = -ENOMEM; err = -ENOMEM;
goto err_out; goto err_out;
} }
@ -1116,11 +1116,15 @@ static int __devinit r6040_init_one(struct pci_dev *pdev,
ioaddr = pci_iomap(pdev, bar, io_size); ioaddr = pci_iomap(pdev, bar, io_size);
if (!ioaddr) { if (!ioaddr) {
printk(KERN_ERR "ioremap failed for device %s\n", printk(KERN_ERR DRV_NAME ": ioremap failed for device %s\n",
pci_name(pdev)); pci_name(pdev));
err = -EIO; err = -EIO;
goto err_out_free_res; goto err_out_free_res;
} }
/* If PHY status change register is still set to zero it means the
* bootloader didn't initialize it */
if (ioread16(ioaddr + PHY_CC) == 0)
iowrite16(0x9f07, ioaddr + PHY_CC);
/* Init system & device */ /* Init system & device */
lp->base = ioaddr; lp->base = ioaddr;
@ -1137,6 +1141,11 @@ static int __devinit r6040_init_one(struct pci_dev *pdev,
adrp[1] = ioread16(ioaddr + MID_0M); adrp[1] = ioread16(ioaddr + MID_0M);
adrp[2] = ioread16(ioaddr + MID_0H); adrp[2] = ioread16(ioaddr + MID_0H);
/* Some bootloader/BIOSes do not initialize
* MAC address, warn about that */
if (!(adrp[0] || adrp[1] || adrp[2]))
printk(KERN_WARNING DRV_NAME ": MAC address not initialized\n");
/* Link new device into r6040_root_dev */ /* Link new device into r6040_root_dev */
lp->pdev = pdev; lp->pdev = pdev;
lp->dev = dev; lp->dev = dev;

View file

@ -134,6 +134,16 @@ static const struct pnp_device_id sb1000_pnp_ids[] = {
}; };
MODULE_DEVICE_TABLE(pnp, sb1000_pnp_ids); MODULE_DEVICE_TABLE(pnp, sb1000_pnp_ids);
static const struct net_device_ops sb1000_netdev_ops = {
.ndo_open = sb1000_open,
.ndo_start_xmit = sb1000_start_xmit,
.ndo_do_ioctl = sb1000_dev_ioctl,
.ndo_stop = sb1000_close,
.ndo_change_mtu = eth_change_mtu,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
};
static int static int
sb1000_probe_one(struct pnp_dev *pdev, const struct pnp_device_id *id) sb1000_probe_one(struct pnp_dev *pdev, const struct pnp_device_id *id)
{ {
@ -192,11 +202,7 @@ sb1000_probe_one(struct pnp_dev *pdev, const struct pnp_device_id *id)
if (sb1000_debug > 0) if (sb1000_debug > 0)
printk(KERN_NOTICE "%s", version); printk(KERN_NOTICE "%s", version);
/* The SB1000-specific entries in the device structure. */ dev->netdev_ops = &sb1000_netdev_ops;
dev->open = sb1000_open;
dev->do_ioctl = sb1000_dev_ioctl;
dev->hard_start_xmit = sb1000_start_xmit;
dev->stop = sb1000_close;
/* hardware address is 0:0:serial_number */ /* hardware address is 0:0:serial_number */
dev->dev_addr[2] = serial_number >> 24 & 0xff; dev->dev_addr[2] = serial_number >> 24 & 0xff;

View file

@ -1782,6 +1782,21 @@ static int sis190_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
generic_mii_ioctl(&tp->mii_if, if_mii(ifr), cmd, NULL); generic_mii_ioctl(&tp->mii_if, if_mii(ifr), cmd, NULL);
} }
static const struct net_device_ops sis190_netdev_ops = {
.ndo_open = sis190_open,
.ndo_stop = sis190_close,
.ndo_do_ioctl = sis190_ioctl,
.ndo_start_xmit = sis190_start_xmit,
.ndo_tx_timeout = sis190_tx_timeout,
.ndo_set_multicast_list = sis190_set_rx_mode,
.ndo_change_mtu = eth_change_mtu,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = sis190_netpoll,
#endif
};
static int __devinit sis190_init_one(struct pci_dev *pdev, static int __devinit sis190_init_one(struct pci_dev *pdev,
const struct pci_device_id *ent) const struct pci_device_id *ent)
{ {
@ -1815,19 +1830,12 @@ static int __devinit sis190_init_one(struct pci_dev *pdev,
INIT_WORK(&tp->phy_task, sis190_phy_task); INIT_WORK(&tp->phy_task, sis190_phy_task);
dev->open = sis190_open; dev->netdev_ops = &sis190_netdev_ops;
dev->stop = sis190_close;
dev->do_ioctl = sis190_ioctl;
dev->tx_timeout = sis190_tx_timeout;
dev->watchdog_timeo = SIS190_TX_TIMEOUT;
dev->hard_start_xmit = sis190_start_xmit;
#ifdef CONFIG_NET_POLL_CONTROLLER
dev->poll_controller = sis190_netpoll;
#endif
dev->set_multicast_list = sis190_set_rx_mode;
SET_ETHTOOL_OPS(dev, &sis190_ethtool_ops); SET_ETHTOOL_OPS(dev, &sis190_ethtool_ops);
dev->irq = pdev->irq; dev->irq = pdev->irq;
dev->base_addr = (unsigned long) 0xdead; dev->base_addr = (unsigned long) 0xdead;
dev->watchdog_timeo = SIS190_TX_TIMEOUT;
spin_lock_init(&tp->lock); spin_lock_init(&tp->lock);

View file

@ -603,7 +603,6 @@ static int sl_init(struct net_device *dev)
dev->mtu = sl->mtu; dev->mtu = sl->mtu;
dev->type = ARPHRD_SLIP + sl->mode; dev->type = ARPHRD_SLIP + sl->mode;
#ifdef SL_CHECK_TRANSMIT #ifdef SL_CHECK_TRANSMIT
dev->tx_timeout = sl_tx_timeout;
dev->watchdog_timeo = 20*HZ; dev->watchdog_timeo = 20*HZ;
#endif #endif
return 0; return 0;
@ -617,19 +616,26 @@ static void sl_uninit(struct net_device *dev)
sl_free_bufs(sl); sl_free_bufs(sl);
} }
static const struct net_device_ops sl_netdev_ops = {
.ndo_init = sl_init,
.ndo_uninit = sl_uninit,
.ndo_open = sl_open,
.ndo_stop = sl_close,
.ndo_start_xmit = sl_xmit,
.ndo_get_stats = sl_get_stats,
.ndo_change_mtu = sl_change_mtu,
.ndo_tx_timeout = sl_tx_timeout,
#ifdef CONFIG_SLIP_SMART
.ndo_do_ioctl = sl_ioctl,
#endif
};
static void sl_setup(struct net_device *dev) static void sl_setup(struct net_device *dev)
{ {
dev->init = sl_init; dev->netdev_ops = &sl_netdev_ops;
dev->uninit = sl_uninit;
dev->open = sl_open;
dev->destructor = free_netdev; dev->destructor = free_netdev;
dev->stop = sl_close;
dev->get_stats = sl_get_stats;
dev->change_mtu = sl_change_mtu;
dev->hard_start_xmit = sl_xmit;
#ifdef CONFIG_SLIP_SMART
dev->do_ioctl = sl_ioctl;
#endif
dev->hard_header_len = 0; dev->hard_header_len = 0;
dev->addr_len = 0; dev->addr_len = 0;
dev->tx_queue_len = 10; dev->tx_queue_len = 10;

View file

@ -648,6 +648,24 @@ static void netdev_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
#endif /* VLAN_SUPPORT */ #endif /* VLAN_SUPPORT */
static const struct net_device_ops netdev_ops = {
.ndo_open = netdev_open,
.ndo_stop = netdev_close,
.ndo_start_xmit = start_tx,
.ndo_tx_timeout = tx_timeout,
.ndo_get_stats = get_stats,
.ndo_set_multicast_list = &set_rx_mode,
.ndo_do_ioctl = netdev_ioctl,
.ndo_change_mtu = eth_change_mtu,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
#ifdef VLAN_SUPPORT
.ndo_vlan_rx_register = netdev_vlan_rx_register,
.ndo_vlan_rx_add_vid = netdev_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = netdev_vlan_rx_kill_vid,
#endif
};
static int __devinit starfire_init_one(struct pci_dev *pdev, static int __devinit starfire_init_one(struct pci_dev *pdev,
const struct pci_device_id *ent) const struct pci_device_id *ent)
{ {
@ -710,11 +728,9 @@ static int __devinit starfire_init_one(struct pci_dev *pdev,
if (enable_hw_cksum) if (enable_hw_cksum)
dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG; dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG;
#endif /* ZEROCOPY */ #endif /* ZEROCOPY */
#ifdef VLAN_SUPPORT #ifdef VLAN_SUPPORT
dev->features |= NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER; dev->features |= NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER;
dev->vlan_rx_register = netdev_vlan_rx_register;
dev->vlan_rx_add_vid = netdev_vlan_rx_add_vid;
dev->vlan_rx_kill_vid = netdev_vlan_rx_kill_vid;
#endif /* VLAN_RX_KILL_VID */ #endif /* VLAN_RX_KILL_VID */
#ifdef ADDR_64BITS #ifdef ADDR_64BITS
dev->features |= NETIF_F_HIGHDMA; dev->features |= NETIF_F_HIGHDMA;
@ -810,18 +826,12 @@ static int __devinit starfire_init_one(struct pci_dev *pdev,
} }
} }
/* The chip-specific entries in the device structure. */ dev->netdev_ops = &netdev_ops;
dev->open = &netdev_open;
dev->hard_start_xmit = &start_tx;
dev->tx_timeout = tx_timeout;
dev->watchdog_timeo = TX_TIMEOUT; dev->watchdog_timeo = TX_TIMEOUT;
netif_napi_add(dev, &np->napi, netdev_poll, max_interrupt_work);
dev->stop = &netdev_close;
dev->get_stats = &get_stats;
dev->set_multicast_list = &set_rx_mode;
dev->do_ioctl = &netdev_ioctl;
SET_ETHTOOL_OPS(dev, &ethtool_ops); SET_ETHTOOL_OPS(dev, &ethtool_ops);
netif_napi_add(dev, &np->napi, netdev_poll, max_interrupt_work);
if (mtu) if (mtu)
dev->mtu = mtu; dev->mtu = mtu;

View file

@ -449,6 +449,19 @@ static void sundance_reset(struct net_device *dev, unsigned long reset_cmd)
} }
} }
static const struct net_device_ops netdev_ops = {
.ndo_open = netdev_open,
.ndo_stop = netdev_close,
.ndo_start_xmit = start_tx,
.ndo_get_stats = get_stats,
.ndo_set_multicast_list = set_rx_mode,
.ndo_do_ioctl = netdev_ioctl,
.ndo_tx_timeout = tx_timeout,
.ndo_change_mtu = change_mtu,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
};
static int __devinit sundance_probe1 (struct pci_dev *pdev, static int __devinit sundance_probe1 (struct pci_dev *pdev,
const struct pci_device_id *ent) const struct pci_device_id *ent)
{ {
@ -530,16 +543,10 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev,
np->mii_if.reg_num_mask = 0x1f; np->mii_if.reg_num_mask = 0x1f;
/* The chip-specific entries in the device structure. */ /* The chip-specific entries in the device structure. */
dev->open = &netdev_open; dev->netdev_ops = &netdev_ops;
dev->hard_start_xmit = &start_tx;
dev->stop = &netdev_close;
dev->get_stats = &get_stats;
dev->set_multicast_list = &set_rx_mode;
dev->do_ioctl = &netdev_ioctl;
SET_ETHTOOL_OPS(dev, &ethtool_ops); SET_ETHTOOL_OPS(dev, &ethtool_ops);
dev->tx_timeout = &tx_timeout;
dev->watchdog_timeo = TX_TIMEOUT; dev->watchdog_timeo = TX_TIMEOUT;
dev->change_mtu = &change_mtu;
pci_set_drvdata(pdev, dev); pci_set_drvdata(pdev, dev);
i = register_netdev(dev); i = register_netdev(dev);

View file

@ -2989,6 +2989,19 @@ static void gem_remove_one(struct pci_dev *pdev)
} }
} }
static const struct net_device_ops gem_netdev_ops = {
.ndo_open = gem_open,
.ndo_stop = gem_close,
.ndo_start_xmit = gem_start_xmit,
.ndo_get_stats = gem_get_stats,
.ndo_set_multicast_list = gem_set_multicast,
.ndo_do_ioctl = gem_ioctl,
.ndo_tx_timeout = gem_tx_timeout,
.ndo_change_mtu = gem_change_mtu,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
};
static int __devinit gem_init_one(struct pci_dev *pdev, static int __devinit gem_init_one(struct pci_dev *pdev,
const struct pci_device_id *ent) const struct pci_device_id *ent)
{ {
@ -3142,17 +3155,10 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
if (gem_get_device_address(gp)) if (gem_get_device_address(gp))
goto err_out_free_consistent; goto err_out_free_consistent;
dev->open = gem_open; dev->netdev_ops = &gem_netdev_ops;
dev->stop = gem_close;
dev->hard_start_xmit = gem_start_xmit;
dev->get_stats = gem_get_stats;
dev->set_multicast_list = gem_set_multicast;
dev->do_ioctl = gem_ioctl;
netif_napi_add(dev, &gp->napi, gem_poll, 64); netif_napi_add(dev, &gp->napi, gem_poll, 64);
dev->ethtool_ops = &gem_ethtool_ops; dev->ethtool_ops = &gem_ethtool_ops;
dev->tx_timeout = gem_tx_timeout;
dev->watchdog_timeo = 5 * HZ; dev->watchdog_timeo = 5 * HZ;
dev->change_mtu = gem_change_mtu;
dev->irq = pdev->irq; dev->irq = pdev->irq;
dev->dma = 0; dev->dma = 0;
dev->set_mac_address = gem_set_mac_address; dev->set_mac_address = gem_set_mac_address;

View file

@ -2607,6 +2607,18 @@ static struct quattro * __devinit quattro_pci_find(struct pci_dev *pdev)
} }
#endif /* CONFIG_PCI */ #endif /* CONFIG_PCI */
static const struct net_device_ops hme_netdev_ops = {
.ndo_open = happy_meal_open,
.ndo_stop = happy_meal_close,
.ndo_start_xmit = happy_meal_start_xmit,
.ndo_tx_timeout = happy_meal_tx_timeout,
.ndo_get_stats = happy_meal_get_stats,
.ndo_set_multicast_list = happy_meal_set_multicast,
.ndo_change_mtu = eth_change_mtu,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
};
#ifdef CONFIG_SBUS #ifdef CONFIG_SBUS
static int __devinit happy_meal_sbus_probe_one(struct of_device *op, int is_qfe) static int __devinit happy_meal_sbus_probe_one(struct of_device *op, int is_qfe)
{ {
@ -2750,12 +2762,7 @@ static int __devinit happy_meal_sbus_probe_one(struct of_device *op, int is_qfe)
init_timer(&hp->happy_timer); init_timer(&hp->happy_timer);
hp->dev = dev; hp->dev = dev;
dev->open = &happy_meal_open; dev->netdev_ops = &hme_netdev_ops;
dev->stop = &happy_meal_close;
dev->hard_start_xmit = &happy_meal_start_xmit;
dev->get_stats = &happy_meal_get_stats;
dev->set_multicast_list = &happy_meal_set_multicast;
dev->tx_timeout = &happy_meal_tx_timeout;
dev->watchdog_timeo = 5*HZ; dev->watchdog_timeo = 5*HZ;
dev->ethtool_ops = &hme_ethtool_ops; dev->ethtool_ops = &hme_ethtool_ops;
@ -3076,12 +3083,7 @@ static int __devinit happy_meal_pci_probe(struct pci_dev *pdev,
init_timer(&hp->happy_timer); init_timer(&hp->happy_timer);
hp->dev = dev; hp->dev = dev;
dev->open = &happy_meal_open; dev->netdev_ops = &hme_netdev_ops;
dev->stop = &happy_meal_close;
dev->hard_start_xmit = &happy_meal_start_xmit;
dev->get_stats = &happy_meal_get_stats;
dev->set_multicast_list = &happy_meal_set_multicast;
dev->tx_timeout = &happy_meal_tx_timeout;
dev->watchdog_timeo = 5*HZ; dev->watchdog_timeo = 5*HZ;
dev->ethtool_ops = &hme_ethtool_ops; dev->ethtool_ops = &hme_ethtool_ops;
dev->irq = pdev->irq; dev->irq = pdev->irq;

View file

@ -831,6 +831,21 @@ static void TLan_Poll(struct net_device *dev)
} }
#endif #endif
static const struct net_device_ops TLan_netdev_ops = {
.ndo_open = TLan_Open,
.ndo_stop = TLan_Close,
.ndo_start_xmit = TLan_StartTx,
.ndo_tx_timeout = TLan_tx_timeout,
.ndo_get_stats = TLan_GetStats,
.ndo_set_multicast_list = TLan_SetMulticastList,
.ndo_do_ioctl = TLan_ioctl,
.ndo_change_mtu = eth_change_mtu,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = TLan_Poll,
#endif
};
@ -892,16 +907,7 @@ static int TLan_Init( struct net_device *dev )
netif_carrier_off(dev); netif_carrier_off(dev);
/* Device methods */ /* Device methods */
dev->open = &TLan_Open; dev->netdev_ops = &TLan_netdev_ops;
dev->hard_start_xmit = &TLan_StartTx;
dev->stop = &TLan_Close;
dev->get_stats = &TLan_GetStats;
dev->set_multicast_list = &TLan_SetMulticastList;
dev->do_ioctl = &TLan_ioctl;
#ifdef CONFIG_NET_POLL_CONTROLLER
dev->poll_controller = &TLan_Poll;
#endif
dev->tx_timeout = &TLan_tx_timeout;
dev->watchdog_timeo = TX_TIMEOUT; dev->watchdog_timeo = TX_TIMEOUT;
return 0; return 0;

View file

@ -1922,6 +1922,18 @@ bad_srom:
goto fill_defaults; goto fill_defaults;
} }
static const struct net_device_ops de_netdev_ops = {
.ndo_open = de_open,
.ndo_stop = de_close,
.ndo_set_multicast_list = de_set_rx_mode,
.ndo_start_xmit = de_start_xmit,
.ndo_get_stats = de_get_stats,
.ndo_tx_timeout = de_tx_timeout,
.ndo_change_mtu = eth_change_mtu,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
};
static int __devinit de_init_one (struct pci_dev *pdev, static int __devinit de_init_one (struct pci_dev *pdev,
const struct pci_device_id *ent) const struct pci_device_id *ent)
{ {
@ -1944,14 +1956,9 @@ static int __devinit de_init_one (struct pci_dev *pdev,
if (!dev) if (!dev)
return -ENOMEM; return -ENOMEM;
dev->netdev_ops = &de_netdev_ops;
SET_NETDEV_DEV(dev, &pdev->dev); SET_NETDEV_DEV(dev, &pdev->dev);
dev->open = de_open;
dev->stop = de_close;
dev->set_multicast_list = de_set_rx_mode;
dev->hard_start_xmit = de_start_xmit;
dev->get_stats = de_get_stats;
dev->ethtool_ops = &de_ethtool_ops; dev->ethtool_ops = &de_ethtool_ops;
dev->tx_timeout = de_tx_timeout;
dev->watchdog_timeo = TX_TIMEOUT; dev->watchdog_timeo = TX_TIMEOUT;
de = netdev_priv(dev); de = netdev_priv(dev);

View file

@ -1077,6 +1077,18 @@ static int (*dc_infoblock[])(struct net_device *dev, u_char, u_char *) = {
mdelay(2); /* Wait for 2ms */\ mdelay(2); /* Wait for 2ms */\
} }
static const struct net_device_ops de4x5_netdev_ops = {
.ndo_open = de4x5_open,
.ndo_stop = de4x5_close,
.ndo_start_xmit = de4x5_queue_pkt,
.ndo_get_stats = de4x5_get_stats,
.ndo_set_multicast_list = set_multicast_list,
.ndo_do_ioctl = de4x5_ioctl,
.ndo_change_mtu = eth_change_mtu,
.ndo_set_mac_address= eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
};
static int __devinit static int __devinit
de4x5_hw_init(struct net_device *dev, u_long iobase, struct device *gendev) de4x5_hw_init(struct net_device *dev, u_long iobase, struct device *gendev)
@ -1258,13 +1270,7 @@ de4x5_hw_init(struct net_device *dev, u_long iobase, struct device *gendev)
/* The DE4X5-specific entries in the device structure. */ /* The DE4X5-specific entries in the device structure. */
SET_NETDEV_DEV(dev, gendev); SET_NETDEV_DEV(dev, gendev);
dev->open = &de4x5_open; dev->netdev_ops = &de4x5_netdev_ops;
dev->hard_start_xmit = &de4x5_queue_pkt;
dev->stop = &de4x5_close;
dev->get_stats = &de4x5_get_stats;
dev->set_multicast_list = &set_multicast_list;
dev->do_ioctl = &de4x5_ioctl;
dev->mem_start = 0; dev->mem_start = 0;
/* Fill in the generic fields of the device structure. */ /* Fill in the generic fields of the device structure. */

View file

@ -257,9 +257,6 @@ struct dmfe_board_info {
u8 wol_mode; /* user WOL settings */ u8 wol_mode; /* user WOL settings */
struct timer_list timer; struct timer_list timer;
/* System defined statistic counter */
struct net_device_stats stats;
/* Driver defined statistic counter */ /* Driver defined statistic counter */
unsigned long tx_fifo_underrun; unsigned long tx_fifo_underrun;
unsigned long tx_loss_carrier; unsigned long tx_loss_carrier;
@ -316,7 +313,6 @@ static u8 SF_mode; /* Special Function: 1:VLAN, 2:RX Flow Control
static int dmfe_open(struct DEVICE *); static int dmfe_open(struct DEVICE *);
static int dmfe_start_xmit(struct sk_buff *, struct DEVICE *); static int dmfe_start_xmit(struct sk_buff *, struct DEVICE *);
static int dmfe_stop(struct DEVICE *); static int dmfe_stop(struct DEVICE *);
static struct net_device_stats * dmfe_get_stats(struct DEVICE *);
static void dmfe_set_filter_mode(struct DEVICE *); static void dmfe_set_filter_mode(struct DEVICE *);
static const struct ethtool_ops netdev_ethtool_ops; static const struct ethtool_ops netdev_ethtool_ops;
static u16 read_srom_word(long ,int); static u16 read_srom_word(long ,int);
@ -351,6 +347,19 @@ static void dmfe_set_phyxcer(struct dmfe_board_info *);
/* DM910X network board routine ---------------------------- */ /* DM910X network board routine ---------------------------- */
static const struct net_device_ops netdev_ops = {
.ndo_open = dmfe_open,
.ndo_stop = dmfe_stop,
.ndo_start_xmit = dmfe_start_xmit,
.ndo_set_multicast_list = dmfe_set_filter_mode,
.ndo_change_mtu = eth_change_mtu,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = poll_dmfe,
#endif
};
/* /*
* Search DM910X board ,allocate space and register it * Search DM910X board ,allocate space and register it
*/ */
@ -442,14 +451,7 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev,
dev->base_addr = db->ioaddr; dev->base_addr = db->ioaddr;
dev->irq = pdev->irq; dev->irq = pdev->irq;
pci_set_drvdata(pdev, dev); pci_set_drvdata(pdev, dev);
dev->open = &dmfe_open; dev->netdev_ops = &netdev_ops;
dev->hard_start_xmit = &dmfe_start_xmit;
dev->stop = &dmfe_stop;
dev->get_stats = &dmfe_get_stats;
dev->set_multicast_list = &dmfe_set_filter_mode;
#ifdef CONFIG_NET_POLL_CONTROLLER
dev->poll_controller = &poll_dmfe;
#endif
dev->ethtool_ops = &netdev_ethtool_ops; dev->ethtool_ops = &netdev_ethtool_ops;
netif_carrier_off(dev); netif_carrier_off(dev);
spin_lock_init(&db->lock); spin_lock_init(&db->lock);
@ -867,15 +869,15 @@ static void dmfe_free_tx_pkt(struct DEVICE *dev, struct dmfe_board_info * db)
/* A packet sent completed */ /* A packet sent completed */
db->tx_packet_cnt--; db->tx_packet_cnt--;
db->stats.tx_packets++; dev->stats.tx_packets++;
/* Transmit statistic counter */ /* Transmit statistic counter */
if ( tdes0 != 0x7fffffff ) { if ( tdes0 != 0x7fffffff ) {
/* printk(DRV_NAME ": tdes0=%x\n", tdes0); */ /* printk(DRV_NAME ": tdes0=%x\n", tdes0); */
db->stats.collisions += (tdes0 >> 3) & 0xf; dev->stats.collisions += (tdes0 >> 3) & 0xf;
db->stats.tx_bytes += le32_to_cpu(txptr->tdes1) & 0x7ff; dev->stats.tx_bytes += le32_to_cpu(txptr->tdes1) & 0x7ff;
if (tdes0 & TDES0_ERR_MASK) { if (tdes0 & TDES0_ERR_MASK) {
db->stats.tx_errors++; dev->stats.tx_errors++;
if (tdes0 & 0x0002) { /* UnderRun */ if (tdes0 & 0x0002) { /* UnderRun */
db->tx_fifo_underrun++; db->tx_fifo_underrun++;
@ -969,13 +971,13 @@ static void dmfe_rx_packet(struct DEVICE *dev, struct dmfe_board_info * db)
if (rdes0 & 0x8000) { if (rdes0 & 0x8000) {
/* This is a error packet */ /* This is a error packet */
//printk(DRV_NAME ": rdes0: %lx\n", rdes0); //printk(DRV_NAME ": rdes0: %lx\n", rdes0);
db->stats.rx_errors++; dev->stats.rx_errors++;
if (rdes0 & 1) if (rdes0 & 1)
db->stats.rx_fifo_errors++; dev->stats.rx_fifo_errors++;
if (rdes0 & 2) if (rdes0 & 2)
db->stats.rx_crc_errors++; dev->stats.rx_crc_errors++;
if (rdes0 & 0x80) if (rdes0 & 0x80)
db->stats.rx_length_errors++; dev->stats.rx_length_errors++;
} }
if ( !(rdes0 & 0x8000) || if ( !(rdes0 & 0x8000) ||
@ -1008,8 +1010,8 @@ static void dmfe_rx_packet(struct DEVICE *dev, struct dmfe_board_info * db)
skb->protocol = eth_type_trans(skb, dev); skb->protocol = eth_type_trans(skb, dev);
netif_rx(skb); netif_rx(skb);
db->stats.rx_packets++; dev->stats.rx_packets++;
db->stats.rx_bytes += rxlen; dev->stats.rx_bytes += rxlen;
} }
} else { } else {
/* Reuse SKB buffer when the packet is error */ /* Reuse SKB buffer when the packet is error */
@ -1024,20 +1026,6 @@ static void dmfe_rx_packet(struct DEVICE *dev, struct dmfe_board_info * db)
db->rx_ready_ptr = rxptr; db->rx_ready_ptr = rxptr;
} }
/*
* Get statistics from driver.
*/
static struct net_device_stats * dmfe_get_stats(struct DEVICE *dev)
{
struct dmfe_board_info *db = netdev_priv(dev);
DMFE_DBUG(0, "dmfe_get_stats", 0);
return &db->stats;
}
/* /*
* Set DM910X multicast address * Set DM910X multicast address
*/ */
@ -1161,7 +1149,7 @@ static void dmfe_timer(unsigned long data)
/* Operating Mode Check */ /* Operating Mode Check */
if ( (db->dm910x_chk_mode & 0x1) && if ( (db->dm910x_chk_mode & 0x1) &&
(db->stats.rx_packets > MAX_CHECK_PACKET) ) (dev->stats.rx_packets > MAX_CHECK_PACKET) )
db->dm910x_chk_mode = 0x4; db->dm910x_chk_mode = 0x4;
/* Dynamic reset DM910X : system error or transmit time-out */ /* Dynamic reset DM910X : system error or transmit time-out */

View file

@ -1225,6 +1225,22 @@ static int tulip_uli_dm_quirk(struct pci_dev *pdev)
return 0; return 0;
} }
static const struct net_device_ops tulip_netdev_ops = {
.ndo_open = tulip_open,
.ndo_start_xmit = tulip_start_xmit,
.ndo_tx_timeout = tulip_tx_timeout,
.ndo_stop = tulip_close,
.ndo_get_stats = tulip_get_stats,
.ndo_do_ioctl = private_ioctl,
.ndo_set_multicast_list = set_rx_mode,
.ndo_change_mtu = eth_change_mtu,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = poll_tulip,
#endif
};
static int __devinit tulip_init_one (struct pci_dev *pdev, static int __devinit tulip_init_one (struct pci_dev *pdev,
const struct pci_device_id *ent) const struct pci_device_id *ent)
{ {
@ -1601,19 +1617,10 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
} }
/* The Tulip-specific entries in the device structure. */ /* The Tulip-specific entries in the device structure. */
dev->open = tulip_open; dev->netdev_ops = &tulip_netdev_ops;
dev->hard_start_xmit = tulip_start_xmit;
dev->tx_timeout = tulip_tx_timeout;
dev->watchdog_timeo = TX_TIMEOUT; dev->watchdog_timeo = TX_TIMEOUT;
#ifdef CONFIG_TULIP_NAPI #ifdef CONFIG_TULIP_NAPI
netif_napi_add(dev, &tp->napi, tulip_poll, 16); netif_napi_add(dev, &tp->napi, tulip_poll, 16);
#endif
dev->stop = tulip_close;
dev->get_stats = tulip_get_stats;
dev->do_ioctl = private_ioctl;
dev->set_multicast_list = set_rx_mode;
#ifdef CONFIG_NET_POLL_CONTROLLER
dev->poll_controller = &poll_tulip;
#endif #endif
SET_ETHTOOL_OPS(dev, &ops); SET_ETHTOOL_OPS(dev, &ops);

View file

@ -168,9 +168,6 @@ struct uli526x_board_info {
u8 wait_reset; /* Hardware failed, need to reset */ u8 wait_reset; /* Hardware failed, need to reset */
struct timer_list timer; struct timer_list timer;
/* System defined statistic counter */
struct net_device_stats stats;
/* Driver defined statistic counter */ /* Driver defined statistic counter */
unsigned long tx_fifo_underrun; unsigned long tx_fifo_underrun;
unsigned long tx_loss_carrier; unsigned long tx_loss_carrier;
@ -220,7 +217,6 @@ static int mode = 8;
static int uli526x_open(struct net_device *); static int uli526x_open(struct net_device *);
static int uli526x_start_xmit(struct sk_buff *, struct net_device *); static int uli526x_start_xmit(struct sk_buff *, struct net_device *);
static int uli526x_stop(struct net_device *); static int uli526x_stop(struct net_device *);
static struct net_device_stats * uli526x_get_stats(struct net_device *);
static void uli526x_set_filter_mode(struct net_device *); static void uli526x_set_filter_mode(struct net_device *);
static const struct ethtool_ops netdev_ethtool_ops; static const struct ethtool_ops netdev_ethtool_ops;
static u16 read_srom_word(long, int); static u16 read_srom_word(long, int);
@ -251,6 +247,19 @@ static void uli526x_set_phyxcer(struct uli526x_board_info *);
/* ULI526X network board routine ---------------------------- */ /* ULI526X network board routine ---------------------------- */
static const struct net_device_ops netdev_ops = {
.ndo_open = uli526x_open,
.ndo_stop = uli526x_stop,
.ndo_start_xmit = uli526x_start_xmit,
.ndo_set_multicast_list = uli526x_set_filter_mode,
.ndo_change_mtu = eth_change_mtu,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = uli526x_poll,
#endif
};
/* /*
* Search ULI526X board, allocate space and register it * Search ULI526X board, allocate space and register it
*/ */
@ -335,15 +344,9 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev,
pci_set_drvdata(pdev, dev); pci_set_drvdata(pdev, dev);
/* Register some necessary functions */ /* Register some necessary functions */
dev->open = &uli526x_open; dev->netdev_ops = &netdev_ops;
dev->hard_start_xmit = &uli526x_start_xmit;
dev->stop = &uli526x_stop;
dev->get_stats = &uli526x_get_stats;
dev->set_multicast_list = &uli526x_set_filter_mode;
dev->ethtool_ops = &netdev_ethtool_ops; dev->ethtool_ops = &netdev_ethtool_ops;
#ifdef CONFIG_NET_POLL_CONTROLLER
dev->poll_controller = &uli526x_poll;
#endif
spin_lock_init(&db->lock); spin_lock_init(&db->lock);
@ -733,7 +736,8 @@ static void uli526x_poll(struct net_device *dev)
* Free TX resource after TX complete * Free TX resource after TX complete
*/ */
static void uli526x_free_tx_pkt(struct net_device *dev, struct uli526x_board_info * db) static void uli526x_free_tx_pkt(struct net_device *dev,
struct uli526x_board_info * db)
{ {
struct tx_desc *txptr; struct tx_desc *txptr;
u32 tdes0; u32 tdes0;
@ -747,15 +751,15 @@ static void uli526x_free_tx_pkt(struct net_device *dev, struct uli526x_board_inf
/* A packet sent completed */ /* A packet sent completed */
db->tx_packet_cnt--; db->tx_packet_cnt--;
db->stats.tx_packets++; dev->stats.tx_packets++;
/* Transmit statistic counter */ /* Transmit statistic counter */
if ( tdes0 != 0x7fffffff ) { if ( tdes0 != 0x7fffffff ) {
/* printk(DRV_NAME ": tdes0=%x\n", tdes0); */ /* printk(DRV_NAME ": tdes0=%x\n", tdes0); */
db->stats.collisions += (tdes0 >> 3) & 0xf; dev->stats.collisions += (tdes0 >> 3) & 0xf;
db->stats.tx_bytes += le32_to_cpu(txptr->tdes1) & 0x7ff; dev->stats.tx_bytes += le32_to_cpu(txptr->tdes1) & 0x7ff;
if (tdes0 & TDES0_ERR_MASK) { if (tdes0 & TDES0_ERR_MASK) {
db->stats.tx_errors++; dev->stats.tx_errors++;
if (tdes0 & 0x0002) { /* UnderRun */ if (tdes0 & 0x0002) { /* UnderRun */
db->tx_fifo_underrun++; db->tx_fifo_underrun++;
if ( !(db->cr6_data & CR6_SFT) ) { if ( !(db->cr6_data & CR6_SFT) ) {
@ -825,13 +829,13 @@ static void uli526x_rx_packet(struct net_device *dev, struct uli526x_board_info
if (rdes0 & 0x8000) { if (rdes0 & 0x8000) {
/* This is a error packet */ /* This is a error packet */
//printk(DRV_NAME ": rdes0: %lx\n", rdes0); //printk(DRV_NAME ": rdes0: %lx\n", rdes0);
db->stats.rx_errors++; dev->stats.rx_errors++;
if (rdes0 & 1) if (rdes0 & 1)
db->stats.rx_fifo_errors++; dev->stats.rx_fifo_errors++;
if (rdes0 & 2) if (rdes0 & 2)
db->stats.rx_crc_errors++; dev->stats.rx_crc_errors++;
if (rdes0 & 0x80) if (rdes0 & 0x80)
db->stats.rx_length_errors++; dev->stats.rx_length_errors++;
} }
if ( !(rdes0 & 0x8000) || if ( !(rdes0 & 0x8000) ||
@ -854,8 +858,8 @@ static void uli526x_rx_packet(struct net_device *dev, struct uli526x_board_info
skb->protocol = eth_type_trans(skb, dev); skb->protocol = eth_type_trans(skb, dev);
netif_rx(skb); netif_rx(skb);
db->stats.rx_packets++; dev->stats.rx_packets++;
db->stats.rx_bytes += rxlen; dev->stats.rx_bytes += rxlen;
} else { } else {
/* Reuse SKB buffer when the packet is error */ /* Reuse SKB buffer when the packet is error */
@ -871,19 +875,6 @@ static void uli526x_rx_packet(struct net_device *dev, struct uli526x_board_info
} }
/*
* Get statistics from driver.
*/
static struct net_device_stats * uli526x_get_stats(struct net_device *dev)
{
struct uli526x_board_info *db = netdev_priv(dev);
ULI526X_DBUG(0, "uli526x_get_stats", 0);
return &db->stats;
}
/* /*
* Set ULI526X multicast address * Set ULI526X multicast address
*/ */

View file

@ -343,7 +343,18 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
static const struct ethtool_ops netdev_ethtool_ops; static const struct ethtool_ops netdev_ethtool_ops;
static int netdev_close(struct net_device *dev); static int netdev_close(struct net_device *dev);
static const struct net_device_ops netdev_ops = {
.ndo_open = netdev_open,
.ndo_stop = netdev_close,
.ndo_start_xmit = start_tx,
.ndo_get_stats = get_stats,
.ndo_set_multicast_list = set_rx_mode,
.ndo_do_ioctl = netdev_ioctl,
.ndo_tx_timeout = tx_timeout,
.ndo_change_mtu = eth_change_mtu,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
};
static int __devinit w840_probe1 (struct pci_dev *pdev, static int __devinit w840_probe1 (struct pci_dev *pdev,
const struct pci_device_id *ent) const struct pci_device_id *ent)
@ -420,14 +431,8 @@ static int __devinit w840_probe1 (struct pci_dev *pdev,
np->mii_if.force_media = 1; np->mii_if.force_media = 1;
/* The chip-specific entries in the device structure. */ /* The chip-specific entries in the device structure. */
dev->open = &netdev_open; dev->netdev_ops = &netdev_ops;
dev->hard_start_xmit = &start_tx;
dev->stop = &netdev_close;
dev->get_stats = &get_stats;
dev->set_multicast_list = &set_rx_mode;
dev->do_ioctl = &netdev_ioctl;
dev->ethtool_ops = &netdev_ethtool_ops; dev->ethtool_ops = &netdev_ethtool_ops;
dev->tx_timeout = &tx_timeout;
dev->watchdog_timeo = TX_TIMEOUT; dev->watchdog_timeo = TX_TIMEOUT;
i = register_netdev(dev); i = register_netdev(dev);
@ -1555,7 +1560,7 @@ static void __devexit w840_remove1 (struct pci_dev *pdev)
* rtnl_lock, & netif_device_detach after the rtnl_unlock. * rtnl_lock, & netif_device_detach after the rtnl_unlock.
* - get_stats: * - get_stats:
* spin_lock_irq(np->lock), doesn't touch hw if not present * spin_lock_irq(np->lock), doesn't touch hw if not present
* - hard_start_xmit: * - start_xmit:
* synchronize_irq + netif_tx_disable; * synchronize_irq + netif_tx_disable;
* - tx_timeout: * - tx_timeout:
* netif_device_detach + netif_tx_disable; * netif_device_detach + netif_tx_disable;

View file

@ -104,10 +104,8 @@ struct xircom_private {
*/ */
spinlock_t lock; spinlock_t lock;
struct pci_dev *pdev; struct pci_dev *pdev;
struct net_device *dev; struct net_device *dev;
struct net_device_stats stats;
}; };
@ -119,7 +117,6 @@ static int xircom_start_xmit(struct sk_buff *skb, struct net_device *dev);
static int xircom_open(struct net_device *dev); static int xircom_open(struct net_device *dev);
static int xircom_close(struct net_device *dev); static int xircom_close(struct net_device *dev);
static void xircom_up(struct xircom_private *card); static void xircom_up(struct xircom_private *card);
static struct net_device_stats *xircom_get_stats(struct net_device *dev);
#ifdef CONFIG_NET_POLL_CONTROLLER #ifdef CONFIG_NET_POLL_CONTROLLER
static void xircom_poll_controller(struct net_device *dev); static void xircom_poll_controller(struct net_device *dev);
#endif #endif
@ -194,6 +191,18 @@ static const struct ethtool_ops netdev_ethtool_ops = {
.get_drvinfo = netdev_get_drvinfo, .get_drvinfo = netdev_get_drvinfo,
}; };
static const struct net_device_ops netdev_ops = {
.ndo_open = xircom_open,
.ndo_stop = xircom_close,
.ndo_start_xmit = xircom_start_xmit,
.ndo_change_mtu = eth_change_mtu,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = xircom_poll_controller,
#endif
};
/* xircom_probe is the code that gets called on device insertion. /* xircom_probe is the code that gets called on device insertion.
it sets up the hardware and registers the device to the networklayer. it sets up the hardware and registers the device to the networklayer.
@ -266,13 +275,7 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_
read_mac_address(private); read_mac_address(private);
setup_descriptors(private); setup_descriptors(private);
dev->open = &xircom_open; dev->netdev_ops = &netdev_ops;
dev->hard_start_xmit = &xircom_start_xmit;
dev->stop = &xircom_close;
dev->get_stats = &xircom_get_stats;
#ifdef CONFIG_NET_POLL_CONTROLLER
dev->poll_controller = &xircom_poll_controller;
#endif
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
pci_set_drvdata(pdev, dev); pci_set_drvdata(pdev, dev);
@ -497,14 +500,6 @@ static int xircom_close(struct net_device *dev)
} }
static struct net_device_stats *xircom_get_stats(struct net_device *dev)
{
struct xircom_private *card = netdev_priv(dev);
return &card->stats;
}
#ifdef CONFIG_NET_POLL_CONTROLLER #ifdef CONFIG_NET_POLL_CONTROLLER
static void xircom_poll_controller(struct net_device *dev) static void xircom_poll_controller(struct net_device *dev)
{ {
@ -1193,7 +1188,7 @@ static void investigate_read_descriptor(struct net_device *dev,struct xircom_pri
skb = dev_alloc_skb(pkt_len + 2); skb = dev_alloc_skb(pkt_len + 2);
if (skb == NULL) { if (skb == NULL) {
card->stats.rx_dropped++; dev->stats.rx_dropped++;
goto out; goto out;
} }
skb_reserve(skb, 2); skb_reserve(skb, 2);
@ -1201,8 +1196,8 @@ static void investigate_read_descriptor(struct net_device *dev,struct xircom_pri
skb_put(skb, pkt_len); skb_put(skb, pkt_len);
skb->protocol = eth_type_trans(skb, dev); skb->protocol = eth_type_trans(skb, dev);
netif_rx(skb); netif_rx(skb);
card->stats.rx_packets++; dev->stats.rx_packets++;
card->stats.rx_bytes += pkt_len; dev->stats.rx_bytes += pkt_len;
out: out:
/* give the buffer back to the card */ /* give the buffer back to the card */
@ -1232,16 +1227,16 @@ static void investigate_write_descriptor(struct net_device *dev, struct xircom_p
#endif #endif
if (status > 0) { /* bit 31 is 0 when done */ if (status > 0) { /* bit 31 is 0 when done */
if (card->tx_skb[descnr]!=NULL) { if (card->tx_skb[descnr]!=NULL) {
card->stats.tx_bytes += card->tx_skb[descnr]->len; dev->stats.tx_bytes += card->tx_skb[descnr]->len;
dev_kfree_skb_irq(card->tx_skb[descnr]); dev_kfree_skb_irq(card->tx_skb[descnr]);
} }
card->tx_skb[descnr] = NULL; card->tx_skb[descnr] = NULL;
/* Bit 8 in the status field is 1 if there was a collision */ /* Bit 8 in the status field is 1 if there was a collision */
if (status&(1<<8)) if (status&(1<<8))
card->stats.collisions++; dev->stats.collisions++;
card->tx_buffer[4*descnr] = 0; /* descriptor is free again */ card->tx_buffer[4*descnr] = 0; /* descriptor is free again */
netif_wake_queue (dev); netif_wake_queue (dev);
card->stats.tx_packets++; dev->stats.tx_packets++;
} }
leave("investigate_write_descriptor"); leave("investigate_write_descriptor");

View file

@ -2296,6 +2296,19 @@ out:
return mode; return mode;
} }
static const struct net_device_ops typhoon_netdev_ops = {
.ndo_open = typhoon_open,
.ndo_stop = typhoon_close,
.ndo_start_xmit = typhoon_start_tx,
.ndo_set_multicast_list = typhoon_set_rx_mode,
.ndo_tx_timeout = typhoon_tx_timeout,
.ndo_get_stats = typhoon_get_stats,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = typhoon_set_mac_address,
.ndo_change_mtu = eth_change_mtu,
.ndo_vlan_rx_register = typhoon_vlan_rx_register,
};
static int __devinit static int __devinit
typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
{ {
@ -2495,16 +2508,9 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
} }
/* The chip-specific entries in the device structure. */ /* The chip-specific entries in the device structure. */
dev->open = typhoon_open; dev->netdev_ops = &typhoon_netdev_ops;
dev->hard_start_xmit = typhoon_start_tx;
dev->stop = typhoon_close;
dev->set_multicast_list = typhoon_set_rx_mode;
dev->tx_timeout = typhoon_tx_timeout;
netif_napi_add(dev, &tp->napi, typhoon_poll, 16); netif_napi_add(dev, &tp->napi, typhoon_poll, 16);
dev->watchdog_timeo = TX_TIMEOUT; dev->watchdog_timeo = TX_TIMEOUT;
dev->get_stats = typhoon_get_stats;
dev->set_mac_address = typhoon_set_mac_address;
dev->vlan_rx_register = typhoon_vlan_rx_register;
SET_ETHTOOL_OPS(dev, &typhoon_ethtool_ops); SET_ETHTOOL_OPS(dev, &typhoon_ethtool_ops);

View file

@ -23,7 +23,7 @@
#include <linux/usb/usbnet.h> #include <linux/usb/usbnet.h>
/* datasheet: /* datasheet:
http://www.davicom.com.tw/big5/download/Data%20Sheet/DM9601-DS-P01-930914.pdf http://ptm2.cc.utu.fi/ftp/network/cards/DM9601/From_NET/DM9601-DS-P01-930914.pdf
*/ */
/* control requests */ /* control requests */
@ -397,16 +397,24 @@ static void dm9601_set_multicast(struct net_device *net)
dm_write_reg_async(dev, DM_RX_CTRL, rx_ctl); dm_write_reg_async(dev, DM_RX_CTRL, rx_ctl);
} }
static void __dm9601_set_mac_address(struct usbnet *dev)
{
dm_write_async(dev, DM_PHY_ADDR, ETH_ALEN, dev->net->dev_addr);
}
static int dm9601_set_mac_address(struct net_device *net, void *p) static int dm9601_set_mac_address(struct net_device *net, void *p)
{ {
struct sockaddr *addr = p; struct sockaddr *addr = p;
struct usbnet *dev = netdev_priv(net); struct usbnet *dev = netdev_priv(net);
if (!is_valid_ether_addr(addr->sa_data)) if (!is_valid_ether_addr(addr->sa_data)) {
dev_err(&net->dev, "not setting invalid mac address %pM\n",
addr->sa_data);
return -EINVAL; return -EINVAL;
}
memcpy(net->dev_addr, addr->sa_data, net->addr_len); memcpy(net->dev_addr, addr->sa_data, net->addr_len);
dm_write_async(dev, DM_PHY_ADDR, net->addr_len, net->dev_addr); __dm9601_set_mac_address(dev);
return 0; return 0;
} }
@ -414,6 +422,7 @@ static int dm9601_set_mac_address(struct net_device *net, void *p)
static int dm9601_bind(struct usbnet *dev, struct usb_interface *intf) static int dm9601_bind(struct usbnet *dev, struct usb_interface *intf)
{ {
int ret; int ret;
u8 mac[ETH_ALEN];
ret = usbnet_get_endpoints(dev, intf); ret = usbnet_get_endpoints(dev, intf);
if (ret) if (ret)
@ -438,12 +447,24 @@ static int dm9601_bind(struct usbnet *dev, struct usb_interface *intf)
udelay(20); udelay(20);
/* read MAC */ /* read MAC */
if (dm_read(dev, DM_PHY_ADDR, ETH_ALEN, dev->net->dev_addr) < 0) { if (dm_read(dev, DM_PHY_ADDR, ETH_ALEN, mac) < 0) {
printk(KERN_ERR "Error reading MAC address\n"); printk(KERN_ERR "Error reading MAC address\n");
ret = -ENODEV; ret = -ENODEV;
goto out; goto out;
} }
/*
* Overwrite the auto-generated address only with good ones.
*/
if (is_valid_ether_addr(mac))
memcpy(dev->net->dev_addr, mac, ETH_ALEN);
else {
printk(KERN_WARNING
"dm9601: No valid MAC address in EEPROM, using %pM\n",
dev->net->dev_addr);
__dm9601_set_mac_address(dev);
}
/* power up phy */ /* power up phy */
dm_write_reg(dev, DM_GPR_CTRL, 1); dm_write_reg(dev, DM_GPR_CTRL, 1);
dm_write_reg(dev, DM_GPR_DATA, 0); dm_write_reg(dev, DM_GPR_DATA, 0);

View file

@ -251,7 +251,6 @@ struct kaweth_device
struct net_device_stats stats; struct net_device_stats stats;
}; };
/**************************************************************** /****************************************************************
* kaweth_control * kaweth_control
****************************************************************/ ****************************************************************/
@ -975,6 +974,17 @@ static int kaweth_resume(struct usb_interface *intf)
/**************************************************************** /****************************************************************
* kaweth_probe * kaweth_probe
****************************************************************/ ****************************************************************/
static const struct net_device_ops kaweth_netdev_ops = {
.ndo_open = kaweth_open,
.ndo_stop = kaweth_close,
.ndo_start_xmit = kaweth_start_xmit,
.ndo_tx_timeout = kaweth_tx_timeout,
.ndo_set_multicast_list = kaweth_set_rx_mode,
.ndo_get_stats = kaweth_netdev_stats,
};
static int kaweth_probe( static int kaweth_probe(
struct usb_interface *intf, struct usb_interface *intf,
const struct usb_device_id *id /* from id_table */ const struct usb_device_id *id /* from id_table */
@ -1147,22 +1157,13 @@ err_fw:
memcpy(netdev->dev_addr, &kaweth->configuration.hw_addr, memcpy(netdev->dev_addr, &kaweth->configuration.hw_addr,
sizeof(kaweth->configuration.hw_addr)); sizeof(kaweth->configuration.hw_addr));
netdev->open = kaweth_open; netdev->netdev_ops = &kaweth_netdev_ops;
netdev->stop = kaweth_close;
netdev->watchdog_timeo = KAWETH_TX_TIMEOUT; netdev->watchdog_timeo = KAWETH_TX_TIMEOUT;
netdev->tx_timeout = kaweth_tx_timeout;
netdev->hard_start_xmit = kaweth_start_xmit;
netdev->set_multicast_list = kaweth_set_rx_mode;
netdev->get_stats = kaweth_netdev_stats;
netdev->mtu = le16_to_cpu(kaweth->configuration.segment_size); netdev->mtu = le16_to_cpu(kaweth->configuration.segment_size);
SET_ETHTOOL_OPS(netdev, &ops); SET_ETHTOOL_OPS(netdev, &ops);
/* kaweth is zeroed as part of alloc_netdev */ /* kaweth is zeroed as part of alloc_netdev */
INIT_DELAYED_WORK(&kaweth->lowmem_work, kaweth_resubmit_tl); INIT_DELAYED_WORK(&kaweth->lowmem_work, kaweth_resubmit_tl);
usb_set_intfdata(intf, kaweth); usb_set_intfdata(intf, kaweth);
#if 0 #if 0

View file

@ -93,6 +93,7 @@ module_param (msg_level, int, 0);
MODULE_PARM_DESC (msg_level, "Override default message level"); MODULE_PARM_DESC (msg_level, "Override default message level");
MODULE_DEVICE_TABLE(usb, pegasus_ids); MODULE_DEVICE_TABLE(usb, pegasus_ids);
static const struct net_device_ops pegasus_netdev_ops;
static int update_eth_regs_async(pegasus_t *); static int update_eth_regs_async(pegasus_t *);
/* Aargh!!! I _really_ hate such tweaks */ /* Aargh!!! I _really_ hate such tweaks */
@ -1360,14 +1361,10 @@ static int pegasus_probe(struct usb_interface *intf,
pegasus->intf = intf; pegasus->intf = intf;
pegasus->usb = dev; pegasus->usb = dev;
pegasus->net = net; pegasus->net = net;
net->open = pegasus_open;
net->stop = pegasus_close;
net->watchdog_timeo = PEGASUS_TX_TIMEOUT; net->watchdog_timeo = PEGASUS_TX_TIMEOUT;
net->tx_timeout = pegasus_tx_timeout; net->netdev_ops = &pegasus_netdev_ops;
net->do_ioctl = pegasus_ioctl;
net->hard_start_xmit = pegasus_start_xmit;
net->set_multicast_list = pegasus_set_multicast;
net->get_stats = pegasus_netdev_stats;
SET_ETHTOOL_OPS(net, &ops); SET_ETHTOOL_OPS(net, &ops);
pegasus->mii.dev = net; pegasus->mii.dev = net;
pegasus->mii.mdio_read = mdio_read; pegasus->mii.mdio_read = mdio_read;
@ -1482,6 +1479,16 @@ static int pegasus_resume (struct usb_interface *intf)
return 0; return 0;
} }
static const struct net_device_ops pegasus_netdev_ops = {
.ndo_open = pegasus_open,
.ndo_stop = pegasus_close,
.ndo_do_ioctl = pegasus_ioctl,
.ndo_start_xmit = pegasus_start_xmit,
.ndo_set_multicast_list = pegasus_set_multicast,
.ndo_get_stats = pegasus_netdev_stats,
.ndo_tx_timeout = pegasus_tx_timeout,
};
static struct usb_driver pegasus_driver = { static struct usb_driver pegasus_driver = {
.name = driver_name, .name = driver_name,
.probe = pegasus_probe, .probe = pegasus_probe,

View file

@ -624,6 +624,18 @@ static int virtnet_change_mtu(struct net_device *dev, int new_mtu)
return 0; return 0;
} }
static const struct net_device_ops virtnet_netdev = {
.ndo_open = virtnet_open,
.ndo_stop = virtnet_close,
.ndo_start_xmit = start_xmit,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = eth_mac_addr,
.ndo_change_mtu = virtnet_change_mtu,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = virtnet_netpoll,
#endif
};
static int virtnet_probe(struct virtio_device *vdev) static int virtnet_probe(struct virtio_device *vdev)
{ {
int err; int err;
@ -636,14 +648,8 @@ static int virtnet_probe(struct virtio_device *vdev)
return -ENOMEM; return -ENOMEM;
/* Set up network device as normal. */ /* Set up network device as normal. */
dev->open = virtnet_open; dev->netdev_ops = &virtnet_netdev;
dev->stop = virtnet_close;
dev->hard_start_xmit = start_xmit;
dev->change_mtu = virtnet_change_mtu;
dev->features = NETIF_F_HIGHDMA; dev->features = NETIF_F_HIGHDMA;
#ifdef CONFIG_NET_POLL_CONTROLLER
dev->poll_controller = virtnet_netpoll;
#endif
SET_ETHTOOL_OPS(dev, &virtnet_ethtool_ops); SET_ETHTOOL_OPS(dev, &virtnet_ethtool_ops);
SET_NETDEV_DEV(dev, &vdev->dev); SET_NETDEV_DEV(dev, &vdev->dev);

View file

@ -397,11 +397,13 @@ int i2400mu_probe(struct usb_interface *iface,
i2400m->bus_fw_name = I2400MU_FW_FILE_NAME; i2400m->bus_fw_name = I2400MU_FW_FILE_NAME;
i2400m->bus_bm_mac_addr_impaired = 0; i2400m->bus_bm_mac_addr_impaired = 0;
#ifdef CONFIG_PM
iface->needs_remote_wakeup = 1; /* autosuspend (15s delay) */ iface->needs_remote_wakeup = 1; /* autosuspend (15s delay) */
device_init_wakeup(dev, 1); device_init_wakeup(dev, 1);
usb_autopm_enable(i2400mu->usb_iface); usb_autopm_enable(i2400mu->usb_iface);
usb_dev->autosuspend_delay = 15 * HZ; usb_dev->autosuspend_delay = 15 * HZ;
usb_dev->autosuspend_disabled = 0; usb_dev->autosuspend_disabled = 0;
#endif
result = i2400m_setup(i2400m, I2400M_BRI_MAC_REINIT); result = i2400m_setup(i2400m, I2400M_BRI_MAC_REINIT);
if (result < 0) { if (result < 0) {
@ -493,7 +495,9 @@ int i2400mu_suspend(struct usb_interface *iface, pm_message_t pm_msg)
int result = 0; int result = 0;
struct device *dev = &iface->dev; struct device *dev = &iface->dev;
struct i2400mu *i2400mu = usb_get_intfdata(iface); struct i2400mu *i2400mu = usb_get_intfdata(iface);
#ifdef CONFIG_PM
struct usb_device *usb_dev = i2400mu->usb_dev; struct usb_device *usb_dev = i2400mu->usb_dev;
#endif
struct i2400m *i2400m = &i2400mu->i2400m; struct i2400m *i2400m = &i2400mu->i2400m;
d_fnstart(3, dev, "(iface %p pm_msg %u)\n", iface, pm_msg.event); d_fnstart(3, dev, "(iface %p pm_msg %u)\n", iface, pm_msg.event);
@ -503,11 +507,13 @@ int i2400mu_suspend(struct usb_interface *iface, pm_message_t pm_msg)
atomic_dec(&i2400mu->do_autopm); atomic_dec(&i2400mu->do_autopm);
result = i2400m_cmd_enter_powersave(i2400m); result = i2400m_cmd_enter_powersave(i2400m);
atomic_inc(&i2400mu->do_autopm); atomic_inc(&i2400mu->do_autopm);
#ifdef CONFIG_PM
if (result < 0 && usb_dev->auto_pm == 0) { if (result < 0 && usb_dev->auto_pm == 0) {
/* System suspend, can't fail */ /* System suspend, can't fail */
dev_err(dev, "failed to suspend, will reset on resume\n"); dev_err(dev, "failed to suspend, will reset on resume\n");
result = 0; result = 0;
} }
#endif
if (result < 0) if (result < 0)
goto error_enter_powersave; goto error_enter_powersave;
i2400mu_notification_release(i2400mu); i2400mu_notification_release(i2400mu);

View file

@ -1105,6 +1105,16 @@ static void xennet_uninit(struct net_device *dev)
gnttab_free_grant_references(np->gref_rx_head); gnttab_free_grant_references(np->gref_rx_head);
} }
static const struct net_device_ops xennet_netdev_ops = {
.ndo_open = xennet_open,
.ndo_uninit = xennet_uninit,
.ndo_stop = xennet_close,
.ndo_start_xmit = xennet_start_xmit,
.ndo_change_mtu = xennet_change_mtu,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
};
static struct net_device * __devinit xennet_create_dev(struct xenbus_device *dev) static struct net_device * __devinit xennet_create_dev(struct xenbus_device *dev)
{ {
int i, err; int i, err;
@ -1161,12 +1171,9 @@ static struct net_device * __devinit xennet_create_dev(struct xenbus_device *dev
goto exit_free_tx; goto exit_free_tx;
} }
netdev->open = xennet_open; netdev->netdev_ops = &xennet_netdev_ops;
netdev->hard_start_xmit = xennet_start_xmit;
netdev->stop = xennet_close;
netif_napi_add(netdev, &np->napi, xennet_poll, 64); netif_napi_add(netdev, &np->napi, xennet_poll, 64);
netdev->uninit = xennet_uninit;
netdev->change_mtu = xennet_change_mtu;
netdev->features = NETIF_F_IP_CSUM; netdev->features = NETIF_F_IP_CSUM;
SET_ETHTOOL_OPS(netdev, &xennet_ethtool_ops); SET_ETHTOOL_OPS(netdev, &xennet_ethtool_ops);

View file

@ -916,6 +916,21 @@ static struct ethtool_ops qeth_l2_osn_ops = {
.get_drvinfo = qeth_core_get_drvinfo, .get_drvinfo = qeth_core_get_drvinfo,
}; };
static struct net_device_ops qeth_l2_netdev_ops = {
.ndo_open = qeth_l2_open,
.ndo_stop = qeth_l2_stop,
.ndo_get_stats = qeth_get_stats,
.ndo_start_xmit = qeth_l2_hard_start_xmit,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_multicast_list = qeth_l2_set_multicast_list,
.ndo_do_ioctl = qeth_l2_do_ioctl,
.ndo_set_mac_address = qeth_l2_set_mac_address,
.ndo_change_mtu = qeth_change_mtu,
.ndo_vlan_rx_add_vid = qeth_l2_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = qeth_l2_vlan_rx_kill_vid,
.ndo_tx_timeout = qeth_tx_timeout,
};
static int qeth_l2_setup_netdev(struct qeth_card *card) static int qeth_l2_setup_netdev(struct qeth_card *card)
{ {
switch (card->info.type) { switch (card->info.type) {
@ -937,19 +952,9 @@ static int qeth_l2_setup_netdev(struct qeth_card *card)
return -ENODEV; return -ENODEV;
card->dev->ml_priv = card; card->dev->ml_priv = card;
card->dev->tx_timeout = &qeth_tx_timeout;
card->dev->watchdog_timeo = QETH_TX_TIMEOUT; card->dev->watchdog_timeo = QETH_TX_TIMEOUT;
card->dev->open = qeth_l2_open;
card->dev->stop = qeth_l2_stop;
card->dev->hard_start_xmit = qeth_l2_hard_start_xmit;
card->dev->do_ioctl = qeth_l2_do_ioctl;
card->dev->get_stats = qeth_get_stats;
card->dev->change_mtu = qeth_change_mtu;
card->dev->set_multicast_list = qeth_l2_set_multicast_list;
card->dev->vlan_rx_kill_vid = qeth_l2_vlan_rx_kill_vid;
card->dev->vlan_rx_add_vid = qeth_l2_vlan_rx_add_vid;
card->dev->set_mac_address = qeth_l2_set_mac_address;
card->dev->mtu = card->info.initial_mtu; card->dev->mtu = card->info.initial_mtu;
card->dev->netdev_ops = &qeth_l2_netdev_ops;
if (card->info.type != QETH_CARD_TYPE_OSN) if (card->info.type != QETH_CARD_TYPE_OSN)
SET_ETHTOOL_OPS(card->dev, &qeth_l2_ethtool_ops); SET_ETHTOOL_OPS(card->dev, &qeth_l2_ethtool_ops);
else else

View file

@ -1829,28 +1829,6 @@ static void qeth_l3_vlan_rx_register(struct net_device *dev,
static void qeth_l3_vlan_rx_add_vid(struct net_device *dev, unsigned short vid) static void qeth_l3_vlan_rx_add_vid(struct net_device *dev, unsigned short vid)
{ {
struct net_device *vlandev;
struct qeth_card *card = dev->ml_priv;
struct in_device *in_dev;
if (card->info.type == QETH_CARD_TYPE_IQD)
return;
vlandev = vlan_group_get_device(card->vlangrp, vid);
vlandev->neigh_setup = qeth_l3_neigh_setup;
in_dev = in_dev_get(vlandev);
#ifdef CONFIG_SYSCTL
neigh_sysctl_unregister(in_dev->arp_parms);
#endif
neigh_parms_release(&arp_tbl, in_dev->arp_parms);
in_dev->arp_parms = neigh_parms_alloc(vlandev, &arp_tbl);
#ifdef CONFIG_SYSCTL
neigh_sysctl_register(vlandev, in_dev->arp_parms, NET_IPV4,
NET_IPV4_NEIGH, "ipv4", NULL, NULL);
#endif
in_dev_put(in_dev);
return; return;
} }
@ -2916,6 +2894,21 @@ qeth_l3_neigh_setup(struct net_device *dev, struct neigh_parms *np)
return 0; return 0;
} }
static struct net_device_ops qeth_l3_netdev_ops = {
.ndo_open = qeth_l3_open,
.ndo_stop = qeth_l3_stop,
.ndo_get_stats = qeth_get_stats,
.ndo_start_xmit = qeth_l3_hard_start_xmit,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_multicast_list = qeth_l3_set_multicast_list,
.ndo_do_ioctl = qeth_l3_do_ioctl,
.ndo_change_mtu = qeth_change_mtu,
.ndo_vlan_rx_register = qeth_l3_vlan_rx_register,
.ndo_vlan_rx_add_vid = qeth_l3_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = qeth_l3_vlan_rx_kill_vid,
.ndo_tx_timeout = qeth_tx_timeout,
};
static int qeth_l3_setup_netdev(struct qeth_card *card) static int qeth_l3_setup_netdev(struct qeth_card *card)
{ {
if (card->info.type == QETH_CARD_TYPE_OSAE) { if (card->info.type == QETH_CARD_TYPE_OSAE) {
@ -2930,7 +2923,8 @@ static int qeth_l3_setup_netdev(struct qeth_card *card)
card->dev = alloc_etherdev(0); card->dev = alloc_etherdev(0);
if (!card->dev) if (!card->dev)
return -ENODEV; return -ENODEV;
card->dev->neigh_setup = qeth_l3_neigh_setup; qeth_l3_netdev_ops.ndo_neigh_setup =
qeth_l3_neigh_setup;
/*IPv6 address autoconfiguration stuff*/ /*IPv6 address autoconfiguration stuff*/
qeth_l3_get_unique_id(card); qeth_l3_get_unique_id(card);
@ -2947,21 +2941,10 @@ static int qeth_l3_setup_netdev(struct qeth_card *card)
} else } else
return -ENODEV; return -ENODEV;
card->dev->hard_start_xmit = qeth_l3_hard_start_xmit;
card->dev->ml_priv = card; card->dev->ml_priv = card;
card->dev->tx_timeout = &qeth_tx_timeout;
card->dev->watchdog_timeo = QETH_TX_TIMEOUT; card->dev->watchdog_timeo = QETH_TX_TIMEOUT;
card->dev->open = qeth_l3_open;
card->dev->stop = qeth_l3_stop;
card->dev->do_ioctl = qeth_l3_do_ioctl;
card->dev->get_stats = qeth_get_stats;
card->dev->change_mtu = qeth_change_mtu;
card->dev->set_multicast_list = qeth_l3_set_multicast_list;
card->dev->vlan_rx_register = qeth_l3_vlan_rx_register;
card->dev->vlan_rx_add_vid = qeth_l3_vlan_rx_add_vid;
card->dev->vlan_rx_kill_vid = qeth_l3_vlan_rx_kill_vid;
card->dev->mtu = card->info.initial_mtu; card->dev->mtu = card->info.initial_mtu;
card->dev->set_mac_address = NULL; card->dev->netdev_ops = &qeth_l3_netdev_ops;
SET_ETHTOOL_OPS(card->dev, &qeth_l3_ethtool_ops); SET_ETHTOOL_OPS(card->dev, &qeth_l3_ethtool_ops);
card->dev->features |= NETIF_F_HW_VLAN_TX | card->dev->features |= NETIF_F_HW_VLAN_TX |
NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_RX |

View file

@ -279,6 +279,13 @@ static int pn_net_mtu(struct net_device *dev, int new_mtu)
return err; return err;
} }
static const struct net_device_ops pn_netdev_ops = {
.ndo_open = pn_net_open,
.ndo_stop = pn_net_close,
.ndo_start_xmit = pn_net_xmit,
.ndo_change_mtu = pn_net_mtu,
};
static void pn_net_setup(struct net_device *dev) static void pn_net_setup(struct net_device *dev)
{ {
dev->features = 0; dev->features = 0;
@ -290,12 +297,9 @@ static void pn_net_setup(struct net_device *dev)
dev->addr_len = 1; dev->addr_len = 1;
dev->tx_queue_len = 1; dev->tx_queue_len = 1;
dev->netdev_ops = &pn_netdev_ops;
dev->destructor = free_netdev; dev->destructor = free_netdev;
dev->header_ops = &phonet_header_ops; dev->header_ops = &phonet_header_ops;
dev->open = pn_net_open;
dev->stop = pn_net_close;
dev->hard_start_xmit = pn_net_xmit; /* mandatory */
dev->change_mtu = pn_net_mtu;
} }
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/

View file

@ -716,6 +716,14 @@ static int __init get_ether_addr(const char *str, u8 *dev_addr)
static struct eth_dev *the_dev; static struct eth_dev *the_dev;
static const struct net_device_ops eth_netdev_ops = {
.ndo_open = eth_open,
.ndo_stop = eth_stop,
.ndo_start_xmit = eth_start_xmit,
.ndo_change_mtu = ueth_change_mtu,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
};
/** /**
* gether_setup - initialize one ethernet-over-usb link * gether_setup - initialize one ethernet-over-usb link
@ -764,12 +772,8 @@ int __init gether_setup(struct usb_gadget *g, u8 ethaddr[ETH_ALEN])
if (ethaddr) if (ethaddr)
memcpy(ethaddr, dev->host_mac, ETH_ALEN); memcpy(ethaddr, dev->host_mac, ETH_ALEN);
net->change_mtu = ueth_change_mtu; net->netdev_ops = &eth_netdev_ops;
net->hard_start_xmit = eth_start_xmit;
net->open = eth_open;
net->stop = eth_stop;
/* watchdog_timeo, tx_timeout ... */
/* set_multicast_list */
SET_ETHTOOL_OPS(net, &ops); SET_ETHTOOL_OPS(net, &ops);
/* two kinds of host-initiated state changes: /* two kinds of host-initiated state changes:

View file

@ -221,7 +221,6 @@ struct i1480u {
struct net_device *net_dev; struct net_device *net_dev;
spinlock_t lock; spinlock_t lock;
struct net_device_stats stats;
/* RX context handling */ /* RX context handling */
struct sk_buff *rx_skb; struct sk_buff *rx_skb;
@ -271,7 +270,6 @@ extern int i1480u_stop(struct net_device *);
extern int i1480u_hard_start_xmit(struct sk_buff *, struct net_device *); extern int i1480u_hard_start_xmit(struct sk_buff *, struct net_device *);
extern void i1480u_tx_timeout(struct net_device *); extern void i1480u_tx_timeout(struct net_device *);
extern int i1480u_set_config(struct net_device *, struct ifmap *); extern int i1480u_set_config(struct net_device *, struct ifmap *);
extern struct net_device_stats *i1480u_get_stats(struct net_device *);
extern int i1480u_change_mtu(struct net_device *, int); extern int i1480u_change_mtu(struct net_device *, int);
extern void i1480u_uwb_notifs_cb(void *, struct uwb_dev *, enum uwb_notifs); extern void i1480u_uwb_notifs_cb(void *, struct uwb_dev *, enum uwb_notifs);

View file

@ -181,6 +181,15 @@ error:
} }
#endif #endif
static const struct net_device_ops i1480u_netdev_ops = {
.ndo_open = i1480u_open,
.ndo_stop = i1480u_stop,
.ndo_start_xmit = i1480u_hard_start_xmit,
.ndo_tx_timeout = i1480u_tx_timeout,
.ndo_set_config = i1480u_set_config,
.ndo_change_mtu = i1480u_change_mtu,
};
static static
int i1480u_add(struct i1480u *i1480u, struct usb_interface *iface) int i1480u_add(struct i1480u *i1480u, struct usb_interface *iface)
{ {
@ -235,13 +244,7 @@ int i1480u_add(struct i1480u *i1480u, struct usb_interface *iface)
net_dev->features |= NETIF_F_HIGHDMA; net_dev->features |= NETIF_F_HIGHDMA;
net_dev->watchdog_timeo = 5*HZ; /* FIXME: a better default? */ net_dev->watchdog_timeo = 5*HZ; /* FIXME: a better default? */
net_dev->open = i1480u_open; net_dev->netdev_ops = &i1480u_netdev_ops;
net_dev->stop = i1480u_stop;
net_dev->hard_start_xmit = i1480u_hard_start_xmit;
net_dev->tx_timeout = i1480u_tx_timeout;
net_dev->get_stats = i1480u_get_stats;
net_dev->set_config = i1480u_set_config;
net_dev->change_mtu = i1480u_change_mtu;
#ifdef i1480u_FLOW_CONTROL #ifdef i1480u_FLOW_CONTROL
/* Notification endpoint setup (submitted when we open the device) */ /* Notification endpoint setup (submitted when we open the device) */

View file

@ -262,15 +262,6 @@ int i1480u_stop(struct net_device *net_dev)
return 0; return 0;
} }
/** Report statistics */
struct net_device_stats *i1480u_get_stats(struct net_device *net_dev)
{
struct i1480u *i1480u = netdev_priv(net_dev);
return &i1480u->stats;
}
/** /**
* *
* Change the interface config--we probably don't have to do anything. * Change the interface config--we probably don't have to do anything.

View file

@ -167,7 +167,7 @@ do { \
do { \ do { \
if (printk_ratelimit()) \ if (printk_ratelimit()) \
dev_err(&i1480u->usb_iface->dev, msg); \ dev_err(&i1480u->usb_iface->dev, msg); \
i1480u->stats.rx_dropped++; \ i1480u->net_dev->stats.rx_dropped++; \
} while (0) } while (0)
@ -193,10 +193,8 @@ void i1480u_skb_deliver(struct i1480u *i1480u)
if (!should_parse) if (!should_parse)
goto out; goto out;
i1480u->rx_skb->protocol = eth_type_trans(i1480u->rx_skb, net_dev); i1480u->rx_skb->protocol = eth_type_trans(i1480u->rx_skb, net_dev);
i1480u->stats.rx_packets++; net_dev->stats.rx_packets++;
i1480u->stats.rx_bytes += i1480u->rx_untd_pkt_size; net_dev->stats.rx_bytes += i1480u->rx_untd_pkt_size;
net_dev->last_rx = jiffies;
/* FIXME: flow control: check netif_rx() retval */
netif_rx(i1480u->rx_skb); /* deliver */ netif_rx(i1480u->rx_skb); /* deliver */
out: out:

View file

@ -117,8 +117,8 @@ void i1480u_tx_cb(struct urb *urb)
switch (urb->status) { switch (urb->status) {
case 0: case 0:
spin_lock_irqsave(&i1480u->lock, flags); spin_lock_irqsave(&i1480u->lock, flags);
i1480u->stats.tx_packets++; net_dev->stats.tx_packets++;
i1480u->stats.tx_bytes += urb->actual_length; net_dev->stats.tx_bytes += urb->actual_length;
spin_unlock_irqrestore(&i1480u->lock, flags); spin_unlock_irqrestore(&i1480u->lock, flags);
break; break;
case -ECONNRESET: /* Not an error, but a controlled situation; */ case -ECONNRESET: /* Not an error, but a controlled situation; */
@ -530,7 +530,7 @@ int i1480u_hard_start_xmit(struct sk_buff *skb, struct net_device *net_dev)
return NETDEV_TX_OK; return NETDEV_TX_OK;
error: error:
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
i1480u->stats.tx_dropped++; net_dev->stats.tx_dropped++;
out: out:
return NETDEV_TX_OK; return NETDEV_TX_OK;
} }

View file

@ -37,6 +37,8 @@ fw-shipped-$(CONFIG_CHELSIO_T3) += cxgb3/t3b_psram-1.1.0.bin \
cxgb3/t3c_psram-1.1.0.bin \ cxgb3/t3c_psram-1.1.0.bin \
cxgb3/t3fw-7.0.0.bin cxgb3/t3fw-7.0.0.bin
fw-shipped-$(CONFIG_DVB_TTUSB_BUDGET) += ttusb-budget/dspbootcode.bin fw-shipped-$(CONFIG_DVB_TTUSB_BUDGET) += ttusb-budget/dspbootcode.bin
fw-shipped-$(CONFIG_E100) += e100/d101m_ucode.bin e100/d101s_ucode.bin \
e100/d102e_ucode.bin
fw-shipped-$(CONFIG_SMCTR) += tr_smctr.bin fw-shipped-$(CONFIG_SMCTR) += tr_smctr.bin
fw-shipped-$(CONFIG_SND_KORG1212) += korg/k1212.dsp fw-shipped-$(CONFIG_SND_KORG1212) += korg/k1212.dsp
fw-shipped-$(CONFIG_SND_MAESTRO3) += ess/maestro3_assp_kernel.fw \ fw-shipped-$(CONFIG_SND_MAESTRO3) += ess/maestro3_assp_kernel.fw \

View file

@ -360,6 +360,18 @@ License: GPLv2 or OpenIB.org BSD license, no source visible
-------------------------------------------------------------------------- --------------------------------------------------------------------------
Driver: e100 -- Intel PRO/100 Ethernet NIC
File: e100/d101m_ucode.bin
File: e100/d101s_ucode.bin
File: e100/d102e_ucode.bin
Licence: Unknown
Found in hex form in kernel source.
--------------------------------------------------------------------------
Driver: acenic -- Alteon AceNIC Gigabit Ethernet card Driver: acenic -- Alteon AceNIC Gigabit Ethernet card
File: acenic/tg1.bin File: acenic/tg1.bin

View file

@ -0,0 +1,38 @@
:10000000150255003704FFFFFFFFFFFF8907A70612
:10001000FFFFFFFFFFFF580501000C001213100047
:1000200008000C00160238009C001000564020000A
:10003000CC802300560038009C0010000B4C24009C
:1000400000080000184812003804380000000000C2
:1000500000001400550538000080300062061000D2
:100060006105100008040E006148130002000C0036
:10007000933010000080300024061000610510004D
:1000800008040E00610810007E000C00212C2200E4
:1000900002000C00933010007A0C380000000800B9
:1000A000903010007A0C38000000000000000000C2
:1000B00000000000000000009C0010002D4C2400F7
:1000C000040001000010040037043A00104004004E
:1000D0008A07380000000000990010007A6C2000A8
:1000E0009C001000484C24002408130001000C0060
:1000F00013121000750C260000100400040001000B
:100100002608130006000C00A806220026C91300CA
:1001100013131000A80638000000000000000000C3
:1001200000000000000000000000000000000000CF
:10013000000000000000000000060800101B100076
:10014000040005002608100010121000340C3800BE
:1001500000000000000000005B1521009900100065
:10016000596520009C0010005945240036081300F2
:1001700000000C00620C220001000C00131B100098
:100180000E9C22000E0C21000E6C22000E6C210031
:100190000EFC22000E5C21000E4C2100550538009B
:1001A0000400010000100400678C27000008040010
:1001B0000081010037043A002608130001000C00FA
:1001C00059052200131310005905380000000000E3
:1001D000000000000000000000000000000000001F
:1001E00000000000000000000000000031081300C3
:1001F0000B0910001348120080FF0C00AB0626000C
:100200000010040004000100A806380000000000EF
:0B02100000000000000000004E417ED6
:00000001FF
/********************************************************/
/* Micro code for 8086:1229 Rev 8 */
/********************************************************/

View file

@ -0,0 +1,38 @@
:10000000420255007E04FFFFFFFFFFFF1808FF06B6
:10001000FFFFFFFFFFFFA60501000C0012131000F9
:1000200008000C00430238009C00100056402000DD
:10003000D0802300560038009C0010008B4F240015
:1000400000080000184812007F043800000000007B
:1000500000001400A30538000080300010061000D6
:100060006105100008040E006148130002000C0036
:10007000933010000080300024061000610510004D
:1000800008040E00610810007E000C00A12F220061
:1000900002000C0093301000900F380000000800A0
:1000A00090301000900F38000000000000000000A9
:1000B00000000000000000009C001000AD4F240074
:1000C00004000100001004007E043A001040040007
:1000D000190838000000000099001000FD6F200092
:1000E0009A001000FDAF20009C001000C84F2400B3
:1000F0002408130001000C0013121000F70F260053
:1001000000100400040001002608130006000C0083
:100110000007220026C9130013131000000738003F
:1001200000000000000000000000000000000000CF
:10013000000000000000000000060800101B100076
:10014000040005002608100010121000B60F380039
:100150000000000000000000A91521009900100017
:10016000A76520009A001000A7A520009C001000A1
:10017000A74524003608130000000C00E40F2200FD
:1001800001000C00131B10008E9F22008E0F210017
:100190008E6F22008E6F21008EFF22008E5F210065
:1001A0008E4F2100A3053800040001000010040058
:1001B000E98F270000080400008101007E043A0056
:1001C0002608130001000C00A705220013131000DD
:1001D000A70538000000000000000000000000003B
:1001E000000000000000000000000000000000000F
:1001F00000000000310813000B0910001348120022
:1002000080FF0C000307260000100400040001001A
:0B02100000073800000000004E438093
:00000001FF
/********************************************************/
/* Micro code for 8086:1229 Rev 9 */
/********************************************************/

View file

@ -0,0 +1,38 @@
:100000008F027D00F904420E850CED14E914FA14F8
:10001000360EF70EFF1FFF1FB914E00000000000AE
:100020000000000000000000BD14E000000000001F
:100030000000000000000000D514E00000000000F7
:1000400000000000000000000000000000000000B0
:100050000000000000000000C114E00000000000EB
:100060000000000000000000000000000000000090
:100070000000000000000000000000000000000080
:100080000000000000000000000000000000000070
:100090000000000000000000C814E00000000000A4
:1000A000000000000000000000062000EE14E00048
:1000B000000000000000000080FF3000460E9400A9
:1000C0000082030000201000430EE000000000004A
:1000D000000000000000000006003000FB14E000FB
:1000E0000000000000000000000000000000000010
:1000F0000000000000000000000000000000000000
:1001000000000000000000000000000000000000EF
:100110000000000000000000416E90003C0E8000D6
:10012000390EE00000000000FD6E9000FD0E900012
:10013000F80EE000000000000000000000000000D9
:1001400000000000000000000000000000000000AF
:10015000000000000000000000000000000000009F
:10016000000000000000000000000000000000008F
:10017000000000000000000000000000000000007F
:10018000000000000000000000000000000000006F
:10019000000000000000000000000000000000005F
:1001A000000000000000000000000000000000004F
:1001B000000000000000000000000000000000003F
:1001C000000000000000000000000000000000002F
:1001D000000000000000000000000000000000001F
:1001E000000000000000000000000000000000000F
:1001F00000000000000000000000000000000000FF
:1002000000000000000000000000000000000000EE
:0B02100000000000000000002A362E55
:00000001FF
/********************************************************/
/* Micro code for the 8086:1229 Rev F/10 */
/********************************************************/

View file

@ -19,7 +19,7 @@
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#define CAN_VERSION "20081130" #define CAN_VERSION "20090105"
/* increment this number each time you change some user-space interface */ /* increment this number each time you change some user-space interface */
#define CAN_ABI_VERSION "8" #define CAN_ABI_VERSION "8"

View file

@ -115,6 +115,11 @@ extern u16 vlan_dev_vlan_id(const struct net_device *dev);
extern int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp, extern int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp,
u16 vlan_tci, int polling); u16 vlan_tci, int polling);
extern int vlan_hwaccel_do_receive(struct sk_buff *skb); extern int vlan_hwaccel_do_receive(struct sk_buff *skb);
extern int vlan_gro_receive(struct napi_struct *napi, struct vlan_group *grp,
unsigned int vlan_tci, struct sk_buff *skb);
extern int vlan_gro_frags(struct napi_struct *napi, struct vlan_group *grp,
unsigned int vlan_tci,
struct napi_gro_fraginfo *info);
#else #else
static inline struct net_device *vlan_dev_real_dev(const struct net_device *dev) static inline struct net_device *vlan_dev_real_dev(const struct net_device *dev)
@ -140,6 +145,20 @@ static inline int vlan_hwaccel_do_receive(struct sk_buff *skb)
{ {
return 0; return 0;
} }
static inline int vlan_gro_receive(struct napi_struct *napi,
struct vlan_group *grp,
unsigned int vlan_tci, struct sk_buff *skb)
{
return NET_RX_DROP;
}
static inline int vlan_gro_frags(struct napi_struct *napi,
struct vlan_group *grp, unsigned int vlan_tci,
struct napi_gro_fraginfo *info)
{
return NET_RX_DROP;
}
#endif #endif
/** /**

Some files were not shown because too many files have changed in this diff Show more