Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp2421214pxf; Sun, 4 Apr 2021 00:51:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJysSwfFtXqE4Hv76CFW2Pe7QfH/CgbS9pIT4nVQVNJf/KinZm32o+1zaKcX/6PEhNupDT+t X-Received: by 2002:a05:6e02:216b:: with SMTP id s11mr15277091ilv.78.1617522669174; Sun, 04 Apr 2021 00:51:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617522669; cv=none; d=google.com; s=arc-20160816; b=f0oaOK0EK8yXIuWCDzpdhjW9uDHFJ5mbxiwz1W87jyegWcJ30FCLSvEzVPa+QozIVZ LcN6/FxsOZmvd9ymdElURfO4GXS6xhgpnmBa++d6RzZSjBzVvN+YPG+ODx2mXsSCqqYi FZyLnonLxqAGymczktZDrVDZx84rqPwt5sqBiO74vB5UBk73GOUPVPwUByb5nDtjLrfX riD0K7nX2/D8ao0QDjxS3Ppp6qsTjKI2u832kVIskIbUJlXpSDsKlZh+5gQfNckiMMHS UdcEbfuZvgTvpIXgklnOlmPwctRJ+JlEek+0QJSWm1nUbDV9SQCMOSbE/1tmshpAlEGc R0AQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=CGoipI3vA2XWSZvbZ/WZsZtakxsrEW8uGyvio/BPa/U=; b=glXVYupIO8Y0IjZlOi8owOPfYIr8sue317sJ/SbKciVAAJ+WDnLpq59kQZn+BkTNNl LtnSdSsTo1y/riLKRNxIPkJlS114ehZYoljfTZetDJQvB9mbrpB5fjzewEmBKuPO8wbe BBuG5WzdVLOvOjSYJxJ1U/WXLzIB7G5YB0jt7Jn0Ogz+0dtumVm2049xL4hgBlZB4Lz4 62C6q2UcsIfMnxNfqXKEDAg65tCtQ/Fa9Fw45JDClJ0/Bn8444YKKBPFjoO6L8C7RlGZ YCsUyh/VoQhm2ays0Tcig/qoIlr2xnERAEbwiJ2RYYpHKpGedJQ0lSW49D5QQSngiYxd YkWA== 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 w30si11947590jal.121.2021.04.04.00.50.41; Sun, 04 Apr 2021 00:51:09 -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 S229675AbhDDHsm (ORCPT + 99 others); Sun, 4 Apr 2021 03:48:42 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:36456 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S229569AbhDDHsl (ORCPT ); Sun, 4 Apr 2021 03:48:41 -0400 X-UUID: f16c3bb2a3f546859d5678e291bf383f-20210404 X-UUID: f16c3bb2a3f546859d5678e291bf383f-20210404 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 2119883454; Sun, 04 Apr 2021 15:48:33 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs08n2.mediatek.inc (172.21.101.56) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sun, 4 Apr 2021 15:48:30 +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:25 +0800 From: Ryder Lee To: Felix Fietkau , Lorenzo Bianconi CC: Shayne Chen , , , Ryder Lee Subject: [PATCH 1/2] mt76: mt7615: fix .add_beacon_offload() Date: Sun, 4 Apr 2021 15:48:23 +0800 Message-ID: X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: 107E1DE47BFFE049BF3324AC3A36DE74FC65B65B725E15F0D9C5F58DFB9999A92000: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, so beacon_offload cannot be disabled for some devices. Signed-off-by: Ryder Lee --- drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c index 04b21ec611bb..3274d079bd11 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c @@ -702,6 +702,9 @@ mt7615_mcu_add_beacon_offload(struct mt7615_dev *dev, }; struct sk_buff *skb; + if (!enable) + goto out; + skb = ieee80211_beacon_get_template(hw, vif, &offs); if (!skb) return -EINVAL; @@ -731,6 +734,7 @@ mt7615_mcu_add_beacon_offload(struct mt7615_dev *dev, } dev_kfree_skb(skb); +out: return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_BCN_OFFLOAD, &req, sizeof(req), true); } @@ -1165,8 +1169,8 @@ mt7615_mcu_uni_add_beacon_offload(struct mt7615_dev *dev, __le16 tim_ie_pos; __le16 csa_ie_pos; __le16 bcc_ie_pos; - /* 0: enable beacon offload - * 1: disable beacon offload + /* 0: disable beacon offload + * 1: enable beacon offload * 2: update probe respond offload */ u8 enable; @@ -1189,6 +1193,9 @@ mt7615_mcu_uni_add_beacon_offload(struct mt7615_dev *dev, }; struct sk_buff *skb; + if (!enable) + goto out; + skb = ieee80211_beacon_get_template(mt76_hw(dev), vif, &offs); if (!skb) return -EINVAL; @@ -1213,6 +1220,7 @@ mt7615_mcu_uni_add_beacon_offload(struct mt7615_dev *dev, } dev_kfree_skb(skb); +out: return mt76_mcu_send_msg(&dev->mt76, MCU_UNI_CMD_BSS_INFO_UPDATE, &req, sizeof(req), true); } -- 2.18.0