bk://gkernel.bkbits.net/net-drivers-2.6
mingo@elte.hu|ChangeSet|20040511070510|63204 mingo

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/05/11 03:05:10-04:00 mingo@elte.hu 
#   [netdrvr dmfe] netpoll support
# 
# drivers/net/tulip/dmfe.c
#   2004/05/10 20:00:00-04:00 mingo@elte.hu +23 -0
#   netpoll support for dmfe.c, 2.6.6-rc3
# 
# ChangeSet
#   2004/05/11 03:05:01-04:00 hch@lst.de 
#   [netdrvr gt961000eth] remove useless MOD_{INC,DEC}_USE_COUNT
#   
#   *grr* - this one slipped in after my last round of audits it seems.
# 
# drivers/net/gt96100eth.c
#   2004/05/03 09:22:22-04:00 hch@lst.de +0 -6
#   remove useless MOD_{INC,DEC}_USE_COUNT
# 
# ChangeSet
#   2004/05/11 03:04:53-04:00 akpm@osdl.org 
#   [PATCH] 8139too not running s3 suspend/resume pci fix
#   
#   From: "Adrian Yee" <brewt-linux-kernel@brewt.org>
#   
#   Having an 8139 based device in my notebook, I often switch between it and
#   wireless.  The problem is that the 8139too driver does not save/restore the
#   pci configuration of the card if the device isn't running.  This simple
#   patch moves the save/restore code so that the code runs regardless of
#   whether or not the device is running.
#   
#   I looked at other drivers and they all seem to do the same thing.  Is there
#   a reason why this isn't done like in the patch?
# 
# drivers/net/8139too.c
#   2004/04/26 13:11:44-04:00 akpm@osdl.org +3 -2
#   8139too not running s3 suspend/resume pci fix
# 
# ChangeSet
#   2004/05/11 03:04:44-04:00 akpm@osdl.org 
#   [PATCH] lance.c: fix for card with signature 0x52 0x49
#   
#   From: Vesselin Kostadiov <vesselin@alphawave.com.au>
#   
#   Problem: The lance.c driver did not work with my Racal Interlan EtherBlaster
#   card.
#   
#   More info: I found that my card has a signature 0x52 0x49 that was not
#   recognized by the driver.
#   
#   Explanation: Following your suggestion I created a static table with possible
#   signatures, not too different from the table in ni65.c.  The updated code
#   compares the first byte of the cards signature with the first byte of the
#   signatures from the table.  It this succeeds then it reads the second byte and
#   compares the whole signature with the values from the table.  This way the
#   minimal I/O reads approach is maintained.
#   
#   Side effect: The previous version would missdetect cards with signatures 0x52
#   0x57 and 0x57 0x44.  This has been fixed as well.
# 
# drivers/net/lance.c
#   2004/05/03 09:40:23-04:00 akpm@osdl.org +37 -7
#   lance.c: fix for card with signature 0x52 0x49
# 
# ChangeSet
#   2004/05/11 03:04:36-04:00 cw@f00f.org 
#   [PATCH] kill warning in r8169
# 
# drivers/net/r8169.c
#   2004/05/10 14:42:46-04:00 cw@f00f.org +1 -1
#   bk 2.6.6 r8169.c shud'up gcc
# 
diff -Nru a/drivers/net/8139too.c b/drivers/net/8139too.c
--- a/drivers/net/8139too.c	Wed May 12 20:30:15 2004
+++ b/drivers/net/8139too.c	Wed May 12 20:30:15 2004
@@ -2554,6 +2554,8 @@
 	void *ioaddr = tp->mmio_addr;
 	unsigned long flags;
 
+	pci_save_state (pdev, tp->pci_state);
+
 	if (!netif_running (dev))
 		return 0;
 
@@ -2572,7 +2574,6 @@
 	spin_unlock_irqrestore (&tp->lock, flags);
 
 	pci_set_power_state (pdev, 3);
-	pci_save_state (pdev, tp->pci_state);
 
 	return 0;
 }
@@ -2583,9 +2584,9 @@
 	struct net_device *dev = pci_get_drvdata (pdev);
 	struct rtl8139_private *tp = dev->priv;
 
+	pci_restore_state (pdev, tp->pci_state);
 	if (!netif_running (dev))
 		return 0;
-	pci_restore_state (pdev, tp->pci_state);
 	pci_set_power_state (pdev, 0);
 	rtl8139_init_ring (dev);
 	rtl8139_hw_start (dev);
diff -Nru a/drivers/net/gt96100eth.c b/drivers/net/gt96100eth.c
--- a/drivers/net/gt96100eth.c	Wed May 12 20:30:15 2004
+++ b/drivers/net/gt96100eth.c	Wed May 12 20:30:15 2004
@@ -1070,22 +1070,18 @@
 {
 	int retval;
     
-	MOD_INC_USE_COUNT;
-
 	dbg(2, "%s: dev=%p\n", __FUNCTION__, dev);
 
 	// Initialize and startup the GT-96100 ethernet port
 	if ((retval = gt96100_init(dev))) {
 		err("error in gt96100_init\n");
 		free_irq(dev->irq, dev);
-		MOD_DEC_USE_COUNT;
 		return retval;
 	}
 
 	if ((retval = request_irq(dev->irq, &gt96100_interrupt,
 				  SA_SHIRQ, dev->name, dev))) {
 		err("unable to get IRQ %d\n", dev->irq);
-		MOD_DEC_USE_COUNT;
 		return retval;
 	}
 	
@@ -1106,8 +1102,6 @@
 	}
 
 	free_irq(dev->irq, dev);
