Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp915267lqt; Fri, 7 Jun 2024 02:32:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVW050dC0UgkR19v3gP6YSptGXqr6DnWmXrQS/tTRqw1Z+nZD8iATsxfU9qBBtUozKSWLokuZ9Fq2zr2vf3Cw5bV3NHK0GAcoYht3rWgQ== X-Google-Smtp-Source: AGHT+IGq7lEH9HYuAHEY63P10oUKGtrS69S29cKZv2UIe2S+MWy2JkD7X4FDRw4fyvzdvbDN101V X-Received: by 2002:a05:6358:7e13:b0:19e:e5e1:adc8 with SMTP id e5c5f4694b2df-19f1ffa8bcdmr205608255d.30.1717752778579; Fri, 07 Jun 2024 02:32:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717752778; cv=pass; d=google.com; s=arc-20160816; b=MIADtuMt+o56mJDRUsgTNWniIfzaHoNDJQfQusSX9mEQ7mn4WSm8DSCYYyeUMRzjy+ FvaQVNSplgqwfMMEfx340XjejZkNhb4o8iaOft6B4d4sIs7GnzK1W6zRdnTGjPlgE7kP X5yPPPOaSQiUZJp0dfqsrp676Yp69+C1IrSuSRmh/2CMKAGV0iTNYsdczKqNqUU9V94o TFL5Voq/dIILgK5XMDzGA5ZfbwevTQinoX2MasYDrd2r4UD/CeqdwlxadJ1qrvx5jeF3 ExBd2ReT4Q0WNsf8DsAY4tvYlNStpnHSmAn18aA/B+ILEKmAuoaZCP+3ZoqkJ8pjrTNE d3/A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:references:in-reply-to:date:cc :to:from:subject:message-id:dkim-signature; bh=wNDpLAZwU/EYJiwT4OGqCeCzsKMxMr8tNN7YDNbfUtI=; fh=rs38UuQCQ8DkCwF6UY5N4wls6wAzuWU2MxQpFaxxuXg=; b=c3RK4bivgABh3lPK+p+VB7BQV5EyzUiZA0WWz61bvZ0ZEbgYbWvIFsayqunaoi4n/O WsvWZfEagvnOv0XpG06qGququxbPA24i3lS3zTHEwQa21/qA1o/n4poSnjSlNm/vPjd2 X+UwZwVdCnRGlUUvXhKggROYpxOGUbAr3hLjcpXGStGsaDn17GBtRuMaG0IrEIBfkeqZ 042Y1iKc2+a6eTzaIrGofEPL4wSFPDOSDAEAEiZKRz7lO+2uKiIwl7wb8TN0YHAvOghi tiPLKtJb8X2FszonmPJakX5d+RmVNRgp7jQ8IDxkDzCklcgLuvMD/lMw5RwTMwJ4gfX9 q0Yw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=MFqvTOaA; arc=pass (i=1 spf=pass spfdomain=sipsolutions.net dkim=pass dkdomain=sipsolutions.net dmarc=pass fromdomain=sipsolutions.net); spf=pass (google.com: domain of linux-wireless+bounces-8672-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-8672-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6e443b31ee2si372071a12.30.2024.06.07.02.32.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 02:32:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-8672-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=MFqvTOaA; arc=pass (i=1 spf=pass spfdomain=sipsolutions.net dkim=pass dkdomain=sipsolutions.net dmarc=pass fromdomain=sipsolutions.net); spf=pass (google.com: domain of linux-wireless+bounces-8672-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-8672-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 1F297281013 for ; Fri, 7 Jun 2024 09:32:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 71A3778C9A; Fri, 7 Jun 2024 09:32:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="MFqvTOaA" X-Original-To: linux-wireless@vger.kernel.org Received: from sipsolutions.net (s3.sipsolutions.net [168.119.38.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9FC8A12E1C1 for ; Fri, 7 Jun 2024 09:32:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=168.119.38.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717752774; cv=none; b=S7XGMWW0zJb1q6q266x0kzKAD9/8DaRCgAXukncIW+bhkZ2Y0je0T0N4HgqT5DpFQ+qVKkDE40zcu/E97enmKR8Mk33IXpPBS9z5Xl9Lb04jTDG6rtSx0TO6tuTeUMJ/hbd7wg8IkalmANrlNPbGnt3C7zSQkBWqrQ9KxzVmi/0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717752774; c=relaxed/simple; bh=w65lxOtJy3AUrfzDNltlSjXfUA8MPLYFUal35gi2TkA=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=bSh7JYIGtLlMA2rFZofx84WbW9wc7crrOciUsBw9Dqi+hbVSPDWFJ5rhkMpmRsBb6WUDIsbxUiBdTNtBwH7RwCaxE6R6TOJKPyT8TrICHWXiytEADlo4FmAgw5z05bXjRbHhrmbsIwhBbxw//hQ+LCop3tenD2fMNeFgwo8JZXM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net; spf=pass smtp.mailfrom=sipsolutions.net; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b=MFqvTOaA; arc=none smtp.client-ip=168.119.38.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sipsolutions.net DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=MIME-Version:Content-Transfer-Encoding: Content-Type:References:In-Reply-To:Date:Cc:To:From:Subject:Message-ID:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=wNDpLAZwU/EYJiwT4OGqCeCzsKMxMr8tNN7YDNbfUtI=; t=1717752769; x=1718962369; b=MFqvTOaAWKJg8pdwDQhBHIYy9SYq/19kB8+uPsDTGM0dETW JVyEkz36V+Pj2X2H0RFQKThH4+FkLM578OGbByozY30HG8W2xeUGP0vbmfVzYprOMzef3pA1DJCBd FR1g2zlqTUgpEx6B66VypmCL8cx3rlzvobg7eoY+xlkfDsA8yuqunLSflExyjEtESULxJPTNgH5nD e88ptkiE14zK+QHLv+8308/YSHtgbSk/iOIf/FvZcqWor8yzDJ80gN5nBh7CbRKtWsGJ35OXhBhcE fFt2AFCXMEm1YBid8TaUPEhl2Xo05+2qVX5mMLMR3GMuFZXfa7uGw2MupiANC0SA==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1sFVxl-00000000rzy-3mMt; Fri, 07 Jun 2024 11:32:46 +0200 Message-ID: <65e01dcab3e934b1295fe64d9d311bd1fbdd2665.camel@sipsolutions.net> Subject: Re: [RFC v3 3/8] wifi: cfg80211: extend interface combination check for multi-radio From: Johannes Berg To: Felix Fietkau , linux-wireless@vger.kernel.org Cc: quic_adisi@quicinc.com, quic_periyasa@quicinc.com, ath12k@lists.infradead.org Date: Fri, 07 Jun 2024 11:32:45 +0200 In-Reply-To: <754815488294f5b7f599b2adba085f1889b53b1a.1717696995.git-series.nbd@nbd.name> References: <754815488294f5b7f599b2adba085f1889b53b1a.1717696995.git-series.nbd@nbd.name> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.52.2 (3.52.2-1.fc40) Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-malware-bazaar: not-scanned On Thu, 2024-06-06 at 20:07 +0200, Felix Fietkau wrote: >=20 > @@ -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_beac= on_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 =3D -1; > =20 > *beacon_int_gcd =3D 0; > *beacon_int_different =3D false; > + if (radio) > + radio_idx =3D 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. =20 > + rdev =3D wiphy_to_rdev(wiphy); > list_for_each_entry(wdev, &wiphy->wdev_list, list) { > int wdev_bi; > + u32 mask; > =20 > /* 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? > =20 > + if (radio_idx >=3D 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 =3D 0; i < wiphy->n_iface_combinations; i++) { > - const struct ieee80211_iface_combination *c; > + if (radio) { > + c =3D radio->iface_combinations; > + n =3D radio->n_iface_combinations; > + } else { > + c =3D wiphy->iface_combinations; > + n =3D wiphy->n_iface_combinations; > + } > + for (i =3D 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