Bug 174963 - buffalo wli-uc-gn wireless card sometimes unusable and emit "run0: wcid=xx out of range"
Summary: buffalo wli-uc-gn wireless card sometimes unusable and emit "run0: wcid=xx ou...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: usb (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-usb (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-04 05:30 UTC by jov
Modified: 2019-01-13 09:03 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jov 2013-01-04 05:30:00 UTC
I think the hardware is ok because I can use it in Win7. And in Freebsd 9.1,it works for sometime,but sometimes after system reboot or I plug out & plug in the card it my unusable.on the console it emmit:
 "run0: wcid=xx out of range" where xx is 91,87 and etc.

it seams the wifi is connected because ifconfig wlan0 cmd shows the right ssid and bssid ,but inet addr is always 0.0.0.0

Fix: thanks for PseudoCylon <moonlightakkiy@yahoo.ca>'s help, his patch solves the problem.

Reboot or re-plug-in shouldn't be a cause of the problem. Receiving an
association ID larger than device's max (64) is the problem. You must
be using a high-end AP. Reboot or re-plug-in initiate re-association
and just happen to receive a large association ID.


AK


--begin patch--



@@ -2374,9 +2375,12 @@ run_newassoc(struct ieee80211_node *ni, int isnew)
        struct run_softc *sc = ic->ic_ifp->if_softc;
        uint8_t rate;
        uint8_t ridx;
-       uint8_t wcid = RUN_AID2WCID(ni->ni_associd);
+       uint8_t wcid;
        int i, j;

+       wcid = (vap->iv_opmode == IEEE80211_M_STA) ?
+           1 : RUN_AID2WCID(ni->ni_associd);
+
        if (wcid > RT2870_WCID_MAX) {
                device_printf(sc->sc_dev, "wcid=%d out of range\n", wcid);
                return;
@@ -3044,8 +3048,12 @@ run_tx(struct run_softc *sc, struct mbuf *m,
struct ieee80211_node *ni)
        txd->flags = qflags;
        txwi = (struct rt2860_txwi *)(txd + 1);
        txwi->xflags = xflags;
-       txwi->wcid = IEEE80211_IS_MULTICAST(wh->i_addr1) ?
-           0 : RUN_AID2WCID(ni->ni_associd);
+       if (IEEE80211_IS_MULTICAST(wh->i_addr1))
+               txwi->wcid = 0;
+       else {
+               txwi->wcid = (vap->iv_opmode == IEEE80211_M_STA) ?
+                   1 : RUN_AID2WCID(ni->ni_associd);
+       }
        /* clear leftover garbage bits */
        txwi->flags = 0;
        txwi->txop = 0;--R7OVndYJPShakVJGCEPopkrDNWZQIO0ldZC5Qkp7NNmrzuoP
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

diff --git a/dev/usb/wlan/if_run.c b/dev/usb/wlan/if_run.c
index 3d2577f..ed11d97 100644
--- a/dev/usb/wlan/if_run.c
+++ b/dev/usb/wlan/if_run.c
@@ -2019,7 +2019,8 @@ run_key_set_cb(void *arg)
                wcid = 0;       /* NB: update WCID0 for group keys */
                base = RT2860_SKEY(RUN_VAP(vap)->rvp_id, k->wk_keyix);
        } else {
-               wcid = RUN_AID2WCID(associd);
+               wcid = (vap->iv_opmode == IEEE80211_M_STA) ?
+                   1 : RUN_AID2WCID(associd);
                base = RT2860_PKEY(wcid);
        }
How-To-Repeat: I plug out & plug in the card some times
Comment 1 dfilter service freebsd_committer freebsd_triage 2013-01-04 20:44:30 UTC
Author: hselasky
Date: Fri Jan  4 20:44:17 2013
New Revision: 245047
URL: http://svnweb.freebsd.org/changeset/base/245047

Log:
  Fix for "run0: wcid=xx out of range" error message.
  
  MFC after:	1 week
  PR:		usb/174963
  Submitted by:	PseudoCylon <moonlightakkiy@yahoo.ca>

Modified:
  head/sys/dev/usb/wlan/if_run.c

Modified: head/sys/dev/usb/wlan/if_run.c
==============================================================================
--- head/sys/dev/usb/wlan/if_run.c	Fri Jan  4 19:29:23 2013	(r245046)
+++ head/sys/dev/usb/wlan/if_run.c	Fri Jan  4 20:44:17 2013	(r245047)
@@ -2019,7 +2019,8 @@ run_key_set_cb(void *arg)
 		wcid = 0;	/* NB: update WCID0 for group keys */
 		base = RT2860_SKEY(RUN_VAP(vap)->rvp_id, k->wk_keyix);
 	} else {
-		wcid = RUN_AID2WCID(associd);
+		wcid = (vap->iv_opmode == IEEE80211_M_STA) ?
+		    1 : RUN_AID2WCID(associd);
 		base = RT2860_PKEY(wcid);
 	}
 
