[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4b8339b7-9dc6-4231-a60f-0c9f6296358a@intel.com>
Date: Thu, 24 Apr 2025 08:59:45 -0700
From: Jacob Keller <jacob.e.keller@...el.com>
To: Jakub Kicinski <kuba@...nel.org>, <davem@...emloft.net>
CC: <netdev@...r.kernel.org>, <edumazet@...gle.com>, <pabeni@...hat.com>,
<andrew+netdev@...n.ch>, <horms@...nel.org>, <donald.hunter@...il.com>,
<sdf@...ichev.me>
Subject: Re: [PATCH net-next 11/12] tools: ynl-gen: don't init enum checks for
classic netlink
On 4/23/2025 7:12 PM, Jakub Kicinski wrote:
> - if 'enum' in self.attr:
> - enum = self.family.consts[self.attr['enum']]
> - low, high = enum.value_range()
> - if 'min' not in self.checks:
> - if low != 0 or self.type[0] == 's':
> - self.checks['min'] = low
> - if 'max' not in self.checks:
> - self.checks['max'] = high
> -
> - if 'min' in self.checks and 'max' in self.checks:
> - if self.get_limit('min') > self.get_limit('max'):
> - raise Exception(f'Invalid limit for "{self.name}" min: {self.get_limit("min")} max: {self.get_limit("max")}')
> - self.checks['range'] = True
> -
> - low = min(self.get_limit('min', 0), self.get_limit('max', 0))
> - high = max(self.get_limit('min', 0), self.get_limit('max', 0))
> - if low < 0 and self.type[0] == 'u':
> - raise Exception(f'Invalid limit for "{self.name}" negative limit for unsigned type')
> - if low < -32768 or high > 32767:
> - self.checks['full-range'] = True
> + if not family.is_classic():
> + # Classic families have some funny enums, don't bother
> + # computing checks we only need them for policy
> + self._init_checks()
>
I feel like having the comment inside the if block was a bit misleading
since its talking about skipping the checks, but this is the control
flow where we *don't* skip the checks. I guess thats a bit of taste as
to whether this makes sense to go before the if check or not.
Powered by blists - more mailing lists