]> git.proxmox.com Git - ovs.git/commitdiff
odp-execute: Reuse rss hash in OVS_ACTION_ATTR_HASH.
authorIlya Maximets <i.maximets@samsung.com>
Thu, 13 Jul 2017 15:07:03 +0000 (18:07 +0300)
committerAndy Zhou <azhou@ovn.org>
Thu, 20 Jul 2017 23:10:04 +0000 (16:10 -0700)
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@samsung.com>
Acked-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Andy Zhou <azhou@ovn.org>
lib/odp-execute.c
tests/ofproto-dpif.at

index d6563347b5f708e714c12a04d718aaedd33e42c8..03120bf06645525b057790167484cfb5af74614f 100644 (file)
@@ -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 {
index 9941e3578f465f0d53567cf75af4a2a50e05f116..5e1347702aafed251304ddca03f0a9c39a12be68 100644 (file)
@@ -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