From: Jakub Kicinski <kuba@kernel.org>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: Karthikeyan Periyasamy <quic_periyasa@quicinc.com>,
ath12k@lists.infradead.org, linux-wireless@vger.kernel.org,
Vasanthakumar Thiagarajan <quic_vthiagar@quicinc.com>,
netdev@vger.kernel.org
Subject: Re: [PATCH 02/13] wifi: nl80211: send underlying multi-hardware channel capabilities to user space
Date: Thu, 28 Mar 2024 11:49:03 -0700 [thread overview]
Message-ID: <20240328114903.1d0c8af9@kernel.org> (raw)
In-Reply-To: <9d0f309da45ae657cd2ce0bc11a93d66e856ef64.camel@sipsolutions.net>
On Thu, 28 Mar 2024 13:01:55 +0100 Johannes Berg wrote:
> If we do that, including NL80211_MULTI_HW_ATTR_IDX for illustrative
> purposes though I think it should be removed, we'd end up with:
>
> NL80211_ATTR_MULTI_HW
> - NL80211_MULTI_HW_ATTR_IDX: 0
> - NL80211_MULTI_HW_ATTR_FREQ: 2412
> - NL80211_MULTI_HW_ATTR_FREQ: 2417
> ...
> NL80211_ATTR_MULTI_HW
> - NL80211_MULTI_HW_ATTR_IDX: 1
> - NL80211_MULTI_HW_ATTR_FREQ: 5180
> - NL80211_MULTI_HW_ATTR_FREQ: 5200
> ...
>
> which _is_ a lot more compact, and removes all the uninteresting mid-
> level indexing.
>
> So in that sense, I prefer that, but I'm truly not sure how the (hand-
> written) userspace code would deal with that.
I think the best way today would be two walks:
for_each_attr() {
switch (type):
case THE_A_ARRAY_1:
cnt1++;
break;
case THE_A_ARRAY_2:
cnt2++;
break;
}
if (cnt1)
array_1 = calloc();
cnt1 = 0; /* we'll use it as index in second loop */
if (cnt2)
array_2 = calloc();
cnt2 = 0;
for_each_attr() {
/* [ normal parsing, populating array_1[cnt1++] etc. ] */
}
Compared to "indexed array" the only practical difference I think is
the fact that all attrs are walked. I think you have to count them
either way before parsing.
I was wondering at some point whether we should require that all
multi-attr attributes are grouped together. Or add an explicit "count"
attribute. But couldn't convince myself that such extra rules will
pay off sufficiently with perf and/or ease of use...
next prev parent reply other threads:[~2024-03-28 18:49 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20240328072916.1164195-1-quic_periyasa@quicinc.com>
[not found] ` <20240328072916.1164195-3-quic_periyasa@quicinc.com>
[not found] ` <6d92d0ba4a8764cd91cc20c4bd35613bcc41dfcd.camel@sipsolutions.net>
[not found] ` <9d5c2f9f-19b5-af4d-8018-1eb97fac10d6@quicinc.com>
2024-03-28 12:01 ` [PATCH 02/13] wifi: nl80211: send underlying multi-hardware channel capabilities to user space Johannes Berg
2024-03-28 15:10 ` Karthikeyan Periyasamy
2024-03-28 16:09 ` Johannes Berg
2024-03-28 16:14 ` Jeff Johnson
2024-03-28 16:17 ` Jeff Johnson
2024-03-28 16:17 ` Johannes Berg
2024-03-28 16:18 ` Johannes Berg
2024-03-28 18:49 ` Jakub Kicinski [this message]
2024-03-28 18:53 ` Johannes Berg
2024-03-28 18:57 ` Jakub Kicinski
2024-03-28 19:32 ` Johannes Berg
2024-03-29 14:21 ` Vasanthakumar Thiagarajan
2024-04-10 7:59 ` Johannes Berg
2024-04-10 16:52 ` Jeff Johnson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240328114903.1d0c8af9@kernel.org \
--to=kuba@kernel.org \
--cc=ath12k@lists.infradead.org \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=quic_periyasa@quicinc.com \
--cc=quic_vthiagar@quicinc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).