diff -Naur -X /g/g/lib/dontdiff /home/jgarzik/vanilla/kernel-2.4.19-pre4/Documentation/networking/dl2k.txt net-drivers-2.4/Documentation/networking/dl2k.txt --- /home/jgarzik/vanilla/kernel-2.4.19-pre4/Documentation/networking/dl2k.txt Mon Feb 25 19:37:51 2002 +++ net-drivers-2.4/Documentation/networking/dl2k.txt Thu Mar 21 06:38:04 2002 @@ -1,7 +1,7 @@ D-Link DL2000-based Gigabit Ethernet Adapter Installation for Linux - Jan 02, 2002 + Jan 29, 2002 Contents ======== @@ -199,8 +199,8 @@ 6 1000Mbps full duplex. By default, the NIC operates at autosense. - Note that only 1000mbps_fd and 1000mbps_hd - types are available for fiber adapter. + 1000mbps_fd and 1000mbps_hd types are only + available for fiber adapter. vlan=[0|1] - Specifies the VLAN ID. If vlan=0, the Virtual Local Area Network (VLAN) function is diff -Naur -X /g/g/lib/dontdiff /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/3c503.c net-drivers-2.4/drivers/net/3c503.c --- /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/3c503.c Mon Feb 25 19:37:58 2002 +++ net-drivers-2.4/drivers/net/3c503.c Thu Mar 21 06:38:21 2002 @@ -692,9 +692,11 @@ MODULE_PARM(io, "1-" __MODULE_STRING(MAX_EL2_CARDS) "i"); MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_EL2_CARDS) "i"); MODULE_PARM(xcvr, "1-" __MODULE_STRING(MAX_EL2_CARDS) "i"); -MODULE_PARM_DESC(io, "EtherLink II I/O base address(es)"); -MODULE_PARM_DESC(irq, "EtherLink II IRQ number(s) (assigned)"); -MODULE_PARM_DESC(xcvr, "EtherLink II tranceiver(s) (0=internal, 1=external)"); +MODULE_PARM_DESC(io, "I/O base address(es)"); +MODULE_PARM_DESC(irq, "IRQ number(s) (assigned)"); +MODULE_PARM_DESC(xcvr, "tranceiver(s) (0=internal, 1=external)"); +MODULE_DESCRIPTION("3Com ISA EtherLink II, II/16 (3c503, 3c503/16) driver"); +MODULE_LICENSE("GPL"); /* This is set up so that only a single autoprobe takes place per call. ISA device autoprobes on a running machine are not recommended. */ @@ -742,7 +744,6 @@ } } #endif /* MODULE */ -MODULE_LICENSE("GPL"); /* diff -Naur -X /g/g/lib/dontdiff /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/ac3200.c net-drivers-2.4/drivers/net/ac3200.c --- /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/ac3200.c Sun Sep 30 19:26:06 2001 +++ net-drivers-2.4/drivers/net/ac3200.c Thu Mar 21 06:38:21 2002 @@ -346,9 +346,11 @@ MODULE_PARM(io, "1-" __MODULE_STRING(MAX_AC32_CARDS) "i"); MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_AC32_CARDS) "i"); MODULE_PARM(mem, "1-" __MODULE_STRING(MAX_AC32_CARDS) "i"); -MODULE_PARM_DESC(io, "ac3200 I/O base adress(es)"); -MODULE_PARM_DESC(irq, "ac3200 IRQ number(s)"); -MODULE_PARM_DESC(mem, "ac3200 Memory base address(es)"); +MODULE_PARM_DESC(io, "I/O base adress(es)"); +MODULE_PARM_DESC(irq, "IRQ number(s)"); +MODULE_PARM_DESC(mem, "Memory base address(es)"); +MODULE_DESCRIPTION("Ansel AC3200 EISA ethernet driver"); +MODULE_LICENSE("GPL"); int init_module(void) @@ -395,7 +397,6 @@ } } #endif /* MODULE */ -MODULE_LICENSE("GPL"); /* diff -Naur -X /g/g/lib/dontdiff /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/acenic.c net-drivers-2.4/drivers/net/acenic.c --- /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/acenic.c Thu Mar 21 06:39:14 2002 +++ net-drivers-2.4/drivers/net/acenic.c Thu Mar 21 06:38:21 2002 @@ -2,7 +2,7 @@ * acenic.c: Linux driver for the Alteon AceNIC Gigabit Ethernet card * and other Tigon based cards. * - * Copyright 1998-2001 by Jes Sorensen, . + * Copyright 1998-2002 by Jes Sorensen, . * * Thanks to Alteon and 3Com for providing hardware and documentation * enabling me to write this driver. @@ -30,6 +30,7 @@ * Pierrick Pinasseau (CERN): For lending me an Ultra 5 to test the * driver under Linux/Sparc64 * Matt Domsch : Detect Alteon 1000baseT cards + * ETHTOOL_GDRVINFO support * Chip Salzenberg : Fix race condition between tx * handler and close() cleanup. * Ken Aaker : Correct check for whether @@ -64,7 +65,10 @@ #include #include #include + +#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) #include +#endif #ifdef SIOCETHTOOL #include @@ -84,8 +88,10 @@ #ifdef CONFIG_ACENIC_OMIT_TIGON_I #define ACE_IS_TIGON_I(ap) 0 +#define ACE_TX_RING_ENTRIES(ap) MAX_TX_RING_ENTRIES #else #define ACE_IS_TIGON_I(ap) (ap->version == 1) +#define ACE_TX_RING_ENTRIES(ap) ap->tx_ring_entries #endif #ifndef PCI_VENDOR_ID_ALTEON @@ -317,9 +323,11 @@ #if (defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)) && \ defined(NETIF_F_HW_VLAN_RX) -#define ACENIC_DO_VLAN 1 +#define ACENIC_DO_VLAN 1 +#define ACE_RCB_VLAN_FLAG RCB_FLG_VLAN_ASSIST #else -#define ACENIC_DO_VLAN 0 +#define ACENIC_DO_VLAN 0 +#define ACE_RCB_VLAN_FLAG 0 #endif #include "acenic.h" @@ -560,7 +568,7 @@ static int dis_pci_mem_inval[ACE_MAX_MOD_PARMS] = {1, 1, 1, 1, 1, 1, 1, 1}; static char version[] __initdata = - "acenic.c: v0.85 11/08/2001 Jes Sorensen, linux-acenic@SunSITE.dk\n" + "acenic.c: v0.89 03/15/2002 Jes Sorensen, linux-acenic@SunSITE.dk\n" " http://home.cern.ch/~jes/gige/acenic.html\n"; static struct net_device *root_dev; @@ -627,7 +635,6 @@ ap = dev->priv; ap->pdev = pdev; - dev->irq = pdev->irq; dev->open = &ace_open; dev->hard_start_xmit = &ace_start_xmit; dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM; @@ -737,9 +744,9 @@ ap->name [sizeof (ap->name) - 1] = '\0'; printk("Gigabit Ethernet at 0x%08lx, ", dev->base_addr); #ifdef __sparc__ - printk("irq %s\n", __irq_itoa(dev->irq)); + printk("irq %s\n", __irq_itoa(pdev->irq)); #else - printk("irq %i\n", dev->irq); + printk("irq %i\n", pdev->irq); #endif #ifdef CONFIG_ACENIC_OMIT_TIGON_I @@ -972,6 +979,13 @@ ap->evt_ring_dma); ap->evt_ring = NULL; } + if (ap->tx_ring != NULL && !ACE_IS_TIGON_I(ap)) { + size = (sizeof(struct tx_desc) * MAX_TX_RING_ENTRIES); + pci_free_consistent(ap->pdev, size, ap->tx_ring, + ap->tx_ring_dma); + } + ap->tx_ring = NULL; + if (ap->evt_prd != NULL) { pci_free_consistent(ap->pdev, sizeof(u32), (void *)ap->evt_prd, ap->evt_prd_dma); @@ -1018,12 +1032,19 @@ if (ap->evt_ring == NULL) goto fail; - size = (sizeof(struct tx_desc) * TX_RING_ENTRIES); + /* + * Only allocate a host TX ring for the Tigon II, the Tigon I + * has to use PCI registers for this ;-( + */ + if (!ACE_IS_TIGON_I(ap)) { + size = (sizeof(struct tx_desc) * MAX_TX_RING_ENTRIES); - ap->tx_ring = pci_alloc_consistent(ap->pdev, size, &ap->tx_ring_dma); + ap->tx_ring = pci_alloc_consistent(ap->pdev, size, + &ap->tx_ring_dma); - if (ap->tx_ring == NULL) - goto fail; + if (ap->tx_ring == NULL) + goto fail; + } ap->evt_prd = pci_alloc_consistent(ap->pdev, sizeof(u32), &ap->evt_prd_dma); @@ -1098,6 +1119,7 @@ struct ace_private *ap; struct ace_regs *regs; struct ace_info *info = NULL; + struct pci_dev *pdev; unsigned long myjif; u64 tmp_ptr; u32 tig_ver, mac1, mac2, tmp, pci_state; @@ -1156,6 +1178,7 @@ tigonFwReleaseFix); writel(0, ®s->LocalCtrl); ap->version = 1; + ap->tx_ring_entries = TIGON_I_TX_RING_ENTRIES; break; #endif case 6: @@ -1171,6 +1194,7 @@ writel(SRAM_BANK_512K, ®s->LocalCtrl); writel(SYNC_SRAM_TIMING, ®s->MiscCfg); ap->version = 2; + ap->tx_ring_entries = MAX_TX_RING_ENTRIES; break; default: printk(KERN_WARNING " Unsupported Tigon version detected " @@ -1236,7 +1260,8 @@ * Ie. having two NICs in the machine, one will have the cache * line set at boot time, the other will not. */ - pci_read_config_byte(ap->pdev, PCI_CACHE_LINE_SIZE, &cache_size); + pdev = ap->pdev; + pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &cache_size); cache_size <<= 2; if (cache_size != SMP_CACHE_BYTES) { printk(KERN_INFO " PCI cache line size set incorrectly " @@ -1245,7 +1270,7 @@ printk("expecting %i\n", SMP_CACHE_BYTES); else { printk("correcting to %i\n", SMP_CACHE_BYTES); - pci_write_config_byte(ap->pdev, PCI_CACHE_LINE_SIZE, + pci_write_config_byte(pdev, PCI_CACHE_LINE_SIZE, SMP_CACHE_BYTES >> 2); } } @@ -1277,7 +1302,7 @@ dis_pci_mem_inval[board_idx]) { if (ap->pci_command & PCI_COMMAND_INVALIDATE) { ap->pci_command &= ~PCI_COMMAND_INVALIDATE; - pci_write_config_word(ap->pdev, PCI_COMMAND, + pci_write_config_word(pdev, PCI_COMMAND, ap->pci_command); printk(KERN_INFO " Disabling PCI memory " "write and invalidate\n"); @@ -1304,7 +1329,7 @@ "supported, PCI write and invalidate " "disabled\n", SMP_CACHE_BYTES); ap->pci_command &= ~PCI_COMMAND_INVALIDATE; - pci_write_config_word(ap->pdev, PCI_COMMAND, + pci_write_config_word(pdev, PCI_COMMAND, ap->pci_command); } } @@ -1346,16 +1371,16 @@ if (!(ap->pci_command & PCI_COMMAND_FAST_BACK)) { printk(KERN_INFO " Enabling PCI Fast Back to Back\n"); ap->pci_command |= PCI_COMMAND_FAST_BACK; - pci_write_config_word(ap->pdev, PCI_COMMAND, ap->pci_command); + pci_write_config_word(pdev, PCI_COMMAND, ap->pci_command); } #endif /* * Configure DMA attributes. */ - if (!pci_set_dma_mask(ap->pdev, 0xffffffffffffffffULL)) { + if (!pci_set_dma_mask(pdev, 0xffffffffffffffffULL)) { ap->pci_using_dac = 1; - } else if (!pci_set_dma_mask(ap->pdev, 0xffffffffULL)) { + } else if (!pci_set_dma_mask(pdev, 0xffffffffULL)) { ap->pci_using_dac = 0; } else { ecode = -ENODEV; @@ -1382,12 +1407,14 @@ goto init_error; } - ecode = request_irq(dev->irq, ace_interrupt, SA_SHIRQ, dev->name, dev); + ecode = request_irq(pdev->irq, ace_interrupt, SA_SHIRQ, + dev->name, dev); if (ecode) { printk(KERN_WARNING "%s: Requested IRQ %d is busy\n", - dev->name, dev->irq); + dev->name, pdev->irq); goto init_error; - } + } else + dev->irq = pdev->irq; /* * Register the device here to be able to catch allocated @@ -1398,7 +1425,7 @@ #ifdef INDEX_DEBUG spin_lock_init(&ap->debug_lock); - ap->last_tx = TX_RING_ENTRIES - 1; + ap->last_tx = ACE_TX_RING_ENTRIES(ap) - 1; ap->last_std_rx = 0; ap->last_mini_rx = 0; #endif @@ -1439,10 +1466,8 @@ set_aceaddr(&info->rx_std_ctrl.rngptr, ap->rx_ring_base_dma); info->rx_std_ctrl.max_len = ACE_STD_MTU + ETH_HLEN + 4; - info->rx_std_ctrl.flags = RCB_FLG_TCP_UDP_SUM|RCB_FLG_NO_PSEUDO_HDR; -#if ACENIC_DO_VLAN - info->rx_std_ctrl.flags |= RCB_FLG_VLAN_ASSIST; -#endif + info->rx_std_ctrl.flags = + RCB_FLG_TCP_UDP_SUM | RCB_FLG_NO_PSEUDO_HDR | ACE_RCB_VLAN_FLAG; memset(ap->rx_std_ring, 0, RX_STD_RING_ENTRIES * sizeof(struct rx_desc)); @@ -1457,10 +1482,8 @@ (ap->rx_ring_base_dma + (sizeof(struct rx_desc) * RX_STD_RING_ENTRIES))); info->rx_jumbo_ctrl.max_len = 0; - info->rx_jumbo_ctrl.flags = RCB_FLG_TCP_UDP_SUM|RCB_FLG_NO_PSEUDO_HDR; -#if ACENIC_DO_VLAN - info->rx_jumbo_ctrl.flags |= RCB_FLG_VLAN_ASSIST; -#endif + info->rx_jumbo_ctrl.flags = + RCB_FLG_TCP_UDP_SUM | RCB_FLG_NO_PSEUDO_HDR | ACE_RCB_VLAN_FLAG; memset(ap->rx_jumbo_ring, 0, RX_JUMBO_RING_ENTRIES * sizeof(struct rx_desc)); @@ -1482,10 +1505,7 @@ RX_JUMBO_RING_ENTRIES)))); info->rx_mini_ctrl.max_len = ACE_MINI_SIZE; info->rx_mini_ctrl.flags = - RCB_FLG_TCP_UDP_SUM|RCB_FLG_NO_PSEUDO_HDR; -#if ACENIC_DO_VLAN - info->rx_mini_ctrl.flags |= RCB_FLG_VLAN_ASSIST; -#endif + RCB_FLG_TCP_UDP_SUM|RCB_FLG_NO_PSEUDO_HDR|ACE_RCB_VLAN_FLAG; for (i = 0; i < RX_MINI_RING_ENTRIES; i++) ap->rx_mini_ring[i].flags = @@ -1515,18 +1535,33 @@ *(ap->rx_ret_prd) = 0; writel(TX_RING_BASE, ®s->WinBase); - memset(ap->tx_ring, 0, TX_RING_ENTRIES * sizeof(struct tx_desc)); - set_aceaddr(&info->tx_ctrl.rngptr, ap->tx_ring_dma); + if (ACE_IS_TIGON_I(ap)) { + ap->tx_ring = (struct tx_desc *)regs->Window; + for (i = 0; i < (TIGON_I_TX_RING_ENTRIES * + sizeof(struct tx_desc) / 4); i++) { + writel(0, (unsigned long)ap->tx_ring + i * 4); + } - info->tx_ctrl.max_len = TX_RING_ENTRIES; - tmp = RCB_FLG_TCP_UDP_SUM|RCB_FLG_NO_PSEUDO_HDR|RCB_FLG_TX_HOST_RING; + set_aceaddr(&info->tx_ctrl.rngptr, TX_RING_BASE); + } else { + memset(ap->tx_ring, 0, + MAX_TX_RING_ENTRIES * sizeof(struct tx_desc)); + + set_aceaddr(&info->tx_ctrl.rngptr, ap->tx_ring_dma); + } + + info->tx_ctrl.max_len = ACE_TX_RING_ENTRIES(ap); + tmp = RCB_FLG_TCP_UDP_SUM | RCB_FLG_NO_PSEUDO_HDR | ACE_RCB_VLAN_FLAG; + + /* + * The Tigon I does not like having the TX ring in host memory ;-( + */ + if (!ACE_IS_TIGON_I(ap)) + tmp |= RCB_FLG_TX_HOST_RING; #if TX_COAL_INTS_ONLY tmp |= RCB_FLG_COAL_INT_ONLY; #endif -#if ACENIC_DO_VLAN - tmp |= RCB_FLG_VLAN_ASSIST; -#endif info->tx_ctrl.flags = tmp; set_aceaddr(&info->tx_csm_ptr, ap->tx_csm_dma); @@ -1552,7 +1587,7 @@ ace_set_rxtx_parms(dev, 0); if (board_idx == BOARD_IDX_OVERFLOW) { - printk(KERN_WARNING "%s: more then %i NICs detected, " + printk(KERN_WARNING "%s: more than %i NICs detected, " "ignoring module parameters!\n", dev->name, ACE_MAX_MOD_PARMS); } else if (board_idx >= 0) { @@ -2141,14 +2176,6 @@ } -#if ACENIC_DO_VLAN -static int ace_vlan_rx(struct ace_private *ap, struct sk_buff *skb, u16 vlan_tag) -{ - return vlan_hwaccel_rx(skb, ap->vlgrp, vlan_tag); -} -#endif - - static void ace_rx_int(struct net_device *dev, u32 rxretprd, u32 rxretcsm) { struct ace_private *ap = dev->priv; @@ -2234,11 +2261,9 @@ } /* send it up */ - #if ACENIC_DO_VLAN - if (ap->vlgrp != NULL && - (bd_flags & BD_FLG_VLAN_TAG)) { - ace_vlan_rx(ap, skb, retdesc->vlan); + if (ap->vlgrp && (bd_flags & BD_FLG_VLAN_TAG)) { + vlan_hwaccel_rx(skb, ap->vlgrp, retdesc->vlan); } else #endif netif_rx(skb); @@ -2300,7 +2325,7 @@ info->skb = NULL; } - idx = (idx + 1) % TX_RING_ENTRIES; + idx = (idx + 1) % ACE_TX_RING_ENTRIES(ap); } while (idx != txcsm); if (netif_queue_stopped(dev)) @@ -2393,7 +2418,7 @@ * update releases enough of space, otherwise we just * wait for device to make more work. */ - if (!tx_ring_full(txcsm, ap->tx_prd)) + if (!tx_ring_full(ap, txcsm, ap->tx_prd)) ace_tx_int(dev, txcsm, idx); } @@ -2598,7 +2623,7 @@ save_flags(flags); cli(); - for (i = 0; i < TX_RING_ENTRIES; i++) { + for (i = 0; i < ACE_TX_RING_ENTRIES(ap); i++) { struct sk_buff *skb; dma_addr_t mapping; struct tx_ring_info *info; @@ -2608,7 +2633,13 @@ mapping = pci_unmap_addr(info, mapping); if (mapping) { - memset(ap->tx_ring + i, 0, sizeof(struct tx_desc)); + if (ACE_IS_TIGON_I(ap)) { + writel(0, &ap->tx_ring[i].addr.addrhi); + writel(0, &ap->tx_ring[i].addr.addrlo); + writel(0, &ap->tx_ring[i].flagsize); + } else + memset(ap->tx_ring + i, 0, + sizeof(struct tx_desc)); pci_unmap_page(ap->pdev, mapping, pci_unmap_len(info, maplen), PCI_DMA_TODEVICE); @@ -2633,6 +2664,7 @@ return 0; } + static inline dma_addr_t ace_map_tx_skb(struct ace_private *ap, struct sk_buff *skb, struct sk_buff *tail, u32 idx) @@ -2653,18 +2685,28 @@ static inline void -ace_load_tx_bd(struct tx_desc *desc, u64 addr, u32 flagsize, u32 vlan_tag) +ace_load_tx_bd(struct ace_private *ap, struct tx_desc *desc, u64 addr, + u32 flagsize, u32 vlan_tag) { #if !USE_TX_COAL_NOW flagsize &= ~BD_FLG_COAL_NOW; #endif - desc->addr.addrhi = addr >> 32; - desc->addr.addrlo = addr; - desc->flagsize = flagsize; + if (!ACE_IS_TIGON_I(ap)) { + writel(addr >> 32, &desc->addr.addrhi); + writel(addr & 0xffffffff, &desc->addr.addrlo); + writel(flagsize, &desc->flagsize); +#if ACENIC_DO_VLAN + writel(vlan_tag, &desc->vlanres); +#endif + } else { + desc->addr.addrhi = addr >> 32; + desc->addr.addrlo = addr; + desc->flagsize = flagsize; #if ACENIC_DO_VLAN - desc->vlanres = vlan_tag; + desc->vlanres = vlan_tag; #endif + } } @@ -2681,11 +2723,10 @@ if (early_stop_netif_stop_queue(dev)) return 1; - restart: idx = ap->tx_prd; - if (tx_ring_full(ap->tx_ret_csm, idx)) + if (tx_ring_full(ap, ap->tx_ret_csm, idx)) goto overflow; #if MAX_SKB_FRAGS @@ -2706,13 +2747,13 @@ } #endif desc = ap->tx_ring + idx; - idx = (idx + 1) % TX_RING_ENTRIES; + idx = (idx + 1) % ACE_TX_RING_ENTRIES(ap); /* Look at ace_tx_int for explanations. */ - if (tx_ring_full(ap->tx_ret_csm, idx)) + if (tx_ring_full(ap, ap->tx_ret_csm, idx)) flagsize |= BD_FLG_COAL_NOW; - ace_load_tx_bd(desc, mapping, flagsize, vlan_tag); + ace_load_tx_bd(ap, desc, mapping, flagsize, vlan_tag); } #if MAX_SKB_FRAGS else { @@ -2731,9 +2772,9 @@ } #endif - ace_load_tx_bd(ap->tx_ring + idx, mapping, flagsize, vlan_tag); + ace_load_tx_bd(ap, ap->tx_ring + idx, mapping, flagsize, vlan_tag); - idx = (idx + 1) % TX_RING_ENTRIES; + idx = (idx + 1) % ACE_TX_RING_ENTRIES(ap); for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; @@ -2750,11 +2791,11 @@ flagsize = (frag->size << 16); if (skb->ip_summed == CHECKSUM_HW) flagsize |= BD_FLG_TCP_UDP_SUM; - idx = (idx + 1) % TX_RING_ENTRIES; + idx = (idx + 1) % ACE_TX_RING_ENTRIES(ap); if (i == skb_shinfo(skb)->nr_frags - 1) { flagsize |= BD_FLG_END; - if (tx_ring_full(ap->tx_ret_csm, idx)) + if (tx_ring_full(ap, ap->tx_ret_csm, idx)) flagsize |= BD_FLG_COAL_NOW; /* @@ -2767,7 +2808,7 @@ } pci_unmap_addr_set(info, mapping, mapping); pci_unmap_len_set(info, maplen, frag->size); - ace_load_tx_bd(desc, mapping, flagsize, vlan_tag); + ace_load_tx_bd(ap, desc, mapping, flagsize, vlan_tag); } } #endif @@ -2785,7 +2826,7 @@ * serialized, this is the only situation we have to * re-test. */ - if (!tx_ring_full(ap->tx_ret_csm, idx)) + if (!tx_ring_full(ap, ap->tx_ret_csm, idx)) netif_wake_queue(dev); } @@ -2864,8 +2905,8 @@ return -EOPNOTSUPP; if (copy_from_user(&ecmd, ifr->ifr_data, sizeof(ecmd))) return -EFAULT; - - if (ecmd.cmd == ETHTOOL_GSET) { + switch (ecmd.cmd) { + case ETHTOOL_GSET: ecmd.supported = (SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full | SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full | @@ -2913,7 +2954,8 @@ if(copy_to_user(ifr->ifr_data, &ecmd, sizeof(ecmd))) return -EFAULT; return 0; - } else if (ecmd.cmd == ETHTOOL_SSET) { + + case ETHTOOL_SSET: if(!capable(CAP_NET_ADMIN)) return -EPERM; @@ -2970,7 +3012,24 @@ ace_issue_cmd(regs, &cmd); } return 0; + + case ETHTOOL_GDRVINFO: { + struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO}; + strncpy(info.driver, "acenic", sizeof(info.driver) - 1); + sprintf(info.fw_version, "%i.%i.%i", + tigonFwReleaseMajor, tigonFwReleaseMinor, + tigonFwReleaseFix); + strncpy(info.version, version, sizeof(info.version) - 1); + if (ap && ap->pdev) + strcpy(info.bus_info, ap->pdev->slot_name); + if (copy_to_user(ifr->ifr_data, &info, sizeof(info))) + return -EFAULT; + return 0; + } + default: + break; } + #endif return -EOPNOTSUPP; diff -Naur -X /g/g/lib/dontdiff /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/acenic.h net-drivers-2.4/drivers/net/acenic.h --- /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/acenic.h Thu Mar 21 06:39:14 2002 +++ net-drivers-2.4/drivers/net/acenic.h Thu Mar 21 06:38:21 2002 @@ -446,11 +446,12 @@ /* - * TX ring + * TX ring - maximum TX ring entries for Tigon I's is 128 */ -#define TX_RING_ENTRIES 256 -#define TX_RING_SIZE (TX_RING_ENTRIES * sizeof(struct tx_desc)) -#define TX_RING_BASE 0x3800 +#define MAX_TX_RING_ENTRIES 256 +#define TIGON_I_TX_RING_ENTRIES 128 +#define TX_RING_SIZE (MAX_TX_RING_ENTRIES * sizeof(struct tx_desc)) +#define TX_RING_BASE 0x3800 struct tx_desc{ aceaddr addr; @@ -617,7 +618,7 @@ */ struct ace_skb { - struct tx_ring_info tx_skbuff[TX_RING_ENTRIES]; + struct tx_ring_info tx_skbuff[MAX_TX_RING_ENTRIES]; struct ring_info rx_std_skbuff[RX_STD_RING_ENTRIES]; struct ring_info rx_mini_skbuff[RX_MINI_RING_ENTRIES]; struct ring_info rx_jumbo_skbuff[RX_JUMBO_RING_ENTRIES]; @@ -641,10 +642,6 @@ struct ace_skb *skb; dma_addr_t info_dma; /* 32/64 bit */ -#if ACENIC_DO_VLAN - struct vlan_group *vlgrp; -#endif - int version, link; int promisc, mcast_all; @@ -654,7 +651,7 @@ struct tx_desc *tx_ring; u32 tx_prd; volatile u32 tx_ret_csm; - struct timer_list timer; + int tx_ring_entries; /* * RX elements @@ -673,6 +670,10 @@ struct rx_desc *rx_mini_ring; struct rx_desc *rx_return_ring; +#if ACENIC_DO_VLAN + struct vlan_group *vlgrp; +#endif + int tasklet_pending, jumbo; struct tasklet_struct ace_tasklet; @@ -705,17 +706,17 @@ #define TX_RESERVED MAX_SKB_FRAGS -static inline int tx_space (u32 csm, u32 prd) +static inline int tx_space (struct ace_private *ap, u32 csm, u32 prd) { - return (csm - prd - 1) & (TX_RING_ENTRIES - 1); + return (csm - prd - 1) & (ACE_TX_RING_ENTRIES(ap) - 1); } -#define tx_free(ap) tx_space((ap)->tx_ret_csm, (ap)->tx_prd) +#define tx_free(ap) tx_space((ap)->tx_ret_csm, (ap)->tx_prd, ap) #if MAX_SKB_FRAGS -#define tx_ring_full(csm, prd) (tx_space(csm, prd) <= TX_RESERVED) +#define tx_ring_full(ap, csm, prd) (tx_space(ap, csm, prd) <= TX_RESERVED) #else -#define tx_ring_full 0 +#define tx_ring_full 0 #endif @@ -724,7 +725,7 @@ u64 baddr = (u64) addr; aa->addrlo = baddr & 0xffffffff; aa->addrhi = baddr >> 32; - mb(); + wmb(); } diff -Naur -X /g/g/lib/dontdiff /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/at1700.c net-drivers-2.4/drivers/net/at1700.c --- /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/at1700.c Thu Mar 21 06:39:14 2002 +++ net-drivers-2.4/drivers/net/at1700.c Thu Mar 21 06:38:21 2002 @@ -836,6 +836,7 @@ i++, mclist = mclist->next) set_bit(ether_crc_le(ETH_ALEN, mclist->dmi_addr) >> 26, mc_filter); + outb(0x02, ioaddr + RX_MODE); /* Use normal mode. */ } save_flags(flags); diff -Naur -X /g/g/lib/dontdiff /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/bmac.c net-drivers-2.4/drivers/net/bmac.c --- /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/bmac.c Thu Mar 21 06:39:14 2002 +++ net-drivers-2.4/drivers/net/bmac.c Thu Mar 21 06:38:21 2002 @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include diff -Naur -X /g/g/lib/dontdiff /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/de4x5.c net-drivers-2.4/drivers/net/de4x5.c --- /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/de4x5.c Thu Mar 21 06:39:14 2002 +++ net-drivers-2.4/drivers/net/de4x5.c Thu Mar 21 06:38:22 2002 @@ -657,15 +657,15 @@ ** DESC_ALIGN. ALIGN aligns the start address of the private memory area ** and hence the RX descriptor ring's first entry. */ -#define ALIGN4 ((u_long)4 - 1) /* 1 longword align */ -#define ALIGN8 ((u_long)8 - 1) /* 2 longword align */ -#define ALIGN16 ((u_long)16 - 1) /* 4 longword align */ -#define ALIGN32 ((u_long)32 - 1) /* 8 longword align */ -#define ALIGN64 ((u_long)64 - 1) /* 16 longword align */ -#define ALIGN128 ((u_long)128 - 1) /* 32 longword align */ +#define DE4X5_ALIGN4 ((u_long)4 - 1) /* 1 longword align */ +#define DE4X5_ALIGN8 ((u_long)8 - 1) /* 2 longword align */ +#define DE4X5_ALIGN16 ((u_long)16 - 1) /* 4 longword align */ +#define DE4X5_ALIGN32 ((u_long)32 - 1) /* 8 longword align */ +#define DE4X5_ALIGN64 ((u_long)64 - 1) /* 16 longword align */ +#define DE4X5_ALIGN128 ((u_long)128 - 1) /* 32 longword align */ -#define ALIGN ALIGN32 /* Keep the DC21040 happy... */ -#define CACHE_ALIGN CAL_16LONG +#define DE4X5_ALIGN DE4X5_ALIGN32 /* Keep the DC21040 happy... */ +#define DE4X5_CACHE_ALIGN CAL_16LONG #define DESC_SKIP_LEN DSL_0 /* Must agree with DESC_ALIGN */ /*#define DESC_ALIGN u32 dummy[4]; / * Must agree with DESC_SKIP_LEN */ #define DESC_ALIGN @@ -1202,7 +1202,7 @@ ** Reserve a section of kernel memory for the adapter ** private area and the TX/RX descriptor rings. */ - dev->priv = (void *) kmalloc(sizeof(struct de4x5_private) + ALIGN, + dev->priv = (void *) kmalloc(sizeof(struct de4x5_private) + DE4X5_ALIGN, GFP_KERNEL); if (dev->priv == NULL) { return -ENOMEM; @@ -1212,7 +1212,7 @@ ** Align to a longword boundary */ tmp = dev->priv; - dev->priv = (void *)(((u_long)dev->priv + ALIGN) & ~ALIGN); + dev->priv = (void *)(((u_long)dev->priv + DE4X5_ALIGN) & ~DE4X5_ALIGN); lp = (struct de4x5_private *)dev->priv; memset(dev->priv, 0, sizeof(struct de4x5_private)); lp->bus = bus.bus; @@ -1248,7 +1248,7 @@ lp->dma_size = (NUM_RX_DESC + NUM_TX_DESC) * sizeof(struct de4x5_desc); #if defined(__alpha__) || defined(__powerpc__) || defined(__sparc_v9__) || defined(DE4X5_DO_MEMCPY) - lp->dma_size += RX_BUFF_SZ * NUM_RX_DESC + ALIGN; + lp->dma_size += RX_BUFF_SZ * NUM_RX_DESC + DE4X5_ALIGN; #endif lp->rx_ring = pci_alloc_consistent(pdev, lp->dma_size, &lp->dma_rings); if (lp->rx_ring == NULL) { @@ -1278,9 +1278,9 @@ dma_rx_bufs = lp->dma_rings + (NUM_RX_DESC + NUM_TX_DESC) * sizeof(struct de4x5_desc); - dma_rx_bufs = (dma_rx_bufs + ALIGN) & ~ALIGN; + dma_rx_bufs = (dma_rx_bufs + DE4X5_ALIGN) & ~DE4X5_ALIGN; lp->rx_bufs = (char *)(((long)(lp->rx_ring + NUM_RX_DESC - + NUM_TX_DESC) + ALIGN) & ~ALIGN); + + NUM_TX_DESC) + DE4X5_ALIGN) & ~DE4X5_ALIGN); for (i=0; irx_ring[i].status = 0; lp->rx_ring[i].des1 = cpu_to_le32(RX_BUFF_SZ); @@ -1489,7 +1489,7 @@ ** Fasternet chips and 4 longwords for all others: DMA errors result ** without these values. Cache align 16 long. */ - bmr = (lp->chipset==DC21140 ? PBL_8 : PBL_4) | DESC_SKIP_LEN | CACHE_ALIGN; + bmr = (lp->chipset==DC21140 ? PBL_8 : PBL_4) | DESC_SKIP_LEN | DE4X5_CACHE_ALIGN; bmr |= ((lp->chipset & ~0x00ff)==DC2114x ? BMR_RML : 0); outl(bmr, DE4X5_BMR); @@ -3638,12 +3638,12 @@ struct sk_buff *ret; u_long i=0, tmp; - p = dev_alloc_skb(IEEE802_3_SZ + ALIGN + 2); + p = dev_alloc_skb(IEEE802_3_SZ + DE4X5_ALIGN + 2); if (!p) return NULL; p->dev = dev; tmp = virt_to_bus(p->data); - i = ((tmp + ALIGN) & ~ALIGN) - tmp; + i = ((tmp + DE4X5_ALIGN) & ~DE4X5_ALIGN) - tmp; skb_reserve(p, i); lp->rx_ring[index].buf = cpu_to_le32(tmp + i); diff -Naur -X /g/g/lib/dontdiff /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/de620.c net-drivers-2.4/drivers/net/de620.c --- /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/de620.c Sun Sep 30 19:26:06 2001 +++ net-drivers-2.4/drivers/net/de620.c Thu Mar 21 06:38:23 2002 @@ -449,11 +449,17 @@ return ret; } - if (adapter_init(dev)) - return -EIO; + if (adapter_init(dev)) { + ret = -EIO; + goto out_free_irq; + } netif_start_queue(dev); return 0; + +out_free_irq: + free_irq(dev->irq, dev); + return ret; } /************************************************ @@ -850,7 +856,10 @@ return -EBUSY; } #endif - request_region(dev->base_addr, 3, "de620"); + if (!request_region(dev->base_addr, 3, "de620")) { + printk(KERN_ERR "io 0x%3lX, which is busy.\n", dev->base_addr); + return -EBUSY; + } /* else, got it! */ printk(", Ethernet Address: %2.2X", diff -Naur -X /g/g/lib/dontdiff /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/dl2k.c net-drivers-2.4/drivers/net/dl2k.c --- /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/dl2k.c Thu Mar 21 06:39:14 2002 +++ net-drivers-2.4/drivers/net/dl2k.c Thu Mar 21 06:38:23 2002 @@ -1,6 +1,6 @@ /* D-Link DL2000-based Gigabit Ethernet Adapter Linux driver */ /* - Copyright (c) 2001 by D-Link Corporation + Copyright (c) 2001,2002 by D-Link Corporation Written by Edward Peng. Created 03-May-2001, base on Linux' sundance.c. @@ -27,12 +27,14 @@ Added tx_coalesce paramter. 1.07 2002/01/03 Fixed miscount of RX frame error. 1.08 2002/01/17 Fixed the multicast bug. + 1.09 2002/03/07 Move rx-poll-now to re-fill loop. + Added rio_timer() to watch rx buffers. */ #include "dl2k.h" static char version[] __devinitdata = - KERN_INFO "D-Link DL2000-based linux driver v1.08 2002/01/17\n"; + KERN_INFO "D-Link DL2000-based linux driver v1.09 2002/03/07\n"; #define MAX_UNITS 8 static int mtu[MAX_UNITS]; @@ -42,9 +44,10 @@ static int tx_flow[MAX_UNITS]; static int rx_flow[MAX_UNITS]; static int copy_thresh; -static int rx_coalesce = DEFAULT_RXC; -static int rx_timeout = DEFAULT_RXT; -static int tx_coalesce = DEFAULT_TXC; +static int rx_coalesce; /* Rx frame count each interrupt */ +static int rx_timeout; /* Rx DMA wait time in 64ns increments */ +static int tx_coalesce = DEFAULT_TXC; /* HW xmit count each TxComplete [1-8] */ + MODULE_AUTHOR ("Edward Peng"); MODULE_DESCRIPTION ("D-Link DL2000-based Gigabit Ethernet Adapter"); @@ -71,6 +74,7 @@ static int multicast_filter_limit = 0x40; static int rio_open (struct net_device *dev); +static void rio_timer (unsigned long data); static void tx_timeout (struct net_device *dev); static void alloc_list (struct net_device *dev); static int start_xmit (struct sk_buff *skb, struct net_device *dev); @@ -146,6 +150,7 @@ np->chip_id = chip_idx; np->pdev = pdev; spin_lock_init (&np->lock); + spin_lock_init (&np->rx_lock); /* Parse manual configuration */ np->an_enable = 1; @@ -260,6 +265,7 @@ np->an_enable = 1; mii_set_media (dev); } + pci_read_config_byte(pdev, PCI_REVISION_ID, &np->pci_rev_id); /* Reset all logic functions */ writew (GlobalReset | DMAReset | FIFOReset | NetworkReset | HostReset, @@ -340,7 +346,7 @@ } /* Check CRC */ - crc = ~ether_crc_le(256-4, sromdata); + crc = ~ether_crc_le(256 - 4, sromdata); if (psrom->crc != crc) { printk (KERN_ERR "%s: EEPROM data CRC error.\n", dev->name); return -1; @@ -421,8 +427,10 @@ ioaddr + RxDMAIntCtrl); } /* Set RIO to poll every N*320nsec. */ - writeb (0xff, ioaddr + RxDMAPollPeriod); + writeb (0x20, ioaddr + RxDMAPollPeriod); writeb (0xff, ioaddr + TxDMAPollPeriod); + writeb (0x30, ioaddr + RxDMABurstThresh); + writeb (0x30, ioaddr + RxDMAUrgentThresh); netif_start_queue (dev); writel (StatsEnable | RxEnable | TxEnable, ioaddr + MACCtrl); /* VLAN supported */ @@ -445,9 +453,59 @@ /* clear statistics */ get_stats (dev); + init_timer (&np->timer); + np->timer.expires = jiffies + 1*HZ; + np->timer.data = (unsigned long) dev; + np->timer.function = &rio_timer; + add_timer (&np->timer); return 0; } +static void +rio_timer (unsigned long data) +{ + struct net_device *dev = (struct net_device *)data; + struct netdev_private *np = dev->priv; + unsigned int entry; + int next_tick = 1*HZ; + unsigned long flags; + /* Recover rx ring exhausted error */ + if (np->cur_rx - np->old_rx >= RX_RING_SIZE) { + printk(KERN_INFO "Try to recover rx ring exhausted...\n"); + spin_lock_irqsave(&np->rx_lock, flags); + /* Re-allocate skbuffs to fill the descriptor ring */ + for (; np->cur_rx - np->old_rx > 0; np->old_rx++) { + struct sk_buff *skb; + entry = np->old_rx % RX_RING_SIZE; + /* Dropped packets don't need to re-allocate */ + if (np->rx_skbuff[entry] == NULL) { + skb = dev_alloc_skb (np->rx_buf_sz); + if (skb == NULL) { + np->rx_ring[entry].fraginfo = 0; + printk (KERN_INFO + "%s: Still unable to re-allocate Rx skbuff.#%d\n", + dev->name, entry); + break; + } + np->rx_skbuff[entry] = skb; + skb->dev = dev; + /* 16 byte align the IP header */ + skb_reserve (skb, 2); + np->rx_ring[entry].fraginfo = + cpu_to_le64 (pci_map_single + (np->pdev, skb->tail, np->rx_buf_sz, + PCI_DMA_FROMDEVICE)); + } + np->rx_ring[entry].fraginfo |= + cpu_to_le64 (np->rx_buf_sz) << 48; + np->rx_ring[entry].status = 0; + } /* end for */ + spin_unlock_irqrestore (&np->rx_lock, flags); + } /* end if */ + np->timer.expires = jiffies + next_tick; + add_timer(&np->timer); +} + static void tx_timeout (struct net_device *dev) { @@ -499,16 +557,14 @@ np->tx_ring[i].status = cpu_to_le64 (TFDDone); np->tx_ring[i].next_desc = cpu_to_le64 (np->tx_ring_dma + ((i+1)%TX_RING_SIZE) * - sizeof (struct - netdev_desc)); + sizeof (struct netdev_desc)); } /* Initialize Rx descriptors */ for (i = 0; i < RX_RING_SIZE; i++) { np->rx_ring[i].next_desc = cpu_to_le64 (np->rx_ring_dma + ((i + 1) % RX_RING_SIZE) * - sizeof (struct - netdev_desc)); + sizeof (struct netdev_desc)); np->rx_ring[i].status = 0; np->rx_ring[i].fraginfo = 0; np->rx_skbuff[i] = 0; @@ -529,8 +585,8 @@ skb_reserve (skb, 2); /* 16 byte align the IP header. */ /* Rubicon now supports 40 bits of addressing space. */ np->rx_ring[i].fraginfo = - cpu_to_le64 (pci_map_single - (np->pdev, skb->tail, np->rx_buf_sz, + cpu_to_le64 ( pci_map_single ( + np->pdev, skb->tail, np->rx_buf_sz, PCI_DMA_FROMDEVICE)); np->rx_ring[i].fraginfo |= cpu_to_le64 (np->rx_buf_sz) << 48; } @@ -773,6 +829,8 @@ int entry = np->cur_rx % RX_RING_SIZE; int cnt = np->old_rx + RX_RING_SIZE - np->cur_rx; int rx_shift; + + spin_lock (&np->rx_lock); if (np->old_rx > RX_RING_SIZE) { rx_shift = RX_RING_SIZE; np->old_rx -= rx_shift; @@ -828,12 +886,14 @@ skb_put (skb, pkt_len); } skb->protocol = eth_type_trans (skb, dev); -#if 0 +#if 0 /* Checksum done by hw, but csum value unavailable. */ - if (!(frame_status & (TCPError | UDPError | IPError))) { + if (np->pci_rev_id >= 0x0c && + !(frame_status & (TCPError | UDPError | IPError))) { skb->ip_summed = CHECKSUM_UNNECESSARY; - } + } #endif + netif_rx (skb); dev->last_rx = jiffies; } @@ -849,9 +909,10 @@ skb = dev_alloc_skb (np->rx_buf_sz); if (skb == NULL) { np->rx_ring[entry].fraginfo = 0; - printk (KERN_ERR - "%s: Allocate Rx buffer error!", - dev->name); + printk (KERN_INFO + "%s: receive_packet: " + "Unable to re-allocate Rx skbuff.#%d\n", + dev->name, entry); break; } np->rx_skbuff[entry] = skb; @@ -866,13 +927,12 @@ np->rx_ring[entry].fraginfo |= cpu_to_le64 (np->rx_buf_sz) << 48; np->rx_ring[entry].status = 0; + /* RxDMAPollNow */ + writel (readl (dev->base_addr + DMACtrl) | 0x00000010, + dev->base_addr + DMACtrl); } - - /* RxDMAPollNow */ - writel (readl (dev->base_addr + DMACtrl) | 0x00000010, - dev->base_addr + DMACtrl); - DEBUG_RFD_DUMP (np, 2); + spin_unlock(&np->rx_lock); return 0; } @@ -1006,7 +1066,7 @@ hash_table[0] = hash_table[1] = 0; /* RxFlowcontrol DA: 01-80-C2-00-00-01. Hash index=0x39 */ - hash_table[1] |= 0x02000000; + hash_table[1] |= cpu_to_le32(0x02000000); if (dev->flags & IFF_PROMISC) { /* Receive all frames promiscuously. */ rx_mode = ReceiveAllFrames; @@ -1020,11 +1080,16 @@ rx_mode = ReceiveBroadcast | ReceiveMulticastHash | ReceiveUnicast; for (i=0, mclist = dev->mc_list; mclist && i < dev->mc_count; - i++, mclist=mclist->next) { + i++, mclist=mclist->next) { + crc = ether_crc_le (ETH_ALEN, mclist->dmi_addr); - for (index=0, bit=0; bit<6; bit++, crc<<=1) { - if (crc & 0x80000000) index |= 1 << bit; - } + + /* The inverted high significant 6 bits of CRC are + used as an index to hashtable */ + for (index = 0, bit = 0; bit < 6; bit++) + if (test_bit(31 - bit, &crc)) + set_bit(bit, &index); + hash_table[index / 32] |= (1 << (index % 32)); } } else { @@ -1094,6 +1159,7 @@ np->old_rx); break; case SIOCDEVPRIVATE + 8: + printk("TX ring:\n"); for (i = 0; i < TX_RING_SIZE; i++) { desc = &np->tx_ring[i]; printk @@ -1629,7 +1695,8 @@ writel (TxDisable | RxDisable | StatsDisable, ioaddr + MACCtrl); synchronize_irq (); free_irq (dev->irq, dev); - + del_timer_sync (&np->timer); + /* Free all the skbuffs in the queue. */ for (i = 0; i < RX_RING_SIZE; i++) { np->rx_ring[i].status = 0; @@ -1679,10 +1746,10 @@ } static struct pci_driver rio_driver = { - name:"dl2k", - id_table:rio_pci_tbl, - probe:rio_probe1, - remove:__devexit_p(rio_remove1), + name: "dl2k", + id_table: rio_pci_tbl, + probe: rio_probe1, + remove: __devexit_p(rio_remove1), }; static int __init diff -Naur -X /g/g/lib/dontdiff /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/dl2k.h net-drivers-2.4/drivers/net/dl2k.h --- /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/dl2k.h Thu Mar 21 06:39:14 2002 +++ net-drivers-2.4/drivers/net/dl2k.h Thu Mar 21 06:38:23 2002 @@ -1,6 +1,6 @@ /* D-Link DL2000-based Gigabit Ethernet Adapter Linux driver */ /* - Copyright (c) 2001 by D-Link Corporation + Copyright (c) 2001, 2002 by D-Link Corporation Written by Edward Peng. Created 03-May-2001, base on Linux' sundance.c. @@ -649,6 +649,7 @@ dma_addr_t rx_ring_dma; struct pci_dev *pdev; spinlock_t lock; + spinlock_t rx_lock; struct net_device_stats stats; unsigned int rx_buf_sz; /* Based on MTU+slack. */ unsigned int speed; /* Operating speed */ @@ -664,9 +665,11 @@ unsigned int tx_flow:1; /* Tx flow control enable */ unsigned int rx_flow:1; /* Rx flow control enable */ unsigned int phy_media:1; /* 1: fiber, 0: copper */ + unsigned char pci_rev_id; /* PCI revision ID */ struct netdev_desc *last_tx; /* Last Tx descriptor used. */ unsigned long cur_rx, old_rx; /* Producer/consumer ring indices */ unsigned long cur_tx, old_tx; + struct timer_list timer; int wake_polarity; char name[256]; /* net device description */ u8 duplex_polarity; diff -Naur -X /g/g/lib/dontdiff /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/e2100.c net-drivers-2.4/drivers/net/e2100.c --- /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/e2100.c Sun Sep 30 19:26:06 2001 +++ net-drivers-2.4/drivers/net/e2100.c Thu Mar 21 06:38:23 2002 @@ -388,10 +388,12 @@ MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_E21_CARDS) "i"); MODULE_PARM(mem, "1-" __MODULE_STRING(MAX_E21_CARDS) "i"); MODULE_PARM(xcvr, "1-" __MODULE_STRING(MAX_E21_CARDS) "i"); -MODULE_PARM_DESC(io, "E2100 I/O base address(es)"); -MODULE_PARM_DESC(irq, "E2100 IRQ number(s)"); -MODULE_PARM_DESC(mem, " E2100 memory base address(es)"); -MODULE_PARM_DESC(xcvr, "E2100 tranceiver(s) (0=internal, 1=external)"); +MODULE_PARM_DESC(io, "I/O base address(es)"); +MODULE_PARM_DESC(irq, "IRQ number(s)"); +MODULE_PARM_DESC(mem, " memory base address(es)"); +MODULE_PARM_DESC(xcvr, "tranceiver(s) (0=internal, 1=external)"); +MODULE_DESCRIPTION("Cabletron E2100 ISA ethernet driver"); +MODULE_LICENSE("GPL"); /* This is set up so that only a single autoprobe takes place per call. ISA device autoprobes on a running machine are not recommended. */ @@ -440,7 +442,6 @@ } } #endif /* MODULE */ -MODULE_LICENSE("GPL"); /* diff -Naur -X /g/g/lib/dontdiff /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/eepro100.c net-drivers-2.4/drivers/net/eepro100.c --- /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/eepro100.c Thu Mar 21 06:39:14 2002 +++ net-drivers-2.4/drivers/net/eepro100.c Thu Mar 21 06:38:23 2002 @@ -64,8 +64,8 @@ /* A few values that may be tweaked. */ /* The ring sizes should be a power of two for efficiency. */ -#define TX_RING_SIZE 32 -#define RX_RING_SIZE 32 +#define TX_RING_SIZE 64 +#define RX_RING_SIZE 64 /* How much slots multicast filter setup may take. Do not descrease without changing set_rx_mode() implementaion. */ #define TX_MULTICAST_SIZE 2 @@ -114,7 +114,6 @@ #include #include #include -#include MODULE_AUTHOR("Maintainer: Andrey V. Savochkin "); MODULE_DESCRIPTION("Intel i82557/i82558/i82559 PCI EtherExpressPro driver"); @@ -130,17 +129,17 @@ MODULE_PARM(rx_copybreak, "i"); MODULE_PARM(max_interrupt_work, "i"); MODULE_PARM(multicast_filter_limit, "i"); -MODULE_PARM_DESC(debug, "eepro100 debug level (0-6)"); -MODULE_PARM_DESC(options, "eepro100: Bits 0-3: tranceiver type, bit 4: full duplex, bit 5: 100Mbps"); -MODULE_PARM_DESC(full_duplex, "eepro100 full duplex setting(s) (1)"); -MODULE_PARM_DESC(congenb, "eepro100 Enable congestion control (1)"); -MODULE_PARM_DESC(txfifo, "eepro100 Tx FIFO threshold in 4 byte units, (0-15)"); -MODULE_PARM_DESC(rxfifo, "eepro100 Rx FIFO threshold in 4 byte units, (0-15)"); -MODULE_PARM_DESC(txdmaccount, "eepro100 Tx DMA burst length; 128 - disable (0-128)"); -MODULE_PARM_DESC(rxdmaccount, "eepro100 Rx DMA burst length; 128 - disable (0-128)"); -MODULE_PARM_DESC(rx_copybreak, "eepro100 copy breakpoint for copy-only-tiny-frames"); -MODULE_PARM_DESC(max_interrupt_work, "eepro100 maximum events handled per interrupt"); -MODULE_PARM_DESC(multicast_filter_limit, "eepro100 maximum number of filtered multicast addresses"); +MODULE_PARM_DESC(debug, "debug level (0-6)"); +MODULE_PARM_DESC(options, "Bits 0-3: tranceiver type, bit 4: full duplex, bit 5: 100Mbps"); +MODULE_PARM_DESC(full_duplex, "full duplex setting(s) (1)"); +MODULE_PARM_DESC(congenb, "Enable congestion control (1)"); +MODULE_PARM_DESC(txfifo, "Tx FIFO threshold in 4 byte units, (0-15)"); +MODULE_PARM_DESC(rxfifo, "Rx FIFO threshold in 4 byte units, (0-15)"); +MODULE_PARM_DESC(txdmaccount, "Tx DMA burst length; 128 - disable (0-128)"); +MODULE_PARM_DESC(rxdmaccount, "Rx DMA burst length; 128 - disable (0-128)"); +MODULE_PARM_DESC(rx_copybreak, "copy breakpoint for copy-only-tiny-frames"); +MODULE_PARM_DESC(max_interrupt_work, "maximum events handled per interrupt"); +MODULE_PARM_DESC(multicast_filter_limit, "maximum number of filtered multicast addresses"); #define RUN_AT(x) (jiffies + (x)) @@ -570,6 +569,19 @@ if (speedo_debug > 0 && did_version++ == 0) printk(version); + /* save power state before pci_enable_device overwrites it */ + pm = pci_find_capability(pdev, PCI_CAP_ID_PM); + if (pm) { + u16 pwr_command; + pci_read_config_word(pdev, pm + PCI_PM_CTRL, &pwr_command); + acpi_idle_state = pwr_command & PCI_PM_CTRL_STATE_MASK; + } + + if (pci_enable_device(pdev)) + goto err_out_free_mmio_region; + + pci_set_master(pdev); + if (!request_region(pci_resource_start(pdev, 1), pci_resource_len(pdev, 1), "eepro100")) { printk (KERN_ERR "eepro100: cannot reserve I/O ports\n"); @@ -600,18 +612,6 @@ pci_resource_start(pdev, 0), irq); #endif - /* save power state b4 pci_enable_device overwrites it */ - pm = pci_find_capability(pdev, PCI_CAP_ID_PM); - if (pm) { - u16 pwr_command; - pci_read_config_word(pdev, pm + PCI_PM_CTRL, &pwr_command); - acpi_idle_state = pwr_command & PCI_PM_CTRL_STATE_MASK; - } - - if (pci_enable_device(pdev)) - goto err_out_free_mmio_region; - - pci_set_master(pdev); if (speedo_found1(pdev, ioaddr, cards_found, acpi_idle_state) == 0) cards_found++; @@ -1074,6 +1074,51 @@ outw(CUStart | SCBMaskEarlyRx | SCBMaskFlowCtl, ioaddr + SCBCmd); } +/* + * Sometimes the receiver stops making progress. This routine knows how to + * get it going again, without losing packets or being otherwise nasty like + * a chip reset would be. Previously the driver had a whole sequence + * of if RxSuspended, if it's no buffers do one thing, if it's no resources, + * do another, etc. But those things don't really matter. Separate logic + * in the ISR provides for allocating buffers--the other half of operation + * is just making sure the receiver is active. speedo_rx_soft_reset does that. + * This problem with the old, more involved algorithm is shown up under + * ping floods on the order of 60K packets/second on a 100Mbps fdx network. + */ +static void +speedo_rx_soft_reset(struct net_device *dev) +{ + struct speedo_private *sp = dev->priv; + struct RxFD *rfd; + long ioaddr; + + ioaddr = dev->base_addr; + wait_for_cmd_done(ioaddr + SCBCmd); + if (inb(ioaddr + SCBCmd) != 0) { + printk("%s: previous command stalled\n", dev->name); + return; + } + /* + * Put the hardware into a known state. + */ + outb(RxAbort, ioaddr + SCBCmd); + + rfd = sp->rx_ringp[sp->cur_rx % RX_RING_SIZE]; + + rfd->rx_buf_addr = 0xffffffff; + + wait_for_cmd_done(ioaddr + SCBCmd); + + if (inb(ioaddr + SCBCmd) != 0) { + printk("%s: RxAbort command stalled\n", dev->name); + return; + } + outl(sp->rx_ring_dma[sp->cur_rx % RX_RING_SIZE], + ioaddr + SCBPointer); + outb(RxStart, ioaddr + SCBCmd); +} + + /* Media monitoring and control. */ static void speedo_timer(unsigned long data) { @@ -1377,9 +1422,10 @@ /* workaround for hardware bug on 10 mbit half duplex */ - if ((sp->partner==0) && (sp->chip_id==1)) { + if ((sp->partner == 0) && (sp->chip_id == 1)) { wait_for_cmd_done(ioaddr + SCBCmd); outb(0 , ioaddr + SCBCmd); + udelay(1); } /* Trigger the command unit resume. */ @@ -1507,82 +1553,39 @@ if ((status & 0xfc00) == 0) break; - /* Always check if all rx buffers are allocated. --SAW */ - speedo_refill_rx_buffers(dev, 0); if ((status & 0x5000) || /* Packet received, or Rx error. */ (sp->rx_ring_state&(RrNoMem|RrPostponed)) == RrPostponed) /* Need to gather the postponed packet. */ speedo_rx(dev); - if (status & 0x1000) { - spin_lock(&sp->lock); - if ((status & 0x003c) == 0x0028) { /* No more Rx buffers. */ - struct RxFD *rxf; - printk(KERN_WARNING "%s: card reports no RX buffers.\n", - dev->name); - rxf = sp->rx_ringp[sp->cur_rx % RX_RING_SIZE]; - if (rxf == NULL) { - if (speedo_debug > 2) - printk(KERN_DEBUG - "%s: NULL cur_rx in speedo_interrupt().\n", - dev->name); - sp->rx_ring_state |= RrNoMem|RrNoResources; - } else if (rxf == sp->last_rxf) { - if (speedo_debug > 2) - printk(KERN_DEBUG - "%s: cur_rx is last in speedo_interrupt().\n", - dev->name); - sp->rx_ring_state |= RrNoMem|RrNoResources; - } else - outb(RxResumeNoResources, ioaddr + SCBCmd); - } else if ((status & 0x003c) == 0x0008) { /* No resources. */ - struct RxFD *rxf; - printk(KERN_WARNING "%s: card reports no resources.\n", - dev->name); - rxf = sp->rx_ringp[sp->cur_rx % RX_RING_SIZE]; - if (rxf == NULL) { - if (speedo_debug > 2) - printk(KERN_DEBUG - "%s: NULL cur_rx in speedo_interrupt().\n", - dev->name); - sp->rx_ring_state |= RrNoMem|RrNoResources; - } else if (rxf == sp->last_rxf) { - if (speedo_debug > 2) - printk(KERN_DEBUG - "%s: cur_rx is last in speedo_interrupt().\n", - dev->name); - sp->rx_ring_state |= RrNoMem|RrNoResources; - } else { - /* Restart the receiver. */ - outl(sp->rx_ring_dma[sp->cur_rx % RX_RING_SIZE], - ioaddr + SCBPointer); - outb(RxStart, ioaddr + SCBCmd); - } - } - sp->stats.rx_errors++; - spin_unlock(&sp->lock); - } - - if ((sp->rx_ring_state&(RrNoMem|RrNoResources)) == RrNoResources) { - printk(KERN_WARNING - "%s: restart the receiver after a possible hang.\n", - dev->name); - spin_lock(&sp->lock); - /* Restart the receiver. - I'm not sure if it's always right to restart the receiver - here but I don't know another way to prevent receiver hangs. - 1999/12/25 SAW */ - outl(sp->rx_ring_dma[sp->cur_rx % RX_RING_SIZE], - ioaddr + SCBPointer); - outb(RxStart, ioaddr + SCBCmd); - sp->rx_ring_state &= ~RrNoResources; - spin_unlock(&sp->lock); + /* Always check if all rx buffers are allocated. --SAW */ + speedo_refill_rx_buffers(dev, 0); + + spin_lock(&sp->lock); + /* + * The chip may have suspended reception for various reasons. + * Check for that, and re-prime it should this be the case. + */ + switch ((status >> 2) & 0xf) { + case 0: /* Idle */ + break; + case 1: /* Suspended */ + case 2: /* No resources (RxFDs) */ + case 9: /* Suspended with no more RBDs */ + case 10: /* No resources due to no RBDs */ + case 12: /* Ready with no RBDs */ + speedo_rx_soft_reset(dev); + break; + case 3: case 5: case 6: case 7: case 8: + case 11: case 13: case 14: case 15: + /* these are all reserved values */ + break; } - + + /* User interrupt, Command/Tx unit interrupt or CU not active. */ if (status & 0xA400) { - spin_lock(&sp->lock); speedo_tx_buffer_gc(dev); if (sp->tx_full && (int)(sp->cur_tx - sp->dirty_tx) < TX_QUEUE_UNFULL) { @@ -1590,8 +1593,9 @@ sp->tx_full = 0; netif_wake_queue(dev); /* Attention: under a spinlock. --SAW */ } - spin_unlock(&sp->lock); } + + spin_unlock(&sp->lock); if (--boguscnt < 0) { printk(KERN_ERR "%s: Too much work at interrupt, status=0x%4.4x.\n", @@ -2205,6 +2209,8 @@ if (!netif_running(dev)) return 0; + + del_timer_sync(&sp->timer); netif_device_detach(dev); outl(PortPartialReset, ioaddr + SCBPort); @@ -2237,6 +2243,8 @@ sp->rx_mode = -1; sp->flow_ctrl = sp->partner = 0; set_rx_mode(dev); + sp->timer.expires = RUN_AT(2*HZ); + add_timer(&sp->timer); return 0; } #endif /* CONFIG_PM */ diff -Naur -X /g/g/lib/dontdiff /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/epic100.c net-drivers-2.4/drivers/net/epic100.c --- /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/epic100.c Thu Mar 21 06:39:14 2002 +++ net-drivers-2.4/drivers/net/epic100.c Thu Mar 21 06:38:23 2002 @@ -60,11 +60,14 @@ LK1.1.12: * fix power-up sequence + LK1.1.13: + * revert version 1.1.12, power-up sequence "fix" + */ #define DRV_NAME "epic100" -#define DRV_VERSION "1.11+LK1.1.12" -#define DRV_RELDATE "Jan 18, 2002" +#define DRV_VERSION "1.11+LK1.1.13" +#define DRV_RELDATE "Mar 20, 2002" /* The user-configurable values. @@ -678,8 +681,9 @@ required by the details of which bits are reset and the transceiver wiring on the Ositech CardBus card. */ - - outl(0x12, ioaddr + MIICfg); +#if 0 + outl(dev->if_port == 1 ? 0x13 : 0x12, ioaddr + MIICfg); +#endif if (ep->chip_flags & MII_PWRDWN) outl((inl(ioaddr + NVCTL) & ~0x003C) | 0x4800, ioaddr + NVCTL); diff -Naur -X /g/g/lib/dontdiff /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/es3210.c net-drivers-2.4/drivers/net/es3210.c --- /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/es3210.c Sun Sep 30 19:26:06 2001 +++ net-drivers-2.4/drivers/net/es3210.c Thu Mar 21 06:38:23 2002 @@ -383,9 +383,11 @@ MODULE_PARM(io, "1-" __MODULE_STRING(MAX_ES_CARDS) "i"); MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_ES_CARDS) "i"); MODULE_PARM(mem, "1-" __MODULE_STRING(MAX_ES_CARDS) "i"); -MODULE_PARM_DESC(io, "ES3210 I/O base address(es)"); -MODULE_PARM_DESC(irq, "ES3210 IRQ number(s)"); -MODULE_PARM_DESC(mem, "ES3210 memory base address(es)"); +MODULE_PARM_DESC(io, "I/O base address(es)"); +MODULE_PARM_DESC(irq, "IRQ number(s)"); +MODULE_PARM_DESC(mem, "memory base address(es)"); +MODULE_DESCRIPTION("Racal-Interlan ES3210 EISA ethernet driver"); +MODULE_LICENSE("GPL"); int init_module(void) @@ -429,5 +431,4 @@ } } #endif /* MODULE */ -MODULE_LICENSE("GPL"); diff -Naur -X /g/g/lib/dontdiff /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/hp-plus.c net-drivers-2.4/drivers/net/hp-plus.c --- /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/hp-plus.c Sun Sep 30 19:26:06 2001 +++ net-drivers-2.4/drivers/net/hp-plus.c Thu Mar 21 06:38:23 2002 @@ -408,8 +408,10 @@ MODULE_PARM(io, "1-" __MODULE_STRING(MAX_HPP_CARDS) "i"); MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_HPP_CARDS) "i"); -MODULE_PARM_DESC(io, "HP PC-LAN+ I/O port address(es)"); -MODULE_PARM_DESC(irq, "HP PC-LAN+ IRQ number(s); ignored if properly detected"); +MODULE_PARM_DESC(io, "I/O port address(es)"); +MODULE_PARM_DESC(irq, "IRQ number(s); ignored if properly detected"); +MODULE_DESCRIPTION("HP PC-LAN+ ISA ethernet driver"); +MODULE_LICENSE("GPL"); /* This is set up so that only a single autoprobe takes place per call. ISA device autoprobes on a running machine are not recommended. */ @@ -457,7 +459,6 @@ } } #endif /* MODULE */ -MODULE_LICENSE("GPL"); /* diff -Naur -X /g/g/lib/dontdiff /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/hp.c net-drivers-2.4/drivers/net/hp.c --- /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/hp.c Sun Sep 30 19:26:06 2001 +++ net-drivers-2.4/drivers/net/hp.c Thu Mar 21 06:38:23 2002 @@ -380,8 +380,10 @@ MODULE_PARM(io, "1-" __MODULE_STRING(MAX_HP_CARDS) "i"); MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_HP_CARDS) "i"); -MODULE_PARM_DESC(io, "HP PC-LAN I/O base address(es)"); -MODULE_PARM_DESC(irq, "HP PC-LAN IRQ number(s) (assigned)"); +MODULE_PARM_DESC(io, "I/O base address(es)"); +MODULE_PARM_DESC(irq, "IRQ number(s) (assigned)"); +MODULE_DESCRIPTION("HP PC-LAN ISA ethernet driver"); +MODULE_LICENSE("GPL"); /* This is set up so that only a single autoprobe takes place per call. ISA device autoprobes on a running machine are not recommended. */ @@ -429,7 +431,6 @@ } } #endif /* MODULE */ -MODULE_LICENSE("GPL"); /* diff -Naur -X /g/g/lib/dontdiff /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/hp100.c net-drivers-2.4/drivers/net/hp100.c --- /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/hp100.c Sun Sep 30 19:26:08 2001 +++ net-drivers-2.4/drivers/net/hp100.c Thu Mar 21 06:38:23 2002 @@ -210,8 +210,8 @@ hp100_ring_t rxring[MAX_RX_PDL]; hp100_ring_t txring[MAX_TX_PDL]; - u_int *page_vaddr; /* Virtual address of allocated page */ u_int *page_vaddr_algn; /* Aligned virtual address of allocated page */ + u_long whatever_offset; /* Offset to bus/phys/dma address */ int rxrcommit; /* # Rx PDLs commited to adapter */ int txrcommit; /* # Tx PDLs commited to adapter */ }; @@ -348,6 +348,18 @@ static void hp100_RegisterDump(struct net_device *dev); #endif +/* Conversion to new PCI API : + * Convert an address in a kernel buffer to a bus/phys/dma address. + * This work *only* for memory fragments part of lp->page_vaddr, + * because it was properly DMA allocated via pci_alloc_consistent(), + * so we just need to "retreive" the original mapping to bus/phys/dma + * address - Jean II */ +static inline dma_addr_t virt_to_whatever(struct net_device *dev, u32 * ptr) +{ + return ((u_long) ptr) + + ((struct hp100_private *) (dev->priv))->whatever_offset; +} + /* TODO: This function should not really be needed in a good design... */ static void wait(void) { @@ -625,9 +637,20 @@ local_mode = 3; } else if (chip == HP100_CHIPID_LASSEN && (lsw & (HP100_BM_WRITE | HP100_BM_READ)) == (HP100_BM_WRITE | HP100_BM_READ)) { + /* Conversion to new PCI API : + * I don't have the doc, but I assume that the card + * can map the full 32bit address space. + * Also, we can have EISA Busmaster cards (not tested), + * so beware !!! - Jean II */ + if((bus == HP100_BUS_PCI) && + (pci_set_dma_mask(pci_dev, 0xffffffff))) { + /* Gracefully fallback to shared memory */ + goto busmasterfail; + } printk("hp100: %s: Busmaster mode enabled.\n", dev->name); hp100_outw(HP100_MEM_EN | HP100_IO_EN | HP100_RESET_LB, OPTION_LSW); } else { + busmasterfail: #ifdef HP100_DEBUG printk("hp100: %s: Card not configured for BM or BM not supported with this card.\n", dev->name); printk("hp100: %s: Trying shared memory mode.\n", dev->name); @@ -770,11 +793,14 @@ * in the cards shared memory area. But currently, busmaster has been * implemented/tested only with the lassen chip anyway... */ if (lp->mode == 1) { /* busmaster */ + dma_addr_t page_baddr; /* Get physically continous memory for TX & RX PDLs */ - if ((lp->page_vaddr = kmalloc(MAX_RINGSIZE + 0x0f, GFP_KERNEL)) == NULL) + /* Conversion to new PCI API : + * Pages are always aligned and zeroed, no need to it ourself. + * Doc says should be OK for EISA bus as well - Jean II */ + if ((lp->page_vaddr_algn = pci_alloc_consistent(lp->pci_dev, MAX_RINGSIZE, &page_baddr)) == NULL) return -ENOMEM; - lp->page_vaddr_algn = ((u_int *) (((u_int) (lp->page_vaddr) + 0x0f) & ~0x0f)); - memset(lp->page_vaddr, 0, MAX_RINGSIZE + 0x0f); + lp->whatever_offset = ((u_long) page_baddr) - ((u_long) lp->page_vaddr_algn); #ifdef HP100_DEBUG_BM printk("hp100: %s: Reserved DMA memory from 0x%x to 0x%x\n", dev->name, (u_int) lp->page_vaddr_algn, (u_int) lp->page_vaddr_algn + MAX_RINGSIZE); @@ -1187,7 +1213,7 @@ { struct hp100_private *lp = (struct hp100_private *) dev->priv; hp100_ring_t *ringptr; - u_int *pageptr; + u_int *pageptr; /* Warning : increment by 4 - Jean II */ int i; #ifdef HP100_DEBUG_B @@ -1244,7 +1270,7 @@ dev->name, (unsigned) pdlptr); ringptr->pdl = pdlptr + 1; - ringptr->pdl_paddr = virt_to_bus(pdlptr + 1); + ringptr->pdl_paddr = virt_to_whatever(dev, pdlptr + 1); ringptr->skb = (void *) NULL; /* @@ -1255,7 +1281,7 @@ */ /* Note that pdlptr+1 and not pdlptr is the pointer to the PDH */ - *(pdlptr + 2) = (u_int) virt_to_bus(pdlptr); /* Address Frag 1 */ + *(pdlptr + 2) = (u_int) virt_to_whatever(dev, pdlptr); /* Address Frag 1 */ *(pdlptr + 3) = 4; /* Length Frag 1 */ return ((((MAX_RX_FRAG * 2 + 2) + 3) / 4) * 4); @@ -1270,7 +1296,7 @@ printk("hp100: %s: Init txpdl: Unaligned pdlptr 0x%x.\n", dev->name, (unsigned) pdlptr); ringptr->pdl = pdlptr; /* +1; */ - ringptr->pdl_paddr = virt_to_bus(pdlptr); /* +1 */ + ringptr->pdl_paddr = virt_to_whatever(dev, pdlptr); /* +1 */ ringptr->skb = (void *) NULL; return ((((MAX_TX_FRAG * 2 + 2) + 3) / 4) * 4); @@ -1329,8 +1355,10 @@ (unsigned int) ringptr->skb->data); #endif + /* Conversion to new PCI API : map skbuf data to PCI bus. + * Doc says it's OK for EISA as well - Jean II */ ringptr->pdl[0] = 0x00020000; /* Write PDH */ - ringptr->pdl[3] = ((u_int) virt_to_bus(ringptr->skb->data)); + ringptr->pdl[3] = ((u_int) pci_map_single(((struct hp100_private *) (dev->priv))->pci_dev, ringptr->skb->data, MAX_ETHER_SIZE, PCI_DMA_FROMDEVICE)); ringptr->pdl[4] = MAX_ETHER_SIZE; /* Length of Data */ #ifdef HP100_DEBUG_BM @@ -1583,7 +1611,6 @@ ringptr->skb = skb; ringptr->pdl[0] = ((1 << 16) | i); /* PDH: 1 Fragment & length */ - ringptr->pdl[1] = (u32) virt_to_bus(skb->data); /* 1st Frag: Adr. of data */ if (lp->chip == HP100_CHIPID_SHASTA) { /* TODO:Could someone who has the EISA card please check if this works? */ ringptr->pdl[2] = i; @@ -1591,6 +1618,9 @@ /* In the PDL, don't use the padded size but the real packet size: */ ringptr->pdl[2] = skb->len; /* 1st Frag: Length of frag */ } + /* Conversion to new PCI API : map skbuf data to PCI bus. + * Doc says it's OK for EISA as well - Jean II */ + ringptr->pdl[1] = ((u32) pci_map_single(lp->pci_dev, skb->data, ringptr->pdl[2], PCI_DMA_TODEVICE)); /* 1st Frag: Adr. of data */ /* Hand this PDL to the card. */ hp100_outl(ringptr->pdl_paddr, TX_PDA_L); /* Low Prio. Queue */ @@ -1639,6 +1669,8 @@ dev->name, (u_int) lp->txrhead->skb->data, lp->txrcommit, hp100_inb(TX_PDL), donecount); #endif + /* Conversion to new PCI API : NOP */ + pci_unmap_single(lp->pci_dev, (dma_addr_t) lp->txrhead->pdl[1], lp->txrhead->pdl[2], PCI_DMA_TODEVICE); dev_kfree_skb_any(lp->txrhead->skb); lp->txrhead->skb = (void *) NULL; lp->txrhead = lp->txrhead->next; @@ -1948,6 +1980,9 @@ header = *(ptr->pdl - 1); pkt_len = (header & HP100_PKT_LEN_MASK); + /* Conversion to new PCI API : NOP */ + pci_unmap_single(lp->pci_dev, (dma_addr_t) ptr->pdl[3], MAX_ETHER_SIZE, PCI_DMA_FROMDEVICE); + #ifdef HP100_DEBUG_BM printk("hp100: %s: rx_bm: header@0x%x=0x%x length=%d, errors=0x%x, dest=0x%x\n", dev->name, (u_int) (ptr->pdl - 1), (u_int) header, @@ -2908,7 +2943,7 @@ release_region(d->base_addr, HP100_REGION_SIZE); if (p->mode == 1) /* busmaster */ - kfree(p->page_vaddr); + pci_free_consistent(p->pci_dev, MAX_RINGSIZE + 0x0f, p->page_vaddr_algn, virt_to_whatever(d, p->page_vaddr_algn)); if (p->mem_ptr_virt) iounmap(p->mem_ptr_virt); kfree(d->priv); diff -Naur -X /g/g/lib/dontdiff /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/lne390.c net-drivers-2.4/drivers/net/lne390.c --- /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/lne390.c Sun Sep 30 19:26:06 2001 +++ net-drivers-2.4/drivers/net/lne390.c Thu Mar 21 06:38:23 2002 @@ -381,9 +381,10 @@ MODULE_PARM(io, "1-" __MODULE_STRING(MAX_LNE_CARDS) "i"); MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_LNE_CARDS) "i"); MODULE_PARM(mem, "1-" __MODULE_STRING(MAX_LNE_CARDS) "i"); -MODULE_PARM_DESC(io, "LNE390 I/O base address(es)"); -MODULE_PARM_DESC(irq, "LNE390 IRQ number(s)"); -MODULE_PARM_DESC(mem, "LNE390 memory base address(es)"); +MODULE_PARM_DESC(io, "I/O base address(es)"); +MODULE_PARM_DESC(irq, "IRQ number(s)"); +MODULE_PARM_DESC(mem, "memory base address(es)"); +MODULE_DESCRIPTION("Mylex LNE390A/B EISA Ethernet driver"); MODULE_LICENSE("GPL"); int init_module(void) diff -Naur -X /g/g/lib/dontdiff /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/ne.c net-drivers-2.4/drivers/net/ne.c --- /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/ne.c Sun Sep 30 19:26:07 2001 +++ net-drivers-2.4/drivers/net/ne.c Thu Mar 21 06:38:23 2002 @@ -734,9 +734,11 @@ MODULE_PARM(io, "1-" __MODULE_STRING(MAX_NE_CARDS) "i"); MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_NE_CARDS) "i"); MODULE_PARM(bad, "1-" __MODULE_STRING(MAX_NE_CARDS) "i"); -MODULE_PARM_DESC(io, "NEx000 I/O base address(es),required"); -MODULE_PARM_DESC(irq, "NEx000 IRQ number(s)"); -MODULE_PARM_DESC(bad, "NEx000 accept bad clone(s)"); +MODULE_PARM_DESC(io, "I/O base address(es),required"); +MODULE_PARM_DESC(irq, "IRQ number(s)"); +MODULE_PARM_DESC(bad, "Accept card(s) with bad signatures"); +MODULE_DESCRIPTION("NE1000/NE2000 ISA/PnP Ethernet driver"); +MODULE_LICENSE("GPL"); /* This is set up so that no ISA autoprobe takes place. We can't guarantee that the ne2k probe is the last 8390 based probe to take place (as it @@ -788,7 +790,6 @@ } } #endif /* MODULE */ -MODULE_LICENSE("GPL"); /* diff -Naur -X /g/g/lib/dontdiff /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/ne2k-pci.c net-drivers-2.4/drivers/net/ne2k-pci.c --- /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/ne2k-pci.c Fri Dec 21 17:41:54 2001 +++ net-drivers-2.4/drivers/net/ne2k-pci.c Thu Mar 21 06:38:23 2002 @@ -82,9 +82,9 @@ MODULE_PARM(debug, "i"); MODULE_PARM(options, "1-" __MODULE_STRING(MAX_UNITS) "i"); MODULE_PARM(full_duplex, "1-" __MODULE_STRING(MAX_UNITS) "i"); -MODULE_PARM_DESC(debug, "PCI NE2000 debug level (1-2)"); -MODULE_PARM_DESC(options, "PCI NE2000: Bit 5: full duplex"); -MODULE_PARM_DESC(full_duplex, "PCI NE2000 full duplex setting(s) (1)"); +MODULE_PARM_DESC(debug, "debug level (1-2)"); +MODULE_PARM_DESC(options, "Bit 5: full duplex"); +MODULE_PARM_DESC(full_duplex, "full duplex setting(s) (1)"); /* Some defines that people can play with if so inclined. */ diff -Naur -X /g/g/lib/dontdiff /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/ne3210.c net-drivers-2.4/drivers/net/ne3210.c --- /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/ne3210.c Sun Sep 30 19:26:07 2001 +++ net-drivers-2.4/drivers/net/ne3210.c Thu Mar 21 06:38:23 2002 @@ -370,9 +370,11 @@ MODULE_PARM(io, "1-" __MODULE_STRING(MAX_NE3210_CARDS) "i"); MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_NE3210_CARDS) "i"); MODULE_PARM(mem, "1-" __MODULE_STRING(MAX_NE3210_CARDS) "i"); -MODULE_PARM_DESC(io, "NE3210 I/O base address(es)"); -MODULE_PARM_DESC(irq, "NE3210 IRQ number(s)"); -MODULE_PARM_DESC(mem, "NE3210 memory base address(es)"); +MODULE_PARM_DESC(io, "I/O base address(es)"); +MODULE_PARM_DESC(irq, "IRQ number(s)"); +MODULE_PARM_DESC(mem, "memory base address(es)"); +MODULE_DESCRIPTION("NE3210 EISA Ethernet driver"); +MODULE_LICENSE("GPL"); int init_module(void) { @@ -415,7 +417,6 @@ } } } -MODULE_LICENSE("GPL"); #endif /* MODULE */ diff -Naur -X /g/g/lib/dontdiff /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/pcmcia/xircom_cb.c net-drivers-2.4/drivers/net/pcmcia/xircom_cb.c --- /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/pcmcia/xircom_cb.c Fri Dec 21 17:41:54 2001 +++ net-drivers-2.4/drivers/net/pcmcia/xircom_cb.c Thu Mar 21 06:38:24 2002 @@ -1,37 +1,45 @@ /* * xircom_cb: A driver for the (tulip-like) Xircom Cardbus ethernet cards * - * This software is Copyright 2001 by the respective authors, and licensed under the GPL + * This software is (C) by the respective authors, and licensed under the GPL * License. * * Written by Arjan van de Ven for Red Hat, Inc. - * Based on work by Jeff Garzik, Doug Ledford, Donald Becker and Ion Badulescu + * Based on work by Jeff Garzik, Doug Ledford and Donald Becker * * This software may be used and distributed according to the terms * of the GNU General Public License, incorporated herein by reference. * * - * $Id: xircom_cb.c,v 1.11 2001/06/05 09:50:57 fenrus Exp $ + * $Id: xircom_cb.c,v 1.33 2001/03/19 14:02:07 arjanv Exp $ */ #include #include -#include +#include +#include +#include +#include +#include +#include #include #include #include +#include #include +#include +#include #include #ifdef DEBUG -#define enter() printk("Enter: %s, %s line %i\n",__FUNCTION__,__FILE__,__LINE__) -#define leave() printk("Leave: %s, %s line %i\n",__FUNCTION__,__FILE__,__LINE__) +#define enter(x) printk("Enter: %s, %s line %i\n",x,__FILE__,__LINE__) +#define leave(x) printk("Leave: %s, %s line %i\n",x,__FILE__,__LINE__) #else -#define enter() do {} while (0) -#define leave() do {} while (0) +#define enter(x) do {} while (0) +#define leave(x) do {} while (0) #endif @@ -66,52 +74,27 @@ /* Offsets of the buffers within the descriptor pages, in bytes */ #define NUMDESCRIPTORS 4 -#define RXTXBUFSIZE 8192 -#define MAX_PACKETSIZE 1536 - -#define DescOwnedCard 0x80000000 -#define DescOwnedDriver 0x00000000 - -#define PromiscBit (1<<6) -#define CollisionBit (1<<8) -#define TxActiveBit (1<<13) -#define RxActiveBit (1<<1) -#define LastDescBit (1<<25) -#define LinkStatusBit (1<<27) - -#define PowerMgmtBits ( (1<<31)|(1<<30) ) - -static const unsigned int bufferoffsets[NUMDESCRIPTORS] = {128,2048,4096,6144}; - -/* note: this struct is assumed to be packed as this is the "hardware" layout */ -struct descriptor { - u32 status; - u32 control; - u32 address1; - u32 address2; -}; +static int bufferoffsets[NUMDESCRIPTORS] = {128,2048,4096,6144}; struct xircom_private { /* Send and receive buffers, kernel-addressable and dma addressable forms */ - unsigned char *rx_buffer; - unsigned char *tx_buffer; - - struct descriptor *rx_desc; - struct descriptor *tx_desc; + unsigned int *rx_buffer; + unsigned int *tx_buffer; dma_addr_t rx_dma_handle; dma_addr_t tx_dma_handle; - struct sk_buff *tx_skb[NUMDESCRIPTORS]; + struct sk_buff *tx_skb[4]; unsigned long io_port; + int open; /* transmit_used is the rotating counter that indicates which transmit descriptor has to be used next */ - unsigned int transmit_used; + int transmit_used; /* Spinlock to serialize register operations. It must be helt while manipulating the following registers: @@ -136,16 +119,16 @@ static void xircom_up(struct xircom_private *card); static struct net_device_stats *xircom_get_stats(struct net_device *dev); -static void investigate_rx_descriptor(struct net_device *dev,struct xircom_private *card, int descnr, unsigned int bufferoffset); -static unsigned int investigate_tx_descriptor(struct net_device *dev, struct xircom_private *card, unsigned int descnr, unsigned int bufferoffset); +static void investigate_read_descriptor(struct net_device *dev,struct xircom_private *card, int descnr, unsigned int bufferoffset); +static void investigate_write_descriptor(struct net_device *dev, struct xircom_private *card, int descnr, unsigned int bufferoffset); static void read_mac_address(struct xircom_private *card); static void tranceiver_voodoo(struct xircom_private *card); static void initialize_card(struct xircom_private *card); -static inline void trigger_transmit(struct xircom_private *card); -static inline void trigger_receive(struct xircom_private *card); +static void trigger_transmit(struct xircom_private *card); +static void trigger_receive(struct xircom_private *card); static void setup_descriptors(struct xircom_private *card); -static inline void remove_descriptors(struct xircom_private *card); -static inline unsigned int link_status_changed(struct xircom_private *card); +static void remove_descriptors(struct xircom_private *card); +static int link_status_changed(struct xircom_private *card); static void activate_receiver(struct xircom_private *card); static void deactivate_receiver(struct xircom_private *card); static void activate_transmitter(struct xircom_private *card); @@ -154,9 +137,7 @@ static void enable_receive_interrupt(struct xircom_private *card); static void enable_link_interrupt(struct xircom_private *card); static void disable_all_interrupts(struct xircom_private *card); -static inline unsigned int link_status(struct xircom_private *card); -static int mdio_read(struct xircom_private *card, int phy_id, int location); -static void mdio_write(struct xircom_private *card, int phy_id, int location, int value); +static int link_status(struct xircom_private *card); @@ -170,7 +151,7 @@ name: "xircom_cb", id_table: xircom_pci_table, probe: xircom_probe, - remove: __devexit_p(xircom_remove), + remove: __devexit_p(xircom_remove), }; @@ -204,25 +185,20 @@ { struct net_device *dev = NULL; struct xircom_private *private; - u8 chip_rev; + unsigned char chip_rev; unsigned long flags; - u32 tmp32; - u16 tmp16; - int ret; - enter(); + unsigned short tmp16; + enter("xircom_probe"); /* First do the PCI initialisation */ - ret = pci_enable_device(pdev); - if (ret) - return ret; + if (pci_enable_device(pdev)) + return -ENODEV; /* disable all powermanagement */ - pci_read_config_dword(pdev, PCI_POWERMGMT,&tmp32); - tmp32 &= ~PowerMgmtBits; - pci_write_config_dword(pdev, PCI_POWERMGMT, tmp32); + pci_write_config_dword(pdev, PCI_POWERMGMT, 0x0000); - pci_set_master(pdev); + pci_set_master(pdev); /* Why isn't this done by pci_enable_device ?*/ /* clear PCI status, if any */ pci_read_config_word (pdev,PCI_STATUS, &tmp16); @@ -236,39 +212,38 @@ } - dev = init_etherdev(dev, sizeof(*private)); - if (dev == NULL) { - printk(KERN_ERR "xircom_probe: failed to allocate etherdev\n"); - return -ENODEV; - } - SET_MODULE_OWNER(dev); - private = dev->priv; - if (private==NULL) { - printk(KERN_ERR "xircom_probe: failed to allocate private device struct\n"); - return -ENODEV; - } - + /* + Before changing the hardware, allocate the memory. + This way, we can fail gracefully if not enough memory + is available. + */ + private = kmalloc(sizeof(*private),GFP_KERNEL); + memset(private, 0, sizeof(struct xircom_private)); + /* Allocate the send/receive buffers */ - private->rx_buffer = pci_alloc_consistent(pdev,RXTXBUFSIZE,&private->rx_dma_handle); + private->rx_buffer = pci_alloc_consistent(pdev,8192,&private->rx_dma_handle); + if (private->rx_buffer == NULL) { printk(KERN_ERR "xircom_probe: no memory for rx buffer \n"); kfree(private); return -ENODEV; } - /* the descriptors are stored in the first bytes of the rx_buffer, hence the ugly cast */ - private->rx_desc = (struct descriptor *)private->rx_buffer; - - private->tx_buffer = pci_alloc_consistent(pdev,RXTXBUFSIZE,&private->tx_dma_handle); + private->tx_buffer = pci_alloc_consistent(pdev,8192,&private->tx_dma_handle); if (private->tx_buffer == NULL) { printk(KERN_ERR "xircom_probe: no memory for tx buffer \n"); kfree(private->rx_buffer); kfree(private); return -ENODEV; } - /* the descriptors are stored in the first bytes of the tx_buffer, hence the ugly cast */ - private->tx_desc = (struct descriptor *)private->tx_buffer; - - + dev = init_etherdev(dev, 0); + if (dev == NULL) { + printk(KERN_ERR "xircom_probe: failed to allocate etherdev\n"); + kfree(private->rx_buffer); + kfree(private->tx_buffer); + kfree(private); + return -ENODEV; + } + SET_MODULE_OWNER(dev); printk(KERN_INFO "%s: Xircom cardbus revision %i at irq %i \n", dev->name, chip_rev, pdev->irq); private->dev = dev; @@ -288,25 +263,21 @@ dev->stop = &xircom_close; dev->get_stats = &xircom_get_stats; dev->priv = private; - pci_set_drvdata(pdev,dev); + pdev->driver_data = dev; - /* start the transmitter to get a heartbeat; don't do - that when there already is one though; Cisco's - really don't like that. */ - if (!link_status(private)) - tranceiver_voodoo(private); + /* start the transmitter to get a heartbeat */ + /* TODO: send 2 dummy packets here */ + tranceiver_voodoo(private); spin_lock_irqsave(&private->lock,flags); activate_transmitter(private); activate_receiver(private); spin_unlock_irqrestore(&private->lock,flags); - - /* TODO: send 2 dummy packets here */ trigger_receive(private); - leave(); + leave("xircom_probe"); return 0; } @@ -319,138 +290,131 @@ */ static void __devexit xircom_remove(struct pci_dev *pdev) { - struct net_device *dev = pci_get_drvdata(pdev); + struct net_device *dev = pdev->driver_data; struct xircom_private *card; - enter(); - - card=dev->priv; - - if (card->rx_buffer!=NULL) - pci_free_consistent(pdev,RXTXBUFSIZE,card->rx_buffer,card->rx_dma_handle); - card->rx_buffer = NULL; - card->rx_desc = NULL; - if (card->tx_buffer!=NULL) - pci_free_consistent(pdev,RXTXBUFSIZE,card->tx_buffer,card->tx_dma_handle); - card->tx_buffer = NULL; - card->tx_desc = NULL; - + enter("xircom_remove"); + if (dev!=NULL) { + card=dev->priv; + if (card!=NULL) { + if (card->rx_buffer!=NULL) + pci_free_consistent(pdev,8192,card->rx_buffer,card->rx_dma_handle); + card->rx_buffer = NULL; + if (card->tx_buffer!=NULL) + pci_free_consistent(pdev,8192,card->tx_buffer,card->tx_dma_handle); + card->tx_buffer = NULL; + } + kfree(card); + } release_region(dev->base_addr, 128); unregister_netdev(dev); kfree(dev); - pci_set_drvdata(pdev,NULL); - leave(); + leave("xircom_remove"); } static void xircom_interrupt(int irq, void *dev_instance, struct pt_regs *regs) { - struct net_device *dev = dev_instance; - struct xircom_private *card = dev->priv; - u32 status; - unsigned int xmit_free_count; - unsigned int i; - - enter(); + struct net_device *dev = (struct net_device *) dev_instance; + struct xircom_private *card = (struct xircom_private *) dev->priv; + unsigned int status; + int i; + enter("xircom_interrupt\n"); spin_lock(&card->lock); status = inl(card->io_port+CSR5); - if (status==0xffffffff) {/* card has been ejected / powered down */ - spin_unlock(&card->lock); - return; - } - /* Todo: check if there were any events at all; to speed up - returning if we're on a shared interrupt */ +#if DEBUG + print_binary(status); + printk("tx status 0x%08x 0x%08x \n",card->tx_buffer[0],card->tx_buffer[4]); + printk("rx status 0x%08x 0x%08x \n",card->rx_buffer[0],card->rx_buffer[4]); +#endif if (link_status_changed(card)) { int newlink; printk(KERN_DEBUG "xircom_cb: Link status has changed \n"); newlink = link_status(card); - if (newlink) { - printk(KERN_INFO "xircom_cb: Link is %i mbit \n",newlink); + printk(KERN_INFO "xircom_cb: Link is %i mbit \n",newlink); + if (newlink) netif_carrier_on(dev); - } else { - printk(KERN_INFO "xircom_cb: Link is absent \n"); + else netif_carrier_off(dev); - } + } - /* Clear all remaining interrupt events */ + /* Clear all remaining interrupts */ status |= 0xffffffff; /* FIXME: make this clear only the real existing bits */ outl(status,card->io_port+CSR5); - xmit_free_count = 0; for (i=0;ilock); - leave(); + leave("xircom_interrupt"); } static int xircom_start_xmit(struct sk_buff *skb, struct net_device *dev) { struct xircom_private *card; unsigned long flags; - unsigned int nextdescriptor; - unsigned int desc; - enter(); + int nextdescriptor; + int desc; + enter("xircom_start_xmit"); card = (struct xircom_private*)dev->priv; - spin_lock_irqsave(&card->lock,flags); + /* First see if we can free some descriptors */ + for (desc=0;desctransmit_used +1) % (NUMDESCRIPTORS); desc = card->transmit_used; /* only send the packet if the descriptor is free */ - if (card->tx_desc[desc].status==0) { + if (card->tx_buffer[4*desc]==0) { /* Copy the packet data; zero the memory first as the card sometimes sends more than you ask it to. */ - memset(&card->tx_buffer[bufferoffsets[desc]],0,MAX_PACKETSIZE); - memcpy(&(card->tx_buffer[bufferoffsets[desc]]),skb->data,skb->len); + memset(&card->tx_buffer[bufferoffsets[desc]/4],0,1536); + memcpy(&(card->tx_buffer[bufferoffsets[desc]/4]),skb->data,skb->len); /* FIXME: The specification tells us that the length we send HAS to be a multiple of 4 bytes. */ - card->tx_desc[desc].control = skb->len; + card->tx_buffer[4*desc+1] = skb->len; if (desc == NUMDESCRIPTORS-1) - card->tx_desc[desc].control |= LastDescBit; /* bit 25: last descriptor of the ring */ + card->tx_buffer[4*desc+1] |= (1<<25); /* bit 25: last descriptor of the ring */ - card->tx_desc[desc].control |= 0xF0000000; + card->tx_buffer[4*desc+1] |= 0xF0000000; /* 0xF0... means want interrupts*/ card->tx_skb[desc] = skb; wmb(); /* This gives the descriptor to the card */ - card->tx_desc[desc].status = DescOwnedCard; + card->tx_buffer[4*desc] = 0x80000000; trigger_transmit(card); - if (((int)card->tx_desc[nextdescriptor].status)<0) { /* next descriptor is occupied... */ + if (((int)card->tx_buffer[nextdescriptor*4])<0) { /* next descriptor is occupied... */ netif_stop_queue(dev); } card->transmit_used = nextdescriptor; + leave("xircom-start_xmit - sent"); spin_unlock_irqrestore(&card->lock,flags); - leave(); return 0; } /* Uh oh... no free descriptor... drop the packet */ - /* This should not happen in theory...*/ netif_stop_queue(dev); spin_unlock_irqrestore(&card->lock,flags); trigger_transmit(card); - leave(); return -EIO; } @@ -462,17 +426,17 @@ { struct xircom_private *xp = (struct xircom_private *) dev->priv; int retval; - enter(); - printk(KERN_INFO "Xircom cardbus adaptor found, registering as %s, using irq %i \n",dev->name,dev->irq); + enter("xircom_open"); + printk(KERN_INFO "xircom cardbus adaptor found, registering as %s, using irq %i \n",dev->name,dev->irq); retval = request_irq(dev->irq, &xircom_interrupt, SA_SHIRQ, dev->name, dev); if (retval) { - printk(KERN_ERR "xircom_cb: Unable to aquire IRQ %i, aborting.\n",dev->irq); - leave(); + leave("xircom_open - No IRQ"); return retval; } xircom_up(xp); - leave(); + xp->open = 1; + leave("xircom_open"); return 0; } @@ -481,9 +445,9 @@ struct xircom_private *card; unsigned long flags; - enter(); + enter("xircom_close"); card = dev->priv; - netif_stop_queue(dev); /* we don't want to send new packets */ + netif_stop_queue(dev); /* we don't want new packets */ spin_lock_irqsave(&card->lock,flags); @@ -498,10 +462,11 @@ spin_unlock_irqrestore(&card->lock,flags); + card->open = 0; free_irq(dev->irq,dev); - leave(); - + leave("xircom_close"); + return 0; } @@ -521,7 +486,7 @@ { unsigned int val; unsigned long flags; - enter(); + enter("initialize_card"); spin_lock_irqsave(&card->lock, flags); @@ -549,7 +514,7 @@ spin_unlock_irqrestore(&card->lock, flags); - leave(); + leave("initialize_card"); } /* @@ -558,11 +523,15 @@ claims that the act of writing is sufficient and that the value is ignored; I chose zero. */ -static inline void trigger_transmit(struct xircom_private *card) +static void trigger_transmit(struct xircom_private *card) { - enter(); - outl(0, card->io_port + CSR1); - leave(); + unsigned int val; + enter("trigger_transmit"); + + val = 0; + outl(val, card->io_port + CSR1); + + leave("trigger_transmit"); } /* @@ -572,11 +541,15 @@ claims that the act of writing is sufficient and that the value is ignored; I chose zero. */ -static inline void trigger_receive(struct xircom_private *card) +static void trigger_receive(struct xircom_private *card) { - enter(); - outl(0, card->io_port + CSR2); - leave(); + unsigned int val; + enter("trigger_receive"); + + val = 0; + outl(val, card->io_port + CSR2); + + leave("trigger_receive"); } /* @@ -586,9 +559,9 @@ static void setup_descriptors(struct xircom_private *card) { unsigned int val; - u32 address; - unsigned int i; - enter(); + unsigned int address; + int i; + enter("setup_descriptors"); if (card->rx_buffer == NULL) @@ -597,75 +570,74 @@ BUG(); /* Receive descriptors */ - memset(card->rx_desc, 0, 128); /* clear the descriptors */ + memset(card->rx_buffer, 0, 128); /* clear the descriptors */ for (i=0;i 0x80000000 */ - card->rx_desc[i].status = DescOwnedCard; + card->rx_buffer[i*4 + 0] = 0x80000000; /* Rx Descr1: buffer 1 is 1536 bytes, buffer 2 is 0 bytes */ - card->rx_desc[i].control = MAX_PACKETSIZE; + card->rx_buffer[i*4 + 1] = 1536; if (i==NUMDESCRIPTORS-1) - card->rx_desc[i].control |= LastDescBit; /* bit 25 is "last descriptor" */ + card->rx_buffer[i*4 + 1] |= (1 << 25); /* bit 25 is "last descriptor" */ /* Rx Descr2: address of the buffer we store the buffer at the 2nd half of the page */ - address = card->rx_dma_handle; - - card->rx_desc[i].address1 = cpu_to_le32(address + bufferoffsets[i]); + address = (unsigned long) card->rx_dma_handle; + card->rx_buffer[i*4 + 2] = cpu_to_le32(address + bufferoffsets[i]); /* Rx Desc3: address of 2nd buffer -> 0 */ - card->rx_desc[i].address2 = 0; + card->rx_buffer[i*4 + 3] = 0; } wmb(); /* Write the receive descriptor ring address to the card */ - address = card->rx_dma_handle; + address = (unsigned long) card->rx_dma_handle; val = cpu_to_le32(address); outl(val, card->io_port + CSR3); /* Receive descr list address */ /* transmit descriptors */ - memset(card->tx_desc, 0, 128); /* clear the descriptors */ + memset(card->tx_buffer, 0, 128); /* clear the descriptors */ for (i=0;i 0x00000000 */ - card->tx_desc[i].status = DescOwnedDriver; + card->tx_buffer[i*4 + 0] = 0x00000000; /* Tx Descr1: buffer 1 is 1536 bytes, buffer 2 is 0 bytes */ - card->tx_desc[i].control = MAX_PACKETSIZE; + card->tx_buffer[i*4 + 1] = 1536; if (i==NUMDESCRIPTORS-1) - card->tx_desc[i].control |= LastDescBit; /* bit 25 is "last descriptor" */ + card->tx_buffer[i*4 + 1] |= (1 << 25); /* bit 25 is "last descriptor" */ /* Tx Descr2: address of the buffer we store the buffer at the 2nd half of the page */ - address = card->tx_dma_handle; - card->tx_desc[i].address1 = cpu_to_le32(address + bufferoffsets[i]); + address = (unsigned long) card->tx_dma_handle; + card->tx_buffer[i*4 + 2] = cpu_to_le32(address + bufferoffsets[i]); /* Tx Desc3: address of 2nd buffer -> 0 */ - card->tx_desc[i].address2 = 0; + card->tx_buffer[i*4 + 3] = 0; } wmb(); /* wite the transmit descriptor ring to the card */ - address = card->tx_dma_handle; + address = (unsigned long) card->tx_dma_handle; val =cpu_to_le32(address); outl(val, card->io_port + CSR4); /* xmit descr list address */ - leave(); + leave("setup_descriptors"); } /* remove_descriptors informs the card the descriptors are no longer valid by setting the address in the card to 0x00. */ -static inline void remove_descriptors(struct xircom_private *card) +static void remove_descriptors(struct xircom_private *card) { unsigned int val; - enter(); + enter("remove_descriptors"); val = 0; outl(val, card->io_port + CSR3); /* Receive descriptor address */ outl(val, card->io_port + CSR4); /* Send descriptor address */ - leave(); + leave("remove_descriptors"); } /* @@ -674,24 +646,24 @@ This function also clears the status-bit. */ -static inline unsigned int link_status_changed(struct xircom_private *card) +static int link_status_changed(struct xircom_private *card) { unsigned int val; - enter(); + enter("link_status_changed"); val = inl(card->io_port + CSR5); /* Status register */ - if ((val & LinkStatusBit) == 0) { /* no change */ - leave(); + if ((val & (1 << 27)) == 0) { /* no change */ + leave("link_status_changed - nochange"); return 0; } /* clear the event by writing a 1 to the bit in the status register. */ - val = LinkStatusBit; + val = (1 << 27); outl(val, card->io_port + CSR5); - leave(); + leave("link_status_changed - changed"); return 1; } @@ -700,19 +672,19 @@ transmit_active returns 1 if the transmitter on the card is in a non-stopped state. */ -static inline int transmit_active(struct xircom_private *card) +static int transmit_active(struct xircom_private *card) { unsigned int val; - enter(); + enter("transmit_active"); val = inl(card->io_port + CSR5); /* Status register */ if ((val & (7 << 20)) == 0) { /* transmitter disabled */ - leave(); + leave("transmit_active - inactive"); return 0; } - leave(); + leave("transmit_active - active"); return 1; } @@ -720,20 +692,20 @@ receive_active returns 1 if the receiver on the card is in a non-stopped state. */ -static inline unsigned int receive_active(struct xircom_private *card) +static int receive_active(struct xircom_private *card) { unsigned int val; - enter(); + enter("receive_active"); val = inl(card->io_port + CSR5); /* Status register */ if ((val & (7 << 17)) == 0) { /* receiver disabled */ - leave(); + leave("receive_active - inactive"); return 0; } - leave(); + leave("receive_active - active"); return 1; } @@ -751,18 +723,18 @@ { unsigned int val; int counter; - enter(); + enter("activate_receiver"); val = inl(card->io_port + CSR6); /* Operation mode */ - /* If the "active" bit (1) is set and the receiver is already + /* If the "active" bit is set and the receiver is already active, no need to do the expensive thing */ - if ((val& RxActiveBit) && (receive_active(card))) + if ((val&2) && (receive_active(card))) return; - val = val & ~RxActiveBit; /* disable the receiver */ + val = val & ~2; /* disable the receiver */ outl(val, card->io_port + CSR6); counter = 10; @@ -778,7 +750,7 @@ /* enable the receiver */ val = inl(card->io_port + CSR6); /* Operation mode */ - val = val | RxActiveBit; /* enable the receiver */ + val = val | 2; /* enable the receiver */ outl(val, card->io_port + CSR6); /* now wait for the card to activate again */ @@ -793,7 +765,7 @@ printk(KERN_ERR "xircom_cb: Receiver failed to re-activate\n"); } - leave(); + leave("activate_receiver"); } /* @@ -807,10 +779,10 @@ { unsigned int val; int counter; - enter(); + enter("deactivate_receiver"); val = inl(card->io_port + CSR6); /* Operation mode */ - val = val & ~RxActiveBit; /* disable the receiver */ + val = val & ~2; /* disable the receiver */ outl(val, card->io_port + CSR6); counter = 10; @@ -825,7 +797,7 @@ } - leave(); + leave("deactivate_receiver"); } @@ -843,17 +815,17 @@ { unsigned int val; int counter; - enter(); + enter("activate_transmitter"); val = inl(card->io_port + CSR6); /* Operation mode */ - /* If the "active" bit (13) is set and the receiver is already + /* If the "active" bit is set and the receiver is already active, no need to do the expensive thing */ - if ((val & TxActiveBit) && (transmit_active(card))) + if ((val&(1<<13)) && (transmit_active(card))) return; - val = val & ~TxActiveBit; /* disable the transmitter */ + val = val & ~(1 << 13); /* disable the transmitter */ outl(val, card->io_port + CSR6); counter = 10; @@ -869,7 +841,7 @@ /* enable the transmitter */ val = inl(card->io_port + CSR6); /* Operation mode */ - val = val | TxActiveBit; /* enable the transmitter */ + val = val | (1 << 13); /* enable the transmitter */ outl(val, card->io_port + CSR6); /* now wait for the card to activate again */ @@ -884,7 +856,7 @@ printk(KERN_ERR "xircom_cb: Transmitter failed to re-activate\n"); } - leave(); + leave("activate_transmitter"); } /* @@ -898,10 +870,10 @@ { unsigned int val; int counter; - enter(); + enter("deactivate_transmitter"); val = inl(card->io_port + CSR6); /* Operation mode */ - val = val & ~TxActiveBit; /* disable the transmitter */ + val = val & ~2; /* disable the transmitter */ outl(val, card->io_port + CSR6); counter = 20; @@ -916,7 +888,7 @@ } - leave(); + leave("deactivate_transmitter"); } @@ -928,13 +900,13 @@ static void enable_transmit_interrupt(struct xircom_private *card) { unsigned int val; - enter(); + enter("enable_transmit_interrupt"); val = inl(card->io_port + CSR7); /* Interrupt enable register */ val |= 1; /* enable the transmit interrupt */ outl(val, card->io_port + CSR7); - leave(); + leave("enable_transmit_interrupt"); } @@ -946,13 +918,13 @@ static void enable_receive_interrupt(struct xircom_private *card) { unsigned int val; - enter(); + enter("enable_receive_interrupt"); val = inl(card->io_port + CSR7); /* Interrupt enable register */ val = val | (1 << 6); /* enable the receive interrupt */ outl(val, card->io_port + CSR7); - leave(); + leave("enable_receive_interrupt"); } /* @@ -963,13 +935,13 @@ static void enable_link_interrupt(struct xircom_private *card) { unsigned int val; - enter(); + enter("enable_link_interrupt"); val = inl(card->io_port + CSR7); /* Interrupt enable register */ - val = val | LinkStatusBit; /* enable the link status chage interrupt */ + val = val | (1 << 27); /* enable the link status chage interrupt */ outl(val, card->io_port + CSR7); - leave(); + leave("enable_link_interrupt"); } @@ -982,12 +954,12 @@ static void disable_all_interrupts(struct xircom_private *card) { unsigned int val; - enter(); + enter("enable_all_interrupts"); val = 0; /* disable all interrupts */ outl(val, card->io_port + CSR7); - leave(); + leave("disable_all_interrupts"); } /* @@ -998,7 +970,7 @@ static void enable_common_interrupts(struct xircom_private *card) { unsigned int val; - enter(); + enter("enable_link_interrupt"); val = inl(card->io_port + CSR7); /* Interrupt enable register */ val |= (1<<16); /* Normal Interrupt Summary */ @@ -1011,7 +983,7 @@ val |= (1<<1); /* Transmit Process Stopped */ outl(val, card->io_port + CSR7); - leave(); + leave("enable_link_interrupt"); } /* @@ -1019,32 +991,31 @@ must be called with the lock held and interrupts disabled. */ -static inline void enable_promisc(struct xircom_private *card) +static int enable_promisc(struct xircom_private *card) { unsigned int val; - enter(); + enter("enable_promisc"); val = inl(card->io_port + CSR6); - val = val | PromiscBit; /* Bit 6 */ + val = val | (1 << 6); outl(val, card->io_port + CSR6); - printk(KERN_INFO "xircom_cb: enabling promiscuous mode \n"); - leave(); + leave("enable_promisc"); + return 1; } /* -link_status() checks the the links status and will return 0 for no link, -10 for 10mbit link and 100 for.. guess what. +link_status() checks the the links status and will return 0 for no link, 10 for 10mbit link and 100 for.. guess what. Must be called in locked state with interrupts disabled */ -static inline unsigned int link_status(struct xircom_private *card) +static int link_status(struct xircom_private *card) { unsigned int val; - enter(); + enter("link_status"); val = inb(card->io_port + CSR12); @@ -1055,59 +1026,12 @@ /* If we get here -> no link at all */ - leave(); + leave("link_status"); return 0; } -/* - -set_half_duplex() sets the card to half duplex mode. In order to do this, -set_half_duplex() has to deactivate the transmitter and receiver first. It -will re-enable the transmitter and receiver if those were active from the -beginning. - -Update: the above is not enough. It doesn't touch the MII, in fact it ensures -the main chipset and the MII are never in sync if a full-duplex connection -is negotiated. The proper fix is to tell the MII to force a half-duplex -connection. -Ion - -Must be called in locked state -*/ -static void set_half_duplex(struct xircom_private *card) -{ - unsigned int val; - int rx,tx,tmp; - enter(); - - rx=receive_active(card); - tx=transmit_active(card); - - deactivate_transmitter(card); - deactivate_receiver(card); - - val = inb(card->io_port + CSR6); - val &= ~(1<<9); - outb(val,card->io_port + CSR6); - - /* tell the MII not to advertise 10/100FDX */ - tmp = mdio_read(card, 0, 4); - printk("xircom_cb: capabilities changed from %#x to %#x\n", - tmp, tmp & ~0x140); - tmp &= ~0x140; - mdio_write(card, 0, 4, tmp); - /* restart autonegotiation */ - tmp = mdio_read(card, 0, 0); - mdio_write(card, 0, 0, tmp | 0x1200); - - if (rx) - activate_receiver(card); - if (tx) - activate_transmitter(card); - - leave(); -} /* @@ -1121,7 +1045,7 @@ unsigned long flags; int i; - enter(); + enter("read_mac_address"); spin_lock_irqsave(&card->lock, flags); @@ -1154,92 +1078,7 @@ printk("%c%2.2X", i ? ':' : ' ', card->dev->dev_addr[i]); printk("\n"); #endif - leave(); -} - - -/* MII transceiver control section. - Read and write the MII registers using software-generated serial - MDIO protocol. See the MII specifications or DP83840A data sheet - for details. */ - -/* The maximum data clock rate is 2.5 Mhz. The minimum timing is usually - met by back-to-back PCI I/O cycles, but we insert a delay to avoid - "overclocking" issues or future 66Mhz PCI. */ -#define mdio_delay() inl(mdio_addr) - -/* Read and write the MII registers using software-generated serial - MDIO protocol. It is just different enough from the EEPROM protocol - to not share code. The maxium data clock rate is 2.5 Mhz. */ -#define MDIO_SHIFT_CLK 0x10000 -#define MDIO_DATA_WRITE0 0x00000 -#define MDIO_DATA_WRITE1 0x20000 -#define MDIO_ENB 0x00000 /* Ignore the 0x02000 databook setting. */ -#define MDIO_ENB_IN 0x40000 -#define MDIO_DATA_READ 0x80000 - -static int mdio_read(struct xircom_private *card, int phy_id, int location) -{ - int i; - int read_cmd = (0xf6 << 10) | (phy_id << 5) | location; - int retval = 0; - long mdio_addr = card->io_port + CSR9; - - /* Establish sync by sending at least 32 logic ones. */ - for (i = 32; i >= 0; i--) { - outl(MDIO_ENB | MDIO_DATA_WRITE1, mdio_addr); - mdio_delay(); - outl(MDIO_ENB | MDIO_DATA_WRITE1 | MDIO_SHIFT_CLK, mdio_addr); - mdio_delay(); - } - /* Shift the read command bits out. */ - for (i = 15; i >= 0; i--) { - int dataval = (read_cmd & (1 << i)) ? MDIO_DATA_WRITE1 : 0; - - outl(MDIO_ENB | dataval, mdio_addr); - mdio_delay(); - outl(MDIO_ENB | dataval | MDIO_SHIFT_CLK, mdio_addr); - mdio_delay(); - } - /* Read the two transition, 16 data, and wire-idle bits. */ - for (i = 19; i > 0; i--) { - outl(MDIO_ENB_IN, mdio_addr); - mdio_delay(); - retval = (retval << 1) | ((inl(mdio_addr) & MDIO_DATA_READ) ? 1 : 0); - outl(MDIO_ENB_IN | MDIO_SHIFT_CLK, mdio_addr); - mdio_delay(); - } - return (retval>>1) & 0xffff; -} - -static void mdio_write(struct xircom_private *card, int phy_id, int location, int value) -{ - int i; - int cmd = (0x5002 << 16) | (phy_id << 23) | (location<<18) | value; - long mdio_addr = card->io_port + CSR9; - - /* Establish sync by sending 32 logic ones. */ - for (i = 32; i >= 0; i--) { - outl(MDIO_ENB | MDIO_DATA_WRITE1, mdio_addr); - mdio_delay(); - outl(MDIO_ENB | MDIO_DATA_WRITE1 | MDIO_SHIFT_CLK, mdio_addr); - mdio_delay(); - } - /* Shift the command bits out. */ - for (i = 31; i >= 0; i--) { - int dataval = (cmd & (1 << i)) ? MDIO_DATA_WRITE1 : 0; - outl(MDIO_ENB | dataval, mdio_addr); - mdio_delay(); - outl(MDIO_ENB | dataval | MDIO_SHIFT_CLK, mdio_addr); - mdio_delay(); - } - /* Clear out extra bits. */ - for (i = 2; i > 0; i--) { - outl(MDIO_ENB_IN, mdio_addr); - mdio_delay(); - outl(MDIO_ENB_IN | MDIO_SHIFT_CLK, mdio_addr); - mdio_delay(); - } + leave("read_mac_address"); } @@ -1251,14 +1090,11 @@ static void tranceiver_voodoo(struct xircom_private *card) { unsigned long flags; - u32 tmp32; - enter(); + enter("tranceiver_voodoo"); /* disable all powermanagement */ - pci_read_config_dword(card->pdev, PCI_POWERMGMT,&tmp32); - tmp32 &= ~PowerMgmtBits; - pci_write_config_dword(card->pdev, PCI_POWERMGMT, tmp32); + pci_write_config_dword(card->pdev, PCI_POWERMGMT, 0x0000); setup_descriptors(card); @@ -1274,7 +1110,7 @@ spin_unlock_irqrestore(&card->lock, flags); netif_start_queue(card->dev); - leave(); + leave("tranceiver_voodoo"); } @@ -1282,14 +1118,11 @@ { unsigned long flags; int i; - u32 tmp32; - enter(); + enter("xircom_up"); /* disable all powermanagement */ - pci_read_config_dword(card->pdev, PCI_POWERMGMT,&tmp32); - tmp32 &= ~PowerMgmtBits; - pci_write_config_dword(card->pdev, PCI_POWERMGMT, tmp32); + pci_write_config_dword(card->pdev, PCI_POWERMGMT, 0x0000); setup_descriptors(card); @@ -1304,23 +1137,23 @@ /* The card can have received packets already, read them away now */ for (i=0;idev,card,i,bufferoffsets[i]); + investigate_read_descriptor(card->dev,card,i,bufferoffsets[i]); - set_half_duplex(card); spin_unlock_irqrestore(&card->lock, flags); trigger_receive(card); trigger_transmit(card); netif_start_queue(card->dev); - leave(); + leave("xircom_up"); } -static void investigate_rx_descriptor(struct net_device *dev,struct xircom_private *card, int descnr, unsigned int bufferoffset) +/* Bufferoffset is in BYTES */ +static void investigate_read_descriptor(struct net_device *dev,struct xircom_private *card, int descnr, unsigned int bufferoffset) { int status; - enter(); - status = card->rx_desc[descnr].status; + enter("investigate_read_descriptor"); + status = card->rx_buffer[4*descnr]; if ((status > 0)) { /* packet received */ @@ -1341,7 +1174,7 @@ } skb->dev = dev; skb_reserve(skb, 2); - eth_copy_and_sum(skb, &card->rx_buffer[bufferoffset], pkt_len, 0); + eth_copy_and_sum(skb, (unsigned char*)&card->rx_buffer[bufferoffset / 4], pkt_len, 0); skb_put(skb, pkt_len); skb->protocol = eth_type_trans(skb, dev); netif_rx(skb); @@ -1351,48 +1184,46 @@ out: /* give the buffer back to the card */ - card->rx_desc[descnr].status = DescOwnedCard; + card->rx_buffer[4*descnr] = 0x80000000; trigger_receive(card); } - leave(); + leave("investigate_read_descriptor"); } -/* Returns 1 if the descriptor is free or became free */ -static unsigned int investigate_tx_descriptor(struct net_device *dev, struct xircom_private *card, unsigned int descnr, unsigned int bufferoffset) +/* Bufferoffset is in BYTES */ +static void investigate_write_descriptor(struct net_device *dev, struct xircom_private *card, int descnr, unsigned int bufferoffset) { - int status,retval = 0; - enter(); - - status = card->tx_desc[descnr].status; + int status; + + enter("investigate_write_descriptor"); - if (status == DescOwnedDriver) - return 1; + status = card->tx_buffer[4*descnr]; #if 0 if (status & 0x8000) { /* Major error */ printk(KERN_ERR "Major transmit error status %x \n", status); - card->tx_desc[descnr].status = 0; + card->tx_buffer[4*descnr] = 0; netif_wake_queue (dev); } #endif if (status > 0) { /* bit 31 is 0 when done */ - card->stats.tx_packets++; if (card->tx_skb[descnr]!=NULL) { card->stats.tx_bytes += card->tx_skb[descnr]->len; dev_kfree_skb_irq(card->tx_skb[descnr]); } card->tx_skb[descnr] = NULL; /* Bit 8 in the status field is 1 if there was a collision */ - if (status & CollisionBit) + if (status&(1<<8)) card->stats.collisions++; - card->tx_desc[descnr].status = DescOwnedDriver; /* descriptor is free again */ - retval = 1; + card->tx_buffer[4*descnr] = 0; /* descriptor is free again */ + netif_wake_queue (dev); + card->stats.tx_packets++; } - leave(); - return retval; + leave("investigate_write_descriptor"); + } @@ -1409,3 +1240,4 @@ module_init(xircom_init) module_exit(xircom_exit) + diff -Naur -X /g/g/lib/dontdiff /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/pcnet32.c net-drivers-2.4/drivers/net/pcnet32.c --- /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/pcnet32.c Thu Mar 21 06:39:14 2002 +++ net-drivers-2.4/drivers/net/pcnet32.c Thu Mar 21 06:38:23 2002 @@ -22,8 +22,9 @@ *************************************************************************/ #define DRV_NAME "pcnet32" -#define DRV_VERSION "1.25kf" -#define DRV_RELDATE "17.11.2001" +#define DRV_VERSION "1.27a" +#define DRV_RELDATE "10.02.2002" +#define PFX DRV_NAME ": " static const char *version = DRV_NAME ".c:v" DRV_VERSION " " DRV_RELDATE " tsbogend@alpha.franken.de\n"; @@ -54,8 +55,6 @@ #include #include -static unsigned int pcnet32_portlist[] __initdata = {0x300, 0x320, 0x340, 0x360, 0}; - /* * PCI device identifiers for "new style" Linux PCI Device Drivers */ @@ -65,13 +64,26 @@ { 0, } }; +MODULE_DEVICE_TABLE (pci, pcnet32_pci_tbl); + +int cards_found __initdata; + +/* + * VLB I/O addresses + */ +static unsigned int pcnet32_portlist[] __initdata = + { 0x300, 0x320, 0x340, 0x360, 0 }; + + + static int pcnet32_debug = 1; static int tx_start = 1; /* Mapping -- 0:20, 1:64, 2:128, 3:~220 (depends on chip vers) */ +static int pcnet32vlb; /* check for VLB cards ? */ static struct net_device *pcnet32_dev; -static const int max_interrupt_work = 80; -static const int rx_copybreak = 200; +static int max_interrupt_work = 80; +static int rx_copybreak = 200; #define PCNET32_PORT_AUI 0x00 #define PCNET32_PORT_10BT 0x01 @@ -94,21 +106,21 @@ PCNET32_PORT_AUI, /* 1 BNC/AUI */ PCNET32_PORT_AUI, /* 2 AUI/BNC */ PCNET32_PORT_ASEL, /* 3 not supported */ - PCNET32_PORT_10BT | PCNET32_PORT_FD, /* 4 10baseT-FD */ + PCNET32_PORT_10BT | PCNET32_PORT_FD, /* 4 10baseT-FD */ PCNET32_PORT_ASEL, /* 5 not supported */ PCNET32_PORT_ASEL, /* 6 not supported */ PCNET32_PORT_ASEL, /* 7 not supported */ PCNET32_PORT_ASEL, /* 8 not supported */ PCNET32_PORT_MII, /* 9 MII 10baseT */ - PCNET32_PORT_MII | PCNET32_PORT_FD, /* 10 MII 10baseT-FD */ + PCNET32_PORT_MII | PCNET32_PORT_FD, /* 10 MII 10baseT-FD */ PCNET32_PORT_MII, /* 11 MII (autosel) */ PCNET32_PORT_10BT, /* 12 10BaseT */ - PCNET32_PORT_MII | PCNET32_PORT_100, /* 13 MII 100BaseTx */ + PCNET32_PORT_MII | PCNET32_PORT_100, /* 13 MII 100BaseTx */ PCNET32_PORT_MII | PCNET32_PORT_100 | PCNET32_PORT_FD, /* 14 MII 100BaseTx-FD */ PCNET32_PORT_ASEL /* 15 not supported */ }; -#define MAX_UNITS 8 +#define MAX_UNITS 8 /* More are supported, limit only on options */ static int options[MAX_UNITS]; static int full_duplex[MAX_UNITS]; @@ -187,7 +199,19 @@ * v1.25kf Added No Interrupt on successful Tx for some Tx's * v1.26 Converted to pci_alloc_consistent, Jamey Hicks / George France * - * v1.26p Fix oops on rmmod+insmod; plug i/o resource leak - Paul Gortmaker + * - Fixed a few bugs, related to running the controller in 32bit mode. + * 23 Oct, 2000. Carsten Langgaard, carstenl@mips.com + * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved. + * v1.26p Fix oops on rmmod+insmod; plug i/o resource leak - Paul Gortmaker + * v1.27 improved CSR/PROM address detection, lots of cleanups, + * new pcnet32vlb module option, HP-PARISC support, + * added module parameter descriptions, + * initial ethtool support - Helge Deller + * v1.27a Sun Feb 10 2002 Go Taniguchi + * use alloc_etherdev and register_netdev + * fix pci probe not increment cards_found + * FD auto negotiate error workaround for xSeries250 + * clean up and using new mii module */ @@ -201,13 +225,13 @@ #define PCNET32_LOG_RX_BUFFERS 5 #endif -#define TX_RING_SIZE (1 << (PCNET32_LOG_TX_BUFFERS)) -#define TX_RING_MOD_MASK (TX_RING_SIZE - 1) -#define TX_RING_LEN_BITS ((PCNET32_LOG_TX_BUFFERS) << 12) - -#define RX_RING_SIZE (1 << (PCNET32_LOG_RX_BUFFERS)) -#define RX_RING_MOD_MASK (RX_RING_SIZE - 1) -#define RX_RING_LEN_BITS ((PCNET32_LOG_RX_BUFFERS) << 4) +#define TX_RING_SIZE (1 << (PCNET32_LOG_TX_BUFFERS)) +#define TX_RING_MOD_MASK (TX_RING_SIZE - 1) +#define TX_RING_LEN_BITS ((PCNET32_LOG_TX_BUFFERS) << 12) + +#define RX_RING_SIZE (1 << (PCNET32_LOG_RX_BUFFERS)) +#define RX_RING_MOD_MASK (RX_RING_SIZE - 1) +#define RX_RING_LEN_BITS ((PCNET32_LOG_RX_BUFFERS) << 4) #define PKT_BUF_SZ 1544 @@ -222,7 +246,7 @@ #define PCNET32_DWIO_RESET 0x18 #define PCNET32_DWIO_BDP 0x1C -#define PCNET32_TOTAL_SIZE 0x20 +#define PCNET32_TOTAL_SIZE 0x20 /* The PCNET32 Rx and Tx ring descriptors. */ struct pcnet32_rx_head { @@ -270,37 +294,36 @@ */ struct pcnet32_private { /* The Tx and Rx ring entries must be aligned on 16-byte boundaries in 32bit mode. */ - struct pcnet32_rx_head rx_ring[RX_RING_SIZE]; - struct pcnet32_tx_head tx_ring[TX_RING_SIZE]; - struct pcnet32_init_block init_block; - dma_addr_t dma_addr; /* DMA address of beginning of this object, returned by pci_alloc_consistent */ - struct pci_dev *pci_dev; /* Pointer to the associated pci device structure */ - const char *name; + struct pcnet32_rx_head rx_ring[RX_RING_SIZE]; + struct pcnet32_tx_head tx_ring[TX_RING_SIZE]; + struct pcnet32_init_block init_block; + dma_addr_t dma_addr; /* DMA address of beginning of this object, + returned by pci_alloc_consistent */ + struct pci_dev *pci_dev; /* Pointer to the associated pci device structure */ + const char *name; /* The saved address of a sent-in-place packet/buffer, for skfree(). */ - struct sk_buff *tx_skbuff[TX_RING_SIZE]; - struct sk_buff *rx_skbuff[RX_RING_SIZE]; - dma_addr_t tx_dma_addr[TX_RING_SIZE]; - dma_addr_t rx_dma_addr[RX_RING_SIZE]; + struct sk_buff *tx_skbuff[TX_RING_SIZE]; + struct sk_buff *rx_skbuff[RX_RING_SIZE]; + dma_addr_t tx_dma_addr[TX_RING_SIZE]; + dma_addr_t rx_dma_addr[RX_RING_SIZE]; struct pcnet32_access a; - spinlock_t lock; /* Guard lock */ - unsigned int cur_rx, cur_tx; /* The next free ring entry */ - unsigned int dirty_rx, dirty_tx; /* The ring entries to be free()ed. */ + spinlock_t lock; /* Guard lock */ + unsigned int cur_rx, cur_tx; /* The next free ring entry */ + unsigned int dirty_rx, dirty_tx; /* The ring entries to be free()ed. */ struct net_device_stats stats; - char tx_full; - int options; - int shared_irq:1, /* shared irq possible */ - ltint:1, -#ifdef DO_DXSUFLO - dxsuflo:1, /* disable transmit stop on uflo */ -#endif - mii:1; /* mii port available */ - struct net_device *next; + char tx_full; + int options; + int shared_irq:1, /* shared irq possible */ + ltint:1, /* enable TxDone-intr inhibitor */ + dxsuflo:1, /* disable transmit stop on uflo */ + mii:1; /* mii port available */ + struct net_device *next; struct mii_if_info mii_if; }; -static int pcnet32_probe_vlbus(int cards_found); +static void pcnet32_probe_vlbus(void); static int pcnet32_probe_pci(struct pci_dev *, const struct pci_device_id *); -static int pcnet32_probe1(unsigned long, unsigned char, int, int, struct pci_dev *); +static int pcnet32_probe1(unsigned long, unsigned int, int, struct pci_dev *); static int pcnet32_open(struct net_device *); static int pcnet32_init_ring(struct net_device *); static int pcnet32_start_xmit(struct sk_buff *, struct net_device *); @@ -319,15 +342,6 @@ PCI_ADDR0=0x10<<0, PCI_ADDR1=0x10<<1, PCI_ADDR2=0x10<<2, PCI_ADDR3=0x10<<3, }; -struct pcnet32_pci_id_info { - const char *name; - u16 vendor_id, device_id, svid, sdid, flags; - int io_size; - int (*probe1) (unsigned long, unsigned char, int, int, struct pci_dev *); -}; - - -MODULE_DEVICE_TABLE (pci, pcnet32_pci_tbl); static u16 pcnet32_wio_read_csr (unsigned long addr, int index) { @@ -375,13 +389,13 @@ } static struct pcnet32_access pcnet32_wio = { - pcnet32_wio_read_csr, - pcnet32_wio_write_csr, - pcnet32_wio_read_bcr, - pcnet32_wio_write_bcr, - pcnet32_wio_read_rap, - pcnet32_wio_write_rap, - pcnet32_wio_reset + read_csr: pcnet32_wio_read_csr, + write_csr: pcnet32_wio_write_csr, + read_bcr: pcnet32_wio_read_bcr, + write_bcr: pcnet32_wio_write_bcr, + read_rap: pcnet32_wio_read_rap, + write_rap: pcnet32_wio_write_rap, + reset: pcnet32_wio_reset }; static u16 pcnet32_dwio_read_csr (unsigned long addr, int index) @@ -430,82 +444,61 @@ } static struct pcnet32_access pcnet32_dwio = { - pcnet32_dwio_read_csr, - pcnet32_dwio_write_csr, - pcnet32_dwio_read_bcr, - pcnet32_dwio_write_bcr, - pcnet32_dwio_read_rap, - pcnet32_dwio_write_rap, - pcnet32_dwio_reset - + read_csr: pcnet32_dwio_read_csr, + write_csr: pcnet32_dwio_write_csr, + read_bcr: pcnet32_dwio_read_bcr, + write_bcr: pcnet32_dwio_write_bcr, + read_rap: pcnet32_dwio_read_rap, + write_rap: pcnet32_dwio_write_rap, + reset: pcnet32_dwio_reset }; - -/* only probes for non-PCI devices, the rest are handled by pci_register_driver via pcnet32_probe_pci*/ -static int __init pcnet32_probe_vlbus(int cards_found) + +/* only probes for non-PCI devices, the rest are handled by + * pci_register_driver via pcnet32_probe_pci */ + +static void __devinit +pcnet32_probe_vlbus(void) { - unsigned long ioaddr = 0; // FIXME dev ? dev->base_addr: 0; - unsigned int irq_line = 0; // FIXME dev ? dev->irq : 0; - int *port; - - printk(KERN_INFO "pcnet32_probe_vlbus: cards_found=%d\n", cards_found); -#ifndef __powerpc__ - if (ioaddr > 0x1ff) { - if (check_region(ioaddr, PCNET32_TOTAL_SIZE) == 0) - return pcnet32_probe1(ioaddr, irq_line, 0, 0, NULL); - else - return -ENODEV; - } else -#endif - if (ioaddr != 0) - return -ENXIO; + unsigned int *port, ioaddr; - /* now look for PCnet32 VLB cards */ - for (port = pcnet32_portlist; *port; port++) { - unsigned long ioaddr = *port; - - if ( check_region(ioaddr, PCNET32_TOTAL_SIZE) == 0) { + /* search for PCnet32 VLB cards at known addresses */ + for (port = pcnet32_portlist; (ioaddr = *port); port++) { + if (!check_region(ioaddr, PCNET32_TOTAL_SIZE)) { /* check if there is really a pcnet chip on that ioaddr */ - if ((inb(ioaddr + 14) == 0x57) && - (inb(ioaddr + 15) == 0x57) && - (pcnet32_probe1(ioaddr, 0, 0, 0, NULL) == 0)) - cards_found++; + if ((inb(ioaddr + 14) == 0x57) && (inb(ioaddr + 15) == 0x57)) + pcnet32_probe1(ioaddr, 0, 0, NULL); } } - return cards_found ? 0: -ENODEV; } - static int __devinit pcnet32_probe_pci(struct pci_dev *pdev, const struct pci_device_id *ent) { - static int card_idx; - long ioaddr; - int err = 0; - - printk(KERN_INFO "pcnet32_probe_pci: found device %#08x.%#08x\n", ent->vendor, ent->device); + unsigned long ioaddr; + int err; - if ((err = pci_enable_device(pdev)) < 0) { - printk(KERN_ERR "pcnet32.c: failed to enable device -- err=%d\n", err); + err = pci_enable_device(pdev); + if (err < 0) { + printk(KERN_ERR PFX "failed to enable device -- err=%d\n", err); return err; } pci_set_master(pdev); ioaddr = pci_resource_start (pdev, 0); - printk(KERN_INFO " ioaddr=%#08lx resource_flags=%#08lx\n", ioaddr, pci_resource_flags (pdev, 0)); if (!ioaddr) { - printk (KERN_ERR "no PCI IO resources, aborting\n"); + printk (KERN_ERR PFX "card has no PCI IO resources, aborting\n"); return -ENODEV; } - + if (!pci_dma_supported(pdev, PCNET32_DMA_MASK)) { - printk(KERN_ERR "pcnet32.c: architecture does not support 32bit PCI busmaster DMA\n"); + printk(KERN_ERR PFX "architecture does not support 32bit PCI busmaster DMA\n"); return -ENODEV; } - return pcnet32_probe1(ioaddr, pdev->irq, 1, card_idx, pdev); + return pcnet32_probe1(ioaddr, pdev->irq, 1, pdev); } @@ -514,41 +507,44 @@ * pdev will be NULL when called from pcnet32_probe_vlbus. */ static int __devinit -pcnet32_probe1(unsigned long ioaddr, unsigned char irq_line, int shared, int card_idx, struct pci_dev *pdev) +pcnet32_probe1(unsigned long ioaddr, unsigned int irq_line, int shared, + struct pci_dev *pdev) { struct pcnet32_private *lp; struct resource *res; dma_addr_t lp_dma_addr; - int i,media,fdx = 0, mii = 0, fset = 0; -#ifdef DO_DXSUFLO - int dxsuflo = 0; -#endif - int ltint = 0; + int i, media; + int fdx, mii, fset, dxsuflo, ltint; int chip_version; char *chipname; struct net_device *dev; struct pcnet32_access *a = NULL; + u8 promaddr[6]; /* reset the chip */ - pcnet32_dwio_reset(ioaddr); pcnet32_wio_reset(ioaddr); /* NOTE: 16-bit check is first, otherwise some older PCnet chips fail */ - if (pcnet32_wio_read_csr (ioaddr, 0) == 4 && pcnet32_wio_check (ioaddr)) { + if (pcnet32_wio_read_csr(ioaddr, 0) == 4 && pcnet32_wio_check(ioaddr)) { a = &pcnet32_wio; } else { - if (pcnet32_dwio_read_csr (ioaddr, 0) == 4 && pcnet32_dwio_check(ioaddr)) { + pcnet32_dwio_reset(ioaddr); + if (pcnet32_dwio_read_csr(ioaddr, 0) == 4 && pcnet32_dwio_check(ioaddr)) { a = &pcnet32_dwio; } else return -ENODEV; } - chip_version = a->read_csr (ioaddr, 88) | (a->read_csr (ioaddr,89) << 16); + chip_version = a->read_csr(ioaddr, 88) | (a->read_csr(ioaddr,89) << 16); if (pcnet32_debug > 2) printk(KERN_INFO " PCnet chip version is %#x.\n", chip_version); if ((chip_version & 0xfff) != 0x003) return -ENODEV; + + /* initialize variables */ + fdx = mii = fset = dxsuflo = ltint = 0; chip_version = (chip_version >> 12) & 0xffff; + switch (chip_version) { case 0x2420: chipname = "PCnet/PCI 79C970"; /* PCI */ @@ -587,23 +583,24 @@ * mode by which the card should operate */ /* switch to home wiring mode */ - media = a->read_bcr (ioaddr, 49); + media = a->read_bcr(ioaddr, 49); #if 0 if (pcnet32_debug > 2) - printk(KERN_DEBUG "pcnet32: pcnet32 media value %#x.\n", media); + printk(KERN_DEBUG PFX "media value %#x.\n", media); media &= ~3; media |= 1; #endif if (pcnet32_debug > 2) - printk(KERN_DEBUG "pcnet32: pcnet32 media reset to %#x.\n", media); - a->write_bcr (ioaddr, 49, media); + printk(KERN_DEBUG PFX "media reset to %#x.\n", media); + a->write_bcr(ioaddr, 49, media); break; case 0x2627: chipname = "PCnet/FAST III 79C975"; /* PCI */ fdx = 1; mii = 1; break; default: - printk(KERN_INFO "pcnet32: PCnet version %#x, no PCnet32 chip.\n",chip_version); + printk(KERN_INFO PFX "PCnet version %#x, no PCnet32 chip.\n", + chip_version); return -ENODEV; } @@ -618,17 +615,15 @@ { a->write_bcr(ioaddr, 18, (a->read_bcr(ioaddr, 18) | 0x0800)); a->write_csr(ioaddr, 80, (a->read_csr(ioaddr, 80) & 0x0C00) | 0x0c00); -#ifdef DO_DXSUFLO dxsuflo = 1; -#endif ltint = 1; } - dev = init_etherdev(NULL, 0); - if(dev==NULL) + dev = alloc_etherdev(0); + if(!dev) return -ENOMEM; - printk(KERN_INFO "%s: %s at %#3lx,", dev->name, chipname, ioaddr); + printk(KERN_INFO PFX "%s at %#3lx,", chipname, ioaddr); /* In most chips, after a chip reset, the ethernet address is read from the * station address PROM at the base address and programmed into the @@ -644,31 +639,28 @@ dev->dev_addr[2*i] = val & 0x0ff; dev->dev_addr[2*i+1] = (val >> 8) & 0x0ff; } - { - u8 promaddr[6]; - for (i = 0; i < 6; i++) { - promaddr[i] = inb(ioaddr + i); - } - if( memcmp( promaddr, dev->dev_addr, 6) ) - { - printk(" warning PROM address does not match CSR address\n"); -#if defined(__i386__) - printk(KERN_WARNING "%s: Probably a Compaq, using the PROM address of", dev->name); - memcpy(dev->dev_addr, promaddr, 6); -#elif defined(__powerpc__) - if (!is_valid_ether_addr(dev->dev_addr) - && is_valid_ether_addr(promaddr)) { - printk("\n" KERN_WARNING "%s: using PROM address:", - dev->name); - memcpy(dev->dev_addr, promaddr, 6); - } + + /* read PROM address and compare with CSR address */ + for (i = 0; i < 6; i++) + promaddr[i] = inb(ioaddr + i); + + if( memcmp( promaddr, dev->dev_addr, 6) + || !is_valid_ether_addr(dev->dev_addr) ) { +#ifndef __powerpc__ + if( is_valid_ether_addr(promaddr) ){ +#else + if( !is_valid_ether_addr(dev->dev_addr) + && is_valid_ether_addr(promaddr)) { #endif - } + printk(" warning: CSR address invalid,\n"); + printk(KERN_INFO " using instead PROM address of"); + memcpy(dev->dev_addr, promaddr, 6); + } } + /* if the ethernet address is not valid, force to 00:00:00:00:00:00 */ if( !is_valid_ether_addr(dev->dev_addr) ) - for (i = 0; i < 6; i++) - dev->dev_addr[i]=0; + memset(dev->dev_addr, 0, sizeof(dev->dev_addr)); for (i = 0; i < 6; i++) printk(" %2.2x", dev->dev_addr[i] ); @@ -698,7 +690,7 @@ dev->base_addr = ioaddr; res = request_region(ioaddr, PCNET32_TOTAL_SIZE, chipname); - if (res == NULL) + if (!res) return -EBUSY; /* pci_alloc_consistent returns page-aligned memory, so we do not have to check the alignment */ @@ -710,7 +702,6 @@ memset(lp, 0, sizeof(*lp)); lp->dma_addr = lp_dma_addr; lp->pci_dev = pdev; - printk("\n" KERN_INFO "pcnet32: pcnet32_private lp=%p lp_dma_addr=%#08x", lp, lp_dma_addr); spin_lock_init(&lp->lock); @@ -718,24 +709,23 @@ lp->name = chipname; lp->shared_irq = shared; lp->mii_if.full_duplex = fdx; -#ifdef DO_DXSUFLO lp->dxsuflo = dxsuflo; -#endif lp->ltint = ltint; lp->mii = mii; - if (options[card_idx] > sizeof (options_mapping)) + if ((cards_found >= MAX_UNITS) || (options[cards_found] > sizeof(options_mapping))) lp->options = PCNET32_PORT_ASEL; else - lp->options = options_mapping[options[card_idx]]; + lp->options = options_mapping[options[cards_found]]; lp->mii_if.dev = dev; lp->mii_if.mdio_read = mdio_read; lp->mii_if.mdio_write = mdio_write; - if (fdx && !(lp->options & PCNET32_PORT_ASEL) && full_duplex[card_idx]) + if (fdx && !(lp->options & PCNET32_PORT_ASEL) && + ((cards_found>=MAX_UNITS) || full_duplex[cards_found])) lp->options |= PCNET32_PORT_FD; - if (a == NULL) { - printk(KERN_ERR "pcnet32: No access methods\n"); + if (!a) { + printk(KERN_ERR PFX "No access methods\n"); pci_free_consistent(lp->pci_dev, sizeof(*lp), lp, lp->dma_addr); release_resource(res); return -ENODEV; @@ -790,8 +780,6 @@ } } - if (pcnet32_debug > 0) - printk(KERN_INFO "%s", version); /* The PCNET32-specific entries in the device structure. */ dev->open = &pcnet32_open; @@ -801,17 +789,19 @@ dev->set_multicast_list = &pcnet32_set_multicast_list; dev->do_ioctl = &pcnet32_ioctl; dev->tx_timeout = pcnet32_tx_timeout; - dev->watchdog_timeo = (HZ >> 1); + dev->watchdog_timeo = (5*HZ); lp->next = pcnet32_dev; pcnet32_dev = dev; /* Fill in the generic fields of the device structure. */ - ether_setup(dev); + register_netdev(dev); + printk(KERN_INFO "%s: registered as %s\n",dev->name, lp->name); + cards_found++; return 0; } - + static int pcnet32_open(struct net_device *dev) { @@ -856,6 +846,9 @@ val |= 1; if (lp->options == (PCNET32_PORT_FD | PCNET32_PORT_AUI)) val |= 2; + } else if (lp->options & PCNET32_PORT_ASEL) { + /* workaround for xSeries250 */ + val |= 3; } lp->a.write_bcr (ioaddr, 9, val); } @@ -888,6 +881,7 @@ lp->a.write_csr (ioaddr, 3, val); } #endif + if (lp->ltint) { /* Enable TxDone-intr inhibitor */ val = lp->a.read_csr (ioaddr, 5); val |= (1<<14); @@ -922,7 +916,7 @@ if (pcnet32_debug > 2) printk(KERN_DEBUG "%s: pcnet32 open after %d ticks, init block %#x csr0 %4.4x.\n", dev->name, i, (u32) (lp->dma_addr + offsetof(struct pcnet32_private, init_block)), - lp->a.read_csr (ioaddr, 0)); + lp->a.read_csr(ioaddr, 0)); MOD_INC_USE_COUNT; @@ -952,7 +946,7 @@ for (i = 0; i < TX_RING_SIZE; i++) { if (lp->tx_skbuff[i]) { pci_unmap_single(lp->pci_dev, lp->tx_dma_addr[i], lp->tx_skbuff[i]->len, PCI_DMA_TODEVICE); - dev_kfree_skb(lp->tx_skbuff[i]); + dev_kfree_skb_any(lp->tx_skbuff[i]); lp->tx_skbuff[i] = NULL; lp->tx_dma_addr[i] = 0; } @@ -1028,11 +1022,12 @@ pcnet32_tx_timeout (struct net_device *dev) { struct pcnet32_private *lp = dev->priv; - unsigned int ioaddr = dev->base_addr; + unsigned long ioaddr = dev->base_addr, flags; + spin_lock_irqsave(&lp->lock, flags); /* Transmitter timeout, serious problems. */ printk(KERN_ERR "%s: transmit timed out, status %4.4x, resetting.\n", - dev->name, lp->a.read_csr (ioaddr, 0)); + dev->name, lp->a.read_csr(ioaddr, 0)); lp->a.write_csr (ioaddr, 0, 0x0004); lp->stats.tx_errors++; if (pcnet32_debug > 2) { @@ -1054,6 +1049,8 @@ dev->trans_start = jiffies; netif_start_queue(dev); + + spin_unlock_irqrestore(&lp->lock, flags); } @@ -1061,14 +1058,14 @@ pcnet32_start_xmit(struct sk_buff *skb, struct net_device *dev) { struct pcnet32_private *lp = dev->priv; - unsigned int ioaddr = dev->base_addr; + unsigned long ioaddr = dev->base_addr; u16 status; int entry; unsigned long flags; if (pcnet32_debug > 3) { printk(KERN_DEBUG "%s: pcnet32_start_xmit() called, csr0 %4.4x.\n", - dev->name, lp->a.read_csr (ioaddr, 0)); + dev->name, lp->a.read_csr(ioaddr, 0)); } spin_lock_irqsave(&lp->lock, flags); @@ -1135,8 +1132,9 @@ int boguscnt = max_interrupt_work; int must_restart; - if (dev == NULL) { - printk (KERN_DEBUG "pcnet32_interrupt(): irq %d for unknown device.\n", irq); + if (!dev) { + printk (KERN_DEBUG "%s(): irq %d for unknown device\n", + __FUNCTION__, irq); return; } @@ -1207,7 +1205,8 @@ /* We must free the original skb */ if (lp->tx_skbuff[entry]) { - pci_unmap_single(lp->pci_dev, lp->tx_dma_addr[entry], lp->tx_skbuff[entry]->len, PCI_DMA_TODEVICE); + pci_unmap_single(lp->pci_dev, lp->tx_dma_addr[entry], + lp->tx_skbuff[entry]->len, PCI_DMA_TODEVICE); dev_kfree_skb_irq(lp->tx_skbuff[entry]); lp->tx_skbuff[entry] = 0; lp->tx_dma_addr[entry] = 0; @@ -1215,13 +1214,12 @@ dirty_tx++; } -#ifndef final_version if (lp->cur_tx - dirty_tx >= TX_RING_SIZE) { - printk(KERN_ERR "out-of-sync dirty pointer, %d vs. %d, full=%d.\n", - dirty_tx, lp->cur_tx, lp->tx_full); + printk(KERN_ERR "%s: out-of-sync dirty pointer, %d vs. %d, full=%d.\n", + dev->name, dirty_tx, lp->cur_tx, lp->tx_full); dirty_tx += TX_RING_SIZE; } -#endif + if (lp->tx_full && netif_queue_stopped(dev) && dirty_tx > lp->cur_tx - TX_RING_SIZE + 2) { @@ -1262,7 +1260,7 @@ /* Clear any other interrupt, and set interrupt enable. */ lp->a.write_csr (ioaddr, 0, 0x7940); - lp->a.write_rap(ioaddr,rap); + lp->a.write_rap (ioaddr,rap); if (pcnet32_debug > 4) printk(KERN_DEBUG "%s: exiting interrupt, csr0=%#4.4x.\n", @@ -1312,10 +1310,13 @@ if ((newskb = dev_alloc_skb (PKT_BUF_SZ))) { skb_reserve (newskb, 2); skb = lp->rx_skbuff[entry]; + pci_unmap_single(lp->pci_dev, lp->rx_dma_addr[entry], skb->len, PCI_DMA_FROMDEVICE); skb_put (skb, pkt_len); lp->rx_skbuff[entry] = newskb; newskb->dev = dev; - lp->rx_dma_addr[entry] = pci_map_single(lp->pci_dev, newskb->tail, newskb->len, PCI_DMA_FROMDEVICE); + lp->rx_dma_addr[entry] = + pci_map_single(lp->pci_dev, newskb->tail, + newskb->len, PCI_DMA_FROMDEVICE); lp->rx_ring[entry].base = le32_to_cpu(lp->rx_dma_addr[entry]); rx_in_place = 1; } else @@ -1349,6 +1350,7 @@ lp->stats.rx_bytes += skb->len; skb->protocol=eth_type_trans(skb,dev); netif_rx(skb); + dev->last_rx = jiffies; lp->stats.rx_packets++; } } @@ -1445,13 +1447,13 @@ /* set all multicast bits */ if (dev->flags & IFF_ALLMULTI){ - ib->filter [0] = 0xffffffff; - ib->filter [1] = 0xffffffff; + ib->filter[0] = 0xffffffff; + ib->filter[1] = 0xffffffff; return; } /* clear the multicast filter */ - ib->filter [0] = 0; - ib->filter [1] = 0; + ib->filter[0] = 0; + ib->filter[1] = 0; /* Add addresses */ for (i = 0; i < dev->mc_count; i++){ @@ -1475,9 +1477,10 @@ */ static void pcnet32_set_multicast_list(struct net_device *dev) { - unsigned long ioaddr = dev->base_addr; + unsigned long ioaddr = dev->base_addr, flags; struct pcnet32_private *lp = dev->priv; + spin_lock_irqsave(&lp->lock, flags); if (dev->flags&IFF_PROMISC) { /* Log any net taps. */ printk(KERN_INFO "%s: Promiscuous mode enabled.\n", dev->name); @@ -1490,6 +1493,7 @@ lp->a.write_csr (ioaddr, 0, 0x0004); /* Temporarily stop the lance. */ pcnet32_restart(dev, 0x0042); /* Resume normal operation */ + spin_unlock_irqrestore(&lp->lock, flags); } static int mdio_read(struct net_device *dev, int phy_id, int reg_num) @@ -1628,17 +1632,14 @@ if (lp->mii) { switch(cmd) { case SIOCGMIIPHY: /* Get address of MII PHY in use. */ - case SIOCDEVPRIVATE: /* for binary compat, remove in 2.5 */ data->phy_id = (phyaddr >> 5) & 0x1f; /* Fall Through */ case SIOCGMIIREG: /* Read MII PHY register. */ - case SIOCDEVPRIVATE+1: /* for binary compat, remove in 2.5 */ lp->a.write_bcr (ioaddr, 33, ((data->phy_id & 0x1f) << 5) | (data->reg_num & 0x1f)); data->val_out = lp->a.read_bcr (ioaddr, 34); lp->a.write_bcr (ioaddr, 33, phyaddr); return 0; case SIOCSMIIREG: /* Write MII PHY register. */ - case SIOCDEVPRIVATE+2: /* for binary compat, remove in 2.5 */ if (!capable(CAP_NET_ADMIN)) return -EPERM; lp->a.write_bcr (ioaddr, 33, ((data->phy_id & 0x1f) << 5) | (data->reg_num & 0x1f)); @@ -1651,20 +1652,28 @@ } return -EOPNOTSUPP; } - + static struct pci_driver pcnet32_driver = { - name: DRV_NAME, - probe: pcnet32_probe_pci, - remove: NULL, - id_table: pcnet32_pci_tbl, + name: DRV_NAME, + probe: pcnet32_probe_pci, + id_table: pcnet32_pci_tbl, }; MODULE_PARM(debug, "i"); +MODULE_PARM_DESC(debug, DRV_NAME " debug level (0-6)"); MODULE_PARM(max_interrupt_work, "i"); +MODULE_PARM_DESC(max_interrupt_work, DRV_NAME " maximum events handled per interrupt"); MODULE_PARM(rx_copybreak, "i"); +MODULE_PARM_DESC(rx_copybreak, DRV_NAME " copy breakpoint for copy-only-tiny-frames"); MODULE_PARM(tx_start_pt, "i"); +MODULE_PARM_DESC(tx_start_pt, DRV_NAME " transmit start point (0-3)"); +MODULE_PARM(pcnet32vlb, "i"); +MODULE_PARM_DESC(pcnet32vlb, DRV_NAME " Vesa local bus (VLB) support (0/1)"); MODULE_PARM(options, "1-" __MODULE_STRING(MAX_UNITS) "i"); +MODULE_PARM_DESC(options, DRV_NAME " initial option setting(s) (0-15)"); MODULE_PARM(full_duplex, "1-" __MODULE_STRING(MAX_UNITS) "i"); +MODULE_PARM_DESC(full_duplex, DRV_NAME " full duplex setting(s) (1)"); + MODULE_AUTHOR("Thomas Bogendoerfer"); MODULE_DESCRIPTION("Driver for PCnet32 and PCnetPCI based ethercards"); MODULE_LICENSE("GPL"); @@ -1675,36 +1684,25 @@ static int __init pcnet32_init_module(void) { - int cards_found = 0; - int err; + printk(KERN_INFO "%s", version); if (debug > 0) pcnet32_debug = debug; + if ((tx_start_pt >= 0) && (tx_start_pt <= 3)) tx_start = tx_start_pt; - - pcnet32_dev = NULL; + /* find the PCI devices */ -#define USE_PCI_REGISTER_DRIVER -#ifdef USE_PCI_REGISTER_DRIVER - if ((err = pci_module_init(&pcnet32_driver)) < 0 ) - return err; -#else - { - struct pci_device_id *devid = pcnet32_pci_tbl; - for (devid = pcnet32_pci_tbl; devid != NULL && devid->vendor != 0; devid++) { - struct pci_dev *pdev = pci_find_subsys(devid->vendor, devid->device, devid->subvendor, devid->subdevice, NULL); - if (pdev != NULL) { - if (pcnet32_probe_pci(pdev, devid) >= 0) { - cards_found++; - } - } - } - } -#endif - return 0; - /* find any remaining VLbus devices */ - return pcnet32_probe_vlbus(cards_found); + pci_module_init(&pcnet32_driver); + + /* should we find any remaining VLbus devices ? */ + if (pcnet32vlb) + pcnet32_probe_vlbus(); + + if (cards_found) + printk(KERN_INFO PFX "%d cards_found.\n", cards_found); + + return cards_found ? 0 : -ENODEV; } static void __exit pcnet32_cleanup_module(void) @@ -1713,13 +1711,13 @@ /* No need to check MOD_IN_USE, as sys_delete_module() checks. */ while (pcnet32_dev) { - struct pcnet32_private *lp = pcnet32_dev->priv; + struct pcnet32_private *lp = pcnet32_dev->priv; next_dev = lp->next; unregister_netdev(pcnet32_dev); release_region(pcnet32_dev->base_addr, PCNET32_TOTAL_SIZE); - if (lp->pci_dev != NULL) + if (lp->pci_dev) pci_unregister_driver(&pcnet32_driver); - pci_free_consistent(lp->pci_dev, sizeof(*lp), lp, lp->dma_addr); + pci_free_consistent(lp->pci_dev, sizeof(*lp), lp, lp->dma_addr); kfree(pcnet32_dev); pcnet32_dev = next_dev; } diff -Naur -X /g/g/lib/dontdiff /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/sk98lin/skge.c net-drivers-2.4/drivers/net/sk98lin/skge.c --- /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/sk98lin/skge.c Fri Oct 12 22:35:53 2001 +++ net-drivers-2.4/drivers/net/sk98lin/skge.c Thu Mar 21 06:38:24 2002 @@ -541,6 +541,48 @@ boards_found++; + /* More then one port found */ + if ((pAC->GIni.GIMacsFound == 2 ) && (pAC->RlmtNets == 2)) { + if ((dev = init_etherdev(NULL, sizeof(DEV_NET))) == 0) { + printk(KERN_ERR "Unable to allocate etherdev " + "structure!\n"); + break; + } + + pAC->dev[1] = dev; + pNet = dev->priv; + pNet->PortNr = 1; + pNet->NetNr = 1; + pNet->pAC = pAC; + pNet->Mtu = 1500; + pNet->Up = 0; + + dev->open = &SkGeOpen; + dev->stop = &SkGeClose; + dev->hard_start_xmit = &SkGeXmit; + dev->get_stats = &SkGeStats; + dev->set_multicast_list = &SkGeSetRxMode; + dev->set_mac_address = &SkGeSetMacAddr; + dev->do_ioctl = &SkGeIoctl; + dev->change_mtu = &SkGeChangeMtu; + + pProcFile = create_proc_entry(dev->name, + S_IFREG | 0444, pSkRootDir); + pProcFile->read_proc = proc_read; + pProcFile->write_proc = NULL; + pProcFile->nlink = 1; + pProcFile->size = sizeof(dev->name+1); + pProcFile->data = (void*)pProcFile; + + memcpy((caddr_t) &dev->dev_addr, + (caddr_t) &pAC->Addr.Net[1].CurrentMacAddress, 6); + + printk("%s: %s\n", dev->name, pAC->DeviceStr); + printk(" PrefPort:B RlmtMode:Dual Check Link State\n"); + + } + + /* * This is bollocks, but we need to tell the net-init * code that it shall go for the next device. diff -Naur -X /g/g/lib/dontdiff /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/smc-ultra.c net-drivers-2.4/drivers/net/smc-ultra.c --- /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/smc-ultra.c Sun Sep 30 19:26:07 2001 +++ net-drivers-2.4/drivers/net/smc-ultra.c Thu Mar 21 06:38:23 2002 @@ -501,8 +501,10 @@ MODULE_PARM(io, "1-" __MODULE_STRING(MAX_ULTRA_CARDS) "i"); MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_ULTRA_CARDS) "i"); -MODULE_PARM_DESC(io, "SMC Ultra I/O base address(es)"); -MODULE_PARM_DESC(irq, "SMC Ultra IRQ number(s) (assigned)"); +MODULE_PARM_DESC(io, "I/O base address(es)"); +MODULE_PARM_DESC(irq, "IRQ number(s) (assigned)"); +MODULE_DESCRIPTION("SMC Ultra/EtherEZ ISA/PnP Ethernet driver"); +MODULE_LICENSE("GPL"); EXPORT_NO_SYMBOLS; @@ -557,7 +559,6 @@ } } #endif /* MODULE */ -MODULE_LICENSE("GPL"); diff -Naur -X /g/g/lib/dontdiff /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/smc-ultra32.c net-drivers-2.4/drivers/net/smc-ultra32.c --- /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/smc-ultra32.c Sun Sep 30 19:26:07 2001 +++ net-drivers-2.4/drivers/net/smc-ultra32.c Thu Mar 21 06:38:23 2002 @@ -379,6 +379,9 @@ #define MAX_ULTRA32_CARDS 4 /* Max number of Ultra cards per module */ static struct net_device dev_ultra[MAX_ULTRA32_CARDS]; +MODULE_DESCRIPTION("SMC Ultra32 EISA ethernet driver"); +MODULE_LICENSE("GPL"); + int init_module(void) { int this_dev, found = 0; @@ -415,5 +418,4 @@ } } #endif /* MODULE */ -MODULE_LICENSE("GPL"); diff -Naur -X /g/g/lib/dontdiff /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/wan/comx-hw-munich.c net-drivers-2.4/drivers/net/wan/comx-hw-munich.c --- /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/wan/comx-hw-munich.c Thu Mar 21 06:39:15 2002 +++ net-drivers-2.4/drivers/net/wan/comx-hw-munich.c Thu Mar 21 06:38:24 2002 @@ -1397,15 +1397,6 @@ return; } -void free_stuff(munich_board_t *board, struct comx_channel *ch) -{ -/* Free CCB and the interrupt queues */ - if (board->ccb) kfree((void *)board->ccb); - if (board->tiq) kfree((void *)board->tiq); - if (board->riq) kfree((void *)board->riq); - if (board->piq) kfree((void *)board->piq); -} - /* * Hardware open routine. * Called by comx (upper) layer when the user wants to bring up the interface @@ -1488,7 +1479,6 @@ if (board->tiq == NULL) { spin_unlock_irqrestore(&mister_lock, flags); - free_stuff(board, ch); return -ENOMEM; } memset((void *)board->tiq, 0, MUNICH_INTQSIZE); @@ -1497,7 +1487,6 @@ if (board->riq == NULL) { spin_unlock_irqrestore(&mister_lock, flags); - free_stuff(board, ch); return -ENOMEM; } memset((void *)board->riq, 0, MUNICH_INTQSIZE); @@ -1506,7 +1495,6 @@ if (board->piq == NULL) { spin_unlock_irqrestore(&mister_lock, flags); - free_stuff(board, ch); return -ENOMEM; } memset((void *)board->piq, 0, MUNICH_PIQSIZE); @@ -1527,7 +1515,6 @@ board->pci->irq); /* TOD: free other resources (a sok malloc feljebb) */ spin_unlock_irqrestore(&mister_lock, flags); - free_stuff(board, ch); return -EAGAIN; } board->irq = board->pci->irq; /* csak akkor legyen != 0, ha tenyleg le van foglalva nekunk */ @@ -1597,7 +1584,6 @@ free_irq(board->irq, (void *)board); /* TOD: free other resources too *//* maybe shut down hw? */ board->irq = 0; spin_unlock_irqrestore(&mister_lock, flags); - free_stuff(board, ch); return -EAGAIN; } else if (!(stat & STAT_PCMA)) @@ -1608,7 +1594,6 @@ free_irq(board->irq, (void *)board); /* TOD: free other resources too *//* maybe shut off the hw? */ board->irq = 0; spin_unlock_irqrestore(&mister_lock, flags); - free_stuff(board, ch); return -EIO; } @@ -1670,7 +1655,7 @@ spin_unlock_irqrestore(&mister_lock, flags); dev->irq = board->irq; /* hogy szep legyen az ifconfig outputja */ - ccb = board->ccb; /* TOD: ez igy csunya egy kicsit hogy benn is meg kinn is beletoltom :( */ + ccb = board->ccb; /* TODO: ez igy csunya egy kicsit hogy benn is meg kinn is beletoltom :( */ spin_lock_irqsave(&mister_lock, flags); @@ -1680,13 +1665,12 @@ /* Check if the selected timeslots aren't used already */ for (i = 0; i < 32; i++) - if (((1 << i) & timeslots) && ccb->timeslot_spec[i].tti == 0) + if (((1 << i) & timeslots) && !ccb->timeslot_spec[i].tti) { printk("MUNICH_open: %s: timeslot %d already used by %s\n", dev->name, i, board->twins[ccb->timeslot_spec[i].txchannel]->name); spin_unlock_irqrestore(&mister_lock, flags); - free_stuff(board, ch); - return -EBUSY; /* TOD: lehet hogy valami mas errno kellene? */ + return -EBUSY; /* TODO: lehet hogy valami mas errno kellene? */ } /* find a free channel: */ @@ -1700,7 +1684,6 @@ ("MUNICH_open: %s: FATAL: can not find a free channel - this should not happen!\n", dev->name); spin_unlock_irqrestore(&mister_lock, flags); - free_stuff(board, ch); return -ENODEV; } if (board->twins[channel] == NULL) @@ -1998,7 +1981,7 @@ spin_lock_irqsave(&mister_lock, flags); - board->use_count--; + if (board->use_count) board->use_count--; if (!board->use_count) /* we were the last user of the board */ { @@ -2020,7 +2003,12 @@ free_irq(board->irq, (void *)board); /* Ha nem inicializalta magat, akkor meg nincs irq */ board->irq = 0; - free_stuff(board, ch); + /* Free CCB and the interrupt queues */ + if (board->ccb) kfree((void *)board->ccb); + if (board->tiq) kfree((void *)board->tiq); + if (board->riq) kfree((void *)board->riq); + if (board->piq) kfree((void *)board->piq); + board->ccb = board->tiq = board->riq = board->piq = NULL; } /* Enable setting of hw parameters */ diff -Naur -X /g/g/lib/dontdiff /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/wd.c net-drivers-2.4/drivers/net/wd.c --- /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/wd.c Sun Sep 30 19:26:07 2001 +++ net-drivers-2.4/drivers/net/wd.c Thu Mar 21 06:38:23 2002 @@ -450,10 +450,11 @@ MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_WD_CARDS) "i"); MODULE_PARM(mem, "1-" __MODULE_STRING(MAX_WD_CARDS) "i"); MODULE_PARM(mem_end, "1-" __MODULE_STRING(MAX_WD_CARDS) "i"); -MODULE_PARM_DESC(io, "WD80x3 I/O base address(es)"); -MODULE_PARM_DESC(irq, "WD80x3 IRQ number(s) (ignored for PureData boards)"); -MODULE_PARM_DESC(mem, "WD80x3 memory base address(es)(ignored for PureData boards)"); -MODULE_PARM_DESC(mem_end, "WD80x3 memory end address(es)"); +MODULE_PARM_DESC(io, "I/O base address(es)"); +MODULE_PARM_DESC(irq, "IRQ number(s) (ignored for PureData boards)"); +MODULE_PARM_DESC(mem, "memory base address(es)(ignored for PureData boards)"); +MODULE_PARM_DESC(mem_end, "memory end address(es)"); +MODULE_DESCRIPTION("ISA Western Digital wd8003/wd8013 ; SMC Elite, Elite16 ethernet driver"); MODULE_LICENSE("GPL"); /* This is set up so that only a single autoprobe takes place per call. diff -Naur -X /g/g/lib/dontdiff /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/wireless/orinoco_plx.c net-drivers-2.4/drivers/net/wireless/orinoco_plx.c --- /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/net/wireless/orinoco_plx.c Mon Feb 25 19:38:03 2002 +++ net-drivers-2.4/drivers/net/wireless/orinoco_plx.c Thu Mar 21 06:38:24 2002 @@ -385,18 +385,17 @@ {0x16ab, 0x1101, PCI_ANY_ID, PCI_ANY_ID,}, /* Reported working, but unknown */ {0x16ab, 0x1102, PCI_ANY_ID, PCI_ANY_ID,}, /* Linksys WDT11 */ {0x16ec, 0x3685, PCI_ANY_ID, PCI_ANY_ID,}, /* USR 2415 */ + {0xec80, 0xec00, PCI_ANY_ID, PCI_ANY_ID,}, /* Belkin F5D6000 */ {0,}, }; MODULE_DEVICE_TABLE(pci, orinoco_plx_pci_id_table); static struct pci_driver orinoco_plx_driver = { - name:"orinoco_plx", - id_table:orinoco_plx_pci_id_table, - probe:orinoco_plx_init_one, - remove:__devexit_p(orinoco_plx_remove_one), - suspend:0, - resume:0 + name: "orinoco_plx", + id_table: orinoco_plx_pci_id_table, + probe: orinoco_plx_init_one, + remove: __devexit_p(orinoco_plx_remove_one), }; static int __init orinoco_plx_init(void) diff -Naur -X /g/g/lib/dontdiff /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/s390/net/ctctty.c net-drivers-2.4/drivers/s390/net/ctctty.c --- /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/s390/net/ctctty.c Wed Jul 25 21:12:02 2001 +++ net-drivers-2.4/drivers/s390/net/ctctty.c Thu Mar 21 06:38:25 2002 @@ -286,7 +286,7 @@ if (!info->netdev) { if (skb) - kfree(skb); + kfree_skb(skb); return 0; } if (info->flags & CTC_ASYNC_TX_LINESTAT) { diff -Naur -X /g/g/lib/dontdiff /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/sound/ac97_codec.c net-drivers-2.4/drivers/sound/ac97_codec.c --- /home/jgarzik/vanilla/kernel-2.4.19-pre4/drivers/sound/ac97_codec.c Mon Nov 12 18:02:54 2001 +++ net-drivers-2.4/drivers/sound/ac97_codec.c Thu Mar 21 06:38:34 2002 @@ -105,7 +105,9 @@ {0x41445340, "Analog Devices AD1881", &null_ops}, {0x41445348, "Analog Devices AD1881A", &null_ops}, {0x41445360, "Analog Devices AD1885", &default_ops}, + {0x41445361, "Analog Devices AD1886", &default_ops}, {0x41445460, "Analog Devices AD1885", &default_ops}, + {0x41445461, "Analog Devices AD1886", &default_ops}, {0x414B4D00, "Asahi Kasei AK4540", &null_ops}, {0x414B4D01, "Asahi Kasei AK4542", &null_ops}, {0x414B4D02, "Asahi Kasei AK4543", &null_ops}, diff -Naur -X /g/g/lib/dontdiff /home/jgarzik/vanilla/kernel-2.4.19-pre4/include/asm-i386/checksum.h net-drivers-2.4/include/asm-i386/checksum.h --- /home/jgarzik/vanilla/kernel-2.4.19-pre4/include/asm-i386/checksum.h Thu Jul 26 20:41:22 2001 +++ net-drivers-2.4/include/asm-i386/checksum.h Thu Mar 21 06:38:45 2002 @@ -29,9 +29,9 @@ /* * Note: when you get a NULL pointer exception here this means someone - * passed in an incorrect kernel address to one of these functions. - * - * If you use these functions directly please don't forget the + * passed in an incorrect kernel address to one of these functions. + * + * If you use these functions directly please don't forget the * verify_area(). */ static __inline__ @@ -66,28 +66,28 @@ * Arnt Gulbrandsen. */ static inline unsigned short ip_fast_csum(unsigned char * iph, - unsigned int ihl) { + unsigned int ihl) +{ unsigned int sum; - __asm__ __volatile__(" - movl (%1), %0 - subl $4, %2 - jbe 2f - addl 4(%1), %0 - adcl 8(%1), %0 - adcl 12(%1), %0 -1: adcl 16(%1), %0 - lea 4(%1), %1 - decl %2 - jne 1b - adcl $0, %0 - movl %0, %2 - shrl $16, %0 - addw %w2, %w0 - adcl $0, %0 - notl %0 -2: - " + __asm__ __volatile__( + "movl (%1), %0 ;\n" + "subl $4, %2 ;\n" + "jbe 2f ;\n" + "addl 4(%1), %0 ;\n" + "adcl 8(%1), %0 ;\n" + "adcl 12(%1), %0 ;\n" +"1: adcl 16(%1), %0 ;\n" + "lea 4(%1), %1 ;\n" + "decl %2 ;\n" + "jne 1b ;\n" + "adcl $0, %0 ;\n" + "movl %0, %2 ;\n" + "shrl $16, %0 ;\n" + "addw %w2, %w0 ;\n" + "adcl $0, %0 ;\n" + "notl %0 ;\n" +"2: ;\n" /* Since the input registers which are loaded with iph and ipl are modified, we must also specify them as outputs, or gcc will assume they contain their original values. */ @@ -102,28 +102,26 @@ static inline unsigned int csum_fold(unsigned int sum) { - __asm__(" - addl %1, %0 - adcl $0xffff, %0 - " + __asm__( + "addl %1, %0 ;\n" + "adcl $0xffff, %0 ;\n" : "=r" (sum) : "r" (sum << 16), "0" (sum & 0xffff0000) ); return (~sum) >> 16; } - + static inline unsigned long csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len, unsigned short proto, - unsigned int sum) + unsigned int sum) { - __asm__(" - addl %1, %0 - adcl %2, %0 - adcl %3, %0 - adcl $0, %0 - " + __asm__( + "addl %1, %0 ;\n" + "adcl %2, %0 ;\n" + "adcl %3, %0 ;\n" + "adcl $0, %0 ;\n" : "=r" (sum) : "g" (daddr), "g"(saddr), "g"((ntohs(len)<<16)+proto*256), "0"(sum)); return sum; @@ -137,7 +135,7 @@ unsigned long daddr, unsigned short len, unsigned short proto, - unsigned int sum) + unsigned int sum) { return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); } @@ -147,7 +145,8 @@ * in icmp.c */ -static inline unsigned short ip_compute_csum(unsigned char * buff, int len) { +static inline unsigned short ip_compute_csum(unsigned char * buff, int len) +{ return csum_fold (csum_partial(buff, len, 0)); } @@ -156,33 +155,32 @@ struct in6_addr *daddr, __u32 len, unsigned short proto, - unsigned int sum) + unsigned int sum) { - __asm__(" - addl 0(%1), %0 - adcl 4(%1), %0 - adcl 8(%1), %0 - adcl 12(%1), %0 - adcl 0(%2), %0 - adcl 4(%2), %0 - adcl 8(%2), %0 - adcl 12(%2), %0 - adcl %3, %0 - adcl %4, %0 - adcl $0, %0 - " + __asm__( + "addl 0(%1), %0 ;\n" + "adcl 4(%1), %0 ;\n" + "adcl 8(%1), %0 ;\n" + "adcl 12(%1), %0 ;\n" + "adcl 0(%2), %0 ;\n" + "adcl 4(%2), %0 ;\n" + "adcl 8(%2), %0 ;\n" + "adcl 12(%2), %0 ;\n" + "adcl %3, %0 ;\n" + "adcl %4, %0 ;\n" + "adcl $0, %0 ;\n" : "=&r" (sum) - : "r" (saddr), "r" (daddr), + : "r" (saddr), "r" (daddr), "r"(htonl(len)), "r"(htonl(proto)), "0"(sum)); return csum_fold(sum); } -/* +/* * Copy and checksum to user */ #define HAVE_CSUM_COPY_USER -static __inline__ unsigned int csum_and_copy_to_user (const char *src, char *dst, +static __inline__ unsigned int csum_and_copy_to_user(const char *src, char *dst, int len, int sum, int *err_ptr) { if (access_ok(VERIFY_WRITE, dst, len))