Re: [PATCH wireless-next v4 08/21] wifi: nl80211/cfg80211: pack SMD dynamic context along with frame

From: Johannes Berg

Date: Mon Nov 16 2026 - 06:00:48 EST


On Fri, 2026-11-13 at 23:47 +0530, Pooventhiran G wrote:
>
> We moved to computing the size instead of having a fixed value because we
> transfer an almost dense context in one phase but just a very sparse one in
> another and thought this would save space on the nlmsg skb.
>

It saves allocation, not actual space in the message or for the
userspace copy. I'm not sure it's worth doing.

The biggest problem with this is that it's basically not maintainable.
We already see this in many places, with fixes to these things, if we
have allocation and building the frame separately.

> If we transfer
> data as D2.0 says, we will transfer about 330 bytes in Prep while only about
> 70 bytes in Exec. This assumes all 8 active data TIDs and without nlhdr
> overhead. Is it okay to define the max size (~400 bytes + nlhdr overhead)
> nevertheless to avoid this size computation?

If it's really that small just allocate NLMSG_GOODSIZE or whatever that
is, which is a bit under 4k so it just takes one page? Don't think it
matters here much, it's also short-lived (if not you have much bigger
problems).

> Ahh, I think I misreferred some examples (like cfg80211_net_detect_results())
> to cancel the inner nests but are pointless to an skb that is going to be
> freed. I will remove them.

It's also pointless to cancel inner nests when cancelling an outer, but
I'm sure we have plenty of code like that because the mere existence of
that API seems to make people think it should always be balanced ;)

johannes