From patchwork Fri Jan 15 02:40:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Helin" X-Patchwork-Id: 9875 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 5E58A91A0; Fri, 15 Jan 2016 03:41:20 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id C72E79198 for ; Fri, 15 Jan 2016 03:41:17 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP; 14 Jan 2016 18:41:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,297,1449561600"; d="scan'208";a="881744588" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga001.fm.intel.com with ESMTP; 14 Jan 2016 18:41:16 -0800 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id u0F2fDhY002323; Fri, 15 Jan 2016 10:41:13 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id u0F2fAlZ000708; Fri, 15 Jan 2016 10:41:12 +0800 Received: (from hzhan75@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id u0F2fAZv000704; Fri, 15 Jan 2016 10:41:10 +0800 From: Helin Zhang To: dev@dpdk.org Date: Fri, 15 Jan 2016 10:40:31 +0800 Message-Id: <1452825653-623-8-git-send-email-helin.zhang@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1452825653-623-1-git-send-email-helin.zhang@intel.com> References: <1452825653-623-1-git-send-email-helin.zhang@intel.com> Subject: [dpdk-dev] [PATCH 07/29] i40e/base: set aq count after memory allocation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The standard way to check if the AQ is enabled is to look at the count field. So it should only set this field after it has successfully allocated memory. To do otherwise is to incite panic among the populace. Signed-off-by: Helin Zhang --- drivers/net/i40e/base/i40e_adminq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/i40e/base/i40e_adminq.c b/drivers/net/i40e/base/i40e_adminq.c index e1a162e..ee563e4 100644 --- a/drivers/net/i40e/base/i40e_adminq.c +++ b/drivers/net/i40e/base/i40e_adminq.c @@ -431,7 +431,6 @@ enum i40e_status_code i40e_init_asq(struct i40e_hw *hw) hw->aq.asq.next_to_use = 0; hw->aq.asq.next_to_clean = 0; - hw->aq.asq.count = hw->aq.num_asq_entries; /* allocate the ring memory */ ret_code = i40e_alloc_adminq_asq_ring(hw); @@ -449,6 +448,7 @@ enum i40e_status_code i40e_init_asq(struct i40e_hw *hw) goto init_adminq_free_rings; /* success! */ + hw->aq.asq.count = hw->aq.num_asq_entries; goto init_adminq_exit; init_adminq_free_rings: @@ -490,7 +490,6 @@ enum i40e_status_code i40e_init_arq(struct i40e_hw *hw) hw->aq.arq.next_to_use = 0; hw->aq.arq.next_to_clean = 0; - hw->aq.arq.count = hw->aq.num_arq_entries; /* allocate the ring memory */ ret_code = i40e_alloc_adminq_arq_ring(hw); @@ -508,6 +507,7 @@ enum i40e_status_code i40e_init_arq(struct i40e_hw *hw) goto init_adminq_free_rings; /* success! */ + hw->aq.arq.count = hw->aq.num_arq_entries; goto init_adminq_exit; init_adminq_free_rings: