Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp444910pxf; Thu, 8 Apr 2021 06:26:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZsgSxazrRHWEIsvGXUDJViMS853IRMpgMTNLHOK0zi+R40s852vqvbgy5FoOT8/dQbfor X-Received: by 2002:aa7:c451:: with SMTP id n17mr11355750edr.197.1617888393142; Thu, 08 Apr 2021 06:26:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617888393; cv=none; d=google.com; s=arc-20160816; b=d6SJu9Mf7rXiG9gJugfD31OHIA2z844amP+a0uqbAqzO87up4V8vSuTPvyitopUYz4 t3fiBUYWpdii/vXbbBV+CXt/ZEvQw1eK6yH0aLjOF6t8V7xjgHGV4eJNXF8Ux6ixsBjz WP2oonpCz8O2gCkEsam0BaGHhFF82tk2qPMbPoz3af89M+q/O/xg5Krhg+seD1MZKY7M Ip9Xi+UUnkpd3DhqqorLgPw52J1aMTNSGTqUxmNP2Vy4WAy6/ZExo5vx3Ea+VvElFpVl Bq/VQudYhnvhpx70b6DnTVila2V7SzzXXkissRCV3gx9jaNOAND3RuI/MYJ7u2K4PT1H TFrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:to:from:subject:message-id; bh=C/y/JPa0oBqhU6rggNMd5R/mb2aHM88c+fit9ATf3cc=; b=DiIeBKrmq3plmymni5d6WddraGOe1RBDR73CadMhtvWpZOiJfpACsgePi1rerLYpFE thO2vuPcvvbBe0lFDK/yOU4b6CwtRO2nmhYqCjOhi1eGxaR1CPOQWahof8gElsOBnvia VhFa7yyaRpDDP8fuJZEKx1kaxf8Y+P3VOUGOqJoyWtYIIdA+ed1iJ2tQ45dmNE8d37Jd kO+/ANWeXtktKUtnqISfCFzrFfjQrm03ZAkZCDiWRMJi5wGgo/zgjeSgFXKexT1YcZL7 KO3y1hv394fqvp48sSaCVfaBPLh3rTIWywQ2PbB/7DZHulVd33ws/SfeXP6HFu4P8C+l ojIA== 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 lk24si12052998ejb.40.2021.04.08.06.26.03; Thu, 08 Apr 2021 06:26:33 -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 S231572AbhDHNZg (ORCPT + 99 others); Thu, 8 Apr 2021 09:25:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231158AbhDHNZf (ORCPT ); Thu, 8 Apr 2021 09:25:35 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28075C061760 for ; Thu, 8 Apr 2021 06:25:23 -0700 (PDT) Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94) (envelope-from ) id 1lUUeu-0090xF-Be; Thu, 08 Apr 2021 15:25:20 +0200 Message-ID: <0b89f56b37073b633b343a71a098247a53ec89f9.camel@sipsolutions.net> Subject: Re: [PATCH] wireless: Allow disabling TWT From: Johannes Berg To: greearb@candelatech.com, linux-wireless@vger.kernel.org Date: Thu, 08 Apr 2021 15:25:19 +0200 In-Reply-To: <20210306162010.16706-1-greearb@candelatech.com> (sfid-20210306_172115_779009_173A00D2) References: <20210306162010.16706-1-greearb@candelatech.com> (sfid-20210306_172115_779009_173A00D2) Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.4 (3.38.4-1.fc33) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-malware-bazaar: not-scanned Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Sat, 2021-03-06 at 08:20 -0800, greearb@candelatech.com wrote: > > + /* Apply overrides as needed. */ > + if (ifmgd->flags & IEEE80211_STA_DISABLE_TWT) { > + if (ext_capa) { > + if (ext_capa && ext_capa->datalen > 10) { > + ext_capa->data[9] &= ~(WLAN_EXT_CAPA10_TWT_RESPONDER_SUPPORT); So apart from the useless code (checking "ext_capa" twice, unnecessary nested ifs, unnecessary parentheses), this can already be done entirely by userspace, since it controls the ext capa we send. > > -static bool ieee80211_twt_req_supported(const struct sta_info *sta, > +static bool ieee80211_twt_req_supported(struct ieee80211_sub_if_data *sdata, > + const struct sta_info *sta, >   const struct ieee802_11_elems *elems) > This code here seems possibly wrong anyway since it doesn't take local capabilities into account, maybe it should, and then these changes wouldn't be necessary? > + /* Apply overrides as needed. */ > + if (ifmgd->flags & IEEE80211_STA_DISABLE_TWT) { > + struct ieee80211_he_cap_elem *hec; > + hec = (struct ieee80211_he_cap_elem *)(pos); > + hec->mac_cap_info[0] &= ~(IEEE80211_HE_MAC_CAP0_TWT_REQ); > + hec->mac_cap_info[0] &= ~(IEEE80211_HE_MAC_CAP0_TWT_RES); > + } Wait, we actually have TWT capability *twice*, once in HE and once in extended capabilities?! Fun. But for this shouldn't we have the more general "HE capability override" stuff that we have also for HT and VHT?