summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Cascón <pablo.cascon@netronome.com>2019-03-27 10:27:39 +0000
committerFerruh Yigit <ferruh.yigit@intel.com>2019-03-29 17:25:32 +0100
commit61d4008fe6bb3e6b7fdef8a972245aec2791c45d (patch)
treed0ab9f6b2721cdd8a0cedac17abd2c52af8c7b5a
parentae843c69aa55d25b1c0ef7984501b2356ed5fe88 (diff)
downloaddpdk-next-eventdev-61d4008fe6bb3e6b7fdef8a972245aec2791c45d.zip
dpdk-next-eventdev-61d4008fe6bb3e6b7fdef8a972245aec2791c45d.tar.gz
dpdk-next-eventdev-61d4008fe6bb3e6b7fdef8a972245aec2791c45d.tar.xz
net/nfp: support setting link up/down
Add functions to set the link state up or down. Signed-off-by: Pablo Cascón <pablo.cascon@netronome.com> Acked-by: Alejandro Lucero <alejandro.lucero@netronome.com>
-rw-r--r--drivers/net/nfp/nfp_net.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 611a6ee..3e6178c 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -844,6 +844,48 @@ nfp_net_stop(struct rte_eth_dev *dev)
}
}
+/* Set the link up. */
+static int
+nfp_net_set_link_up(struct rte_eth_dev *dev)
+{
+ struct nfp_net_hw *hw;
+
+ PMD_DRV_LOG(DEBUG, "Set link up");
+
+ hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+ if (!hw->is_pf)
+ return -ENOTSUP;
+
+ if (rte_eal_process_type() == RTE_PROC_PRIMARY)
+ /* Configure the physical port down */
+ return nfp_eth_set_configured(hw->cpp, hw->pf_port_idx, 1);
+ else
+ return nfp_eth_set_configured(dev->process_private,
+ hw->pf_port_idx, 1);
+}
+
+/* Set the link down. */
+static int
+nfp_net_set_link_down(struct rte_eth_dev *dev)
+{
+ struct nfp_net_hw *hw;
+
+ PMD_DRV_LOG(DEBUG, "Set link down");
+
+ hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+ if (!hw->is_pf)
+ return -ENOTSUP;
+
+ if (rte_eal_process_type() == RTE_PROC_PRIMARY)
+ /* Configure the physical port down */
+ return nfp_eth_set_configured(hw->cpp, hw->pf_port_idx, 0);
+ else
+ return nfp_eth_set_configured(dev->process_private,
+ hw->pf_port_idx, 0);
+}
+
/* Reset and stop device. The device can not be restarted. */
static void
nfp_net_close(struct rte_eth_dev *dev)
@@ -2652,6 +2694,8 @@ static const struct eth_dev_ops nfp_net_eth_dev_ops = {
.dev_configure = nfp_net_configure,
.dev_start = nfp_net_start,
.dev_stop = nfp_net_stop,
+ .dev_set_link_up = nfp_net_set_link_up,
+ .dev_set_link_down = nfp_net_set_link_down,
.dev_close = nfp_net_close,
.promiscuous_enable = nfp_net_promisc_enable,
.promiscuous_disable = nfp_net_promisc_disable,