From patchwork Fri Jul 13 02:42:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wenzhuo Lu X-Patchwork-Id: 42999 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 [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9749A1B42E; Fri, 13 Jul 2018 04:40:39 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id B3A181B42B for ; Fri, 13 Jul 2018 04:40:36 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Jul 2018 19:40:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,346,1526367600"; d="scan'208";a="66578077" Received: from dpdk26.sh.intel.com ([10.67.110.161]) by orsmga003.jf.intel.com with ESMTP; 12 Jul 2018 19:39:42 -0700 From: Wenzhuo Lu To: dev@dpdk.org Cc: Wenzhuo Lu Date: Fri, 13 Jul 2018 10:42:50 +0800 Message-Id: <1531449770-107772-1-git-send-email-wenzhuo.lu@intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1531373220-42150-1-git-send-email-wenzhuo.lu@intel.com> References: <1531373220-42150-1-git-send-email-wenzhuo.lu@intel.com> Subject: [dpdk-dev] [PATCH v2] ethdev: fix device info getting 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" The device information cannot be gotten correctly before the configuration is set. Because on some NICs the information has dependence on the configuration. Fixes: 3be82f5cc5e3 ("ethdev: support PMD-tuned Tx/Rx parameters") Signed-off-by: Wenzhuo Lu --- lib/librte_ethdev/rte_ethdev.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 3d556a8..6f606c1 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -1022,6 +1022,17 @@ struct rte_eth_dev * RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP); RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP); + if (dev->data->dev_started) { + RTE_ETHDEV_LOG(ERR, + "Port %u must be stopped to allow configuration\n", + port_id); + return -EBUSY; + } + + /* Copy the dev_conf parameter into the dev structure, + * then get the info. + */ + memcpy(&dev->data->dev_conf, &local_conf, sizeof(dev->data->dev_conf)); rte_eth_dev_info_get(port_id, &dev_info); /* If number of queues specified by application for both Rx and Tx is @@ -1053,16 +1064,6 @@ struct rte_eth_dev * return -EINVAL; } - if (dev->data->dev_started) { - RTE_ETHDEV_LOG(ERR, - "Port %u must be stopped to allow configuration\n", - port_id); - return -EBUSY; - } - - /* Copy the dev_conf parameter into the dev structure */ - memcpy(&dev->data->dev_conf, &local_conf, sizeof(dev->data->dev_conf)); - /* * Check that the numbers of RX and TX queues are not greater * than the maximum number of RX and TX queues supported by the