From: Andy Zhou Date: Sat, 30 Jan 2016 01:48:50 +0000 (-0800) Subject: dpif-netdev: optmizing emc_processing() X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Fovs.git;a=commitdiff_plain;h=b89c678b7a267ec004ae292c8f0ee0c3f0ccb6d5 dpif-netdev: optmizing emc_processing() Commit d262ac2c60ce1da7b477737f70e8efd38b32502d introduced a slight performance drop for the fast path, where every packets hits the emc cache. This patch removes that performance drop by only reloading the key pointer on emc cache miss. Signed-off-by: Andy Zhou Acked-by: Daniele Di Proietto --- diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 094ffbf38..faf5d457f 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -3297,6 +3297,7 @@ emc_processing(struct dp_netdev_pmd_thread *pmd, struct dp_packet **packets, struct packet_batch batches[], size_t *n_batches) { struct emc_cache *flow_cache = &pmd->flow_cache; + struct netdev_flow_key *key = &keys[0]; size_t i, n_missed = 0, n_dropped = 0; for (i = 0; i < cnt; i++) { @@ -3314,7 +3315,6 @@ emc_processing(struct dp_netdev_pmd_thread *pmd, struct dp_packet **packets, OVS_PREFETCH(dp_packet_data(packets[i+1])); } - struct netdev_flow_key *key = &keys[n_missed]; miniflow_extract(packet, &key->mf); key->len = 0; /* Not computed yet. */ key->hash = dpif_netdev_packet_get_rss_hash(packet, &key->mf); @@ -3326,7 +3326,8 @@ emc_processing(struct dp_netdev_pmd_thread *pmd, struct dp_packet **packets, } else { /* Exact match cache missed. Group missed packets together at * the beginning of the 'packets' array. */ - packets[n_missed++] = packet; + packets[n_missed] = packet; + key = &keys[n_missed++]; } }