From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 926D45A9B for ; Mon, 19 Jan 2015 07:56:33 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP; 18 Jan 2015 22:56:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208";a="442155209" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by FMSMGA003.fm.intel.com with ESMTP; 18 Jan 2015 22:43:21 -0800 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id t0J6uUel015685; Mon, 19 Jan 2015 14:56:30 +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 t0J6uRTk026031; Mon, 19 Jan 2015 14:56:29 +0800 Received: (from hzhan75@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t0J6uRPC026027; Mon, 19 Jan 2015 14:56:27 +0800 From: Helin Zhang To: dev@dpdk.org Date: Mon, 19 Jan 2015 14:56:14 +0800 Message-Id: <1421650577-25969-5-git-send-email-helin.zhang@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1421650577-25969-1-git-send-email-helin.zhang@intel.com> References: <1421650577-25969-1-git-send-email-helin.zhang@intel.com> Subject: [dpdk-dev] [PATCH 4/7] ethdev: fix of calculating the size of flow type mask array 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: Mon, 19 Jan 2015 06:56:35 -0000 It wrongly calculates the size of the flow type mask array. The fix is to align the flow type maximum index ID with the number of element bit width, and then divide the number of element bit width. Signed-off-by: Helin Zhang --- lib/librte_ether/rte_eth_ctrl.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h index 4308eae..1c15ed0 100644 --- a/lib/librte_ether/rte_eth_ctrl.h +++ b/lib/librte_ether/rte_eth_ctrl.h @@ -398,6 +398,10 @@ enum rte_fdir_mode { RTE_FDIR_MODE_PERFECT, /**< Enable FDIR perfect filter mode. */ }; +#define UINT32_BIT (CHAR_BIT * sizeof(uint32_t)) +#define RTE_FLOW_TYPE_MASK_ARRAY_SIZE \ + (RTE_ALIGN(RTE_ETH_FLOW_TYPE_MAX, UINT32_BIT)/UINT32_BIT) + /** * A structure used to get the information of flow director filter. * It supports RTE_ETH_FILTER_FDIR with RTE_ETH_FILTER_INFO operation. @@ -412,7 +416,7 @@ struct rte_eth_fdir_info { uint32_t guarant_spc; /**< Guaranteed spaces.*/ uint32_t best_spc; /**< Best effort spaces.*/ /** Bit mask for every supported flow type. */ - uint32_t flow_types_mask[RTE_ETH_FLOW_TYPE_MAX / sizeof(uint32_t)]; + uint32_t flow_types_mask[RTE_FLOW_TYPE_MASK_ARRAY_SIZE]; uint32_t max_flexpayload; /**< Total flex payload in bytes. */ /** Flexible payload unit in bytes. Size and alignments of all flex payload segments should be multiplies of this value. */ -- 1.9.3