Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Mar 2015 08:22:11 +0000 (UTC)
From:      Marcelo Araujo <araujo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r279803 - head/sys/dev/ixgbe
Message-ID:  <201503090822.t298MBpV073895@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: araujo (ports committer)
Date: Mon Mar  9 08:22:11 2015
New Revision: 279803
URL: https://svnweb.freebsd.org/changeset/base/279803

Log:
  Fix the media detected for copper cables NIC based on chipset X540T.
  
  Phabric:        D811
  Reviewed by:    jfvogel
  Approved by:	jfvogel
  Sponsored by:   QNAP Systems Inc.

Modified:
  head/sys/dev/ixgbe/ixgbe.c

Modified: head/sys/dev/ixgbe/ixgbe.c
==============================================================================
--- head/sys/dev/ixgbe/ixgbe.c	Mon Mar  9 04:00:46 2015	(r279802)
+++ head/sys/dev/ixgbe/ixgbe.c	Mon Mar  9 08:22:11 2015	(r279803)
@@ -1699,6 +1699,7 @@ static void
 ixgbe_media_status(struct ifnet * ifp, struct ifmediareq * ifmr)
 {
 	struct adapter *adapter = ifp->if_softc;
+       struct ixgbe_hw *hw = &adapter->hw;
 
 	INIT_DEBUGOUT("ixgbe_media_status: begin");
 	IXGBE_CORE_LOCK(adapter);
@@ -1714,17 +1715,29 @@ ixgbe_media_status(struct ifnet * ifp, s
 
 	ifmr->ifm_status |= IFM_ACTIVE;
 
-	switch (adapter->link_speed) {
-		case IXGBE_LINK_SPEED_100_FULL:
-			ifmr->ifm_active |= IFM_100_TX | IFM_FDX;
-			break;
-		case IXGBE_LINK_SPEED_1GB_FULL:
-			ifmr->ifm_active |= IFM_1000_SX | IFM_FDX;
-			break;
-		case IXGBE_LINK_SPEED_10GB_FULL:
-			ifmr->ifm_active |= adapter->optics | IFM_FDX;
-			break;
-	}
+       /*
+        * Not all NIC are 1000baseSX as an example X540T.
+        * We must set properly the media based on NIC model.
+        */
+       switch (hw->device_id) {
+              case IXGBE_DEV_ID_X540T:
+      			if (adapter->link_speed == IXGBE_LINK_SPEED_100_FULL)
+                            	ifmr->ifm_active |= IFM_100_TX | IFM_FDX;
+                     	else if (adapter->link_speed == IXGBE_LINK_SPEED_1GB_FULL)
+                            	ifmr->ifm_active |= IFM_1000_T | IFM_FDX;
+                     	else if (adapter->link_speed == IXGBE_LINK_SPEED_10GB_FULL)
+                            	ifmr->ifm_active |= adapter->optics | IFM_FDX;
+                     	break;
+              default:
+                     	if (adapter->link_speed == IXGBE_LINK_SPEED_100_FULL)
+                            	ifmr->ifm_active |= IFM_100_TX | IFM_FDX;
+                     	else if (adapter->link_speed == IXGBE_LINK_SPEED_1GB_FULL)
+                            	ifmr->ifm_active |= IFM_1000_SX | IFM_FDX;
+                     	else if (adapter->link_speed == IXGBE_LINK_SPEED_10GB_FULL)
+                            	ifmr->ifm_active |= adapter->optics | IFM_FDX;
+                     	break;
+       }
+
 
 	IXGBE_CORE_UNLOCK(adapter);
 



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