-    
-	MOD_DEC_USE_COUNT;
 	return 0;
 }
 
diff -Nru a/drivers/net/lance.c b/drivers/net/lance.c
--- a/drivers/net/lance.c	Wed May 12 20:30:15 2004
+++ b/drivers/net/lance.c	Wed May 12 20:30:15 2004
@@ -37,6 +37,9 @@
 
     Get rid of check_region, check kmalloc return in lance_probe1
     Arnaldo Carvalho de Melo <acme@conectiva.com.br> - 11/01/2001
+
+	Reworked detection, added support for Racal InterLan EtherBlaster cards
+	Vesselin Kostadinov <vesok at yahoo dot com > - 22/4/2004
 */
 
 static const char version[] = "lance.c:v1.15ac 1999/11/13 dplatt@3do.com, becker@cesdis.gsfc.nasa.gov\n";
@@ -62,6 +65,26 @@
 static int lance_probe1(struct net_device *dev, int ioaddr, int irq, int options);
 static int __init do_lance_probe(struct net_device *dev);
 
+
+static struct card {
+	char id_offset14;
+	char id_offset15;
+} cards[] = {
+	{	//"normal"
+		.id_offset14 = 0x57,
+		.id_offset15 = 0x57,
+	},
+	{	//NI6510EB
+		.id_offset14 = 0x52,
+		.id_offset15 = 0x44,
+	},
+	{	//Racal InterLan EtherBlaster
+		.id_offset14 = 0x52,
+		.id_offset15 = 0x49,
+	},
+};
+#define NUM_CARDS 3
+
 #ifdef LANCE_DEBUG
 static int lance_debug = LANCE_DEBUG;
 #else
@@ -380,13 +403,20 @@
 							"lance-probe");
 
 		if (r) {
-			/* Detect "normal" 0x57 0x57 and the NI6510EB 0x52 0x44
-			   signatures w/ minimal I/O reads */
-			char offset15, offset14 = inb(ioaddr + 14);
-			
-			if ((offset14 == 0x52 || offset14 == 0x57) &&
-				((offset15 = inb(ioaddr + 15)) == 0x57 ||
-				 offset15 == 0x44)) {
+			/* Detect the card with minimal I/O reads */
+			char offset14 = inb(ioaddr + 14);
+			int card;
+			for (card = 0; card < NUM_CARDS; ++card)
+				if (cards[card].id_offset14 == offset14)
+					break;
+			if (card < NUM_CARDS) {/*yes, the first byte matches*/
+				char offset15 = inb(ioaddr + 15);
+				for (card = 0; card < NUM_CARDS; ++card)
+					if ((cards[card].id_offset14 == offset14) &&
+						(cards[card].id_offset15 == offset15))
+						break;
+			}
+			if (card < NUM_CARDS) { /*Signature OK*/
 				result = lance_probe1(dev, ioaddr, 0, 0);
 				if (!result) {
 					struct lance_private *lp = dev->priv;
diff -Nru a/drivers/net/r8169.c b/drivers/net/r8169.c
--- a/drivers/net/r8169.c	Wed May 12 20:30:15 2004
+++ b/drivers/net/r8169.c	Wed May 12 20:30:15 2004
@@ -1156,7 +1156,7 @@
 
 static inline void rtl8169_make_unusable_by_asic(struct RxDesc *desc)
 {
-	desc->addr = 0x0badbadbadbadbad;
+	desc->addr = 0x0badbadbadbadbadull;
 	desc->status &= ~cpu_to_le32(OWNbit | RsvdMask);
 }
 
diff -Nru a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c
--- a/drivers/net/tulip/dmfe.c	Wed May 12 20:30:15 2004
+++ b/drivers/net/tulip/dmfe.c	Wed May 12 20:30:15 2004
@@ -299,6 +299,9 @@
 static struct ethtool_ops netdev_ethtool_ops;
 static u16 read_srom_word(long ,int);
 static irqreturn_t dmfe_interrupt(int , void *, struct pt_regs *);
+#ifdef CONFIG_NET_POLL_CONTROLLER
+static void poll_dmfe (struct net_device *dev);
+#endif
 static void dmfe_descriptor_init(struct dmfe_board_info *, unsigned long);
 static void allocate_rx_buffer(struct dmfe_board_info *);
 static void update_cr6(u32, unsigned long);
@@ -417,6 +420,9 @@
 	dev->stop = &dmfe_stop;
 	dev->get_stats = &dmfe_get_stats;
 	dev->set_multicast_list = &dmfe_set_filter_mode;
+#ifdef CONFIG_NET_POLL_CONTROLLER
+	dev->poll_controller = &poll_dmfe;
+#endif
 	dev->ethtool_ops = &netdev_ethtool_ops;
 	spin_lock_init(&db->lock);
 
@@ -790,6 +796,23 @@
 	return IRQ_HANDLED;
 }
 
+
+#ifdef CONFIG_NET_POLL_CONTROLLER
+/*
+ * Polling 'interrupt' - used by things like netconsole to send skbs
+ * without having to re-enable interrupts. It's not called while
+ * the interrupt routine is executing.
+ */
+
+static void poll_dmfe (struct net_device *dev)
+{
+	/* disable_irq here is not very nice, but with the lockless
+	   interrupt handler we have no other choice. */
+	disable_irq(dev->irq);
+	dmfe_interrupt (dev->irq, dev, NULL);
+	enable_irq(dev->irq);
+}
+#endif
 
 /*
  *	Free TX resource after TX complete
