Re: [PATCH net-next v3 04/12] psp: add support for socket-less psp associations

From: Björn Töpel

Date: Tue Dec 01 2026 - 14:10:54 EST


Todd Bert Freed <toddfreed@xxxxxxxx> writes:

>> > The kernel doesn't enforce key rotation for socket-less Rx the way it
>> > does for socket associations. A tc filter which matches a SPI of one
>> > generation will also match that SPI if subsequently re-used in another
>> > generation. It is up to userspace to deal with this eventuality by
>> > removing such rules in time. Userspace may subscribe to rotation
>> > notifications for this purpose.
>>
>> Could you talk about the rationale here? rx-spi-alloc returns the key
>> rotations, why not make the generation part of the flower match?
>
> Thanks for taking a look. The reason for doing it this way, is to enable
> hardware offload. The device can check the psp spi, psp version
> (packet fields), and psp device (it won't be seeing the packet otherwise).
>
> The rotations counter is stored on the psp device object (psd->stats).
> The device would not be able to perform a check against that.

Thanks, that makes sense...

I was thinking of the generation as part of the rule's lifetime. Could
flower remember the generation returned by rx-spi-alloc and still
program just the SPI match on the PSP device?

The rule would stay valid through the first rotation. On the second
rotation, could the PSP core and the driver make sure the old rule is
inactive in hardware before the device can hand out that SPI again? That
would keep the generation check out of the packet path and avoid the
window where userspace is reacting to a rotation but the stale rule can
already match a new owner's packets.

Is there a hardware or ordering constraint that makes that difficult?

Björn