Re: [PATCH net-next v2 4/7] psp: add core tracked stat for outstanding tx keys
From: Daniel Zahka
Date: Thu Oct 29 2026 - 07:04:46 EST
On Thu Oct 29, 2026 at 3:14 AM EDT, Kiran Kella wrote:
> On Thu, Oct 29, 2026 at 3:59 AM Jakub Kicinski <kuba@xxxxxxxxxx> wrote:
>>
>> On Wed, 28 Oct 2026 17:16:17 +0530 Kiran Kella wrote:
>> > > + -
>> > > + name: tx-key-count
>> > > + type: uint
>> > > + doc: |
>> > > + Current number of Tx keys installed on the device.
>> > > + Only visible if the driver stores keys on device.
>> > > + Kernel statistic.
>> > >
>> >
>> > Maybe it is good to have a counter that denotes the number of PSP
>> > sessions set up on a device, which is managed in
>> > psp_dev_tx_key_add/psp_dev_tx_key_del operations similar to the
>> > tx-key-count. That way, even in non-SADB drivers the user can know the
>> > scale of the PSP sessions set up on a device at any time.
>>
>> AFAIR the thinking was to also implicitly flag that the device has
>> an SADB here. So this stat should probably be called tx-sadb-key-count.
>> We couldn't think of a reason to count the tx keys when SADB is not
>> present. Rx keys? maybe, because of SPI exhaustion. Tx keys - why..
>
> Tx keys to just provide info to the user about the scale of active PSP
> bidirectional sessions (after the key exchange) for debuggability and
> for any other derived scaling/performance metrics.
> Especially for non-SADB drivers, where there is no device limit on the
> Tx keys that can be created (of course limited by the SPI exhaustion
> on the peer).
The main use case I had in mind was seeing how much of a device's SADB
was in use. If the usage is high, maybe the user will have a policy to
not even try rx-assoc (which always succeeds), just to fail tx-assoc
with -ENOSPC.
Total active PSP connections on a host is something I think users will
want to track. I'm not sure it needs kernel support though.