Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 Mar 2011 21:01:10 +0000 (UTC)
From:      David Christensen <davidch@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r220224 - head/sys/dev/bxe
Message-ID:  <201103312101.p2VL1AJN022616@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: davidch
Date: Thu Mar 31 21:01:10 2011
New Revision: 220224
URL: http://svn.freebsd.org/changeset/base/220224

Log:
  - Print number of queues when RSS is enabled.
  - Improve reporting of media type (not always 10GBase-CX4).
  
  MFC after:	One week

Modified:
  head/sys/dev/bxe/if_bxe.c
  head/sys/dev/bxe/if_bxe.h

Modified: head/sys/dev/bxe/if_bxe.c
==============================================================================
--- head/sys/dev/bxe/if_bxe.c	Thu Mar 31 20:46:50 2011	(r220223)
+++ head/sys/dev/bxe/if_bxe.c	Thu Mar 31 21:01:10 2011	(r220224)
@@ -1036,7 +1036,7 @@ bxe_print_adapter_info(struct bxe_softc 
 		printf("None");
 		break;
 	case ETH_RSS_MODE_REGULAR:
-		printf("RSS");
+		printf("RSS:%d", sc->num_queues);
 		break;
 	default:
 		printf("Unknown");
@@ -1717,14 +1717,6 @@ bxe_attach(device_t dev)
 
 	/* Prepare the tick routine. */
 	callout_init(&sc->bxe_tick_callout, CALLOUT_MPSAFE);
-	ifmedia_init(&sc->bxe_ifmedia, IFM_IMASK, bxe_ifmedia_upd,
-	     bxe_ifmedia_status);
-	ifmedia_add(&sc->bxe_ifmedia, IFM_ETHER | IFM_10G_CX4, 0, NULL);
-	ifmedia_add(&sc->bxe_ifmedia, IFM_ETHER | IFM_10G_CX4 | IFM_FDX, 0,
-	    NULL);
-	ifmedia_add(&sc->bxe_ifmedia, IFM_ETHER | IFM_AUTO, 0, NULL);
-	ifmedia_set(&sc->bxe_ifmedia, IFM_ETHER | IFM_AUTO);
-	sc->bxe_ifmedia.ifm_media = sc->bxe_ifmedia.ifm_cur->ifm_media;
 
 	/* Enable bus master capability */
 	pci_enable_busmaster(dev);
@@ -1778,12 +1770,62 @@ bxe_attach(device_t dev)
 
 	/* Get hardware info from shared memory and validate data. */
 	if (bxe_get_function_hwinfo(sc)) {
-		DBPRINT(sc, BXE_WARN, "%s(): Failed to get hardware info!\n",
-			__FUNCTION__);
+		DBPRINT(sc, BXE_WARN,
+		    "%s(): Failed to get hardware info!\n", __FUNCTION__);
 		rc = ENODEV;
 		goto bxe_attach_fail;
 	}
 
+	/* Identify supported media based on the PHY type. */
+	switch (XGXS_EXT_PHY_TYPE(sc->link_params.ext_phy_config)) {
+	case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT:
+		DBPRINT(sc, BXE_INFO_LOAD,
+		    "%s(): Found 10GBase-CX4 media.\n", __FUNCTION__);
+		sc->media = IFM_10G_CX4;
+		break;
+#if 0
+	/* ToDo: Configure correct media types for these PHYs. */
+	case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8071
+	case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8072
+	case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073
+	case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8705
+	case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8706
+	case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726
+#endif
+	case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727:
+	case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727_NOC:
+		DBPRINT(sc, BXE_INFO_LOAD,
+		    "%s(): Found 10GBase-SR media.\n", __FUNCTION__);
+		sc->media = IFM_10G_SR;
+		break;
+	case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8481:
+	case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SFX7101:
+	case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84823:
+		DBPRINT(sc, BXE_INFO_LOAD,
+		    "%s(): Found 10GBase-T media.\n", __FUNCTION__);
+		sc->media = IFM_10G_T;
+		break;
+	case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_FAILURE:
+	case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_NOT_CONN:
+	default:
+		BXE_PRINTF("%s(%d): PHY not supported by driver!\n",
+		    __FILE__, __LINE__);
+		sc->media = 0;
+		rc = ENODEV;
+		goto bxe_attach_fail;
+	}
+
+	/* Setup supported media options. */
+	ifmedia_init(&sc->bxe_ifmedia,
+	    IFM_IMASK, bxe_ifmedia_upd,	bxe_ifmedia_status);
+	ifmedia_add(&sc->bxe_ifmedia,
+	    IFM_ETHER | sc->media | IFM_FDX, 0,	NULL);
+	ifmedia_add(&sc->bxe_ifmedia,
+	    IFM_ETHER | IFM_AUTO, 0, NULL);
+	ifmedia_set(&sc->bxe_ifmedia,
+	    IFM_ETHER | IFM_AUTO);
+	sc->bxe_ifmedia.ifm_media = sc->bxe_ifmedia.ifm_cur->ifm_media;
+
 	/* Set init arrays */
 	rc = bxe_init_firmware(sc);
 	if (rc) {
@@ -14153,6 +14195,18 @@ bxe_ifmedia_upd(struct ifnet *ifp)
 		DBPRINT(sc, BXE_VERBOSE_PHY,
 	    "%s(): Media set to IFM_10G_CX4, forced mode.\n", __FUNCTION__);
 		break;
+	case IFM_10G_SR:
+		DBPRINT(sc, BXE_VERBOSE_PHY,
+	    "%s(): Media set to IFM_10G_SR, forced mode.\n", __FUNCTION__);
+		break;
+	case IFM_10G_T:
+		DBPRINT(sc, BXE_VERBOSE_PHY,
+	    "%s(): Media set to IFM_10G_T, forced mode.\n", __FUNCTION__);
+		break;
+	case IFM_10G_TWINAX:
+		DBPRINT(sc, BXE_VERBOSE_PHY,
+	    "%s(): Media set to IFM_10G_TWINAX, forced mode.\n", __FUNCTION__);
+		break;
 	default:
 		DBPRINT(sc, BXE_WARN, "%s(): Invalid media type!\n",
 		    __FUNCTION__);
@@ -14198,7 +14252,7 @@ bxe_ifmedia_status(struct ifnet *ifp, st
 		goto bxe_ifmedia_status_exit;
 	}
 
-	ifmr->ifm_active |= IFM_10G_CX4;
+	ifmr->ifm_active |= sc->media;
 
 	if (sc->link_vars.duplex == MEDIUM_FULL_DUPLEX)
 		ifmr->ifm_active |= IFM_FDX;

Modified: head/sys/dev/bxe/if_bxe.h
==============================================================================
--- head/sys/dev/bxe/if_bxe.h	Thu Mar 31 20:46:50 2011	(r220223)
+++ head/sys/dev/bxe/if_bxe.h	Thu Mar 31 21:01:10 2011	(r220224)
@@ -1119,6 +1119,7 @@ struct bxe_softc {
 	 * MUST start with ifnet pointer (see definition of miibus_statchg()).
 	 */
 	struct ifnet		*bxe_ifp;
+	int			media;
 
 	/* Parent device handle. */
 	device_t		bxe_dev;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201103312101.p2VL1AJN022616>