netdev
[Top] [All Lists]

Re: [PATCH] Gigabit Ethernet support for forcedeth

To: Jeff Garzik <jgarzik@xxxxxxxxx>
Subject: Re: [PATCH] Gigabit Ethernet support for forcedeth
From: Manfred Spraul <manfred@xxxxxxxxxxxxxxxx>
Date: Wed, 30 Jun 2004 20:55:35 +0200
Cc: linux-kernel@xxxxxxxxxxxxxxx, netdev@xxxxxxxxxxx
In-reply-to: <40E2E618.5020601@colorfullife.com>
References: <40E25328.8020102@colorfullife.com> <40E25944.8010200@pobox.com> <40E2E618.5020601@colorfullife.com>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux i686; fr-FR; rv:1.6) Gecko/20040510
Manfred Spraul wrote:


your driver needs to call pci_set_dma_mask() and pci_set_consistent_dma_mask().


I'll add that.

I've checked the pci layer: 32-bit is the default, thus no calls are required. What's missing is error handling for pci_map, I'll add that later.

Attached is an incremental patch that fixes the simple issues you mentioned. Could you merge both patches together to your tree? They improve the driver significantly and I want some test input from users.

I've added message flags and pci_map error handling to my todo list.
--
   Manfred
// $Header$
// Kernel Version:
//  VERSION = 2
//  PATCHLEVEL = 6
//  SUBLEVEL = 7
//  EXTRAVERSION = -mm2
--- 2.6/drivers/net/forcedeth.c 2004-06-30 18:45:23.000000000 +0200
+++ build-2.6/drivers/net/forcedeth.c   2004-06-30 18:45:05.000000000 +0200
@@ -348,18 +348,22 @@ struct ring_desc {
 
 /* General driver defaults */
 #define NV_WATCHDOG_TIMEO      (5*HZ)
-#define DEFAULT_MTU            1500    /* also maximum supported, at least for 
now */
 
 #define RX_RING                128
 #define TX_RING                64
-/* limited to 1 packet until we understand NV_TX_LASTPACKET */
+/* 
+ * If your nic mysteriously hangs then try to reduce the limits
+ * to 1/0: It might be required to set NV_TX_LASTPACKET in the
+ * last valid ring entry. But this would be impossible to
+ * implement - probably a disassembly error.
+ */
 #define TX_LIMIT_STOP  63
 #define TX_LIMIT_START 62
 
 /* rx/tx mac addr + type + vlan + align + slack*/
-#define RX_NIC_BUFSIZE         (DEFAULT_MTU + 64)
+#define RX_NIC_BUFSIZE         (ETH_DATA_LEN + 64)
 /* even more slack */
-#define RX_ALLOC_BUFSIZE       (DEFAULT_MTU + 128)
+#define RX_ALLOC_BUFSIZE       (ETH_DATA_LEN + 128)
 
 #define OOM_REFILL     (1+HZ/20)
 #define POLL_WAIT      (1+HZ/100)
@@ -988,7 +992,7 @@ static void nv_tx_done(struct net_device
        while (np->nic_tx != np->next_tx) {
                i = np->nic_tx % TX_RING;
 
-               Flags = cpu_to_le32(np->tx_ring[i].FlagLen);
+               Flags = le32_to_cpu(np->tx_ring[i].FlagLen);
 
                dprintk(KERN_DEBUG "%s: nv_tx_done: looking at packet %d, Flags 
0x%x.\n",
                                        dev->name, np->nic_tx, Flags);
@@ -1077,7 +1081,7 @@ static void nv_rx_process(struct net_dev
                        break;  /* we scanned the whole ring - do not continue 
*/
 
                i = np->cur_rx % RX_RING;
-               Flags = cpu_to_le32(np->rx_ring[i].FlagLen);
+               Flags = le32_to_cpu(np->rx_ring[i].FlagLen);
                len = nv_descr_getlength(&np->rx_ring[i], np->desc_ver);
 
                dprintk(KERN_DEBUG "%s: nv_rx_process: looking at packet %d, 
Flags 0x%x.\n",
@@ -1193,7 +1197,7 @@ next_pkt:
  */
 static int nv_change_mtu(struct net_device *dev, int new_mtu)
 {
-       if (new_mtu > DEFAULT_MTU)
+       if (new_mtu > ETH_DATA_LEN)
                return -EINVAL;
        dev->mtu = new_mtu;
        return 0;
@@ -1999,7 +2003,7 @@ static void __exit exit_nic(void)
        pci_unregister_driver(&driver);
 }
 
-MODULE_PARM(max_interrupt_work, "i");
+module_param(max_interrupt_work, int, 0);
 MODULE_PARM_DESC(max_interrupt_work, "forcedeth maximum events handled per 
interrupt");
 
 MODULE_AUTHOR("Manfred Spraul <manfred@xxxxxxxxxxxxxxxx>");
<Prev in Thread] Current Thread [Next in Thread>