Skip to content

Commit

Permalink
cxgb3 - Tighten xgmac workaround
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Divy Le Ray authored and Jeff Garzik committed Apr 4, 2007
1 parent 8ac3ba6 commit 6d6daba
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
16 changes: 13 additions & 3 deletions drivers/net/cxgb3/cxgb3_main.c
Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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++;
Expand Down
4 changes: 4 additions & 0 deletions drivers/net/cxgb3/regs.h
Expand Up @@ -1940,6 +1940,10 @@

#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

Expand Down
1 change: 0 additions & 1 deletion drivers/net/cxgb3/xgmac.c
Expand Up @@ -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)
Expand Down

0 comments on commit 6d6daba

Please sign in to comment.