Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 21200
b: refs/heads/master
c: 23a56e2
h: refs/heads/master
v: v3
  • Loading branch information
Jeff Garzik committed Feb 7, 2006
1 parent f01d7fa commit 7f5ef09
Show file tree
Hide file tree
Showing 14 changed files with 221 additions and 110 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: 6bd0e10e53cc4824cd8cdaab8c370e53ab2e23c2
refs/heads/master: 23a56e2cbec2860ef02d6720508fbcb07accc8b4
38 changes: 26 additions & 12 deletions trunk/drivers/net/8139too.c
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,7 @@ struct rtl8139_private {
dma_addr_t tx_bufs_dma;
signed char phys[4]; /* MII device addresses. */
char twistie, twist_row, twist_col; /* Twister tune state. */
unsigned int watchdog_fired : 1;
unsigned int default_port : 4; /* Last dev->if_port value. */
unsigned int have_thread : 1;
spinlock_t lock;
Expand Down Expand Up @@ -638,6 +639,7 @@ static void rtl8139_set_rx_mode (struct net_device *dev);
static void __set_rx_mode (struct net_device *dev);
static void rtl8139_hw_start (struct net_device *dev);
static void rtl8139_thread (void *_data);
static void rtl8139_tx_timeout_task(void *_data);
static struct ethtool_ops rtl8139_ethtool_ops;

/* write MMIO register, with flush */
Expand Down Expand Up @@ -1598,13 +1600,14 @@ static void rtl8139_thread (void *_data)
{
struct net_device *dev = _data;
struct rtl8139_private *tp = netdev_priv(dev);
unsigned long thr_delay;
unsigned long thr_delay = next_tick;

if (rtnl_shlock_nowait() == 0) {
if (tp->watchdog_fired) {
tp->watchdog_fired = 0;
rtl8139_tx_timeout_task(_data);
} else if (rtnl_shlock_nowait() == 0) {
rtl8139_thread_iter (dev, tp, tp->mmio_addr);
rtnl_unlock ();

thr_delay = next_tick;
} else {
/* unlikely race. mitigate with fast poll. */
thr_delay = HZ / 2;
Expand All @@ -1631,7 +1634,8 @@ static void rtl8139_stop_thread(struct rtl8139_private *tp)
if (tp->have_thread) {
cancel_rearming_delayed_work(&tp->thread);
tp->have_thread = 0;
}
} else
flush_scheduled_work();
}

static inline void rtl8139_tx_clear (struct rtl8139_private *tp)
Expand All @@ -1642,14 +1646,13 @@ static inline void rtl8139_tx_clear (struct rtl8139_private *tp)
/* XXX account for unsent Tx packets in tp->stats.tx_dropped */
}


static void rtl8139_tx_timeout (struct net_device *dev)
static void rtl8139_tx_timeout_task (void *_data)
{
struct net_device *dev = _data;
struct rtl8139_private *tp = netdev_priv(dev);
void __iomem *ioaddr = tp->mmio_addr;
int i;
u8 tmp8;
unsigned long flags;

printk (KERN_DEBUG "%s: Transmit timeout, status %2.2x %4.4x %4.4x "
"media %2.2x.\n", dev->name, RTL_R8 (ChipCmd),
Expand All @@ -1670,23 +1673,34 @@ static void rtl8139_tx_timeout (struct net_device *dev)
if (tmp8 & CmdTxEnb)
RTL_W8 (ChipCmd, CmdRxEnb);

spin_lock(&tp->rx_lock);
spin_lock_bh(&tp->rx_lock);
/* Disable interrupts by clearing the interrupt mask. */
RTL_W16 (IntrMask, 0x0000);

/* Stop a shared interrupt from scavenging while we are. */
spin_lock_irqsave (&tp->lock, flags);
spin_lock_irq(&tp->lock);
rtl8139_tx_clear (tp);
spin_unlock_irqrestore (&tp->lock, flags);
spin_unlock_irq(&tp->lock);

/* ...and finally, reset everything */
if (netif_running(dev)) {
rtl8139_hw_start (dev);
netif_wake_queue (dev);
}
spin_unlock(&tp->rx_lock);
spin_unlock_bh(&tp->rx_lock);
}

static void rtl8139_tx_timeout (struct net_device *dev)
{
struct rtl8139_private *tp = netdev_priv(dev);

if (!tp->have_thread) {
INIT_WORK(&tp->thread, rtl8139_tx_timeout_task, dev);
schedule_delayed_work(&tp->thread, next_tick);
} else
tp->watchdog_fired = 1;

}

static int rtl8139_start_xmit (struct sk_buff *skb, struct net_device *dev)
{
Expand Down
15 changes: 14 additions & 1 deletion trunk/drivers/net/bonding/bond_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,8 @@ int bond_sethwaddr(struct net_device *bond_dev, struct net_device *slave_dev)
}

#define BOND_INTERSECT_FEATURES \
(NETIF_F_SG|NETIF_F_IP_CSUM|NETIF_F_NO_CSUM|NETIF_F_HW_CSUM)
(NETIF_F_SG|NETIF_F_IP_CSUM|NETIF_F_NO_CSUM|NETIF_F_HW_CSUM|\
NETIF_F_TSO|NETIF_F_UFO)

/*
* Compute the common dev->feature set available to all slaves. Some
Expand All @@ -1168,6 +1169,16 @@ static int bond_compute_features(struct bonding *bond)
NETIF_F_HW_CSUM)))
features &= ~NETIF_F_SG;

/*
* features will include NETIF_F_TSO (NETIF_F_UFO) iff all
* slave devices support NETIF_F_TSO (NETIF_F_UFO), which
* implies that all slaves also support scatter-gather
* (NETIF_F_SG), which implies that features also includes
* NETIF_F_SG. So no need to check whether we have an
* illegal combination of NETIF_F_{TSO,UFO} and
* !NETIF_F_SG
*/

features |= (bond_dev->features & ~BOND_INTERSECT_FEATURES);
bond_dev->features = features;

Expand Down Expand Up @@ -4080,6 +4091,8 @@ static void bond_ethtool_get_drvinfo(struct net_device *bond_dev,

static struct ethtool_ops bond_ethtool_ops = {
.get_tx_csum = ethtool_op_get_tx_csum,
.get_tso = ethtool_op_get_tso,
.get_ufo = ethtool_op_get_ufo,
.get_sg = ethtool_op_get_sg,
.get_drvinfo = bond_ethtool_get_drvinfo,
};
Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/net/bonding/bond_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ static ssize_t bonding_store_slaves(struct class_device *cd, const char *buffer,
char *ifname;
int i, res, found, ret = count;
struct slave *slave;
struct net_device *dev = 0;
struct net_device *dev = NULL;
struct bonding *bond = to_bond(cd);

/* Quick sanity check -- is the bond interface up? */
Expand Down Expand Up @@ -995,7 +995,7 @@ static ssize_t bonding_store_primary(struct class_device *cd, const char *buf, s
printk(KERN_INFO DRV_NAME
": %s: Setting primary slave to None.\n",
bond->dev->name);
bond->primary_slave = 0;
bond->primary_slave = NULL;
bond_select_active_slave(bond);
} else {
printk(KERN_INFO DRV_NAME
Expand Down Expand Up @@ -1123,7 +1123,7 @@ static ssize_t bonding_store_active_slave(struct class_device *cd, const char *b
printk(KERN_INFO DRV_NAME
": %s: Setting active slave to None.\n",
bond->dev->name);
bond->primary_slave = 0;
bond->primary_slave = NULL;
bond_select_active_slave(bond);
} else {
printk(KERN_INFO DRV_NAME
Expand Down
2 changes: 0 additions & 2 deletions trunk/drivers/net/e100.c
Original file line number Diff line number Diff line change
Expand Up @@ -2752,8 +2752,6 @@ static int e100_resume(struct pci_dev *pdev)
retval = pci_enable_wake(pdev, 0, 0);
if (retval)
DPRINTK(PROBE,ERR, "Error clearing wake events\n");
if(e100_hw_init(nic))
DPRINTK(HW, ERR, "e100_hw_init failed\n");

netif_device_attach(netdev);
if(netif_running(netdev))
Expand Down
24 changes: 11 additions & 13 deletions trunk/drivers/net/gianfar.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,7 @@ static int gfar_probe(struct platform_device *pdev)

/* get a pointer to the register memory */
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
priv->regs = (struct gfar *)
ioremap(r->start, sizeof (struct gfar));
priv->regs = ioremap(r->start, sizeof (struct gfar));

if (NULL == priv->regs) {
err = -ENOMEM;
Expand Down Expand Up @@ -369,7 +368,7 @@ static int gfar_probe(struct platform_device *pdev)
return 0;

register_fail:
iounmap((void *) priv->regs);
iounmap(priv->regs);
regs_fail:
free_netdev(dev);
return err;
Expand All @@ -382,7 +381,7 @@ static int gfar_remove(struct platform_device *pdev)

platform_set_drvdata(pdev, NULL);

iounmap((void *) priv->regs);
iounmap(priv->regs);
free_netdev(dev);

return 0;
Expand Down Expand Up @@ -454,8 +453,7 @@ static void init_registers(struct net_device *dev)

/* Zero out the rmon mib registers if it has them */
if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_RMON) {
memset((void *) &(priv->regs->rmon), 0,
sizeof (struct rmon_mib));
memset_io(&(priv->regs->rmon), 0, sizeof (struct rmon_mib));

/* Mask off the CAM interrupts */
gfar_write(&priv->regs->rmon.cam1, 0xffffffff);
Expand All @@ -477,7 +475,7 @@ static void init_registers(struct net_device *dev)
void gfar_halt(struct net_device *dev)
{
struct gfar_private *priv = netdev_priv(dev);
struct gfar *regs = priv->regs;
struct gfar __iomem *regs = priv->regs;
u32 tempval;

/* Mask all interrupts */
Expand Down Expand Up @@ -507,7 +505,7 @@ void gfar_halt(struct net_device *dev)
void stop_gfar(struct net_device *dev)
{
struct gfar_private *priv = netdev_priv(dev);
struct gfar *regs = priv->regs;
struct gfar __iomem *regs = priv->regs;
unsigned long flags;

phy_stop(priv->phydev);
Expand Down Expand Up @@ -590,7 +588,7 @@ static void free_skb_resources(struct gfar_private *priv)
void gfar_start(struct net_device *dev)
{
struct gfar_private *priv = netdev_priv(dev);
struct gfar *regs = priv->regs;
struct gfar __iomem *regs = priv->regs;
u32 tempval;

/* Enable Rx and Tx in MACCFG1 */
Expand Down Expand Up @@ -624,7 +622,7 @@ int startup_gfar(struct net_device *dev)
unsigned long vaddr;
int i;
struct gfar_private *priv = netdev_priv(dev);
struct gfar *regs = priv->regs;
struct gfar __iomem *regs = priv->regs;
int err = 0;
u32 rctrl = 0;
u32 attrs = 0;
Expand Down Expand Up @@ -1622,7 +1620,7 @@ static irqreturn_t gfar_interrupt(int irq, void *dev_id, struct pt_regs *regs)
static void adjust_link(struct net_device *dev)
{
struct gfar_private *priv = netdev_priv(dev);
struct gfar *regs = priv->regs;
struct gfar __iomem *regs = priv->regs;
unsigned long flags;
struct phy_device *phydev = priv->phydev;
int new_state = 0;
Expand Down Expand Up @@ -1703,7 +1701,7 @@ static void gfar_set_multi(struct net_device *dev)
{
struct dev_mc_list *mc_ptr;
struct gfar_private *priv = netdev_priv(dev);
struct gfar *regs = priv->regs;
struct gfar __iomem *regs = priv->regs;
u32 tempval;

if(dev->flags & IFF_PROMISC) {
Expand Down Expand Up @@ -1842,7 +1840,7 @@ static void gfar_set_mac_for_addr(struct net_device *dev, int num, u8 *addr)
int idx;
char tmpbuf[MAC_ADDR_LEN];
u32 tempval;
u32 *macptr = &priv->regs->macstnaddr1;
u32 __iomem *macptr = &priv->regs->macstnaddr1;

macptr += num*2;

Expand Down
8 changes: 4 additions & 4 deletions trunk/drivers/net/gianfar.h
Original file line number Diff line number Diff line change
Expand Up @@ -682,8 +682,8 @@ struct gfar_private {
struct rxbd8 *cur_rx; /* Next free rx ring entry */
struct txbd8 *cur_tx; /* Next free ring entry */
struct txbd8 *dirty_tx; /* The Ring entry to be freed. */
struct gfar *regs; /* Pointer to the GFAR memory mapped Registers */
u32 *hash_regs[16];
struct gfar __iomem *regs; /* Pointer to the GFAR memory mapped Registers */
u32 __iomem *hash_regs[16];
int hash_width;
struct net_device_stats stats; /* linux network statistics */
struct gfar_extra_stats extra_stats;
Expand Down Expand Up @@ -718,14 +718,14 @@ struct gfar_private {
uint32_t msg_enable;
};

static inline u32 gfar_read(volatile unsigned *addr)
static inline u32 gfar_read(volatile unsigned __iomem *addr)
{
u32 val;
val = in_be32(addr);
return val;
}

static inline void gfar_write(volatile unsigned *addr, u32 val)
static inline void gfar_write(volatile unsigned __iomem *addr, u32 val)
{
out_be32(addr, val);
}
Expand Down
8 changes: 4 additions & 4 deletions trunk/drivers/net/gianfar_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,11 @@ static void gfar_fill_stats(struct net_device *dev, struct ethtool_stats *dummy,
u64 *extra = (u64 *) & priv->extra_stats;

if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_RMON) {
u32 *rmon = (u32 *) & priv->regs->rmon;
u32 __iomem *rmon = (u32 __iomem *) & priv->regs->rmon;
struct gfar_stats *stats = (struct gfar_stats *) buf;

for (i = 0; i < GFAR_RMON_LEN; i++)
stats->rmon[i] = (u64) (rmon[i]);
stats->rmon[i] = (u64) gfar_read(&rmon[i]);

for (i = 0; i < GFAR_EXTRA_STATS_LEN; i++)
stats->extra[i] = extra[i];
Expand Down Expand Up @@ -221,11 +221,11 @@ static void gfar_get_regs(struct net_device *dev, struct ethtool_regs *regs, voi
{
int i;
struct gfar_private *priv = netdev_priv(dev);
u32 *theregs = (u32 *) priv->regs;
u32 __iomem *theregs = (u32 __iomem *) priv->regs;
u32 *buf = (u32 *) regbuf;

for (i = 0; i < sizeof (struct gfar) / sizeof (u32); i++)
buf[i] = theregs[i];
buf[i] = gfar_read(&theregs[i]);
}

/* Convert microseconds to ethernet clock ticks, which changes
Expand Down
Loading

0 comments on commit 7f5ef09

Please sign in to comment.