Re: [PATCH net] net: airoha: Fix PPE table access in airoha_ppe_debugfs_foe_show()

Lorenzo Bianconi
2025-07-31T09:21:00Z

[-- Attachment #1: Type: text/plain, Size: 911 bytes --]

> On Mon, 28 Jul 2025 13:58:08 +0200 Lorenzo Bianconi wrote:
> > +struct airoha_foe_entry *
> > +airoha_ppe_foe_get_entry_locked(struct airoha_ppe *ppe, u32 hash)
>
> Hm, could be just me, but the way we/I used _locked in the core was
> the opposite. _locked means the caller's already taken the lock.
> Here you seem to be saying that the "callee is locked"..
> Can we stick to core's interpretation?

sure, that's fine.

>
> > + struct airoha_foe_entry *hwe;
> > +
> > + spin_lock_bh(&ppe_lock);
> > + hwe = airoha_ppe_foe_get_entry(ppe, hash);
> > + spin_unlock_bh(&ppe_lock);
> > +
> > + return hwe;
>
> Is the lifetime of the hwe object somehow guaranteed in the debugfs
> code? Looks questionable..

PPE table entries are allocated at driver load and never freed, the hw is just
writing into this DMA area when the entry is binded.

Regards,
Lorenzo

> --
> pw-bot: cr

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]