On Mon, Aug 21, 2023 at 11:23 PM Ales Musil <amu...@redhat.com> wrote:
>
>
>
> On Thu, Aug 10, 2023 at 2:44 PM Dumitru Ceara <dce...@redhat.com> wrote:
>>
>> There's currently no need to store both 'ovn_ls_port_group'
>> and 'ovn_port_group_ls' so just use the first type.
>>
>> Signed-off-by: Dumitru Ceara <dce...@redhat.com>
>
>
> Hi Dumitru,
>
> I have one small comment down below.
>

>> +static struct ls_port_group *
>> +ls_port_group_find(const struct hmap *ls_port_groups,
>> +                   const struct nbrec_logical_switch *nbs)
>> +{
>> +    struct ls_port_group *ls_pg;
>> +
>> +    HMAP_FOR_EACH_WITH_HASH (ls_pg, key_node,
uuid_hash(&nbs->header_.uuid),
>> +                             ls_port_groups) {
>
>
> Is the compiler smart enough to optimise the uuid_hash and call it only
once before the loop? I wouldn't count on it, it's probably better to move
it there.
>

It is not about the compiler. The hash will be evaluated only once, which
is just how the HMAP_FOR_EACH_WITH_HASH macro is implemented.

>>
>> +        if (nbs == ls_pg->nbs) {
>> +            return ls_pg;
>> +        }
>> +    }
>> +    return NULL;
>>  }
>>

>
> With that addressed:
>
> Acked-by: Ales Musil <amu...@redhat.com>
>

Acked-by: Han Zhou <hz...@ovn.org>
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to