The hash of the port number is only needed when a DPCLS needs to be
created. Move the hash calculation inside the if to accomplish this.

Signed-off-by: Cian Ferriter <cian.ferri...@intel.com>
---
 lib/dpif-netdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 676434308..6a607b96a 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -2412,9 +2412,10 @@ dp_netdev_pmd_find_dpcls(struct dp_netdev_pmd_thread 
*pmd,
     OVS_REQUIRES(pmd->flow_mutex)
 {
     struct dpcls *cls = dp_netdev_pmd_lookup_dpcls(pmd, in_port);
-    uint32_t hash = hash_port_no(in_port);
 
     if (!cls) {
+        uint32_t hash = hash_port_no(in_port);
+
         /* Create new classifier for in_port */
         cls = xmalloc(sizeof(*cls));
         dpcls_init(cls);
-- 
2.25.1

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to