Re: [PATCH net-next v1 1/1] net: openvswitch: remove unnecessary vlan init in key_extract

From: Eddy Tao
Date: Tue Feb 07 2023 - 22:08:57 EST


Hi, Simon:

    Thanks for looking into this. by looking into the compiled instructions, i am convinced the patch is logically correct but not help in performance, and it adds complexity,

Below function is actually optimized to one movq instruction with no special -O settings on my centos8, which seems good enough for me

static void clear_vlan(struct sw_flow_key *key)
{
    key->eth.vlan.tci = 0;
    key->eth.vlan.tpid = 0;
    key->eth.cvlan.tci = 0;
    key->eth.cvlan.tpid = 0;
}

optimized to movq   $0x0,0x158(%rbx)

I am withdrawing this patch

About your comment below, since it is after the parse_vlan handling, the code looks fine and does not affect the logic of the patch

>>I think you missed the following case further down: >>>>if (unlikely(key->eth.type == htons(0))) Have a great day

eddy