From owner-svn-src-head@FreeBSD.ORG Mon Mar 1 22:55:36 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 55A84106564A; Mon, 1 Mar 2010 22:55:36 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 29FBD8FC21; Mon, 1 Mar 2010 22:55:36 +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 o21MtaV6041484; Mon, 1 Mar 2010 22:55:36 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o21Mta4q041482; Mon, 1 Mar 2010 22:55:36 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201003012255.o21Mta4q041482@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 1 Mar 2010 22:55:36 +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: r204540 - head/sys/dev/msk 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: Mon, 01 Mar 2010 22:55:36 -0000 Author: yongari Date: Mon Mar 1 22:55:35 2010 New Revision: 204540 URL: http://svn.freebsd.org/changeset/base/204540 Log: Make sure to enable flow-control only if established link is full-duplex. Previously msk(4) used to allow flow-control on 1000baseT half-duplex media. Also GMAC pause is enabled if link partner is capable of handling it. While I'm here use IFM_OPTIONS instead of using IFM_GMASK to check optional flags of link. Modified: head/sys/dev/msk/if_msk.c Modified: head/sys/dev/msk/if_msk.c ============================================================================== --- head/sys/dev/msk/if_msk.c Mon Mar 1 22:43:22 2010 (r204539) +++ head/sys/dev/msk/if_msk.c Mon Mar 1 22:55:35 2010 (r204540) @@ -532,28 +532,25 @@ msk_miibus_statchg(device_t dev) break; } - if (((mii->mii_media_active & IFM_GMASK) & IFM_FDX) != 0) - gmac |= GM_GPCR_DUP_FULL; /* Disable Rx flow control. */ - if (((mii->mii_media_active & IFM_GMASK) & IFM_FLAG0) == 0) + if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FLAG0) == 0) gmac |= GM_GPCR_FC_RX_DIS; /* Disable Tx flow control. */ - if (((mii->mii_media_active & IFM_GMASK) & IFM_FLAG1) == 0) + if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FLAG1) == 0) gmac |= GM_GPCR_FC_TX_DIS; + if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0) + gmac |= GM_GPCR_DUP_FULL; + else + gmac |= GM_GPCR_FC_RX_DIS | GM_GPCR_FC_TX_DIS; gmac |= GM_GPCR_RX_ENA | GM_GPCR_TX_ENA; GMAC_WRITE_2(sc, sc_if->msk_port, GM_GP_CTRL, gmac); /* Read again to ensure writing. */ GMAC_READ_2(sc, sc_if->msk_port, GM_GP_CTRL); - - gmac = GMC_PAUSE_ON; - if (((mii->mii_media_active & IFM_GMASK) & - (IFM_FLAG0 | IFM_FLAG1)) == 0) - gmac = GMC_PAUSE_OFF; - /* Diable pause for 10/100 Mbps in half-duplex mode. */ - if ((((mii->mii_media_active & IFM_GMASK) & IFM_FDX) == 0) && - (IFM_SUBTYPE(mii->mii_media_active) == IFM_100_TX || - IFM_SUBTYPE(mii->mii_media_active) == IFM_10_T)) - gmac = GMC_PAUSE_OFF; + gmac = GMC_PAUSE_OFF; + if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0) { + if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FLAG0) != 0) + gmac = GMC_PAUSE_ON; + } CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL), gmac); /* Enable PHY interrupt for FIFO underrun/overflow. */