Commit 2d8ead33 authored by Linus Torvalds's avatar Linus Torvalds

Import 1.1.50

parent 83879d61
VERSION = 1
PATCHLEVEL = 1
SUBLEVEL = 49
SUBLEVEL = 50
ARCH = i386
......
......@@ -25,7 +25,6 @@ bool 'Assume subnets are local' CONFIG_INET_SNARL y
bool 'Disable NAGLE algorithm (normally enabled)' CONFIG_TCP_NAGLE_OFF n
fi
bool 'The IPX protocol' CONFIG_IPX n
bool 'RPC connections to old BSD systems' CONFIG_I_AM_A_BROKEN_BSD_WEENIE n
#bool 'Amateur Radio AX.25 Level 2' CONFIG_AX25 n
fi
......
......@@ -232,7 +232,7 @@ static void make_request(int major,int rw, struct buffer_head * bh)
|| major == SCSI_CDROM_MAJOR)
&& (req = blk_dev[major].current_request))
{
if (major == HD_MAJOR)
if (major == HD_MAJOR || major == FLOPPY_MAJOR)
req = req->next;
while (req) {
if (req->dev == bh->b_dev &&
......
......@@ -69,6 +69,7 @@ static XD_SIGNATURE xd_sigs[] = {
{ 0x0008,"06/24/88(C) Copyright 1988 Western Digital Corp.",xd_wd_init_controller,xd_wd_init_drive," Western Digital WDXT-GEN2" }, /* Dan Newcombe, newcombe@aa.csc.peachnet.edu */
{ 0x0015,"SEAGATE ST11 BIOS REVISION",xd_seagate_init_controller,xd_seagate_init_drive," Seagate ST11M/R" }, /* Salvador Abreu, spa@fct.unl.pt */
{ 0x0010,"ST11R BIOS",xd_seagate_init_controller,xd_seagate_init_drive," Seagate ST11M/R" }, /* Risto Kankkunen, risto.kankkunen@cs.helsinki.fi */
{ 0x0010,"ST11 BIOS V1.7",xd_seagate_init_controller,xd_seagate_init_drive," Seagate ST11R" }, /* Alan Hourihane, alanh@fairlite.demon.co.uk */
{ 0x1000,"(c)Copyright 1987 SMS",xd_omti_init_controller,xd_omti_init_drive,"n OMTI 5520" }, /* Dirk Melchers, dirk@merlin.nbg.sub.org */
};
static u_char *xd_bases[] =
......
......@@ -237,7 +237,9 @@ el_open(struct device *dev)
static int
el_start_xmit(struct sk_buff *skb, struct device *dev)
{
unsigned long flags;
save_flags(flags);
if (dev->tbusy) {
if (jiffies - dev->trans_start < 20) {
if (el_debug > 2)
......@@ -251,12 +253,14 @@ el_start_xmit(struct sk_buff *skb, struct device *dev)
#ifdef oldway
el_reset(dev);
#else
cli();
outb(TX_NORM, TX_CMD);
outb(RX_NORM, RX_CMD);
outb(AX_OFF, AX_CMD); /* Just trigger a false interrupt. */
#endif
outb(AX_RX, AX_CMD); /* Aux control, irq and receive enabled */
dev->tbusy = 0;
restore_flags(flags);
dev->trans_start = jiffies;
}
......@@ -269,9 +273,12 @@ el_start_xmit(struct sk_buff *skb, struct device *dev)
return 0;
/* Avoid timer-based retransmission conflicts. */
cli();
if (set_bit(0, (void*)&dev->tbusy) != 0)
{
printk("%s: Transmitter access conflict.\n", dev->name);
else {
restore_flags(flags);
} else {
int gp_start = 0x800 - (ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN);
unsigned char *buf = skb->data;
......@@ -283,6 +290,7 @@ el_start_xmit(struct sk_buff *skb, struct device *dev)
inb(TX_STATUS);
outb(0x00, RX_BUF_CLR); /* Set rx packet area to 0. */
outw(gp_start, GP_LOW);
restore_flags(flags);
outsb(DATAPORT,buf,skb->len);
outw(gp_start, GP_LOW);
outb(AX_XMIT, AX_CMD); /* Trigger xmit. */
......
/* lance.c: An AMD LANCE ethernet driver for linux. */
/*
Written 1993 by Donald Becker.
Written 1993-94 by Donald Becker.
Copyright 1993 United States Government as represented by the
Director, National Security Agency. This software may be used and
distributed according to the terms of the GNU Public License,
incorporated herein by reference.
Director, National Security Agency.
This software may be used and distributed according to the terms
of the GNU Public License, incorporated herein by reference.
This driver is for the Allied Telesis AT1500 and HP J2405A, and should work
with most other LANCE-based bus-master (NE2100 clone) ethercards.
The author may be reached as becker@super.org or
C/O Supercomputing Research Ctr., 17100 Science Dr., Bowie MD 20715
The author may be reached as becker@CESDIS.gsfc.nasa.gov, or C/O
Center of Excellence in Space Data and Information Sciences
Code 930.5, Goddard Space Flight Center, Greenbelt MD 20771
*/
static char *version = "lance.c:v0.14g 12/21/93 becker@super.org\n";
static char *version = "lance.c:v1.01 8/31/94 becker@cesdis.gsfc.nasa.gov\n";
#include <linux/config.h>
#include <linux/kernel.h>
......@@ -33,13 +34,15 @@ static char *version = "lance.c:v0.14g 12/21/93 becker@super.org\n";
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#ifndef HAVE_PORTRESERVE
#define check_region(addr, size) 0
#define snarf_region(addr, size) do ; while(0)
#endif
struct device *init_etherdev(struct device *dev, int sizeof_private,
unsigned long *mem_startp);
static unsigned int lance_portlist[] = {0x300, 0x320, 0x340, 0x360, 0};
unsigned long lance_probe1(short ioaddr, unsigned long mem_start);
#ifdef HAVE_DEVLIST
struct netdev_entry lance_drv =
{"lance", lance_probe1, LANCE_TOTAL_SIZE, lance_portlist};
#endif
#ifdef LANCE_DEBUG
int lance_debug = LANCE_DEBUG;
......@@ -47,10 +50,6 @@ int lance_debug = LANCE_DEBUG;
int lance_debug = 1;
#endif
#ifndef LANCE_DMA
#define LANCE_DMA 5
#endif
/*
Theory of Operation
......@@ -60,8 +59,9 @@ This device driver is designed for the AMD 79C960, the "PCnet-ISA
single-chip ethernet controller for ISA". This chip is used in a wide
variety of boards from vendors such as Allied Telesis, HP, Kingston,
and Boca. This driver is also intended to work with older AMD 7990
designs, such as the NE1500 and NE2100. For convenience, I use the name
LANCE to refer to either AMD chip.
designs, such as the NE1500 and NE2100, and newer 79C961. For convenience,
I use the name LANCE to refer to all of the AMD chips, even though it properly
refers only to the original 7990.
II. Board-specific settings
......@@ -69,15 +69,18 @@ The driver is designed to work the boards that use the faster
bus-master mode, rather than in shared memory mode. (Only older designs
have on-board buffer memory needed to support the slower shared memory mode.)
Most boards have jumpered settings for the I/O base, IRQ line, and DMA channel.
This driver probes the likely base addresses, {0x300, 0x320, 0x340, 0x360}.
Most ISA boards have jumpered settings for the I/O base, IRQ line, and DMA
channel. This driver probes the likely base addresses:
{0x300, 0x320, 0x340, 0x360}.
After the board is found it generates an DMA-timeout interrupt and uses
autoIRQ to find the IRQ line. The DMA channel defaults to LANCE_DMA, or it
can be set with the low bits of the otherwise-unused dev->mem_start value.
autoIRQ to find the IRQ line. The DMA channel can be set with the low bits
of the otherwise-unused dev->mem_start value (aka PARAM1). If unset it is
probed for by enabling each free DMA channel in turn and checking if
initialization succeeds.
The HP-J2405A board is an exception: with this board it's easy to read the
EEPROM-set values for the base, IRQ, and DMA. Of course you must already
_know_ the base address, but that entry is for changing the EEPROM.
EEPROM-set values for the base, IRQ, and DMA. (Of course you must already
_know_ the base address -- that field is for writing the EEPROM.)
III. Driver operation
......@@ -106,7 +109,7 @@ the buffers are only used when needed as low-memory bounce buffers.
IIIB. 16M memory limitations.
For the ISA bus master mode all structures used directly by the LANCE,
the initialization block, Rx and Tx rings, and data buffers, must be
accessible from the ISA bus, i.e. in the lower 16M of real memory.
accessable from the ISA bus, i.e. in the lower 16M of real memory.
This is a problem for current Linux kernels on >16M machines. The network
devices are initialized after memory initialization, and the kernel doles out
memory from the top of memory downward. The current solution is to have a
......@@ -162,13 +165,13 @@ tx_full and tbusy flags.
/* The LANCE Rx and Tx ring descriptors. */
struct lance_rx_head {
int base;
short buf_length; /* This length is 2's complement (negative)! */
short buf_length; /* This length is 2s complement (negative)! */
short msg_length; /* This length is "normal". */
};
struct lance_tx_head {
int base;
short length; /* Length is 2's complement (negative)! */
short length; /* Length is 2s complement (negative)! */
short misc;
};
......@@ -184,10 +187,12 @@ struct lance_init_block {
struct lance_private {
char devname[8];
/* These must aligned on 8-byte boundaries. */
/* The Tx and Rx ring entries must aligned on 8-byte boundaries. */
struct lance_rx_head rx_ring[RX_RING_SIZE];
struct lance_tx_head tx_ring[TX_RING_SIZE];
struct lance_init_block init_block;
/* The saved address of a sent-in-place packet/buffer, for skfree(). */
struct sk_buff* tx_skbuff[TX_RING_SIZE];
long rx_buffs; /* Address of Rx and Tx buffers. */
/* Tx low-memory "bounce buffer" address. */
char (*tx_bounce_buffs)[PKT_BUF_SZ];
......@@ -195,12 +200,28 @@ struct lance_private {
int dirty_rx, dirty_tx; /* The ring entries to be free()ed. */
int dma;
struct enet_statistics stats;
char old_lance;
char chip_version; /* See lance_chip_type. */
char tx_full;
char lock;
int pad0, pad1; /* Used for alignment */
int pad0, pad1; /* Used for 8-byte alignment */
};
unsigned long lance_probe1(short ioaddr, unsigned long mem_start);
/* A mapping from the chip ID number to the part number and features. */
static struct lance_chip_type {
int id_number;
char *name;
int flags;
} chip_table[] = {
{0x0000, "LANCE 7990", 0}, /* Ancient lance chip. */
{0x0003, "PCnet/ISA 79C960", 0}, /* 79C960 PCnet/ISA. */
{0x2260, "PCnet/ISA+ 79C961", 0}, /* 79C961 PCnet/ISA+ for Plug-n-Play. */
{0x2420, "PCnet/PCI 79C970", 0}, /* 79C970 or 79C974 PCnet-SCSI for PCI */
{0x2430, "PCnet/VLB 79C965", 0}, /* 79C965 PCnet for VL bus. */
{0x0, "PCnet (unknown)", 0},
};
enum {OLD_LANCE = 0, PCNET_ISA=1, PCNET_ISAP=2, PCNET_PCI=3, PCNET_VLB=4, LANCE_UNKNOWN=5};
static int lance_open(struct device *dev);
static void lance_init_ring(struct device *dev);
static int lance_start_xmit(struct sk_buff *skb, struct device *dev);
......@@ -214,11 +235,15 @@ static void set_multicast_list(struct device *dev, int num_addrs, void *addrs);
/* This lance probe is unlike the other board probes in 1.0.*. The LANCE may
have to allocate a contiguous low-memory region for bounce buffers.
This requirement is satified by having the lance initialization occur before the
memory management system is started, and thus well before the other probes. */
unsigned long lance_init(unsigned long mem_start, unsigned long mem_end)
{
int *port, ports[] = {0x300, 0x320, 0x340, 0x360, 0};
int *port;
for (port = &ports[0]; *port; port++) {
for (port = lance_portlist; *port; port++) {
int ioaddr = *port;
if ( check_region(ioaddr, LANCE_TOTAL_SIZE) == 0
......@@ -235,9 +260,26 @@ unsigned long lance_probe1(short ioaddr, unsigned long mem_start)
{
struct device *dev;
struct lance_private *lp;
int hpJ2405A = 0;
int i, reset_val;
int i, reset_val, lance_version;
/* Flags for specific chips or boards. */
unsigned char hpJ2405A = 0; /* HP ISA adaptor */
int hp_builtin = 0; /* HP on-board ethernet. */
static int did_version = 0; /* Already printed version info. */
/* First we look for special cases.
Check for HP's on-board ethernet by looking for 'HP' in the BIOS.
This method provided by Laurent Julliard, Laurent_Julliard@grenoble.hp.com.
*/
if ( *((unsigned short *) 0x000f0102) == 0x5048) {
short ioaddr_table[] = { 0x300, 0x320, 0x340, 0x360};
/* There are two HP versions, check the BIOS for the configuration port. */
int hp_port = ( *((unsigned char *) 0x000f00f1) & 1) ? 0x499 : 0x99;
/* We can have boards other than the built-in! Verify this is on-board. */
if ((inb(hp_port) & 0xc0) == 0x80
&& ioaddr_table[inb(hp_port) & 3] == ioaddr)
hp_builtin = hp_port;
}
/* We might misrecognize the HP Vectra on-board here, but we check below. */
hpJ2405A = (inb(ioaddr) == 0x08 && inb(ioaddr+1) == 0x00
&& inb(ioaddr+2) == 0x09);
......@@ -253,11 +295,30 @@ unsigned long lance_probe1(short ioaddr, unsigned long mem_start)
if (inw(ioaddr+LANCE_DATA) != 0x0004)
return mem_start;
/* Get the version of the chip. */
outw(88, ioaddr+LANCE_ADDR);
if (inw(ioaddr+LANCE_ADDR) != 88) {
lance_version = 0;
} else { /* Good, it's a newer chip. */
int chip_version = inw(ioaddr+LANCE_DATA);
outw(89, ioaddr+LANCE_ADDR);
chip_version |= inw(ioaddr+LANCE_DATA) << 16;
if (lance_debug > 2)
printk(" LANCE chip version is %#x.\n", chip_version);
if ((chip_version & 0xfff) != 0x003)
return mem_start;
chip_version = (chip_version >> 12) & 0xffff;
for (lance_version = 1; chip_table[lance_version].id_number; lance_version++) {
if (chip_table[lance_version].id_number == chip_version)
break;
}
}
dev = init_etherdev(0, sizeof(struct lance_private)
+ PKT_BUF_SZ*(RX_RING_SIZE + TX_RING_SIZE),
&mem_start);
printk("%s: LANCE at %#3x,", dev->name, ioaddr);
printk("%s: %s at %#3x,", dev->name, chip_table[lance_version].name, ioaddr);
/* There is a 16 byte station address PROM at the base address.
The first six bytes are the station address. */
......@@ -282,13 +343,7 @@ unsigned long lance_probe1(short ioaddr, unsigned long mem_start)
}
#endif
outw(88, ioaddr+LANCE_ADDR);
lp->old_lance = (inw(ioaddr+LANCE_DATA) != 0x3003);
#if defined(notdef)
printk(lp->old_lance ? " original LANCE (%04x)" : " PCnet-ISA LANCE (%04x)",
inw(ioaddr+LANCE_DATA));
#endif
lp->chip_version = lance_version;
lp->init_block.mode = 0x0003; /* Disable Rx and Tx. */
for (i = 0; i < 6; i++)
......@@ -299,29 +354,46 @@ unsigned long lance_probe1(short ioaddr, unsigned long mem_start)
lp->init_block.tx_ring = (int)lp->tx_ring | TX_RING_LEN_BITS;
outw(0x0001, ioaddr+LANCE_ADDR);
inw(ioaddr+LANCE_ADDR);
outw((short) (int) &lp->init_block, ioaddr+LANCE_DATA);
outw(0x0002, ioaddr+LANCE_ADDR);
inw(ioaddr+LANCE_ADDR);
outw(((int)&lp->init_block) >> 16, ioaddr+LANCE_DATA);
outw(0x0000, ioaddr+LANCE_ADDR);
if (hpJ2405A) {
inw(ioaddr+LANCE_ADDR);
if (hp_builtin) {
char dma_tbl[4] = {3, 5, 6, 0};
char irq_tbl[8] = {3, 4, 5, 9};
unsigned char port_val = inb(hp_builtin);
dev->dma = dma_tbl[(port_val >> 4) & 3];
dev->irq = irq_tbl[(port_val >> 2) & 3];
printk(" HP Vectra IRQ %d DMA %d.\n", dev->irq, dev->dma);
} else if (hpJ2405A) {
char dma_tbl[4] = {3, 5, 6, 7};
char irq_tbl[8] = {3, 4, 5, 9, 10, 11, 12, 15};
short reset_val = inw(ioaddr+LANCE_RESET);
dev->dma = dma_tbl[(reset_val >> 2) & 3];
dev->irq = irq_tbl[(reset_val >> 4) & 7];
printk(" HP J2405A IRQ %d DMA %d.\n", dev->irq, dev->dma);
} else if (lance_version == PCNET_ISAP) { /* The plug-n-play version. */
short bus_info;
outw(8, ioaddr+LANCE_ADDR);
bus_info = inw(ioaddr+LANCE_BUS_IF);
dev->dma = bus_info & 0x07;
dev->irq = (bus_info >> 4) & 0x0F;
} else {
/* The DMA channel may be passed in on this parameter. */
/* The DMA channel may be passed in PARAM1. */
if (dev->mem_start & 0x07)
dev->dma = dev->mem_start & 0x07;
else if (dev->dma == 0)
dev->dma = LANCE_DMA;
/* To auto-IRQ we enable the initialization-done and DMA err,
interrupts. For now we will always get a DMA error. */
if (dev->irq < 2) {
}
if (dev->irq >= 2)
printk(" assigned IRQ %d", dev->irq);
else {
/* To auto-IRQ we enable the initialization-done and DMA error
interrupts. For ISA boards we get a DMA error, but VLB and PCI
boards will work. */
autoirq_setup(0);
/* Trigger an initialization just for the interrupt. */
......@@ -329,24 +401,65 @@ unsigned long lance_probe1(short ioaddr, unsigned long mem_start)
dev->irq = autoirq_report(1);
if (dev->irq)
printk(", probed IRQ %d, fixed at DMA %d.\n",
dev->irq, dev->dma);
printk(", probed IRQ %d", dev->irq);
else {
printk(", failed to detect IRQ line.\n");
return mem_start;
}
/* Check for the initialization done bit, 0x0100, which means
that we don't need a DMA channel. */
if (inw(ioaddr+LANCE_DATA) & 0x0100)
dev->dma = 4;
}
if (dev->dma == 4) {
printk(", no DMA needed.\n");
} else if (dev->dma) {
if (request_dma(dev->dma, "lance")) {
printk("DMA %d allocation failed.\n", dev->dma);
return mem_start;
} else
printk(" assigned IRQ %d DMA %d.\n", dev->irq, dev->dma);
printk(", assigned DMA %d.\n", dev->dma);
} else { /* OK, we have to auto-DMA. */
int dmas[] = {5, 6, 7, 3}, boguscnt;
for (i = 0; i < 4; i++) {
int dma = dmas[i];
outw(0x7f04, ioaddr+LANCE_DATA); /* Clear the memory error bits. */
if (request_dma(dma, "lance"))
continue;
enable_dma(dma);
set_dma_mode(dma, DMA_MODE_CASCADE);
/* Trigger an initialization. */
outw(0x0001, ioaddr+LANCE_DATA);
for (boguscnt = 100; boguscnt > 0; --boguscnt)
if (inw(ioaddr+LANCE_DATA) & 0x0900)
break;
if (inw(ioaddr+LANCE_DATA) & 0x0100) {
dev->dma = dma;
printk(", DMA %d.\n", dev->dma);
break;
} else {
disable_dma(dma);
free_dma(dma);
}
}
if (i == 4) { /* Failure: bail. */
printk("DMA detection failed.\n");
return mem_start;
}
}
if (! lp->old_lance) {
if (lp->chip_version != OLD_LANCE) {
/* Turn on auto-select of media (10baseT or BNC) so that the user
can watch the LEDs even if the board isn't opened. */
outw(0x0002, ioaddr+LANCE_ADDR);
outw(0x0002, ioaddr+LANCE_BUS_IF);
}
if (lance_debug > 0)
if (lance_debug > 0 && did_version++ == 0)
printk(version);
/* The LANCE-specific entries in the device structure. */
......@@ -371,10 +484,9 @@ lance_open(struct device *dev)
return -EAGAIN;
}
if (request_dma(dev->dma,"lance")) {
free_irq(dev->irq);
return -EAGAIN;
}
/* We used to allocate DMA here, but that was silly.
DMA lines can't be shared! We now permanently snarf them. */
irq2dev_map[dev->irq] = dev;
/* Reset the LANCE */
......@@ -385,10 +497,10 @@ lance_open(struct device *dev)
set_dma_mode(dev->dma, DMA_MODE_CASCADE);
/* Un-Reset the LANCE, needed only for the NE2100. */
if (lp->old_lance)
if (lp->chip_version == OLD_LANCE)
outw(0, ioaddr+LANCE_RESET);
if (! lp->old_lance) {
if (lp->chip_version != OLD_LANCE) {
/* This is 79C960-specific: Turn on auto-select of media (AUI, BNC). */
outw(0x0002, ioaddr+LANCE_ADDR);
outw(0x0002, ioaddr+LANCE_BUS_IF);
......@@ -435,7 +547,7 @@ lance_init_ring(struct device *dev)
struct lance_private *lp = (struct lance_private *)dev->priv;
int i;
lp->lock = 0;
lp->lock = 0, lp->tx_full = 0;
lp->cur_rx = lp->cur_tx = 0;
lp->dirty_rx = lp->dirty_tx = 0;
......@@ -538,7 +650,7 @@ lance_start_xmit(struct sk_buff *skb, struct device *dev)
with the "ownership" bits last. */
/* The old LANCE chips doesn't automatically pad buffers to min. size. */
if (lp->old_lance) {
if (lp->chip_version == OLD_LANCE) {
lp->tx_ring[entry].length =
-(ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN);
} else
......@@ -557,6 +669,7 @@ lance_start_xmit(struct sk_buff *skb, struct device *dev)
(int)(lp->tx_bounce_buffs + entry) | 0x83000000;
dev_kfree_skb (skb, FREE_WRITE);
} else {
lp->tx_skbuff[entry] = skb;
lp->tx_ring[entry].base = (int)(skb->data) | 0x83000000;
}
lp->cur_tx++;
......@@ -571,6 +684,8 @@ lance_start_xmit(struct sk_buff *skb, struct device *dev)
lp->lock = 0;
if (lp->tx_ring[(entry+1) & TX_RING_MOD_MASK].base == 0)
dev->tbusy=0;
else
lp->tx_full = 1;
sti();
return 0;
......@@ -616,13 +731,11 @@ lance_interrupt(int reg_ptr)
while (dirty_tx < lp->cur_tx) {
int entry = dirty_tx & TX_RING_MOD_MASK;
int status = lp->tx_ring[entry].base;
void *databuff;
if (status < 0)
break; /* It still hasn't been Txed */
lp->tx_ring[entry].base = 0;
databuff = (void*)(status & 0x00ffffff);
if (status & 0x40000000) { /* There was an major error, log it. */
int err_status = lp->tx_ring[entry].misc;
......@@ -638,16 +751,11 @@ lance_interrupt(int reg_ptr)
lp->stats.tx_packets++;
}
/* We don't free the skb if it's a data-only copy in the bounce
buffer. The address checks here are sorted -- the first test
should always work. */
if (databuff >= (void*)(&lp->tx_bounce_buffs[TX_RING_SIZE])
|| databuff < (void*)(lp->tx_bounce_buffs)) {
struct sk_buff *skb = ((struct sk_buff *)databuff) - 1;
dev_kfree_skb(skb,FREE_WRITE);
/* Warning: skb may well vanish at the point you call
device_release! */
/* We must free the original skb if it's not a data-only copy
in the bounce buffer. */
if (lp->tx_skbuff[entry]) {
dev_kfree_skb(lp->tx_skbuff[entry],FREE_WRITE);
lp->tx_skbuff[entry] = 0;
}
dirty_tx++;
}
......@@ -660,8 +768,9 @@ lance_interrupt(int reg_ptr)
}
#endif
if (dev->tbusy && dirty_tx > lp->cur_tx - TX_RING_SIZE + 2) {
if (lp->tx_full && dev->tbusy && dirty_tx > lp->cur_tx - TX_RING_SIZE + 2) {
/* The ring is no longer full, clear tbusy. */
lp->tx_full = 0;
dev->tbusy = 0;
mark_bh(NET_BH);
}
......@@ -669,12 +778,12 @@ lance_interrupt(int reg_ptr)
lp->dirty_tx = dirty_tx;
}
if (csr0 & 0x8000) {
if (csr0 & 0x4000) lp->stats.tx_errors++;
if (csr0 & 0x1000) lp->stats.rx_errors++;
if (csr0 & 0x8000) { /* Check the error summary bit. */
if (csr0 & 0x4000) lp->stats.tx_errors++; /* Tx babble. */
if (csr0 & 0x1000) lp->stats.rx_errors++; /* Missed a Rx frame. */
}
/* Clear the interrupts we've handled. */
/* Clear any other interrupt. */
outw(0x0000, dev->base_addr + LANCE_ADDR);
outw(0x7f40, dev->base_addr + LANCE_DATA);
......@@ -739,6 +848,9 @@ lance_rx(struct device *dev)
}
lp->rx_ring[entry].base |= 0x80000000;
/* The docs say that the buffer length isn't touched, but Andrew Boyd
of QNX reports that some revs of the 79C965 clear it. */
lp->rx_ring[entry].buf_length = -PKT_BUF_SZ;
entry = (++lp->cur_rx) & RX_RING_MOD_MASK;
}
......@@ -773,7 +885,6 @@ lance_close(struct device *dev)
disable_dma(dev->dma);
free_irq(dev->irq);
free_dma(dev->dma);
irq2dev_map[dev->irq] = 0;
......@@ -831,14 +942,11 @@ set_multicast_list(struct device *dev, int num_addrs, void *addrs)
outw(0x0142, ioaddr+LANCE_DATA); /* Resume normal operation. */
}
#ifdef HAVE_DEVLIST
static unsigned int lance_portlist[] = {0x300, 0x320, 0x340, 0x360, 0};
struct netdev_entry lance_drv =
{"lance", lance_probe1, LANCE_TOTAL_SIZE, lance_portlist};
#endif
/*
* Local variables:
* compile-command: "gcc -D__KERNEL__ -I/usr/src/linux/net/inet -Wall -Wstrict-prototypes -O6 -m486 -c lance.c"
* c-indent-level: 4
* tab-width: 4
* End:
*/
......@@ -311,6 +311,7 @@ static void *addresses[] =
(void *) 0xd8000,
(void *) 0xe0000,
(void *) 0xf0000,
(void *) 0xeb800, /* VTech Platinum SMP */
};
#define ADDRESS_COUNT (sizeof( addresses ) / sizeof( unsigned ))
......
......@@ -156,6 +156,7 @@ static struct blist blacklist[] =
{"TEXEL","CD-ROM","1.06"}, /* causes failed REQUEST SENSE on lun 1 for seagate
* controller, which causes SCSI code to reset bus.*/
{"QUANTUM","LPS525S","3110"},/* Locks sometimes if polled for lun != 0 */
{"QUANTUM","PD1225S","3110"},/* Locks sometimes if polled for lun != 0 */
{NULL, NULL, NULL}};
static int blacklisted(unsigned char * response_data){
......
......@@ -11,6 +11,7 @@
* Portions taken from the KA9Q/NOS (v2.00m PA0GRI) source.
* Ross Biro, <bir7@leland.Stanford.Edu>
* Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
* Florian La Roche.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
......@@ -59,5 +60,28 @@ struct arpreq {
#define ATF_PUBL 0x08 /* publish entry */
#define ATF_USETRAILERS 0x10 /* has requested trailers */
/*
* This structure defines an ethernet arp header.
*/
struct arphdr
{
unsigned short ar_hrd; /* format of hardware address */
unsigned short ar_pro; /* format of protocol address */
unsigned char ar_hln; /* length of hardware address */
unsigned char ar_pln; /* length of protocol address */
unsigned short ar_op; /* ARP opcode (command) */
#if 0
/*
* Ethernet looks like this : This bit is variable sized however...
*/
unsigned char ar_sha[ETH_ALEN]; /* sender hardware address */
unsigned char ar_sip[4]; /* sender IP address */
unsigned char ar_tha[ETH_ALEN]; /* target hardware address */
unsigned char ar_tip[4]; /* target IP address */
#endif
};
#endif /* _LINUX_IF_ARP_H */
......@@ -245,6 +245,8 @@ void unmap_fixup(struct vm_area_struct *area,
/* Add end mapping -- leave beginning for below */
mpnt = (struct vm_area_struct *)kmalloc(sizeof(*mpnt), GFP_KERNEL);
if (!mpnt)
return;
*mpnt = *area;
mpnt->vm_offset += (end - area->vm_start);
mpnt->vm_start = end;
......@@ -256,6 +258,8 @@ void unmap_fixup(struct vm_area_struct *area,
/* construct whatever mapping is needed */
mpnt = (struct vm_area_struct *)kmalloc(sizeof(*mpnt), GFP_KERNEL);
if (!mpnt)
return;
*mpnt = *area;
insert_vm_struct(current, mpnt);
}
......
......@@ -30,6 +30,9 @@
* Alan Cox : Drop data when a device is downed.
* Alan Cox : Use init_timer().
* Alan Cox : Double lock fixes.
* Martin Seine : Move the arphdr structure
* to if_arp.h for compatibility
* with BSD based programs.
*/
#include <linux/types.h>
......@@ -86,29 +89,6 @@ struct arp_table
struct sk_buff_head skb; /* list of queued packets */
};
/*
* This structure defines an ethernet arp header.
*/
struct arphdr
{
unsigned short ar_hrd; /* format of hardware address */
unsigned short ar_pro; /* format of protocol address */
unsigned char ar_hln; /* length of hardware address */
unsigned char ar_pln; /* length of protocol address */
unsigned short ar_op; /* ARP opcode (command) */
#if 0
/*
* Ethernet looks like this : This bit is variable sized however...
*/
unsigned char ar_sha[ETH_ALEN]; /* sender hardware address */
unsigned char ar_sip[4]; /* sender IP address */
unsigned char ar_tha[ETH_ALEN]; /* target hardware address */
unsigned char ar_tip[4]; /* target IP address */
#endif
};
/*
* Configurable Parameters (don't touch unless you know what you are doing
......
......@@ -87,10 +87,10 @@ register_8022_client(unsigned char type, int (*rcvfunc)(struct sk_buff *, struct
proto->rcvfunc = rcvfunc;
proto->header_length = 3;
proto->datalink_header = p8022_datalink_header;
}
proto->next = p8022_list;
p8022_list = proto;
}
return proto;
}
......
......@@ -80,14 +80,12 @@
* Alan Cox : Window clamping
* Michael Riepe : Bug in tcp_check()
* Matt Dillon : More TCP improvements and RST bug fixes
* Matt Dillon : Yet more small nasties remove from the TCP code
* (Be very nice to this man if tcp finally works 100%) 8)
* Alan Cox : BSD accept sematics.
*
*
* To Fix:
* Possibly a problem with accept(). BSD accept never fails after
* it causes a select. Linux can - given the official select semantics I
* feel that _really_ its the BSD network programs that are bust (notably
* inetd, which hangs occasionally because of this).
*
* Fast path the code. Two things here - fix the window calculation
* so it doesn't iterate over the queue, also spot packets with no funny
* options arriving in order and process directly.
......@@ -224,6 +222,40 @@ int tcp_select_window(struct sock *sk)
return(new_window);
}
/*
* Find someone to 'accept'. Must be called with
* sk->inuse=1 or cli()
*/
static struct sk_buff *tcp_find_established(struct sock *s)
{
struct sk_buff *p=skb_peek(&s->receive_queue);
if(p==NULL)
return NULL;
do
{
if(p->sk->state>=TCP_ESTABLISHED)
return p;
p=p->next;
}
while(p!=skb_peek(&s->receive_queue));
return NULL;
}
static struct sk_buff *tcp_dequeue_established(struct sock *s)
{
struct sk_buff *skb;
unsigned long flags;
save_flags(flags);
cli();
skb=tcp_find_established(s);
if(skb!=NULL)
skb_unlink(skb); /* Take it off the queue */
restore_flags(flags);
return skb;
}
/*
* Enter the time wait state.
*/
......@@ -406,7 +438,7 @@ static int tcp_select(struct sock *sk, int sel_type, select_table *wait)
printk("-select out");
if (skb_peek(&sk->receive_queue) != NULL)
{
if (sk->state == TCP_LISTEN || tcp_readable(sk))
if ((sk->state == TCP_LISTEN && tcp_find_established(sk)) || tcp_readable(sk))
{
release_sock(sk);
if(sk->debug)
......@@ -445,12 +477,11 @@ static int tcp_select(struct sock *sk, int sel_type, select_table *wait)
}
/*
* FIXME:
* Hack so it will probably be able to write
* something if it says it's ok to write.
* This is now right thanks to a small fix
* by Matt Dillon.
*/
if (sk->prot->wspace(sk) >= sk->mss)
if (sk->prot->wspace(sk) >= sk->mtu+128+sk->prot->max_header)
{
release_sock(sk);
/* This should cause connect to work ok. */
......@@ -2523,15 +2554,7 @@ static int tcp_ack(struct sock *sk, struct tcphdr *th, unsigned long saddr, int
if (sk->retransmits && sk->timeout == TIME_KEEPOPEN)
sk->retransmits = 0;
#if 0
/*
* Not quite clear why the +1 and -1 here, and why not +1 in next line
*/
if (after(ack, sk->sent_seq+1) || before(ack, sk->rcv_ack_seq-1))
#else
if (after(ack, sk->sent_seq) || before(ack, sk->rcv_ack_seq))
#endif
{
if(sk->debug)
printk("Ack ignored %lu %lu\n",ack,sk->sent_seq);
......@@ -2941,7 +2964,8 @@ static int tcp_ack(struct sock *sk, struct tcphdr *th, unsigned long saddr, int
/*
* Incoming ACK to a FIN we sent in the case of our initiating the close.
*
* Move to FIN_WAIT2 to await a FIN from the other end.
* Move to FIN_WAIT2 to await a FIN from the other end. Set
* SEND_SHUTDOWN but not RCV_SHUTDOWN as data can still be coming in.
*/
if (sk->state == TCP_FIN_WAIT1)
......@@ -2952,13 +2976,15 @@ static int tcp_ack(struct sock *sk, struct tcphdr *th, unsigned long saddr, int
if (sk->rcv_ack_seq == sk->write_seq)
{
flag |= 1;
#ifdef THIS_BIT_IS_WRONG
if (sk->acked_seq != sk->fin_seq)
{
tcp_time_wait(sk);
}
else
#endif
{
sk->shutdown = SHUTDOWN_MASK;
sk->shutdown |= SEND_SHUTDOWN;
tcp_set_state(sk,TCP_FIN_WAIT2);
}
}
......@@ -3065,7 +3091,7 @@ static int tcp_data(struct sk_buff *skb, struct sock *sk,
{
new_seq= th->seq + skb->len + th->syn; /* Right edge of _data_ part of frame */
if(after(new_seq,sk->copied_seq+1)) /* If the right edge of this frame is after the last copied byte
if(after(new_seq,sk->/*copied*/acked_seq+1)) /* If the right edge of this frame is after the last copied byte
then it contains data we will never touch. We send an RST to
ensure the far end knows it never got to the application */
{
......@@ -3448,6 +3474,7 @@ static int tcp_fin(struct sk_buff *skb, struct sock *sk, struct tcphdr *th,
*/
reset_timer(sk, TIME_CLOSE, TCP_TIMEWAIT_LEN);
/*sk->fin_seq = th->seq+1;*/
sk->shutdown|=SHUTDOWN_MASK;
tcp_set_state(sk,TCP_TIME_WAIT);
break;
case TCP_CLOSE:
......@@ -3490,7 +3517,7 @@ tcp_accept(struct sock *sk, int flags)
cli();
sk->inuse = 1;
while((skb = skb_dequeue(&sk->receive_queue)) == NULL)
while((skb = tcp_dequeue_established(sk)) == NULL)
{
if (flags & O_NONBLOCK)
{
......
......@@ -17,6 +17,7 @@
* top level.
* Alan Cox : Move address structures to/from user
* mode above the protocol layers.
* Rob Janssen : Allow 0 length sends
*
*
* This program is free software; you can redistribute it and/or
......@@ -924,8 +925,6 @@ static int sock_send(int fd, void * buff, int len, unsigned flags)
if(len<0)
return -EINVAL;
if(len==0)
return 0;
err=verify_area(VERIFY_READ, buff, len);
if(err)
return err;
......@@ -953,8 +952,6 @@ static int sock_sendto(int fd, void * buff, int len, unsigned flags,
if(len<0)
return -EINVAL;
if(len==0)
return 0;
err=verify_area(VERIFY_READ,buff,len);
if(err)
return err;
......
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