From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 08A9DA058E; Wed, 25 Mar 2020 03:58:14 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 620752BCE; Wed, 25 Mar 2020 03:58:14 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 55E781E34 for ; Wed, 25 Mar 2020 03:58:12 +0100 (CET) IronPort-SDR: 4AuK38Wams+Aasv4ZEABNM+/0OQv9fXdVoD/wJgtLVOyuwA/7//8rx2GNhGO1Rg7A/OwuVjcFE sTxRXvZ6fCtQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2020 19:58:11 -0700 IronPort-SDR: pa0CWoAJst6UYKrMMw1aoe+3lI5sxScfI3NoaepatpnoMBSsqkl38xt02Hf9gIMZF5JbxycxHh aAkC5LHnwlgw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,302,1580803200"; d="scan'208";a="265390330" Received: from intel.sh.intel.com ([10.239.255.137]) by orsmga002.jf.intel.com with ESMTP; 24 Mar 2020 19:58:09 -0700 From: Lunyuan Cui To: dev@dpdk.org Cc: Jingjing Wu , Qiming Yang , Lunyuan Cui Date: Wed, 25 Mar 2020 02:47:58 +0000 Message-Id: <20200325024758.132253-1-lunyuanx.cui@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] net/iavf: enable port reset 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" This patch is intended to add iavf_dev_reset ops, enable iavf to support "port reset all". Signed-off-by: Lunyuan Cui --- drivers/net/iavf/iavf_ethdev.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index 34913f9c4..01366bc3c 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -32,6 +32,7 @@ static int iavf_dev_configure(struct rte_eth_dev *dev); static int iavf_dev_start(struct rte_eth_dev *dev); static void iavf_dev_stop(struct rte_eth_dev *dev); static void iavf_dev_close(struct rte_eth_dev *dev); +static int iavf_dev_reset(struct rte_eth_dev *dev); static int iavf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info); static const uint32_t *iavf_dev_supported_ptypes_get(struct rte_eth_dev *dev); @@ -91,6 +92,7 @@ static const struct eth_dev_ops iavf_eth_dev_ops = { .dev_start = iavf_dev_start, .dev_stop = iavf_dev_stop, .dev_close = iavf_dev_close, + .dev_reset = iavf_dev_reset, .dev_infos_get = iavf_dev_info_get, .dev_supported_ptypes_get = iavf_dev_supported_ptypes_get, .link_update = iavf_dev_link_update, @@ -1416,6 +1418,23 @@ iavf_dev_uninit(struct rte_eth_dev *dev) return 0; } +/* + * Reset VF device only to re-initialize resources in PMD layer + */ +static int +iavf_dev_reset(struct rte_eth_dev *dev) +{ + int ret; + + ret = iavf_dev_uninit(dev); + if (ret) + return ret; + + ret = iavf_dev_init(dev); + + return ret; +} + static int eth_iavf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, struct rte_pci_device *pci_dev) { -- 2.17.1