From: Michael Qiu <michael.qiu@intel.com>
To: dev@dpdk.org
Cc: Michael Qiu <michael.qiu@intel.com>
Subject: [dpdk-dev] [PATCH 1/2 v2] lib/librte_lpm: Fix anonymous union initialization issue
Date: Wed, 30 Mar 2016 11:38:12 +0800 [thread overview]
Message-ID: <1459309092-8904-1-git-send-email-michael.qiu@intel.com> (raw)
In-Reply-To: <1458890426-20688-2-git-send-email-michael.qiu@intel.com>
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
cc1: warnings being treated as errors
The root casue 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>
---
v2 --> v1:
Fixes whilespace issue around "="
lib/librte_lpm/rte_lpm.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/lib/librte_lpm/rte_lpm.c b/lib/librte_lpm/rte_lpm.c
index af5811c..efd507e 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.
--
1.9.3
next prev parent reply other threads:[~2016-03-30 3:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-25 7:20 [dpdk-dev] [PATCH 0/2] Compile fixes in SUSE11 SP3 i686 platform Michael Qiu
2016-03-25 7:20 ` [dpdk-dev] [PATCH 1/2] lib/librte_lpm: Fix anonymous union initialization issue Michael Qiu
2016-03-25 17:02 ` Stephen Hemminger
2016-03-30 3:38 ` Michael Qiu [this message]
2016-03-25 7:20 ` [dpdk-dev] [PATCH 2/2] drivers/crypto: Fix anonymous union initialization in crypto Michael Qiu
2016-03-25 10:48 ` Trahe, Fiona
2016-03-30 12:49 ` [dpdk-dev] [PATCH v2] drivers/crypto: Fix anonymous union initialization in crypto PMDs Fiona Trahe
2016-03-31 19:32 ` [dpdk-dev] [PATCH 0/2] Compile fixes in SUSE11 SP3 i686 platform Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1459309092-8904-1-git-send-email-michael.qiu@intel.com \
--to=michael.qiu@intel.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).