[ovs-dev,v1] flow: save "vlan_hdrs" memset for untagged traffic
diff mbox series

Message ID 1566466228-45378-1-git-send-email-Yanqin.Wei@arm.com
State New
Headers show
Series
  • [ovs-dev,v1] flow: save "vlan_hdrs" memset for untagged traffic
Related show

Commit Message

Yanqin Wei Aug. 22, 2019, 9:30 a.m. UTC
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.Hu@arm.com>
Signed-off-by: Yanqin Wei <Yanqin.Wei@arm.com>
---
 lib/flow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

0-day Robot Aug. 22, 2019, 10:37 a.m. UTC | #1
Bleep bloop.  Greetings Yanqin Wei, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


checkpatch:
ERROR: Remove Gerrit Change-Id's before submitting upstream.
10: Change-Id: I6d503c904d0354c94882196d7720a574b2d07e44

Lines checked: 40, Warnings: 0, Errors: 1


Please check this out.  If you feel there has been an error, please email aconole@redhat.com

Thanks,
0-day Robot

Patch
diff mbox series

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);