PERFORCE change 152042 for review
Ed Schouten
ed at FreeBSD.org
Mon Oct 27 19:28:09 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=152042
Change 152042 by ed at ed_dull on 2008/10/27 19:27:42
It seems we can live without Giant in log_console().
Revert changes to subr_prf.c. It's just easier to IFC at the same time.
Affected files ...
.. //depot/projects/mpsafetty/bin/cp/utils.c#4 integrate
.. //depot/projects/mpsafetty/etc/Makefile#4 integrate
.. //depot/projects/mpsafetty/etc/devd.conf#2 integrate
.. //depot/projects/mpsafetty/etc/remote#4 integrate
.. //depot/projects/mpsafetty/sys/conf/files#22 integrate
.. //depot/projects/mpsafetty/sys/dev/ath/ah_osdep.c#2 integrate
.. //depot/projects/mpsafetty/sys/dev/ath/ath_rate/amrr/amrr.c#2 integrate
.. //depot/projects/mpsafetty/sys/dev/ath/ath_rate/onoe/onoe.c#2 integrate
.. //depot/projects/mpsafetty/sys/dev/ath/ath_rate/sample/sample.c#2 integrate
.. //depot/projects/mpsafetty/sys/dev/ath/if_ath.c#5 integrate
.. //depot/projects/mpsafetty/sys/dev/ath/if_athrate.h#2 integrate
.. //depot/projects/mpsafetty/sys/dev/ath/if_athvar.h#4 integrate
.. //depot/projects/mpsafetty/sys/dev/iwn/if_iwn.c#3 integrate
.. //depot/projects/mpsafetty/sys/dev/ral/rt2560.c#2 integrate
.. //depot/projects/mpsafetty/sys/dev/ral/rt2661.c#2 integrate
.. //depot/projects/mpsafetty/sys/dev/usb/if_zyd.c#5 integrate
.. //depot/projects/mpsafetty/sys/dev/wpi/if_wpi.c#3 integrate
.. //depot/projects/mpsafetty/sys/kern/subr_prf.c#4 integrate
.. //depot/projects/mpsafetty/sys/modules/mac_bsdextended/Makefile#2 integrate
.. //depot/projects/mpsafetty/sys/net80211/ieee80211_adhoc.c#4 integrate
.. //depot/projects/mpsafetty/sys/net80211/ieee80211_sta.c#5 integrate
.. //depot/projects/mpsafetty/sys/netinet/sctp_os_bsd.h#5 integrate
.. //depot/projects/mpsafetty/sys/netinet/sctp_output.c#7 integrate
.. //depot/projects/mpsafetty/sys/netinet/sctp_timer.c#5 integrate
.. //depot/projects/mpsafetty/sys/netinet/sctp_timer.h#4 integrate
.. //depot/projects/mpsafetty/sys/security/mac_bsdextended/mac_bsdextended.c#8 integrate
.. //depot/projects/mpsafetty/sys/security/mac_bsdextended/ugidfw_internal.h#1 branch
.. //depot/projects/mpsafetty/sys/security/mac_bsdextended/ugidfw_system.c#2 integrate
.. //depot/projects/mpsafetty/sys/security/mac_bsdextended/ugidfw_vnode.c#2 integrate
.. //depot/projects/mpsafetty/usr.sbin/Makefile#11 integrate
Differences ...
==== //depot/projects/mpsafetty/bin/cp/utils.c#4 (text+ko) ====
@@ -33,7 +33,7 @@
#endif
#endif /* not lint */
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/bin/cp/utils.c,v 1.55 2008/09/09 12:31:42 trasz Exp $");
+__FBSDID("$FreeBSD: src/bin/cp/utils.c,v 1.56 2008/10/27 15:21:15 dds Exp $");
#include <sys/types.h>
#include <sys/acl.h>
@@ -137,41 +137,39 @@
* Mmap and write if less than 8M (the limit is so we don't totally
* trash memory on big files. This is really a minor hack, but it
* wins some CPU back.
+ * Some filesystems, such as smbnetfs, don't support mmap,
+ * so this is a best-effort attempt.
*/
#ifdef VM_AND_BUFFER_CACHE_SYNCHRONIZED
if (S_ISREG(fs->st_mode) && fs->st_size > 0 &&
- fs->st_size <= 8 * 1048576) {
- if ((p = mmap(NULL, (size_t)fs->st_size, PROT_READ,
- MAP_SHARED, from_fd, (off_t)0)) == MAP_FAILED) {
+ fs->st_size <= 8 * 1024 * 1024 &&
+ (p = mmap(NULL, (size_t)fs->st_size, PROT_READ,
+ MAP_SHARED, from_fd, (off_t)0)) != MAP_FAILED) {
+ wtotal = 0;
+ for (bufp = p, wresid = fs->st_size; ;
+ bufp += wcount, wresid -= (size_t)wcount) {
+ wcount = write(to_fd, bufp, wresid);
+ if (wcount <= 0)
+ break;
+ wtotal += wcount;
+ if (info) {
+ info = 0;
+ (void)fprintf(stderr,
+ "%s -> %s %3d%%\n",
+ entp->fts_path, to.p_path,
+ cp_pct(wtotal, fs->st_size));
+ }
+ if (wcount >= (ssize_t)wresid)
+ break;
+ }
+ if (wcount != (ssize_t)wresid) {
+ warn("%s", to.p_path);
+ rval = 1;
+ }
+ /* Some systems don't unmap on close(2). */
+ if (munmap(p, fs->st_size) < 0) {
warn("%s", entp->fts_path);
rval = 1;
- } else {
- wtotal = 0;
- for (bufp = p, wresid = fs->st_size; ;
- bufp += wcount, wresid -= (size_t)wcount) {
- wcount = write(to_fd, bufp, wresid);
- if (wcount <= 0)
- break;
- wtotal += wcount;
- if (info) {
- info = 0;
- (void)fprintf(stderr,
- "%s -> %s %3d%%\n",
- entp->fts_path, to.p_path,
- cp_pct(wtotal, fs->st_size));
- }
- if (wcount >= (ssize_t)wresid)
- break;
- }
- if (wcount != (ssize_t)wresid) {
- warn("%s", to.p_path);
- rval = 1;
- }
- /* Some systems don't unmap on close(2). */
- if (munmap(p, fs->st_size) < 0) {
- warn("%s", entp->fts_path);
- rval = 1;
- }
}
} else
#endif
==== //depot/projects/mpsafetty/etc/Makefile#4 (text+ko) ====
@@ -1,5 +1,5 @@
# from: @(#)Makefile 5.11 (Berkeley) 5/21/91
-# $FreeBSD: src/etc/Makefile,v 1.371 2008/10/08 13:28:02 des Exp $
+# $FreeBSD: src/etc/Makefile,v 1.372 2008/10/27 16:13:28 sam Exp $
.include <bsd.own.mk>
@@ -8,7 +8,7 @@
.endif
BIN1= auth.conf \
- crontab csh.cshrc csh.login csh.logout devd.conf devfs.conf \
+ crontab devd.conf devfs.conf \
ddb.conf dhclient.conf disktab fbtab \
ftpusers gettytab group \
hosts hosts.allow hosts.equiv \
@@ -84,6 +84,10 @@
BIN1+= pf.os
.endif
+.if ${MK_TCSH} != "no"
+BIN1+= csh.cshrc csh.login csh.logout
+.endif
+
.if ${MK_WIRELESS} != "no"
BIN1+= regdomain.xml
.endif
@@ -148,9 +152,12 @@
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 755 \
${BIN2} ${DESTDIR}/etc; \
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
- master.passwd nsmb.conf opieaccess ${DESTDIR}/etc; \
- pwd_mkdb ${PWD_MKDB_ENDIAN} -i -p -d ${DESTDIR}/etc \
- ${DESTDIR}/etc/master.passwd
+ master.passwd nsmb.conf opieaccess ${DESTDIR}/etc;
+.if ${MK_TCSH} == "no"
+ sed -i "" -e 's;/bin/csh;;' ${DESTDIR}/etc/master.passwd
+.endif
+ pwd_mkdb ${PWD_MKDB_ENDIAN} -i -p -d ${DESTDIR}/etc \
+ ${DESTDIR}/etc/master.passwd
.if ${MK_BLUETOOTH} != "no"
${_+_}cd ${.CURDIR}/bluetooth; ${MAKE} install
.endif
@@ -195,14 +202,18 @@
.endif
cd ${.CURDIR}/root; \
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
+ dot.profile ${DESTDIR}/root/.profile; \
+ rm -f ${DESTDIR}/.profile; \
+ ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile
+.if ${MK_TCSH} != "no"
+ cd ${.CURDIR}/root; \
+ ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
dot.cshrc ${DESTDIR}/root/.cshrc; \
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
dot.login ${DESTDIR}/root/.login; \
- ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
- dot.profile ${DESTDIR}/root/.profile; \
- rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
- ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc; \
- ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile
+ rm -f ${DESTDIR}/.cshrc; \
+ ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc
+.endif
cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
${MTREE} ${DESTDIR}/etc/mtree
.if ${MK_PPP} != "no"
==== //depot/projects/mpsafetty/etc/devd.conf#2 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/etc/devd.conf,v 1.42 2008/06/27 12:04:36 rpaulo Exp $
+# $FreeBSD: src/etc/devd.conf,v 1.43 2008/10/27 16:20:40 thompsa Exp $
#
# Refer to devd.conf(5) and devd(8) man pages for the details on how to
# run and configure devd.
@@ -256,6 +256,7 @@
};
# The next blocks enable volume hotkeys that can be found on the Asus EeePC
+# The four keys above the keyboard notify 0x1a through to 0x1d respectively
notify 0 {
match "system" "ACPI";
match "subsystem" "ASUS-Eee";
==== //depot/projects/mpsafetty/etc/remote#4 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/etc/remote,v 1.18 2008/07/21 22:38:00 marcel Exp $
+# $FreeBSD: src/etc/remote,v 1.19 2008/10/27 17:19:14 thompsa Exp $
#
# @(#)remote 5.2 (Berkeley) 6/30/90
#
@@ -66,3 +66,11 @@
uart5|com6:dv=/dev/cuau5:br#9600:pa=none:
uart6|com7:dv=/dev/cuau6:br#9600:pa=none:
uart7|com8:dv=/dev/cuau7:br#9600:pa=none:
+ucom1:dv=/dev/cuaU0:br#9600:pa=none:
+ucom2:dv=/dev/cuaU1:br#9600:pa=none:
+ucom3:dv=/dev/cuaU2:br#9600:pa=none:
+ucom4:dv=/dev/cuaU3:br#9600:pa=none:
+ucom5:dv=/dev/cuaU4:br#9600:pa=none:
+ucom6:dv=/dev/cuaU5:br#9600:pa=none:
+ucom7:dv=/dev/cuaU6:br#9600:pa=none:
+ucom8:dv=/dev/cuaU7:br#9600:pa=none:
==== //depot/projects/mpsafetty/sys/conf/files#22 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/files,v 1.1340 2008/10/25 06:18:12 marcel Exp $
+# $FreeBSD: src/sys/conf/files,v 1.1341 2008/10/27 17:57:03 bz Exp $
#
# The long compile-with and dependency lines are required because of
# limitations in config: backslash-newline doesn't work in strings, and
@@ -2194,6 +2194,8 @@
security/mac/mac_vfs.c optional mac
security/mac_biba/mac_biba.c optional mac_biba
security/mac_bsdextended/mac_bsdextended.c optional mac_bsdextended
+security/mac_bsdextended/ugidfw_system.c optional mac_bsdextended
+security/mac_bsdextended/ugidfw_vnode.c optional mac_bsdextended
security/mac_ifoff/mac_ifoff.c optional mac_ifoff
security/mac_lomac/mac_lomac.c optional mac_lomac
security/mac_mls/mac_mls.c optional mac_mls
==== //depot/projects/mpsafetty/sys/dev/ath/ah_osdep.c#2 (text+ko) ====
@@ -26,7 +26,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGES.
*
- * $FreeBSD: src/sys/dev/ath/ah_osdep.c,v 1.4 2008/04/20 20:35:35 sam Exp $
+ * $FreeBSD: src/sys/dev/ath/ah_osdep.c,v 1.5 2008/10/27 18:30:33 sam Exp $
*/
#include "opt_ah.h"
@@ -71,8 +71,12 @@
int lineno, const char* msg);
#endif
#ifdef AH_DEBUG
+#if HAL_ABI_VERSION >= 0x08090101
+extern void HALDEBUG(struct ath_hal *ah, u_int mask, const char* fmt, ...);
+#else
extern void HALDEBUG(struct ath_hal *ah, const char* fmt, ...);
extern void HALDEBUGn(struct ath_hal *ah, u_int level, const char* fmt, ...);
+#endif
#endif /* AH_DEBUG */
/* NB: put this here instead of the driver to avoid circular references */
@@ -139,7 +143,19 @@
}
#ifdef AH_DEBUG
+#if HAL_ABI_VERSION >= 0x08090101
void
+HALDEBUG(struct ath_hal *ah, u_int mask, const char* fmt, ...)
+{
+ if (ath_hal_debug & mask) {
+ __va_list ap;
+ va_start(ap, fmt);
+ ath_hal_vprintf(ah, fmt, ap);
+ va_end(ap);
+ }
+}
+#else
+void
HALDEBUG(struct ath_hal *ah, const char* fmt, ...)
{
if (ath_hal_debug) {
@@ -160,6 +176,7 @@
va_end(ap);
}
}
+#endif
#endif /* AH_DEBUG */
#ifdef AH_DEBUG_ALQ
==== //depot/projects/mpsafetty/sys/dev/ath/ath_rate/amrr/amrr.c#2 (text+ko) ====
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ath/ath_rate/amrr/amrr.c,v 1.15 2008/04/20 20:35:36 sam Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ath/ath_rate/amrr/amrr.c,v 1.17 2008/10/27 17:03:24 sam Exp $");
/*
* AMRR rate control. See:
@@ -277,8 +277,7 @@
ath_rate_ctl_start(struct ath_softc *sc, struct ieee80211_node *ni)
{
#define RATE(_ix) (ni->ni_rates.rs_rates[(_ix)] & IEEE80211_RATE_VAL)
- struct ath_node *an = ATH_NODE(ni);
- const struct ieee80211_txparam *tp = an->an_tp;
+ const struct ieee80211_txparam *tp = ni->ni_txparms;
int srate;
KASSERT(ni->ni_rates.rs_nrates > 0, ("no rates"));
@@ -321,49 +320,6 @@
#undef RATE
}
-static void
-ath_rate_cb(void *arg, struct ieee80211_node *ni)
-{
- struct ath_softc *sc = arg;
-
- ath_rate_update(sc, ni, 0);
-}
-
-/*
- * Reset the rate control state for each 802.11 state transition.
- */
-void
-ath_rate_newstate(struct ieee80211vap *vap, enum ieee80211_state state)
-{
- struct ieee80211com *ic = vap->iv_ic;
- struct ath_softc *sc = ic->ic_ifp->if_softc;
- struct ieee80211_node *ni;
-
- if (state == IEEE80211_S_INIT)
- return;
- if (vap->iv_opmode == IEEE80211_M_STA) {
- /*
- * Reset local xmit state; this is really only
- * meaningful when operating in station mode.
- */
- ni = vap->iv_bss;
- if (state == IEEE80211_S_RUN) {
- ath_rate_ctl_start(sc, ni);
- } else {
- ath_rate_update(sc, ni, 0);
- }
- } else {
- /*
- * When operating as a station the node table holds
- * the AP's that were discovered during scanning.
- * For any other operating mode we want to reset the
- * tx rate state of each node.
- */
- ieee80211_iterate_nodes(&ic->ic_sta, ath_rate_cb, sc);
- ath_rate_update(sc, vap->iv_bss, 0);
- }
-}
-
/*
* Examine and potentially adjust the transmit rate.
*/
==== //depot/projects/mpsafetty/sys/dev/ath/ath_rate/onoe/onoe.c#2 (text+ko) ====
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ath/ath_rate/onoe/onoe.c,v 1.16 2008/04/20 20:35:36 sam Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ath/ath_rate/onoe/onoe.c,v 1.18 2008/10/27 17:03:24 sam Exp $");
/*
* Atsushi Onoe's rate control algorithm.
@@ -251,8 +251,7 @@
ath_rate_ctl_start(struct ath_softc *sc, struct ieee80211_node *ni)
{
#define RATE(_ix) (ni->ni_rates.rs_rates[(_ix)] & IEEE80211_RATE_VAL)
- struct ath_node *an = ATH_NODE(ni);
- const struct ieee80211_txparam *tp = an->an_tp;
+ const struct ieee80211_txparam *tp = ni->ni_txparms;
int srate;
KASSERT(ni->ni_rates.rs_nrates > 0, ("no rates"));
@@ -295,49 +294,6 @@
#undef RATE
}
-static void
-ath_rate_cb(void *arg, struct ieee80211_node *ni)
-{
- struct ath_softc *sc = arg;
-
- ath_rate_update(sc, ni, 0);
-}
-
-/*
- * Reset the rate control state for each 802.11 state transition.
- */
-void
-ath_rate_newstate(struct ieee80211vap *vap, enum ieee80211_state state)
-{
- struct ieee80211com *ic = vap->iv_ic;
- struct ath_softc *sc = ic->ic_ifp->if_softc;
- struct ieee80211_node *ni;
-
- if (state == IEEE80211_S_INIT)
- return;
- if (vap->iv_opmode == IEEE80211_M_STA) {
- /*
- * Reset local xmit state; this is really only
- * meaningful when operating in station mode.
- */
- ni = vap->iv_bss;
- if (state == IEEE80211_S_RUN) {
- ath_rate_ctl_start(sc, ni);
- } else {
- ath_rate_update(sc, ni, 0);
- }
- } else {
- /*
- * When operating as a station the node table holds
- * the AP's that were discovered during scanning.
- * For any other operating mode we want to reset the
- * tx rate state of each node.
- */
- ieee80211_iterate_nodes(&ic->ic_sta, ath_rate_cb, sc);
- ath_rate_update(sc, vap->iv_bss, 0);
- }
-}
-
/*
* Examine and potentially adjust the transmit rate.
*/
==== //depot/projects/mpsafetty/sys/dev/ath/ath_rate/sample/sample.c#2 (text+ko) ====
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ath/ath_rate/sample/sample.c,v 1.20 2008/04/20 20:35:36 sam Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ath/ath_rate/sample/sample.c,v 1.24 2008/10/27 18:22:44 sam Exp $");
/*
* John Bicket's SampleRate control algorithm.
@@ -393,11 +393,8 @@
size_bin = size_to_bin(frame_size);
size = bin_to_size(size_bin);
- if (!(0 <= ndx0 && ndx0 < sn->num_rates)) {
- printf("%s: bogus ndx0 %d, max %u, mode %u\n",
- __func__, ndx0, sn->num_rates, sc->sc_curmode);
+ if (!(0 <= ndx0 && ndx0 < sn->num_rates))
return;
- }
rate = sn->rates[ndx0].rate;
tt += calc_usecs_unicast_packet(sc, size, sn->rates[ndx0].rix,
@@ -405,11 +402,8 @@
MIN(tries0, tries) - 1);
tries_so_far += tries0;
if (tries1 && tries0 < tries) {
- if (!(0 <= ndx1 && ndx1 < sn->num_rates)) {
- printf("%s: bogus ndx1 %d, max %u, mode %u\n",
- __func__, ndx1, sn->num_rates, sc->sc_curmode);
+ if (!(0 <= ndx1 && ndx1 < sn->num_rates))
return;
- }
tt += calc_usecs_unicast_packet(sc, size, sn->rates[ndx1].rix,
short_tries,
MIN(tries1 + tries_so_far, tries) - tries_so_far - 1);
@@ -417,11 +411,8 @@
tries_so_far += tries1;
if (tries2 && tries0 + tries1 < tries) {
- if (!(0 <= ndx2 && ndx2 < sn->num_rates)) {
- printf("%s: bogus ndx2 %d, max %u, mode %u\n",
- __func__, ndx2, sn->num_rates, sc->sc_curmode);
+ if (!(0 <= ndx2 && ndx2 < sn->num_rates))
return;
- }
tt += calc_usecs_unicast_packet(sc, size, sn->rates[ndx2].rix,
short_tries,
MIN(tries2 + tries_so_far, tries) - tries_so_far - 1);
@@ -430,11 +421,8 @@
tries_so_far += tries2;
if (tries3 && tries0 + tries1 + tries2 < tries) {
- if (!(0 <= ndx3 && ndx3 < sn->num_rates)) {
- printf("%s: bogus ndx3 %d, max %u, mode %u\n",
- __func__, ndx3, sn->num_rates, sc->sc_curmode);
+ if (!(0 <= ndx3 && ndx3 < sn->num_rates))
return;
- }
tt += calc_usecs_unicast_packet(sc, size, sn->rates[ndx3].rix,
short_tries,
MIN(tries3 + tries_so_far, tries) - tries_so_far - 1);
@@ -488,6 +476,13 @@
}
}
+static void
+badrate(struct ifnet *ifp, int series, int hwrate, int tries, int status)
+{
+ if_printf(ifp, "bad series%d hwrate 0x%x, tries %u ts_status 0x%x\n",
+ series, hwrate, tries, status);
+}
+
void
ath_rate_tx_complete(struct ath_softc *sc, struct ath_node *an,
const struct ath_buf *bf)
@@ -498,9 +493,11 @@
const struct ath_tx_status *ts = &bf->bf_status.ds_txstat;
const struct ath_desc *ds0 = &bf->bf_desc[0];
int final_rate, short_tries, long_tries, frame_size;
+ const HAL_RATE_TABLE *rt = sc->sc_currates;
int mrr;
- final_rate = sc->sc_hwmap[ts->ts_rate &~ HAL_TXSTAT_ALTRATE].ieeerate;
+ final_rate = sc->sc_hwmap[
+ rt->rateCodeToIndex[ts->ts_rate &~ HAL_TXSTAT_ALTRATE]].ieeerate;
short_tries = ts->ts_shortretry;
long_tries = ts->ts_longretry + 1;
frame_size = ds0->ds_ctl0 & 0x0fff; /* low-order 12 bits of ds_ctl0 */
@@ -521,6 +518,10 @@
if (!mrr || !(ts->ts_rate & HAL_TXSTAT_ALTRATE)) {
int ndx = rate_to_ndx(sn, final_rate);
+ if (ndx < 0) {
+ badrate(ifp, 0, ts->ts_rate, long_tries, ts->ts_status);
+ return;
+ }
/*
* Only one rate was used; optimize work.
*/
@@ -558,22 +559,31 @@
hwrate3 = MS(ds0->ds_ctl3, AR5416_XmitRate3);
}
- rate0 = sc->sc_hwmap[hwrate0].ieeerate;
+ rate0 = sc->sc_hwmap[rt->rateCodeToIndex[hwrate0]].ieeerate;
tries0 = MS(ds0->ds_ctl2, AR_XmitDataTries0);
ndx0 = rate_to_ndx(sn, rate0);
- rate1 = sc->sc_hwmap[hwrate1].ieeerate;
+ rate1 = sc->sc_hwmap[rt->rateCodeToIndex[hwrate1]].ieeerate;
tries1 = MS(ds0->ds_ctl2, AR_XmitDataTries1);
ndx1 = rate_to_ndx(sn, rate1);
- rate2 = sc->sc_hwmap[hwrate2].ieeerate;
+ rate2 = sc->sc_hwmap[rt->rateCodeToIndex[hwrate2]].ieeerate;
tries2 = MS(ds0->ds_ctl2, AR_XmitDataTries2);
ndx2 = rate_to_ndx(sn, rate2);
- rate3 = sc->sc_hwmap[hwrate3].ieeerate;
+ rate3 = sc->sc_hwmap[rt->rateCodeToIndex[hwrate3]].ieeerate;
tries3 = MS(ds0->ds_ctl2, AR_XmitDataTries3);
ndx3 = rate_to_ndx(sn, rate3);
+ if (tries0 && ndx0 < 0)
+ badrate(ifp, 0, hwrate0, tries0, ts->ts_status);
+ if (tries1 && ndx1 < 0)
+ badrate(ifp, 1, hwrate1, tries1, ts->ts_status);
+ if (tries2 && ndx2 < 0)
+ badrate(ifp, 2, hwrate2, tries2, ts->ts_status);
+ if (tries3 && ndx3 < 0)
+ badrate(ifp, 3, hwrate3, tries3, ts->ts_status);
+
IEEE80211_NOTE(an->an_node.ni_vap, IEEE80211_MSG_RATECTL,
&an->an_node,
"%s: size %d finaltsidx %d tries %d %s rate/try [%d/%d %d/%d %d/%d %d/%d]",
@@ -654,7 +664,7 @@
{
#define RATE(_ix) (ni->ni_rates.rs_rates[(_ix)] & IEEE80211_RATE_VAL)
struct ath_node *an = ATH_NODE(ni);
- const struct ieee80211_txparam *tp = an->an_tp;
+ const struct ieee80211_txparam *tp = ni->ni_txparms;
struct sample_node *sn = ATH_NODE_SAMPLE(an);
const HAL_RATE_TABLE *rt = sc->sc_currates;
int x, y, srate;
@@ -759,34 +769,6 @@
}
static void
-rate_cb(void *arg, struct ieee80211_node *ni)
-{
- struct ath_softc *sc = arg;
-
- ath_rate_newassoc(sc, ATH_NODE(ni), 1);
-}
-
-/*
- * Reset the rate control state for each 802.11 state transition.
- */
-void
-ath_rate_newstate(struct ieee80211vap *vap, enum ieee80211_state state)
-{
- struct ieee80211com *ic = vap->iv_ic;
- struct ath_softc *sc = ic->ic_ifp->if_softc;
-
- if (state == IEEE80211_S_RUN) {
- if (vap->iv_opmode != IEEE80211_M_STA) {
- /*
- * Sync rates for associated stations and neighbors.
- */
- ieee80211_iterate_nodes(&ic->ic_sta, rate_cb, sc);
- }
- ath_rate_newassoc(sc, ATH_NODE(vap->iv_bss), 1);
- }
-}
-
-static void
ath_rate_sysctlattach(struct ath_softc *sc, struct sample_softc *osc)
{
struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(sc->sc_dev);
==== //depot/projects/mpsafetty/sys/dev/ath/if_ath.c#5 (text+ko) ====
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ath/if_ath.c,v 1.194 2008/10/19 21:34:49 sam Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ath/if_ath.c,v 1.214 2008/10/27 18:30:33 sam Exp $");
/*
* Driver for the Atheros Wireless LAN controller.
@@ -114,11 +114,7 @@
((((u_int8_t *)(p))[0] ) | (((u_int8_t *)(p))[1] << 8) | \
(((u_int8_t *)(p))[2] << 16) | (((u_int8_t *)(p))[3] << 24)))
-enum {
- ATH_LED_TX,
- ATH_LED_RX,
- ATH_LED_POLL,
-};
+#define CTRY_XR9 5001 /* Ubiquiti XR9 */
static struct ieee80211vap *ath_vap_create(struct ieee80211com *,
const char name[IFNAMSIZ], int unit, int opmode,
@@ -238,10 +234,6 @@
TUNABLE_INT("hw.ath.txbuf", &ath_txbuf);
#ifdef ATH_DEBUG
-static int ath_debug = 0;
-SYSCTL_INT(_hw_ath, OID_AUTO, debug, CTLFLAG_RW, &ath_debug,
- 0, "control debugging printfs");
-TUNABLE_INT("hw.ath.debug", &ath_debug);
enum {
ATH_DEBUG_XMIT = 0x00000001, /* basic xmit operation */
ATH_DEBUG_XMIT_DESC = 0x00000002, /* xmit descriptors */
@@ -263,9 +255,15 @@
ATH_DEBUG_LED = 0x00100000, /* led management */
ATH_DEBUG_FF = 0x00200000, /* fast frames */
ATH_DEBUG_DFS = 0x00400000, /* DFS processing */
+ ATH_DEBUG_REGDOMAIN = 0x02000000, /* regulatory processing */
ATH_DEBUG_FATAL = 0x80000000, /* fatal errors */
ATH_DEBUG_ANY = 0xffffffff
};
+static int ath_debug = 0;
+SYSCTL_INT(_hw_ath, OID_AUTO, debug, CTLFLAG_RW, &ath_debug,
+ 0, "control debugging printfs");
+TUNABLE_INT("hw.ath.debug", &ath_debug);
+
#define IFF_DUMPPKTS(sc, m) \
((sc->sc_debug & (m)) || \
(sc->sc_ifp->if_flags & (IFF_DEBUG|IFF_LINK2)) == (IFF_DEBUG|IFF_LINK2))
@@ -300,6 +298,7 @@
struct ath_hal *ah = NULL;
HAL_STATUS status;
int error = 0, i;
+ u_int wmodes;
DPRINTF(sc, ATH_DEBUG_ANY, "%s: devid 0x%x\n", __func__, devid);
@@ -331,6 +330,9 @@
}
sc->sc_ah = ah;
sc->sc_invalid = 0; /* ready to go, enable interrupt handling */
+#ifdef ATH_DEBUG
+ sc->sc_debug = ath_debug;
+#endif
/*
* Check if the MAC has multi-rate retry support.
@@ -604,7 +606,8 @@
sc->sc_hastsfadd = ath_hal_hastsfadjust(ah);
if (ath_hal_hasfastframes(ah))
ic->ic_caps |= IEEE80211_C_FF;
- if (ath_hal_getwirelessmodes(ah, ic->ic_regdomain.country) & (HAL_MODE_108G|HAL_MODE_TURBO))
+ wmodes = ath_hal_getwirelessmodes(ah, ic->ic_regdomain.country);
+ if (wmodes & (HAL_MODE_108G|HAL_MODE_TURBO))
ic->ic_caps |= IEEE80211_C_TURBOP;
/*
@@ -1312,7 +1315,8 @@
* the frequency possibly mapped for GSM channels.
*/
static void
-ath_mapchan(HAL_CHANNEL *hc, const struct ieee80211_channel *chan)
+ath_mapchan(const struct ieee80211com *ic,
+ HAL_CHANNEL *hc, const struct ieee80211_channel *chan)
{
#define N(a) (sizeof(a) / sizeof(a[0]))
static const u_int modeflags[IEEE80211_MODE_MAX] = {
@@ -1343,8 +1347,13 @@
if (IEEE80211_IS_CHAN_HT40U(chan))
hc->channelFlags |= CHANNEL_HT40PLUS;
- hc->channel = IEEE80211_IS_CHAN_GSM(chan) ?
- 2422 + (922 - chan->ic_freq) : chan->ic_freq;
+ if (IEEE80211_IS_CHAN_GSM(chan)) {
+ if (ic->ic_regdomain.country == CTRY_XR9)
+ hc->channel = 2427 + (chan->ic_freq - 907);
+ else
+ hc->channel = 2422 + (922 - chan->ic_freq);
+ } else
+ hc->channel = chan->ic_freq;
#undef N
}
@@ -1397,7 +1406,7 @@
* be followed by initialization of the appropriate bits
* and then setup of the interrupt mask.
*/
- ath_mapchan(&sc->sc_curchan, ic->ic_curchan);
+ ath_mapchan(ic, &sc->sc_curchan, ic->ic_curchan);
ath_settkipmic(sc);
if (!ath_hal_reset(ah, sc->sc_opmode, &sc->sc_curchan, AH_FALSE, &status)) {
if_printf(ifp, "unable to reset hardware; hal status %u\n",
@@ -1534,7 +1543,7 @@
* Convert to a HAL channel description with the flags
* constrained to reflect the current operating mode.
*/
- ath_mapchan(&sc->sc_curchan, ic->ic_curchan);
+ ath_mapchan(ic, &sc->sc_curchan, ic->ic_curchan);
ath_hal_intrset(ah, 0); /* disable interrupts */
ath_draintxq(sc); /* stop xmit side */
@@ -1566,7 +1575,23 @@
static int
ath_reset_vap(struct ieee80211vap *vap, u_long cmd)
{
- return ath_reset(vap->iv_ic->ic_ifp);
+ struct ieee80211com *ic = vap->iv_ic;
+ struct ifnet *ifp = ic->ic_ifp;
+ struct ath_softc *sc = ifp->if_softc;
+ struct ath_hal *ah = sc->sc_ah;
+
+ switch (cmd) {
+ case IEEE80211_IOC_TXPOWER:
+ /*
+ * If per-packet TPC is enabled, then we have nothing
+ * to do; otherwise we need to force the global limit.
+ * All this can happen directly; no need to reset.
+ */
+ if (!ath_hal_gettpc(ah))
+ ath_hal_settxpowlimit(ah, ic->ic_txpowlimit);
+ return 0;
+ }
+ return ath_reset(ifp);
}
static int
@@ -2527,10 +2552,10 @@
*
* o always accept unicast, broadcast, and multicast traffic
* o accept PHY error frames when hardware doesn't have MIB support
- * to count and we need them for ANI (sta mode only at the moment)
+ * to count and we need them for ANI (sta mode only until recently)
* and we are not scanning (ANI is disabled)
- * NB: only with recent hal's; older hal's add rx filter bits out
- * of sight and we need to blindly preserve them
+ * NB: older hal's add rx filter bits out of sight and we need to
+ * blindly preserve them
* o probe request frames are accepted only when operating in
* hostap, adhoc, or monitor modes
* o enable promiscuous mode
@@ -2557,22 +2582,24 @@
struct ieee80211com *ic = ifp->if_l2com;
u_int32_t rfilt;
+ rfilt = HAL_RX_FILTER_UCAST | HAL_RX_FILTER_BCAST | HAL_RX_FILTER_MCAST;
#if HAL_ABI_VERSION < 0x08011600
- rfilt = (ath_hal_getrxfilter(sc->sc_ah) &
- (HAL_RX_FILTER_PHYRADAR | HAL_RX_FILTER_PHYERR))
- | HAL_RX_FILTER_UCAST | HAL_RX_FILTER_BCAST | HAL_RX_FILTER_MCAST;
-#else
- rfilt = HAL_RX_FILTER_UCAST | HAL_RX_FILTER_BCAST | HAL_RX_FILTER_MCAST;
+ rfilt |= (ath_hal_getrxfilter(sc->sc_ah) &
+ (HAL_RX_FILTER_PHYRADAR | HAL_RX_FILTER_PHYERR));
+#elif HAL_ABI_VERSION < 0x08060100
if (ic->ic_opmode == IEEE80211_M_STA &&
!sc->sc_needmib && !sc->sc_scanning)
rfilt |= HAL_RX_FILTER_PHYERR;
+#else
+ if (!sc->sc_needmib && !sc->sc_scanning)
+ rfilt |= HAL_RX_FILTER_PHYERR;
#endif
if (ic->ic_opmode != IEEE80211_M_STA)
rfilt |= HAL_RX_FILTER_PROBEREQ;
if (ic->ic_opmode == IEEE80211_M_MONITOR || (ifp->if_flags & IFF_PROMISC))
rfilt |= HAL_RX_FILTER_PROM;
if (ic->ic_opmode == IEEE80211_M_STA ||
- sc->sc_opmode == HAL_M_IBSS ||
+ ic->ic_opmode == IEEE80211_M_IBSS ||
sc->sc_swbmiss || sc->sc_scanning)
rfilt |= HAL_RX_FILTER_BEACON;
/*
@@ -3702,7 +3729,7 @@
*rssi = ic->ic_node_getrssi(ni);
if (ni->ni_chan != IEEE80211_CHAN_ANYC) {
- ath_mapchan(&hchan, ni->ni_chan);
+ ath_mapchan(ic, &hchan, ni->ni_chan);
*noise = ath_hal_getchannoise(ah, &hchan);
} else
*noise = -95; /* nominally correct */
@@ -3869,12 +3896,13 @@
ath_rx_tap(struct ifnet *ifp, struct mbuf *m,
const struct ath_rx_status *rs, u_int64_t tsf, int16_t nf)
{
-#define CHAN_HT htole32(CHANNEL_HT20|CHANNEL_HT40PLUS|CHANNEL_HT40MINUS)
#define CHAN_HT20 htole32(IEEE80211_CHAN_HT20)
#define CHAN_HT40U htole32(IEEE80211_CHAN_HT40U)
#define CHAN_HT40D htole32(IEEE80211_CHAN_HT40D)
+#define CHAN_HT (CHAN_HT20|CHAN_HT40U|CHAN_HT40D)
struct ath_softc *sc = ifp->if_softc;
- u_int8_t rix;
+ const HAL_RATE_TABLE *rt;
+ uint8_t rix;
/*
* Discard anything shorter than an ack or cts.
@@ -3885,12 +3913,14 @@
sc->sc_stats.ast_rx_tooshort++;
return 0;
}
- rix = rs->rs_rate;
+ rt = sc->sc_currates;
+ KASSERT(rt != NULL, ("no rate table, mode %u", sc->sc_curmode));
+ rix = rt->rateCodeToIndex[rs->rs_rate];
sc->sc_rx_th.wr_rate = sc->sc_hwmap[rix].ieeerate;
sc->sc_rx_th.wr_flags = sc->sc_hwmap[rix].rxflags;
-#if HAL_ABI_VERSION >= 0x07050400
+#ifdef AH_SUPPORT_AR5416
sc->sc_rx_th.wr_chan_flags &= ~CHAN_HT;
- if (sc->sc_rx_th.wr_rate & 0x80) { /* HT rate */
+ if (sc->sc_rx_th.wr_rate & IEEE80211_RATE_MCS) { /* HT rate */
if ((rs->rs_flags & HAL_RX_2040) == 0)
sc->sc_rx_th.wr_chan_flags |= CHAN_HT20;
else if (sc->sc_curchan.channelFlags & CHANNEL_HT40PLUS)
@@ -3912,10 +3942,10 @@
bpf_mtap2(ifp->if_bpf, &sc->sc_rx_th, sc->sc_rx_th_len, m);
return 1;
+#undef CHAN_HT
#undef CHAN_HT20
#undef CHAN_HT40U
#undef CHAN_HT40D
-#undef CHAN_HT
}
static void
@@ -3957,6 +3987,7 @@
DPRINTF(sc, ATH_DEBUG_RX_PROC, "%s: pending %u\n", __func__, npending);
ngood = 0;
nf = ath_hal_getchannoise(ah, &sc->sc_curchan);
+ sc->sc_stats.ast_rx_noise = nf;
tsf = ath_hal_gettsf64(ah);
do {
bf = STAILQ_FIRST(&sc->sc_rxbuf);
@@ -4145,9 +4176,11 @@
}
if (IFF_DUMPPKTS(sc, ATH_DEBUG_RECV)) {
+ const HAL_RATE_TABLE *rt = sc->sc_currates;
+ uint8_t rix = rt->rateCodeToIndex[rs->rs_rate];
+
ieee80211_dump_pkt(ic, mtod(m, caddr_t), len,
- sc->sc_hwmap[rs->rs_rate].ieeerate,
- rs->rs_rssi);
+ sc->sc_hwmap[rix].ieeerate, rs->rs_rssi);
}
m_adj(m, -IEEE80211_CRC_LEN);
@@ -4205,10 +4238,11 @@
* periodic beacon frames to trigger the poll event.
*/
if (type == IEEE80211_FC0_TYPE_DATA) {
- sc->sc_rxrate = rs->rs_rate;
- ath_led_event(sc, ATH_LED_RX);
+ const HAL_RATE_TABLE *rt = sc->sc_currates;
+ ath_led_event(sc,
+ rt->rateCodeToIndex[rs->rs_rate]);
} else if (ticks - sc->sc_ledevent >= sc->sc_ledidle)
- ath_led_event(sc, ATH_LED_POLL);
+ ath_led_event(sc, 0);
}
rx_next:
STAILQ_INSERT_TAIL(&sc->sc_rxbuf, bf, bf_list);
@@ -4729,7 +4763,7 @@
} else {
ath_rate_findrate(sc, an, shortPreamble, pktlen,
&rix, &try0, &txrate);
- sc->sc_txrate = txrate; /* for LED blinking */
+ sc->sc_txrix = rix; /* for LED blinking */
sc->sc_lastdatarix = rix; /* for fast frames */
if (try0 != ATH_TXMAXTRY)
ismrr = 1;
@@ -4886,18 +4920,18 @@
if (IFF_DUMPPKTS(sc, ATH_DEBUG_XMIT))
ieee80211_dump_pkt(ic, mtod(m0, caddr_t), m0->m_len,
- sc->sc_hwmap[txrate].ieeerate, -1);
+ sc->sc_hwmap[rix].ieeerate, -1);
if (bpf_peers_present(ifp->if_bpf)) {
u_int64_t tsf = ath_hal_gettsf64(ah);
sc->sc_tx_th.wt_tsf = htole64(tsf);
- sc->sc_tx_th.wt_flags = sc->sc_hwmap[txrate].txflags;
+ sc->sc_tx_th.wt_flags = sc->sc_hwmap[rix].txflags;
if (iswep)
sc->sc_tx_th.wt_flags |= IEEE80211_RADIOTAP_F_WEP;
if (isfrag)
sc->sc_tx_th.wt_flags |= IEEE80211_RADIOTAP_F_FRAG;
- sc->sc_tx_th.wt_rate = sc->sc_hwmap[txrate].ieeerate;
+ sc->sc_tx_th.wt_rate = sc->sc_hwmap[rix].ieeerate;
sc->sc_tx_th.wt_txpower = ni->ni_txpower;
sc->sc_tx_th.wt_antenna = sc->sc_txantenna;
@@ -4942,7 +4976,7 @@
, ctsrate /* rts/cts rate */
, ctsduration /* rts/cts duration */
);
- bf->bf_flags = flags;
+ bf->bf_txflags = flags;
/*
* Setup the multi-rate retry state only when we're
* going to use it. This assumes ath_hal_setuptxdesc
@@ -5013,13 +5047,11 @@
sc->sc_ant_tx[txant]++;
if (ts->ts_rate & HAL_TXSTAT_ALTRATE)
sc->sc_stats.ast_tx_altrate++;
- sc->sc_stats.ast_tx_rssi = ts->ts_rssi;
- ATH_RSSI_LPF(sc->sc_halstats.ns_avgtxrssi,
- ts->ts_rssi);
pri = M_WME_GETAC(bf->bf_m);
if (pri >= WME_AC_VO)
ic->ic_wme.wme_hipri_traffic++;
- ni->ni_inact = ni->ni_inact_reload;
+ if ((bf->bf_txflags & HAL_TXDESC_NOACK) == 0)
+ ni->ni_inact = ni->ni_inact_reload;
} else {
if (ts->ts_status & HAL_TXERR_XRETRY)
sc->sc_stats.ast_tx_xretries++;
@@ -5038,13 +5070,18 @@
* Hand the descriptor to the rate control algorithm.
*/
if ((ts->ts_status & HAL_TXERR_FILT) == 0 &&
- (bf->bf_flags & HAL_TXDESC_NOACK) == 0) {
+ (bf->bf_txflags & HAL_TXDESC_NOACK) == 0) {
/*
- * If frame was ack'd update the last rx time
- * used to workaround phantom bmiss interrupts.
+ * If frame was ack'd update statistics,
+ * including the last rx time used to
+ * workaround phantom bmiss interrupts.
*/
- if (ts->ts_status == 0)
+ if (ts->ts_status == 0) {
nacked++;
+ sc->sc_stats.ast_tx_rssi = ts->ts_rssi;
+ ATH_RSSI_LPF(sc->sc_halstats.ns_avgtxrssi,
+ ts->ts_rssi);
+ }
ath_rate_tx_complete(sc, an, bf);
}
/*
@@ -5053,7 +5090,8 @@
*/
if (bf->bf_m->m_flags & M_TXCB)
ieee80211_process_callback(ni, bf->bf_m,
- ts->ts_status);
+ (bf->bf_txflags & HAL_TXDESC_NOACK) == 0 ?
+ ts->ts_status : HAL_TXERR_XRETRY);
/*
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list