Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 127808
b: refs/heads/master
c: 2765df5
h: refs/heads/master
v: v3
  • Loading branch information
Stephen Hemminger authored and David S. Miller committed Jan 8, 2009
1 parent 0f30761 commit 1e19667
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 38 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1034c9f69ae7b61d408836e60c6a2b5afc6e48bc
refs/heads/master: 2765df58986ac4382b70bf31be70a64a7a9eaf4c
62 changes: 25 additions & 37 deletions trunk/drivers/net/tulip/dmfe.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,6 @@ struct dmfe_board_info {
u8 wol_mode; /* user WOL settings */
struct timer_list timer;

/* System defined statistic counter */
struct net_device_stats stats;

/* Driver defined statistic counter */
unsigned long tx_fifo_underrun;
unsigned long tx_loss_carrier;
Expand Down Expand Up @@ -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_start_xmit(struct sk_buff *, 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 const struct ethtool_ops netdev_ethtool_ops;
static u16 read_srom_word(long ,int);
Expand Down Expand Up @@ -351,6 +347,19 @@ static void dmfe_set_phyxcer(struct dmfe_board_info *);

/* 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
*/
Expand Down Expand Up @@ -442,14 +451,7 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev,
dev->base_addr = db->ioaddr;
dev->irq = pdev->irq;
pci_set_drvdata(pdev, dev);
dev->open = &dmfe_open;
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->netdev_ops = &netdev_ops;
dev->ethtool_ops = &netdev_ethtool_ops;
netif_carrier_off(dev);
spin_lock_init(&db->lock);
Expand Down Expand Up @@ -867,15 +869,15 @@ static void dmfe_free_tx_pkt(struct DEVICE *dev, struct dmfe_board_info * db)

/* A packet sent completed */
db->tx_packet_cnt--;
db->stats.tx_packets++;
dev->stats.tx_packets++;

/* Transmit statistic counter */
if ( tdes0 != 0x7fffffff ) {
/* printk(DRV_NAME ": tdes0=%x\n", tdes0); */
db->stats.collisions += (tdes0 >> 3) & 0xf;
db->stats.tx_bytes += le32_to_cpu(txptr->tdes1) & 0x7ff;
dev->stats.collisions += (tdes0 >> 3) & 0xf;
dev->stats.tx_bytes += le32_to_cpu(txptr->tdes1) & 0x7ff;
if (tdes0 & TDES0_ERR_MASK) {
db->stats.tx_errors++;
dev->stats.tx_errors++;

if (tdes0 & 0x0002) { /* UnderRun */
db->tx_fifo_underrun++;
Expand Down Expand Up @@ -969,13 +971,13 @@ static void dmfe_rx_packet(struct DEVICE *dev, struct dmfe_board_info * db)
if (rdes0 & 0x8000) {
/* This is a error packet */
//printk(DRV_NAME ": rdes0: %lx\n", rdes0);
db->stats.rx_errors++;
dev->stats.rx_errors++;
if (rdes0 & 1)
db->stats.rx_fifo_errors++;
dev->stats.rx_fifo_errors++;
if (rdes0 & 2)
db->stats.rx_crc_errors++;
dev->stats.rx_crc_errors++;
if (rdes0 & 0x80)
db->stats.rx_length_errors++;
dev->stats.rx_length_errors++;
}

if ( !(rdes0 & 0x8000) ||
Expand Down Expand Up @@ -1008,8 +1010,8 @@ static void dmfe_rx_packet(struct DEVICE *dev, struct dmfe_board_info * db)

skb->protocol = eth_type_trans(skb, dev);
netif_rx(skb);
db->stats.rx_packets++;
db->stats.rx_bytes += rxlen;
dev->stats.rx_packets++;
dev->stats.rx_bytes += rxlen;
}
} else {
/* Reuse SKB buffer when the packet is error */
Expand All @@ -1024,20 +1026,6 @@ static void dmfe_rx_packet(struct DEVICE *dev, struct dmfe_board_info * db)
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
*/
Expand Down Expand Up @@ -1161,7 +1149,7 @@ static void dmfe_timer(unsigned long data)

/* Operating Mode Check */
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;

/* Dynamic reset DM910X : system error or transmit time-out */
Expand Down

0 comments on commit 1e19667

Please sign in to comment.