diff options
author | Tonghao Zhang <xiangxia.m.yue@gmail.com> | 2020-10-12 13:24:57 -0700 |
---|---|---|
committer | Ilya Maximets <i.maximets@ovn.org> | 2020-10-17 17:32:06 +0200 |
commit | e5466316984d84dfeabbcf6254f207caaff06f7d (patch) | |
tree | 9cd4c80a88808aac53b10d4011c21679e1449e6b /datapath | |
parent | cdc58fe7d290cd0990e15ca10df1ad5b312b01d7 (diff) | |
download | openvswitch-e5466316984d84dfeabbcf6254f207caaff06f7d.tar.gz |
datapath: add likely in flow_lookup
Upstream commit:
commit 0a3e01371db17d753dd92ec4d0fc6247412d3b01
Author: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Date: Fri Nov 1 22:23:51 2019 +0800
net: openvswitch: add likely in flow_lookup
The most case *index < ma->max, and flow-mask is not NULL.
We add un/likely for performance.
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Tested-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: William Tu <u9012063@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Reviewed-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Acked-by: Yi-Hung Wei <yihung.wei@gmail.com>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'datapath')
-rw-r--r-- | datapath/flow_table.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/datapath/flow_table.c b/datapath/flow_table.c index 7efaa8044..ca2efe94d 100644 --- a/datapath/flow_table.c +++ b/datapath/flow_table.c @@ -541,7 +541,7 @@ static struct sw_flow *flow_lookup(struct flow_table *tbl, struct sw_flow_mask *mask; int i; - if (*index < ma->max) { + if (likely(*index < ma->max)) { mask = rcu_dereference_ovsl(ma->masks[*index]); if (mask) { flow = masked_flow_lookup(ti, key, mask, n_mask_hit); @@ -556,7 +556,7 @@ static struct sw_flow *flow_lookup(struct flow_table *tbl, continue; mask = rcu_dereference_ovsl(ma->masks[i]); - if (!mask) + if (unlikely(!mask)) break; flow = masked_flow_lookup(ti, key, mask, n_mask_hit); |