Skip to content

Commit

Permalink
odp-execute: Reuse rss hash in OVS_ACTION_ATTR_HASH.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Darrell Ball <[email protected]>
Signed-off-by: Andy Zhou <[email protected]>
  • Loading branch information
igsilya authored and azhou-nicira committed Jul 20, 2017
1 parent 2575df0 commit 95a6cb3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
11 changes: 9 additions & 2 deletions lib/odp-execute.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions tests/ofproto-dpif.at
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 95a6cb3

Please sign in to comment.