Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2459017pxb; Tue, 13 Apr 2021 02:21:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZIMuDGbKLj946wrbDOdC3w0JVf7aUfeG7DgqrBgB2s+ArgqRh6PpHrlM7JXkEYe6kCNpb X-Received: by 2002:a17:902:6544:b029:ea:f94e:9d4e with SMTP id d4-20020a1709026544b02900eaf94e9d4emr9874269pln.16.1618305682898; Tue, 13 Apr 2021 02:21:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618305682; cv=none; d=google.com; s=arc-20160816; b=Nb72K+MdIwjpj3s2uDU6HxGfT+wuwbC+ruvw0dHL/FWZU+MB17ibOVIfwo2HtlVUqF H22v4M1FuOrHf4e7MCdO3lfH0PoO1h7grluFmlv+aPgcoi5SSJ7VftczgTyeFqN0rI35 uinC2jlv3BgtsQmZaFbYikyNUXwh6R+EkezyycoP4p7jeLPjnMpFSALTldMLo/Y99Xcv VKJQyBZQrSH2kFC4x25FFspGtv/417yktegaoWpWz8mQWrJr8IZhXPUkIu28oiWesLTJ MQDdCO366SnfOLK6ekb5vZwItJ/C6alMktie6BsiMdWkAo9PukvQQVEBO0/nbmA5QDQ5 1Q1w== 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=z5OlFcrUQJFhiQBMW3HTyxbEEm1bsHTIbSfup/ojSUU=; b=eEFJ3j3zJ/fJZtCQDi50EqdQ0zqgkpOjaLUsbwvdNpwKhtLDTO4k1TAtUQoP2qY2cs Wo3t0APZO657xRQBl7VLBRx6lg4DonTEj7S+OKZGKwP7vE668NrdZqx8ojVbwh+O5goI T6Zm/rDOrMpTDo+fxHUUtVNe+PwQyc/YxXqf0SVECV8MsY6I1ksJJJiG4SJN7HK7pCtS ditF0e58SjKoX5KsaPF80QAqA1tpk7GHzFkIF12U+a6P4CVXJBfkvwrFx4V5ALYWq6w6 FERx/E6yBpZE2SnMTiMVRzVWJQw2RDlME2nAbQKXjafwR9Sx/IRZw5PjDGFj4EX/cFmZ miSg== 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 j21si17088929pfr.154.2021.04.13.02.21.09; Tue, 13 Apr 2021 02:21:22 -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 S238935AbhDMH1B (ORCPT + 99 others); Tue, 13 Apr 2021 03:27:01 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:49603 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S230252AbhDMH0w (ORCPT ); Tue, 13 Apr 2021 03:26:52 -0400 X-UUID: 75d284721cbd4963bacac58db4f67a12-20210413 X-UUID: 75d284721cbd4963bacac58db4f67a12-20210413 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] by mailgw02.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 796767578; Tue, 13 Apr 2021 15:26:26 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs06n1.mediatek.inc (172.21.101.129) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 13 Apr 2021 15:26:24 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 13 Apr 2021 15:26:24 +0800 From: Ryder Lee To: Felix Fietkau , Lorenzo Bianconi CC: Shayne Chen , , , Ryder Lee Subject: [PATCH 1/2] mt76: mt7615: only free skbs after mt7615_dma_reset() when reset happens Date: Tue, 13 Apr 2021 15:26:19 +0800 Message-ID: <1fc26bda42fcd85b4bcebc8520601c70b882aa34.1618297567.git.ryder.lee@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org In mt7615_mac_reset_work(), make sure freeing skbs after mt7615_dma_reset() and use ieee80211_free_txskb() in stead of to dev_kfree_skb_any() to report proper status. Signed-off-by: Ryder Lee --- drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 8 ++++++-- drivers/net/wireless/mediatek/mt76/mt7615/pci_mac.c | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c index 60aadf8a09cc..ce71e2c5a8d3 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c @@ -2037,8 +2037,12 @@ void mt7615_tx_token_put(struct mt7615_dev *dev) spin_lock_bh(&dev->token_lock); idr_for_each_entry(&dev->token, txwi, id) { mt7615_txp_skb_unmap(&dev->mt76, txwi); - if (txwi->skb) - dev_kfree_skb_any(txwi->skb); + if (txwi->skb) { + struct ieee80211_hw *hw; + + hw = mt76_tx_status_get_hw(&dev->mt76, txwi->skb); + ieee80211_free_txskb(hw, txwi->skb); + } mt76_put_txwi(&dev->mt76, txwi); } spin_unlock_bh(&dev->token_lock); diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/pci_mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/pci_mac.c index 7694391603dd..bcc4344bbfc3 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/pci_mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/pci_mac.c @@ -310,6 +310,9 @@ void mt7615_mac_reset_work(struct work_struct *work) if (mt7615_wait_reset_state(dev, MT_MCU_CMD_RESET_DONE)) { mt7615_dma_reset(dev); + mt7615_tx_token_put(dev); + idr_init(&dev->token); + mt76_wr(dev, MT_WPDMA_MEM_RNG_ERR, 0); mt7615_hif_int_event_trigger(dev, MT_MCU_INT_EVENT_PDMA_INIT); -- 2.18.0