cxgb3 - Tighten xgmac workaround
authorDivy Le Ray <divy@chelsio.com>
Sat, 31 Mar 2007 07:23:24 +0000 (00:23 -0700)
committerJeff Garzik <jeff@garzik.org>
Wed, 4 Apr 2007 02:31:09 +0000 (22:31 -0400)
Run the watchdog task when the link is up.
Flush the XGMAC Tx FIFO when the link drops.

Also remove a statistics update that should have gone
in the previous modification of xgmac.c.

Signed-off-by: Divy Le Ray <divy@chelsio.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/net/cxgb3/cxgb3_main.c
drivers/net/cxgb3/regs.h
drivers/net/cxgb3/xgmac.c

index 145b67cc1d2ec7a7402d2f268aae5e9c28f9f4b1..512daf738948709f6f01af41a3a703f90f469394 100644 (file)
@@ -185,16 +185,26 @@ void t3_os_link_changed(struct adapter *adapter, int port_id, int link_stat,
                        int speed, int duplex, int pause)
 {
        struct net_device *dev = adapter->port[port_id];
+       struct port_info *pi = netdev_priv(dev);
+       struct cmac *mac = &pi->mac;
 
        /* Skip changes from disabled ports. */
        if (!netif_running(dev))
                return;
 
        if (link_stat != netif_carrier_ok(dev)) {
-               if (link_stat)
+               if (link_stat) {
+                       t3_set_reg_field(adapter,
+                                        A_XGM_TXFIFO_CFG + mac->offset,
+                                        F_ENDROPPKT, 0);
                        netif_carrier_on(dev);
-               else
+               } else {
                        netif_carrier_off(dev);
+                       t3_set_reg_field(adapter,
+                                        A_XGM_TXFIFO_CFG + mac->offset,
+                                        F_ENDROPPKT, F_ENDROPPKT);
+               }
+
                link_report(dev);
        }
 }
@@ -2119,7 +2129,7 @@ static void check_t3b2_mac(struct adapter *adapter)
                        continue;
 
                status = 0;
-               if (netif_running(dev))
+               if (netif_running(dev) && netif_carrier_ok(dev))
                        status = t3b2_mac_watchdog_task(&p->mac);
                if (status == 1)
                        p->mac.stats.num_toggled++;
index b38629a244d0f10472ee9e7ee87295cd777e78c7..f8be41c5a0817b7fcbb94f95c364f8f20558e267 100644 (file)
 
 #define V_TXFIFOTHRESH(x) ((x) << S_TXFIFOTHRESH)
 
+#define S_ENDROPPKT    21
+#define V_ENDROPPKT(x) ((x) << S_ENDROPPKT)
+#define F_ENDROPPKT    V_ENDROPPKT(1U)
+
 #define A_XGM_SERDES_CTRL 0x890
 #define A_XGM_SERDES_CTRL0 0x8e0
 
index 2b42c13ba8e0331a44029786c591bd129482bbda..94aaff005a355fd352123001fadacdf20f0a59c1 100644 (file)
@@ -471,7 +471,6 @@ const struct mac_stats *t3_mac_update_stats(struct cmac *mac)
        RMON_UPDATE(mac, rx_symbol_errs, RX_SYM_CODE_ERR_FRAMES);
 
        RMON_UPDATE(mac, rx_too_long, RX_OVERSIZE_FRAMES);
-       mac->stats.rx_too_long += RMON_READ(mac, A_XGM_RX_MAX_PKT_SIZE_ERR_CNT);
 
        v = RMON_READ(mac, A_XGM_RX_MAX_PKT_SIZE_ERR_CNT);
        if (mac->adapter->params.rev == T3_REV_B2)