2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

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.

Signed-off-by: Cian Ferriter <cian.ferriter@intel.com>
Acked-by: Mike Pattrick <mkp@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
Cian Ferriter
2022-04-29 15:44:33 +00:00
committed by Ilya Maximets
parent d7c0b90fa3
commit 5ec5473304

View File

@@ -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);