@@ -2374,9 +2375,12 @@ run_newassoc(struct ieee80211_node *ni, 
 	struct run_softc *sc = ic->ic_ifp->if_softc;
 	uint8_t rate;
 	uint8_t ridx;
-	uint8_t wcid = RUN_AID2WCID(ni->ni_associd);
+	uint8_t wcid;
 	int i, j;
 
+	wcid = (vap->iv_opmode == IEEE80211_M_STA) ?
+	    1 : RUN_AID2WCID(ni->ni_associd);
+
 	if (wcid > RT2870_WCID_MAX) {
 		device_printf(sc->sc_dev, "wcid=%d out of range\n", wcid);
 		return;
@@ -3044,8 +3048,12 @@ run_tx(struct run_softc *sc, struct mbuf
 	txd->flags = qflags;
 	txwi = (struct rt2860_txwi *)(txd + 1);
 	txwi->xflags = xflags;
-	txwi->wcid = IEEE80211_IS_MULTICAST(wh->i_addr1) ?
-	    0 : RUN_AID2WCID(ni->ni_associd);
+	if (IEEE80211_IS_MULTICAST(wh->i_addr1)) {
+		txwi->wcid = 0;
+	} else {
+		txwi->wcid = (vap->iv_opmode == IEEE80211_M_STA) ?
+		    1 : RUN_AID2WCID(ni->ni_associd);
+	}
 	/* clear leftover garbage bits */
 	txwi->flags = 0;
 	txwi->txop = 0;
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 2 dfilter service freebsd_committer freebsd_triage 2013-01-21 07:16:42 UTC
Author: hselasky
Date: Mon Jan 21 07:16:29 2013
New Revision: 245729
URL: http://svnweb.freebsd.org/changeset/base/245729

Log:
  MFC r245047:
  Fix for "run0: wcid=xx out of range" error message.
  
  PR:		usb/174963
  Submitted by:	PseudoCylon <moonlightakkiy@yahoo.ca>

Modified:
  stable/9/sys/dev/usb/wlan/if_run.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/usb/wlan/if_run.c
==============================================================================
--- stable/9/sys/dev/usb/wlan/if_run.c	Mon Jan 21 07:14:06 2013	(r245728)
+++ stable/9/sys/dev/usb/wlan/if_run.c	Mon Jan 21 07:16:29 2013	(r245729)
@@ -2019,7 +2019,8 @@ run_key_set_cb(void *arg)
 		wcid = 0;	/* NB: update WCID0 for group keys */
 		base = RT2860_SKEY(RUN_VAP(vap)->rvp_id, k->wk_keyix);
 	} else {
-		wcid = RUN_AID2WCID(associd);
+		wcid = (vap->iv_opmode == IEEE80211_M_STA) ?
+		    1 : RUN_AID2WCID(associd);
 		base = RT2860_PKEY(wcid);
 	}
 
@@ -2374,9 +2375,12 @@ run_newassoc(struct ieee80211_node *ni, 
 	struct run_softc *sc = ic->ic_ifp->if_softc;
 	uint8_t rate;
 	uint8_t ridx;
-	uint8_t wcid = RUN_AID2WCID(ni->ni_associd);
+	uint8_t wcid;
 	int i, j;
 
+	wcid = (vap->iv_opmode == IEEE80211_M_STA) ?
+	    1 : RUN_AID2WCID(ni->ni_associd);
+
 	if (wcid > RT2870_WCID_MAX) {
 		device_printf(sc->sc_dev, "wcid=%d out of range\n", wcid);
 		return;
@@ -3044,8 +3048,12 @@ run_tx(struct run_softc *sc, struct mbuf
 	txd->flags = qflags;
 	txwi = (struct rt2860_txwi *)(txd + 1);
 	txwi->xflags = xflags;
-	txwi->wcid = IEEE80211_IS_MULTICAST(wh->i_addr1) ?
-	    0 : RUN_AID2WCID(ni->ni_associd);
+	if (IEEE80211_IS_MULTICAST(wh->i_addr1)) {
+		txwi->wcid = 0;
+	} else {
+		txwi->wcid = (vap->iv_opmode == IEEE80211_M_STA) ?
+		    1 : RUN_AID2WCID(ni->ni_associd);
+	}
 	/* clear leftover garbage bits */
 	txwi->flags = 0;
 	txwi->txop = 0;
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 3 Martin Wilke freebsd_committer freebsd_triage 2015-12-25 04:56:41 UTC
Committed 2013-01-05;
Comment 4 Eitan Adler freebsd_committer freebsd_triage 2018-05-28 19:45:38 UTC
batch change:

For bugs that match the following
-  Status Is In progress 
AND
- Untouched since 2018-01-01.
AND
- Affects Base System OR Documentation

DO:

Reset to open status.


Note:
I did a quick pass but if you are getting this email it might be worthwhile to double check to see if this bug ought to be closed.
Comment 5 Andriy Voskoboinyk freebsd_committer freebsd_triage 2019-01-13 09:03:31 UTC
Seems to be already resolved in base r245047 (as noted in comment #2)