mirror of
https://github.com/ukui/kernel.git
synced 2026-03-09 10:07:04 -07:00
Manual merge of rsync://rsync.kernel.org/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git
This is a fixed-up version of the broken "upstream-2.6.13" branch, where I re-did the manual merge of drivers/net/r8169.c by hand, and made sure the history is all good.
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
Generic HDLC layer
|
||||
Krzysztof Halasa <khc@pm.waw.pl>
|
||||
January, 2003
|
||||
|
||||
|
||||
Generic HDLC layer currently supports:
|
||||
- Frame Relay (ANSI, CCITT and no LMI), with ARP support (no InARP).
|
||||
Normal (routed) and Ethernet-bridged (Ethernet device emulation)
|
||||
interfaces can share a single PVC.
|
||||
- raw HDLC - either IP (IPv4) interface or Ethernet device emulation.
|
||||
- Cisco HDLC,
|
||||
- PPP (uses syncppp.c),
|
||||
- X.25 (uses X.25 routines).
|
||||
1. Frame Relay (ANSI, CCITT, Cisco and no LMI).
|
||||
- Normal (routed) and Ethernet-bridged (Ethernet device emulation)
|
||||
interfaces can share a single PVC.
|
||||
- ARP support (no InARP support in the kernel - there is an
|
||||
experimental InARP user-space daemon available on:
|
||||
http://www.kernel.org/pub/linux/utils/net/hdlc/).
|
||||
2. raw HDLC - either IP (IPv4) interface or Ethernet device emulation.
|
||||
3. Cisco HDLC.
|
||||
4. PPP (uses syncppp.c).
|
||||
5. X.25 (uses X.25 routines).
|
||||
|
||||
There are hardware drivers for the following cards:
|
||||
- C101 by Moxa Technologies Co., Ltd.
|
||||
- RISCom/N2 by SDL Communications Inc.
|
||||
- and others, some not in the official kernel.
|
||||
Generic HDLC is a protocol driver only - it needs a low-level driver
|
||||
for your particular hardware.
|
||||
|
||||
Ethernet device emulation (using HDLC or Frame-Relay PVC) is compatible
|
||||
with IEEE 802.1Q (VLANs) and 802.1D (Ethernet bridging).
|
||||
@@ -24,7 +24,7 @@ with IEEE 802.1Q (VLANs) and 802.1D (Ethernet bridging).
|
||||
Make sure the hdlc.o and the hardware driver are loaded. It should
|
||||
create a number of "hdlc" (hdlc0 etc) network devices, one for each
|
||||
WAN port. You'll need the "sethdlc" utility, get it from:
|
||||
http://hq.pm.waw.pl/hdlc/
|
||||
http://www.kernel.org/pub/linux/utils/net/hdlc/
|
||||
|
||||
Compile sethdlc.c utility:
|
||||
gcc -O2 -Wall -o sethdlc sethdlc.c
|
||||
@@ -52,12 +52,12 @@ Setting interface:
|
||||
* v35 | rs232 | x21 | t1 | e1 - sets physical interface for a given port
|
||||
if the card has software-selectable interfaces
|
||||
loopback - activate hardware loopback (for testing only)
|
||||
* clock ext - external clock (uses DTE RX and TX clock)
|
||||
* clock int - internal clock (provides clock signal on DCE clock output)
|
||||
* clock txint - TX internal, RX external (provides TX clock on DCE output)
|
||||
* clock txfromrx - TX clock derived from RX clock (TX clock on DCE output)
|
||||
* rate - sets clock rate in bps (not required for external clock or
|
||||
for txfromrx)
|
||||
* clock ext - both RX clock and TX clock external
|
||||
* clock int - both RX clock and TX clock internal
|
||||
* clock txint - RX clock external, TX clock internal
|
||||
* clock txfromrx - RX clock external, TX clock derived from RX clock
|
||||
* rate - sets clock rate in bps (for "int" or "txint" clock only)
|
||||
|
||||
|
||||
Setting protocol:
|
||||
|
||||
@@ -79,7 +79,7 @@ Setting protocol:
|
||||
* x25 - sets X.25 mode
|
||||
|
||||
* fr - Frame Relay mode
|
||||
lmi ansi / ccitt / none - LMI (link management) type
|
||||
lmi ansi / ccitt / cisco / none - LMI (link management) type
|
||||
dce - Frame Relay DCE (network) side LMI instead of default DTE (user).
|
||||
It has nothing to do with clocks!
|
||||
t391 - link integrity verification polling timer (in seconds) - user
|
||||
@@ -119,13 +119,14 @@ or
|
||||
|
||||
|
||||
|
||||
If you have a problem with N2 or C101 card, you can issue the "private"
|
||||
command to see port's packet descriptor rings (in kernel logs):
|
||||
If you have a problem with N2, C101 or PLX200SYN card, you can issue the
|
||||
"private" command to see port's packet descriptor rings (in kernel logs):
|
||||
|
||||
sethdlc hdlc0 private
|
||||
|
||||
The hardware driver has to be build with CONFIG_HDLC_DEBUG_RINGS.
|
||||
The hardware driver has to be build with #define DEBUG_RINGS.
|
||||
Attaching this info to bug reports would be helpful. Anyway, let me know
|
||||
if you have problems using this.
|
||||
|
||||
For patches and other info look at http://hq.pm.waw.pl/hdlc/
|
||||
For patches and other info look at:
|
||||
<http://www.kernel.org/pub/linux/utils/net/hdlc/>.
|
||||
|
||||
@@ -47,7 +47,6 @@ ni52 <------------------ Buggy ------------------>
|
||||
ni65 YES YES YES Software(#)
|
||||
seeq NO NO NO N/A
|
||||
sgiseek <------------------ Buggy ------------------>
|
||||
sk_g16 NO NO YES N/A
|
||||
smc-ultra YES YES YES Hardware
|
||||
sunlance YES YES YES Hardware
|
||||
tulip YES YES YES Hardware
|
||||
|
||||
@@ -284,9 +284,6 @@ ppp.c:
|
||||
seeq8005.c: *Not modularized*
|
||||
(Probes ports: 0x300, 0x320, 0x340, 0x360)
|
||||
|
||||
sk_g16.c: *Not modularized*
|
||||
(Probes ports: 0x100, 0x180, 0x208, 0x220m 0x288, 0x320, 0x328, 0x390)
|
||||
|
||||
skeleton.c: *Skeleton*
|
||||
|
||||
slhc.c:
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
|
||||
#include <linux/config.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/moduleparam.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/netdevice.h>
|
||||
@@ -91,16 +92,17 @@ KERN_INFO DRV_NAME ": 10/100 PCI Ethernet driver v" DRV_VERSION " (" DRV_RELDATE
|
||||
|
||||
MODULE_AUTHOR("Jeff Garzik <jgarzik@pobox.com>");
|
||||
MODULE_DESCRIPTION("RealTek RTL-8139C+ series 10/100 PCI Ethernet driver");
|
||||
MODULE_VERSION(DRV_VERSION);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
static int debug = -1;
|
||||
MODULE_PARM (debug, "i");
|
||||
module_param(debug, int, 0);
|
||||
MODULE_PARM_DESC (debug, "8139cp: bitmapped message enable number");
|
||||
|
||||
/* Maximum number of multicast addresses to filter (vs. Rx-all-multicast).
|
||||
The RTL chips use a 64 element hash table based on the Ethernet CRC. */
|
||||
static int multicast_filter_limit = 32;
|
||||
MODULE_PARM (multicast_filter_limit, "i");
|
||||
module_param(multicast_filter_limit, int, 0);
|
||||
MODULE_PARM_DESC (multicast_filter_limit, "8139cp: maximum number of filtered multicast addresses");
|
||||
|
||||
#define PFX DRV_NAME ": "
|
||||
@@ -186,6 +188,9 @@ enum {
|
||||
RingEnd = (1 << 30), /* End of descriptor ring */
|
||||
FirstFrag = (1 << 29), /* First segment of a packet */
|
||||
LastFrag = (1 << 28), /* Final segment of a packet */
|
||||
LargeSend = (1 << 27), /* TCP Large Send Offload (TSO) */
|
||||
MSSShift = 16, /* MSS value position */
|
||||
MSSMask = 0xfff, /* MSS value: 11 bits */
|
||||
TxError = (1 << 23), /* Tx error summary */
|
||||
RxError = (1 << 20), /* Rx error summary */
|
||||
IPCS = (1 << 18), /* Calculate IP checksum */
|
||||
@@ -312,7 +317,7 @@ struct cp_desc {
|
||||
struct ring_info {
|
||||
struct sk_buff *skb;
|
||||
dma_addr_t mapping;
|
||||
unsigned frag;
|
||||
u32 len;
|
||||
};
|
||||
|
||||
struct cp_dma_stats {
|
||||
@@ -394,6 +399,9 @@ struct cp_private {
|
||||
static void __cp_set_rx_mode (struct net_device *dev);
|
||||
static void cp_tx (struct cp_private *cp);
|
||||
static void cp_clean_rings (struct cp_private *cp);
|
||||
#ifdef CONFIG_NET_POLL_CONTROLLER
|
||||
static void cp_poll_controller(struct net_device *dev);
|
||||
#endif
|
||||
|
||||
static struct pci_device_id cp_pci_tbl[] = {
|
||||
{ PCI_VENDOR_ID_REALTEK, PCI_DEVICE_ID_REALTEK_8139,
|
||||
@@ -688,6 +696,19 @@ cp_interrupt (int irq, void *dev_instance, struct pt_regs *regs)
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NET_POLL_CONTROLLER
|
||||
/*
|
||||
* Polling receive - used by netconsole and other diagnostic tools
|
||||
* to allow network i/o with interrupts disabled.
|
||||
*/
|
||||
static void cp_poll_controller(struct net_device *dev)
|
||||
{
|
||||
disable_irq(dev->irq);
|
||||
cp_interrupt(dev->irq, dev, NULL);
|
||||
enable_irq(dev->irq);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void cp_tx (struct cp_private *cp)
|
||||
{
|
||||
unsigned tx_head = cp->tx_head;
|
||||
@@ -707,7 +728,7 @@ static void cp_tx (struct cp_private *cp)
|
||||
BUG();
|
||||
|
||||
pci_unmap_single(cp->pdev, cp->tx_skb[tx_tail].mapping,
|
||||
skb->len, PCI_DMA_TODEVICE);
|
||||
cp->tx_skb[tx_tail].len, PCI_DMA_TODEVICE);
|
||||
|
||||
if (status & LastFrag) {
|
||||
if (status & (TxError | TxFIFOUnder)) {
|
||||
@@ -749,10 +770,11 @@ static int cp_start_xmit (struct sk_buff *skb, struct net_device *dev)
|
||||
{
|
||||
struct cp_private *cp = netdev_priv(dev);
|
||||
unsigned entry;
|
||||
u32 eor;
|
||||
u32 eor, flags;
|
||||
#if CP_VLAN_TAG_USED
|
||||
u32 vlan_tag = 0;
|
||||
#endif
|
||||
int mss = 0;
|
||||
|
||||
spin_lock_irq(&cp->lock);
|
||||
|
||||
@@ -772,6 +794,9 @@ static int cp_start_xmit (struct sk_buff *skb, struct net_device *dev)
|
||||
|
||||
entry = cp->tx_head;
|
||||
eor = (entry == (CP_TX_RING_SIZE - 1)) ? RingEnd : 0;
|
||||
if (dev->features & NETIF_F_TSO)
|
||||
mss = skb_shinfo(skb)->tso_size;
|
||||
|
||||
if (skb_shinfo(skb)->nr_frags == 0) {
|
||||
struct cp_desc *txd = &cp->tx_ring[entry];
|
||||
u32 len;
|
||||
@@ -783,26 +808,26 @@ static int cp_start_xmit (struct sk_buff *skb, struct net_device *dev)
|
||||
txd->addr = cpu_to_le64(mapping);
|
||||
wmb();
|
||||
|
||||
if (skb->ip_summed == CHECKSUM_HW) {
|
||||
flags = eor | len | DescOwn | FirstFrag | LastFrag;
|
||||
|
||||
if (mss)
|
||||
flags |= LargeSend | ((mss & MSSMask) << MSSShift);
|
||||
else if (skb->ip_summed == CHECKSUM_HW) {
|
||||
const struct iphdr *ip = skb->nh.iph;
|
||||
if (ip->protocol == IPPROTO_TCP)
|
||||
txd->opts1 = cpu_to_le32(eor | len | DescOwn |
|
||||
FirstFrag | LastFrag |
|
||||
IPCS | TCPCS);
|
||||
flags |= IPCS | TCPCS;
|
||||
else if (ip->protocol == IPPROTO_UDP)
|
||||
txd->opts1 = cpu_to_le32(eor | len | DescOwn |
|
||||
FirstFrag | LastFrag |
|
||||
IPCS | UDPCS);
|
||||
flags |= IPCS | UDPCS;
|
||||
else
|
||||
BUG();
|
||||
} else
|
||||
txd->opts1 = cpu_to_le32(eor | len | DescOwn |
|
||||
FirstFrag | LastFrag);
|
||||
WARN_ON(1); /* we need a WARN() */
|
||||
}
|
||||
|
||||
txd->opts1 = cpu_to_le32(flags);
|
||||
wmb();
|
||||
|
||||
cp->tx_skb[entry].skb = skb;
|
||||
cp->tx_skb[entry].mapping = mapping;
|
||||
cp->tx_skb[entry].frag = 0;
|
||||
cp->tx_skb[entry].len = len;
|
||||
entry = NEXT_TX(entry);
|
||||
} else {
|
||||
struct cp_desc *txd;
|
||||
@@ -820,7 +845,7 @@ static int cp_start_xmit (struct sk_buff *skb, struct net_device *dev)
|
||||
first_len, PCI_DMA_TODEVICE);
|
||||
cp->tx_skb[entry].skb = skb;
|
||||
cp->tx_skb[entry].mapping = first_mapping;
|
||||
cp->tx_skb[entry].frag = 1;
|
||||
cp->tx_skb[entry].len = first_len;
|
||||
entry = NEXT_TX(entry);
|
||||
|
||||
for (frag = 0; frag < skb_shinfo(skb)->nr_frags; frag++) {
|
||||
@@ -836,16 +861,19 @@ static int cp_start_xmit (struct sk_buff *skb, struct net_device *dev)
|
||||
len, PCI_DMA_TODEVICE);
|
||||
eor = (entry == (CP_TX_RING_SIZE - 1)) ? RingEnd : 0;
|
||||
|
||||
if (skb->ip_summed == CHECKSUM_HW) {
|
||||
ctrl = eor | len | DescOwn | IPCS;
|
||||
ctrl = eor | len | DescOwn;
|
||||
|
||||
if (mss)
|
||||
ctrl |= LargeSend |
|
||||
((mss & MSSMask) << MSSShift);
|
||||
else if (skb->ip_summed == CHECKSUM_HW) {
|
||||
if (ip->protocol == IPPROTO_TCP)
|
||||
ctrl |= TCPCS;
|
||||
ctrl |= IPCS | TCPCS;
|
||||
else if (ip->protocol == IPPROTO_UDP)
|
||||
ctrl |= UDPCS;
|
||||
ctrl |= IPCS | UDPCS;
|
||||
else
|
||||
BUG();
|
||||
} else
|
||||
ctrl = eor | len | DescOwn;
|
||||
}
|
||||
|
||||
if (frag == skb_shinfo(skb)->nr_frags - 1)
|
||||
ctrl |= LastFrag;
|
||||
@@ -860,7 +888,7 @@ static int cp_start_xmit (struct sk_buff *skb, struct net_device *dev)
|
||||
|
||||
cp->tx_skb[entry].skb = skb;
|
||||
cp->tx_skb[entry].mapping = mapping;
|
||||
cp->tx_skb[entry].frag = frag + 2;
|
||||
cp->tx_skb[entry].len = len;
|
||||
entry = NEXT_TX(entry);
|
||||
}
|
||||
|
||||
@@ -1074,7 +1102,6 @@ static int cp_refill_rx (struct cp_private *cp)
|
||||
cp->rx_skb[i].mapping = pci_map_single(cp->pdev,
|
||||
skb->tail, cp->rx_buf_sz, PCI_DMA_FROMDEVICE);
|
||||
cp->rx_skb[i].skb = skb;
|
||||
cp->rx_skb[i].frag = 0;
|
||||
|
||||
cp->rx_ring[i].opts2 = 0;
|
||||
cp->rx_ring[i].addr = cpu_to_le64(cp->rx_skb[i].mapping);
|
||||
@@ -1126,9 +1153,6 @@ static void cp_clean_rings (struct cp_private *cp)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
memset(cp->rx_ring, 0, sizeof(struct cp_desc) * CP_RX_RING_SIZE);
|
||||
memset(cp->tx_ring, 0, sizeof(struct cp_desc) * CP_TX_RING_SIZE);
|
||||
|
||||
for (i = 0; i < CP_RX_RING_SIZE; i++) {
|
||||
if (cp->rx_skb[i].skb) {
|
||||
pci_unmap_single(cp->pdev, cp->rx_skb[i].mapping,
|
||||
@@ -1140,13 +1164,18 @@ static void cp_clean_rings (struct cp_private *cp)
|
||||
for (i = 0; i < CP_TX_RING_SIZE; i++) {
|
||||
if (cp->tx_skb[i].skb) {
|
||||
struct sk_buff *skb = cp->tx_skb[i].skb;
|
||||
|
||||
pci_unmap_single(cp->pdev, cp->tx_skb[i].mapping,
|
||||
skb->len, PCI_DMA_TODEVICE);
|
||||
dev_kfree_skb(skb);
|
||||
cp->tx_skb[i].len, PCI_DMA_TODEVICE);
|
||||
if (le32_to_cpu(cp->tx_ring[i].opts1) & LastFrag)
|
||||
dev_kfree_skb(skb);
|
||||
cp->net_stats.tx_dropped++;
|
||||
}
|
||||
}
|
||||
|
||||
memset(cp->rx_ring, 0, sizeof(struct cp_desc) * CP_RX_RING_SIZE);
|
||||
memset(cp->tx_ring, 0, sizeof(struct cp_desc) * CP_TX_RING_SIZE);
|
||||
|
||||
memset(&cp->rx_skb, 0, sizeof(struct ring_info) * CP_RX_RING_SIZE);
|
||||
memset(&cp->tx_skb, 0, sizeof(struct ring_info) * CP_TX_RING_SIZE);
|
||||
}
|
||||
@@ -1538,6 +1567,8 @@ static struct ethtool_ops cp_ethtool_ops = {
|
||||
.set_tx_csum = ethtool_op_set_tx_csum, /* local! */
|
||||
.get_sg = ethtool_op_get_sg,
|
||||
.set_sg = ethtool_op_set_sg,
|
||||
.get_tso = ethtool_op_get_tso,
|
||||
.set_tso = ethtool_op_set_tso,
|
||||
.get_regs = cp_get_regs,
|
||||
.get_wol = cp_get_wol,
|
||||
.set_wol = cp_set_wol,
|
||||
@@ -1749,6 +1780,9 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
dev->get_stats = cp_get_stats;
|
||||
dev->do_ioctl = cp_ioctl;
|
||||
dev->poll = cp_rx_poll;
|
||||
#ifdef CONFIG_NET_POLL_CONTROLLER
|
||||
dev->poll_controller = cp_poll_controller;
|
||||
#endif
|
||||
dev->weight = 16; /* arbitrary? from NAPI_HOWTO.txt. */
|
||||
#ifdef BROKEN
|
||||
dev->change_mtu = cp_change_mtu;
|
||||
@@ -1768,6 +1802,10 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
if (pci_using_dac)
|
||||
dev->features |= NETIF_F_HIGHDMA;
|
||||
|
||||
#if 0 /* disabled by default until verified */
|
||||
dev->features |= NETIF_F_TSO;
|
||||
#endif
|
||||
|
||||
dev->irq = pdev->irq;
|
||||
|
||||
rc = register_netdev(dev);
|
||||
|
||||
@@ -569,7 +569,7 @@ struct rtl_extra_stats {
|
||||
};
|
||||
|
||||
struct rtl8139_private {
|
||||
void *mmio_addr;
|
||||
void __iomem *mmio_addr;
|
||||
int drv_flags;
|
||||
struct pci_dev *pci_dev;
|
||||
u32 msg_enable;
|
||||
@@ -614,7 +614,7 @@ MODULE_PARM_DESC (multicast_filter_limit, "8139too maximum number of filtered mu
|
||||
MODULE_PARM_DESC (media, "8139too: Bits 4+9: force full duplex, bit 5: 100Mbps");
|
||||
MODULE_PARM_DESC (full_duplex, "8139too: Force full duplex for board(s) (1)");
|
||||
|
||||
static int read_eeprom (void *ioaddr, int location, int addr_len);
|
||||
static int read_eeprom (void __iomem *ioaddr, int location, int addr_len);
|
||||
static int rtl8139_open (struct net_device *dev);
|
||||
static int mdio_read (struct net_device *dev, int phy_id, int location);
|
||||
static void mdio_write (struct net_device *dev, int phy_id, int location,
|
||||
@@ -638,46 +638,20 @@ static void __set_rx_mode (struct net_device *dev);
|
||||
static void rtl8139_hw_start (struct net_device *dev);
|
||||
static struct ethtool_ops rtl8139_ethtool_ops;
|
||||
|
||||
#ifdef USE_IO_OPS
|
||||
|
||||
#define RTL_R8(reg) inb (((unsigned long)ioaddr) + (reg))
|
||||
#define RTL_R16(reg) inw (((unsigned long)ioaddr) + (reg))
|
||||
#define RTL_R32(reg) ((unsigned long) inl (((unsigned long)ioaddr) + (reg)))
|
||||
#define RTL_W8(reg, val8) outb ((val8), ((unsigned long)ioaddr) + (reg))
|
||||
#define RTL_W16(reg, val16) outw ((val16), ((unsigned long)ioaddr) + (reg))
|
||||
#define RTL_W32(reg, val32) outl ((val32), ((unsigned long)ioaddr) + (reg))
|
||||
#define RTL_W8_F RTL_W8
|
||||
#define RTL_W16_F RTL_W16
|
||||
#define RTL_W32_F RTL_W32
|
||||
#undef readb
|
||||
#undef readw
|
||||
#undef readl
|
||||
#undef writeb
|
||||
#undef writew
|
||||
#undef writel
|
||||
#define readb(addr) inb((unsigned long)(addr))
|
||||
#define readw(addr) inw((unsigned long)(addr))
|
||||
#define readl(addr) inl((unsigned long)(addr))
|
||||
#define writeb(val,addr) outb((val),(unsigned long)(addr))
|
||||
#define writew(val,addr) outw((val),(unsigned long)(addr))
|
||||
#define writel(val,addr) outl((val),(unsigned long)(addr))
|
||||
|
||||
#else
|
||||
|
||||
/* write MMIO register, with flush */
|
||||
/* Flush avoids rtl8139 bug w/ posted MMIO writes */
|
||||
#define RTL_W8_F(reg, val8) do { writeb ((val8), ioaddr + (reg)); readb (ioaddr + (reg)); } while (0)
|
||||
#define RTL_W16_F(reg, val16) do { writew ((val16), ioaddr + (reg)); readw (ioaddr + (reg)); } while (0)
|
||||
#define RTL_W32_F(reg, val32) do { writel ((val32), ioaddr + (reg)); readl (ioaddr + (reg)); } while (0)
|
||||
#define RTL_W8_F(reg, val8) do { iowrite8 ((val8), ioaddr + (reg)); ioread8 (ioaddr + (reg)); } while (0)
|
||||
#define RTL_W16_F(reg, val16) do { iowrite16 ((val16), ioaddr + (reg)); ioread16 (ioaddr + (reg)); } while (0)
|
||||
#define RTL_W32_F(reg, val32) do { iowrite32 ((val32), ioaddr + (reg)); ioread32 (ioaddr + (reg)); } while (0)
|
||||
|
||||
|
||||
#define MMIO_FLUSH_AUDIT_COMPLETE 1
|
||||
#if MMIO_FLUSH_AUDIT_COMPLETE
|
||||
|
||||
/* write MMIO register */
|
||||
#define RTL_W8(reg, val8) writeb ((val8), ioaddr + (reg))
|
||||
#define RTL_W16(reg, val16) writew ((val16), ioaddr + (reg))
|
||||
#define RTL_W32(reg, val32) writel ((val32), ioaddr + (reg))
|
||||
#define RTL_W8(reg, val8) iowrite8 ((val8), ioaddr + (reg))
|
||||
#define RTL_W16(reg, val16) iowrite16 ((val16), ioaddr + (reg))
|
||||
#define RTL_W32(reg, val32) iowrite32 ((val32), ioaddr + (reg))
|
||||
|
||||
#else
|
||||
|
||||
@@ -689,11 +663,9 @@ static struct ethtool_ops rtl8139_ethtool_ops;
|
||||
#endif /* MMIO_FLUSH_AUDIT_COMPLETE */
|
||||
|
||||
/* read MMIO register */
|
||||
#define RTL_R8(reg) readb (ioaddr + (reg))
|
||||
#define RTL_R16(reg) readw (ioaddr + (reg))
|
||||
#define RTL_R32(reg) ((unsigned long) readl (ioaddr + (reg)))
|
||||
|
||||
#endif /* USE_IO_OPS */
|
||||
#define RTL_R8(reg) ioread8 (ioaddr + (reg))
|
||||
#define RTL_R16(reg) ioread16 (ioaddr + (reg))
|
||||
#define RTL_R32(reg) ((unsigned long) ioread32 (ioaddr + (reg)))
|
||||
|
||||
|
||||
static const u16 rtl8139_intr_mask =
|
||||
@@ -740,10 +712,13 @@ static void __rtl8139_cleanup_dev (struct net_device *dev)
|
||||
assert (tp->pci_dev != NULL);
|
||||
pdev = tp->pci_dev;
|
||||
|
||||
#ifndef USE_IO_OPS
|
||||
#ifdef USE_IO_OPS
|
||||
if (tp->mmio_addr)
|
||||
iounmap (tp->mmio_addr);
|
||||
#endif /* !USE_IO_OPS */
|
||||
ioport_unmap (tp->mmio_addr);
|
||||
#else
|
||||
if (tp->mmio_addr)
|
||||
pci_iounmap (pdev, tp->mmio_addr);
|
||||
#endif /* USE_IO_OPS */
|
||||
|
||||
/* it's ok to call this even if we have no regions to free */
|
||||
pci_release_regions (pdev);
|
||||
@@ -753,7 +728,7 @@ static void __rtl8139_cleanup_dev (struct net_device *dev)
|
||||
}
|
||||
|
||||
|
||||
static void rtl8139_chip_reset (void *ioaddr)
|
||||
static void rtl8139_chip_reset (void __iomem *ioaddr)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -773,7 +748,7 @@ static void rtl8139_chip_reset (void *ioaddr)
|
||||
static int __devinit rtl8139_init_board (struct pci_dev *pdev,
|
||||
struct net_device **dev_out)
|
||||
{
|
||||
void *ioaddr;
|
||||
void __iomem *ioaddr;
|
||||
struct net_device *dev;
|
||||
struct rtl8139_private *tp;
|
||||
u8 tmp8;
|
||||
@@ -855,13 +830,18 @@ static int __devinit rtl8139_init_board (struct pci_dev *pdev,
|
||||
pci_set_master (pdev);
|
||||
|
||||
#ifdef USE_IO_OPS
|
||||
ioaddr = (void *) pio_start;
|
||||
ioaddr = ioport_map(pio_start, pio_len);
|
||||
if (!ioaddr) {
|
||||
printk (KERN_ERR PFX "%s: cannot map PIO, aborting\n", pci_name(pdev));
|
||||
rc = -EIO;
|
||||
goto err_out;
|
||||
}
|
||||
dev->base_addr = pio_start;
|
||||
tp->mmio_addr = ioaddr;
|
||||
tp->regs_len = pio_len;
|
||||
#else
|
||||
/* ioremap MMIO region */
|
||||
ioaddr = ioremap (mmio_start, mmio_len);
|
||||
ioaddr = pci_iomap(pdev, 1, 0);
|
||||
if (ioaddr == NULL) {
|
||||
printk (KERN_ERR PFX "%s: cannot remap MMIO, aborting\n", pci_name(pdev));
|
||||
rc = -EIO;
|
||||
@@ -947,7 +927,7 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev,
|
||||
struct net_device *dev = NULL;
|
||||
struct rtl8139_private *tp;
|
||||
int i, addr_len, option;
|
||||
void *ioaddr;
|
||||
void __iomem *ioaddr;
|
||||
static int board_idx = -1;
|
||||
u8 pci_rev;
|
||||
|
||||
@@ -1147,47 +1127,46 @@ static void __devexit rtl8139_remove_one (struct pci_dev *pdev)
|
||||
No extra delay is needed with 33Mhz PCI, but 66Mhz may change this.
|
||||
*/
|
||||
|
||||
#define eeprom_delay() readl(ee_addr)
|
||||
#define eeprom_delay() RTL_R32(Cfg9346)
|
||||
|
||||
/* The EEPROM commands include the alway-set leading bit. */
|
||||
#define EE_WRITE_CMD (5)
|
||||
#define EE_READ_CMD (6)
|
||||
#define EE_ERASE_CMD (7)
|
||||
|
||||
static int __devinit read_eeprom (void *ioaddr, int location, int addr_len)
|
||||
static int __devinit read_eeprom (void __iomem *ioaddr, int location, int addr_len)
|
||||
{
|
||||
int i;
|
||||
unsigned retval = 0;
|
||||
void *ee_addr = ioaddr + Cfg9346;
|
||||
int read_cmd = location | (EE_READ_CMD << addr_len);
|
||||
|
||||
writeb (EE_ENB & ~EE_CS, ee_addr);
|
||||
writeb (EE_ENB, ee_addr);
|
||||
RTL_W8 (Cfg9346, EE_ENB & ~EE_CS);
|
||||
RTL_W8 (Cfg9346, EE_ENB);
|
||||
eeprom_delay ();
|
||||
|
||||
/* Shift the read command bits out. */
|
||||
for (i = 4 + addr_len; i >= 0; i--) {
|
||||
int dataval = (read_cmd & (1 << i)) ? EE_DATA_WRITE : 0;
|
||||
writeb (EE_ENB | dataval, ee_addr);
|
||||
RTL_W8 (Cfg9346, EE_ENB | dataval);
|
||||
eeprom_delay ();
|
||||
writeb (EE_ENB | dataval | EE_SHIFT_CLK, ee_addr);
|
||||
RTL_W8 (Cfg9346, EE_ENB | dataval | EE_SHIFT_CLK);
|
||||
eeprom_delay ();
|
||||
}
|
||||
writeb (EE_ENB, ee_addr);
|
||||
RTL_W8 (Cfg9346, EE_ENB);
|
||||
eeprom_delay ();
|
||||
|
||||
for (i = 16; i > 0; i--) {
|
||||
writeb (EE_ENB | EE_SHIFT_CLK, ee_addr);
|
||||
RTL_W8 (Cfg9346, EE_ENB | EE_SHIFT_CLK);
|
||||
eeprom_delay ();
|
||||
retval =
|
||||
(retval << 1) | ((readb (ee_addr) & EE_DATA_READ) ? 1 :
|
||||
(retval << 1) | ((RTL_R8 (Cfg9346) & EE_DATA_READ) ? 1 :
|
||||
0);
|
||||
writeb (EE_ENB, ee_addr);
|
||||
RTL_W8 (Cfg9346, EE_ENB);
|
||||
eeprom_delay ();
|
||||
}
|
||||
|
||||
/* Terminate the EEPROM access. */
|
||||
writeb (~EE_CS, ee_addr);
|
||||
RTL_W8 (Cfg9346, ~EE_CS);
|
||||
eeprom_delay ();
|
||||
|
||||
return retval;
|
||||
@@ -1206,7 +1185,7 @@ static int __devinit read_eeprom (void *ioaddr, int location, int addr_len)
|
||||
#define MDIO_WRITE0 (MDIO_DIR)
|
||||
#define MDIO_WRITE1 (MDIO_DIR | MDIO_DATA_OUT)
|
||||
|
||||
#define mdio_delay(mdio_addr) readb(mdio_addr)
|
||||
#define mdio_delay() RTL_R8(Config4)
|
||||
|
||||
|
||||
static char mii_2_8139_map[8] = {
|
||||
@@ -1223,15 +1202,15 @@ static char mii_2_8139_map[8] = {
|
||||
|
||||
#ifdef CONFIG_8139TOO_8129
|
||||
/* Syncronize the MII management interface by shifting 32 one bits out. */
|
||||
static void mdio_sync (void *mdio_addr)
|
||||
static void mdio_sync (void __iomem *ioaddr)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 32; i >= 0; i--) {
|
||||
writeb (MDIO_WRITE1, mdio_addr);
|
||||
mdio_delay (mdio_addr);
|
||||
writeb (MDIO_WRITE1 | MDIO_CLK, mdio_addr);
|
||||
mdio_delay (mdio_addr);
|
||||
RTL_W8 (Config4, MDIO_WRITE1);
|
||||
mdio_delay ();
|
||||
RTL_W8 (Config4, MDIO_WRITE1 | MDIO_CLK);
|
||||
mdio_delay ();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1241,35 +1220,36 @@ static int mdio_read (struct net_device *dev, int phy_id, int location)
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
int retval = 0;
|
||||
#ifdef CONFIG_8139TOO_8129
|
||||
void *mdio_addr = tp->mmio_addr + Config4;
|
||||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
int mii_cmd = (0xf6 << 10) | (phy_id << 5) | location;
|
||||
int i;
|
||||
#endif
|
||||
|
||||
if (phy_id > 31) { /* Really a 8139. Use internal registers. */
|
||||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
return location < 8 && mii_2_8139_map[location] ?
|
||||
readw (tp->mmio_addr + mii_2_8139_map[location]) : 0;
|
||||
RTL_R16 (mii_2_8139_map[location]) : 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_8139TOO_8129
|
||||
mdio_sync (mdio_addr);
|
||||
mdio_sync (ioaddr);
|
||||
/* Shift the read command bits out. */
|
||||
for (i = 15; i >= 0; i--) {
|
||||
int dataval = (mii_cmd & (1 << i)) ? MDIO_DATA_OUT : 0;
|
||||
|
||||
writeb (MDIO_DIR | dataval, mdio_addr);
|
||||
mdio_delay (mdio_addr);
|
||||
writeb (MDIO_DIR | dataval | MDIO_CLK, mdio_addr);
|
||||
mdio_delay (mdio_addr);
|
||||
RTL_W8 (Config4, MDIO_DIR | dataval);
|
||||
mdio_delay ();
|
||||
RTL_W8 (Config4, MDIO_DIR | dataval | MDIO_CLK);
|
||||
mdio_delay ();
|
||||
}
|
||||
|
||||
/* Read the two transition, 16 data, and wire-idle bits. */
|
||||
for (i = 19; i > 0; i--) {
|
||||
writeb (0, mdio_addr);
|
||||
mdio_delay (mdio_addr);
|
||||
retval = (retval << 1) | ((readb (mdio_addr) & MDIO_DATA_IN) ? 1 : 0);
|
||||
writeb (MDIO_CLK, mdio_addr);
|
||||
mdio_delay (mdio_addr);
|
||||
RTL_W8 (Config4, 0);
|
||||
mdio_delay ();
|
||||
retval = (retval << 1) | ((RTL_R8 (Config4) & MDIO_DATA_IN) ? 1 : 0);
|
||||
RTL_W8 (Config4, MDIO_CLK);
|
||||
mdio_delay ();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1282,13 +1262,13 @@ static void mdio_write (struct net_device *dev, int phy_id, int location,
|
||||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
#ifdef CONFIG_8139TOO_8129
|
||||
void *mdio_addr = tp->mmio_addr + Config4;
|
||||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
int mii_cmd = (0x5002 << 16) | (phy_id << 23) | (location << 18) | value;
|
||||
int i;
|
||||
#endif
|
||||
|
||||
if (phy_id > 31) { /* Really a 8139. Use internal registers. */
|
||||
void *ioaddr = tp->mmio_addr;
|
||||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
if (location == 0) {
|
||||
RTL_W8 (Cfg9346, Cfg9346_Unlock);
|
||||
RTL_W16 (BasicModeCtrl, value);
|
||||
@@ -1299,23 +1279,23 @@ static void mdio_write (struct net_device *dev, int phy_id, int location,
|
||||
}
|
||||
|
||||
#ifdef CONFIG_8139TOO_8129
|
||||
mdio_sync (mdio_addr);
|
||||
mdio_sync (ioaddr);
|
||||
|
||||
/* Shift the command bits out. */
|
||||
for (i = 31; i >= 0; i--) {
|
||||
int dataval =
|
||||
(mii_cmd & (1 << i)) ? MDIO_WRITE1 : MDIO_WRITE0;
|
||||
writeb (dataval, mdio_addr);
|
||||
mdio_delay (mdio_addr);
|
||||
writeb (dataval | MDIO_CLK, mdio_addr);
|
||||
mdio_delay (mdio_addr);
|
||||
RTL_W8 (Config4, dataval);
|
||||
mdio_delay ();
|
||||
RTL_W8 (Config4, dataval | MDIO_CLK);
|
||||
mdio_delay ();
|
||||
}
|
||||
/* Clear out extra bits. */
|
||||
for (i = 2; i > 0; i--) {
|
||||
writeb (0, mdio_addr);
|
||||
mdio_delay (mdio_addr);
|
||||
writeb (MDIO_CLK, mdio_addr);
|
||||
mdio_delay (mdio_addr);
|
||||
RTL_W8 (Config4, 0);
|
||||
mdio_delay ();
|
||||
RTL_W8 (Config4, MDIO_CLK);
|
||||
mdio_delay ();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -1325,7 +1305,7 @@ static int rtl8139_open (struct net_device *dev)
|
||||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
int retval;
|
||||
void *ioaddr = tp->mmio_addr;
|
||||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
|
||||
retval = request_irq (dev->irq, rtl8139_interrupt, SA_SHIRQ, dev->name, dev);
|
||||
if (retval)
|
||||
@@ -1382,7 +1362,7 @@ static void rtl_check_media (struct net_device *dev, unsigned int init_media)
|
||||
static void rtl8139_hw_start (struct net_device *dev)
|
||||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
void *ioaddr = tp->mmio_addr;
|
||||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
u32 i;
|
||||
u8 tmp;
|
||||
|
||||
@@ -1484,7 +1464,7 @@ static void rtl8139_tune_twister (struct net_device *dev,
|
||||
struct rtl8139_private *tp)
|
||||
{
|
||||
int linkcase;
|
||||
void *ioaddr = tp->mmio_addr;
|
||||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
|
||||
/* This is a complicated state machine to configure the "twister" for
|
||||
impedance/echos based on the cable length.
|
||||
@@ -1568,7 +1548,7 @@ static void rtl8139_tune_twister (struct net_device *dev,
|
||||
|
||||
static inline void rtl8139_thread_iter (struct net_device *dev,
|
||||
struct rtl8139_private *tp,
|
||||
void *ioaddr)
|
||||
void __iomem *ioaddr)
|
||||
{
|
||||
int mii_lpa;
|
||||
|
||||
@@ -1676,7 +1656,7 @@ static inline void rtl8139_tx_clear (struct rtl8139_private *tp)
|
||||
static void rtl8139_tx_timeout (struct net_device *dev)
|
||||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
void *ioaddr = tp->mmio_addr;
|
||||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
int i;
|
||||
u8 tmp8;
|
||||
unsigned long flags;
|
||||
@@ -1721,7 +1701,7 @@ static void rtl8139_tx_timeout (struct net_device *dev)
|
||||
static int rtl8139_start_xmit (struct sk_buff *skb, struct net_device *dev)
|
||||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
void *ioaddr = tp->mmio_addr;
|
||||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
unsigned int entry;
|
||||
unsigned int len = skb->len;
|
||||
|
||||
@@ -1763,7 +1743,7 @@ static int rtl8139_start_xmit (struct sk_buff *skb, struct net_device *dev)
|
||||
|
||||
static void rtl8139_tx_interrupt (struct net_device *dev,
|
||||
struct rtl8139_private *tp,
|
||||
void *ioaddr)
|
||||
void __iomem *ioaddr)
|
||||
{
|
||||
unsigned long dirty_tx, tx_left;
|
||||
|
||||
@@ -1833,7 +1813,7 @@ static void rtl8139_tx_interrupt (struct net_device *dev,
|
||||
|
||||
/* TODO: clean this up! Rx reset need not be this intensive */
|
||||
static void rtl8139_rx_err (u32 rx_status, struct net_device *dev,
|
||||
struct rtl8139_private *tp, void *ioaddr)
|
||||
struct rtl8139_private *tp, void __iomem *ioaddr)
|
||||
{
|
||||
u8 tmp8;
|
||||
#ifdef CONFIG_8139_OLD_RX_RESET
|
||||
@@ -1930,7 +1910,7 @@ static __inline__ void wrap_copy(struct sk_buff *skb, const unsigned char *ring,
|
||||
|
||||
static void rtl8139_isr_ack(struct rtl8139_private *tp)
|
||||
{
|
||||
void *ioaddr = tp->mmio_addr;
|
||||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
u16 status;
|
||||
|
||||
status = RTL_R16 (IntrStatus) & RxAckBits;
|
||||
@@ -1949,7 +1929,7 @@ static void rtl8139_isr_ack(struct rtl8139_private *tp)
|
||||
static int rtl8139_rx(struct net_device *dev, struct rtl8139_private *tp,
|
||||
int budget)
|
||||
{
|
||||
void *ioaddr = tp->mmio_addr;
|
||||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
int received = 0;
|
||||
unsigned char *rx_ring = tp->rx_ring;
|
||||
unsigned int cur_rx = tp->cur_rx;
|
||||
@@ -2087,7 +2067,7 @@ out:
|
||||
|
||||
static void rtl8139_weird_interrupt (struct net_device *dev,
|
||||
struct rtl8139_private *tp,
|
||||
void *ioaddr,
|
||||
void __iomem *ioaddr,
|
||||
int status, int link_changed)
|
||||
{
|
||||
DPRINTK ("%s: Abnormal interrupt, status %8.8x.\n",
|
||||
@@ -2127,7 +2107,7 @@ static void rtl8139_weird_interrupt (struct net_device *dev,
|
||||
static int rtl8139_poll(struct net_device *dev, int *budget)
|
||||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
void *ioaddr = tp->mmio_addr;
|
||||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
int orig_budget = min(*budget, dev->quota);
|
||||
int done = 1;
|
||||
|
||||
@@ -2165,7 +2145,7 @@ static irqreturn_t rtl8139_interrupt (int irq, void *dev_instance,
|
||||
{
|
||||
struct net_device *dev = (struct net_device *) dev_instance;
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
void *ioaddr = tp->mmio_addr;
|
||||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
u16 status, ackstat;
|
||||
int link_changed = 0; /* avoid bogus "uninit" warning */
|
||||
int handled = 0;
|
||||
@@ -2241,7 +2221,7 @@ static void rtl8139_poll_controller(struct net_device *dev)
|
||||
static int rtl8139_close (struct net_device *dev)
|
||||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
void *ioaddr = tp->mmio_addr;
|
||||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
int ret = 0;
|
||||
unsigned long flags;
|
||||
|
||||
@@ -2304,7 +2284,7 @@ static int rtl8139_close (struct net_device *dev)
|
||||
static void rtl8139_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
|
||||
{
|
||||
struct rtl8139_private *np = netdev_priv(dev);
|
||||
void *ioaddr = np->mmio_addr;
|
||||
void __iomem *ioaddr = np->mmio_addr;
|
||||
|
||||
spin_lock_irq(&np->lock);
|
||||
if (rtl_chip_info[np->chipset].flags & HasLWake) {
|
||||
@@ -2338,7 +2318,7 @@ static void rtl8139_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
|
||||
static int rtl8139_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
|
||||
{
|
||||
struct rtl8139_private *np = netdev_priv(dev);
|
||||
void *ioaddr = np->mmio_addr;
|
||||
void __iomem *ioaddr = np->mmio_addr;
|
||||
u32 support;
|
||||
u8 cfg3, cfg5;
|
||||
|
||||
@@ -2506,7 +2486,7 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
||||
static struct net_device_stats *rtl8139_get_stats (struct net_device *dev)
|
||||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
void *ioaddr = tp->mmio_addr;
|
||||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
unsigned long flags;
|
||||
|
||||
if (netif_running(dev)) {
|
||||
@@ -2525,7 +2505,7 @@ static struct net_device_stats *rtl8139_get_stats (struct net_device *dev)
|
||||
static void __set_rx_mode (struct net_device *dev)
|
||||
{
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
void *ioaddr = tp->mmio_addr;
|
||||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
u32 mc_filter[2]; /* Multicast hash filter */
|
||||
int i, rx_mode;
|
||||
u32 tmp;
|
||||
@@ -2586,7 +2566,7 @@ static int rtl8139_suspend (struct pci_dev *pdev, pm_message_t state)
|
||||
{
|
||||
struct net_device *dev = pci_get_drvdata (pdev);
|
||||
struct rtl8139_private *tp = netdev_priv(dev);
|
||||
void *ioaddr = tp->mmio_addr;
|
||||
void __iomem *ioaddr = tp->mmio_addr;
|
||||
unsigned long flags;
|
||||
|
||||
pci_save_state (pdev);
|
||||
|
||||
@@ -824,6 +824,18 @@ config SMC9194
|
||||
<file:Documentation/networking/net-modules.txt>. The module
|
||||
will be called smc9194.
|
||||
|
||||
config DM9000
|
||||
tristate "DM9000 support"
|
||||
depends on ARM && NET_ETHERNET
|
||||
select CRC32
|
||||
select MII
|
||||
---help---
|
||||
Support for DM9000 chipset.
|
||||
|
||||
To compile this driver as a module, choose M here and read
|
||||
<file:Documentation/networking/net-modules.txt>. The module will be
|
||||
called dm9000.
|
||||
|
||||
config NET_VENDOR_RACAL
|
||||
bool "Racal-Interlan (Micom) NI cards"
|
||||
depends on NET_ETHERNET && ISA
|
||||
@@ -989,21 +1001,6 @@ config EEXPRESS_PRO
|
||||
<file:Documentation/networking/net-modules.txt>. The module
|
||||
will be called eepro.
|
||||
|
||||
config FMV18X
|
||||
tristate "FMV-181/182/183/184 support (OBSOLETE)"
|
||||
depends on NET_ISA && OBSOLETE
|
||||
---help---
|
||||
If you have a Fujitsu FMV-181/182/183/184 network (Ethernet) card,
|
||||
say Y and read the Ethernet-HOWTO, available from
|
||||
<http://www.tldp.org/docs.html#howto>.
|
||||
|
||||
If you use an FMV-183 or FMV-184 and it is not working, you may need
|
||||
to disable Plug & Play mode of the card.
|
||||
|
||||
To compile this driver as a module, choose M here and read
|
||||
<file:Documentation/networking/net-modules.txt>. The module
|
||||
will be called fmv18x.
|
||||
|
||||
config HPLAN_PLUS
|
||||
tristate "HP PCLAN+ (27247B and 27252A) support"
|
||||
depends on NET_ISA
|
||||
@@ -1092,14 +1089,6 @@ config SEEQ8005
|
||||
<file:Documentation/networking/net-modules.txt>. The module
|
||||
will be called seeq8005.
|
||||
|
||||
config SK_G16
|
||||
tristate "SK_G16 support (OBSOLETE)"
|
||||
depends on NET_ISA && OBSOLETE
|
||||
help
|
||||
If you have a network (Ethernet) card of this type, say Y and read
|
||||
the Ethernet-HOWTO, available from
|
||||
<http://www.tldp.org/docs.html#howto>.
|
||||
|
||||
config SKMC
|
||||
tristate "SKnet MCA support"
|
||||
depends on NET_ETHERNET && MCA && BROKEN
|
||||
@@ -1932,6 +1921,18 @@ config R8169_VLAN
|
||||
|
||||
If in doubt, say Y.
|
||||
|
||||
config SKGE
|
||||
tristate "New SysKonnect GigaEthernet support (EXPERIMENTAL)"
|
||||
depends on PCI && EXPERIMENTAL
|
||||
select CRC32
|
||||
---help---
|
||||
This driver support the Marvell Yukon or SysKonnect SK-98xx/SK-95xx
|
||||
and related Gigabit Ethernet adapters. It is a new smaller driver
|
||||
driver with better performance and more complete ethtool support.
|
||||
|
||||
It does not support the link failover and network management
|
||||
features that "portable" vendor supplied sk98lin driver does.
|
||||
|
||||
config SK98LIN
|
||||
tristate "Marvell Yukon Chipset / SysKonnect SK-98xx Support"
|
||||
depends on PCI
|
||||
|
||||
@@ -53,6 +53,7 @@ obj-$(CONFIG_FEALNX) += fealnx.o
|
||||
obj-$(CONFIG_TIGON3) += tg3.o
|
||||
obj-$(CONFIG_BNX2) += bnx2.o
|
||||
obj-$(CONFIG_TC35815) += tc35815.o
|
||||
obj-$(CONFIG_SKGE) += skge.o
|
||||
obj-$(CONFIG_SK98LIN) += sk98lin/
|
||||
obj-$(CONFIG_SKFP) += skfp/
|
||||
obj-$(CONFIG_VIA_RHINE) += via-rhine.o
|
||||
@@ -74,7 +75,6 @@ obj-$(CONFIG_MAC8390) += mac8390.o 8390.o
|
||||
obj-$(CONFIG_APNE) += apne.o 8390.o
|
||||
obj-$(CONFIG_PCMCIA_PCNET) += 8390.o
|
||||
obj-$(CONFIG_SHAPER) += shaper.o
|
||||
obj-$(CONFIG_SK_G16) += sk_g16.o
|
||||
obj-$(CONFIG_HP100) += hp100.o
|
||||
obj-$(CONFIG_SMC9194) += smc9194.o
|
||||
obj-$(CONFIG_FEC) += fec.o
|
||||
@@ -122,7 +122,6 @@ obj-$(CONFIG_DEFXX) += defxx.o
|
||||
obj-$(CONFIG_SGISEEQ) += sgiseeq.o
|
||||
obj-$(CONFIG_SGI_O2MACE_ETH) += meth.o
|
||||
obj-$(CONFIG_AT1700) += at1700.o
|
||||
obj-$(CONFIG_FMV18X) += fmv18x.o
|
||||
obj-$(CONFIG_EL1) += 3c501.o
|
||||
obj-$(CONFIG_EL16) += 3c507.o
|
||||
obj-$(CONFIG_ELMC) += 3c523.o
|
||||
@@ -180,6 +179,7 @@ obj-$(CONFIG_AMD8111_ETH) += amd8111e.o
|
||||
obj-$(CONFIG_IBMVETH) += ibmveth.o
|
||||
obj-$(CONFIG_S2IO) += s2io.o
|
||||
obj-$(CONFIG_SMC91X) += smc91x.o
|
||||
obj-$(CONFIG_DM9000) += dm9000.o
|
||||
obj-$(CONFIG_FEC_8XX) += fec_8xx/
|
||||
|
||||
obj-$(CONFIG_ARM) += arm/
|
||||
|
||||
@@ -210,9 +210,6 @@ static struct devprobe2 isa_probes[] __initdata = {
|
||||
#ifdef CONFIG_AT1700
|
||||
{at1700_probe, 0},
|
||||
#endif
|
||||
#ifdef CONFIG_FMV18X /* Fujitsu FMV-181/182 */
|
||||
{fmv18x_probe, 0},
|
||||
#endif
|
||||
#ifdef CONFIG_ETH16I
|
||||
{eth16i_probe, 0}, /* ICL EtherTeam 16i/32 */
|
||||
#endif
|
||||
@@ -243,9 +240,6 @@ static struct devprobe2 isa_probes[] __initdata = {
|
||||
#ifdef CONFIG_ELPLUS /* 3c505 */
|
||||
{elplus_probe, 0},
|
||||
#endif
|
||||
#ifdef CONFIG_SK_G16
|
||||
{SK_init, 0},
|
||||
#endif
|
||||
#ifdef CONFIG_NI5010
|
||||
{ni5010_probe, 0},
|
||||
#endif
|
||||
|
||||
@@ -68,6 +68,7 @@ struct etherh_priv {
|
||||
void __iomem *dma_base;
|
||||
unsigned int id;
|
||||
void __iomem *ctrl_port;
|
||||
void __iomem *base;
|
||||
unsigned char ctrl;
|
||||
u32 supported;
|
||||
};
|
||||
@@ -177,7 +178,7 @@ etherh_setif(struct net_device *dev)
|
||||
switch (etherh_priv(dev)->id) {
|
||||
case PROD_I3_ETHERLAN600:
|
||||
case PROD_I3_ETHERLAN600A:
|
||||
addr = (void *)dev->base_addr + EN0_RCNTHI;
|
||||
addr = etherh_priv(dev)->base + EN0_RCNTHI;
|
||||
|
||||
switch (dev->if_port) {
|
||||
case IF_PORT_10BASE2:
|
||||
@@ -218,7 +219,7 @@ etherh_getifstat(struct net_device *dev)
|
||||
switch (etherh_priv(dev)->id) {
|
||||
case PROD_I3_ETHERLAN600:
|
||||
case PROD_I3_ETHERLAN600A:
|
||||
addr = (void *)dev->base_addr + EN0_RCNTHI;
|
||||
addr = etherh_priv(dev)->base + EN0_RCNTHI;
|
||||
switch (dev->if_port) {
|
||||
case IF_PORT_10BASE2:
|
||||
stat = 1;
|
||||
@@ -281,7 +282,7 @@ static void
|
||||
etherh_reset(struct net_device *dev)
|
||||
{
|
||||
struct ei_device *ei_local = netdev_priv(dev);
|
||||
void __iomem *addr = (void *)dev->base_addr;
|
||||
void __iomem *addr = etherh_priv(dev)->base;
|
||||
|
||||
writeb(E8390_NODMA+E8390_PAGE0+E8390_STOP, addr);
|
||||
|
||||
@@ -327,7 +328,7 @@ etherh_block_output (struct net_device *dev, int count, const unsigned char *buf
|
||||
|
||||
ei_local->dmaing = 1;
|
||||
|
||||
addr = (void *)dev->base_addr;
|
||||
addr = etherh_priv(dev)->base;
|
||||
dma_base = etherh_priv(dev)->dma_base;
|
||||
|
||||
count = (count + 1) & ~1;
|
||||
@@ -387,7 +388,7 @@ etherh_block_input (struct net_device *dev, int count, struct sk_buff *skb, int
|
||||
|
||||
ei_local->dmaing = 1;
|
||||
|
||||
addr = (void *)dev->base_addr;
|
||||
addr = etherh_priv(dev)->base;
|
||||
dma_base = etherh_priv(dev)->dma_base;
|
||||
|
||||
buf = skb->data;
|
||||
@@ -427,7 +428,7 @@ etherh_get_header (struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_p
|
||||
|
||||
ei_local->dmaing = 1;
|
||||
|
||||
addr = (void *)dev->base_addr;
|
||||
addr = etherh_priv(dev)->base;
|
||||
dma_base = etherh_priv(dev)->dma_base;
|
||||
|
||||
writeb (E8390_NODMA | E8390_PAGE0 | E8390_START, addr + E8390_CMD);
|
||||
@@ -696,7 +697,8 @@ etherh_probe(struct expansion_card *ec, const struct ecard_id *id)
|
||||
eh->ctrl_port = eh->ioc_fast;
|
||||
}
|
||||
|
||||
dev->base_addr = (unsigned long)eh->memc + data->ns8390_offset;
|
||||
eh->base = eh->memc + data->ns8390_offset;
|
||||
dev->base_addr = (unsigned long)eh->base;
|
||||
eh->dma_base = eh->memc + data->dataport_offset;
|
||||
eh->ctrl_port += data->ctrlport_offset;
|
||||
|
||||
|
||||
@@ -1681,10 +1681,6 @@ static int au1000_init(struct net_device *dev)
|
||||
control |= MAC_FULL_DUPLEX;
|
||||
}
|
||||
|
||||
/* fix for startup without cable */
|
||||
if (!link)
|
||||
dev->flags &= ~IFF_RUNNING;
|
||||
|
||||
aup->mac->control = control;
|
||||
aup->mac->vlan1_tag = 0x8100; /* activate vlan support */
|
||||
au_sync();
|
||||
@@ -1709,16 +1705,14 @@ static void au1000_timer(unsigned long data)
|
||||
if_port = dev->if_port;
|
||||
if (aup->phy_ops->phy_status(dev, aup->phy_addr, &link, &speed) == 0) {
|
||||
if (link) {
|
||||
if (!(dev->flags & IFF_RUNNING)) {
|
||||
if (!netif_carrier_ok(dev)) {
|
||||
netif_carrier_on(dev);
|
||||
dev->flags |= IFF_RUNNING;
|
||||
printk(KERN_INFO "%s: link up\n", dev->name);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (dev->flags & IFF_RUNNING) {
|
||||
if (netif_carrier_ok(dev)) {
|
||||
netif_carrier_off(dev);
|
||||
dev->flags &= ~IFF_RUNNING;
|
||||
dev->if_port = 0;
|
||||
printk(KERN_INFO "%s: link down\n", dev->name);
|
||||
}
|
||||
|
||||
@@ -1412,7 +1412,6 @@ static int bmac_open(struct net_device *dev)
|
||||
bp->opened = 1;
|
||||
bmac_reset_and_enable(dev);
|
||||
enable_irq(dev->irq);
|
||||
dev->flags |= IFF_RUNNING;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1425,7 +1424,6 @@ static int bmac_close(struct net_device *dev)
|
||||
int i;
|
||||
|
||||
bp->sleeping = 1;
|
||||
dev->flags &= ~(IFF_UP | IFF_RUNNING);
|
||||
|
||||
/* disable rx and tx */
|
||||
config = bmread(dev, RXCFG);
|
||||
|
||||
1219
drivers/net/dm9000.c
Normal file
1219
drivers/net/dm9000.c
Normal file
File diff suppressed because it is too large
Load Diff
135
drivers/net/dm9000.h
Normal file
135
drivers/net/dm9000.h
Normal file
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
* dm9000 Ethernet
|
||||
*/
|
||||
|
||||
#ifndef _DM9000X_H_
|
||||
#define _DM9000X_H_
|
||||
|
||||
#define DM9000_ID 0x90000A46
|
||||
|
||||
/* although the registers are 16 bit, they are 32-bit aligned.
|
||||
*/
|
||||
|
||||
#define DM9000_NCR 0x00
|
||||
#define DM9000_NSR 0x01
|
||||
#define DM9000_TCR 0x02
|
||||
#define DM9000_TSR1 0x03
|
||||
#define DM9000_TSR2 0x04
|
||||
#define DM9000_RCR 0x05
|
||||
#define DM9000_RSR 0x06
|
||||
#define DM9000_ROCR 0x07
|
||||
#define DM9000_BPTR 0x08
|
||||
#define DM9000_FCTR 0x09
|
||||
#define DM9000_FCR 0x0A
|
||||
#define DM9000_EPCR 0x0B
|
||||
#define DM9000_EPAR 0x0C
|
||||
#define DM9000_EPDRL 0x0D
|
||||
#define DM9000_EPDRH 0x0E
|
||||
#define DM9000_WCR 0x0F
|
||||
|
||||
#define DM9000_PAR 0x10
|
||||
#define DM9000_MAR 0x16
|
||||
|
||||
#define DM9000_GPCR 0x1e
|
||||
#define DM9000_GPR 0x1f
|
||||
#define DM9000_TRPAL 0x22
|
||||
#define DM9000_TRPAH 0x23
|
||||
#define DM9000_RWPAL 0x24
|
||||
#define DM9000_RWPAH 0x25
|
||||
|
||||
#define DM9000_VIDL 0x28
|
||||
#define DM9000_VIDH 0x29
|
||||
#define DM9000_PIDL 0x2A
|
||||
#define DM9000_PIDH 0x2B
|
||||
|
||||
#define DM9000_CHIPR 0x2C
|
||||
#define DM9000_SMCR 0x2F
|
||||
|
||||
#define DM9000_MRCMDX 0xF0
|
||||
#define DM9000_MRCMD 0xF2
|
||||
#define DM9000_MRRL 0xF4
|
||||
#define DM9000_MRRH 0xF5
|
||||
#define DM9000_MWCMDX 0xF6
|
||||
#define DM9000_MWCMD 0xF8
|
||||
#define DM9000_MWRL 0xFA
|
||||
#define DM9000_MWRH 0xFB
|
||||
#define DM9000_TXPLL 0xFC
|
||||
#define DM9000_TXPLH 0xFD
|
||||
#define DM9000_ISR 0xFE
|
||||
#define DM9000_IMR 0xFF
|
||||
|
||||
#define NCR_EXT_PHY (1<<7)
|
||||
#define NCR_WAKEEN (1<<6)
|
||||
#define NCR_FCOL (1<<4)
|
||||
#define NCR_FDX (1<<3)
|
||||
#define NCR_LBK (3<<1)
|
||||
#define NCR_RST (1<<0)
|
||||
|
||||
#define NSR_SPEED (1<<7)
|
||||
#define NSR_LINKST (1<<6)
|
||||
#define NSR_WAKEST (1<<5)
|
||||
#define NSR_TX2END (1<<3)
|
||||
#define NSR_TX1END (1<<2)
|
||||
#define NSR_RXOV (1<<1)
|
||||
|
||||
#define TCR_TJDIS (1<<6)
|
||||
#define TCR_EXCECM (1<<5)
|
||||
#define TCR_PAD_DIS2 (1<<4)
|
||||
#define TCR_CRC_DIS2 (1<<3)
|
||||
#define TCR_PAD_DIS1 (1<<2)
|
||||
#define TCR_CRC_DIS1 (1<<1)
|
||||
#define TCR_TXREQ (1<<0)
|
||||
|
||||
#define TSR_TJTO (1<<7)
|
||||
#define TSR_LC (1<<6)
|
||||
#define TSR_NC (1<<5)
|
||||
#define TSR_LCOL (1<<4)
|
||||
#define TSR_COL (1<<3)
|
||||
#define TSR_EC (1<<2)
|
||||
|
||||
#define RCR_WTDIS (1<<6)
|
||||
#define RCR_DIS_LONG (1<<5)
|
||||
#define RCR_DIS_CRC (1<<4)
|
||||
#define RCR_ALL (1<<3)
|
||||
#define RCR_RUNT (1<<2)
|
||||
#define RCR_PRMSC (1<<1)
|
||||
#define RCR_RXEN (1<<0)
|
||||
|
||||
#define RSR_RF (1<<7)
|
||||
#define RSR_MF (1<<6)
|
||||
#define RSR_LCS (1<<5)
|
||||
#define RSR_RWTO (1<<4)
|
||||
#define RSR_PLE (1<<3)
|
||||
#define RSR_AE (1<<2)
|
||||
#define RSR_CE (1<<1)
|
||||
#define RSR_FOE (1<<0)
|
||||
|
||||
#define FCTR_HWOT(ot) (( ot & 0xf ) << 4 )
|
||||
#define FCTR_LWOT(ot) ( ot & 0xf )
|
||||
|
||||
#define IMR_PAR (1<<7)
|
||||
#define IMR_ROOM (1<<3)
|
||||
#define IMR_ROM (1<<2)
|
||||
#define IMR_PTM (1<<1)
|
||||
#define IMR_PRM (1<<0)
|
||||
|
||||
#define ISR_ROOS (1<<3)
|
||||
#define ISR_ROS (1<<2)
|
||||
#define ISR_PTS (1<<1)
|
||||
#define ISR_PRS (1<<0)
|
||||
#define ISR_CLR_STATUS (ISR_ROOS | ISR_ROS | ISR_PTS | ISR_PRS)
|
||||
|
||||
#define EPCR_REEP (1<<5)
|
||||
#define EPCR_WEP (1<<4)
|
||||
#define EPCR_EPOS (1<<3)
|
||||
#define EPCR_ERPRR (1<<2)
|
||||
#define EPCR_ERPRW (1<<1)
|
||||
#define EPCR_ERRE (1<<0)
|
||||
|
||||
#define GPCR_GEP_CNTL (1<<0)
|
||||
|
||||
#define DM9000_PKT_RDY 0x01 /* Packet ready to receive */
|
||||
#define DM9000_PKT_MAX 1536 /* Received packet max size */
|
||||
|
||||
#endif /* _DM9000X_H_ */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1537,20 +1537,20 @@ static void shmem_get_8390_hdr(struct net_device *dev,
|
||||
static void shmem_block_input(struct net_device *dev, int count,
|
||||
struct sk_buff *skb, int ring_offset)
|
||||
{
|
||||
void __iomem *xfer_start = ei_status.mem + (TX_PAGES<<8)
|
||||
+ ring_offset
|
||||
void __iomem *base = ei_status.mem;
|
||||
unsigned long offset = (TX_PAGES<<8) + ring_offset
|
||||
- (ei_status.rx_start_page << 8);
|
||||
char *buf = skb->data;
|
||||
|
||||
if (xfer_start + count > (void __iomem *)ei_status.rmem_end) {
|
||||
if (offset + count > ei_status.priv) {
|
||||
/* We must wrap the input move. */
|
||||
int semi_count = (void __iomem *)ei_status.rmem_end - xfer_start;
|
||||
copyin(buf, xfer_start, semi_count);
|
||||
int semi_count = ei_status.priv - offset;
|
||||
copyin(buf, base + offset, semi_count);
|
||||
buf += semi_count;
|
||||
xfer_start = ei_status.mem + (TX_PAGES<<8);
|
||||
offset = TX_PAGES<<8;
|
||||
count -= semi_count;
|
||||
}
|
||||
copyin(buf, xfer_start, count);
|
||||
copyin(buf, base + offset, count);
|
||||
}
|
||||
|
||||
/*====================================================================*/
|
||||
@@ -1611,8 +1611,9 @@ static int setup_shmem_window(dev_link_t *link, int start_pg,
|
||||
}
|
||||
|
||||
ei_status.mem = info->base + offset;
|
||||
ei_status.priv = req.Size;
|
||||
dev->mem_start = (u_long)ei_status.mem;
|
||||
dev->mem_end = ei_status.rmem_end = (u_long)info->base + req.Size;
|
||||
dev->mem_end = dev->mem_start + req.Size;
|
||||
|
||||
ei_status.tx_start_page = start_pg;
|
||||
ei_status.rx_start_page = start_pg + TX_PAGES;
|
||||
|
||||
@@ -1217,36 +1217,43 @@ ppp_push(struct ppp *ppp)
|
||||
*/
|
||||
static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb)
|
||||
{
|
||||
int nch, len, fragsize;
|
||||
int len, fragsize;
|
||||
int i, bits, hdrlen, mtu;
|
||||
int flen, fnb;
|
||||
int flen;
|
||||
int navail, nfree;
|
||||
int nbigger;
|
||||
unsigned char *p, *q;
|
||||
struct list_head *list;
|
||||
struct channel *pch;
|
||||
struct sk_buff *frag;
|
||||
struct ppp_channel *chan;
|
||||
|
||||
nch = 0;
|
||||
nfree = 0; /* # channels which have no packet already queued */
|
||||
navail = 0; /* total # of usable channels (not deregistered) */
|
||||
hdrlen = (ppp->flags & SC_MP_XSHORTSEQ)? MPHDRLEN_SSN: MPHDRLEN;
|
||||
i = 0;
|
||||
list = &ppp->channels;
|
||||
while ((list = list->next) != &ppp->channels) {
|
||||
pch = list_entry(list, struct channel, clist);
|
||||
nch += pch->avail = (skb_queue_len(&pch->file.xq) == 0);
|
||||
/*
|
||||
* If a channel hasn't had a fragment yet, it has to get
|
||||
* one before we send any fragments on later channels.
|
||||
* If it can't take a fragment now, don't give any
|
||||
* to subsequent channels.
|
||||
*/
|
||||
if (!pch->had_frag && !pch->avail) {
|
||||
while ((list = list->next) != &ppp->channels) {
|
||||
pch = list_entry(list, struct channel, clist);
|
||||
pch->avail = 0;
|
||||
navail += pch->avail = (pch->chan != NULL);
|
||||
if (pch->avail) {
|
||||
if (skb_queue_len(&pch->file.xq) == 0
|
||||
|| !pch->had_frag) {
|
||||
pch->avail = 2;
|
||||
++nfree;
|
||||
}
|
||||
break;
|
||||
if (!pch->had_frag && i < ppp->nxchan)
|
||||
ppp->nxchan = i;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
if (nch == 0)
|
||||
|
||||
/*
|
||||
* Don't start sending this packet unless at least half of
|
||||
* the channels are free. This gives much better TCP
|
||||
* performance if we have a lot of channels.
|
||||
*/
|
||||
if (nfree == 0 || nfree < navail / 2)
|
||||
return 0; /* can't take now, leave it in xmit_pending */
|
||||
|
||||
/* Do protocol field compression (XXX this should be optional) */
|
||||
@@ -1257,14 +1264,19 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb)
|
||||
--len;
|
||||
}
|
||||
|
||||
/* decide on fragment size */
|
||||
/*
|
||||
* Decide on fragment size.
|
||||
* We create a fragment for each free channel regardless of
|
||||
* how small they are (i.e. even 0 length) in order to minimize
|
||||
* the time that it will take to detect when a channel drops
|
||||
* a fragment.
|
||||
*/
|
||||
fragsize = len;
|
||||
if (nch > 1) {
|
||||
int maxch = ROUNDUP(len, MIN_FRAG_SIZE);
|
||||
if (nch > maxch)
|
||||
nch = maxch;
|
||||
fragsize = ROUNDUP(fragsize, nch);
|
||||
}
|
||||
if (nfree > 1)
|
||||
fragsize = ROUNDUP(fragsize, nfree);
|
||||
/* nbigger channels get fragsize bytes, the rest get fragsize-1,
|
||||
except if nbigger==0, then they all get fragsize. */
|
||||
nbigger = len % nfree;
|
||||
|
||||
/* skip to the channel after the one we last used
|
||||
and start at that one */
|
||||
@@ -1278,7 +1290,7 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb)
|
||||
|
||||
/* create a fragment for each channel */
|
||||
bits = B;
|
||||
do {
|
||||
while (nfree > 0 || len > 0) {
|
||||
list = list->next;
|
||||
if (list == &ppp->channels) {
|
||||
i = 0;
|
||||
@@ -1289,61 +1301,92 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb)
|
||||
if (!pch->avail)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Skip this channel if it has a fragment pending already and
|
||||
* we haven't given a fragment to all of the free channels.
|
||||
*/
|
||||
if (pch->avail == 1) {
|
||||
if (nfree > 0)
|
||||
continue;
|
||||
} else {
|
||||
--nfree;
|
||||
pch->avail = 1;
|
||||
}
|
||||
|
||||
/* check the channel's mtu and whether it is still attached. */
|
||||
spin_lock_bh(&pch->downl);
|
||||
if (pch->chan == 0 || (mtu = pch->chan->mtu) < hdrlen) {
|
||||
/* can't use this channel */
|
||||
if (pch->chan == NULL) {
|
||||
/* can't use this channel, it's being deregistered */
|
||||
spin_unlock_bh(&pch->downl);
|
||||
pch->avail = 0;
|
||||
if (--nch == 0)
|
||||
if (--navail == 0)
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* We have to create multiple fragments for this channel
|
||||
* if fragsize is greater than the channel's mtu.
|
||||
* Create a fragment for this channel of
|
||||
* min(max(mtu+2-hdrlen, 4), fragsize, len) bytes.
|
||||
* If mtu+2-hdrlen < 4, that is a ridiculously small
|
||||
* MTU, so we use mtu = 2 + hdrlen.
|
||||
*/
|
||||
if (fragsize > len)
|
||||
fragsize = len;
|
||||
for (flen = fragsize; flen > 0; flen -= fnb) {
|
||||
fnb = flen;
|
||||
if (fnb > mtu + 2 - hdrlen)
|
||||
fnb = mtu + 2 - hdrlen;
|
||||
if (fnb >= len)
|
||||
bits |= E;
|
||||
frag = alloc_skb(fnb + hdrlen, GFP_ATOMIC);
|
||||
if (frag == 0)
|
||||
goto noskb;
|
||||
q = skb_put(frag, fnb + hdrlen);
|
||||
/* make the MP header */
|
||||
q[0] = PPP_MP >> 8;
|
||||
q[1] = PPP_MP;
|
||||
if (ppp->flags & SC_MP_XSHORTSEQ) {
|
||||
q[2] = bits + ((ppp->nxseq >> 8) & 0xf);
|
||||
q[3] = ppp->nxseq;
|
||||
} else {
|
||||
q[2] = bits;
|
||||
q[3] = ppp->nxseq >> 16;
|
||||
q[4] = ppp->nxseq >> 8;
|
||||
q[5] = ppp->nxseq;
|
||||
}
|
||||
flen = fragsize;
|
||||
mtu = pch->chan->mtu + 2 - hdrlen;
|
||||
if (mtu < 4)
|
||||
mtu = 4;
|
||||
if (flen > mtu)
|
||||
flen = mtu;
|
||||
if (flen == len && nfree == 0)
|
||||
bits |= E;
|
||||
frag = alloc_skb(flen + hdrlen + (flen == 0), GFP_ATOMIC);
|
||||
if (frag == 0)
|
||||
goto noskb;
|
||||
q = skb_put(frag, flen + hdrlen);
|
||||
|
||||
/* copy the data in */
|
||||
memcpy(q + hdrlen, p, fnb);
|
||||
|
||||
/* try to send it down the channel */
|
||||
chan = pch->chan;
|
||||
if (!chan->ops->start_xmit(chan, frag))
|
||||
skb_queue_tail(&pch->file.xq, frag);
|
||||
pch->had_frag = 1;
|
||||
p += fnb;
|
||||
len -= fnb;
|
||||
++ppp->nxseq;
|
||||
bits = 0;
|
||||
/* make the MP header */
|
||||
q[0] = PPP_MP >> 8;
|
||||
q[1] = PPP_MP;
|
||||
if (ppp->flags & SC_MP_XSHORTSEQ) {
|
||||
q[2] = bits + ((ppp->nxseq >> 8) & 0xf);
|
||||
q[3] = ppp->nxseq;
|
||||
} else {
|
||||
q[2] = bits;
|
||||
q[3] = ppp->nxseq >> 16;
|
||||
q[4] = ppp->nxseq >> 8;
|
||||
q[5] = ppp->nxseq;
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy the data in.
|
||||
* Unfortunately there is a bug in older versions of
|
||||
* the Linux PPP multilink reconstruction code where it
|
||||
* drops 0-length fragments. Therefore we make sure the
|
||||
* fragment has at least one byte of data. Any bytes
|
||||
* we add in this situation will end up as padding on the
|
||||
* end of the reconstructed packet.
|
||||
*/
|
||||
if (flen == 0)
|
||||
*skb_put(frag, 1) = 0;
|
||||
else
|
||||
memcpy(q + hdrlen, p, flen);
|
||||
|
||||
/* try to send it down the channel */
|
||||
chan = pch->chan;
|
||||
if (skb_queue_len(&pch->file.xq)
|
||||
|| !chan->ops->start_xmit(chan, frag))
|
||||
skb_queue_tail(&pch->file.xq, frag);
|
||||
pch->had_frag = 1;
|
||||
p += flen;
|
||||
len -= flen;
|
||||
++ppp->nxseq;
|
||||
bits = 0;
|
||||
spin_unlock_bh(&pch->downl);
|
||||
} while (len > 0);
|
||||
|
||||
if (--nbigger == 0 && fragsize > 0)
|
||||
--fragsize;
|
||||
}
|
||||
ppp->nxchan = i;
|
||||
|
||||
return 1;
|
||||
@@ -1422,7 +1465,7 @@ ppp_input(struct ppp_channel *chan, struct sk_buff *skb)
|
||||
kfree_skb(skb);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
proto = PPP_PROTO(skb);
|
||||
read_lock_bh(&pch->upl);
|
||||
if (pch->ppp == 0 || proto >= 0xc000 || proto == PPP_CCPFRAG) {
|
||||
@@ -1691,7 +1734,7 @@ ppp_receive_mp_frame(struct ppp *ppp, struct sk_buff *skb, struct channel *pch)
|
||||
struct list_head *l;
|
||||
int mphdrlen = (ppp->flags & SC_MP_SHORTSEQ)? MPHDRLEN_SSN: MPHDRLEN;
|
||||
|
||||
if (!pskb_may_pull(skb, mphdrlen + 1) || ppp->mrru == 0)
|
||||
if (!pskb_may_pull(skb, mphdrlen) || ppp->mrru == 0)
|
||||
goto err; /* no good, throw it away */
|
||||
|
||||
/* Decode sequence number and begin/end bits */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4212,7 +4212,7 @@ SK_BOOL DualNet;
|
||||
Flags);
|
||||
|
||||
SkGeStopPort(pAC, IoC, FromPort, SK_STOP_ALL, SK_HARD_RST);
|
||||
pAC->dev[Param.Para32[0]]->flags &= ~IFF_RUNNING;
|
||||
netif_carrier_off(pAC->dev[Param.Para32[0]]);
|
||||
spin_unlock_irqrestore(
|
||||
&pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock,
|
||||
Flags);
|
||||
@@ -4355,7 +4355,7 @@ SK_BOOL DualNet;
|
||||
}
|
||||
|
||||
/* Inform the world that link protocol is up. */
|
||||
pAC->dev[Param.Para32[0]]->flags |= IFF_RUNNING;
|
||||
netif_carrier_on(pAC->dev[Param.Para32[0]]);
|
||||
|
||||
break;
|
||||
case SK_DRV_NET_DOWN: /* SK_U32 Reason */
|
||||
@@ -4368,7 +4368,7 @@ SK_BOOL DualNet;
|
||||
} else {
|
||||
DoPrintInterfaceChange = SK_TRUE;
|
||||
}
|
||||
pAC->dev[Param.Para32[1]]->flags &= ~IFF_RUNNING;
|
||||
netif_carrier_off(pAC->dev[Param.Para32[1]]);
|
||||
break;
|
||||
case SK_DRV_SWITCH_HARD: /* SK_U32 FromPortIdx SK_U32 ToPortIdx */
|
||||
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT,
|
||||
@@ -4961,7 +4961,6 @@ static int __devinit skge_probe_one(struct pci_dev *pdev,
|
||||
#ifdef CONFIG_NET_POLL_CONTROLLER
|
||||
dev->poll_controller = &SkGePollController;
|
||||
#endif
|
||||
dev->flags &= ~IFF_RUNNING;
|
||||
SET_NETDEV_DEV(dev, &pdev->dev);
|
||||
SET_ETHTOOL_OPS(dev, &SkGeEthtoolOps);
|
||||
|
||||
@@ -5035,7 +5034,6 @@ static int __devinit skge_probe_one(struct pci_dev *pdev,
|
||||
dev->set_mac_address = &SkGeSetMacAddr;
|
||||
dev->do_ioctl = &SkGeIoctl;
|
||||
dev->change_mtu = &SkGeChangeMtu;
|
||||
dev->flags &= ~IFF_RUNNING;
|
||||
SET_NETDEV_DEV(dev, &pdev->dev);
|
||||
SET_ETHTOOL_OPS(dev, &SkGeEthtoolOps);
|
||||
|
||||
|
||||
2066
drivers/net/sk_g16.c
2066
drivers/net/sk_g16.c
File diff suppressed because it is too large
Load Diff
@@ -1,165 +0,0 @@
|
||||
/*-
|
||||
*
|
||||
* This software may be used and distributed according to the terms
|
||||
* of the GNU General Public License, incorporated herein by reference.
|
||||
*
|
||||
* Module : sk_g16.h
|
||||
* Version : $Revision$
|
||||
*
|
||||
* Author : M.Hipp (mhipp@student.uni-tuebingen.de)
|
||||
* changes by : Patrick J.D. Weichmann
|
||||
*
|
||||
* Date Created : 94/05/25
|
||||
*
|
||||
* Description : In here are all necessary definitions of
|
||||
* the am7990 (LANCE) chip used for writing a
|
||||
* network device driver which uses this chip
|
||||
*
|
||||
* $Log$
|
||||
-*/
|
||||
|
||||
#ifndef SK_G16_H
|
||||
|
||||
#define SK_G16_H
|
||||
|
||||
|
||||
/*
|
||||
* Control and Status Register 0 (CSR0) bit definitions
|
||||
*
|
||||
* (R=Readable) (W=Writeable) (S=Set on write) (C-Clear on write)
|
||||
*
|
||||
*/
|
||||
|
||||
#define CSR0_ERR 0x8000 /* Error summary (R) */
|
||||
#define CSR0_BABL 0x4000 /* Babble transmitter timeout error (RC) */
|
||||
#define CSR0_CERR 0x2000 /* Collision Error (RC) */
|
||||
#define CSR0_MISS 0x1000 /* Missed packet (RC) */
|
||||
#define CSR0_MERR 0x0800 /* Memory Error (RC) */
|
||||
#define CSR0_RINT 0x0400 /* Receiver Interrupt (RC) */
|
||||
#define CSR0_TINT 0x0200 /* Transmit Interrupt (RC) */
|
||||
#define CSR0_IDON 0x0100 /* Initialization Done (RC) */
|
||||
#define CSR0_INTR 0x0080 /* Interrupt Flag (R) */
|
||||
#define CSR0_INEA 0x0040 /* Interrupt Enable (RW) */
|
||||
#define CSR0_RXON 0x0020 /* Receiver on (R) */
|
||||
#define CSR0_TXON 0x0010 /* Transmitter on (R) */
|
||||
#define CSR0_TDMD 0x0008 /* Transmit Demand (RS) */
|
||||
#define CSR0_STOP 0x0004 /* Stop (RS) */
|
||||
#define CSR0_STRT 0x0002 /* Start (RS) */
|
||||
#define CSR0_INIT 0x0001 /* Initialize (RS) */
|
||||
|
||||
#define CSR0_CLRALL 0x7f00 /* mask for all clearable bits */
|
||||
|
||||
/*
|
||||
* Control and Status Register 3 (CSR3) bit definitions
|
||||
*
|
||||
*/
|
||||
|
||||
#define CSR3_BSWAP 0x0004 /* Byte Swap (RW) */
|
||||
#define CSR3_ACON 0x0002 /* ALE Control (RW) */
|
||||
#define CSR3_BCON 0x0001 /* Byte Control (RW) */
|
||||
|
||||
/*
|
||||
* Initialization Block Mode operation Bit Definitions.
|
||||
*/
|
||||
|
||||
#define MODE_PROM 0x8000 /* Promiscuous Mode */
|
||||
#define MODE_INTL 0x0040 /* Internal Loopback */
|
||||
#define MODE_DRTY 0x0020 /* Disable Retry */
|
||||
#define MODE_COLL 0x0010 /* Force Collision */
|
||||
#define MODE_DTCR 0x0008 /* Disable Transmit CRC) */
|
||||
#define MODE_LOOP 0x0004 /* Loopback */
|
||||
#define MODE_DTX 0x0002 /* Disable the Transmitter */
|
||||
#define MODE_DRX 0x0001 /* Disable the Receiver */
|
||||
|
||||
#define MODE_NORMAL 0x0000 /* Normal operation mode */
|
||||
|
||||
/*
|
||||
* Receive message descriptor status bit definitions.
|
||||
*/
|
||||
|
||||
#define RX_OWN 0x80 /* Owner bit 0 = host, 1 = lance */
|
||||
#define RX_ERR 0x40 /* Error Summary */
|
||||
#define RX_FRAM 0x20 /* Framing Error */
|
||||
#define RX_OFLO 0x10 /* Overflow Error */
|
||||
#define RX_CRC 0x08 /* CRC Error */
|
||||
#define RX_BUFF 0x04 /* Buffer Error */
|
||||
#define RX_STP 0x02 /* Start of Packet */
|
||||
#define RX_ENP 0x01 /* End of Packet */
|
||||
|
||||
|
||||
/*
|
||||
* Transmit message descriptor status bit definitions.
|
||||
*/
|
||||
|
||||
#define TX_OWN 0x80 /* Owner bit 0 = host, 1 = lance */
|
||||
#define TX_ERR 0x40 /* Error Summary */
|
||||
#define TX_MORE 0x10 /* More the 1 retry needed to Xmit */
|
||||
#define TX_ONE 0x08 /* One retry needed to Xmit */
|
||||
#define TX_DEF 0x04 /* Deferred */
|
||||
#define TX_STP 0x02 /* Start of Packet */
|
||||
#define TX_ENP 0x01 /* End of Packet */
|
||||
|
||||
/*
|
||||
* Transmit status (2) (valid if TX_ERR == 1)
|
||||
*/
|
||||
|
||||
#define TX_BUFF 0x8000 /* Buffering error (no ENP) */
|
||||
#define TX_UFLO 0x4000 /* Underflow (late memory) */
|
||||
#define TX_LCOL 0x1000 /* Late collision */
|
||||
#define TX_LCAR 0x0400 /* Loss of Carrier */
|
||||
#define TX_RTRY 0x0200 /* Failed after 16 retransmissions */
|
||||
#define TX_TDR 0x003f /* Time-domain-reflectometer-value */
|
||||
|
||||
|
||||
/*
|
||||
* Structures used for Communication with the LANCE
|
||||
*/
|
||||
|
||||
/* LANCE Initialize Block */
|
||||
|
||||
struct init_block
|
||||
{
|
||||
unsigned short mode; /* Mode Register */
|
||||
unsigned char paddr[6]; /* Physical Address (MAC) */
|
||||
unsigned char laddr[8]; /* Logical Filter Address (not used) */
|
||||
unsigned int rdrp; /* Receive Descriptor Ring pointer */
|
||||
unsigned int tdrp; /* Transmit Descriptor Ring pointer */
|
||||
};
|
||||
|
||||
|
||||
/* Receive Message Descriptor Entry */
|
||||
|
||||
struct rmd
|
||||
{
|
||||
union
|
||||
{
|
||||
unsigned long buffer; /* Address of buffer */
|
||||
struct
|
||||
{
|
||||
unsigned char unused[3];
|
||||
unsigned volatile char status; /* Status Bits */
|
||||
} s;
|
||||
} u;
|
||||
volatile short blen; /* Buffer Length (two's complement) */
|
||||
unsigned short mlen; /* Message Byte Count */
|
||||
};
|
||||
|
||||
|
||||
/* Transmit Message Descriptor Entry */
|
||||
|
||||
struct tmd
|
||||
{
|
||||
union
|
||||
{
|
||||
unsigned long buffer; /* Address of buffer */
|
||||
struct
|
||||
{
|
||||
unsigned char unused[3];
|
||||
unsigned volatile char status; /* Status Bits */
|
||||
} s;
|
||||
} u;
|
||||
unsigned short blen; /* Buffer Length (two's complement) */
|
||||
unsigned volatile short status2; /* Error Status Bits */
|
||||
};
|
||||
|
||||
#endif /* End of SK_G16_H */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user