Subject: Re: [PATCH net-next v3 3/4] tools/net/ynl: Handle acks that use req_value

From: Donald Hunter <[email-masked]>
Date: Wed, 17 Apr 2024 13:51:38 +0100

Jakub Kicinski <[email-masked]> writes:

> On Tue, 16 Apr 2024 20:32:14 +0100 Donald Hunter wrote:
>> The nfnetlink family uses the directional op model but errors get
>> reported using the request value instead of the reply value.
>
> What's an error in this case ? "Normal" errors come via NLMSG_ERROR

Thanks for pointing out what should have been obvious. Looking at it
again today, I realise I missed the root cause which was a bug in the
extack decoding for directional ops. When I fix that issue, this patch
can be dropped.

>> diff --git a/tools/net/ynl/lib/nlspec.py b/tools/net/ynl/lib/nlspec.py
>> index 6d08ab9e213f..04085bc6365e 100644
>> --- a/tools/net/ynl/lib/nlspec.py
>> +++ b/tools/net/ynl/lib/nlspec.py
>> @@ -567,6 +567,18 @@ class SpecFamily(SpecElement):
>>            return op
>>        return None
>>  
>> +    def get_op_by_value(self, value):
>> +        """
>> +        For a given operation value, look up operation spec. Search
>> +        by response value first then fall back to request value. This
>> +        is required for handling failure cases.
>
> Looks like we're only going to need it in NetlinkProtocol, so that's
> fine. But let's somehow call out that this is a bit of a hack, so that
> people don't feel like this is the more correct way of finding the op
> than direct access to rsp_by_value[].