From: Johannes Berg <johannes@sipsolutions.net>
To: Vasanthakumar Thiagarajan <quic_vthiagar@quicinc.com>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [RFC 2/4] wifi: nl80211: send underlying multi-hardware channel capabilities to user space
Date: Fri, 21 Oct 2022 14:13:26 +0200 [thread overview]
Message-ID: <9d09ce8fa217cdba7a79f4b35e4a4663e3a66e16.camel@sipsolutions.net> (raw)
In-Reply-To: <20220920100518.19705-3-quic_vthiagar@quicinc.com>
On Tue, 2022-09-20 at 15:35 +0530, Vasanthakumar Thiagarajan wrote:
>
> +++ b/include/uapi/linux/nl80211.h
> @@ -2749,6 +2749,12 @@ enum nl80211_commands {
> * When used with %NL80211_CMD_FRAME_TX_STATUS, indicates the ack RX
> * timestamp. When used with %NL80211_CMD_FRAME RX notification, indicates
> * the incoming frame RX timestamp.
> + *
> + * @NL80211_ATTR_MULTI_HW_MACS: nested attribute to send the hardware mac
Not sure I'd call this multiple MACs? It's multiple devices in some
sense, but from a spec POV at least, I'd think our NIC also has multiple
MACs when it doesn't use this infrastructure. Might get a bit confusing?
Maybe just stick to "multi_hw" or so?
> +/**
> + * nl80211_multi_hw_mac_attrs - multi-hw mac attributes
> + *
> + * @NL80211_MULTI_HW_MAC_ATTR_INVALID: invalid
> + * @NL80211_MULTI_HW_MAC_ATTR_IDX: (u8) array index in wiphy @hw_chans to refer an
> + * underlying hw mac for which the supported channel list is advertised.
I'd prefer this to be primarily written from a userspace POV, so the
whole "@hw_chans" etc isn't really right. Maybe say something like
"(u8) multi-HW index used to refer to an underlying HW ...; internally
the index of the wiphy's @hw_chans array."
or so?
> + * @NL80211_MULTI_HW_MAC_ATTR_FREQS: array of supported center frequencies
FWIW, Jakub has started advertising for using the same attribute
multiple times to have arrays, so you'd just have
{NL80211_MULTI_HW_ATTR_FREQ: 2412},
{NL80211_MULTI_HW_ATTR_FREQ: 2417},
{NL80211_MULTI_HW_ATTR_FREQ: 2422},
etc. in the message. Not sure we want to try that here, but it'd also
simplify splitting messages for dumps.
> +static int nl80211_put_multi_hw_support(struct wiphy *wiphy,
> + struct sk_buff *msg)
> +{
> + struct nlattr *hw_macs, *hw_mac;
> + struct nlattr *freqs;
> + int i, c;
> +
> + if (!wiphy->num_hw)
> + return 0;
> +
> + hw_macs = nla_nest_start(msg, NL80211_ATTR_MULTI_HW_MACS);
> + if (!hw_macs)
> + return -ENOBUFS;
> +
> + for (i = 0; i < wiphy->num_hw; i++) {
> + hw_mac = nla_nest_start(msg, i + 1);
> + if (!hw_mac)
> + return -ENOBUFS;
> +
> + if (nla_put_u8(msg, NL80211_MULTI_HW_MAC_ATTR_IDX, i))
> + return -ENOBUFS;
> +
> + freqs = nla_nest_start(msg,
> + NL80211_MULTI_HW_MAC_ATTR_FREQS);
> + if (!freqs)
> + return -ENOBUFS;
> +
> + for (c = 0; c < wiphy->hw_chans[i]->n_chans; c++)
> + if (nla_put_u32(msg, c + 1,
> + wiphy->hw_chans[i]->chans[c].center_freq))
> + return -ENOBUFS;
Ah you used a nested array even.
So the argument for using a real array would've been that it's smaller,
but I guess with nested that argument goes way.
Would you mind trying Jakub's preferred approach here and see how that
works out?
For the generator basically you'd just have
hw_mac = nla_nest_start();
nla_put_u8(IDX, i)
for (c = 0; c < ...; c++)
nla_put_u32(MULTI_HW_ATTR_FREQ, ...->chans[c].center_freq);
johannes
next prev parent reply other threads:[~2022-10-21 12:13 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-20 10:05 [RFC 0/4] wifi: cfg80211/mac80211: capability advertisement infra for multi-hw abstraction under one wiphy Vasanthakumar Thiagarajan
2022-09-20 10:05 ` [RFC 1/4] wifi: cfg80211: Add provision to advertise multiple radio in " Vasanthakumar Thiagarajan
2022-10-21 12:04 ` Johannes Berg
2022-10-21 12:45 ` Vasanthakumar Thiagarajan
2022-09-20 10:05 ` [RFC 2/4] wifi: nl80211: send underlying multi-hardware channel capabilities to user space Vasanthakumar Thiagarajan
2022-10-21 12:13 ` Johannes Berg [this message]
2022-10-21 12:57 ` Vasanthakumar Thiagarajan
2022-09-20 10:05 ` [RFC 3/4] wifi: cfg80211/mac80211: extend iface comb advertisement for multi-hardware dev Vasanthakumar Thiagarajan
2022-10-21 12:22 ` Johannes Berg
2022-10-21 13:21 ` Vasanthakumar Thiagarajan
2022-09-20 10:05 ` [RFC 4/4] wifi: nl80211: send iface combination to user space in multi-hardware wiphy Vasanthakumar Thiagarajan
2022-10-21 12:25 ` Johannes Berg
2022-10-21 13:31 ` Vasanthakumar Thiagarajan
2022-10-21 11:57 ` [RFC 0/4] wifi: cfg80211/mac80211: capability advertisement infra for multi-hw abstraction under one wiphy Johannes Berg
2022-10-21 12:11 ` Vasanthakumar Thiagarajan
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=9d09ce8fa217cdba7a79f4b35e4a4663e3a66e16.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--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