summaryrefslogtreecommitdiffstats
path: root/drivers/net/tlan.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1999-06-13 16:29:25 +0000
committerRalf Baechle <ralf@linux-mips.org>1999-06-13 16:29:25 +0000
commitdb7d4daea91e105e3859cf461d7e53b9b77454b2 (patch)
tree9bb65b95440af09e8aca63abe56970dd3360cc57 /drivers/net/tlan.c
parent9c1c01ead627bdda9211c9abd5b758d6c687d8ac (diff)
Merge with Linux 2.2.8.
Diffstat (limited to 'drivers/net/tlan.c')
-rw-r--r--drivers/net/tlan.c43
1 files changed, 27 insertions, 16 deletions
diff --git a/drivers/net/tlan.c b/drivers/net/tlan.c
index d3d2fba46..f476b6259 100644
--- a/drivers/net/tlan.c
+++ b/drivers/net/tlan.c
@@ -29,6 +29,8 @@
*
* Tigran Aivazian <tigran@sco.com>: TLan_PciProbe() now uses
* new PCI BIOS interface.
+ * Alan Cox <alan@redhat.com>: Fixed the out of memory
+ * handling.
*
********************************************************************/
@@ -1250,28 +1252,36 @@ u32 TLan_HandleRxEOF( struct device *dev, u16 host_int )
netif_rx( skb );
}
} else {
- skb = (struct sk_buff *) head_list->buffer[9].address;
- head_list->buffer[9].address = 0;
- skb_trim( skb, head_list->frameSize );
-
+ struct sk_buff *new_skb;
+
+ /*
+ * I changed the algorithm here. What we now do
+ * is allocate the new frame. If this fails we
+ * simply recycle the frame.
+ */
+
+ new_skb = dev_alloc_skb( TLAN_MAX_FRAME_SIZE + 7 );
+ if ( new_skb != NULL ) {
+ /* If this ever happened it would be a problem */
+ /* not any more - ac */
+ skb = (struct sk_buff *) head_list->buffer[9].address;
+ head_list->buffer[9].address = 0;
+ skb_trim( skb, head_list->frameSize );
#if LINUX_KERNEL_VERSION > 0x20100
priv->stats->rx_bytes += head_list->frameSize;
#endif
- skb->protocol = eth_type_trans( skb, dev );
- netif_rx( skb );
-
- skb = dev_alloc_skb( TLAN_MAX_FRAME_SIZE + 7 );
- if ( skb == NULL ) {
- printk( "TLAN: Couldn't allocate memory for received data.\n" );
- /* If this ever happened it would be a problem */
- } else {
- skb->dev = dev;
- skb_reserve( skb, 2 );
- t = (void *) skb_put( skb, TLAN_MAX_FRAME_SIZE );
+ skb->protocol = eth_type_trans( skb, dev );
+ netif_rx( skb );
+
+ new_skb->dev = dev;
+ skb_reserve( new_skb, 2 );
+ t = (void *) skb_put( new_skb, TLAN_MAX_FRAME_SIZE );
head_list->buffer[0].address = virt_to_bus( t );
- head_list->buffer[9].address = (u32) skb;
+ head_list->buffer[9].address = (u32) new_skb;
}
+ else
+ printk(KERN_WARNING "TLAN: Couldn't allocate memory for received data.\n" );
}
head_list->forward = 0;
@@ -1867,6 +1877,7 @@ TLan_ResetAdapter( struct device *dev )
u8 data8;
priv->tlanFullDuplex = FALSE;
+ priv->phyOnline=0;
/* 1. Assert reset bit. */
data = inl(dev->base_addr + TLAN_HOST_CMD);