Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp1004712lqt; Fri, 7 Jun 2024 05:37:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW9w38NMQC5OO7ZOhh+VMW/Uq58mNyJbfFyprenW4vVZtCVV2nXeG4DzGll9zLK96LUMVjAeAif5Phfh4gDN4Ib9s0mvHA4pUXpDRDiZA== X-Google-Smtp-Source: AGHT+IGqxcK9LbHPM8tqmyR7ID1u/WJ2dlS42U0tDu3ceH2FPzaWo8q/F021M3StOwIDpKvevntC X-Received: by 2002:a67:f7c4:0:b0:48c:19d7:eb83 with SMTP id ada2fe7eead31-48c274b864amr1923568137.34.1717763826433; Fri, 07 Jun 2024 05:37:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717763826; cv=pass; d=google.com; s=arc-20160816; b=L9eOWGWySAADx43ZyutS30X8Ev30UNiPlKP50xK+VEpf162jhSJAvQtS742mOQNgvf DNS+PZIzXU1RSVWjhnZpEZ9qmFsJgNT30WZIj6mDPodMqgnAMhvi7Ad1h3cjIvglK4+3 uurVaBVvHBKchg7k6o2Kp0p9hZSi9bKfIypemp03zeTksUUHXAhqAgM3dLdn5sCn16bB hzNK8Lxn2+qEbNXFv5F1xWUp3Ip91I5UkbvwD3QMdwxHaI7BMgDnyONOb8NBDEk5HVer fNCtKT3UfnWAXesvdNGfZAKczcJrmrgi8Le5WXUPY/1zBoXUslnIJLHCVoPV5ZvjZ48h Bl1w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=EONA58GKhxEWo7KfkjqILqtjinFUj4gxSIC87MiQUaw=; fh=Glnsb4k+ktL/IlCgVa24txsgwg0jozxgwELhfayKUzw=; b=fBf6DDzImAVIyc1NX0BTllN42O8Au44eBiaAHofWtWXcWlQ4w355GfoF0QmuaxL8hG sOz/JVuDI+WLex5n1ZaQgKZZP8fvKjfBSYVnDK2ajaFaanpGwtgZLF9RKI1pYnQ5l1eS yn8NBcFefVEj0rP4zGYAg/eSyzD+thFlNA//gr7+u1M1D+0G/ipfSMqOvs9g0JlvkIBo aSNT5dFI6YVUG1QNWn0IE+httwwGdr0Hgz7O32X9K99Hx6Bc1zOli3tsw2P2mCnCpQ0G vG9C8zflWDGI8dMCX5Q29+Jg9nV5WLIq4rM0wFggTP1i9JzovaN5wK7yxS6RJhrZ2lvQ 6onQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=lEgWgf7T; arc=pass (i=1 dkim=pass dkdomain=nbd.name dmarc=pass fromdomain=nbd.name); spf=pass (google.com: domain of linux-wireless+bounces-8687-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-8687-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nbd.name Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-79533377b53si299598185a.652.2024.06.07.05.37.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 05:37:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-8687-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=lEgWgf7T; arc=pass (i=1 dkim=pass dkdomain=nbd.name dmarc=pass fromdomain=nbd.name); spf=pass (google.com: domain of linux-wireless+bounces-8687-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-8687-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nbd.name 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 903561C20B6D for ; Fri, 7 Jun 2024 12:37:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0C05E18F2D9; Fri, 7 Jun 2024 12:37:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b="lEgWgf7T" X-Original-To: linux-wireless@vger.kernel.org Received: from nbd.name (nbd.name [46.4.11.11]) (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 48D424AEC3 for ; Fri, 7 Jun 2024 12:37:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.4.11.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717763822; cv=none; b=ECt/WcIna+yXftpyHXn6Pq1xy2rH7PWC7O1XqMxoO7JEVltW84vMgaoJxVRzqYIbI8YCOULC0Jx4C6qcLdp31p197fgCOFlfzKGWshoddvFoZGxmvJnzU4Ih6bKXHQ6nZ78fd6Ef3guRvXk/ln/SNY30wEAKyTijrGOU19ciZRY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717763822; c=relaxed/simple; bh=Is4GtUvGhOk206no8dsxyEASqKiT3h6sPVHoIEHqZmI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=pap0v+8uXd1cWqIsopJ88dTq1tcV5xs5TkoM+vkCOIZLbk5exs8ghhF/GFXiA00K0u5X3LTBdXxvPqYMVlWX72PRRKJvP/FkrA+rMjMiH77LpMYuBo8hjb/KnS8Knmy1mgpy+Ome3mN17Szqe0mlhCzeMB4krrqbKMnpR48pimA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name; spf=none smtp.mailfrom=nbd.name; dkim=pass (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b=lEgWgf7T; arc=none smtp.client-ip=46.4.11.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=nbd.name DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=EONA58GKhxEWo7KfkjqILqtjinFUj4gxSIC87MiQUaw=; b=lEgWgf7Tkix7IWlFe3KQYpzFaV 5xpQMmNxkAKNjzfjb4PclbwJK7xKmo3blfRrhTtjx9VbpgfXVVTP/PVvlbZ9nCh3Qj2aRi/9xTiDM EVww+MHXreDqoOAvMMegC3e05qlJ5RHN2uiHZ+amTTjrtjd56M3PB/ld9mkhjtfl8ebE=; Received: from p4ff13226.dip0.t-ipconnect.de ([79.241.50.38] helo=nf.local) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1sFYq0-008tfH-3C; Fri, 07 Jun 2024 14:36:57 +0200 Message-ID: Date: Fri, 7 Jun 2024 14:36:56 +0200 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC v3 3/8] wifi: cfg80211: extend interface combination check for multi-radio To: Johannes Berg , linux-wireless@vger.kernel.org Cc: quic_adisi@quicinc.com, quic_periyasa@quicinc.com, ath12k@lists.infradead.org References: <754815488294f5b7f599b2adba085f1889b53b1a.1717696995.git-series.nbd@nbd.name> <65e01dcab3e934b1295fe64d9d311bd1fbdd2665.camel@sipsolutions.net> Content-Language: en-US From: Felix Fietkau Autocrypt: addr=nbd@nbd.name; keydata= xsDiBEah5CcRBADIY7pu4LIv3jBlyQ/2u87iIZGe6f0f8pyB4UjzfJNXhJb8JylYYRzIOSxh ExKsdLCnJqsG1PY1mqTtoG8sONpwsHr2oJ4itjcGHfn5NJSUGTbtbbxLro13tHkGFCoCr4Z5 Pv+XRgiANSpYlIigiMbOkide6wbggQK32tC20QxUIwCg4k6dtV/4kwEeiOUfErq00TVqIiEE AKcUi4taOuh/PQWx/Ujjl/P1LfJXqLKRPa8PwD4j2yjoc9l+7LptSxJThL9KSu6gtXQjcoR2 vCK0OeYJhgO4kYMI78h1TSaxmtImEAnjFPYJYVsxrhay92jisYc7z5R/76AaELfF6RCjjGeP wdalulG+erWju710Bif7E1yjYVWeA/9Wd1lsOmx6uwwYgNqoFtcAunDaMKi9xVQW18FsUusM TdRvTZLBpoUAy+MajAL+R73TwLq3LnKpIcCwftyQXK5pEDKq57OhxJVv1Q8XkA9Dn1SBOjNB l25vJDFAT9ntp9THeDD2fv15yk4EKpWhu4H00/YX8KkhFsrtUs69+vZQwc0cRmVsaXggRmll dGthdSA8bmJkQG5iZC5uYW1lPsJgBBMRAgAgBQJGoeQnAhsjBgsJCAcDAgQVAggDBBYCAwEC HgECF4AACgkQ130UHQKnbvXsvgCgjsAIIOsY7xZ8VcSm7NABpi91yTMAniMMmH7FRenEAYMa VrwYTIThkTlQzsFNBEah5FQQCACMIep/hTzgPZ9HbCTKm9xN4bZX0JjrqjFem1Nxf3MBM5vN CYGBn8F4sGIzPmLhl4xFeq3k5irVg/YvxSDbQN6NJv8o+tP6zsMeWX2JjtV0P4aDIN1pK2/w VxcicArw0VYdv2ZCarccFBgH2a6GjswqlCqVM3gNIMI8ikzenKcso8YErGGiKYeMEZLwHaxE Y7mTPuOTrWL8uWWRL5mVjhZEVvDez6em/OYvzBwbkhImrryF29e3Po2cfY2n7EKjjr3/141K DHBBdgXlPNfDwROnA5ugjjEBjwkwBQqPpDA7AYPvpHh5vLbZnVGu5CwG7NAsrb2isRmjYoqk wu++3117AAMFB/9S0Sj7qFFQcD4laADVsabTpNNpaV4wAgVTRHKV/kC9luItzwDnUcsZUPdQ f3MueRJ3jIHU0UmRBG3uQftqbZJj3ikhnfvyLmkCNe+/hXhPu9sGvXyi2D4vszICvc1KL4RD aLSrOsROx22eZ26KqcW4ny7+va2FnvjsZgI8h4sDmaLzKczVRIiLITiMpLFEU/VoSv0m1F4B FtRgoiyjFzigWG0MsTdAN6FJzGh4mWWGIlE7o5JraNhnTd+yTUIPtw3ym6l8P+gbvfoZida0 TspgwBWLnXQvP5EDvlZnNaKa/3oBes6z0QdaSOwZCRA3QSLHBwtgUsrT6RxRSweLrcabwkkE GBECAAkFAkah5FQCGwwACgkQ130UHQKnbvW2GgCeMncXpbbWNT2AtoAYICrKyX5R3iMAoMhw cL98efvrjdstUfTCP2pfetyN In-Reply-To: <65e01dcab3e934b1295fe64d9d311bd1fbdd2665.camel@sipsolutions.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 07.06.24 11:32, Johannes Berg wrote: > 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 :) ) I'll update the callback to return u32 >> +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. Will pass the index in directly. >> + 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? Not sure about this. I guess we can revisit it later since it's out of scope for this series. >> >> + 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? mask is supposed to be per wdev, which is iterated in a loop here. > >> + 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 :) Will move it into the loop body to make it more obvious. Thanks, - Felix