aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2022-11-04 17:07:04 +0100
committerMarkus Armbruster <armbru@redhat.com>2022-12-14 20:05:07 +0100
commit05e074886052acccb65f7df73ae4bbe7923e01bc (patch)
tree08b67c3160015847ea5568e9d6ad7fcd223016b1 /hw
parentd01c00463fa70ff87ac40d5d3c39acd805488e69 (diff)
qapi rocker: Elide redundant has_FOO in generated C
The has_FOO for pointer-valued FOO are redundant, except for arrays. They are also a nuisance to work with. Recent commit "qapi: Start to elide redundant has_FOO in generated C" provided the means to elide them step by step. This is the step for qapi/rocker.json. Said commit explains the transformation in more detail. The invariant violations mentioned there do not occur here. Cc: Jiri Pirko <jiri@resnulli.us> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20221104160712.3005652-23-armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r--hw/net/rocker/rocker_of_dpa.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/hw/net/rocker/rocker_of_dpa.c b/hw/net/rocker/rocker_of_dpa.c
index b3b8c5bb6d..dfe4754469 100644
--- a/hw/net/rocker/rocker_of_dpa.c
+++ b/hw/net/rocker/rocker_of_dpa.c
@@ -2348,23 +2348,19 @@ static void of_dpa_flow_fill(void *cookie, void *value, void *user_data)
if (memcmp(key->eth.src.a, zero_mac.a, ETH_ALEN) ||
memcmp(mask->eth.src.a, zero_mac.a, ETH_ALEN)) {
- nkey->has_eth_src = true;
nkey->eth_src = qemu_mac_strdup_printf(key->eth.src.a);
}
- if (nkey->has_eth_src && memcmp(mask->eth.src.a, ff_mac.a, ETH_ALEN)) {
- nmask->has_eth_src = true;
+ if (nkey->eth_src && memcmp(mask->eth.src.a, ff_mac.a, ETH_ALEN)) {
nmask->eth_src = qemu_mac_strdup_printf(mask->eth.src.a);
}
if (memcmp(key->eth.dst.a, zero_mac.a, ETH_ALEN) ||
memcmp(mask->eth.dst.a, zero_mac.a, ETH_ALEN)) {
- nkey->has_eth_dst = true;
nkey->eth_dst = qemu_mac_strdup_printf(key->eth.dst.a);
}
- if (nkey->has_eth_dst && memcmp(mask->eth.dst.a, ff_mac.a, ETH_ALEN)) {
- nmask->has_eth_dst = true;
+ if (nkey->eth_dst && memcmp(mask->eth.dst.a, ff_mac.a, ETH_ALEN)) {
nmask->eth_dst = qemu_mac_strdup_printf(mask->eth.dst.a);
}
@@ -2400,7 +2396,6 @@ static void of_dpa_flow_fill(void *cookie, void *value, void *user_data)
if (key->ipv4.addr.dst || mask->ipv4.addr.dst) {
char *dst = inet_ntoa(*(struct in_addr *)&key->ipv4.addr.dst);
int dst_len = of_dpa_mask2prefix(mask->ipv4.addr.dst);
- nkey->has_ip_dst = true;
nkey->ip_dst = g_strdup_printf("%s/%d", dst, dst_len);
}
break;
@@ -2501,12 +2496,10 @@ static void of_dpa_group_fill(void *key, void *value, void *user_data)
ngroup->set_vlan_id = ntohs(group->l2_rewrite.vlan_id);
}
if (memcmp(group->l2_rewrite.src_mac.a, zero_mac.a, ETH_ALEN)) {
- ngroup->has_set_eth_src = true;
ngroup->set_eth_src =
qemu_mac_strdup_printf(group->l2_rewrite.src_mac.a);
}
if (memcmp(group->l2_rewrite.dst_mac.a, zero_mac.a, ETH_ALEN)) {
- ngroup->has_set_eth_dst = true;
ngroup->set_eth_dst =
qemu_mac_strdup_printf(group->l2_rewrite.dst_mac.a);
}
@@ -2532,12 +2525,10 @@ static void of_dpa_group_fill(void *key, void *value, void *user_data)
ngroup->set_vlan_id = ntohs(group->l3_unicast.vlan_id);
}
if (memcmp(group->l3_unicast.src_mac.a, zero_mac.a, ETH_ALEN)) {
- ngroup->has_set_eth_src = true;
ngroup->set_eth_src =
qemu_mac_strdup_printf(group->l3_unicast.src_mac.a);
}
if (memcmp(group->l3_unicast.dst_mac.a, zero_mac.a, ETH_ALEN)) {
- ngroup->has_set_eth_dst = true;
ngroup->set_eth_dst =
qemu_mac_strdup_printf(group->l3_unicast.dst_mac.a);
}