Commit 27e69543 authored by Edward Peng's avatar Edward Peng Committed by Jeff Garzik

dl2k gige net driver update:

* lock tx_coalesce==1 in 10/100 modes
* switch driver to default to PIO (instead of MMIO)
parent 15d68f80
D-Link DL2000-based Gigabit Ethernet Adapter Installation D-Link DL2000-based Gigabit Ethernet Adapter Installation
for Linux for Linux
Jan 29, 2002 May 23, 2002
Contents Contents
======== ========
...@@ -202,7 +202,7 @@ media=media_type - Specifies the media type the NIC operates at. ...@@ -202,7 +202,7 @@ media=media_type - Specifies the media type the NIC operates at.
1000mbps_fd and 1000mbps_hd types are only 1000mbps_fd and 1000mbps_hd types are only
available for fiber adapter. available for fiber adapter.
vlan=[0|1] - Specifies the VLAN ID. If vlan=0, the vlan=n - Specifies the VLAN ID. If vlan=0, the
Virtual Local Area Network (VLAN) function is Virtual Local Area Network (VLAN) function is
disable. disable.
...@@ -211,24 +211,34 @@ jumbo=[0|1] - Specifies the jumbo frame support. If jumbo=1, ...@@ -211,24 +211,34 @@ jumbo=[0|1] - Specifies the jumbo frame support. If jumbo=1,
function is disabled. function is disabled.
Jumbo frame usually improve the performance Jumbo frame usually improve the performance
int gigabit. int gigabit.
This feature need jumbo frame compatible
rx_coalesce=n - Rx frame count each interrupt. remote.
rx_timeout=n - Rx DMA wait time for an interrupt. Proper
values of rx_coalesce and rx_timeout bring rx_coalesce=m - Number of rx frame handled each interrupt.
a conspicuous performance in the fast machine. rx_timeout=n - Rx DMA wait time for an interrupt.
Ex. rx_coalesce=5 and rx_timeout=750 If set rx_coalesce > 0, hardware only assert
an interrupt for m frames. Hardware won't
tx_coalesce=n - Tx transmit count each TxComp interrupt. assert rx interrupt until m frames received or
Setting value larger than 1 will improve reach timeout of n * 640 nano seconds.
performance, but this is possible to lower Set proper rx_coalesce and rx_timeout can
stability in slow UP machines. By default, reduce congestion collapse and overload which
tx_coalesce=1. (dl2k) has been a bottlenect for high speed network.
tx_flow=[1|0] - Specifies the Tx flow control. If tx_flow=1, For example, rx_coalesce=10 rx_timeout=800.
the Tx flow control enable. that is, hardware assert only 1 interrupt
for 10 frames received or timeout of 512 us.
rx_flow=[1|0] - Specifies the Rx flow control. If rx_flow=1,
the Rx flow control enable. tx_coalesce=n - Number of tx frame handled each interrupt.
Set n > 1 can reduce the interrupts
congestion usually lower performance of
high speed network card. Default is 16.
tx_flow=[1|0] - Specifies the Tx flow control. If tx_flow=0,
the Tx flow control disable else driver
autodetect.
rx_flow=[1|0] - Specifies the Rx flow control. If rx_flow=0,
the Rx flow control enable else driver
autodetect.
Configuration Script Sample Configuration Script Sample
......
/* D-Link DL2000-based Gigabit Ethernet Adapter Linux driver */ /* D-Link DL2000-based Gigabit Ethernet Adapter Linux driver */
/* /*
Copyright (c) 2001,2002 by D-Link Corporation Copyright (c) 2001, 2002 by D-Link Corporation
Written by Edward Peng.<edward_peng@dlink.com.tw> Written by Edward Peng.<edward_peng@dlink.com.tw>
Created 03-May-2001, base on Linux' sundance.c. Created 03-May-2001, base on Linux' sundance.c.
...@@ -33,12 +33,13 @@ ...@@ -33,12 +33,13 @@
1.11 2002/05/23 Added ISR schedule scheme. 1.11 2002/05/23 Added ISR schedule scheme.
Fixed miscount of rx frame error for DGE-550SX. Fixed miscount of rx frame error for DGE-550SX.
Fixed VLAN bug. Fixed VLAN bug.
1.12 2002/06/13 Lock tx_coalesce=1 on 10/100Mbps mode.
*/ */
#include "dl2k.h" #include "dl2k.h"
static char version[] __devinitdata = static char version[] __devinitdata =
KERN_INFO "D-Link DL2000-based linux driver v1.11 2002/05/23\n"; KERN_INFO "D-Link DL2000-based linux driver v1.12 2002/06/13\n";
#define MAX_UNITS 8 #define MAX_UNITS 8
static int mtu[MAX_UNITS]; static int mtu[MAX_UNITS];
...@@ -138,15 +139,15 @@ rio_probe1 (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -138,15 +139,15 @@ rio_probe1 (struct pci_dev *pdev, const struct pci_device_id *ent)
} }
SET_MODULE_OWNER (dev); SET_MODULE_OWNER (dev);
#ifdef USE_IO_OPS #ifdef MEM_MAPPING
ioaddr = pci_resource_start (pdev, 0);
#else
ioaddr = pci_resource_start (pdev, 1); ioaddr = pci_resource_start (pdev, 1);
ioaddr = (long) ioremap (ioaddr, RIO_IO_SIZE); ioaddr = (long) ioremap (ioaddr, RIO_IO_SIZE);
if (!ioaddr) { if (!ioaddr) {
err = -ENOMEM; err = -ENOMEM;
goto err_out_dev; goto err_out_dev;
} }
#else
ioaddr = pci_resource_start (pdev, 0);
#endif #endif
dev->base_addr = ioaddr; dev->base_addr = ioaddr;
dev->irq = irq; dev->irq = irq;
...@@ -158,6 +159,7 @@ rio_probe1 (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -158,6 +159,7 @@ rio_probe1 (struct pci_dev *pdev, const struct pci_device_id *ent)
/* Parse manual configuration */ /* Parse manual configuration */
np->an_enable = 1; np->an_enable = 1;
np->tx_coalesce = 1;
if (card_idx < MAX_UNITS) { if (card_idx < MAX_UNITS) {
if (media[card_idx] != NULL) { if (media[card_idx] != NULL) {
np->an_enable = 0; np->an_enable = 0;
...@@ -213,7 +215,7 @@ rio_probe1 (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -213,7 +215,7 @@ rio_probe1 (struct pci_dev *pdev, const struct pci_device_id *ent)
if (tx_coalesce < 1) if (tx_coalesce < 1)
tx_coalesce = 1; tx_coalesce = 1;
if (tx_coalesce > TX_RING_SIZE-1) else if (tx_coalesce > TX_RING_SIZE-1)
tx_coalesce = TX_RING_SIZE - 1; tx_coalesce = TX_RING_SIZE - 1;
} }
dev->open = &rio_open; dev->open = &rio_open;
...@@ -303,7 +305,7 @@ rio_probe1 (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -303,7 +305,7 @@ rio_probe1 (struct pci_dev *pdev, const struct pci_device_id *ent)
err_out_unmap_tx: err_out_unmap_tx:
pci_free_consistent (pdev, TX_TOTAL_SIZE, np->tx_ring, np->tx_ring_dma); pci_free_consistent (pdev, TX_TOTAL_SIZE, np->tx_ring, np->tx_ring_dma);
err_out_iounmap: err_out_iounmap:
#ifndef USE_IO_OPS #ifdef MEM_MAPPING
iounmap ((void *) ioaddr); iounmap ((void *) ioaddr);
err_out_dev: err_out_dev:
...@@ -361,7 +363,7 @@ parse_eeprom (struct net_device *dev) ...@@ -361,7 +363,7 @@ parse_eeprom (struct net_device *dev)
} }
/* Check CRC */ /* Check CRC */
crc = ~ether_crc_le(256 - 4, sromdata); crc = ~ether_crc_le (256 - 4, sromdata);
if (psrom->crc != crc) { if (psrom->crc != crc) {
printk (KERN_ERR "%s: EEPROM data CRC error.\n", dev->name); printk (KERN_ERR "%s: EEPROM data CRC error.\n", dev->name);
return -1; return -1;
...@@ -636,7 +638,7 @@ start_xmit (struct sk_buff *skb, struct net_device *dev) ...@@ -636,7 +638,7 @@ start_xmit (struct sk_buff *skb, struct net_device *dev)
/* DL2K bug: DMA fails to get next descriptor ptr in 10Mbps mode /* DL2K bug: DMA fails to get next descriptor ptr in 10Mbps mode
* Work around: Always use 1 descriptor in 10Mbps mode */ * Work around: Always use 1 descriptor in 10Mbps mode */
if (entry % tx_coalesce == 0 || np->speed == 10) if (entry % np->tx_coalesce == 0 || np->speed == 10)
txdesc->status = cpu_to_le64 (entry | tfc_vlan_tag | txdesc->status = cpu_to_le64 (entry | tfc_vlan_tag |
WordAlignDisable | WordAlignDisable |
TxDMAIndicate | TxDMAIndicate |
...@@ -936,6 +938,10 @@ rio_error (struct net_device *dev, int int_status) ...@@ -936,6 +938,10 @@ rio_error (struct net_device *dev, int int_status)
mii_get_media_pcs (dev); mii_get_media_pcs (dev);
else else
mii_get_media (dev); mii_get_media (dev);
if (np->speed == 1000)
np->tx_coalesce = tx_coalesce;
else
np->tx_coalesce = 1;
macctrl = 0; macctrl = 0;
macctrl |= (np->vlan) ? AutoVLANuntagging : 0; macctrl |= (np->vlan) ? AutoVLANuntagging : 0;
macctrl |= (np->full_duplex) ? DuplexSelect : 0; macctrl |= (np->full_duplex) ? DuplexSelect : 0;
...@@ -1671,7 +1677,7 @@ rio_remove1 (struct pci_dev *pdev) ...@@ -1671,7 +1677,7 @@ rio_remove1 (struct pci_dev *pdev)
np->rx_ring_dma); np->rx_ring_dma);
pci_free_consistent (pdev, TX_TOTAL_SIZE, np->tx_ring, pci_free_consistent (pdev, TX_TOTAL_SIZE, np->tx_ring,
np->tx_ring_dma); np->tx_ring_dma);
#ifndef USE_IO_OPS #ifdef MEM_MAPPING
iounmap ((char *) (dev->base_addr)); iounmap ((char *) (dev->base_addr));
#endif #endif
kfree (dev); kfree (dev);
......
...@@ -33,15 +33,15 @@ ...@@ -33,15 +33,15 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/time.h> #include <linux/time.h>
#define TX_RING_SIZE 128 #define TX_RING_SIZE 256
#define TX_QUEUE_LEN 120 /* Limit ring entries actually used. */ #define TX_QUEUE_LEN (TX_RING_SIZE - 1) /* Limit ring entries actually used.*/
#define RX_RING_SIZE 128 #define RX_RING_SIZE 256
#define TX_TOTAL_SIZE TX_RING_SIZE*sizeof(struct netdev_desc) #define TX_TOTAL_SIZE TX_RING_SIZE*sizeof(struct netdev_desc)
#define RX_TOTAL_SIZE RX_RING_SIZE*sizeof(struct netdev_desc) #define RX_TOTAL_SIZE RX_RING_SIZE*sizeof(struct netdev_desc)
/* This driver was written to use PCI memory space, however x86-oriented /* This driver was written to use PCI memory space, however x86-oriented
hardware often uses I/O space accesses. */ hardware often uses I/O space accesses. */
#ifdef USE_IO_OPS #ifndef MEM_MAPPING
#undef readb #undef readb
#undef readw #undef readw
#undef readl #undef readl
...@@ -658,6 +658,7 @@ struct netdev_private { ...@@ -658,6 +658,7 @@ struct netdev_private {
unsigned int chip_id; /* PCI table chip id */ unsigned int chip_id; /* PCI table chip id */
unsigned int rx_coalesce; /* Maximum frames each RxDMAComplete intr */ unsigned int rx_coalesce; /* Maximum frames each RxDMAComplete intr */
unsigned int rx_timeout; /* Wait time between RxDMAComplete intr */ unsigned int rx_timeout; /* Wait time between RxDMAComplete intr */
unsigned int tx_coalesce; /* Maximum frames each tx interrupt */
unsigned int full_duplex:1; /* Full-duplex operation requested. */ unsigned int full_duplex:1; /* Full-duplex operation requested. */
unsigned int an_enable:2; /* Auto-Negotiated Enable */ unsigned int an_enable:2; /* Auto-Negotiated Enable */
unsigned int jumbo:1; /* Jumbo frame enable */ unsigned int jumbo:1; /* Jumbo frame enable */
...@@ -681,10 +682,10 @@ struct netdev_private { ...@@ -681,10 +682,10 @@ struct netdev_private {
}; };
/* The station address location in the EEPROM. */ /* The station address location in the EEPROM. */
#ifdef USE_IO_OPS #ifdef MEM_MAPPING
#define PCI_IOTYPE (PCI_USES_MASTER | PCI_USES_IO | PCI_ADDR0)
#else
#define PCI_IOTYPE (PCI_USES_MASTER | PCI_USES_MEM | PCI_ADDR1) #define PCI_IOTYPE (PCI_USES_MASTER | PCI_USES_MEM | PCI_ADDR1)
#else
#define PCI_IOTYPE (PCI_USES_MASTER | PCI_USES_IO | PCI_ADDR0)
#endif #endif
/* The struct pci_device_id consist of: /* The struct pci_device_id consist of:
vendor, device Vendor and device ID to match (or PCI_ANY_ID) vendor, device Vendor and device ID to match (or PCI_ANY_ID)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment