Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp4142553ybd; Tue, 25 Jun 2019 15:03:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqwAQ+FHpTSHYjFXQSgJt0/63EzN8rqZmt4ZdnQPKvowIjbXaZxAAt/BQW/EmlFxka0qbtkl X-Received: by 2002:a17:90a:e397:: with SMTP id b23mr103879pjz.117.1561500225957; Tue, 25 Jun 2019 15:03:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561500225; cv=none; d=google.com; s=arc-20160816; b=utGbamkb0xyjAFLdQJb3/MkjvRj2Mv0LZ8AWmV1CtnQahiraO7qxOo2tlFjCxjkJ5x coQHIzBNbHg1nHjYULs/rCBvypD2Fd7WkaExwLDqnt69xjhXeCOzo6TAXfCQXzVXpJ2x QW/9MX5IZARmuPic5xsqNGMPysixhh3X4hu1D/gX5LTnfmq3AXnqJGLVGd6CeJNjTtgj RJv91TtO6WARfc9/9qOEeQr+mrvh2zRyj0RRnYU+OQn1lHTILeR3axaOOPec9xOuxC5J /xfPqyJvwsSr+py9Cvg8zU2AB3DI0gJwSLNdkl6KISUxEWM9Cr8R5HRi3YhFW8iPHKyW 9NHw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=pfwVUEUATJ1obkd4TFQrfOZBuhqE8nm/HTRE5jQStrU=; b=LszwDMiWRAkObAMbQyV2tl2/+PIzlRnNpbJOiCL1Rn2oLOdCKQUWJGoQ9ljRTt8E4F vLJboJUwlPZPnfckC5zipFxklomy8IuDj7i1bYW8Hqb0vqeNvFlgS0Ugqjy01L16rALZ 8EtylYP0gmgqKYaAKZWV60p8BE7uUZlHpyQEd1J3p4KCFMNTmXy5EmdxuWJedJwIjgbK WftBDBaXEqZVx4MxWgny+6dMQaqAh46yymfu2KW1kfgQWaMgxHbCmIlhtud1q5pI+vKT 2jO+kFXDkZfZ0RlFOhiEn1XBDd8CtNu5gGeffOxZ98YIYaGqfRnIReH1J9b/hc02xbaF Cq5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=E00tR+sZ; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m143si16580844pfd.224.2019.06.25.15.03.30; Tue, 25 Jun 2019 15:03:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=E00tR+sZ; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726341AbfFYWBx (ORCPT + 99 others); Tue, 25 Jun 2019 18:01:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:37548 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726287AbfFYWBx (ORCPT ); Tue, 25 Jun 2019 18:01:53 -0400 Received: from lore-desk-wlan.lan (unknown [151.66.61.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D8C742080C; Tue, 25 Jun 2019 22:01:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561500112; bh=UoBYvM55ZkxZSZEIRWLVjxw+oh4kvjrXUR3Y49Liqws=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E00tR+sZUTSdFhL1SZYk+BRPpz3OavWwJHDtJc/MH/cxFDcePsmLmc/1MOhW42lfI iLiA/BlASDvWY2cJlEpbHmJZTMRMU/Jb6NENLL9VYA1l59BdjLEHhLOaq7Czqweaiw O4vRryYq4VJL2COGY8mAnw+bP6GKFKCsr+VTinMM= From: Lorenzo Bianconi To: nbd@nbd.name Cc: lorenzo.bianconi@redhat.com, linux-wireless@vger.kernel.org, ryder.lee@mediatek.com, royluo@google.com, yf.luo@mediatek.com Subject: [RFC 3/5] mt76: mt7615: do not perform txcalibration before cac is complited Date: Wed, 26 Jun 2019 00:01:24 +0200 Message-Id: <98dd82966b4f468553ebbb6ebf41f7921c2be38b.1561499275.git.lorenzo@kernel.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Delay channel calibration after Channel Availability Check. Add some code cleanup to mt7615_mcu_set_channel Signed-off-by: Lorenzo Bianconi --- .../net/wireless/mediatek/mt76/mt7615/mcu.c | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c index c0fd0ad805b5..31bdab1b5df6 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c @@ -1279,7 +1279,8 @@ int mt7615_mcu_rdd_cmd(struct mt7615_dev *dev, int mt7615_mcu_set_channel(struct mt7615_dev *dev) { - struct cfg80211_chan_def *chdef = &dev->mt76.chandef; + struct cfg80211_chan_def *chandef = &dev->mt76.chandef; + int freq1 = chandef->center_freq1, freq2 = chandef->center_freq2; struct { u8 control_chan; u8 center_chan; @@ -1298,17 +1299,20 @@ int mt7615_mcu_set_channel(struct mt7615_dev *dev) u8 rsv1[3]; u8 txpower_sku[53]; u8 rsv2[3]; - } req = {0}; + } req = { + .control_chan = chandef->chan->hw_value, + .center_chan = ieee80211_frequency_to_channel(freq1), + .tx_streams = (dev->mt76.chainmask >> 8) & 0xf, + .rx_streams_mask = dev->mt76.antenna_mask, + .center_chan2 = ieee80211_frequency_to_channel(freq2), + }; int ret; - req.control_chan = chdef->chan->hw_value; - req.center_chan = ieee80211_frequency_to_channel(chdef->center_freq1); - req.tx_streams = (dev->mt76.chainmask >> 8) & 0xf; - req.rx_streams_mask = dev->mt76.antenna_mask; - req.switch_reason = CH_SWITCH_NORMAL; - req.band_idx = 0; - req.center_chan2 = ieee80211_frequency_to_channel(chdef->center_freq2); - req.txpower_drop = 0; + if ((chandef->chan->flags & IEEE80211_CHAN_RADAR) && + chandef->chan->dfs_state != NL80211_DFS_AVAILABLE) + req.switch_reason = CH_SWITCH_DFS; + else + req.switch_reason = CH_SWITCH_NORMAL; switch (dev->mt76.chandef.width) { case NL80211_CHAN_WIDTH_40: @@ -1333,6 +1337,7 @@ int mt7615_mcu_set_channel(struct mt7615_dev *dev) case NL80211_CHAN_WIDTH_20: default: req.bw = CMD_CBW_20MHZ; + break; } memset(req.txpower_sku, 0x3f, 49); -- 2.21.0