[ovs-dev] [PATCH v2] odp-execute: Reuse rss hash in OVS_ACTION_ATTR_HASH.
Ilya Maximets
i.maximets at samsung.com
Thu Jul 13 15:07:03 UTC 2017
If RSS hash exists in a packet it can be reused instead of
5 tuple hash re-calculation in OVS_ACTION_ATTR_HASH. This
leads to increasing the performance of sending packets to
the OVS bonding in userspace datapath up to 10-15%.
Additionally fixed unit test 'select group with dp_hash
selection method' to not depend on dp_hash value.
Signed-off-by: Ilya Maximets <i.maximets at samsung.com>
---
Version 2:
* Removed assumption on hash_basis value.
* hash_finish replaced with hash_int as more appropriate.
* Fixed 'select group with dp_hash selection method' UT.
lib/odp-execute.c | 11 +++++++++--
tests/ofproto-dpif.at | 4 ++--
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/lib/odp-execute.c b/lib/odp-execute.c
index d656334..03120bf 100644
--- a/lib/odp-execute.c
+++ b/lib/odp-execute.c
@@ -646,8 +646,15 @@ odp_execute_actions(void *dp, struct dp_packet_batch *batch, bool steal,
uint32_t hash;
DP_PACKET_BATCH_FOR_EACH (packet, batch) {
- flow_extract(packet, &flow);
- hash = flow_hash_5tuple(&flow, hash_act->hash_basis);
+ /* RSS hash can be used here instead of 5tuple for
+ * performance reasons. */
+ if (dp_packet_rss_valid(packet)) {
+ hash = dp_packet_get_rss_hash(packet);
+ hash = hash_int(hash, hash_act->hash_basis);
+ } else {
+ flow_extract(packet, &flow);
+ hash = flow_hash_5tuple(&flow, hash_act->hash_basis);
+ }
packet->md.dp_hash = hash;
}
} else {
diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at
index 8373f90..83c72cf 100644
--- a/tests/ofproto-dpif.at
+++ b/tests/ofproto-dpif.at
@@ -491,10 +491,10 @@ for d in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
done
-AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/dp_hash(.*\/0x1)/dp_hash(0xXXXX\/0x1)/' | strip_ufid | strip_used | sort], [0], [dnl
+AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/dp_hash(.*\/0x1)/dp_hash(0xXXXX\/0x1)/' | sed 's/\(actions:1\)[[01]]/\1X/' | strip_ufid | strip_used | sort], [0], [dnl
flow-dump from non-dpdk interfaces:
recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=192.168.0.1,frag=no), packets:15, bytes:630, used:0.0s, actions:hash(hash_l4(0)),recirc(0x2)
-recirc_id(0x2),dp_hash(0xXXXX/0x1),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:15, bytes:630, used:0.0s, actions:11
+recirc_id(0x2),dp_hash(0xXXXX/0x1),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:15, bytes:630, used:0.0s, actions:1X
])
OVS_VSWITCHD_STOP
--
2.7.4
More information about the dev
mailing list