ChangeSet 1.1966.82.1, 2005/01/18 01:43:40-05:00, [EMAIL PROTECTED]
Merge pobox.com:/garz/repo/linux-2.6
into pobox.com:/garz/repo/netdev-2.6/8139too
8139too.c | 97 ++++++++++++++++++++++++++++++--------------------------------
1 files changed, 47 insertions(+), 50 deletions(-)
diff -Nru a/drivers/net/8139too.c b/drivers/net/8139too.c
--- a/drivers/net/8139too.c 2005-03-07 11:20:29 -08:00
+++ b/drivers/net/8139too.c 2005-03-07 11:20:29 -08:00
@@ -389,8 +389,14 @@
/* Bits in TxConfig. */
enum tx_config_bits {
- TxIFG1 = (1 << 25), /* Interframe Gap Time */
- TxIFG0 = (1 << 24), /* Enabling these bits violates IEEE 802.3 */
+
+ /* Interframe Gap Time. Only TxIFG96 doesn't violate IEEE 802.3 */
+ TxIFGShift = 24,
+ TxIFG84 = (0 << TxIFGShift), /* 8.4us / 840ns (10 / 100Mbps) */
+ TxIFG88 = (1 << TxIFGShift), /* 8.8us / 880ns (10 / 100Mbps) */
+ TxIFG92 = (2 << TxIFGShift), /* 9.2us / 920ns (10 / 100Mbps) */
+ TxIFG96 = (3 << TxIFGShift), /* 9.6us / 960ns (10 / 100Mbps) */
+
TxLoopBack = (1 << 18) | (1 << 17), /* enable loopback test mode */
TxCRC = (1 << 16), /* DISABLE appending CRC to end of Tx packets */
TxClearAbt = (1 << 0), /* Clear abort (WO) */
@@ -723,17 +729,14 @@
#endif
static const unsigned int rtl8139_tx_config =
- (TX_DMA_BURST << TxDMAShift) | (TX_RETRY << TxRetryShift);
+ TxIFG96 | (TX_DMA_BURST << TxDMAShift) | (TX_RETRY << TxRetryShift);
static void __rtl8139_cleanup_dev (struct net_device *dev)
{
- struct rtl8139_private *tp;
+ struct rtl8139_private *tp = netdev_priv(dev);
struct pci_dev *pdev;
assert (dev != NULL);
- assert (dev->priv != NULL);
-
- tp = dev->priv;
assert (tp->pci_dev != NULL);
pdev = tp->pci_dev;
@@ -746,7 +749,7 @@
pci_release_regions (pdev);
free_netdev(dev);
-
+ pci_disable_device(pdev);
pci_set_drvdata (pdev, NULL);
}
@@ -785,7 +788,7 @@
*dev_out = NULL;
- /* dev and dev->priv zeroed in alloc_etherdev */
+ /* dev and priv zeroed in alloc_etherdev */
dev = alloc_etherdev (sizeof (*tp));
if (dev == NULL) {
printk (KERN_ERR PFX "%s: Unable to alloc new net device\n",
pci_name(pdev));
@@ -794,7 +797,7 @@
SET_MODULE_OWNER(dev);
SET_NETDEV_DEV(dev, &pdev->dev);
- tp = dev->priv;
+ tp = netdev_priv(dev);
tp->pci_dev = pdev;
/* enable device (incl. PCI PM wakeup and hotplug setup) */
@@ -976,8 +979,8 @@
return i;
assert (dev != NULL);
- tp = dev->priv;
- assert (tp != NULL);
+ tp = netdev_priv(dev);
+
ioaddr = tp->mmio_addr;
assert (ioaddr != NULL);
@@ -1010,8 +1013,8 @@
dev->irq = pdev->irq;
- /* dev->priv/tp zeroed and aligned in alloc_etherdev */
- tp = dev->priv;
+ /* tp zeroed and aligned in alloc_etherdev */
+ tp = netdev_priv(dev);
/* note: tp->chipset set in rtl8139_init_board */
tp->drv_flags = board_info[ent->driver_data].hw_flags;
@@ -1116,11 +1119,8 @@
static void __devexit rtl8139_remove_one (struct pci_dev *pdev)
{
struct net_device *dev = pci_get_drvdata (pdev);
- struct rtl8139_private *np;
assert (dev != NULL);
- np = dev->priv;
- assert (np != NULL);
unregister_netdev (dev);
@@ -1234,7 +1234,7 @@
static int mdio_read (struct net_device *dev, int phy_id, int location)
{
- struct rtl8139_private *tp = dev->priv;
+ struct rtl8139_private *tp = netdev_priv(dev);
int retval = 0;
#ifdef CONFIG_8139TOO_8129
void *mdio_addr = tp->mmio_addr + Config4;
@@ -1276,7 +1276,7 @@
static void mdio_write (struct net_device *dev, int phy_id, int location,
int value)
{
- struct rtl8139_private *tp = dev->priv;
+ struct rtl8139_private *tp = netdev_priv(dev);
#ifdef CONFIG_8139TOO_8129
void *mdio_addr = tp->mmio_addr + Config4;
int mii_cmd = (0x5002 << 16) | (phy_id << 23) | (location << 18) |
value;
@@ -1319,7 +1319,7 @@
static int rtl8139_open (struct net_device *dev)
{
- struct rtl8139_private *tp = dev->priv;
+ struct rtl8139_private *tp = netdev_priv(dev);
int retval;
void *ioaddr = tp->mmio_addr;
@@ -1367,7 +1367,7 @@
static void rtl_check_media (struct net_device *dev, unsigned int init_media)
{
- struct rtl8139_private *tp = dev->priv;
+ struct rtl8139_private *tp = netdev_priv(dev);
if (tp->phys[0] >= 0) {
mii_check_media(&tp->mii, netif_msg_link(tp), init_media);
@@ -1377,7 +1377,7 @@
/* Start the hardware at open or resume. */
static void rtl8139_hw_start (struct net_device *dev)
{
- struct rtl8139_private *tp = dev->priv;
+ struct rtl8139_private *tp = netdev_priv(dev);
void *ioaddr = tp->mmio_addr;
u32 i;
u8 tmp;
@@ -1399,8 +1399,6 @@
tp->rx_config = rtl8139_rx_config | AcceptBroadcast | AcceptMyPhys;
RTL_W32 (RxConfig, tp->rx_config);
-
- /* Check this value: the documentation for IFG contradicts ifself. */
RTL_W32 (TxConfig, rtl8139_tx_config);
tp->cur_rx = 0;
@@ -1446,7 +1444,7 @@
/* Initialize the Rx and Tx rings, along with various 'dev' bits. */
static void rtl8139_init_ring (struct net_device *dev)
{
- struct rtl8139_private *tp = dev->priv;
+ struct rtl8139_private *tp = netdev_priv(dev);
int i;
tp->cur_rx = 0;
@@ -1613,7 +1611,7 @@
static int rtl8139_thread (void *data)
{
struct net_device *dev = data;
- struct rtl8139_private *tp = dev->priv;
+ struct rtl8139_private *tp = netdev_priv(dev);
unsigned long timeout;
daemonize("%s", dev->name);
@@ -1645,7 +1643,7 @@
static void rtl8139_start_thread(struct net_device *dev)
{
- struct rtl8139_private *tp = dev->priv;
+ struct rtl8139_private *tp = netdev_priv(dev);
tp->thr_pid = -1;
tp->twistie = 0;
@@ -1673,7 +1671,7 @@
static void rtl8139_tx_timeout (struct net_device *dev)
{
- struct rtl8139_private *tp = dev->priv;
+ struct rtl8139_private *tp = netdev_priv(dev);
void *ioaddr = tp->mmio_addr;
int i;
u8 tmp8;
@@ -1718,7 +1716,7 @@
static int rtl8139_start_xmit (struct sk_buff *skb, struct net_device *dev)
{
- struct rtl8139_private *tp = dev->priv;
+ struct rtl8139_private *tp = netdev_priv(dev);
void *ioaddr = tp->mmio_addr;
unsigned int entry;
unsigned int len = skb->len;
@@ -1766,7 +1764,6 @@
unsigned long dirty_tx, tx_left;
assert (dev != NULL);
- assert (tp != NULL);
assert (ioaddr != NULL);
dirty_tx = tp->dirty_tx;
@@ -2125,7 +2122,7 @@
static int rtl8139_poll(struct net_device *dev, int *budget)
{
- struct rtl8139_private *tp = dev->priv;
+ struct rtl8139_private *tp = netdev_priv(dev);
void *ioaddr = tp->mmio_addr;
int orig_budget = min(*budget, dev->quota);
int done = 1;
@@ -2163,7 +2160,7 @@
struct pt_regs *regs)
{
struct net_device *dev = (struct net_device *) dev_instance;
- struct rtl8139_private *tp = dev->priv;
+ struct rtl8139_private *tp = netdev_priv(dev);
void *ioaddr = tp->mmio_addr;
u16 status, ackstat;
int link_changed = 0; /* avoid bogus "uninit" warning */
@@ -2239,7 +2236,7 @@
static int rtl8139_close (struct net_device *dev)
{
- struct rtl8139_private *tp = dev->priv;
+ struct rtl8139_private *tp = netdev_priv(dev);
void *ioaddr = tp->mmio_addr;
int ret = 0;
unsigned long flags;
@@ -2302,7 +2299,7 @@
other threads or interrupts aren't messing with the 8139. */
static void rtl8139_get_wol(struct net_device *dev, struct ethtool_wolinfo
*wol)
{
- struct rtl8139_private *np = dev->priv;
+ struct rtl8139_private *np = netdev_priv(dev);
void *ioaddr = np->mmio_addr;
spin_lock_irq(&np->lock);
@@ -2336,7 +2333,7 @@
aren't messing with the 8139. */
static int rtl8139_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
{
- struct rtl8139_private *np = dev->priv;
+ struct rtl8139_private *np = netdev_priv(dev);
void *ioaddr = np->mmio_addr;
u32 support;
u8 cfg3, cfg5;
@@ -2376,7 +2373,7 @@
static void rtl8139_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo
*info)
{
- struct rtl8139_private *np = dev->priv;
+ struct rtl8139_private *np = netdev_priv(dev);
strcpy(info->driver, DRV_NAME);
strcpy(info->version, DRV_VERSION);
strcpy(info->bus_info, pci_name(np->pci_dev));
@@ -2385,7 +2382,7 @@
static int rtl8139_get_settings(struct net_device *dev, struct ethtool_cmd
*cmd)
{
- struct rtl8139_private *np = dev->priv;
+ struct rtl8139_private *np = netdev_priv(dev);
spin_lock_irq(&np->lock);
mii_ethtool_gset(&np->mii, cmd);
spin_unlock_irq(&np->lock);
@@ -2394,7 +2391,7 @@
static int rtl8139_set_settings(struct net_device *dev, struct ethtool_cmd
*cmd)
{
- struct rtl8139_private *np = dev->priv;
+ struct rtl8139_private *np = netdev_priv(dev);
int rc;
spin_lock_irq(&np->lock);
rc = mii_ethtool_sset(&np->mii, cmd);
@@ -2404,25 +2401,25 @@
static int rtl8139_nway_reset(struct net_device *dev)
{
- struct rtl8139_private *np = dev->priv;
+ struct rtl8139_private *np = netdev_priv(dev);
return mii_nway_restart(&np->mii);
}
static u32 rtl8139_get_link(struct net_device *dev)
{
- struct rtl8139_private *np = dev->priv;
+ struct rtl8139_private *np = netdev_priv(dev);
return mii_link_ok(&np->mii);
}
static u32 rtl8139_get_msglevel(struct net_device *dev)
{
- struct rtl8139_private *np = dev->priv;
+ struct rtl8139_private *np = netdev_priv(dev);
return np->msg_enable;
}
static void rtl8139_set_msglevel(struct net_device *dev, u32 datum)
{
- struct rtl8139_private *np = dev->priv;
+ struct rtl8139_private *np = netdev_priv(dev);
np->msg_enable = datum;
}
@@ -2433,13 +2430,13 @@
#else
static int rtl8139_get_regs_len(struct net_device *dev)
{
- struct rtl8139_private *np = dev->priv;
+ struct rtl8139_private *np = netdev_priv(dev);
return np->regs_len;
}
static void rtl8139_get_regs(struct net_device *dev, struct ethtool_regs
*regs, void *regbuf)
{
- struct rtl8139_private *np = dev->priv;
+ struct rtl8139_private *np = netdev_priv(dev);
regs->version = RTL_REGS_VER;
@@ -2456,7 +2453,7 @@
static void rtl8139_get_ethtool_stats(struct net_device *dev, struct
ethtool_stats *stats, u64 *data)
{
- struct rtl8139_private *np = dev->priv;
+ struct rtl8139_private *np = netdev_priv(dev);
data[0] = np->xstats.early_rx;
data[1] = np->xstats.tx_buf_mapped;
@@ -2488,7 +2485,7 @@
static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
- struct rtl8139_private *np = dev->priv;
+ struct rtl8139_private *np = netdev_priv(dev);
int rc;
if (!netif_running(dev))
@@ -2504,7 +2501,7 @@
static struct net_device_stats *rtl8139_get_stats (struct net_device *dev)
{
- struct rtl8139_private *tp = dev->priv;
+ struct rtl8139_private *tp = netdev_priv(dev);
void *ioaddr = tp->mmio_addr;
unsigned long flags;
@@ -2523,7 +2520,7 @@
static void __set_rx_mode (struct net_device *dev)
{
- struct rtl8139_private *tp = dev->priv;
+ struct rtl8139_private *tp = netdev_priv(dev);
void *ioaddr = tp->mmio_addr;
u32 mc_filter[2]; /* Multicast hash filter */
int i, rx_mode;
@@ -2572,7 +2569,7 @@
static void rtl8139_set_rx_mode (struct net_device *dev)
{
unsigned long flags;
- struct rtl8139_private *tp = dev->priv;
+ struct rtl8139_private *tp = netdev_priv(dev);
spin_lock_irqsave (&tp->lock, flags);
__set_rx_mode(dev);
@@ -2584,7 +2581,7 @@
static int rtl8139_suspend (struct pci_dev *pdev, u32 state)
{
struct net_device *dev = pci_get_drvdata (pdev);
- struct rtl8139_private *tp = dev->priv;
+ struct rtl8139_private *tp = netdev_priv(dev);
void *ioaddr = tp->mmio_addr;
unsigned long flags;
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html