Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp374150lqh; Thu, 28 Mar 2024 05:02:31 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWmHHLiz1fIeyagUKHRfJ6jv6asiMTStiImPZuGfg13t7RIpNgCzJO4dEJhsaMHfAfe05+N3nIXDNH7x9RATEhMFo1gjiHKPbJKFWHefw== X-Google-Smtp-Source: AGHT+IGSZ87Hssat/y8bbcZ42BOgQKvfYT/qq+IRs5JdtVhIW7KMDmEyB4VWvhosZaKyv/IHSHDP X-Received: by 2002:a05:6a20:d38c:b0:1a3:6940:82ea with SMTP id iq12-20020a056a20d38c00b001a3694082eamr3380287pzb.31.1711627351243; Thu, 28 Mar 2024 05:02:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711627351; cv=pass; d=google.com; s=arc-20160816; b=L+XJS8hsU2Ib2ys+BwLyWZ/auokPdJsqGl7rlzqzG4dMqmQigmavlLNh7qx2XFeqGc 7qfNwveZhSEy4IBxhPJ0h9LKQeOluYpoXOp3+SHU42DbuB9vZ55oY5RUcnm+SaJfKGQ6 afzvdHGGHmluv0lIsGe3nGh2OMhaRD82DyPaw40kDWfecpU4OXzXvFHZ0YRJK4x1e7DM 4tSGAQO7ImseDxWqs6fmpXj4NPNW2T5riH6Bm8UOi8JSQU8KGrnX92zQvcod3asZ8oEh T9WxLgoYX4WKRsN7sGczuWt98S7MWYBxYMY7mcgWWkZWHz5epI9+G53jByqN+JQtuap1 Qq1w== 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=hVOuhICxUdhTInSEWv15GWO9hreXzs61ZuyZShZLH68=; fh=Hs7U+SKXINyko1W07g2arVI3vTuS3bSN9vja1hOJMd4=; b=QtnB9vikVeTkx6WOcyegHfZTAK3aoqf9IMni8/FsFCnjh+Q46a+/hJ0dFoGAMgiqw2 H4RN83+IKaSMdiPkAwk4e/xb0xuhD1q6P4WTK4Uc1cni2Zk3rbJPUyproEpY+iB4h6sD d0wCVpQzFwDDGR3paLlgbqhof6pZi7oWDXtLUa3ay/+NO/KL4RJyZyWjsoLdz2giiSGK IgXsQ3V+3F4PqFTD36R9zm0LQXXDX7eJY86UmYDzjd4B0l6db1mnPXorZ4SwrMg86IH2 /fdymzV+bVI1val9h6irD3bOUiKXhCrNv0HiXgfgS1HLAe+HL1SlzHTqDlWXnn4qLnqC nvNg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=LPLbZakZ; 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-5451-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-5451-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 q7-20020a655247000000b005dcb4f1acc6si1302710pgp.176.2024.03.28.05.02.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 05:02:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-5451-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=LPLbZakZ; 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-5451-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-5451-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 5DFC8296821 for ; Thu, 28 Mar 2024 12:02:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0DDAE7E564; Thu, 28 Mar 2024 12:02:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="LPLbZakZ" 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 102EB7EF00; Thu, 28 Mar 2024 12:02:00 +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=1711627322; cv=none; b=fzrY21ys/wKRd+1lt6eS426SHBWlnqEWqpy1Yhd53WzUAMhqXnS6PfPXi8lszmcgcpNI+SVI6/BRBPvBkWhwmrJuPQCCiVl6eV86YPwNse6z3q38MkKum+QwhfH3srdavNVkZwY54LX0FcKzR2U3VKCtGsNhGV5DVoDZ77Ff7Gk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711627322; c=relaxed/simple; bh=nrisgRUODTGQErEmWu+eI98Zdm3W823MDE1S5wWMYOE=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=sY9Fs5o0ySI49WF5eQVSpJordP6iH0QeVMEgUMMUs0INcO6sGeUJiTW/G7wUE9/A/4w09tOc8+DOzjqFCgeMdryFkn7uQ61xwwfww5UViekev3pq7fZoXjItHcbxK1b8qCe3LhjuX5cl3ggeOni9SLpC4PwhvAZdOJHCnThYAFQ= 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=LPLbZakZ; 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=hVOuhICxUdhTInSEWv15GWO9hreXzs61ZuyZShZLH68=; t=1711627321; x=1712836921; b=LPLbZakZwOSEAdIQwB0xLcWXnZcmX86j505pqG86+yKXR2x 0WOilkZ1QuswDMbWTff1bh26X/+Uk2xuysehgoEoQLBRrRevNQBl5SkPJk2Fknv7gqQw4K7C9bFw/ nW/UUIcbtp62W6roktJCwor02CxMqLzvA25C60LZL4j5a5u2xPJvG+c9z4myNZ6Oq93qINKqvNOdl /JLJz1gdz6rnFYBWMPThZl6f1hvvhMY1q28c6FQ1sSnRHGPcJHS8BwKa5rS88pj6ommCg9RaLGxrA esxX0oy1g5ssvQcZ20i+7hJxii13eK+by0WCd3z8xh9wY943vWMlLzOPUteS80mw==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1rpoSC-00000000wR3-2bD5; Thu, 28 Mar 2024 13:01:56 +0100 Message-ID: <9d0f309da45ae657cd2ce0bc11a93d66e856ef64.camel@sipsolutions.net> Subject: Re: [PATCH 02/13] wifi: nl80211: send underlying multi-hardware channel capabilities to user space From: Johannes Berg To: Karthikeyan Periyasamy , ath12k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, Vasanthakumar Thiagarajan , netdev@vger.kernel.org, Jakub Kicinski Date: Thu, 28 Mar 2024 13:01:55 +0100 In-Reply-To: <9d5c2f9f-19b5-af4d-8018-1eb97fac10d6@quicinc.com> References: <20240328072916.1164195-1-quic_periyasa@quicinc.com> <20240328072916.1164195-3-quic_periyasa@quicinc.com> <6d92d0ba4a8764cd91cc20c4bd35613bcc41dfcd.camel@sipsolutions.net> <9d5c2f9f-19b5-af4d-8018-1eb97fac10d6@quicinc.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.4 (3.50.4-1.fc39) 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-03-28 at 15:48 +0530, Karthikeyan Periyasamy wrote: > On 3/28/2024 1:19 PM, Johannes Berg wrote: > > On Thu, 2024-03-28 at 12:59 +0530, Karthikeyan Periyasamy wrote: > > > +/** > > > + * nl80211_multi_hw_attrs - multi-hw attributes > > > + * > > > + * @NL80211_MULTI_HW_ATTR_INVALID: invalid > > > + * @NL80211_MULTI_HW_ATTR_IDX: (u8) multi-HW index to refer the unde= rlying HW > > > + * for which the supported channel list is advertised. Internally re= fer > > > + * the index of the wiphy's @hw_chans array. > > Is there a good reason to expose this? Seems pretty internal to me, and > > not sure what userspace would do with it? >=20 > Hostapd use this hw index for the channel switch cmd. What, where? I don't see that in this patchset? And why?? In any case, unless I just missed it and you're going to tell me to look at patch N, we don't need it here, and then I'd prefer to keep it an internal detail until it's needed. > The hw index used as a sanity check to identify whether the user=20 > requested channel fall under the different hw or not. You mean within hostapd itself? That doesn't make sense, it can derive that information differently. > In split-phy hardware, 5GHz band supported by two physical hardware's.= =20 > First supports 5GHz Low band and second supports 5GHz High band. In your hardware design anyway, but yeah, I get it. > In this case, user space cannot use band vise check here to identify=20 > given channel or freq supported in the given hardware. No, but it also doesn't need an index assigned by the kernel for that. > > > + for (i =3D 0; i < wiphy->num_hw; i++) { > > > + hw_mac =3D nla_nest_start(msg, i + 1); > > And you kind of even have it here already ... >=20 > Then user and kernel have to make an assumption that implicit index used= =20 > in the life cycle. Agree that's maybe not a great idea, for all we care this could just use 0 as the index anyway. Which reminds me ... Right now, the way you have it, we have the following structure: NL80211_ATTR_MULTI_HW - 1 - NL80211_MULTI_HW_ATTR_IDX: 0 - NL80211_MULTI_HW_ATTR_FREQS - 0: 2412 - 1: 2417 ... - 2 - NL80211_MULTI_HW_ATTR_IDX: 1 - NL80211_MULTI_HW_ATTR_FREQS - ... as above with 5 GHz etc. ... Netlink is kind of moving away from nested arrays though: https://kernel.org/doc/html/latest/userspace-api/netlink/specs.html#multi-a= ttr-arrays https://kernel.org/doc/html/latest/userspace-api/netlink/genetlink-legacy.h= tml#attribute-type-nests This talks about families, but maybe we shouldn't read that literally and do the new style for new arrays in existing families as well, not just new families. 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. johannes