staging: r8188eu: fix the number of probereq retries
authorMartin Kaiser <martin@kaiser.cx>
Sat, 26 Nov 2022 15:42:51 +0000 (16:42 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 5 Dec 2022 12:26:13 +0000 (13:26 +0100)
issue_probereq_ex sends a probe request and retries if this fails. There's
no point in making the number of retries configurable. Hard-code the value
that's used by issue_probereq_ex's only caller.

Simplify the code to check the loop condition only once.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20221126154253.178275-4-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/r8188eu/core/rtw_mlme_ext.c
drivers/staging/r8188eu/include/rtw_mlme_ext.h

index 990336244030de6f149eeb98e8f906b1fdbf40e0..667f54e313eff6a1d2d05f5f8b8d45c4d4e6b2a4 100644 (file)
@@ -4482,21 +4482,16 @@ inline void issue_probereq(struct adapter *padapter, struct ndis_802_11_ssid *ps
        _issue_probereq(padapter, pssid, da, false);
 }
 
-void issue_probereq_ex(struct adapter *padapter, struct ndis_802_11_ssid *pssid, u8 *da,
-                      int try_cnt)
+void issue_probereq_ex(struct adapter *padapter, struct ndis_802_11_ssid *pssid, u8 *da)
 {
-       int ret;
-       int i = 0;
-
-       do {
-               ret = _issue_probereq(padapter, pssid, da, true);
-
-               i++;
+       int i;
 
-               if (i < try_cnt && ret == _FAIL)
+       for (i = 0; i < 3; i++) {
+               if (_issue_probereq(padapter, pssid, da, true) == _FAIL)
                        msleep(1);
-
-       } while ((i < try_cnt) && (ret == _FAIL));
+               else
+                       break;
+       }
 }
 
 /*  if psta == NULL, indicate we are station (client) now... */
@@ -7046,7 +7041,7 @@ void linked_status_chk(struct adapter *padapter)
                                }
 
                                if (rx_chk != _SUCCESS)
-                                       issue_probereq_ex(padapter, &pmlmeinfo->network.Ssid, psta->hwaddr, 3);
+                                       issue_probereq_ex(padapter, &pmlmeinfo->network.Ssid, psta->hwaddr);
 
                                if ((tx_chk != _SUCCESS && pmlmeinfo->link_count++ == 0xf) || rx_chk != _SUCCESS) {
                                        tx_chk = issue_nulldata(padapter, psta->hwaddr, 0, 3, 1);
index 04fd673d3a04cd3c74e65493b38a6d475f2151ea..089bd544677331e2e2c0877c6bf8efbfb58a1cca 100644 (file)
@@ -512,8 +512,7 @@ void issue_auth(struct adapter *padapter, struct sta_info *psta,
                unsigned short status);
 void issue_probereq(struct adapter *padapter, struct ndis_802_11_ssid *pssid,
                    u8 *da);
-void issue_probereq_ex(struct adapter *adapter, struct ndis_802_11_ssid *pssid,
-                      u8 *da, int try_cnt);
+void issue_probereq_ex(struct adapter *padapter, struct ndis_802_11_ssid *pssid, u8 *da);
 int issue_nulldata(struct adapter *padapter, unsigned char *da,
                   unsigned int power_mode, int try_cnt, int wait_ms);
 int issue_qos_nulldata(struct adapter *padapter, unsigned char *da,