From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 1214DC312 for ; Tue, 16 Jun 2015 10:07:56 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP; 16 Jun 2015 01:07:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,624,1427785200"; d="scan'208";a="509003952" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by FMSMGA003.fm.intel.com with ESMTP; 16 Jun 2015 01:07:55 -0700 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id t5G87rT1027489; Tue, 16 Jun 2015 16:07:53 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id t5G87pgX022243; Tue, 16 Jun 2015 16:07:53 +0800 Received: (from wenzhuol@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t5G87phk022239; Tue, 16 Jun 2015 16:07:51 +0800 From: Wenzhuo Lu To: dev@dpdk.org Date: Tue, 16 Jun 2015 16:07:49 +0800 Message-Id: <1434442069-22208-1-git-send-email-wenzhuo.lu@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dpdk-dev] [PATCH] ixgbe: fix x550 shutdown API issue X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Jun 2015 08:07:57 -0000 For there're only laser ports on x550 before, we only considered laser ports for the testpmd CLIs "port start/stop ...". Now we have new x550 devices which have copper ports. Use the API for copper to enable/disable these ports. And also let the testpmd CLI "set link-up/down ..." support copper ports. Signed-off-by: Wenzhuo Lu --- drivers/net/ixgbe/ixgbe_ethdev.c | 44 +++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 7414a2e..ac7608e 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -1522,8 +1522,13 @@ ixgbe_dev_start(struct rte_eth_dev *dev) goto error; } - /* Turn on the laser */ - ixgbe_enable_tx_laser(hw); + if (hw->mac.ops.get_media_type(hw) == ixgbe_media_type_copper) { + /* Turn on the copper */ + ixgbe_set_phy_power(hw, true); + } else { + /* Turn on the laser */ + ixgbe_enable_tx_laser(hw); + } err = ixgbe_check_link(hw, &speed, &link_up, 0); if (err) @@ -1643,8 +1648,13 @@ ixgbe_dev_stop(struct rte_eth_dev *dev) vf < dev->pci_dev->max_vfs; vf++) vfinfo[vf].clear_to_send = false; - /* Turn off the laser */ - ixgbe_disable_tx_laser(hw); + if (hw->mac.ops.get_media_type(hw) == ixgbe_media_type_copper) { + /* Turn off the copper */ + ixgbe_set_phy_power(hw, false); + } else { + /* Turn off the laser */ + ixgbe_disable_tx_laser(hw); + } ixgbe_dev_clear_queues(dev); @@ -1670,7 +1680,7 @@ ixgbe_dev_stop(struct rte_eth_dev *dev) } /* - * Set device link up: enable tx laser. + * Set device link up: enable tx. */ static int ixgbe_dev_set_link_up(struct rte_eth_dev *dev) @@ -1686,18 +1696,21 @@ ixgbe_dev_set_link_up(struct rte_eth_dev *dev) return -ENOTSUP; } #endif + } + + if (hw->mac.ops.get_media_type(hw) == ixgbe_media_type_copper) { + /* Turn on the copper */ + ixgbe_set_phy_power(hw, true); + } else { /* Turn on the laser */ ixgbe_enable_tx_laser(hw); - return 0; } - PMD_INIT_LOG(ERR, "Set link up is not supported by device id 0x%x", - hw->device_id); - return -ENOTSUP; + return 0; } /* - * Set device link down: disable tx laser. + * Set device link down: disable tx. */ static int ixgbe_dev_set_link_down(struct rte_eth_dev *dev) @@ -1713,14 +1726,17 @@ ixgbe_dev_set_link_down(struct rte_eth_dev *dev) return -ENOTSUP; } #endif + } + + if (hw->mac.ops.get_media_type(hw) == ixgbe_media_type_copper) { + /* Turn off the copper */ + ixgbe_set_phy_power(hw, false); + } else { /* Turn off the laser */ ixgbe_disable_tx_laser(hw); - return 0; } - PMD_INIT_LOG(ERR, "Set link down is not supported by device id 0x%x", - hw->device_id); - return -ENOTSUP; + return 0; } /* -- 1.9.3