From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 0AAE7594F for ; Thu, 22 May 2014 08:11:18 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 21 May 2014 23:11:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.98,885,1392192000"; d="scan'208";a="535850276" Received: from shilc102.sh.intel.com ([10.239.39.44]) by fmsmga001.fm.intel.com with ESMTP; 21 May 2014 23:11:26 -0700 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shilc102.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id s4M6BMCo026772; Thu, 22 May 2014 14:11:24 +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 s4M6BJVH032126; Thu, 22 May 2014 14:11:22 +0800 Received: (from couyang@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id s4M6BJfK032122; Thu, 22 May 2014 14:11:19 +0800 From: Ouyang Changchun To: dev@dpdk.org Date: Thu, 22 May 2014 14:11:12 +0800 Message-Id: <1400739073-32011-3-git-send-email-changchun.ouyang@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <1400739073-32011-1-git-send-email-changchun.ouyang@intel.com> References: <1400739073-32011-1-git-send-email-changchun.ouyang@intel.com> Subject: [dpdk-dev] [PATCH 2/3] ixgbe: Implement the functionality of administrative link up and down in IXGBE PMD 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: Thu, 22 May 2014 06:11:19 -0000 This patch implements the functionality of administrative link up and down in IXGBE PMD. Signed-off-by: Ouyang Changchun --- lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 58 +++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c index 76f09af..b6ffad0 100644 --- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c +++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c @@ -98,6 +98,8 @@ static int eth_ixgbe_dev_init(struct eth_driver *eth_drv, static int ixgbe_dev_configure(struct rte_eth_dev *dev); static int ixgbe_dev_start(struct rte_eth_dev *dev); static void ixgbe_dev_stop(struct rte_eth_dev *dev); +static int ixgbe_dev_admin_link_up(struct rte_eth_dev *dev); +static int ixgbe_dev_admin_link_down(struct rte_eth_dev *dev); static void ixgbe_dev_close(struct rte_eth_dev *dev); static void ixgbe_dev_promiscuous_enable(struct rte_eth_dev *dev); static void ixgbe_dev_promiscuous_disable(struct rte_eth_dev *dev); @@ -263,6 +265,8 @@ static struct eth_dev_ops ixgbe_eth_dev_ops = { .dev_configure = ixgbe_dev_configure, .dev_start = ixgbe_dev_start, .dev_stop = ixgbe_dev_stop, + .dev_admin_link_up = ixgbe_dev_admin_link_up, + .dev_admin_link_down = ixgbe_dev_admin_link_down, .dev_close = ixgbe_dev_close, .promiscuous_enable = ixgbe_dev_promiscuous_enable, .promiscuous_disable = ixgbe_dev_promiscuous_disable, @@ -1487,6 +1491,60 @@ ixgbe_dev_stop(struct rte_eth_dev *dev) } /* + * Link up device administratively: enable tx laser. + */ +static int +ixgbe_dev_admin_link_up(struct rte_eth_dev *dev) +{ + struct ixgbe_hw *hw = + IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + if (hw->mac.type == ixgbe_mac_82599EB) { +#ifdef RTE_NIC_BYPASS + if (hw->device_id == IXGBE_DEV_ID_82599_BYPASS) { + /* Not suported in bypass mode */ + PMD_INIT_LOG(ERR, "\nAdmin link up is not supported by device id 0x%x\n", + hw->device_id); + return -ENOTSUP; + } +#endif + /* Turn on the laser */ + ixgbe_enable_tx_laser(hw); + return 0; + } + + PMD_INIT_LOG(ERR, "\nAdmin link up is not supported by device id 0x%x\n", + hw->device_id); + return -ENOTSUP; +} + +/* + * Link down device administratively: disable tx laser. + */ +static int +ixgbe_dev_admin_link_down(struct rte_eth_dev *dev) +{ + struct ixgbe_hw *hw = + IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + if (hw->mac.type == ixgbe_mac_82599EB) { +#ifdef RTE_NIC_BYPASS + if (hw->device_id == IXGBE_DEV_ID_82599_BYPASS) { + /* Not suported in bypass mode */ + PMD_INIT_LOG(ERR, "\nAdmin link down is not supported by device id 0x%x\n", + hw->device_id); + return -ENOTSUP; + } +#endif + /* Turn off the laser */ + ixgbe_disable_tx_laser(hw); + return 0; + } + + PMD_INIT_LOG(ERR, "\nAdmin link down is not supported by device id 0x%x\n", + hw->device_id); + return -ENOTSUP; +} + +/* * Reest and stop device. */ static void -- 1.9.0