Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d274d80b authored by Vladimir Kondratiev's avatar Vladimir Kondratiev Committed by Maya Erez
Browse files

wil6210: wait for disconnect completion



cfg80211_ops.disconnect() should wait for disconnect flow to
complete. If it does not, internal state becomes out of sync with
one in cfg80211. If one does stress test connect/disconnect
sequence, cfg80211 will issue next connect before disconnect
completed internally.

Change-Id: I66a6a23239710c85b9cdb5824c205692c4b53866
Signed-off-by: default avatarVladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: default avatarMaya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
Git-commit: 78771d76f826202012201d700028a2d866d03fb3
Git-repo: https://github.com/kvalo/ath.git


CRs-Fixed: 982882
Signed-off-by: default avatarMaya Erez <merez@codeaurora.org>
parent e262ad36
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -535,7 +535,18 @@ static int wil_cfg80211_disconnect(struct wiphy *wiphy,

	wil_dbg_misc(wil, "%s(reason=%d)\n", __func__, reason_code);

	rc = wmi_send(wil, WMI_DISCONNECT_CMDID, NULL, 0);
	if (!(test_bit(wil_status_fwconnecting, wil->status) ||
	      test_bit(wil_status_fwconnected, wil->status))) {
		wil_err(wil, "%s: Disconnect was called while disconnected\n",
			__func__);
		return 0;
	}

	rc = wmi_call(wil, WMI_DISCONNECT_CMDID, NULL, 0,
		      WMI_DISCONNECT_EVENTID, NULL, 0,
		      WIL6210_DISCONNECT_TO_MS);
	if (rc)
		wil_err(wil, "%s: disconnect error %d\n", __func__, rc);

	return rc;
}
+9 −19
Original line number Diff line number Diff line
@@ -23,9 +23,6 @@
#include "wmi.h"
#include "boot_loader.h"

#define WAIT_FOR_DISCONNECT_TIMEOUT_MS 2000
#define WAIT_FOR_DISCONNECT_INTERVAL_MS 10

bool debug_fw; /* = false; */
module_param(debug_fw, bool, S_IRUGO);
MODULE_PARM_DESC(debug_fw, " do not perform card reset. For FW debug");
@@ -942,8 +939,7 @@ int wil_up(struct wil6210_priv *wil)

int __wil_down(struct wil6210_priv *wil)
{
	int iter = WAIT_FOR_DISCONNECT_TIMEOUT_MS /
			WAIT_FOR_DISCONNECT_INTERVAL_MS;
	int rc;

	WARN_ON(!mutex_is_locked(&wil->mutex));

@@ -967,22 +963,16 @@ int __wil_down(struct wil6210_priv *wil)
	}

	if (test_bit(wil_status_fwconnected, wil->status) ||
	    test_bit(wil_status_fwconnecting, wil->status))
		wmi_send(wil, WMI_DISCONNECT_CMDID, NULL, 0);
	    test_bit(wil_status_fwconnecting, wil->status)) {

	/* make sure wil is idle (not connected) */
		mutex_unlock(&wil->mutex);
	while (iter--) {
		int idle = !test_bit(wil_status_fwconnected, wil->status) &&
			   !test_bit(wil_status_fwconnecting, wil->status);
		if (idle)
			break;
		msleep(WAIT_FOR_DISCONNECT_INTERVAL_MS);
	}
		rc = wmi_call(wil, WMI_DISCONNECT_CMDID, NULL, 0,
			      WMI_DISCONNECT_EVENTID, NULL, 0,
			      WIL6210_DISCONNECT_TO_MS);
		mutex_lock(&wil->mutex);

	if (iter < 0)
		wil_err(wil, "timeout waiting for idle FW/HW\n");
		if (rc)
			wil_err(wil, "timeout waiting for disconnect\n");
	}

	wil_reset(wil, false);

+1 −0
Original line number Diff line number Diff line
@@ -92,6 +92,7 @@ static inline u32 wil_mtu2macbuf(u32 mtu)
#define WIL6210_FW_RECOVERY_RETRIES	(5) /* try to recover this many times */
#define WIL6210_FW_RECOVERY_TO	msecs_to_jiffies(5000)
#define WIL6210_SCAN_TO		msecs_to_jiffies(10000)
#define WIL6210_DISCONNECT_TO_MS (2000)
#define WIL6210_RX_HIGH_TRSH_INIT		(0)
#define WIL6210_RX_HIGH_TRSH_DEFAULT \
				(1 << (WIL_RX_RING_SIZE_ORDER_DEFAULT - 3))