public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Val Henson <val@nmt.edu>
To: jgarzik@mandrakesoft.com, becker@scyld.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] Endian-ness bugs in yellowfin.c
Date: Thu, 13 Sep 2001 19:51:41 -0600	[thread overview]
Message-ID: <20010913195141.B799@boardwalk> (raw)

This patch applies to the 2.4.10-pre8 yellowfin driver.  What it does:

* Fixes three bugs on big-endian architecture
* Changes flags to support at least one SYM53C885E card
* Replaces ncr885e driver with yellowfin

I ran into a couple of design decisions people won't like:

This driver is both a 1000 Mbit driver and 100 Mbit driver.  My
solution was to list the driver once under each category with the
appropriate name.

The flag IsGigabit seems misnamed, since it doesn't seem to control
anything related to gigabit-ness.  I turned it on for the SYMBIOS card
since, at least on my card, it uses the correct code.

#ifdef __powerpc__ probably should be changed to some form of #ifdef
BIG_ENDIAN but I didn't include that in this patch.

And finally, I'd like to remove ncr885e.c entirely since it's
redundant and extremely buggy.  Any objections?

-VAL

diff -Nru a/Documentation/Configure.help b/Documentation/Configure.help
--- a/Documentation/Configure.help	Thu Sep 13 19:20:29 2001
+++ b/Documentation/Configure.help	Thu Sep 13 19:20:29 2001
@@ -8824,10 +8824,10 @@
 Packet Engines Yellowfin Gigabit-NIC support
 CONFIG_YELLOWFIN
   Say Y here if you have a Packet Engines G-NIC PCI Gigabit Ethernet
-  adapter. This adapter is used by the Beowulf Linux cluster project.
-  See http://cesdis.gsfc.nasa.gov/linux/drivers/yellowfin.html for
-  more information about this driver in particular and Beowulf in
-  general.
+  adapter or the SYM53C885 Ethernet controller. The Gigabit adapter is
+  used by the Beowulf Linux cluster project.  See
+  http://cesdis.gsfc.nasa.gov/linux/drivers/yellowfin.html for more
+  information about this driver in particular and Beowulf in general.
 
   If you want to compile this driver as a module ( = code which can be
   inserted in and removed from the running kernel whenever you want),
diff -Nru a/drivers/net/Config.in b/drivers/net/Config.in
--- a/drivers/net/Config.in	Thu Sep 13 19:20:29 2001
+++ b/drivers/net/Config.in	Thu Sep 13 19:20:29 2001
@@ -39,7 +39,7 @@
       fi
       dep_tristate '  BMAC (G3 ethernet) support' CONFIG_BMAC $CONFIG_ALL_PPC
       dep_tristate '  GMAC (G4/iBook ethernet) support' CONFIG_GMAC $CONFIG_ALL_PPC
-      tristate '  Symbios 53c885 (Synergy ethernet) support' CONFIG_NCR885E
+      tristate '  Symbios 53c885 (Synergy ethernet) support' CONFIG_YELLOWFIN
       tristate '  National DP83902AV (Oak ethernet) support' CONFIG_OAKNET
       dep_bool '  PowerPC 405 on-chip ethernet' CONFIG_PPC405_ENET $CONFIG_405GP
       if [ "$CONFIG_PPC405_ENET" = "y" ]; then
diff -Nru a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c
--- a/drivers/net/yellowfin.c	Thu Sep 13 19:20:29 2001
+++ b/drivers/net/yellowfin.c	Thu Sep 13 19:20:29 2001
@@ -276,7 +276,7 @@
 	 PCI_IOTYPE, YELLOWFIN_SIZE,
 	 FullTxStatus | IsGigabit | HasMulticastBug | HasMACAddrBug},
 	{"Symbios SYM83C885", { 0x07011000, 0xffffffff},
-	 PCI_IOTYPE, YELLOWFIN_SIZE, HasMII },
+	 PCI_IOTYPE, YELLOWFIN_SIZE, HasMII | IsGigabit | FullTxStatus },
 	{0,},
 };
 
@@ -785,8 +785,8 @@
 			break;
 		skb->dev = dev;		/* Mark as being used by this device. */
 		skb_reserve(skb, 2);	/* 16 byte align the IP header. */
-		yp->rx_ring[i].addr = pci_map_single(yp->pci_dev, skb->tail,
-			yp->rx_buf_sz, PCI_DMA_FROMDEVICE);
+		yp->rx_ring[i].addr = cpu_to_le32(pci_map_single(yp->pci_dev,
+			skb->tail, yp->rx_buf_sz, PCI_DMA_FROMDEVICE));
 	}
 	yp->rx_ring[i-1].dbdma_cmd = cpu_to_le32(CMD_STOP);
 	yp->dirty_rx = (unsigned int)(i - RX_RING_SIZE);
@@ -1109,7 +1109,7 @@
 		buf_addr = rx_skb->tail;
 		data_size = (le32_to_cpu(desc->dbdma_cmd) - 
 			le32_to_cpu(desc->result_status)) & 0xffff;
-		frame_status = get_unaligned((s16*)&(buf_addr[data_size - 2]));
+		frame_status = le16_to_cpu(get_unaligned((s16*)&(buf_addr[data_size - 2])));
 		if (yellowfin_debug > 4)
 			printk(KERN_DEBUG "  yellowfin_rx() status was %4.4x.\n",
 				   frame_status);
@@ -1206,8 +1206,8 @@
 			yp->rx_skbuff[entry] = skb;
 			skb->dev = dev;	/* Mark as being used by this device. */
 			skb_reserve(skb, 2);	/* Align IP on 16 byte boundaries */
-			yp->rx_ring[entry].addr = pci_map_single(yp->pci_dev,
-				skb->tail, yp->rx_buf_sz, PCI_DMA_FROMDEVICE);
+			yp->rx_ring[entry].addr = cpu_to_le32(pci_map_single(yp->pci_dev,
+				skb->tail, yp->rx_buf_sz, PCI_DMA_FROMDEVICE));
 		}
 		yp->rx_ring[entry].dbdma_cmd = cpu_to_le32(CMD_STOP);
 		yp->rx_ring[entry].result_status = 0;	/* Clear complete bit. */

             reply	other threads:[~2001-09-14  2:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-14  1:51 Val Henson [this message]
2001-09-14  2:39 ` [PATCH] Endian-ness bugs in yellowfin.c Tom Rini
2001-09-14  2:55   ` Val Henson
2001-09-14  3:02     ` Tom Rini
2001-09-14  5:01       ` Matthew Dharm
2001-09-14  6:12         ` Val Henson
2001-09-14  9:12         ` Alan Cox
2001-09-14  6:15       ` Val Henson
2001-09-14  6:47         ` Jeff Garzik
2001-09-14  8:07           ` Kai Henningsen
2001-09-14 20:20             ` Val Henson
2001-09-14  6:49 ` Jeff Garzik
2001-09-14 18:50   ` Cort Dougan
2001-09-14 20:20     ` Val Henson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010913195141.B799@boardwalk \
    --to=val@nmt.edu \
    --cc=becker@scyld.com \
    --cc=jgarzik@mandrakesoft.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox