PERFORCE change 136320 for review
Sam Leffler
sam at FreeBSD.org
Wed Feb 27 03:48:17 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=136320
Change 136320 by sam at sam_ebb on 2008/02/27 03:47:36
blindly apply the same change as the 2661 so wds works;
I can't test it any more as I've given away all my 2560 cards
Affected files ...
.. //depot/projects/vap/sys/dev/ral/rt2560.c#18 edit
Differences ...
==== //depot/projects/vap/sys/dev/ral/rt2560.c#18 (text) ====
@@ -280,14 +280,19 @@
/* set device capabilities */
ic->ic_caps =
- IEEE80211_C_IBSS | /* IBSS mode supported */
- IEEE80211_C_MONITOR | /* monitor mode supported */
- IEEE80211_C_HOSTAP | /* HostAp mode supported */
- IEEE80211_C_TXPMGT | /* tx power management */
- IEEE80211_C_SHPREAMBLE | /* short preamble supported */
- IEEE80211_C_SHSLOT | /* short slot time supported */
- IEEE80211_C_BGSCAN | /* bg scanning support */
- IEEE80211_C_WPA; /* 802.11i */
+ IEEE80211_C_IBSS /* ibss, nee adhoc, mode */
+ | IEEE80211_C_HOSTAP /* hostap mode */
+ | IEEE80211_C_MONITOR /* monitor mode */
+ | IEEE80211_C_AHDEMO /* adhoc demo mode */
+ | IEEE80211_C_WDS /* 4-address traffic works */
+ | IEEE80211_C_SHPREAMBLE /* short preamble supported */
+ | IEEE80211_C_SHSLOT /* short slot time supported */
+ | IEEE80211_C_WPA /* capable of WPA1+WPA2 */
+ | IEEE80211_C_BGSCAN /* capable of bg scanning */
+#ifdef notyet
+ | IEEE80211_C_TXFRAG /* handle tx frags */
+#endif
+ ;
bands = 0;
setbit(&bands, IEEE80211_MODE_11B);
@@ -382,19 +387,46 @@
const uint8_t bssid[IEEE80211_ADDR_LEN],
const uint8_t mac[IEEE80211_ADDR_LEN])
{
+ struct ifnet *ifp = ic->ic_ifp;
struct rt2560_vap *rvp;
struct ieee80211vap *vap;
- if (!TAILQ_EMPTY(&ic->ic_vaps)) /* only one at a time */
+ switch (opmode) {
+ case IEEE80211_M_STA:
+ case IEEE80211_M_IBSS:
+ case IEEE80211_M_AHDEMO:
+ case IEEE80211_M_MONITOR:
+ case IEEE80211_M_HOSTAP:
+ if (!TAILQ_EMPTY(&ic->ic_vaps)) {
+ if_printf(ifp, "only 1 vap supported\n");
+ return NULL;
+ }
+ if (opmode == IEEE80211_M_STA)
+ flags |= IEEE80211_CLONE_NOBEACONS;
+ break;
+ case IEEE80211_M_WDS:
+ if (TAILQ_EMPTY(&ic->ic_vaps) ||
+ ic->ic_opmode != IEEE80211_M_HOSTAP) {
+ if_printf(ifp, "wds only supported in ap mode\n");
+ return NULL;
+ }
+ /*
+ * Silently remove any request for a unique
+ * bssid; WDS vap's always share the local
+ * mac address.
+ */
+ flags &= ~IEEE80211_CLONE_BSSID;
+ break;
+ default:
+ if_printf(ifp, "unknown opmode %d\n", opmode);
return NULL;
+ }
rvp = (struct rt2560_vap *) malloc(sizeof(struct rt2560_vap),
M_80211_VAP, M_NOWAIT | M_ZERO);
if (rvp == NULL)
return NULL;
vap = &rvp->ral_vap;
- /* enable s/w bmiss handling for sta mode */
- ieee80211_vap_setup(ic, vap, name, unit, opmode,
- flags | IEEE80211_CLONE_NOBEACONS, bssid, mac);
+ ieee80211_vap_setup(ic, vap, name, unit, opmode, flags, bssid, mac);
/* override state transition machine */
rvp->ral_newstate = vap->iv_newstate;
@@ -406,7 +438,8 @@
/* complete setup */
ieee80211_vap_attach(vap, ieee80211_media_change, ieee80211_media_status);
- ic->ic_opmode = opmode;
+ if (TAILQ_FIRST(&ic->ic_vaps) == vap)
+ ic->ic_opmode = opmode;
return vap;
}
@@ -790,29 +823,26 @@
rt2560_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
{
struct rt2560_vap *rvp = RT2560_VAP(vap);
- struct rt2560_softc *sc = vap->iv_ic->ic_ifp->if_softc;
- const struct ieee80211_txparam *tp;
- enum ieee80211_state ostate;
- struct ieee80211_node *ni;
- struct mbuf *m;
- int error = 0;
+ struct ifnet *ifp = vap->iv_ic->ic_ifp;
+ struct rt2560_softc *sc = ifp->if_softc;
+ int error;
+
+ if (nstate == IEEE80211_S_INIT && vap->iv_state == IEEE80211_S_RUN) {
+ callout_stop(&rvp->rssadapt_ch);
- ostate = vap->iv_state;
+ /* abort TSF synchronization */
+ RAL_WRITE(sc, RT2560_CSR14, 0);
- switch (nstate) {
- case IEEE80211_S_INIT:
- if (ostate == IEEE80211_S_RUN) {
- callout_stop(&rvp->rssadapt_ch);
+ /* turn association led off */
+ rt2560_update_led(sc, 0, 0);
+ }
- /* abort TSF synchronization */
- RAL_WRITE(sc, RT2560_CSR14, 0);
+ error = rvp->ral_newstate(vap, nstate, arg);
- /* turn association led off */
- rt2560_update_led(sc, 0, 0);
- }
- break;
- case IEEE80211_S_RUN:
- ni = vap->iv_bss;
+ if (error == 0 && nstate == IEEE80211_S_RUN) {
+ struct ieee80211_node *ni = vap->iv_bss;
+ const struct ieee80211_txparam *tp;
+ struct mbuf *m;
if (vap->iv_opmode != IEEE80211_M_MONITOR) {
rt2560_update_plcp(sc);
@@ -824,16 +854,13 @@
vap->iv_opmode == IEEE80211_M_IBSS) {
m = ieee80211_beacon_alloc(ni, &rvp->ral_bo);
if (m == NULL) {
- device_printf(sc->sc_dev,
- "could not allocate beacon\n");
- error = ENOBUFS;
- break;
+ if_printf(ifp, "could not allocate beacon\n");
+ return ENOBUFS;
}
-
ieee80211_ref_node(ni);
error = rt2560_tx_bcn(sc, m, ni);
if (error != 0)
- break;
+ return error;
}
/* turn assocation led on */
@@ -844,7 +871,6 @@
/* fake a join to init the tx rate */
rt2560_newassoc(ni, 1);
}
-
tp = &vap->iv_txparms[ieee80211_chan2mode(ni->ni_chan)];
if (tp->ucastrate == IEEE80211_FIXED_RATE_NONE)
callout_reset(&rvp->rssadapt_ch, hz / 10,
@@ -852,12 +878,8 @@
rt2560_enable_tsf_sync(sc);
}
- break;
- default:
- break;
}
-
- return (error != 0) ? error : rvp->ral_newstate(vap, nstate, arg);
+ return error;
}
/*
More information about the p4-projects
mailing list