acenic-v0.46 update

From: Jes Sorensen (jes@linuxcare.com)
Date: Wed Sep 06 2000 - 10:08:13 EST


Hi

Here is a patch for the acenic-v0.46 driver relative to whats in
test8-pre4 - it solves a few bugs and cleans up a few minor issues in
the code and comments.

I have been unable to test this patch but looking over the changes I
cannot see any reason why it would cause problems.

Jes

--- ../linux/drivers/net/acenic.c Fri Jul 28 15:47:19 2000
+++ drivers/net/acenic.c Tue Sep 5 15:21:11 2000
@@ -29,7 +29,12 @@
  * infrastructure and Sparc support
  * Pierrick Pinasseau (CERN): For lending me an Ultra 5 to test the
  * driver under Linux/Sparc64
- * Matt Domsch <Matt_Domsch@dell.com>: Detect 1000baseT cards
+ * Matt Domsch <Matt_Domsch@dell.com>: Detect Alteon 1000baseT cards
+ * Chip Salzenberg <chip@valinux.com>: Fix race condition between tx
+ * handler and close() cleanup.
+ * Ken Aaker <kdaaker@rchland.vnet.ibm.com>: Correct check for whether
+ * memory mapped IO is enabled to
+ * make the driver work on RS/6000.
  */
 
 #include <linux/config.h>
@@ -83,8 +88,13 @@
 #define PCI_VENDOR_ID_NETGEAR 0x1385
 #define PCI_DEVICE_ID_NETGEAR_GA620 0x620a
 #endif
+#ifndef PCI_DEVICE_ID_NETGEAR_GA620T
+#define PCI_DEVICE_ID_NETGEAR_GA620T 0x630a
+#endif
+
 /*
- * They used the DEC vendor ID by mistake
+ * Farallon used the DEC vendor ID by mistake and they seem not
+ * to care - stinky!
  */
 #ifndef PCI_DEVICE_ID_FARALLON_PN9000SX
 #define PCI_DEVICE_ID_FARALLON_PN9000SX 0x1a
@@ -389,7 +399,7 @@
 static int dis_pci_mem_inval[ACE_MAX_MOD_PARMS] = {1, 1, 1, 1, 1, 1, 1, 1};
 
 static const char __initdata *version =
- "acenic.c: v0.44 05/11/2000 Jes Sorensen, linux-acenic@SunSITE.auc.dk\n"
+ "acenic.c: v0.46 09/05/2000 Jes Sorensen, linux-acenic@SunSITE.auc.dk\n"
   " http://home.cern.ch/~jes/gige/acenic.html\n";
 
 static struct net_device *root_dev = NULL;
@@ -429,7 +439,8 @@
                     !((pdev->vendor == PCI_VENDOR_ID_3COM) &&
                       (pdev->device == PCI_DEVICE_ID_3COM_3C985)) &&
                     !((pdev->vendor == PCI_VENDOR_ID_NETGEAR) &&
- (pdev->device == PCI_DEVICE_ID_NETGEAR_GA620)) &&
+ ((pdev->device == PCI_DEVICE_ID_NETGEAR_GA620) ||
+ (pdev->device == PCI_DEVICE_ID_NETGEAR_GA620T))) &&
                 /*
                  * Farallon used the DEC vendor ID on their cards by
                  * mistake for a while
@@ -480,7 +491,7 @@
                 pci_read_config_word(pdev, PCI_COMMAND, &ap->pci_command);
 
                 /* OpenFirmware on Mac's does not set this - DOH.. */
