Re: [EXTERNAL] Re: [RFT 3/6] wlcore: Add support for runtime PM

2018-06-04 Thread Tony Lindgren
* Reizer, Eyal  [180603 06:07]:
> I have noticed the following recovery a couple of times on my setup when the 
> board was 
> just sitting for a long time with just pings
> It starts with a firmware recovery started from the interrupt handler but the 
> recovery fails 

Sounds like the recovery needs some more work :)

> leaving the sdio stuck.
> At this stage the only way to get out of it is unload/load of the driver 
> modules.
> Have you seen this on your side as well?

Hmm I don't think I've seen this one yet.

> 64 bytes from 192.168.100.1: seq=32772 ttl=64 time=9.644 ms
> 64 bytes from 192.168.100.1: seq=32773 ttl=64 time=9.572 ms
> 64 bytes from 192.168.100.1: seq=32774 ttl=64 time=10.974 ms
> 64 bytes from 192.168.100.1: seq=32775 ttl=64 time=9.618 ms
> [127899.040526] wlcore: ERROR SW watchdog interrupt received! starting 
> recovery.

Do you know what does the SW watchdog means here? Does it mean the
interrupt did not get delivered to wlcore? Or a spurious IRQ to wlcore?
Or a timeout waiting for the ELP wake interrupt?

Regards,

Tony



Re: [PATCH v3 00/19] rtlwifi: halmac: Add new module halmac

2018-06-04 Thread Pkshih
On Thu, 2018-05-24 at 11:27 +0300, Kalle Valo wrote:
> 
> You are missing my point: I don't even have time to review huge rtlwifi
> patches when they are not even ready for upstream. I cannot start
> working on cleaning up rtlwifi code and doing multiple iterations of
> reviews on these kind of huge patchsets. Either you need to
> significantly scale down the size of patchsets (especially LOC) or you
> need to get review help from someone else. But the current way of
> working is not doable for me.
> 

Is there a proper way to look for "someone else" you mentioned?

We plan to rewrite a new driver excluding agnostic OS layer to support 
new generation 11AC chips, because they're very different from the chips
existed in rtlwifi and rtl8xxxu. 

If we have a "someone" to review our driver, where is the proper place to
put developing driver repository? Staging or public git repository 
(e.g. GitHub)?

Finally, the driver is done. Are there explicit criteria to accept the
driver as a mainline driver? 

Thanks
PK



Re: [PATCH 3/6] qtnfmac: implement cfg80211 power management callback

2018-06-04 Thread Igor Mitsyanko

On 06/04/2018 05:50 AM, Sergey Matyukevich wrote:

I think it's better be moved somewhere out of qtnf_wiphy_allocate() as OPS
are global for all MACs, while qtnf_wiphy_allocate() is called for each MAC
separately.


Consider the case of splitting hardware capabilities into two groups:
global and per-wmac. In this case we may need to register different
subsets of cfg80211 operations for each wmac. In such a case, function
qtnf_wiphy_allocate looks like a reasonable point where to merge both
capability groups and customize cfg80211_ops structure for each wmac.




What I mean is that wiphy_new() will not dup cfg80211_ops that we pass, 
it will just assign a pointer to whatever it gets.
qtn_cfg80211_ops is global right now, if we modify it, it will affect 
all WMACs, not just the one that we're allocating.


Currently it's not a problem as we do not have any per-WMAC 
capabilities. If we to have any, we would have to dup qtn_cfg80211_ops 
in qtnf_wiphy_allocate().


Though I agree that we already have QLINK_HW_CAPAB_DFS_OFFLOAD 
processing in qtnf_wiphy_allocate(), so it makes sense to do a cleanup 
separately.


[PATCH v2 0/2] cfg80211/mac80211: last ack signal support in station dump

2018-06-04 Thread Balaji Pothunoori
This patch adds "last ack signal" support in station dump if
driver reports ack rssi for last tx packet.


Balaji Pothunoori (2):
  cfg80211: last ack signal support in station dump
  mac80211: last ack signal support in station dump

v2:
 - typo corrected in subject
 
 include/uapi/linux/nl80211.h | 14 +++---
 net/mac80211/sta_info.c  | 20 ++--
 net/wireless/nl80211.c   |  8 
 3 files changed, 25 insertions(+), 17 deletions(-)

-- 
2.7.4



[PATCH v2 2/2] mac80211: last ack signal support in station dump

2018-06-04 Thread Balaji Pothunoori
This patch adds "last ack signal" and "avg ack signal" support
in station dump for valid ack rssi.

Signed-off-by: Balaji Pothunoori 
---
v2:
 - typo corrected in subject

 net/mac80211/sta_info.c | 20 ++--
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 6428f1a..12b618e 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -2310,13 +2310,21 @@ void sta_set_sinfo(struct sta_info *sta, struct 
station_info *sinfo,
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL);
}
 
-   if (ieee80211_hw_check(&sta->local->hw, REPORTS_TX_ACK_STATUS) &&
-   !(sinfo->filled & BIT_ULL(NL80211_STA_INFO_DATA_ACK_SIGNAL_AVG))) {
-   sinfo->avg_ack_signal =
-   -(s8)ewma_avg_signal_read(
+   if (ieee80211_hw_check(&sta->local->hw, REPORTS_TX_ACK_STATUS)) {
+   if (sta->status_stats.ack_signal_filled && ((!(sinfo->filled &
+   BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL))) ||
+   (!(sinfo->filled &
+   BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL_AVG) {
+   sinfo->ack_signal =
+   sta->status_stats.last_ack_signal;
+   sinfo->filled |=
+   BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL);
+   sinfo->avg_ack_signal =
+   -(s8)ewma_avg_signal_read(
&sta->status_stats.avg_ack_signal);
-   sinfo->filled |=
-   BIT_ULL(NL80211_STA_INFO_DATA_ACK_SIGNAL_AVG);
+   sinfo->filled |=
+   BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL_AVG);
+   }
}
 }
 
-- 
2.7.4



[PATCH v2 1/2] cfg80211: last ack signal support in station dump

2018-06-04 Thread Balaji Pothunoori
This patch adds "last ack signal" support in station dump if
driver supports.

Signed-off-by: Balaji Pothunoori 
---
v2:
 - typo corrected in subject

 include/uapi/linux/nl80211.h | 14 +++---
 net/wireless/nl80211.c   |  8 
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 28b3654..3514bef 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -3000,8 +3000,8 @@ enum nl80211_sta_bss_param {
  * received from the station (u64, usec)
  * @NL80211_STA_INFO_PAD: attribute used for padding for 64-bit alignment
  * @NL80211_STA_INFO_ACK_SIGNAL: signal strength of the last ACK frame(u8, dBm)
- * @NL80211_STA_INFO_DATA_ACK_SIGNAL_AVG: avg signal strength of (data)
- * ACK frame (s8, dBm)
+ * @NL80211_STA_INFO_ACK_SIGNAL_AVG: avg signal strength of data or management
+ * ACK frames(s8, dBm)
  * @__NL80211_STA_INFO_AFTER_LAST: internal
  * @NL80211_STA_INFO_MAX: highest possible station info attribute
  */
@@ -3041,7 +3041,7 @@ enum nl80211_sta_info {
NL80211_STA_INFO_RX_DURATION,
NL80211_STA_INFO_PAD,
NL80211_STA_INFO_ACK_SIGNAL,
-   NL80211_STA_INFO_DATA_ACK_SIGNAL_AVG,
+   NL80211_STA_INFO_ACK_SIGNAL_AVG,
 
/* keep last */
__NL80211_STA_INFO_AFTER_LAST,
@@ -5128,9 +5128,9 @@ enum nl80211_feature_flags {
  * "radar detected" event.
  * @NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211: Driver supports sending and
  * receiving control port frames over nl80211 instead of the netdevice.
- * @NL80211_EXT_FEATURE_DATA_ACK_SIGNAL_SUPPORT: This Driver support data ack
- * rssi if firmware support, this flag is to intimate about ack rssi
- * support to nl80211.
+ * @NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT: This Driver support ack rssi if
+ * firmware support, this flag is to intimate about ack rssi support
+ * to nl80211.
  * @NL80211_EXT_FEATURE_TXQS: Driver supports FQ-CoDel-enabled intermediate
  *  TXQs.
  *
@@ -5165,7 +5165,7 @@ enum nl80211_ext_feature_index {
NL80211_EXT_FEATURE_HIGH_ACCURACY_SCAN,
NL80211_EXT_FEATURE_DFS_OFFLOAD,
NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211,
-   NL80211_EXT_FEATURE_DATA_ACK_SIGNAL_SUPPORT,
+   NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT,
NL80211_EXT_FEATURE_TXQS,
 
/* add new features before the definition below */
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 07514ca..29cf5fd 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -4650,11 +4650,11 @@ static int nl80211_send_station(struct sk_buff *msg, 
u32 cmd, u32 portid,
PUT_SINFO_U64(RX_DROP_MISC, rx_dropped_misc);
PUT_SINFO_U64(BEACON_RX, rx_beacon);
PUT_SINFO(BEACON_SIGNAL_AVG, rx_beacon_signal_avg, u8);
-   PUT_SINFO(ACK_SIGNAL, ack_signal, u8);
if (wiphy_ext_feature_isset(&rdev->wiphy,
-   
NL80211_EXT_FEATURE_DATA_ACK_SIGNAL_SUPPORT))
-   PUT_SINFO(DATA_ACK_SIGNAL_AVG, avg_ack_signal, s8);
-
+   NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT)) {
+   PUT_SINFO(ACK_SIGNAL, ack_signal, u8);
+   PUT_SINFO(ACK_SIGNAL_AVG, avg_ack_signal, s8);
+   }
 #undef PUT_SINFO
 #undef PUT_SINFO_U64
 
-- 
2.7.4



Linux 4.17 iwlwifi IBSS AC 8265 Microcode SW error detected. Restarting 0x2000000

2018-06-04 Thread Krzysztof Hałasa
Hi,

I'm unable to make this setup work:
Linux x86-64 4.17
iwlwifi-8265-36.ucode, 2498044 bytes

iw dev wlan0 set type ibss
ip link set up dev wlan0
iw dev wlan0 set bitrates legacy-2.4 6 ht-mcs-2.4 8
iw dev wlan0 ibss join xyz 2462

Any ideas?

I have removed irrelevant parts, but everything is available on request.

iwlwifi :01:00.0: Detected Intel(R) Dual Band Wireless AC 8265, REV=0x230
iwlwifi :01:00.0: base HW address: d4:6d:6d:b1:f1:25
ieee80211 phy6: Selected rate control algorithm 'iwl-mvm-rs'
thermal thermal_zone1: failed to read out thermal zone (-61)
wlan0: Trigger new scan to find an IBSS to join
...
wlan0: Creating new IBSS network, BSSID f2:b6:b4:b7:1d:4b
iwlwifi :01:00.0: regular scan timed out
iwlwifi :01:00.0: Microcode SW error detected.  Restarting 0x200.
iwlwifi :01:00.0: Start IWL Error Log Dump:
iwlwifi :01:00.0: Status: 0x0100, count: 6
iwlwifi :01:00.0: Loaded firmware version: 36.e91976c0.0
iwlwifi :01:00.0: 0x0084 | NMI_INTERRUPT_UNKNOWN
iwlwifi :01:00.0: 0x02F0 | trm_hw_status0
iwlwifi :01:00.0: 0x | trm_hw_status1
iwlwifi :01:00.0: 0x000248DC | branchlink2
iwlwifi :01:00.0: 0x0003A7DA | interruptlink1
iwlwifi :01:00.0: 0x0003A7DA | interruptlink2
iwlwifi :01:00.0: 0x | data1
iwlwifi :01:00.0: 0x0080 | data2
iwlwifi :01:00.0: 0x0783 | data3
iwlwifi :01:00.0: 0xFFE27F31 | beacon time
iwlwifi :01:00.0: 0x01CE58A0 | tsf low
iwlwifi :01:00.0: 0x | tsf hi
iwlwifi :01:00.0: 0x | time gp1
iwlwifi :01:00.0: 0x02744DB0 | time gp2
iwlwifi :01:00.0: 0x0001 | uCode revision type
iwlwifi :01:00.0: 0x0024 | uCode version major
iwlwifi :01:00.0: 0xE91976C0 | uCode version minor
iwlwifi :01:00.0: 0x0230 | hw version
iwlwifi :01:00.0: 0x18489000 | board version
iwlwifi :01:00.0: 0x001C | hcmd
iwlwifi :01:00.0: 0x00022000 | isr0
iwlwifi :01:00.0: 0x0080 | isr1
iwlwifi :01:00.0: 0x08005802 | isr2
iwlwifi :01:00.0: 0x00415CC0 | isr3
iwlwifi :01:00.0: 0x | isr4
iwlwifi :01:00.0: 0x8032FB03 | last cmd Id
iwlwifi :01:00.0: 0x | wait_event
iwlwifi :01:00.0: 0x6E99 | l2p_control
iwlwifi :01:00.0: 0x0020 | l2p_duration
iwlwifi :01:00.0: 0x0003 | l2p_mhvalid
iwlwifi :01:00.0: 0x0020 | l2p_addr_match
iwlwifi :01:00.0: 0x000D | lmpm_pmg_sel
iwlwifi :01:00.0: 0x28031619 | timestamp
iwlwifi :01:00.0: 0x00348898 | flow_handler
iwlwifi :01:00.0: Start IWL Error Log Dump:
iwlwifi :01:00.0: Status: 0x0100, count: 7
iwlwifi :01:00.0: 0x0070 | ADVANCED_SYSASSERT
iwlwifi :01:00.0: 0x | umac branchlink1
iwlwifi :01:00.0: 0xC008689C | umac branchlink2
iwlwifi :01:00.0: 0xC0083A94 | umac interruptlink1
iwlwifi :01:00.0: 0xC0083A94 | umac interruptlink2
iwlwifi :01:00.0: 0x0800 | umac data1
iwlwifi :01:00.0: 0xC0083A94 | umac data2
iwlwifi :01:00.0: 0xDEADBEEF | umac data3
iwlwifi :01:00.0: 0x0024 | umac major
iwlwifi :01:00.0: 0xE91976C0 | umac minor
iwlwifi :01:00.0: 0xC088628C | frame pointer
iwlwifi :01:00.0: 0xC088628C | stack pointer
iwlwifi :01:00.0: 0x0033010D | last host cmd
iwlwifi :01:00.0: 0x | isr status reg
ieee80211 phy6: Hardware restart was requested
[ cut here ]
Changing inactive MAC d4:6d:6d:b1:f1:25/1
WARNING: CPU: 2 PID: 304 at 
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c:1326 
iwl_mvm_mac_ctxt_changed+0x73/0x90 [iwlmvm]
Hardware name: GETAC F110G4/F110G4, BIOS R1.08.070520 03/07/2018
RIP: 0010:iwl_mvm_mac_ctxt_changed+0x73/0x90 [iwlmvm]
Call Trace:
 iwl_mvm_bss_info_changed+0x494/0x6a0 [iwlmvm]
 ? iwl_mvm_assign_vif_chanctx+0x40/0x50 [iwlmvm]
 ieee80211_bss_info_change_notify+0x78/0xc0
 ieee80211_reconfig+0x61a/0xc50
 ieee80211_restart_work+0x9e/0xd0
 process_one_work+0x15c/0x300
 worker_thread+0x30/0x3a0
 ? process_one_work+0x300/0x300
 kthread+0x10d/0x130
 ? kthread_flush_work_fn+0x10/0x10
 ret_from_fork+0x1f/0x30
---[ end trace d84041e0ec387e49 ]---
iwlwifi :01:00.0: failed to update MAC d4:6d:6d:b1:f1:25
iwlwifi :01:00.0: Microcode SW error detected.  Restarting 0x200.
iwlwifi :01:00.0: Start IWL Error Log Dump:
iwlwifi :01:00.0: Status: 0x0100, count: 6
iwlwifi :01:00.0: Loaded firmware version: 36.e91976c0.0
iwlwifi :01:00.0: 0x3018 | ADVANCED_SYSASSERT
iwlwifi :01:00.0: 0x00A002F1 | trm_hw_status0
iwlwifi :01:00.0: 0x | trm_hw_status1
iwlwifi :01:00.0: 0x000248DC | branchlink2
iwlwifi :01:00.0: 0x0003A7DA | interruptlink1
iwlwifi :01:00.0: 0x | interruptlink2
iwlwifi :01:00.0: 0x | data1
iwlwifi :01:00.0: 0x0080 | data2
iwlwifi :01:00.0: 0x | data3
iwlwifi :01:00.0: 0x | beacon time
iwlwifi :01:00.0: 0xAC17 | tsf low
iwlwifi :01:00.0: 0x | tsf hi
iwlwifi :01:0

Re: [PATCH 3/6] qtnfmac: implement cfg80211 power management callback

2018-06-04 Thread Sergey Matyukevich
Hello Igor,

> > Implement set_power_mgmt() callback that forwards power saving
> > settings to the device firmware.
> > 
> > Signed-off-by: Sergei Maksimenko 
> > ---
> >   static void qtnf_cfg80211_reg_notifier(struct wiphy *wiphy_in,
> > @@ -922,6 +939,9 @@ struct wiphy *qtnf_wiphy_allocate(struct qtnf_bus *bus)
> > if (bus->hw_info.hw_capab & QLINK_HW_CAPAB_DFS_OFFLOAD)
> > qtn_cfg80211_ops.start_radar_detection = NULL;
> > +   if (!(bus->hw_info.hw_capab & QLINK_HW_CAPAB_PWR_MGMT))
> > +   qtn_cfg80211_ops.set_power_mgmt = NULL;
> > +
> 
> I think it's better be moved somewhere out of qtnf_wiphy_allocate() as OPS
> are global for all MACs, while qtnf_wiphy_allocate() is called for each MAC
> separately.

Consider the case of splitting hardware capabilities into two groups:
global and per-wmac. In this case we may need to register different
subsets of cfg80211 operations for each wmac. In such a case, function
qtnf_wiphy_allocate looks like a reasonable point where to merge both
capability groups and customize cfg80211_ops structure for each wmac.

Regards,
Sergey


[bug report] mwifiex: process rxba_sync event

2018-06-04 Thread Dan Carpenter
Hello Xinming Hu,

The patch 99ffe72cdae4: "mwifiex: process rxba_sync event" from Jul
25, 2016, leads to the following static checker warning:

drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c:941 
mwifiex_11n_rxba_sync_event()
warn: 'tlv_buf_left' can be negative (type promoted to high)

drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c
   927  void mwifiex_11n_rxba_sync_event(struct mwifiex_private *priv,
   928   u8 *event_buf, u16 len)
   929  {
   930  struct mwifiex_ie_types_rxba_sync *tlv_rxba = (void *)event_buf;
   931  u16 tlv_type, tlv_len;
   932  struct mwifiex_rx_reorder_tbl *rx_reor_tbl_ptr;
   933  u8 i, j;
   934  u16 seq_num, tlv_seq_num, tlv_bitmap_len;
   935  int tlv_buf_left = len;
   936  int ret;
   937  u8 *tmp;
   938  
   939  mwifiex_dbg_dump(priv->adapter, EVT_D, "RXBA_SYNC event:",
   940   event_buf, len);
   941  while (tlv_buf_left >= sizeof(*tlv_rxba)) {
   942  tlv_type = le16_to_cpu(tlv_rxba->header.type);
   943  tlv_len  = le16_to_cpu(tlv_rxba->header.len);
   944  if (tlv_type != TLV_TYPE_RXBA_SYNC) {
   945  mwifiex_dbg(priv->adapter, ERROR,
   946  "Wrong TLV id=0x%x\n", tlv_type);
   947  return;
   948  }
   949  
   950  tlv_seq_num = le16_to_cpu(tlv_rxba->seq_num);
   951  tlv_bitmap_len = le16_to_cpu(tlv_rxba->bitmap_len);
   952  mwifiex_dbg(priv->adapter, INFO,
   953  "%pM tid=%d seq_num=%d bitmap_len=%d\n",
   954  tlv_rxba->mac, tlv_rxba->tid, tlv_seq_num,
   955  tlv_bitmap_len);
   956  
   957  rx_reor_tbl_ptr =
   958  mwifiex_11n_get_rx_reorder_tbl(priv, 
tlv_rxba->tid,
   959 tlv_rxba->mac);
   960  if (!rx_reor_tbl_ptr) {
   961  mwifiex_dbg(priv->adapter, ERROR,
   962  "Can not find rx_reorder_tbl!");
   963  return;
   964  }
   965  
   966  for (i = 0; i < tlv_bitmap_len; i++) {
   967  for (j = 0 ; j < 8; j++) {
   968  if (tlv_rxba->bitmap[i] & (1 << j)) {
   969  seq_num = (MAX_TID_VALUE - 1) &
   970  (tlv_seq_num + i * 8 + 
j);
   971  
   972  mwifiex_dbg(priv->adapter, 
ERROR,
   973  "drop 
packet,seq=%d\n",
   974  seq_num);
   975  
   976  ret = mwifiex_11n_rx_reorder_pkt
   977  (priv, seq_num, tlv_rxba->tid,
   978   tlv_rxba->mac, 0, NULL);
   979  
   980  if (ret)
   981  
mwifiex_dbg(priv->adapter,
   982  ERROR,
   983  "Fail to 
drop packet");
   984  }
   985  }
   986  }
   987  
   988  tlv_buf_left -= (sizeof(*tlv_rxba) + tlv_len);
^^
This could theoretically underflow to negative.  We should probably
check "sizeof(*tlv_rxba) + tlv_len" at the start of the loop and
tlv_bitmap_len as well to avoid a theoretical read beyond the end of
the array.

   989  tmp = (u8 *)tlv_rxba + tlv_len + sizeof(*tlv_rxba);
   990  tlv_rxba = (struct mwifiex_ie_types_rxba_sync *)tmp;
   991  }
   992  }

regards,
dan carpenter


Re: [PATCH 0/4] staging: wilc1000: modification to use list_head data structure

2018-06-04 Thread Claudiu Beznea
Reviewed-by: Claudiu Beznea 

On 04.06.2018 08:29, Ajay Singh wrote:
> Instead of having own linked list implementation to maintain buffer queue 
> change
> to use list_head. Also removed the few elements from 'wilc' struct as it's not
> required to be part of 'wilc' struct.
> 
> Ajay Singh (4):
>   staging: wilc1000: use list_head to maintain 'txq_entry_t' elements of
> tx queue
>   staging: wilc1000: use list_head to maintain 'rxq_entry_t elements in
> rx queue
>   staging: wilc1000: remove 'rxq_entries' from 'wilc' struct
>   staging: wilc1000: move 'txq_spinlock_flags' from 'wilc' structure to
> local variable
> 
>  drivers/staging/wilc1000/linux_wlan.c |   2 +
>  drivers/staging/wilc1000/wilc_wfi_netdevice.h |   9 +--
>  drivers/staging/wilc1000/wilc_wlan.c  | 101 
> --
>  drivers/staging/wilc1000/wilc_wlan.h  |   5 +-
>  4 files changed, 37 insertions(+), 80 deletions(-)
> 


[PATCH] mt76x2: fix mrr idx/count estimation in mt76x2_mac_fill_tx_status()

2018-06-04 Thread Lorenzo Bianconi
Fix mcs and attempt count estimation in mt76x2_mac_fill_tx_status routine
if the number of tx retries reported by the hw is grater than
IEEE80211_TX_MAX_RATES

Fixes: 7bc04215a66b ("mt76: add driver code for MT76x2e")
Signed-off-by: Lorenzo Bianconi 
---
 drivers/net/wireless/mediatek/mt76/mt76x2_mac.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_mac.c 
b/drivers/net/wireless/mediatek/mt76/mt76x2_mac.c
index b49aea4da2d6..8985446570bd 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2_mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2_mac.c
@@ -439,15 +439,13 @@ mt76x2_mac_fill_tx_status(struct mt76x2_dev *dev,
if (last_rate < IEEE80211_TX_MAX_RATES - 1)
rate[last_rate + 1].idx = -1;
 
-   cur_idx = rate[last_rate].idx + st->retry;
+   cur_idx = rate[last_rate].idx + last_rate;
for (i = 0; i <= last_rate; i++) {
rate[i].flags = rate[last_rate].flags;
rate[i].idx = max_t(int, 0, cur_idx - i);
rate[i].count = 1;
}
-
-   if (last_rate > 0)
-   rate[last_rate - 1].count = st->retry + 1 - last_rate;
+   rate[last_rate].count = st->retry + 1 - last_rate;
 
info->status.ampdu_len = n_frames;
info->status.ampdu_ack_len = st->success ? n_frames : 0;
-- 
2.14.4