From: Johannes Berg <johannes@sipsolutions.net>
To: Felix Fietkau <nbd@nbd.name>, linux-wireless@vger.kernel.org
Cc: quic_adisi@quicinc.com, quic_periyasa@quicinc.com,
ath12k@lists.infradead.org
Subject: Re: [RFC v3 3/8] wifi: cfg80211: extend interface combination check for multi-radio
Date: Fri, 07 Jun 2024 11:32:45 +0200 [thread overview]
Message-ID: <65e01dcab3e934b1295fe64d9d311bd1fbdd2665.camel@sipsolutions.net> (raw)
In-Reply-To: <754815488294f5b7f599b2adba085f1889b53b1a.1717696995.git-series.nbd@nbd.name>
On Thu, 2024-06-06 at 20:07 +0200, Felix Fietkau wrote:
>
> @@ -4577,6 +4579,7 @@ struct mgmt_frame_regs {
> *
> * @set_hw_timestamp: Enable/disable HW timestamping of TM/FTM frames.
> * @set_ttlm: set the TID to link mapping.
> + * @get_radio_mask: get bitmask of radios in use
> */
> struct cfg80211_ops {
> int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
> @@ -4938,6 +4941,8 @@ struct cfg80211_ops {
> struct cfg80211_set_hw_timestamp *hwts);
> int (*set_ttlm)(struct wiphy *wiphy, struct net_device *dev,
> struct cfg80211_ttlm_params *params);
> + int (*get_radio_mask)(struct wiphy *wiphy, struct net_device *dev,
> + u32 *mask);
not sure I see the point of this being a callback rather than being
passed in?
(Also, if really needed, do you actually expect a device with 32 radios?
if not you can use a return value instead of u32 *mask out pointer :) )
> +DEFINE_EVENT(wiphy_netdev_evt, rdev_get_radio_mask,
> + TP_PROTO(struct wiphy *wiphy, struct net_device *netdev),
> + TP_ARGS(wiphy, netdev)
> +);
and if we do need it that really should trace not just the fact that it
happened but also the return value and mask
> static void cfg80211_calculate_bi_data(struct wiphy *wiphy, u32 new_beacon_int,
> u32 *beacon_int_gcd,
> - bool *beacon_int_different)
> + bool *beacon_int_different,
> + const struct wiphy_radio *radio)
> {
> + struct cfg80211_registered_device *rdev;
> struct wireless_dev *wdev;
> + int radio_idx = -1;
>
> *beacon_int_gcd = 0;
> *beacon_int_different = false;
> + if (radio)
> + radio_idx = radio - wiphy->radio;
This can go oh so wrong ... and technically even be UB. I'd rather pass
the index from the driver, I guess, and validate it against n_radios.
> + rdev = wiphy_to_rdev(wiphy);
> list_for_each_entry(wdev, &wiphy->wdev_list, list) {
> int wdev_bi;
> + u32 mask;
>
> /* this feature isn't supported with MLO */
> if (wdev->valid_links)
> continue;
Are we expecting this to change? because the premise of this patchset is
MLO support, and yet with real MLO we won't get here?
Or is that because non-MLO interfaces could be created on this wiphy?
>
> + if (radio_idx >= 0) {
> + if (rdev_get_radio_mask(rdev, wdev->netdev, &mask))
> + continue;
here: given that 'radio'/'radio_idx' is passed in, not sure I see why
the mask couldn't also be passed in?
> + if (!(mask & BIT(radio_idx)))
> + continue;
that could use a comment
> - for (i = 0; i < wiphy->n_iface_combinations; i++) {
> - const struct ieee80211_iface_combination *c;
> + if (radio) {
> + c = radio->iface_combinations;
> + n = radio->n_iface_combinations;
> + } else {
> + c = wiphy->iface_combinations;
> + n = wiphy->n_iface_combinations;
> + }
> + for (i = 0; i < n; i++, c++) {
that c++ is a bit too hidden for my taste there, but YMMV and I guess if
I wasn't reading the diff it'd be more obvious :)
johannes
next prev parent reply other threads:[~2024-06-07 9:32 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-06 18:07 [RFC v3 0/8] cfg80211/mac80211: support defining multiple radios per wiphy Felix Fietkau
2024-06-06 18:07 ` [RFC v3 1/8] wifi: nl80211: split helper function from nl80211_put_iface_combinations Felix Fietkau
2024-06-06 18:07 ` [RFC v3 2/8] wifi: cfg80211: add support for advertising multiple radios belonging to a wiphy Felix Fietkau
2024-06-07 9:24 ` Johannes Berg
2024-06-07 10:00 ` Felix Fietkau
2024-06-06 18:07 ` [RFC v3 3/8] wifi: cfg80211: extend interface combination check for multi-radio Felix Fietkau
2024-06-07 9:32 ` Johannes Berg [this message]
2024-06-07 12:36 ` Felix Fietkau
2024-06-06 18:07 ` [RFC v3 4/8] wifi: mac80211: add support for DFS with multiple radios Felix Fietkau
2024-06-07 4:25 ` Karthikeyan Periyasamy
2024-06-07 4:35 ` Felix Fietkau
2024-06-07 4:54 ` Karthikeyan Periyasamy
2024-06-07 5:03 ` Felix Fietkau
2024-06-07 6:45 ` Karthikeyan Periyasamy
2024-06-07 8:16 ` Felix Fietkau
2024-06-07 8:54 ` Karthikeyan Periyasamy
2024-06-07 9:00 ` Felix Fietkau
2024-06-12 14:23 ` Karthikeyan Periyasamy
2024-06-12 14:29 ` Felix Fietkau
2024-06-06 18:07 ` [RFC v3 5/8] wifi: mac80211: add radio index to ieee80211_chanctx_conf Felix Fietkau
2024-06-06 18:07 ` [RFC v3 6/8] wifi: mac80211: extend ifcomb check functions for multi-radio Felix Fietkau
2024-06-07 4:45 ` Karthikeyan Periyasamy
2024-06-07 4:49 ` Felix Fietkau
2024-06-07 9:22 ` Karthikeyan Periyasamy
2024-06-07 10:07 ` Karthikeyan Periyasamy
2024-06-07 10:22 ` Felix Fietkau
2024-06-07 10:53 ` Karthikeyan Periyasamy
2024-06-07 11:04 ` Felix Fietkau
2024-06-12 12:05 ` Johannes Berg
2024-06-12 12:21 ` Felix Fietkau
2024-06-06 18:07 ` [RFC v3 7/8] wifi: mac80211: move code in ieee80211_link_reserve_chanctx to a helper Felix Fietkau
2024-06-06 18:07 ` [RFC v3 8/8] wifi: mac80211: add wiphy radio assignment and validation Felix Fietkau
2024-06-07 9:44 ` Johannes Berg
2024-06-07 9:53 ` Felix Fietkau
2024-06-07 10:12 ` Johannes Berg
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=65e01dcab3e934b1295fe64d9d311bd1fbdd2665.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=ath12k@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=nbd@nbd.name \
--cc=quic_adisi@quicinc.com \
--cc=quic_periyasa@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