From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 15FD0C3E8 for ; Thu, 18 Feb 2016 15:34:58 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP; 18 Feb 2016 06:34:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,465,1449561600"; d="scan'208";a="915801804" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga002.jf.intel.com with ESMTP; 18 Feb 2016 06:34:58 -0800 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id u1IEYucr018455; Thu, 18 Feb 2016 22:34:56 +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 u1IEYrBx018582; Thu, 18 Feb 2016 22:34:55 +0800 Received: (from hzhan75@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id u1IEYrNG018578; Thu, 18 Feb 2016 22:34:53 +0800 From: Helin Zhang To: dev@dpdk.org Date: Thu, 18 Feb 2016 22:34:13 +0800 Message-Id: <1455806076-18497-8-git-send-email-helin.zhang@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1455806076-18497-1-git-send-email-helin.zhang@intel.com> References: <1455776683-11790-1-git-send-email-helin.zhang@intel.com> <1455806076-18497-1-git-send-email-helin.zhang@intel.com> Subject: [dpdk-dev] [PATCH v3 07/30] 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: , X-List-Received-Date: Thu, 18 Feb 2016 14:34:59 -0000 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: -- 2.5.0