From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id E5D2D100C for ; Wed, 8 Aug 2018 09:00:07 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Aug 2018 00:00:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,456,1526367600"; d="scan'208";a="79500671" Received: from dpdk51.sh.intel.com ([10.67.110.190]) by fmsmga001.fm.intel.com with ESMTP; 08 Aug 2018 00:00:04 -0700 From: Qi Zhang To: thomas@monjalon.net, konstantin.ananyev@intel.com, declan.doherty@intel.com, ferruh.yigit@intel.com Cc: dev@dpdk.org, benjamin.h.shelton@intel.com, narender.vangati@intel.com, beilei.xing@intel.com, wenzhuo.lu@intel.com, 0000-cover-letter.patch, Qi Zhang Date: Wed, 8 Aug 2018 15:00:44 +0800 Message-Id: <20180808070045.13334-3-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180808070045.13334-1-qi.z.zhang@intel.com> References: <20180808070045.13334-1-qi.z.zhang@intel.com> Subject: [dpdk-dev] [RFC 3/4] net/ixgbe: enable async device 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: , X-List-Received-Date: Wed, 08 Aug 2018 07:00:08 -0000 Handle device reset in a separate thread and raise RTE_ETH_EVENT_RESET_COMPLETE event when it is done. Signed-off-by: Qi Zhang --- drivers/net/ixgbe/ixgbe_ethdev.c | 48 +++++++++++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 26b192737..6e2d6fc1a 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2923,12 +2923,29 @@ ixgbe_dev_close(struct rte_eth_dev *dev) ixgbe_set_rar(hw, 0, hw->mac.addr, 0, IXGBE_RAH_AV); } +static void * +do_dev_reset(void *args) +{ + struct rte_eth_dev *dev = args; + int ret; + + ret = eth_ixgbe_dev_uninit(dev); + if (!ret) + ret = eth_ixgbe_dev_init(dev, NULL); + + _rte_eth_dev_callback_process(dev, + RTE_ETH_EVENT_RESET_COMPLETE, + &ret); + return NULL; +} + /* * Reset PF device. */ static int ixgbe_dev_reset(struct rte_eth_dev *dev) { + pthread_t tid; int ret; /* When a DPDK PMD PF begin to reset PF port, it should notify all @@ -2940,11 +2957,8 @@ ixgbe_dev_reset(struct rte_eth_dev *dev) if (dev->data->sriov.active) return -ENOTSUP; - ret = eth_ixgbe_dev_uninit(dev); - if (ret) - return ret; - - ret = eth_ixgbe_dev_init(dev, NULL); + ret = rte_ctrl_thread_create(&tid, "ixgbe_dev_reset", + NULL, do_dev_reset, dev); return ret; } @@ -5173,19 +5187,33 @@ ixgbevf_dev_close(struct rte_eth_dev *dev) ixgbevf_remove_mac_addr(dev, 0); } +static void * +do_dev_vf_reset(void *args) +{ + struct rte_eth_dev *dev = args; + int ret; + + ret = eth_ixgbevf_dev_uninit(dev); + if (!ret) + ret = eth_ixgbevf_dev_init(dev); + + _rte_eth_dev_callback_process(dev, + RTE_ETH_EVENT_RESET_COMPLETE, + &ret); + return NULL; +} + /* * Reset VF device */ static int ixgbevf_dev_reset(struct rte_eth_dev *dev) { + pthread_t tid; int ret; - ret = eth_ixgbevf_dev_uninit(dev); - if (ret) - return ret; - - ret = eth_ixgbevf_dev_init(dev); + ret = rte_ctrl_thread_create(&tid, "ixgbevf_dev_reset", + NULL, do_dev_vf_reset, dev); return ret; } -- 2.13.6