Commit 84bc69a1 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://kernel.bkbits.net/jgarzik/net-drivers-2.5

into home.transmeta.com:/home/torvalds/v2.5/linux
parents b5939deb d857e540
...@@ -980,7 +980,7 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev, ...@@ -980,7 +980,7 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev,
dev->irq = pdev->irq; dev->irq = pdev->irq;
/* dev->priv/tp zeroed and aligned in init_etherdev */ /* dev->priv/tp zeroed and aligned in alloc_etherdev */
tp = dev->priv; tp = dev->priv;
/* note: tp->chipset set in rtl8139_init_board */ /* note: tp->chipset set in rtl8139_init_board */
...@@ -2143,9 +2143,7 @@ static int rtl8139_close (struct net_device *dev) ...@@ -2143,9 +2143,7 @@ static int rtl8139_close (struct net_device *dev)
spin_unlock_irqrestore (&tp->lock, flags); spin_unlock_irqrestore (&tp->lock, flags);
/* TODO: isn't this code racy? we synchronize the IRQ and then free it, */ synchronize_irq (dev->irq); /* racy, but that's ok here */
/* but another IRQ could've happened in between the sync and free */
synchronize_irq (dev->irq);
free_irq (dev->irq, dev); free_irq (dev->irq, dev);
rtl8139_tx_clear (tp); rtl8139_tx_clear (tp);
......
This diff is collapsed.
This diff is collapsed.
...@@ -614,6 +614,22 @@ e100_found1(struct pci_dev *pcid, const struct pci_device_id *ent) ...@@ -614,6 +614,22 @@ e100_found1(struct pci_dev *pcid, const struct pci_device_id *ent)
goto err_dealloc; goto err_dealloc;
} }
dev->vlan_rx_register = e100_vlan_rx_register;
dev->vlan_rx_add_vid = e100_vlan_rx_add_vid;
dev->vlan_rx_kill_vid = e100_vlan_rx_kill_vid;
dev->irq = pcid->irq;
dev->open = &e100_open;
dev->hard_start_xmit = &e100_xmit_frame;
dev->stop = &e100_close;
dev->change_mtu = &e100_change_mtu;
dev->get_stats = &e100_get_stats;
dev->set_multicast_list = &e100_set_multi;
dev->set_mac_address = &e100_set_mac;
dev->do_ioctl = &e100_ioctl;
if (bdp->flags & USE_IPCB)
dev->features = NETIF_F_SG | NETIF_F_HW_CSUM |
NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
if ((rc = register_netdev(dev)) != 0) { if ((rc = register_netdev(dev)) != 0) {
goto err_pci; goto err_pci;
} }
...@@ -660,23 +676,6 @@ e100_found1(struct pci_dev *pcid, const struct pci_device_id *ent) ...@@ -660,23 +676,6 @@ e100_found1(struct pci_dev *pcid, const struct pci_device_id *ent)
goto err_unregister_netdev; goto err_unregister_netdev;
} }
dev->vlan_rx_register = e100_vlan_rx_register;
dev->vlan_rx_add_vid = e100_vlan_rx_add_vid;
dev->vlan_rx_kill_vid = e100_vlan_rx_kill_vid;
dev->irq = pcid->irq;
dev->open = &e100_open;
dev->hard_start_xmit = &e100_xmit_frame;
dev->stop = &e100_close;
dev->change_mtu = &e100_change_mtu;
dev->get_stats = &e100_get_stats;
dev->set_multicast_list = &e100_set_multi;
dev->set_mac_address = &e100_set_mac;
dev->do_ioctl = &e100_ioctl;
if (bdp->flags & USE_IPCB)
dev->features = NETIF_F_SG | NETIF_F_HW_CSUM |
NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
e100nics++; e100nics++;
e100_get_speed_duplex_caps(bdp); e100_get_speed_duplex_caps(bdp);
......
...@@ -602,7 +602,7 @@ static int __devinit netdrv_init_board (struct pci_dev *pdev, ...@@ -602,7 +602,7 @@ static int __devinit netdrv_init_board (struct pci_dev *pdev,
*ioaddr_out = NULL; *ioaddr_out = NULL;
*dev_out = NULL; *dev_out = NULL;
/* dev zeroed in init_etherdev */ /* dev zeroed in alloc_etherdev */
dev = alloc_etherdev (sizeof (*tp)); dev = alloc_etherdev (sizeof (*tp));
if (dev == NULL) { if (dev == NULL) {
printk (KERN_ERR PFX "unable to alloc new ethernet\n"); printk (KERN_ERR PFX "unable to alloc new ethernet\n");
...@@ -790,7 +790,7 @@ static int __devinit netdrv_init_one (struct pci_dev *pdev, ...@@ -790,7 +790,7 @@ static int __devinit netdrv_init_one (struct pci_dev *pdev,
dev->irq = pdev->irq; dev->irq = pdev->irq;
dev->base_addr = (unsigned long) ioaddr; dev->base_addr = (unsigned long) ioaddr;
/* dev->priv/tp zeroed and aligned in init_etherdev */ /* dev->priv/tp zeroed and aligned in alloc_etherdev */
tp = dev->priv; tp = dev->priv;
/* note: tp->chipset set in netdrv_init_board */ /* note: tp->chipset set in netdrv_init_board */
......
...@@ -1002,6 +1002,8 @@ pcnet32_init_ring(struct net_device *dev) ...@@ -1002,6 +1002,8 @@ pcnet32_init_ring(struct net_device *dev)
} }
skb_reserve (rx_skbuff, 2); skb_reserve (rx_skbuff, 2);
} }
if (lp->rx_dma_addr[i] == NULL)
lp->rx_dma_addr[i] = pci_map_single(lp->pci_dev, rx_skbuff->tail, rx_skbuff->len, PCI_DMA_FROMDEVICE); lp->rx_dma_addr[i] = pci_map_single(lp->pci_dev, rx_skbuff->tail, rx_skbuff->len, PCI_DMA_FROMDEVICE);
lp->rx_ring[i].base = (u32)le32_to_cpu(lp->rx_dma_addr[i]); lp->rx_ring[i].base = (u32)le32_to_cpu(lp->rx_dma_addr[i]);
lp->rx_ring[i].buf_length = le16_to_cpu(-PKT_BUF_SZ); lp->rx_ring[i].buf_length = le16_to_cpu(-PKT_BUF_SZ);
...@@ -1037,7 +1039,7 @@ pcnet32_restart(struct net_device *dev, unsigned int csr0_bits) ...@@ -1037,7 +1039,7 @@ pcnet32_restart(struct net_device *dev, unsigned int csr0_bits)
/* ReInit Ring */ /* ReInit Ring */
lp->a.write_csr (ioaddr, 0, 1); lp->a.write_csr (ioaddr, 0, 1);
i = 0; i = 0;
while (i++ < 100) while (i++ < 1000)
if (lp->a.read_csr (ioaddr, 0) & 0x0100) if (lp->a.read_csr (ioaddr, 0) & 0x0100)
break; break;
...@@ -1128,6 +1130,7 @@ pcnet32_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -1128,6 +1130,7 @@ pcnet32_start_xmit(struct sk_buff *skb, struct net_device *dev)
lp->tx_skbuff[entry] = skb; lp->tx_skbuff[entry] = skb;
lp->tx_dma_addr[entry] = pci_map_single(lp->pci_dev, skb->data, skb->len, PCI_DMA_TODEVICE); lp->tx_dma_addr[entry] = pci_map_single(lp->pci_dev, skb->data, skb->len, PCI_DMA_TODEVICE);
lp->tx_ring[entry].base = (u32)le32_to_cpu(lp->tx_dma_addr[entry]); lp->tx_ring[entry].base = (u32)le32_to_cpu(lp->tx_dma_addr[entry]);
wmb(); /* Make sure owner changes after all others are visible */
lp->tx_ring[entry].status = le16_to_cpu(status); lp->tx_ring[entry].status = le16_to_cpu(status);
lp->cur_tx++; lp->cur_tx++;
......
...@@ -365,8 +365,8 @@ rtl8169_init_board(struct pci_dev *pdev, struct net_device **dev_out, ...@@ -365,8 +365,8 @@ rtl8169_init_board(struct pci_dev *pdev, struct net_device **dev_out,
*ioaddr_out = NULL; *ioaddr_out = NULL;
*dev_out = NULL; *dev_out = NULL;
// dev zeroed in init_etherdev // dev zeroed in alloc_etherdev
dev = init_etherdev(NULL, sizeof (*tp)); dev = alloc_etherdev(sizeof (*tp));
if (dev == NULL) { if (dev == NULL) {
printk(KERN_ERR PFX "unable to alloc new ethernet\n"); printk(KERN_ERR PFX "unable to alloc new ethernet\n");
return -ENOMEM; return -ENOMEM;
...@@ -391,18 +391,18 @@ rtl8169_init_board(struct pci_dev *pdev, struct net_device **dev_out, ...@@ -391,18 +391,18 @@ rtl8169_init_board(struct pci_dev *pdev, struct net_device **dev_out,
printk(KERN_ERR PFX printk(KERN_ERR PFX
"region #1 not an MMIO resource, aborting\n"); "region #1 not an MMIO resource, aborting\n");
rc = -ENODEV; rc = -ENODEV;
goto err_out; goto err_out_disable;
} }
// check for weird/broken PCI region reporting // check for weird/broken PCI region reporting
if (mmio_len < RTL_MIN_IO_SIZE) { if (mmio_len < RTL_MIN_IO_SIZE) {
printk(KERN_ERR PFX "Invalid PCI region size(s), aborting\n"); printk(KERN_ERR PFX "Invalid PCI region size(s), aborting\n");
rc = -ENODEV; rc = -ENODEV;
goto err_out; goto err_out_disable;
} }
rc = pci_request_regions(pdev, dev->name); rc = pci_request_regions(pdev, dev->name);
if (rc) if (rc)
goto err_out; goto err_out_disable;
// enable PCI bus-mastering // enable PCI bus-mastering
pci_set_master(pdev); pci_set_master(pdev);
...@@ -450,8 +450,10 @@ rtl8169_init_board(struct pci_dev *pdev, struct net_device **dev_out, ...@@ -450,8 +450,10 @@ rtl8169_init_board(struct pci_dev *pdev, struct net_device **dev_out,
err_out_free_res: err_out_free_res:
pci_release_regions(pdev); pci_release_regions(pdev);
err_out_disable:
pci_disable_device(pdev);
err_out: err_out:
unregister_netdev(dev);
kfree(dev); kfree(dev);
return rc; return rc;
} }
...@@ -464,7 +466,7 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -464,7 +466,7 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
void *ioaddr = NULL; void *ioaddr = NULL;
static int board_idx = -1; static int board_idx = -1;
static int printed_version = 0; static int printed_version = 0;
int i; int i, rc;
int option = -1, Cap10_100 = 0, Cap1000 = 0; int option = -1, Cap10_100 = 0, Cap1000 = 0;
assert(pdev != NULL); assert(pdev != NULL);
...@@ -477,20 +479,18 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -477,20 +479,18 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
printed_version = 1; printed_version = 1;
} }
i = rtl8169_init_board(pdev, &dev, &ioaddr); rc = rtl8169_init_board(pdev, &dev, &ioaddr);
if (i < 0) { if (rc)
return i; return rc;
}
tp = dev->priv; tp = dev->priv;
assert(ioaddr != NULL); assert(ioaddr != NULL);
assert(dev != NULL); assert(dev != NULL);
assert(tp != NULL); assert(tp != NULL);
// Get MAC address // // Get MAC address. FIXME: read EEPROM
for (i = 0; i < MAC_ADDR_LEN; i++) { for (i = 0; i < MAC_ADDR_LEN; i++)
dev->dev_addr[i] = RTL_R8(MAC0 + i); dev->dev_addr[i] = RTL_R8(MAC0 + i);
}
dev->open = rtl8169_open; dev->open = rtl8169_open;
dev->hard_start_xmit = rtl8169_start_xmit; dev->hard_start_xmit = rtl8169_start_xmit;
...@@ -507,11 +507,20 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -507,11 +507,20 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
tp->pci_dev = pdev; tp->pci_dev = pdev;
tp->mmio_addr = ioaddr; tp->mmio_addr = ioaddr;
spin_lock_init(&tp->lock);
rc = register_netdev(dev);
if (rc) {
iounmap(ioaddr);
pci_release_regions(pdev);
pci_disable_device(pdev);
kfree(dev);
return rc;
}
printk(KERN_DEBUG "%s: Identified chip type is '%s'.\n", dev->name, printk(KERN_DEBUG "%s: Identified chip type is '%s'.\n", dev->name,
rtl_chip_info[tp->chipset].name); rtl_chip_info[tp->chipset].name);
spin_lock_init(&tp->lock);
pci_set_drvdata(pdev, dev); pci_set_drvdata(pdev, dev);
printk(KERN_INFO "%s: %s at 0x%lx, " printk(KERN_INFO "%s: %s at 0x%lx, "
...@@ -623,7 +632,7 @@ static void __devexit ...@@ -623,7 +632,7 @@ static void __devexit
rtl8169_remove_one(struct pci_dev *pdev) rtl8169_remove_one(struct pci_dev *pdev)
{ {
struct net_device *dev = pci_get_drvdata(pdev); struct net_device *dev = pci_get_drvdata(pdev);
struct rtl8169_private *tp = (struct rtl8169_private *) (dev->priv); struct rtl8169_private *tp = dev->priv;
assert(dev != NULL); assert(dev != NULL);
assert(tp != NULL); assert(tp != NULL);
...@@ -636,6 +645,7 @@ rtl8169_remove_one(struct pci_dev *pdev) ...@@ -636,6 +645,7 @@ rtl8169_remove_one(struct pci_dev *pdev)
memset(dev, 0xBC, memset(dev, 0xBC,
sizeof (struct net_device) + sizeof (struct rtl8169_private)); sizeof (struct net_device) + sizeof (struct rtl8169_private));
pci_disable_device(pdev);
kfree(dev); kfree(dev);
pci_set_drvdata(pdev, NULL); pci_set_drvdata(pdev, NULL);
} }
......
...@@ -346,6 +346,27 @@ static void TLan_EeReceiveByte( u16, u8 *, int ); ...@@ -346,6 +346,27 @@ static void TLan_EeReceiveByte( u16, u8 *, int );
static int TLan_EeReadByte( struct net_device *, u8, u8 * ); static int TLan_EeReadByte( struct net_device *, u8, u8 * );
static void
TLan_StoreSKB( struct tlan_list_tag *tag, struct sk_buff *skb)
{
unsigned long addr = (unsigned long)skb;
tag->buffer[9].address = (u32)addr;
addr >>= 31; /* >>= 32 is undefined for 32bit arch, stupid C */
addr >>= 1;
tag->buffer[8].address = (u32)addr;
}
static struct sk_buff *
TLan_GetSKB( struct tlan_list_tag *tag)
{
unsigned long addr = tag->buffer[8].address;
addr <<= 31;
addr <<= 1;
addr |= tag->buffer[9].address;
return (struct sk_buff *) addr;
}
static TLanIntVectorFunc *TLanIntVector[TLAN_INT_NUMBER_OF_INTS] = { static TLanIntVectorFunc *TLanIntVector[TLAN_INT_NUMBER_OF_INTS] = {
TLan_HandleInvalid, TLan_HandleInvalid,
TLan_HandleTxEOF, TLan_HandleTxEOF,
...@@ -424,7 +445,7 @@ static void __devexit tlan_remove_one( struct pci_dev *pdev) ...@@ -424,7 +445,7 @@ static void __devexit tlan_remove_one( struct pci_dev *pdev)
pci_free_consistent(priv->pciDev, priv->dmaSize, priv->dmaStorage, priv->dmaStorageDMA ); pci_free_consistent(priv->pciDev, priv->dmaSize, priv->dmaStorage, priv->dmaStorageDMA );
} }
release_region( dev->base_addr, 0x10 ); pci_release_regions(pdev);
kfree( dev ); kfree( dev );
...@@ -510,15 +531,25 @@ static int __devinit TLan_probe1(struct pci_dev *pdev, ...@@ -510,15 +531,25 @@ static int __devinit TLan_probe1(struct pci_dev *pdev,
TLanPrivateInfo *priv; TLanPrivateInfo *priv;
u8 pci_rev; u8 pci_rev;
u16 device_id; u16 device_id;
int reg; int reg, rc = -ENODEV;
if (pdev) {
rc = pci_enable_device(pdev);
if (rc)
return rc;
if (pdev && pci_enable_device(pdev)) rc = pci_request_regions(pdev, TLanSignature);
return -EIO; if (rc) {
printk(KERN_ERR "TLAN: Could not reserve IO regions\n");
goto err_out;
}
}
dev = init_etherdev(NULL, sizeof(TLanPrivateInfo)); dev = alloc_etherdev(sizeof(TLanPrivateInfo));
if (dev == NULL) { if (dev == NULL) {
printk(KERN_ERR "TLAN: Could not allocate memory for device.\n"); printk(KERN_ERR "TLAN: Could not allocate memory for device.\n");
return -ENOMEM; rc = -ENOMEM;
goto err_out_regions;
} }
SET_MODULE_OWNER(dev); SET_MODULE_OWNER(dev);
SET_NETDEV_DEV(dev, &pdev->dev); SET_NETDEV_DEV(dev, &pdev->dev);
...@@ -533,12 +564,10 @@ static int __devinit TLan_probe1(struct pci_dev *pdev, ...@@ -533,12 +564,10 @@ static int __devinit TLan_probe1(struct pci_dev *pdev,
priv->adapter = &board_info[ent->driver_data]; priv->adapter = &board_info[ent->driver_data];
if(pci_set_dma_mask(pdev, 0xFFFFFFFF)) rc = pci_set_dma_mask(pdev, 0xFFFFFFFF);
{ if (rc) {
printk(KERN_ERR "TLAN: No suitable PCI mapping available.\n"); printk(KERN_ERR "TLAN: No suitable PCI mapping available.\n");
unregister_netdev(dev); goto err_out_free_dev;
kfree(dev);
return -ENODEV;
} }
pci_read_config_byte ( pdev, PCI_REVISION_ID, &pci_rev); pci_read_config_byte ( pdev, PCI_REVISION_ID, &pci_rev);
...@@ -553,9 +582,8 @@ static int __devinit TLan_probe1(struct pci_dev *pdev, ...@@ -553,9 +582,8 @@ static int __devinit TLan_probe1(struct pci_dev *pdev,
} }
if (!pci_io_base) { if (!pci_io_base) {
printk(KERN_ERR "TLAN: No IO mappings available\n"); printk(KERN_ERR "TLAN: No IO mappings available\n");
unregister_netdev(dev); rc = -EIO;
kfree(dev); goto err_out_free_dev;
return -ENODEV;
} }
dev->base_addr = pci_io_base; dev->base_addr = pci_io_base;
...@@ -605,12 +633,18 @@ static int __devinit TLan_probe1(struct pci_dev *pdev, ...@@ -605,12 +633,18 @@ static int __devinit TLan_probe1(struct pci_dev *pdev,
spin_lock_init(&priv->lock); spin_lock_init(&priv->lock);
if (TLan_Init(dev)) { rc = TLan_Init(dev);
if (rc) {
printk(KERN_ERR "TLAN: Could not set up device.\n");
goto err_out_free_dev;
}
rc = register_netdev(dev);
if (rc) {
printk(KERN_ERR "TLAN: Could not register device.\n"); printk(KERN_ERR "TLAN: Could not register device.\n");
unregister_netdev(dev); goto err_out_uninit;
kfree(dev); }
return -EAGAIN;
} else {
TLanDevicesInstalled++; TLanDevicesInstalled++;
boards_found++; boards_found++;
...@@ -631,8 +665,19 @@ static int __devinit TLan_probe1(struct pci_dev *pdev, ...@@ -631,8 +665,19 @@ static int __devinit TLan_probe1(struct pci_dev *pdev,
priv->adapter->deviceLabel, priv->adapter->deviceLabel,
priv->adapterRev); priv->adapterRev);
return 0; return 0;
}
err_out_uninit:
pci_free_consistent(priv->pciDev, priv->dmaSize, priv->dmaStorage,
priv->dmaStorageDMA );
err_out_free_dev:
kfree(dev);
err_out_regions:
if (pdev)
pci_release_regions(pdev);
err_out:
if (pdev)
pci_disable_device(pdev);
return rc;
} }
...@@ -798,15 +843,6 @@ static int TLan_Init( struct net_device *dev ) ...@@ -798,15 +843,6 @@ static int TLan_Init( struct net_device *dev )
priv = dev->priv; priv = dev->priv;
if (!priv->is_eisa) /* EISA devices have already requested IO */
if (!request_region( dev->base_addr, 0x10, TLanSignature )) {
printk(KERN_ERR "TLAN: %s: IO port region 0x%lx size 0x%x in use.\n",
dev->name,
dev->base_addr,
0x10 );
return -EIO;
}
if ( bbuf ) { if ( bbuf ) {
dma_size = ( TLAN_NUM_RX_LISTS + TLAN_NUM_TX_LISTS ) dma_size = ( TLAN_NUM_RX_LISTS + TLAN_NUM_TX_LISTS )
* ( sizeof(TLanList) + TLAN_MAX_FRAME_SIZE ); * ( sizeof(TLanList) + TLAN_MAX_FRAME_SIZE );
...@@ -820,7 +856,6 @@ static int TLan_Init( struct net_device *dev ) ...@@ -820,7 +856,6 @@ static int TLan_Init( struct net_device *dev )
if ( priv->dmaStorage == NULL ) { if ( priv->dmaStorage == NULL ) {
printk(KERN_ERR "TLAN: Could not allocate lists and buffers for %s.\n", printk(KERN_ERR "TLAN: Could not allocate lists and buffers for %s.\n",
dev->name ); dev->name );
release_region( dev->base_addr, 0x10 );
return -ENOMEM; return -ENOMEM;
} }
memset( priv->dmaStorage, 0, dma_size ); memset( priv->dmaStorage, 0, dma_size );
...@@ -1039,7 +1074,7 @@ static int TLan_StartTx( struct sk_buff *skb, struct net_device *dev ) ...@@ -1039,7 +1074,7 @@ static int TLan_StartTx( struct sk_buff *skb, struct net_device *dev )
memcpy( tail_buffer, skb->data, skb->len ); memcpy( tail_buffer, skb->data, skb->len );
} else { } else {
tail_list->buffer[0].address = pci_map_single(priv->pciDev, skb->data, skb->len, PCI_DMA_TODEVICE); tail_list->buffer[0].address = pci_map_single(priv->pciDev, skb->data, skb->len, PCI_DMA_TODEVICE);
tail_list->buffer[9].address = (u32) skb; TLan_StoreSKB(tail_list, skb);
} }
pad = TLAN_MIN_FRAME_SIZE - skb->len; pad = TLAN_MIN_FRAME_SIZE - skb->len;
...@@ -1365,9 +1400,10 @@ u32 TLan_HandleTxEOF( struct net_device *dev, u16 host_int ) ...@@ -1365,9 +1400,10 @@ u32 TLan_HandleTxEOF( struct net_device *dev, u16 host_int )
while (((tmpCStat = head_list->cStat ) & TLAN_CSTAT_FRM_CMP) && (ack < 255)) { while (((tmpCStat = head_list->cStat ) & TLAN_CSTAT_FRM_CMP) && (ack < 255)) {
ack++; ack++;
if ( ! bbuf ) { if ( ! bbuf ) {
struct sk_buff *skb = (struct sk_buff *) head_list->buffer[9].address; struct sk_buff *skb = TLan_GetSKB(head_list);
pci_unmap_single(priv->pciDev, head_list->buffer[0].address, skb->len, PCI_DMA_TODEVICE); pci_unmap_single(priv->pciDev, head_list->buffer[0].address, skb->len, PCI_DMA_TODEVICE);
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
head_list->buffer[8].address = 0;
head_list->buffer[9].address = 0; head_list->buffer[9].address = 0;
} }
...@@ -1523,7 +1559,7 @@ u32 TLan_HandleRxEOF( struct net_device *dev, u16 host_int ) ...@@ -1523,7 +1559,7 @@ u32 TLan_HandleRxEOF( struct net_device *dev, u16 host_int )
new_skb = dev_alloc_skb( TLAN_MAX_FRAME_SIZE + 7 ); new_skb = dev_alloc_skb( TLAN_MAX_FRAME_SIZE + 7 );
if ( new_skb != NULL ) { if ( new_skb != NULL ) {
skb = (struct sk_buff *) head_list->buffer[9].address; skb = TLan_GetSKB(head_list);
pci_unmap_single(priv->pciDev, head_list->buffer[0].address, TLAN_MAX_FRAME_SIZE, PCI_DMA_FROMDEVICE); pci_unmap_single(priv->pciDev, head_list->buffer[0].address, TLAN_MAX_FRAME_SIZE, PCI_DMA_FROMDEVICE);
skb_trim( skb, frameSize ); skb_trim( skb, frameSize );
...@@ -1537,10 +1573,7 @@ u32 TLan_HandleRxEOF( struct net_device *dev, u16 host_int ) ...@@ -1537,10 +1573,7 @@ u32 TLan_HandleRxEOF( struct net_device *dev, u16 host_int )
t = (void *) skb_put( new_skb, TLAN_MAX_FRAME_SIZE ); t = (void *) skb_put( new_skb, TLAN_MAX_FRAME_SIZE );
head_list->buffer[0].address = pci_map_single(priv->pciDev, new_skb->data, TLAN_MAX_FRAME_SIZE, PCI_DMA_FROMDEVICE); head_list->buffer[0].address = pci_map_single(priv->pciDev, new_skb->data, TLAN_MAX_FRAME_SIZE, PCI_DMA_FROMDEVICE);
head_list->buffer[8].address = (u32) t; head_list->buffer[8].address = (u32) t;
#if BITS_PER_LONG==64 TLan_StoreSKB(head_list, new_skb);
#error "Not 64bit clean"
#endif
head_list->buffer[9].address = (u32) new_skb;
} else } else
printk(KERN_WARNING "TLAN: Couldn't allocate memory for received data.\n" ); printk(KERN_WARNING "TLAN: Couldn't allocate memory for received data.\n" );
} }
...@@ -1926,6 +1959,7 @@ void TLan_ResetLists( struct net_device *dev ) ...@@ -1926,6 +1959,7 @@ void TLan_ResetLists( struct net_device *dev )
} }
list->buffer[2].count = 0; list->buffer[2].count = 0;
list->buffer[2].address = 0; list->buffer[2].address = 0;
list->buffer[8].address = 0;
list->buffer[9].address = 0; list->buffer[9].address = 0;
} }
...@@ -1951,7 +1985,7 @@ void TLan_ResetLists( struct net_device *dev ) ...@@ -1951,7 +1985,7 @@ void TLan_ResetLists( struct net_device *dev )
} }
list->buffer[0].address = pci_map_single(priv->pciDev, t, TLAN_MAX_FRAME_SIZE, PCI_DMA_FROMDEVICE); list->buffer[0].address = pci_map_single(priv->pciDev, t, TLAN_MAX_FRAME_SIZE, PCI_DMA_FROMDEVICE);
list->buffer[8].address = (u32) t; list->buffer[8].address = (u32) t;
list->buffer[9].address = (u32) skb; TLan_StoreSKB(list, skb);
} }
list->buffer[1].count = 0; list->buffer[1].count = 0;
list->buffer[1].address = 0; list->buffer[1].address = 0;
...@@ -1974,20 +2008,22 @@ void TLan_FreeLists( struct net_device *dev ) ...@@ -1974,20 +2008,22 @@ void TLan_FreeLists( struct net_device *dev )
if ( ! bbuf ) { if ( ! bbuf ) {
for ( i = 0; i < TLAN_NUM_TX_LISTS; i++ ) { for ( i = 0; i < TLAN_NUM_TX_LISTS; i++ ) {
list = priv->txList + i; list = priv->txList + i;
skb = (struct sk_buff *) list->buffer[9].address; skb = TLan_GetSKB(list);
if ( skb ) { if ( skb ) {
pci_unmap_single(priv->pciDev, list->buffer[0].address, skb->len, PCI_DMA_TODEVICE); pci_unmap_single(priv->pciDev, list->buffer[0].address, skb->len, PCI_DMA_TODEVICE);
dev_kfree_skb_any( skb ); dev_kfree_skb_any( skb );
list->buffer[8].address = 0;
list->buffer[9].address = 0; list->buffer[9].address = 0;
} }
} }
for ( i = 0; i < TLAN_NUM_RX_LISTS; i++ ) { for ( i = 0; i < TLAN_NUM_RX_LISTS; i++ ) {
list = priv->rxList + i; list = priv->rxList + i;
skb = (struct sk_buff *) list->buffer[9].address; skb = TLan_GetSKB(list);
if ( skb ) { if ( skb ) {
pci_unmap_single(priv->pciDev, list->buffer[0].address, TLAN_MAX_FRAME_SIZE, PCI_DMA_FROMDEVICE); pci_unmap_single(priv->pciDev, list->buffer[0].address, TLAN_MAX_FRAME_SIZE, PCI_DMA_FROMDEVICE);
dev_kfree_skb_any( skb ); dev_kfree_skb_any( skb );
list->buffer[8].address = 0;
list->buffer[9].address = 0; list->buffer[9].address = 0;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment