[PATCH 2/3] mt76: mt7915: report tx rate directly from tx status
kernel test robot
lkp at intel.com
Wed Jul 14 01:02:48 PDT 2021
Hi Ryder,
I love your patch! Perhaps something to improve:
[auto build test WARNING on wireless-drivers-next/master]
[also build test WARNING on v5.14-rc1 next-20210714]
[cannot apply to wireless-drivers/master]
[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/Ryder-Lee/mt76-mt7915-take-RCU-read-lock-when-calling-ieee80211_bss_get_elem/20210714-133745
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
# https://github.com/0day-ci/linux/commit/787e54058191f647390d63f0f608de62a3d3a3e8
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Ryder-Lee/mt76-mt7915-take-RCU-read-lock-when-calling-ieee80211_bss_get_elem/20210714-133745
git checkout 787e54058191f647390d63f0f608de62a3d3a3e8
# 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 at intel.com>
All warnings (new ones prefixed by >>):
drivers/net/wireless/mediatek/mt76/mt7915/mac.c: In function 'mt7915_mac_tx_free':
>> drivers/net/wireless/mediatek/mt76/mt7915/mac.c:1221:23: warning: variable 'phy' set but not used [-Wunused-but-set-variable]
1221 | struct mt7915_phy *phy;
| ^~~
drivers/net/wireless/mediatek/mt76/mt7915/mac.c:1213:6: warning: variable 'stat' set but not used [-Wunused-but-set-variable]
1213 | u8 stat;
| ^~~~
drivers/net/wireless/mediatek/mt76/mt7915/mac.c: In function 'mt7915_mac_add_txs_skb':
>> drivers/net/wireless/mediatek/mt76/mt7915/mac.c:1271:21: warning: variable 'msta' set but not used [-Wunused-but-set-variable]
1271 | struct mt7915_sta *msta;
| ^~~~
drivers/net/wireless/mediatek/mt76/mt7915/mac.c: In function 'mt7915_tx_complete_skb':
drivers/net/wireless/mediatek/mt76/mt7915/mac.c:1463:21: warning: variable 'dev' set but not used [-Wunused-but-set-variable]
1463 | struct mt7915_dev *dev;
| ^~~
vim +/phy +1221 drivers/net/wireless/mediatek/mt76/mt7915/mac.c
e57b7901469fc0 Ryder Lee 2020-04-25 1183
338330bd26b1fe Felix Fietkau 2021-05-07 1184 static void
338330bd26b1fe Felix Fietkau 2021-05-07 1185 mt7915_mac_tx_free(struct mt7915_dev *dev, struct sk_buff *skb)
e57b7901469fc0 Ryder Lee 2020-04-25 1186 {
e57b7901469fc0 Ryder Lee 2020-04-25 1187 struct mt7915_tx_free *free = (struct mt7915_tx_free *)skb->data;
e57b7901469fc0 Ryder Lee 2020-04-25 1188 struct mt76_dev *mdev = &dev->mt76;
4c430774e01b06 Lorenzo Bianconi 2020-11-13 1189 struct mt76_phy *mphy_ext = mdev->phy2;
e57b7901469fc0 Ryder Lee 2020-04-25 1190 struct mt76_txwi_cache *txwi;
e57b7901469fc0 Ryder Lee 2020-04-25 1191 struct ieee80211_sta *sta = NULL;
660915d052c606 Felix Fietkau 2020-09-01 1192 LIST_HEAD(free_list);
660915d052c606 Felix Fietkau 2020-09-01 1193 struct sk_buff *tmp;
e57b7901469fc0 Ryder Lee 2020-04-25 1194 u8 i, count;
5342758d5522db Felix Fietkau 2020-11-21 1195 bool wake = false;
e57b7901469fc0 Ryder Lee 2020-04-25 1196
f8a667a9af9198 Felix Fietkau 2020-08-22 1197 /* clean DMA queues and unmap buffers first */
91990519298e23 Lorenzo Bianconi 2020-11-11 1198 mt76_queue_tx_cleanup(dev, dev->mphy.q_tx[MT_TXQ_PSD], false);
91990519298e23 Lorenzo Bianconi 2020-11-11 1199 mt76_queue_tx_cleanup(dev, dev->mphy.q_tx[MT_TXQ_BE], false);
4c430774e01b06 Lorenzo Bianconi 2020-11-13 1200 if (mphy_ext) {
4c430774e01b06 Lorenzo Bianconi 2020-11-13 1201 mt76_queue_tx_cleanup(dev, mphy_ext->q_tx[MT_TXQ_PSD], false);
4c430774e01b06 Lorenzo Bianconi 2020-11-13 1202 mt76_queue_tx_cleanup(dev, mphy_ext->q_tx[MT_TXQ_BE], false);
4c430774e01b06 Lorenzo Bianconi 2020-11-13 1203 }
f8a667a9af9198 Felix Fietkau 2020-08-22 1204
e57b7901469fc0 Ryder Lee 2020-04-25 1205 /*
e57b7901469fc0 Ryder Lee 2020-04-25 1206 * TODO: MT_TX_FREE_LATENCY is msdu time from the TXD is queued into PLE,
e57b7901469fc0 Ryder Lee 2020-04-25 1207 * to the time ack is received or dropped by hw (air + hw queue time).
e57b7901469fc0 Ryder Lee 2020-04-25 1208 * Should avoid accessing WTBL to get Tx airtime, and use it instead.
e57b7901469fc0 Ryder Lee 2020-04-25 1209 */
e57b7901469fc0 Ryder Lee 2020-04-25 1210 count = FIELD_GET(MT_TX_FREE_MSDU_CNT, le16_to_cpu(free->ctrl));
e57b7901469fc0 Ryder Lee 2020-04-25 1211 for (i = 0; i < count; i++) {
e57b7901469fc0 Ryder Lee 2020-04-25 1212 u32 msdu, info = le32_to_cpu(free->info[i]);
e57b7901469fc0 Ryder Lee 2020-04-25 1213 u8 stat;
e57b7901469fc0 Ryder Lee 2020-04-25 1214
e57b7901469fc0 Ryder Lee 2020-04-25 1215 /*
e57b7901469fc0 Ryder Lee 2020-04-25 1216 * 1'b1: new wcid pair.
e57b7901469fc0 Ryder Lee 2020-04-25 1217 * 1'b0: msdu_id with the same 'wcid pair' as above.
e57b7901469fc0 Ryder Lee 2020-04-25 1218 */
e57b7901469fc0 Ryder Lee 2020-04-25 1219 if (info & MT_TX_FREE_PAIR) {
e57b7901469fc0 Ryder Lee 2020-04-25 1220 struct mt7915_sta *msta;
1daf2522fa1604 Felix Fietkau 2020-07-26 @1221 struct mt7915_phy *phy;
e57b7901469fc0 Ryder Lee 2020-04-25 1222 struct mt76_wcid *wcid;
e57b7901469fc0 Ryder Lee 2020-04-25 1223 u16 idx;
e57b7901469fc0 Ryder Lee 2020-04-25 1224
e57b7901469fc0 Ryder Lee 2020-04-25 1225 count++;
e57b7901469fc0 Ryder Lee 2020-04-25 1226 idx = FIELD_GET(MT_TX_FREE_WLAN_ID, info);
e57b7901469fc0 Ryder Lee 2020-04-25 1227 wcid = rcu_dereference(dev->mt76.wcid[idx]);
e57b7901469fc0 Ryder Lee 2020-04-25 1228 sta = wcid_to_sta(wcid);
e57b7901469fc0 Ryder Lee 2020-04-25 1229 if (!sta)
e57b7901469fc0 Ryder Lee 2020-04-25 1230 continue;
e57b7901469fc0 Ryder Lee 2020-04-25 1231
e57b7901469fc0 Ryder Lee 2020-04-25 1232 msta = container_of(wcid, struct mt7915_sta, wcid);
1daf2522fa1604 Felix Fietkau 2020-07-26 1233 phy = msta->vif->phy;
1daf2522fa1604 Felix Fietkau 2020-07-26 1234 spin_lock_bh(&dev->sta_poll_lock);
1daf2522fa1604 Felix Fietkau 2020-07-26 1235 if (list_empty(&msta->poll_list))
1daf2522fa1604 Felix Fietkau 2020-07-26 1236 list_add_tail(&msta->poll_list, &dev->sta_poll_list);
1daf2522fa1604 Felix Fietkau 2020-07-26 1237 spin_unlock_bh(&dev->sta_poll_lock);
6425791d350301 Felix Fietkau 2020-09-27 1238 continue;
e57b7901469fc0 Ryder Lee 2020-04-25 1239 }
e57b7901469fc0 Ryder Lee 2020-04-25 1240
e57b7901469fc0 Ryder Lee 2020-04-25 1241 msdu = FIELD_GET(MT_TX_FREE_MSDU_ID, info);
e57b7901469fc0 Ryder Lee 2020-04-25 1242 stat = FIELD_GET(MT_TX_FREE_STATUS, info);
e57b7901469fc0 Ryder Lee 2020-04-25 1243
d089692bc7938a Lorenzo Bianconi 2021-04-20 1244 txwi = mt76_token_release(mdev, msdu, &wake);
e57b7901469fc0 Ryder Lee 2020-04-25 1245 if (!txwi)
e57b7901469fc0 Ryder Lee 2020-04-25 1246 continue;
e57b7901469fc0 Ryder Lee 2020-04-25 1247
223fd4f8430810 Felix Fietkau 2021-05-07 1248 mt7915_txwi_free(dev, txwi, sta, &free_list);
e57b7901469fc0 Ryder Lee 2020-04-25 1249 }
0f1c443ca9cfa0 Felix Fietkau 2020-08-20 1250
0f1c443ca9cfa0 Felix Fietkau 2020-08-20 1251 mt7915_mac_sta_poll(dev);
5342758d5522db Felix Fietkau 2020-11-21 1252
d089692bc7938a Lorenzo Bianconi 2021-04-20 1253 if (wake)
d089692bc7938a Lorenzo Bianconi 2021-04-20 1254 mt76_set_tx_blocked(&dev->mt76, false);
5342758d5522db Felix Fietkau 2020-11-21 1255
781eef5b34c57d Felix Fietkau 2020-07-24 1256 mt76_worker_schedule(&dev->mt76.tx_worker);
660915d052c606 Felix Fietkau 2020-09-01 1257
660915d052c606 Felix Fietkau 2020-09-01 1258 napi_consume_skb(skb, 1);
660915d052c606 Felix Fietkau 2020-09-01 1259
660915d052c606 Felix Fietkau 2020-09-01 1260 list_for_each_entry_safe(skb, tmp, &free_list, list) {
660915d052c606 Felix Fietkau 2020-09-01 1261 skb_list_del_init(skb);
660915d052c606 Felix Fietkau 2020-09-01 1262 napi_consume_skb(skb, 1);
660915d052c606 Felix Fietkau 2020-09-01 1263 }
e57b7901469fc0 Ryder Lee 2020-04-25 1264 }
e57b7901469fc0 Ryder Lee 2020-04-25 1265
3de4cb1756565a Felix Fietkau 2021-05-07 1266 static bool
3de4cb1756565a Felix Fietkau 2021-05-07 1267 mt7915_mac_add_txs_skb(struct mt7915_dev *dev, struct mt76_wcid *wcid, int pid,
3de4cb1756565a Felix Fietkau 2021-05-07 1268 __le32 *txs_data)
3de4cb1756565a Felix Fietkau 2021-05-07 1269 {
787e54058191f6 Ryder Lee 2021-07-14 1270 struct ieee80211_supported_band *sband;
787e54058191f6 Ryder Lee 2021-07-14 @1271 struct mt7915_sta *msta;
3de4cb1756565a Felix Fietkau 2021-05-07 1272 struct mt76_dev *mdev = &dev->mt76;
787e54058191f6 Ryder Lee 2021-07-14 1273 struct mt76_phy *mphy;
3de4cb1756565a Felix Fietkau 2021-05-07 1274 struct ieee80211_tx_info *info;
3de4cb1756565a Felix Fietkau 2021-05-07 1275 struct sk_buff_head list;
787e54058191f6 Ryder Lee 2021-07-14 1276 struct rate_info rate = {};
3de4cb1756565a Felix Fietkau 2021-05-07 1277 struct sk_buff *skb;
787e54058191f6 Ryder Lee 2021-07-14 1278 bool cck = false;
787e54058191f6 Ryder Lee 2021-07-14 1279 u32 txrate, txs;
3de4cb1756565a Felix Fietkau 2021-05-07 1280
3de4cb1756565a Felix Fietkau 2021-05-07 1281 mt76_tx_status_lock(mdev, &list);
3de4cb1756565a Felix Fietkau 2021-05-07 1282 skb = mt76_tx_status_skb_get(mdev, wcid, pid, &list);
3de4cb1756565a Felix Fietkau 2021-05-07 1283 if (!skb)
3de4cb1756565a Felix Fietkau 2021-05-07 1284 goto out;
3de4cb1756565a Felix Fietkau 2021-05-07 1285
787e54058191f6 Ryder Lee 2021-07-14 1286 txs = le32_to_cpu(txs_data[0]);
787e54058191f6 Ryder Lee 2021-07-14 1287
3de4cb1756565a Felix Fietkau 2021-05-07 1288 info = IEEE80211_SKB_CB(skb);
787e54058191f6 Ryder Lee 2021-07-14 1289 if (!(txs & MT_TXS0_ACK_ERROR_MASK))
3de4cb1756565a Felix Fietkau 2021-05-07 1290 info->flags |= IEEE80211_TX_STAT_ACK;
3de4cb1756565a Felix Fietkau 2021-05-07 1291
3de4cb1756565a Felix Fietkau 2021-05-07 1292 info->status.ampdu_len = 1;
3de4cb1756565a Felix Fietkau 2021-05-07 1293 info->status.ampdu_ack_len = !!(info->flags &
3de4cb1756565a Felix Fietkau 2021-05-07 1294 IEEE80211_TX_STAT_ACK);
3de4cb1756565a Felix Fietkau 2021-05-07 1295
3de4cb1756565a Felix Fietkau 2021-05-07 1296 info->status.rates[0].idx = -1;
787e54058191f6 Ryder Lee 2021-07-14 1297
787e54058191f6 Ryder Lee 2021-07-14 1298 if (!wcid->sta)
787e54058191f6 Ryder Lee 2021-07-14 1299 goto out;
787e54058191f6 Ryder Lee 2021-07-14 1300
787e54058191f6 Ryder Lee 2021-07-14 1301 msta = container_of(wcid, struct mt7915_sta, wcid);
787e54058191f6 Ryder Lee 2021-07-14 1302 txrate = FIELD_GET(MT_TXS0_TX_RATE, txs);
787e54058191f6 Ryder Lee 2021-07-14 1303
787e54058191f6 Ryder Lee 2021-07-14 1304 rate.mcs = FIELD_GET(MT_TX_RATE_IDX, txrate);
787e54058191f6 Ryder Lee 2021-07-14 1305 rate.nss = FIELD_GET(MT_TX_RATE_NSS, txrate) + 1;
787e54058191f6 Ryder Lee 2021-07-14 1306
787e54058191f6 Ryder Lee 2021-07-14 1307 switch (FIELD_GET(MT_TX_RATE_MODE, txrate)) {
787e54058191f6 Ryder Lee 2021-07-14 1308 case MT_PHY_TYPE_CCK:
787e54058191f6 Ryder Lee 2021-07-14 1309 cck = true;
787e54058191f6 Ryder Lee 2021-07-14 1310 fallthrough;
787e54058191f6 Ryder Lee 2021-07-14 1311 case MT_PHY_TYPE_OFDM:
787e54058191f6 Ryder Lee 2021-07-14 1312 mphy = &dev->mphy;
787e54058191f6 Ryder Lee 2021-07-14 1313 if (wcid->ext_phy && dev->mt76.phy2)
787e54058191f6 Ryder Lee 2021-07-14 1314 mphy = dev->mt76.phy2;
787e54058191f6 Ryder Lee 2021-07-14 1315
787e54058191f6 Ryder Lee 2021-07-14 1316 if (mphy->chandef.chan->band == NL80211_BAND_5GHZ)
787e54058191f6 Ryder Lee 2021-07-14 1317 sband = &mphy->sband_5g.sband;
787e54058191f6 Ryder Lee 2021-07-14 1318 else
787e54058191f6 Ryder Lee 2021-07-14 1319 sband = &mphy->sband_2g.sband;
787e54058191f6 Ryder Lee 2021-07-14 1320
787e54058191f6 Ryder Lee 2021-07-14 1321 rate.mcs = mt76_get_rate(mphy->dev, sband, rate.mcs, cck);
787e54058191f6 Ryder Lee 2021-07-14 1322 rate.legacy = sband->bitrates[rate.mcs].bitrate;
787e54058191f6 Ryder Lee 2021-07-14 1323 break;
787e54058191f6 Ryder Lee 2021-07-14 1324 case MT_PHY_TYPE_HT:
787e54058191f6 Ryder Lee 2021-07-14 1325 case MT_PHY_TYPE_HT_GF:
787e54058191f6 Ryder Lee 2021-07-14 1326 rate.mcs += (rate.nss - 1) * 8;
787e54058191f6 Ryder Lee 2021-07-14 1327 if (rate.mcs > 31)
787e54058191f6 Ryder Lee 2021-07-14 1328 goto out;
787e54058191f6 Ryder Lee 2021-07-14 1329
787e54058191f6 Ryder Lee 2021-07-14 1330 rate.flags = RATE_INFO_FLAGS_MCS;
787e54058191f6 Ryder Lee 2021-07-14 1331 if (wcid->rate.flags & RATE_INFO_FLAGS_SHORT_GI)
787e54058191f6 Ryder Lee 2021-07-14 1332 rate.flags |= RATE_INFO_FLAGS_SHORT_GI;
787e54058191f6 Ryder Lee 2021-07-14 1333 break;
787e54058191f6 Ryder Lee 2021-07-14 1334 case MT_PHY_TYPE_VHT:
787e54058191f6 Ryder Lee 2021-07-14 1335 if (rate.mcs > 9)
787e54058191f6 Ryder Lee 2021-07-14 1336 goto out;
787e54058191f6 Ryder Lee 2021-07-14 1337
787e54058191f6 Ryder Lee 2021-07-14 1338 rate.flags = RATE_INFO_FLAGS_VHT_MCS;
787e54058191f6 Ryder Lee 2021-07-14 1339 break;
787e54058191f6 Ryder Lee 2021-07-14 1340 case MT_PHY_TYPE_HE_SU:
787e54058191f6 Ryder Lee 2021-07-14 1341 case MT_PHY_TYPE_HE_EXT_SU:
787e54058191f6 Ryder Lee 2021-07-14 1342 case MT_PHY_TYPE_HE_TB:
787e54058191f6 Ryder Lee 2021-07-14 1343 case MT_PHY_TYPE_HE_MU:
787e54058191f6 Ryder Lee 2021-07-14 1344 if (rate.mcs > 11)
787e54058191f6 Ryder Lee 2021-07-14 1345 goto out;
787e54058191f6 Ryder Lee 2021-07-14 1346
787e54058191f6 Ryder Lee 2021-07-14 1347 rate.he_gi = wcid->rate.he_gi;
787e54058191f6 Ryder Lee 2021-07-14 1348 rate.he_dcm = FIELD_GET(MT_TX_RATE_DCM, txrate);
787e54058191f6 Ryder Lee 2021-07-14 1349 rate.flags = RATE_INFO_FLAGS_HE_MCS;
787e54058191f6 Ryder Lee 2021-07-14 1350 break;
787e54058191f6 Ryder Lee 2021-07-14 1351 default:
787e54058191f6 Ryder Lee 2021-07-14 1352 goto out;
787e54058191f6 Ryder Lee 2021-07-14 1353 }
787e54058191f6 Ryder Lee 2021-07-14 1354
787e54058191f6 Ryder Lee 2021-07-14 1355 switch (FIELD_GET(MT_TXS0_BW, txs)) {
787e54058191f6 Ryder Lee 2021-07-14 1356 case IEEE80211_STA_RX_BW_160:
787e54058191f6 Ryder Lee 2021-07-14 1357 rate.bw = RATE_INFO_BW_160;
787e54058191f6 Ryder Lee 2021-07-14 1358 break;
787e54058191f6 Ryder Lee 2021-07-14 1359 case IEEE80211_STA_RX_BW_80:
787e54058191f6 Ryder Lee 2021-07-14 1360 rate.bw = RATE_INFO_BW_80;
787e54058191f6 Ryder Lee 2021-07-14 1361 break;
787e54058191f6 Ryder Lee 2021-07-14 1362 case IEEE80211_STA_RX_BW_40:
787e54058191f6 Ryder Lee 2021-07-14 1363 rate.bw = RATE_INFO_BW_40;
787e54058191f6 Ryder Lee 2021-07-14 1364 break;
787e54058191f6 Ryder Lee 2021-07-14 1365 default:
787e54058191f6 Ryder Lee 2021-07-14 1366 rate.bw = RATE_INFO_BW_20;
787e54058191f6 Ryder Lee 2021-07-14 1367 break;
787e54058191f6 Ryder Lee 2021-07-14 1368 }
787e54058191f6 Ryder Lee 2021-07-14 1369 wcid->rate = rate;
3de4cb1756565a Felix Fietkau 2021-05-07 1370
3de4cb1756565a Felix Fietkau 2021-05-07 1371 out:
787e54058191f6 Ryder Lee 2021-07-14 1372 mt76_tx_status_skb_done(mdev, skb, &list);
3de4cb1756565a Felix Fietkau 2021-05-07 1373 mt76_tx_status_unlock(mdev, &list);
3de4cb1756565a Felix Fietkau 2021-05-07 1374
3de4cb1756565a Felix Fietkau 2021-05-07 1375 return !!skb;
3de4cb1756565a Felix Fietkau 2021-05-07 1376 }
3de4cb1756565a Felix Fietkau 2021-05-07 1377
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 68005 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-mediatek/attachments/20210714/59e94db8/attachment-0001.gz>
More information about the Linux-mediatek
mailing list