Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 10336
b: refs/heads/master
c: 6ba98d3
h: refs/heads/master
v: v3
  • Loading branch information
John W. Linville authored and Jeff Garzik committed Oct 19, 2005
1 parent f051f69 commit 62a272f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 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: 923833405d8d81b5be036093773d88d87fc7e1bd
refs/heads/master: 6ba98d311d0a4ff7dc36d8f435ce60174f4c30ec
34 changes: 31 additions & 3 deletions trunk/drivers/net/via-rhine.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,13 +490,17 @@ struct rhine_private {
u8 tx_thresh, rx_thresh;

struct mii_if_info mii_if;
struct work_struct tx_timeout_task;
struct work_struct check_media_task;
void __iomem *base;
};

static int mdio_read(struct net_device *dev, int phy_id, int location);
static void mdio_write(struct net_device *dev, int phy_id, int location, int value);
static int rhine_open(struct net_device *dev);
static void rhine_tx_timeout(struct net_device *dev);
static void rhine_tx_timeout_task(struct net_device *dev);
static void rhine_check_media_task(struct net_device *dev);
static int rhine_start_tx(struct sk_buff *skb, struct net_device *dev);
static irqreturn_t rhine_interrupt(int irq, void *dev_instance, struct pt_regs *regs);
static void rhine_tx(struct net_device *dev);
Expand Down Expand Up @@ -851,6 +855,12 @@ static int __devinit rhine_init_one(struct pci_dev *pdev,
if (rp->quirks & rqRhineI)
dev->features |= NETIF_F_SG|NETIF_F_HW_CSUM;

INIT_WORK(&rp->tx_timeout_task,
(void (*)(void *))rhine_tx_timeout_task, dev);

INIT_WORK(&rp->check_media_task,
(void (*)(void *))rhine_check_media_task, dev);

/* dev->name not defined before register_netdev()! */
rc = register_netdev(dev);
if (rc)
Expand Down Expand Up @@ -1077,6 +1087,11 @@ static void rhine_check_media(struct net_device *dev, unsigned int init_media)
ioaddr + ChipCmd1);
}

static void rhine_check_media_task(struct net_device *dev)
{
rhine_check_media(dev, 0);
}

static void init_registers(struct net_device *dev)
{
struct rhine_private *rp = netdev_priv(dev);
Expand Down Expand Up @@ -1130,8 +1145,8 @@ static void rhine_disable_linkmon(void __iomem *ioaddr, u32 quirks)
if (quirks & rqRhineI) {
iowrite8(0x01, ioaddr + MIIRegAddr); // MII_BMSR

/* Can be called from ISR. Evil. */
mdelay(1);
/* Do not call from ISR! */
msleep(1);

/* 0x80 must be set immediately before turning it off */
iowrite8(0x80, ioaddr + MIICmd);
Expand Down Expand Up @@ -1219,6 +1234,16 @@ static int rhine_open(struct net_device *dev)
}

static void rhine_tx_timeout(struct net_device *dev)
{
struct rhine_private *rp = netdev_priv(dev);

/*
* Move bulk of work outside of interrupt context
*/
schedule_work(&rp->tx_timeout_task);
}

static void rhine_tx_timeout_task(struct net_device *dev)
{
struct rhine_private *rp = netdev_priv(dev);
void __iomem *ioaddr = rp->base;
Expand Down Expand Up @@ -1626,7 +1651,7 @@ static void rhine_error(struct net_device *dev, int intr_status)
spin_lock(&rp->lock);

if (intr_status & IntrLinkChange)
rhine_check_media(dev, 0);
schedule_work(&rp->check_media_task);
if (intr_status & IntrStatsMax) {
rp->stats.rx_crc_errors += ioread16(ioaddr + RxCRCErrs);
rp->stats.rx_missed_errors += ioread16(ioaddr + RxMissed);
Expand Down Expand Up @@ -1874,6 +1899,9 @@ static int rhine_close(struct net_device *dev)
spin_unlock_irq(&rp->lock);

free_irq(rp->pdev->irq, dev);

flush_scheduled_work();

free_rbufs(dev);
free_tbufs(dev);
free_ring(dev);
Expand Down

0 comments on commit 62a272f

Please sign in to comment.