From patchwork Thu Aug 24 16:20:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alejandro Lucero X-Patchwork-Id: 27899 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id E6CB59121; Thu, 24 Aug 2017 18:20:54 +0200 (CEST) Received: from netronome.com (host-79-78-33-110.static.as9105.net [79.78.33.110]) by dpdk.org (Postfix) with ESMTP id 4264A7D36 for ; Thu, 24 Aug 2017 18:20:36 +0200 (CEST) Received: from netronome.com (localhost [127.0.0.1]) by netronome.com (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id v7OGKP8r016349 for ; Thu, 24 Aug 2017 17:20:25 +0100 Received: (from alucero@localhost) by netronome.com (8.14.4/8.14.4/Submit) id v7OGKPP8016348 for dev@dpdk.org; Thu, 24 Aug 2017 17:20:25 +0100 From: Alejandro Lucero To: dev@dpdk.org Date: Thu, 24 Aug 2017 17:20:20 +0100 Message-Id: <1503591622-16232-15-git-send-email-alejandro.lucero@netronome.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1503591622-16232-1-git-send-email-alejandro.lucero@netronome.com> References: <1503591622-16232-1-git-send-email-alejandro.lucero@netronome.com> Subject: [dpdk-dev] [PATCH 14/16] nfp: add support for hw port link configuration 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" It is PMD task to configure the hardware port: link up when port started and link down when port stopped. This is not required for VFs but it is for PF ports. A minor refactoring in PMD stop and close functions is done because the Link down needs to happen just when device is stopped. Signed-off-by: Alejandro Lucero --- drivers/net/nfp/nfp_net.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index f9ce204..aa611e1 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -737,6 +737,10 @@ static void nfp_net_read_mac(struct nfp_net_hw *hw) goto error; } + if (hw->is_pf) + /* Configure the physical port up */ + nfp_nsp_eth_config(hw->nspu_desc, hw->pf_port_idx, 1); + hw->ctrl = new_ctrl; return 0; @@ -765,9 +769,12 @@ static void nfp_net_read_mac(struct nfp_net_hw *hw) nfp_net_stop(struct rte_eth_dev *dev) { int i; + struct nfp_net_hw *hw; PMD_INIT_LOG(DEBUG, "Stop"); + hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + nfp_net_disable_queues(dev); /* Clear queues */ @@ -780,6 +787,10 @@ static void nfp_net_read_mac(struct nfp_net_hw *hw) nfp_net_reset_rx_queue( (struct nfp_net_rxq *)dev->data->rx_queues[i]); } + + if (hw->is_pf) + /* Configure the physical port down */ + nfp_nsp_eth_config(hw->nspu_desc, hw->pf_port_idx, 0); } /* Reset and stop device. The device can not be restarted. */ @@ -788,6 +799,7 @@ static void nfp_net_read_mac(struct nfp_net_hw *hw) { struct nfp_net_hw *hw; struct rte_pci_device *pci_dev; + int i; PMD_INIT_LOG(DEBUG, "Close"); @@ -799,7 +811,18 @@ static void nfp_net_read_mac(struct nfp_net_hw *hw) * threads/queues before calling the device close function. */ - nfp_net_stop(dev); + nfp_net_disable_queues(dev); + + /* Clear queues */ + for (i = 0; i < dev->data->nb_tx_queues; i++) { + nfp_net_reset_tx_queue( + (struct nfp_net_txq *)dev->data->tx_queues[i]); + } + + for (i = 0; i < dev->data->nb_rx_queues; i++) { + nfp_net_reset_rx_queue( + (struct nfp_net_rxq *)dev->data->rx_queues[i]); + } rte_intr_disable(&pci_dev->intr_handle); nn_cfg_writeb(hw, NFP_NET_CFG_LSC, 0xff);