Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp773873ybm; Wed, 27 May 2020 07:44:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLASyVz4mZD7vU9EBIsZoxDxf+dswDlGTBNTpRtpzCF8n0N4vvQ6NMf9O/XjS/M7ITr1PU X-Received: by 2002:a50:f0ce:: with SMTP id a14mr24563967edm.131.1590590652305; Wed, 27 May 2020 07:44:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590590652; cv=none; d=google.com; s=arc-20160816; b=NO/mkOGx4lplqdE4dnfCxIiza/I3Jfun6stMeER1bjhcogEGs4Dz/mBfYUU7qQDRi1 pgJluqDDKhcOTmm88/AywKKQ27KRaaV2CrXbgttwQuzmclbqR2LNq+9/tfLZaOoD/fP4 fTSC0d7WVXzUCSlFYs1bxjZL6ancG19dfEl0QF1ld4Er6j2QoFWk/EU46Ohz3pJnkAdk YX2Rv4l6/VTRxjHsPLWab4VYgDBxU4k+8XQHMMQvZFfDHK3cj+GTgj57e4YLWx9xgYUC RUTco7oHSILlU+H+GtX5uJ4VEPEAsCsS6vEZszD9yUq7c3OYihOIBZBY5nqICeN6Cq8P xSAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=5tIZb+/b0JXOZX6sBpgH/obu1VUYM/fCvg617j/rOeQ=; b=m7t11kKzca5NGvcMJsCXnNzi479WFLMbkj0m5QLt0F+wzKmYiqioGMI2LMHZECFj8z 1ELlp1cp0nWiifN6ZNkah1p8kOAGpRcAX2Ao8t0sDgdVZUlB7iQc4y5egQXQUXjciZUF 7xucIZDhvNeAnSr34G/XPluMH9uPbcmZsZz6oOd/8IV8hkKMSFEjX/cfEN9KZYjszYLy DIuJippWyEmbzMKs0l5uDB2OmteoESsXGWQlKAGUiT4AoIGhCFEgnhGUt1IbiG8MA4XY w1HJnZoWC9cyk218W1za/u3HNfDdcyoKaNffHyxF88CqvdP+r0neBWuRbbOV3bsNt8lK 6gRA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j17si2026221edh.365.2020.05.27.07.43.47; Wed, 27 May 2020 07:44:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388359AbgE0Olx (ORCPT + 99 others); Wed, 27 May 2020 10:41:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387942AbgE0Olx (ORCPT ); Wed, 27 May 2020 10:41:53 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 228B0C05BD1E for ; Wed, 27 May 2020 07:41:53 -0700 (PDT) Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.93) (envelope-from ) id 1jdxFf-004ANJ-Dv; Wed, 27 May 2020 16:41:51 +0200 Message-ID: <74232fe9a140a15306c04f0509e6c615b8e329de.camel@sipsolutions.net> Subject: Re: [PATCH v3 10/11] mac80211: determine chantype from HE operation in 6 GHz From: Johannes Berg To: Rajkumar Manoharan , kvalo@codeaurora.org Cc: linux-wireless@vger.kernel.org, ath11k@lists.infradead.org Date: Wed, 27 May 2020 16:41:50 +0200 In-Reply-To: <1589399105-25472-10-git-send-email-rmanohar@codeaurora.org> References: <1589399105-25472-1-git-send-email-rmanohar@codeaurora.org> <1589399105-25472-10-git-send-email-rmanohar@codeaurora.org> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.2 (3.36.2-1.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Wed, 2020-05-13 at 12:45 -0700, Rajkumar Manoharan wrote: > In 6 GHz band, determine chandef from 6 GHz operation information > of HE operation element. So here we get to real differences ... > Reported-by: kernel test robot Huh? > +bool ieee80211_chandef_he_oper(struct ieee80211_sub_if_data *sdata, > + const struct ieee80211_he_operation *heop, > + struct cfg80211_chan_def *chandef) > +{ > + struct ieee80211_he_oper_6ghz_op_info info; > + const struct ieee80211_sta_he_cap *he_cap; > + struct ieee80211_supported_band *sband; > + struct cfg80211_chan_def new = *chandef; > + int cf0, cf1; > + int ccf0, ccf1; > + bool support_80_80; > + bool support_160; > + u8 he_phy_cap; > + u8 pos = 0; > + > + /* Below HE Operation check is required only for 6 GHz band */ > + if (chandef->chan->band != NL80211_BAND_6GHZ) > + return true; > + > + if (!heop) > + return false; > + > + sband = sdata->local->hw.wiphy->bands[chandef->chan->band]; > + if (!sband) > + return false; > + > + he_cap = ieee80211_get_he_iftype_cap(sband, sdata->vif.type); > + if (!he_cap) > + return false; > + > + if (!(le32_to_cpu(heop->he_oper_params) & > + IEEE80211_HE_OPERATION_6GHZ_OP_INFO)) > + return false; > + > + he_phy_cap = he_cap->he_cap_elem.phy_cap_info[0]; > + support_160 = > + !!(he_phy_cap & > + IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G); > + support_80_80 = > + !!(he_phy_cap & > + IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G); > + > + if (le32_to_cpu(heop->he_oper_params) & > + IEEE80211_HE_OPERATION_VHT_OPER_INFO) > + pos += 3; > + if (le32_to_cpu(heop->he_oper_params) & > + IEEE80211_HE_OPERATION_CO_HOSTED_BSS) > + pos += 1; This really gets better with the ieee80211_he_6ghz_oper() inline I wrote and posted in the other reply. > + case IEEE80211_HE_6GHZ_CHANWIDTH_160MHZ_80P80MHZ: > + new.center_freq1 = cf0; > + new.width = NL80211_CHAN_WIDTH_80; > + if (ccf1) { > + unsigned int diff; > + > + diff = abs(ccf1 - ccf0); > + if (diff == 8 && support_160) { > + new.width = NL80211_CHAN_WIDTH_160; > + new.center_freq1 = cf1; > + } else if ((diff > 8) && support_80_80) { > + new.width = NL80211_CHAN_WIDTH_80P80; > + new.center_freq2 = cf1; > + } > + } Hmm. Yes, we just had + case IEEE80211_HE_6GHZ_OPER_CTRL_CHANWIDTH_160MHZ: + if (abs(he_6ghz_oper->ccfs1 - he_6ghz_oper->ccfs0) == 8) + he_chandef.width = NL80211_CHAN_WIDTH_160; + else + he_chandef.width = NL80211_CHAN_WIDTH_80P80; + break; but that breaks if you don't support 80+80 or 160. OTOH, we check this later again, I think, and downgrade if we don't support it, so no harm done? I think I'd prefer the parsing to be exact, and then downgrade as necessary. That makes things a bit simpler. That may mean the place where you call this should be different though. johannes