From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <wei.dai@intel.com>
Received: from mga01.intel.com (mga01.intel.com [192.55.52.88])
 by dpdk.org (Postfix) with ESMTP id 7B11F9E3;
 Mon, 19 Jun 2017 06:24:11 +0200 (CEST)
Received: from fmsmga005.fm.intel.com ([10.253.24.32])
 by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 18 Jun 2017 21:24:10 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.39,359,1493708400"; 
 d="scan'208,223";a="115988847"
Received: from dpdk6.bj.intel.com ([172.16.182.81])
 by fmsmga005.fm.intel.com with ESMTP; 18 Jun 2017 21:24:08 -0700
From: Wei Dai <wei.dai@intel.com>
To: bruce.richardson@intel.com
Cc: dev@dpdk.org, jianwei.ma@intel.com, Wei Dai <wei.dai@intel.com>,
 stable@dpdk.org
Date: Mon, 19 Jun 2017 12:14:38 +0800
Message-Id: <1497845678-7643-1-git-send-email-wei.dai@intel.com>
X-Mailer: git-send-email 2.7.4
Subject: [dpdk-dev] [PATCH] lpm: fix index of tbl8
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Mon, 19 Jun 2017 04:24:12 -0000

>>From v20 to v1604, number of tlb8 can be up to 1<<24,
(uint8_t) or (uint16_t) may truncate the number of
index of tlb8 in v1604 and cause wrong number.

Fixes: dc81ebbacaeb ("lpm: extend IPv4 next hop field")
Cc: stable@dpdk.org

Signed-off-by: Wei Dai <wei.dai@intel.com>
---
 lib/librte_lpm/rte_lpm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_lpm/rte_lpm.c b/lib/librte_lpm/rte_lpm.c
index 8c15c4c..978ac60 100644
--- a/lib/librte_lpm/rte_lpm.c
+++ b/lib/librte_lpm/rte_lpm.c
@@ -1034,7 +1034,7 @@ add_depth_big_v1604(struct rte_lpm *lpm, uint32_t ip_masked, uint8_t depth,
 		 */
 
 		struct rte_lpm_tbl_entry new_tbl24_entry = {
-			.group_idx = (uint8_t)tbl8_group_index,
+			.group_idx = tbl8_group_index,
 			.valid = VALID,
 			.valid_group = 1,
 			.depth = 0,
@@ -1080,7 +1080,7 @@ add_depth_big_v1604(struct rte_lpm *lpm, uint32_t ip_masked, uint8_t depth,
 		 */
 
 		struct rte_lpm_tbl_entry new_tbl24_entry = {
-				.group_idx = (uint8_t)tbl8_group_index,
+				.group_idx = tbl8_group_index,
 				.valid = VALID,
 				.valid_group = 1,
 				.depth = 0,
-- 
2.7.4