- if (!ap->pci_command & PCI_COMMAND_MEMORY) {
+ if (!(ap->pci_command & PCI_COMMAND_MEMORY)) {
                         printk(KERN_INFO "%s: Enabling PCI Memory Mapped "
                                "access - was not enabled by BIOS/Firmware\n",
                                dev->name);
@@ -597,7 +608,6 @@
 }
 
 
-#ifdef MODULE
 MODULE_AUTHOR("Jes Sorensen <Jes.Sorensen@cern.ch>");
 MODULE_DESCRIPTION("AceNIC/3C985/GA620 Gigabit Ethernet driver");
 MODULE_PARM(link, "1-" __MODULE_STRING(8) "i");
@@ -607,7 +617,6 @@
 MODULE_PARM(rx_coal_tick, "1-" __MODULE_STRING(8) "i");
 MODULE_PARM(max_rx_desc, "1-" __MODULE_STRING(8) "i");
 
-#endif
 
 void __exit ace_module_cleanup(void)
 {
@@ -1994,18 +2003,34 @@
         if (txcsm != idx) {
                 do {
                         struct sk_buff *skb;
- dma_addr_t mapping;
 
                         skb = ap->skb->tx_skbuff[idx].skb;
- mapping = ap->skb->tx_skbuff[idx].mapping;
+ /*
+ * Race condition between the code cleaning
+ * the tx queue in the interrupt handler and the
+ * interface close,
+ *
+ * This is a kludge that really should be fixed
+ * by preventing the driver from generating a tx
+ * interrupt when the packet has already been
+ * removed from the tx queue.
+ *
+ * Nailed by Don Dugger and Chip Salzenberg of
+ * VA Linux.
+ */
+ if (skb) {
+ dma_addr_t mapping;
 
- ap->stats.tx_packets++;
- ap->stats.tx_bytes += skb->len;
- pci_unmap_single(ap->pdev, mapping, skb->len,
- PCI_DMA_TODEVICE);
- dev_kfree_skb_irq(skb);
+ mapping = ap->skb->tx_skbuff[idx].mapping;
+
+ ap->stats.tx_packets++;
+ ap->stats.tx_bytes += skb->len;
+ pci_unmap_single(ap->pdev, mapping, skb->len,
+ PCI_DMA_TODEVICE);
+ dev_kfree_skb_irq(skb);
 
- ap->skb->tx_skbuff[idx].skb = NULL;
+ ap->skb->tx_skbuff[idx].skb = NULL;
+ }
 
                         /*
                          * Question here is whether one should not skip
@@ -2966,6 +2991,6 @@
 
 /*
  * Local variables:
- * compile-command: "gcc -D__KERNEL__ -DMODULE -I../../include -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -pipe -fno-strength-reduce -DMODVERSIONS -include ../../include/linux/modversions.h -c -o acenic.o acenic.c"
+ * compile-command: "gcc -D__SMP__ -D__KERNEL__ -DMODULE -I../../include -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -pipe -fno-strength-reduce -DMODVERSIONS -include ../../include/linux/modversions.h -c -o acenic.o acenic.c"
  * End:
  */
--- ../linux/drivers/net/acenic.h Fri May 12 14:38:35 2000
+++ drivers/net/acenic.h Tue Sep 5 14:57:24 2000
@@ -609,7 +609,7 @@
         struct timer_list timer;
 
         unsigned long std_refill_busy
- __attribute__ ((aligned (L1_CACHE_BYTES)));
+ __attribute__ ((aligned (SMP_CACHE_BYTES)));
         unsigned long mini_refill_busy, jumbo_refill_busy;
         atomic_t cur_rx_bufs,
                                 cur_mini_bufs,
@@ -642,7 +642,7 @@
         char name[48];
 #ifdef INDEX_DEBUG
         spinlock_t debug_lock
- __attribute__ ((aligned (L1_CACHE_BYTES)));;
+ __attribute__ ((aligned (SMP_CACHE_BYTES)));;
         u32 last_tx, last_std_rx, last_mini_rx;
 #endif
         struct net_device_stats stats;
--- ../linux/drivers/net/acenic_firmware.h Thu Jul 6 22:27:48 2000
+++ drivers/net/acenic_firmware.h Wed Jun 7 17:26:43 2000
@@ -17,6 +17,9 @@
 #define tigonFwSbssLen 0x38
 #define tigonFwBssAddr 0x00015dd0
 #define tigonFwBssLen 0x2080
+u32 tigonFwText[];
+u32 tigonFwData[];
+u32 tigonFwRodata[];
 #ifndef CONFIG_ACENIC_OMIT_TIGON_I
 /* Generated by genfw.c */
 u32 tigonFwText[(MAX_TEXT_LEN/4) + 1] __initdata = {
@@ -4592,10 +4595,6 @@
 0x0, 0x0, 0x0, 0x2,
 0x0, 0x0, 0x30001, 0x1,
 0x30201, 0x0, 0x0, 0x0 };
-#else
-#define tigonFwText NULL
-#define tigonFwData NULL
-#define tigonFwRodata NULL
 #endif
 /* Generated by genfw.c */
 #define tigon2FwReleaseMajor 0xc
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Sep 07 2000 - 21:00:25 EST