From owner-svn-src-head@freebsd.org Thu Jun 15 21:14:49 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9C058BEF11C; Thu, 15 Jun 2017 21:14:49 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 72E0784A9E; Thu, 15 Jun 2017 21:14:49 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5FLEmSc074949; Thu, 15 Jun 2017 21:14:48 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5FLEmXZ074948; Thu, 15 Jun 2017 21:14:48 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201706152114.v5FLEmXZ074948@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Thu, 15 Jun 2017 21:14:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r319990 - head/sys/dev/bnxt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 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: Thu, 15 Jun 2017 21:14:49 -0000 Author: sbruno Date: Thu Jun 15 21:14:48 2017 New Revision: 319990 URL: https://svnweb.freebsd.org/changeset/base/319990 Log: bnxt(4): Implement temporary workaround in driver to report supported media types that are currently unavailable from the firmware. e.g. 10G, 25G, 50G & 100G Submitted by: bhargava.marreddy@broadcom.com Reviewed by: venkatkumar.duvvuru@broadcom.com Differential Revision: https://reviews.freebsd.org/D10816 Modified: head/sys/dev/bnxt/if_bnxt.c Modified: head/sys/dev/bnxt/if_bnxt.c ============================================================================== --- head/sys/dev/bnxt/if_bnxt.c Thu Jun 15 21:06:03 2017 (r319989) +++ head/sys/dev/bnxt/if_bnxt.c Thu Jun 15 21:14:48 2017 (r319990) @@ -287,7 +287,7 @@ static driver_t bnxt_iflib_driver = { * iflib shared context */ -#define BNXT_DRIVER_VERSION "1.0.0.0" +#define BNXT_DRIVER_VERSION "1.0.0.1" char bnxt_driver_version[] = BNXT_DRIVER_VERSION; extern struct if_txrx bnxt_txrx; static struct if_shared_ctx bnxt_sctx_init = { @@ -1158,7 +1158,12 @@ bnxt_media_status(if_ctx_t ctx, struct ifmediareq * if ifmr->ifm_active |= IFM_1000_SGMII; break; default: - ifmr->ifm_active |= IFM_UNKNOWN; + /* + * Workaround: + * Don't return IFM_UNKNOWN until + * Stratus return proper media_type + */ + ifmr->ifm_active |= IFM_1000_KX; break; } break; @@ -1198,7 +1203,12 @@ bnxt_media_status(if_ctx_t ctx, struct ifmediareq * if ifmr->ifm_active |= IFM_10G_T; break; default: - ifmr->ifm_active |= IFM_UNKNOWN; + /* + * Workaround: + * Don't return IFM_UNKNOWN until + * Stratus return proper media_type + */ + ifmr->ifm_active |= IFM_10G_CR1; break; } break; @@ -1219,7 +1229,12 @@ bnxt_media_status(if_ctx_t ctx, struct ifmediareq * if ifmr->ifm_active |= IFM_25G_SR; break; default: - ifmr->ifm_active |= IFM_UNKNOWN; + /* + * Workaround: + * Don't return IFM_UNKNOWN until + * Stratus return proper media_type + */ + ifmr->ifm_active |= IFM_25G_CR; break; } break; @@ -1255,7 +1270,12 @@ bnxt_media_status(if_ctx_t ctx, struct ifmediareq * if ifmr->ifm_active |= IFM_50G_KR2; break; default: - ifmr->ifm_active |= IFM_UNKNOWN; + /* + * Workaround: + * Don't return IFM_UNKNOWN until + * Stratus return proper media_type + */ + ifmr->ifm_active |= IFM_50G_CR2; break; } break; @@ -1276,7 +1296,12 @@ bnxt_media_status(if_ctx_t ctx, struct ifmediareq * if ifmr->ifm_active |= IFM_100G_SR4; break; default: - ifmr->ifm_active |= IFM_UNKNOWN; + /* + * Workaround: + * Don't return IFM_UNKNOWN until + * Stratus return proper media_type + */ + ifmr->ifm_active |= IFM_100G_CR4; break; } default: @@ -2031,9 +2056,6 @@ bnxt_add_media_types(struct bnxt_softc *softc) ifmedia_add(softc->media, IFM_ETHER | IFM_10G_CR1, 0, NULL); break; - case HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_UNKNOWN: - /* Auto only */ - break; case HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASEKR4: case HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASEKR2: case HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASEKR: @@ -2114,6 +2136,32 @@ bnxt_add_media_types(struct bnxt_softc *softc) if (supported & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_1GB) ifmedia_add(softc->media, IFM_ETHER | IFM_1000_SGMII, 0, NULL); + break; + case HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_UNKNOWN: + default: + /* + * Workaround for Cumulus & Stratus + * For Stratus: + * media_type is being returned as 0x0 + * Return support speeds as 10G, 25G, 50G & 100G + * + * For Cumulus: + * phy_type is being returned as 0x14 (PHY_TYPE_40G_BASECR4) + * Return support speeds as 1G, 10G, 25G & 50G + */ + if (pci_get_device(softc->dev) == BCM57454) { + /* For Stratus: 10G, 25G, 50G & 100G */ + ifmedia_add(softc->media, IFM_ETHER | IFM_100G_CR4, 0, NULL); + ifmedia_add(softc->media, IFM_ETHER | IFM_50G_CR2, 0, NULL); + ifmedia_add(softc->media, IFM_ETHER | IFM_25G_CR, 0, NULL); + ifmedia_add(softc->media, IFM_ETHER | IFM_10G_CR1, 0, NULL); + } else if (pci_get_device(softc->dev) == BCM57414) { + /* For Cumulus: 1G, 10G, 25G & 50G */ + ifmedia_add(softc->media, IFM_ETHER | IFM_50G_CR2, 0, NULL); + ifmedia_add(softc->media, IFM_ETHER | IFM_25G_CR, 0, NULL); + ifmedia_add(softc->media, IFM_ETHER | IFM_10G_CR1, 0, NULL); + ifmedia_add(softc->media, IFM_ETHER | IFM_1000_T, 0, NULL); + } break; }