Re: Sun GEM card looses TX on x86 32bit PCI

From: David S. Miller (davem@redhat.com)
Date: Sun Mar 10 2002 - 20:39:35 EST


   From: Beezly <beezly@beezly.org.uk>
   Date: 10 Mar 2002 20:36:59 +0000

   Unfortunately not. I've just applied these changes and recompiled, but
   I'm suffering exactly the same problem.
   
   This is what I have this time when the card has stopped receiving;

Please add this patch on top of what you have. I still want the
kernel logs from the failure case that I asked for an hour ago
though, I really need to know if systems seeing this problem have
Pause enabled on the link or not.

--- drivers/net/sungem.c.~1~ Sun Mar 10 00:12:34 2002
+++ drivers/net/sungem.c Sun Mar 10 17:29:33 2002
@@ -299,19 +299,39 @@
                         gp->dev->name, rxmac_stat);
 
         if (rxmac_stat & MAC_RXSTAT_OFLW) {
- u32 smac = readl(gp->regs + MAC_SMACHINE);
+ int limit;
 
- printk(KERN_ERR "%s: RX MAC fifo overflow smac[%08x].\n",
- dev->name, smac);
                 gp->net_stats.rx_over_errors++;
                 gp->net_stats.rx_fifo_errors++;
 
- if (((smac >> 24) & 0x7) == 0x7) {
- /* Due to a bug, the chip is hung in this case
- * and a full reset is necessary.
- */
+ /* Reset the RX MAC then re-enable it. */
+ writel(MAC_RXRST_CMD, gp->regs + MAC_RXRST);
+ for (limit = 0; limit < 5000; limit++) {
+ if (!(readl(gp->regs + MAC_RXRST) & MAC_RXRST_CMD))
+ break;
+ udelay(10);
+ }
+ if (limit == 5000) {
+ printk(KERN_ERR "%s: RX MAC will not reset, resetting whole "
+ "chip.\n", dev->name);
                         ret = 1;
+ goto out;
                 }
+
+ writel(0, gp->regs + MAC_RXCFG);
+ for (limit = 0; limit < 5000; limit++) {
+ if (!(readl(gp->regs + MAC_RXCFG) & MAC_RXCFG_ENAB))
+ break;
+ udelay(10);
+ }
+ if (limit == 5000) {
+ printk(KERN_ERR "%s: RX MAC will not disable, resetting whole "
+ "chip.\n", dev->name);
+ ret = 1;
+ goto out;
+ }
+
+ writel(gp->mac_rx_cfg | MAC_RXCFG_ENAB, gp->regs + MAC_RXCFG);
         }
 
         if (rxmac_stat & MAC_RXSTAT_ACE)
@@ -323,6 +343,7 @@
         if (rxmac_stat & MAC_RXSTAT_LCE)
                 gp->net_stats.rx_length_errors += 0x10000;
 
+out:
         /* We do not track MAC_RXSTAT_FCE and MAC_RXSTAT_VCE
          * events.
          */
@@ -1830,7 +1851,6 @@
 static void gem_init_mac(struct gem *gp)
 {
         unsigned char *e = &gp->dev->dev_addr[0];
- u32 rxcfg;
 
         if (gp->pdev->vendor == PCI_VENDOR_ID_SUN &&
             gp->pdev->device == PCI_DEVICE_ID_SUN_GEM)
@@ -1870,7 +1890,7 @@
         writel(0, gp->regs + MAC_AF21MSK);
         writel(0, gp->regs + MAC_AF0MSK);
 
- rxcfg = gem_setup_multicast(gp);
+ gp->mac_rx_cfg = gem_setup_multicast(gp);
 
         writel(0, gp->regs + MAC_NCOLL);
         writel(0, gp->regs + MAC_FASUCC);
@@ -1888,7 +1908,7 @@
          * them once a link is established.
          */
         writel(0, gp->regs + MAC_TXCFG);
- writel(rxcfg, gp->regs + MAC_RXCFG);
+ writel(gp->mac_rx_cfg, gp->regs + MAC_RXCFG);
         writel(0, gp->regs + MAC_MCCFG);
         writel(0, gp->regs + MAC_XIFCFG);
 
@@ -2441,7 +2461,7 @@
         netif_stop_queue(dev);
 
         rxcfg = readl(gp->regs + MAC_RXCFG);
- rxcfg_new = gem_setup_multicast(gp);
+ gp->mac_rx_cfg = rxcfg_new = gem_setup_multicast(gp);
         
         writel(rxcfg & ~MAC_RXCFG_ENAB, gp->regs + MAC_RXCFG);
         while (readl(gp->regs + MAC_RXCFG) & MAC_RXCFG_ENAB) {
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Mar 15 2002 - 22:00:14 EST