Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp2421970pxf; Sun, 4 Apr 2021 00:53:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6LQxcg2BVt9j/zDv0QiFh2b6/5ub25QBMY6y/wjxhFEmCU4r6v8ckHZDumzALs5doEEfm X-Received: by 2002:a02:942d:: with SMTP id a42mr19109728jai.71.1617522806228; Sun, 04 Apr 2021 00:53:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617522806; cv=none; d=google.com; s=arc-20160816; b=J/VvAgOhUbkGLJwEJsYeMm7abW8nrk8s4ibMm1d/Mg5MvCJNDAmniFfmHqiVWAryQc HQgzNhcU6c6khdOXn6Bf1Qx1DcBKE66IqhVLjR9tAMeJbRzkvogA78hFSIJpGYae0yd5 ebvAM3xAz5m9pIF/F3lE1mRKldEaBWL1Pe6bBoEB62T3hrl5ty00jHOAvJhbjP3v9YuE 3eVD69XSQmTurj6RXZ4aQwXzDjBAqrXdyTLZW2WDZU2DsPJmuBHgWGmrWFe0Bx7tM0uS iFe0FBFycB7wk3/8AP/grS/XNGl4jW1adIeILdw8ZyOIsREG0sWKT7IutF1T2rUf5q7k bUtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=UgHmoBrJEXetTX9Oe8vhV3lFkd9vWBLjrVJTgftYSqg=; b=bj084+UWOcWuzfS2qCLoxVY628peuScTzvLPGTOlpSTuL0AKHx09Oe0/gkflyMCU5C pHEjO5MpWxD2DviIBtCB4ncMx1XyLtI0KGb+LDDTwq4T/ihtr+W5q47awORfIQT/56At lwI5Xu0JFQWFxQQreM6DzAKTgbzU9YQ3NGQb7QP8TpW0GJJGuV2va0H0IP1WIQeDbJbE pQNTfClxudsiIHfy3bXW1ftOpXORnDzCm1gSCp0Cuz07oV6ri7SyfFQtpIy++w15oPEB xzQ7SgdCAd0gh7edc/S4rqC2xQI7PWZkrtABjQ7Dcf9NON9h5ox/PDKDIQqbeW5mY9pS EhsQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y14si12030797ilu.81.2021.04.04.00.53.12; Sun, 04 Apr 2021 00:53:26 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229578AbhDDHsm (ORCPT + 99 others); Sun, 4 Apr 2021 03:48:42 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:34594 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S229550AbhDDHsl (ORCPT ); Sun, 4 Apr 2021 03:48:41 -0400 X-UUID: ab7b507e141743619df071ff6bdfcba8-20210404 X-UUID: ab7b507e141743619df071ff6bdfcba8-20210404 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 469943707; Sun, 04 Apr 2021 15:48:33 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs06n2.mediatek.inc (172.21.101.130) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sun, 4 Apr 2021 15:48:31 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sun, 4 Apr 2021 15:48:31 +0800 From: Ryder Lee To: Felix Fietkau , Lorenzo Bianconi CC: Shayne Chen , , , Ryder Lee Subject: [PATCH 2/2] mt76: mt7915: fix mt7915_mcu_add_beacon Date: Sun, 4 Apr 2021 15:48:24 +0800 Message-ID: X-Mailer: git-send-email 2.18.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: 5D5E0432BA407BD1CD2D454D980094F6B26B7C043BB9E18AF3E8580CFB86F1482000:8 X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org ieee80211_beacon_get_template() returns NULL when beacon state is disabled. Signed-off-by: Ryder Lee --- .../net/wireless/mediatek/mt76/mt7915/mcu.c | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c index 2d2bae93133b..d2e5306b153c 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c @@ -2451,6 +2451,17 @@ int mt7915_mcu_add_beacon(struct ieee80211_hw *hw, struct bss_info_bcn *bcn; int len = MT7915_BEACON_UPDATE_SIZE + MAX_BEACON_SIZE; + rskb = mt7915_mcu_alloc_sta_req(dev, mvif, NULL, len); + if (IS_ERR(rskb)) + return PTR_ERR(rskb); + + tlv = mt7915_mcu_add_tlv(rskb, BSS_INFO_OFFLOAD, sizeof(*bcn)); + bcn = (struct bss_info_bcn *)tlv; + bcn->enable = en; + + if (!en) + goto out; + skb = ieee80211_beacon_get_template(hw, vif, &offs); if (!skb) return -EINVAL; @@ -2461,16 +2472,6 @@ int mt7915_mcu_add_beacon(struct ieee80211_hw *hw, return -EINVAL; } - rskb = mt7915_mcu_alloc_sta_req(dev, mvif, NULL, len); - if (IS_ERR(rskb)) { - dev_kfree_skb(skb); - return PTR_ERR(rskb); - } - - tlv = mt7915_mcu_add_tlv(rskb, BSS_INFO_OFFLOAD, sizeof(*bcn)); - bcn = (struct bss_info_bcn *)tlv; - bcn->enable = en; - if (mvif->band_idx) { info = IEEE80211_SKB_CB(skb); info->hw_queue |= MT_TX_HW_QUEUE_EXT_PHY; @@ -2481,6 +2482,7 @@ int mt7915_mcu_add_beacon(struct ieee80211_hw *hw, mt7915_mcu_beacon_cont(dev, rskb, skb, bcn, &offs); dev_kfree_skb(skb); +out: return mt76_mcu_skb_send_msg(&phy->dev->mt76, rskb, MCU_EXT_CMD(BSS_INFO_UPDATE), true); } -- 2.18.0