On 2/17/22 13:57, Ilya Maximets wrote:
> On 1/31/22 11:34, Eelco Chaudron wrote:
>> Verify that the returned ifindex by netdev_get_ifindex() is valid.
>> This might not be the case in the ERSPAN port scenario, which can
>> not be offloaded.
> 
> Why exactly we can't get ifindex of the kernel interface?

Hmm.  I see that netdev_vport_tunnel_register() doesn't register
the .get_ifindex callback for erspan and some other tunnel types,
but I'm not sure why...

> 
>>
>> Signed-off-by: Eelco Chaudron <[email protected]>
>> ---
>>  lib/netdev-offload-tc.c |    9 +++++++++
>>  1 file changed, 9 insertions(+)
>>
>> diff --git a/lib/netdev-offload-tc.c b/lib/netdev-offload-tc.c
>> index 9845e8d3f..8135441c6 100644
>> --- a/lib/netdev-offload-tc.c
>> +++ b/lib/netdev-offload-tc.c
>> @@ -1842,6 +1842,15 @@ netdev_tc_flow_put(struct netdev *netdev, struct 
>> match *match,
>>                  return ENODEV;
>>              }
>>              action->out.ifindex_out = netdev_get_ifindex(outdev);
>> +
>> +            if (action->out.ifindex_out < 0) {
>> +                VLOG_DBG_RL(&rl,
>> +                            "Can't find ifindex for output port %s, error 
>> %d",
>> +                            netdev_get_name(outdev), 
>> action->out.ifindex_out);
>> +
> 
> We're leaking netdev reference here.
> 
> Shouldn't we check netdev_flow_api_equals(netdev, outdev) here instead?
> This way we will be sure that flow API was successfully initialized for
> the outdev and we're not mixing different offload providers.
> 
>> +                return -action->out.ifindex_out;
>> +            }
>> +
>>              action->out.ingress = is_internal_port(netdev_get_type(outdev));
>>              action->type = TC_ACT_OUTPUT;
>>              flower.action_count++;
>>

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to