From owner-freebsd-bugs@FreeBSD.ORG Fri Sep 3 15:20:04 2010 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3103310656F6 for ; Fri, 3 Sep 2010 15:20:04 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id E357E8FC1F for ; Fri, 3 Sep 2010 15:20:03 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o83FK3D0002053 for ; Fri, 3 Sep 2010 15:20:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o83FK3vj002052; Fri, 3 Sep 2010 15:20:03 GMT (envelope-from gnats) Resent-Date: Fri, 3 Sep 2010 15:20:03 GMT Resent-Message-Id: <201009031520.o83FK3vj002052@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Andrew Boyer Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 78A441065708 for ; Fri, 3 Sep 2010 15:14:06 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 4D7968FC13 for ; Fri, 3 Sep 2010 15:14:06 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o83FE6cj054553 for ; Fri, 3 Sep 2010 15:14:06 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id o83FE5Dn054552; Fri, 3 Sep 2010 15:14:05 GMT (envelope-from nobody) Message-Id: <201009031514.o83FE5Dn054552@www.freebsd.org> Date: Fri, 3 Sep 2010 15:14:05 GMT From: Andrew Boyer To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: misc/150249: [ixgbe] Media type detection broken X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Sep 2010 15:20:04 -0000 >Number: 150249 >Category: misc >Synopsis: [ixgbe] Media type detection broken >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Sep 03 15:20:03 UTC 2010 >Closed-Date: >Last-Modified: >Originator: Andrew Boyer >Release: 7.1p3 >Organization: Avere Systems >Environment: N/A >Description: Intel 82599 adapter cards can use either copper or optical modules. Currently, no matter which type of connection is used, ifconfig will report a media type of 10Gbase-SR. Several changes are required to fix this. 1) In ixgbe_attach(), pci_device_id IXGBE_DEV_ID_82599_SFP causes adapter->optics to be set to IFM_10G_SR. This is incorrect. The "optics" type can not be set until the media is actually detected. (2) In our tree I added a switch statement at the end of ixgbe_handle_mod() to set the optics value based on the return value of hw->mac.ops.get_media_type(). That led me to discover that functions ixgbe_get_media_type_82598() and ixgbe_get_media_type_82599() have flaws: 3) In ixgbe_get_media_type_82598(), device_id IXGBE_DEV_ID_82598_DA_DUAL_PORT returns ixgbe_media_type_fiber, even though the DA card supports only copper. 4) In both, the initial test to detect if there is a copper PHY attached leaves out some possible values for copper PHYs: ixgbe_phy_sfp_passive_tyco ixgbe_phy_sfp_passive_unknown ixgbe_phy_sfp_active_unknown 5) Once you fix this so that ixgbe_get_media_type_*() returns the correct value, you'll notice that ixgbe_identify_sfp_module_generic() stops working for copper cables. This is because it tests for (mac.ops.get_media_type() != ixgbe_media_type_fiber) and returns an error. In our internal tree I have commented out this check completely; the ID routine will fail gracefully if there isn't an SFP present, at least on all of our card types. >How-To-Repeat: Install an 82599 card and SFP+ copper cables. Run 'ifconfig' and observe that the media type is listed as (10Gbase-SR ). >Fix: See suggestions in the Full Description. I could put together a patch if it would help get this fixed in the tree, although a lot of it is in Intel common code (ixgbe_82598.c, ixgbe_82599.c, ixgbe_phy.c). >Release-Note: >Audit-Trail: >Unformatted: