summaryrefslogtreecommitdiff
path: root/lib/librte_lpm
diff options
context:
space:
mode:
authorMichael Qiu <michael.qiu@intel.com>2016-03-30 11:38:12 +0800
committerThomas Monjalon <thomas.monjalon@6wind.com>2016-03-31 21:31:55 +0200
commite13676bfe7d1df44def6ff27886cc27823323f40 (patch)
treeea57ce249f19c77ebd204d6d3853f3c8a63d8785 /lib/librte_lpm
parent8ee787ce80a8a166fb36ba55370db642783539f9 (diff)
downloaddpdk-e13676bfe7d1df44def6ff27886cc27823323f40.zip
dpdk-e13676bfe7d1df44def6ff27886cc27823323f40.tar.gz
dpdk-e13676bfe7d1df44def6ff27886cc27823323f40.tar.xz
lpm: fix build of anonymous union initialization
In SUSE11-SP3 i686 platform, with gcc 4.5.1, there is a compile issue: rte_lpm.c: In function ‘add_depth_small_v20’: rte_lpm.c:778:7: error: unknown field ‘next_hop’ specified in initializer The root cause is gcc only allow anonymous union initialized according to the field it is defined. But next_hop is defined in different field when in different platform(Endian). One solution is add if define in the code to avoid this issue, but there is a simple way, initialize it separately later. Fixes: afc5c914a083 ("lpm: fix big endian support") Signed-off-by: Michael Qiu <michael.qiu@intel.com>
Diffstat (limited to 'lib/librte_lpm')
-rw-r--r--lib/librte_lpm/rte_lpm.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/librte_lpm/rte_lpm.c b/lib/librte_lpm/rte_lpm.c
index af5811c..bd3563f 100644
--- a/lib/librte_lpm/rte_lpm.c
+++ b/lib/librte_lpm/rte_lpm.c
@@ -744,11 +744,11 @@ add_depth_small_v20(struct rte_lpm_v20 *lpm, uint32_t ip, uint8_t depth,
lpm->tbl24[i].depth <= depth)) {
struct rte_lpm_tbl_entry_v20 new_tbl24_entry = {
- { .next_hop = next_hop, },
.valid = VALID,
.valid_group = 0,
.depth = depth,
};
+ new_tbl24_entry.next_hop = next_hop;
/* Setting tbl24 entry in one go to avoid race
* conditions
@@ -775,8 +775,8 @@ add_depth_small_v20(struct rte_lpm_v20 *lpm, uint32_t ip, uint8_t depth,
.valid = VALID,
.valid_group = VALID,
.depth = depth,
- .next_hop = next_hop,
};
+ new_tbl8_entry.next_hop = next_hop;
/*
* Setting tbl8 entry in one go to avoid
@@ -975,10 +975,9 @@ add_depth_big_v20(struct rte_lpm_v20 *lpm, uint32_t ip_masked, uint8_t depth,
struct rte_lpm_tbl_entry_v20 new_tbl8_entry = {
.valid = VALID,
.depth = depth,
- .next_hop = next_hop,
.valid_group = lpm->tbl8[i].valid_group,
};
-
+ new_tbl8_entry.next_hop = next_hop;
/*
* Setting tbl8 entry in one go to avoid race
* condition
@@ -1375,9 +1374,9 @@ delete_depth_small_v20(struct rte_lpm_v20 *lpm, uint32_t ip_masked,
.valid = VALID,
.valid_group = VALID,
.depth = sub_rule_depth,
- .next_hop = lpm->rules_tbl
- [sub_rule_index].next_hop,
};
+ new_tbl8_entry.next_hop =
+ lpm->rules_tbl[sub_rule_index].next_hop;
for (i = tbl24_index; i < (tbl24_index + tbl24_range); i++) {
@@ -1639,9 +1638,10 @@ delete_depth_big_v20(struct rte_lpm_v20 *lpm, uint32_t ip_masked,
.valid = VALID,
.depth = sub_rule_depth,
.valid_group = lpm->tbl8[tbl8_group_start].valid_group,
- .next_hop = lpm->rules_tbl[sub_rule_index].next_hop,
};
+ new_tbl8_entry.next_hop =
+ lpm->rules_tbl[sub_rule_index].next_hop;
/*
* Loop through the range of entries on tbl8 for which the
* rule_to_delete must be modified.