Skip to content

Commit

Permalink
flow: Reduce metadata connection state branches in miniflow_extract
Browse files Browse the repository at this point in the history
This patch merges two separate if-else branches for metadata connection state
into one if-else branch to improve performance. It gives an average performance
improvement of ~3% on arm platforms and ~4.5% on x86 platforms.

Signed-off-by: Malvika Gupta <malvika.gupta@arm.com>
Reviewed-by: Yanqin Wei <yanqin.wei@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Signed-off-by: 0-day Robot <robot@bytheb.org>
  • Loading branch information
Malvika-Gupta authored and ovsrobot committed Aug 27, 2019
1 parent 9c74b57 commit 9804538
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions lib/flow.c
Expand Up @@ -786,20 +786,17 @@ miniflow_extract(struct dp_packet *packet, struct miniflow *dst)
ct_nw_proto_p = miniflow_pointer(mf, ct_nw_proto);
miniflow_push_uint8(mf, ct_nw_proto, 0);
miniflow_push_uint16(mf, ct_zone, md->ct_zone);
} else if (md->recirc_id) {
miniflow_push_uint32(mf, recirc_id, md->recirc_id);
miniflow_pad_to_64(mf, recirc_id);
}

if (md->ct_state) {
miniflow_push_uint32(mf, ct_mark, md->ct_mark);
miniflow_push_be32(mf, packet_type, packet_type);

if (!ovs_u128_is_zero(md->ct_label)) {
miniflow_push_words(mf, ct_label, &md->ct_label,
sizeof md->ct_label / sizeof(uint64_t));
}
} else {
if (md->recirc_id) {
miniflow_push_uint32(mf, recirc_id, md->recirc_id);
miniflow_pad_to_64(mf, recirc_id);
}
miniflow_pad_from_64(mf, packet_type);
miniflow_push_be32(mf, packet_type, packet_type);
}
Expand Down

0 comments on commit 9804538

Please sign in to comment.