From owner-svn-src-head@FreeBSD.ORG Sun Aug 15 20:52:16 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 624D61065694; Sun, 15 Aug 2010 20:52:16 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3763B8FC17; Sun, 15 Aug 2010 20:52:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7FKqG8J071338; Sun, 15 Aug 2010 20:52:16 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7FKqGZk071336; Sun, 15 Aug 2010 20:52:16 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201008152052.o7FKqGZk071336@svn.freebsd.org> From: Navdeep Parhar Date: Sun, 15 Aug 2010 20:52:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211347 - head/sys/dev/cxgb/common X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Aug 2010 20:52:16 -0000 Author: np Date: Sun Aug 15 20:52:15 2010 New Revision: 211347 URL: http://svn.freebsd.org/changeset/base/211347 Log: Fix tx pause quanta and timer calculations. MFC after: 3 days Modified: head/sys/dev/cxgb/common/cxgb_xgmac.c Modified: head/sys/dev/cxgb/common/cxgb_xgmac.c ============================================================================== --- head/sys/dev/cxgb/common/cxgb_xgmac.c Sun Aug 15 20:45:16 2010 (r211346) +++ head/sys/dev/cxgb/common/cxgb_xgmac.c Sun Aug 15 20:52:15 2010 (r211347) @@ -462,7 +462,7 @@ static int rx_fifo_hwm(int mtu) */ int t3_mac_set_mtu(struct cmac *mac, unsigned int mtu) { - int hwm, lwm, divisor; + int hwm, lwm; int ipg; unsigned int thres, v, reg; adapter_t *adap = mac->adapter; @@ -541,16 +541,6 @@ int t3_mac_set_mtu(struct cmac *mac, uns t3_set_reg_field(adap, A_XGM_TXFIFO_CFG + mac->offset, V_TXFIFOTHRESH(M_TXFIFOTHRESH) | V_TXIPG(M_TXIPG), V_TXFIFOTHRESH(thres) | V_TXIPG(ipg)); - - /* Assuming a minimum drain rate of 2.5Gbps... - */ - if (adap->params.rev > 0) { - divisor = (adap->params.rev == T3_REV_C) ? 64 : 8; - t3_write_reg(adap, A_XGM_PAUSE_TIMER + mac->offset, - (hwm - lwm) * 4 / divisor); - } - t3_write_reg(adap, A_XGM_TX_PAUSE_QUANTA + mac->offset, - MAC_RXFIFO_SIZE * 4 * 8 / 512); return 0; } @@ -570,9 +560,17 @@ int t3_mac_set_speed_duplex_fc(struct cm u32 val; adapter_t *adap = mac->adapter; unsigned int oft = mac->offset; + unsigned int pause_bits; if (duplex >= 0 && duplex != DUPLEX_FULL) return -EINVAL; + + pause_bits = MAC_RXFIFO_SIZE * 4 * 8; + t3_write_reg(adap, A_XGM_TX_PAUSE_QUANTA + mac->offset, + pause_bits / 512); + t3_write_reg(adap, A_XGM_PAUSE_TIMER + mac->offset, + (pause_bits >> (adap->params.rev == T3_REV_C ? 10 : 7))); + if (mac->multiport) { u32 rx_max_pkt_size = G_RXMAXPKTSIZE(t3_read_reg(adap, @@ -581,9 +579,9 @@ int t3_mac_set_speed_duplex_fc(struct cm val &= ~V_RXFIFOPAUSEHWM(M_RXFIFOPAUSEHWM); val |= V_RXFIFOPAUSEHWM(rx_fifo_hwm(rx_max_pkt_size) / 8); t3_write_reg(adap, A_XGM_RXFIFO_CFG + oft, val); - t3_set_reg_field(adap, A_XGM_TX_CFG + oft, F_TXPAUSEEN, F_TXPAUSEEN); + return t3_vsc7323_set_speed_fc(adap, speed, fc, mac->ext_port); } if (speed >= 0) {