dpif-netdev: Only hash port number when necessary.
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.
Acked-by: Mike Pattrick
@@ -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);
