Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Apr 2016 16:10:46 +0900 (JST)
From:      Masachika ISHIZUKA <ish@amail.plala.or.jp>
To:        freebsd-wireless@freebsd.org
Subject:   Re: iwm7265fw: fatal firmware error
Message-ID:  <20160422.161046.1399384989198011599.ish@amail.plala.or.jp>
In-Reply-To: <20160305.193602.2144207354689575871.ish@amail.plala.or.jp>
References:  <6E0E9EC8-3035-4443-A495-5981E8C9D4FA@FreeBSD.org> <op.ydthnx1c4dikkl@localhost> <20160305.193602.2144207354689575871.ish@amail.plala.or.jp>

next in thread | previous in thread | raw e-mail | index | archive | help
----Next_Part(Fri_Apr_22_16_10_46_2016_896)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

>> May be workaroundable with https://reviews.freebsd.org/D4236 (restarts
>> the device
>> automatically after each failure; but the problem is still here)
> 
>   Hello, Andriy.
> 
>   Thank you for good information.
>   After applying this patch, my dell notebook with 7260 can restart
> iwm driver automatically and resume connections.

  Hi.

  As my dell xps12 (7260ac) was disconnected after key renewal
interval time, I patched iwm driver. After that, it keeps
connctions.

# cd /sys/dev/iwm
# patch < iwm.diff
# cd /sys/module/iwm
# make
# make install
# reboot
-- 
Masachika ISHIZUKA

----Next_Part(Fri_Apr_22_16_10_46_2016_896)--
Content-Type: Text/X-Patch; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="iwm.diff"

--- /sys/dev/iwm/if_iwm.c.org	2016-02-01 15:01:34.003243000 +0900
+++ /sys/dev/iwm/if_iwm.c	2016-04-21 14:24:02.691305000 +0900
@@ -3159,7 +3159,6 @@
 	struct iwm_node *in;
 	struct iwm_vap *iv = IWM_VAP(vap);
 	uint32_t duration;
-	uint32_t min_duration;
 	int error;
 
 	/*
@@ -3201,7 +3200,25 @@
 	if (iv->is_uploaded) {
 		if ((error = iwm_mvm_mac_ctxt_changed(sc, vap)) != 0) {
 			device_printf(sc->sc_dev,
-			    "%s: failed to add MAC\n", __func__);
+			    "%s: failed to update MAC\n", __func__);
+			goto out;
+		}
+		if ((error = iwm_mvm_phy_ctxt_changed(sc, &sc->sc_phyctxt[0],
+		    in->in_ni.ni_chan, 1, 1)) != 0) {
+			device_printf(sc->sc_dev,
+			    "%s: failed update phy ctxt\n", __func__);
+			goto out;
+		}
+		in->in_phyctxt = &sc->sc_phyctxt[0];
+
+		if ((error = iwm_mvm_binding_update(sc, in)) != 0) {
+			device_printf(sc->sc_dev,
+			    "%s: binding update cmd\n", __func__);
+			goto out;
+		}
+		if ((error = iwm_mvm_update_sta(sc, in)) != 0) {
+			device_printf(sc->sc_dev,
+			    "%s: failed to update sta\n", __func__);
 			goto out;
 		}
 	} else {
@@ -3210,61 +3227,35 @@
 			    "%s: failed to add MAC\n", __func__);
 			goto out;
 		}
-	}
-
-	if ((error = iwm_mvm_phy_ctxt_changed(sc, &sc->sc_phyctxt[0],
-	    in->in_ni.ni_chan, 1, 1)) != 0) {
-		device_printf(sc->sc_dev,
-		    "%s: failed add phy ctxt\n", __func__);
-		goto out;
-	}
-	in->in_phyctxt = &sc->sc_phyctxt[0];
-
-	if ((error = iwm_mvm_binding_add_vif(sc, in)) != 0) {
-		device_printf(sc->sc_dev,
-		    "%s: binding cmd\n", __func__);
-		goto out;
-	}
-
-	if ((error = iwm_mvm_add_sta(sc, in)) != 0) {
-		device_printf(sc->sc_dev,
-		    "%s: failed to add MAC\n", __func__);
-		goto out;
-	}
-
-	/* a bit superfluous? */
-	while (sc->sc_auth_prot)
-		msleep(&sc->sc_auth_prot, &sc->sc_mtx, 0, "iwmauth", 0);
-	sc->sc_auth_prot = 1;
-
-	duration = min(IWM_MVM_TE_SESSION_PROTECTION_MAX_TIME_MS,
-	    200 + in->in_ni.ni_intval);
-	min_duration = min(IWM_MVM_TE_SESSION_PROTECTION_MIN_TIME_MS,
-	    100 + in->in_ni.ni_intval);
-	iwm_mvm_protect_session(sc, in, duration, min_duration, 500);
-
-	IWM_DPRINTF(sc, IWM_DEBUG_RESET,
-	    "%s: waiting for auth_prot\n", __func__);
-	while (sc->sc_auth_prot != 2) {
-		/*
-		 * well, meh, but if the kernel is sleeping for half a
-		 * second, we have bigger problems
-		 */
-		if (sc->sc_auth_prot == 0) {
+		if ((error = iwm_mvm_phy_ctxt_changed(sc, &sc->sc_phyctxt[0],
+		    in->in_ni.ni_chan, 1, 1)) != 0) {
 			device_printf(sc->sc_dev,
-			    "%s: missed auth window!\n", __func__);
-			error = ETIMEDOUT;
+			    "%s: failed add phy ctxt\n", __func__);
 			goto out;
-		} else if (sc->sc_auth_prot == -1) {
+		}
+		in->in_phyctxt = &sc->sc_phyctxt[0];
+	
+		if ((error = iwm_mvm_binding_add_vif(sc, in)) != 0) {
+			device_printf(sc->sc_dev,
+			    "%s: binding add cmd\n", __func__);
+			goto out;
+		}
+		if ((error = iwm_mvm_add_sta(sc, in)) != 0) {
 			device_printf(sc->sc_dev,
-			    "%s: no time event, denied!\n", __func__);
-			sc->sc_auth_prot = 0;
-			error = EAUTH;
+			    "%s: failed to add sta\n", __func__);
 			goto out;
 		}
