lpm: fix ARM big endian build
authorHemant Agrawal <hemant.agrawal@nxp.com>
Mon, 18 Dec 2017 07:56:46 +0000 (13:26 +0530)
committerThomas Monjalon <thomas@monjalon.net>
Fri, 12 Jan 2018 16:27:03 +0000 (17:27 +0100)
Compiling on ARM BE using Linaro toolchain caused following
error/warnings.

rte_lpm.c: In function ‘add_depth_big_v20’:
rte_lpm.c:911:4: error: braces around scalar initializer [-Werror]
    { .group_idx = (uint8_t)tbl8_group_index, },
    ^
rte_lpm.c:911:4: note: (near initialization for
‘new_tbl24_entry.depth’)
rte_lpm.c:911:6:error: field name not in record or union initializer
    { .group_idx = (uint8_t)tbl8_group_index, },
      ^
rte_lpm.c:911:6: note: (near initialization for
‘new_tbl24_entry.depth’)
rte_lpm.c:914:13: error: initialized field overwritten
[-Werror=override-init]
    .depth = 0,

Fixes: dc81ebbacaeb ("lpm: extend IPv4 next hop field")
Cc: stable@dpdk.org
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
lib/librte_lpm/rte_lpm.c

index 414808c..5ba595e 100644 (file)
@@ -883,7 +883,7 @@ add_depth_big_v20(struct rte_lpm_v20 *lpm, uint32_t ip_masked, uint8_t depth,
                 */
 
                struct rte_lpm_tbl_entry_v20 new_tbl24_entry = {
-                       { .group_idx = (uint8_t)tbl8_group_index, },
+                       .group_idx = (uint8_t)tbl8_group_index,
                        .valid = VALID,
                        .valid_group = 1,
                        .depth = 0,
@@ -929,7 +929,7 @@ add_depth_big_v20(struct rte_lpm_v20 *lpm, uint32_t ip_masked, uint8_t depth,
                 */
 
                struct rte_lpm_tbl_entry_v20 new_tbl24_entry = {
-                               { .group_idx = (uint8_t)tbl8_group_index, },
+                               .group_idx = (uint8_t)tbl8_group_index,
                                .valid = VALID,
                                .valid_group = 1,
                                .depth = 0,
@@ -1336,7 +1336,7 @@ delete_depth_small_v20(struct rte_lpm_v20 *lpm, uint32_t ip_masked,
                 */
 
                struct rte_lpm_tbl_entry_v20 new_tbl24_entry = {
-                       {.next_hop = lpm->rules_tbl[sub_rule_index].next_hop,},
+                       .next_hop = lpm->rules_tbl[sub_rule_index].next_hop,
                        .valid = VALID,
                        .valid_group = 0,
                        .depth = sub_rule_depth,
@@ -1639,7 +1639,7 @@ delete_depth_big_v20(struct rte_lpm_v20 *lpm, uint32_t ip_masked,
        } else if (tbl8_recycle_index > -1) {
                /* Update tbl24 entry. */
                struct rte_lpm_tbl_entry_v20 new_tbl24_entry = {
-                       { .next_hop = lpm->tbl8[tbl8_recycle_index].next_hop, },
+                       .next_hop = lpm->tbl8[tbl8_recycle_index].next_hop,
                        .valid = VALID,
                        .valid_group = 0,
                        .depth = lpm->tbl8[tbl8_recycle_index].depth,