For untagged traffic, it is unnecessary to clear vlan_hdrs as it costs 32B memset. So the patch improves it by postponing to clear vlan_hdrs until ethtype check. It can benefit both untagged and single-tagged traffic. From testing, it does not impact performance of dual-tagged traffic.
Change-Id: I6d503c904d0354c94882196d7720a574b2d07e44 Reviewed-by: Gavin Hu <gavin...@arm.com> Signed-off-by: Yanqin Wei <yanqin....@arm.com> --- lib/flow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/flow.c b/lib/flow.c index 1b21f51..4d895e5 100644 --- a/lib/flow.c +++ b/lib/flow.c @@ -343,7 +343,6 @@ parse_vlan(const void **datap, size_t *sizep, union flow_vlan_hdr *vlan_hdrs) { const ovs_be16 *eth_type; - memset(vlan_hdrs, 0, sizeof(union flow_vlan_hdr) * FLOW_MAX_VLAN_HEADERS); data_pull(datap, sizep, ETH_ADDR_LEN * 2); eth_type = *datap; @@ -354,6 +353,7 @@ parse_vlan(const void **datap, size_t *sizep, union flow_vlan_hdr *vlan_hdrs) break; } + memset(vlan_hdrs + n, 0, sizeof(union flow_vlan_hdr)); const ovs_16aligned_be32 *qp = data_pull(datap, sizep, sizeof *qp); vlan_hdrs[n].qtag = get_16aligned_be32(qp); vlan_hdrs[n].tci |= htons(VLAN_CFI); -- 2.7.4 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev