Linux-Wireless Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] mt76: do not inject packets if MT76_STATE_PM is set
@ 2020-07-30  9:27 Lorenzo Bianconi
  2020-07-30 13:40 ` kernel test robot
  0 siblings, 1 reply; 2+ messages in thread
From: Lorenzo Bianconi @ 2020-07-30  9:27 UTC (permalink / raw)
  To: nbd; +Cc: lorenzo.bianconi, sean.wang, linux-wireless

Do not tx packets in mt76_txq_send_burst() or mt76_txq_schedule_list()
if the device is in runtime-pm

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/net/wireless/mediatek/mt76/tx.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/tx.c b/drivers/net/wireless/mediatek/mt76/tx.c
index 3afd89ecd6c9..40ec55ac9a7c 100644
--- a/drivers/net/wireless/mediatek/mt76/tx.c
+++ b/drivers/net/wireless/mediatek/mt76/tx.c
@@ -460,7 +460,8 @@ mt76_txq_send_burst(struct mt76_phy *phy, struct mt76_sw_queue *sq,
 		if (probe)
 			break;
 
-		if (test_bit(MT76_RESET, &phy->state))
+		if (test_bit(MT76_STATE_PM, &phy->state) ||
+		    test_bit(MT76_RESET, &phy->state))
 			return -EBUSY;
 
 		skb = mt76_txq_dequeue(phy, mtxq, false);
@@ -516,7 +517,8 @@ mt76_txq_schedule_list(struct mt76_phy *phy, enum mt76_txq_id qid)
 		if (sq->swq_queued >= 4)
 			break;
 
-		if (test_bit(MT76_RESET, &phy->state)) {
+		if (test_bit(MT76_STATE_PM, &phy->state) ||
+		    test_bit(MT76_RESET, &phy->state)) {
 			ret = -EBUSY;
 			break;
 		}
-- 
2.26.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] mt76: do not inject packets if MT76_STATE_PM is set
  2020-07-30  9:27 [PATCH] mt76: do not inject packets if MT76_STATE_PM is set Lorenzo Bianconi
@ 2020-07-30 13:40 ` kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2020-07-30 13:40 UTC (permalink / raw)
  To: Lorenzo Bianconi, nbd
  Cc: kbuild-all, lorenzo.bianconi, sean.wang, linux-wireless


[-- Attachment #1: Type: text/plain, Size: 4758 bytes --]

Hi Lorenzo,

I love your patch! Yet something to improve:

[auto build test ERROR on wireless-drivers-next/master]
[also build test ERROR on wireless-drivers/master v5.8-rc7 next-20200729]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Lorenzo-Bianconi/mt76-do-not-inject-packets-if-MT76_STATE_PM-is-set/20200730-173004
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git master
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=xtensa 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/net/wireless/mediatek/mt76/tx.c: In function 'mt76_txq_send_burst':
>> drivers/net/wireless/mediatek/mt76/tx.c:443:16: error: 'MT76_STATE_PM' undeclared (first use in this function); did you mean 'MT76_STATE_ROC'?
     443 |   if (test_bit(MT76_STATE_PM, &phy->state) ||
         |                ^~~~~~~~~~~~~
         |                MT76_STATE_ROC
   drivers/net/wireless/mediatek/mt76/tx.c:443:16: note: each undeclared identifier is reported only once for each function it appears in
   drivers/net/wireless/mediatek/mt76/tx.c: In function 'mt76_txq_schedule_list':
   drivers/net/wireless/mediatek/mt76/tx.c:500:16: error: 'MT76_STATE_PM' undeclared (first use in this function); did you mean 'MT76_STATE_ROC'?
     500 |   if (test_bit(MT76_STATE_PM, &phy->state) ||
         |                ^~~~~~~~~~~~~
         |                MT76_STATE_ROC

vim +443 drivers/net/wireless/mediatek/mt76/tx.c

   394	
   395	static int
   396	mt76_txq_send_burst(struct mt76_phy *phy, struct mt76_sw_queue *sq,
   397			    struct mt76_txq *mtxq)
   398	{
   399		struct mt76_dev *dev = phy->dev;
   400		struct ieee80211_txq *txq = mtxq_to_txq(mtxq);
   401		enum mt76_txq_id qid = mt76_txq_get_qid(txq);
   402		struct mt76_wcid *wcid = mtxq->wcid;
   403		struct mt76_queue *hwq = sq->q;
   404		struct ieee80211_tx_info *info;
   405		struct sk_buff *skb;
   406		int n_frames = 1, limit;
   407		struct ieee80211_tx_rate tx_rate;
   408		bool ampdu;
   409		bool probe;
   410		int idx;
   411	
   412		if (test_bit(MT_WCID_FLAG_PS, &wcid->flags))
   413			return 0;
   414	
   415		skb = mt76_txq_dequeue(phy, mtxq, false);
   416		if (!skb)
   417			return 0;
   418	
   419		info = IEEE80211_SKB_CB(skb);
   420		if (!(wcid->tx_info & MT_WCID_TX_INFO_SET))
   421			ieee80211_get_tx_rates(txq->vif, txq->sta, skb,
   422					       info->control.rates, 1);
   423		tx_rate = info->control.rates[0];
   424	
   425		probe = (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE);
   426		ampdu = IEEE80211_SKB_CB(skb)->flags & IEEE80211_TX_CTL_AMPDU;
   427		limit = ampdu ? 16 : 3;
   428	
   429		if (ampdu)
   430			mt76_check_agg_ssn(mtxq, skb);
   431	
   432		idx = dev->queue_ops->tx_queue_skb(dev, qid, skb, wcid, txq->sta);
   433	
   434		if (idx < 0)
   435			return idx;
   436	
   437		do {
   438			bool cur_ampdu;
   439	
   440			if (probe)
   441				break;
   442	
 > 443			if (test_bit(MT76_STATE_PM, &phy->state) ||
   444			    test_bit(MT76_RESET, &phy->state))
   445				return -EBUSY;
   446	
   447			skb = mt76_txq_dequeue(phy, mtxq, false);
   448			if (!skb)
   449				break;
   450	
   451			info = IEEE80211_SKB_CB(skb);
   452			cur_ampdu = info->flags & IEEE80211_TX_CTL_AMPDU;
   453	
   454			if (ampdu != cur_ampdu ||
   455			    (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE)) {
   456				skb_queue_tail(&mtxq->retry_q, skb);
   457				break;
   458			}
   459	
   460			info->control.rates[0] = tx_rate;
   461	
   462			if (cur_ampdu)
   463				mt76_check_agg_ssn(mtxq, skb);
   464	
   465			idx = dev->queue_ops->tx_queue_skb(dev, qid, skb, wcid,
   466							   txq->sta);
   467			if (idx < 0)
   468				return idx;
   469	
   470			n_frames++;
   471		} while (n_frames < limit);
   472	
   473		if (!probe) {
   474			hwq->entry[idx].qid = sq - dev->q_tx;
   475			hwq->entry[idx].schedule = true;
   476			sq->swq_queued++;
   477		}
   478	
   479		dev->queue_ops->kick(dev, hwq);
   480	
   481		return n_frames;
   482	}
   483	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 64442 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-30  9:27 [PATCH] mt76: do not inject packets if MT76_STATE_PM is set Lorenzo Bianconi
2020-07-30 13:40 ` kernel test robot

Linux-Wireless Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-wireless/0 linux-wireless/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-wireless linux-wireless/ https://lore.kernel.org/linux-wireless \
		linux-wireless@vger.kernel.org
	public-inbox-index linux-wireless

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-wireless


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git