This patch allows to skip the chunk comprising of dp_hash and in_port
in the subtable mask when the packet is not recirculated. This will
slightly speed up the hash computation as one expensive function call
to hash_add64() can be skipped.
For each new netdev flow we wildcard in_port in the mask, so in the
physical case where dp_hash is also wildcarded, the resulting 8-byte
chunk will not be part of the subtable mask.
The idea behind is that all the packets within a given dpcls will
have the same in_port value and typically dp_hash == 0. So they will
have the same 8-bytes chunk in their {dp_hash, in_port} portion of the
miniflow. This doesn't contribute effectively in spreading hash values
and avoiding collisions.
v2: Using ovs_assert
Signed-off-by: Antonio Fischetti <[email protected]>
Signed-off-by: Bhanuprakash Bodireddy <[email protected]>
Co-authored-by: Bhanuprakash Bodireddy <[email protected]>
Signed-off-by: Jarno Rajahalme <[email protected]>
Co-authored-by: Jarno Rajahalme <[email protected]>
---
lib/dpif-netdev.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 1a47a45..68b434f 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -2278,7 +2278,18 @@ dp_netdev_flow_add(struct dp_netdev_pmd_thread *pmd,
struct dpcls *cls;
odp_port_t in_port = match->flow.in_port.odp_port;
+ /* As we select the dpcls based on the port number, each netdev flow
+ * belonging to the same dpcls will have the same odp_port value.
+ * For performance reasons here we wildcard odp_port in the mask. In the
+ * physical case where dp_hash is also wildcarded, the resulting 8-byte
+ * chunk {dp_hash, in_port} will be ignored by netdev_flow_mask_init() and
+ * will not be part of the subtable mask.
+ * This will speed up the hash computation during dpcls_lookup() because
+ * one call to hash_add64() will be skipped. */
+ ovs_assert(match->wc.masks.in_port.odp_port == ODPP_NONE);
+ match->wc.masks.in_port.odp_port = 0;
netdev_flow_mask_init(&mask, match);
+ match->wc.masks.in_port.odp_port = ODPP_NONE;
/* Make sure wc does not have metadata. */
ovs_assert(!FLOWMAP_HAS_FIELD(&mask.mf.map, metadata)
&& !FLOWMAP_HAS_FIELD(&mask.mf.map, regs));
--
2.4.11
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev