From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 644FBA05D3 for ; Wed, 27 Mar 2019 11:28:11 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2D2EE5F2A; Wed, 27 Mar 2019 11:28:11 +0100 (CET) Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by dpdk.org (Postfix) with ESMTP id B18575F0F for ; Wed, 27 Mar 2019 11:28:09 +0100 (CET) Received: by mail-wm1-f66.google.com with SMTP id h18so16145043wml.1 for ; Wed, 27 Mar 2019 03:28:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=iJ2e7i2D3rjUV7Uu6Ao9VV369T0TstEjUMaeuACEiGM=; b=b+SiNEqgK78LY6Xju5i3ZMXjry6JYG+w69I7fkws0qSd/9HInPwNQP9xQ4SQac+GQf 66WOx+BiodtnE5lg0sxDwYJUbnCk5it5LX4oKFB0tJ32Zi8Yix7EtjAQy/uyd9fswX+u qRrJkIkXQmgn2DXbliT6qu7ukyt2KcmnckQzk1LZwhRu4NQZN9o282KaZr1S6YGvWJhq JXnZMNzIRvuyV5cXRkas1unroE36w4mseTp93aR112LQTTWP7zlyIXw35+uBwRPq2BKg 3wmhonEDeFRfZqHD6XW+zEcPycwIZjJ1utjZSPcsOBn5RCNQqElpW5BKTkBRfvFRMzQu a2Fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=iJ2e7i2D3rjUV7Uu6Ao9VV369T0TstEjUMaeuACEiGM=; b=LKtWbRATWAMRzlLqlGuNA1CqzYVoJgsvKDwYMAqW6/29wPjI0j5G6nwnkRlpEK4vPX rbBT9o+qY9YCKp7PzIh4gsLoUI3mDwD+yK2vZs5v2DLIpcsXCL0JBWXAx8tf3UeXV+Zk tAAspx30WErlc6AWbi7MdxWfVkO+OZ30VK36MOwBx98SSJ+E10PKgjB/L2/xNdbv1MG5 E6p8jUkJO3wNmKGYdBTlqMi9uXn7SSLzHSzv7zek6YHWarhluDBTE5LP14D1+ZO74/YZ gbAl1iiHOlawvpKxUzLbeDb/SqS2larVdV1rkl/iWPWeBivPm5+Qinre9EYE2Y46TMdm +xXA== X-Gm-Message-State: APjAAAVmG9mfP1m3FQ6OCVWA1ao56ldtbnATcv82ETfzbPOZqcR8q2+i EOrHark5xS8qD9OnTuhWioJAMjCxLN+oww== X-Google-Smtp-Source: APXvYqyaqFAI2i5xKqnwJ20Mdr7EJBTMLYGsBbULpzcxaWJy4Gwb1r7+Robq2GHAWAWuDFWvaDAWcQ== X-Received: by 2002:a7b:c4d2:: with SMTP id g18mr10316228wmk.108.1553682489221; Wed, 27 Mar 2019 03:28:09 -0700 (PDT) Received: from cbvirt1-3.netronome.com ([217.38.71.146]) by smtp.googlemail.com with ESMTPSA id x192sm23799747wmf.48.2019.03.27.03.28.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 27 Mar 2019 03:28:08 -0700 (PDT) From: =?UTF-8?q?Pablo=20Casc=C3=B3n?= To: dev@dpdk.org Cc: =?UTF-8?q?Pablo=20Casc=C3=B3n?= Date: Wed, 27 Mar 2019 10:27:39 +0000 Message-Id: <1553682459-30922-1-git-send-email-pablo.cascon@netronome.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 1/1] net/nfp: add support for set link up/down X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190327102739.61C0E67K4mL_-sX1nYwkWGCAYENvbn9y8bsAIhUnST4@z> Add functions to set the link state up or down. Signed-off-by: Pablo Cascón Acked-by: Alejandro Lucero --- drivers/net/nfp/nfp_net.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index a791e95..f86afa7 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -841,6 +841,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) @@ -2649,6 +2691,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, -- 2.7.4