From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-it0-f50.google.com (mail-it0-f50.google.com [209.85.214.50]) by dpdk.org (Postfix) with ESMTP id 36D785424 for ; Mon, 27 Jun 2016 17:46:37 +0200 (CEST) Received: by mail-it0-f50.google.com with SMTP id f6so64920138ith.0 for ; Mon, 27 Jun 2016 08:46:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arbor.net; s=m0; h=from:to:cc:subject:date:message-id; bh=LvwWa1tNePBkMUR9He1jRgU9LQjAO2pH3ObetfEK90Y=; b=nnYVATas8kPAgjiNZi6sEcWXfrJiqbLjNYckcycUguAZkg7QlLim7ciXG24M5ic51F 3uG2D4Z9/e6Vi4XAXO8+Y8Yppg+6A6QSU5nwmg39BhTMzw2VuDJC71+k/9UT7+YY9Ezj 3vGRemW1KHoznz3hFbCj+9RbAWzB+/+xxBkEc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=LvwWa1tNePBkMUR9He1jRgU9LQjAO2pH3ObetfEK90Y=; b=ltN3rHkFz1vEg3H1nJW0c1rlzwVEzs1luHIhTSGymYI2ql5FxDLpAsgYWYNPy0WRLC igUIgBnOSNwKnned5+hcHad7/AEf0dnfpKZDJleQ/hgWogqMGURz1wa50hqC/A409ZiV t4V1HY0D+XmAUMqu036S9Y2rQ628oXvcGyk6r8eyj9vKlidu2ZxVkz66pQuGJ3NlHD7n NDA+mj0lME+Ee0u1kCQeBgq9rCptT40+S7wevMgUGG9abFis5zEGMHuKmwrexZC+sOwF A1fT8M4ViwHMLbVjuyYoMp28Vm2MPSjkbcHZtp5VWj8pxytOpkZf1n2qdCGOlKX04dqs hbxg== X-Gm-Message-State: ALyK8tIwGba2neAja9jyONtxyzuNH7YzQed50VB19K+XwroV3w07iiXrMjXCWrR/0Zaqgh2J X-Received: by 10.36.65.71 with SMTP id x68mr9482191ita.86.1467042396625; Mon, 27 Jun 2016 08:46:36 -0700 (PDT) Received: from precision.x41s (hlfxns016cw-142134145019.dhcp-dynamic.FibreOP.ns.bellaliant.net. [142.134.145.19]) by smtp.gmail.com with ESMTPSA id 80sm9586377ior.29.2016.06.27.08.46.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Jun 2016 08:46:36 -0700 (PDT) From: Aaron Campbell To: dev@dpdk.org Cc: Aaron Campbell Date: Mon, 27 Jun 2016 12:46:25 -0300 Message-Id: <1467042385-3592-1-git-send-email-aaron@arbor.net> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH] igb: support setting link up or down 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: Mon, 27 Jun 2016 15:46:37 -0000 Add driver functions to set link state up or down. Signed-off-by: Aaron Campbell --- drivers/net/e1000/igb_ethdev.c | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index b822992..f8df691 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -89,6 +89,8 @@ static int eth_igb_configure(struct rte_eth_dev *dev); static int eth_igb_start(struct rte_eth_dev *dev); static void eth_igb_stop(struct rte_eth_dev *dev); +static int eth_igb_dev_set_link_up(struct rte_eth_dev *dev); +static int eth_igb_dev_set_link_down(struct rte_eth_dev *dev); static void eth_igb_close(struct rte_eth_dev *dev); static void eth_igb_promiscuous_enable(struct rte_eth_dev *dev); static void eth_igb_promiscuous_disable(struct rte_eth_dev *dev); @@ -322,6 +324,8 @@ static const struct eth_dev_ops eth_igb_ops = { .dev_configure = eth_igb_configure, .dev_start = eth_igb_start, .dev_stop = eth_igb_stop, + .dev_set_link_up = eth_igb_dev_set_link_up, + .dev_set_link_down = eth_igb_dev_set_link_down, .dev_close = eth_igb_close, .promiscuous_enable = eth_igb_promiscuous_enable, .promiscuous_disable = eth_igb_promiscuous_disable, @@ -1151,7 +1155,7 @@ eth_igb_start(struct rte_eth_dev *dev) rte_intr_disable(intr_handle); /* Power up the phy. Needed to make the link go Up */ - e1000_power_up_phy(hw); + eth_igb_dev_set_link_up(dev); /* * Packet Buffer Allocation (PBA) @@ -1357,10 +1361,7 @@ eth_igb_stop(struct rte_eth_dev *dev) } /* Power down the phy. Needed to make the link go Down */ - if (hw->phy.media_type == e1000_media_type_copper) - e1000_power_down_phy(hw); - else - e1000_shutdown_fiber_serdes_link(hw); + eth_igb_dev_set_link_down(dev); igb_dev_clear_queues(dev); @@ -1407,6 +1408,32 @@ eth_igb_stop(struct rte_eth_dev *dev) } } +static int +eth_igb_dev_set_link_up(struct rte_eth_dev *dev) +{ + struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + if (hw->phy.media_type == e1000_media_type_copper) + e1000_power_up_phy(hw); + else + e1000_power_up_fiber_serdes_link(hw); + + return 0; +} + +static int +eth_igb_dev_set_link_down(struct rte_eth_dev *dev) +{ + struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + if (hw->phy.media_type == e1000_media_type_copper) + e1000_power_down_phy(hw); + else + e1000_shutdown_fiber_serdes_link(hw); + + return 0; +} + static void eth_igb_close(struct rte_eth_dev *dev) { -- 2.7.4