PERFORCE change 135292 for review
Sepherosa Ziehau
sephe at FreeBSD.org
Tue Feb 12 22:55:19 PST 2008
http://perforce.freebsd.org/chv.cgi?CH=135292
Change 135292 by sephe at sephe_zealot:sam_wifi on 2008/02/13 06:55:05
- Hook sysctl nodes
- Add sysctl variable to disable software TX power calibration
- Indentation
Obtained from: DragonFly
Affected files ...
.. //depot/projects/wifi/sys/dev/bwi/bwimac.c#4 edit
.. //depot/projects/wifi/sys/dev/bwi/if_bwi.c#11 edit
.. //depot/projects/wifi/sys/dev/bwi/if_bwivar.h#7 edit
Differences ...
==== //depot/projects/wifi/sys/dev/bwi/bwimac.c#4 (text+ko) ====
@@ -1779,6 +1779,9 @@
int error, i, ofdm_tssi;
int txpwr_diff, rf_atten_adj, bbp_atten_adj;
+ if (!sc->sc_txpwr_calib)
+ return;
+
if (mac->mac_flags & BWI_MAC_F_TPCTL_ERROR) {
DPRINTF(sc, BWI_DBG_MAC | BWI_DBG_TXPOWER, "%s\n",
"tpctl error happened, can't set txpower");
==== //depot/projects/wifi/sys/dev/bwi/if_bwi.c#11 (text+ko) ====
@@ -338,6 +338,7 @@
bwi_attach(struct bwi_softc *sc)
{
struct ieee80211com *ic = &sc->sc_ic;
+ device_t dev = sc->sc_dev;
struct ifnet *ifp;
struct bwi_mac *mac;
struct bwi_phy *phy;
@@ -351,6 +352,7 @@
sc->sc_fw_version = BWI_FW_VERSION3;
sc->sc_led_idle = (2350 * hz) / 1000;
sc->sc_led_blink = 1;
+ sc->sc_txpwr_calib = 1;
sc->sc_debug = bwi_debug;
bwi_power_on(sc, 1);
@@ -417,18 +419,42 @@
ifp = sc->sc_ifp = if_alloc(IFT_ETHER);
if (ifp == NULL) {
- device_printf(sc->sc_dev, "can not if_alloc()\n");
+ device_printf(dev, "can not if_alloc()\n");
error = ENOSPC;
goto fail;
}
/* set these up early for if_printf use */
- if_initname(ifp, device_get_name(sc->sc_dev),
- device_get_unit(sc->sc_dev));
+ if_initname(ifp, device_get_name(dev), device_get_unit(dev));
callout_init(&sc->sc_calib_ch, CALLOUT_MPSAFE);
callout_init(&sc->sc_amrr_ch, CALLOUT_MPSAFE);
+ /*
+ * Add sysctl nodes
+ */
+ SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev),
+ SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
+ "fw_version", CTLFLAG_RD, &sc->sc_fw_version, 0,
+ "Firmware version");
+ SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev),
+ SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
+ "led_idle", CTLFLAG_RW, &sc->sc_led_idle, 0,
+ "# ticks before LED enters idle state");
+ SYSCTL_ADD_INT(device_get_sysctl_ctx(dev),
+ SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
+ "led_blink", CTLFLAG_RW, &sc->sc_led_blink, 0,
+ "Allow LED to blink");
+ SYSCTL_ADD_INT(device_get_sysctl_ctx(dev),
+ SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
+ "txpwr_calib", CTLFLAG_RW, &sc->sc_txpwr_calib, 0,
+ "Enable software TX power calibration");
+#ifdef BWI_DEBUG
+ SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev),
+ SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
+ "debug", CTLFLAG_RW, &sc->sc_debug, 0, "Debug flags");
+#endif
+
ifp->if_softc = sc;
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
ifp->if_init = bwi_init;
@@ -462,7 +488,7 @@
if (IEEE80211_IS_MULTICAST(ic->ic_myaddr)) {
bwi_get_eaddr(sc, BWI_SPROM_11A_EADDR, ic->ic_myaddr);
if (IEEE80211_IS_MULTICAST(ic->ic_myaddr)) {
- device_printf(sc->sc_dev,
+ device_printf(dev,
"invalid MAC address: %6D\n",
ic->ic_myaddr, ":");
}
@@ -1548,13 +1574,13 @@
bwi_enable_intrs(sc, BWI_INIT_INTRS);
if (sc->sc_blink_led != NULL && sc->sc_led_blink) {
- int evt = BWI_LED_EVENT_NONE;
+ int evt = BWI_LED_EVENT_NONE;
- if (tx && rx_data > 0) {
- if (sc->sc_rx_rate > sc->sc_tx_rate)
- evt = BWI_LED_EVENT_RX;
- else
- evt = BWI_LED_EVENT_TX;
+ if (tx && rx_data > 0) {
+ if (sc->sc_rx_rate > sc->sc_tx_rate)
+ evt = BWI_LED_EVENT_RX;
+ else
+ evt = BWI_LED_EVENT_TX;
} else if (tx) {
evt = BWI_LED_EVENT_TX;
} else if (rx_data > 0) {
==== //depot/projects/wifi/sys/dev/bwi/if_bwivar.h#7 (text+ko) ====
@@ -630,6 +630,7 @@
int sc_dwell_time; /* milliseconds */
int sc_led_idle;
int sc_led_blink;
+ int sc_txpwr_calib;
uint32_t sc_debug; /* BWI_DBG_ */
};
@@ -654,11 +655,11 @@
#define BWI_LOCK_INIT(sc) \
mtx_init(&(sc)->sc_mtx, device_get_nameunit((sc)->sc_dev), \
- MTX_NETWORK_LOCK, MTX_DEF | MTX_RECURSE);
+ MTX_NETWORK_LOCK, MTX_DEF | MTX_RECURSE)
#define BWI_LOCK_DESTROY(sc) mtx_destroy(&(sc)->sc_mtx)
-#define BWI_LOCK(sc) mtx_lock(&sc->sc_mtx)
-#define BWI_UNLOCK(sc) mtx_unlock(&sc->sc_mtx)
-#define BWI_LOCK_ASSERT(sc) mtx_assert(&sc->sc_mtx, MA_OWNED)
+#define BWI_LOCK(sc) mtx_lock(&(sc)->sc_mtx)
+#define BWI_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx)
+#define BWI_LOCK_ASSERT(sc) mtx_assert(&(sc)->sc_mtx, MA_OWNED)
int bwi_attach(struct bwi_softc *);
int bwi_detach(struct bwi_softc *);
More information about the p4-projects
mailing list