-		msleep(&sc->sc_auth_prot, &sc->sc_mtx, 0, "iwmau2", 0);
 	}
-	IWM_DPRINTF(sc, IWM_DEBUG_RESET, "<-%s\n", __func__);
+
+	/*
+	 * Prevent the FW from wandering off channel during association
+	 * by "protecting" the session with a time event.
+	 */
+	/* XXX duration is in units of TU, not MS */
+	duration = IWM_MVM_TE_SESSION_PROTECTION_MAX_TIME_MS;
+	iwm_mvm_protect_session(sc, in, duration, 500 /* XXX magic number */);
+	DELAY(100);
+
 	error = 0;
 out:
 	ieee80211_free_node(ni);
--- /sys/dev/iwm/if_iwm_binding.c.org	2015-10-23 16:11:37.635797000 +0900
+++ /sys/dev/iwm/if_iwm_binding.c	2016-04-20 15:17:32.934703000 +0900
@@ -201,13 +201,13 @@
 }
 
 int
-iwm_mvm_binding_update(struct iwm_softc *sc, struct iwm_node *in, int add)
+iwm_mvm_binding_update(struct iwm_softc *sc, struct iwm_node *in)
 {
-	return iwm_mvm_binding_cmd(sc, in, IWM_FW_CTXT_ACTION_ADD);
+	return iwm_mvm_binding_cmd(sc, in, IWM_FW_CTXT_ACTION_MODIFY);
 }
 
 int
 iwm_mvm_binding_add_vif(struct iwm_softc *sc, struct iwm_node *in)
 {
-	return iwm_mvm_binding_update(sc, in, IWM_FW_CTXT_ACTION_ADD);
+	return iwm_mvm_binding_cmd(sc, in, IWM_FW_CTXT_ACTION_ADD);
 }
--- if_iwm_binding.h.org	2015-10-23 16:11:31.950989000 +0900
+++ if_iwm_binding.h	2016-04-21 14:29:44.352627000 +0900
@@ -107,8 +107,7 @@
 
 extern	int iwm_mvm_binding_cmd(struct iwm_softc *sc, struct iwm_node *in,
 	    uint32_t action);
-extern	int iwm_mvm_binding_update(struct iwm_softc *sc, struct iwm_node *in,
-	    int add);
+extern	int iwm_mvm_binding_update(struct iwm_softc *sc, struct iwm_node *in);
 extern	int iwm_mvm_binding_add_vif(struct iwm_softc *sc, struct iwm_node *in);
 
 #endif	/* __IF_IWM_BINDING_H__ */
--- if_iwm_time_event.c.org	2015-10-23 16:11:37.636104000 +0900
+++ if_iwm_time_event.c	2016-04-21 14:26:11.776447000 +0900
@@ -244,7 +244,7 @@
 
 void
 iwm_mvm_protect_session(struct iwm_softc *sc, struct iwm_node *in,
-	uint32_t duration, uint32_t min_duration, uint32_t max_delay)
+	uint32_t duration, uint32_t max_delay)
 {
 	struct iwm_time_event_cmd_v2 time_cmd;
 
--- /sys/dev/iwm/if_iwm_time_event.h.org	2015-10-23 16:11:35.320341000 +0900
+++ /sys/dev/iwm/if_iwm_time_event.h	2016-04-21 14:26:54.507584000 +0900
@@ -108,6 +108,6 @@
 #define	__IF_IWM_TIME_EVENT_H__
 
 extern	void iwm_mvm_protect_session(struct iwm_softc *sc, struct iwm_node *in,
-	    uint32_t duration, uint32_t min_duration, uint32_t max_delay);
+	    uint32_t duration, uint32_t max_delay);
 
 #endif	/* __IF_IWM_TIME_EVENT_H__ */

----Next_Part(Fri_Apr_22_16_10_46_2016_896)----



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160422.161046.1399384989198011599.ish>