svn commit: r201882 - head/sys/dev/iwn
Giorgos Keramidas
keramida at FreeBSD.org
Sat Jan 9 04:00:22 UTC 2010
Author: keramida (doc committer)
Date: Sat Jan 9 04:00:22 2010
New Revision: 201882
URL: http://svn.freebsd.org/changeset/base/201882
Log:
Revert iwn channel-argument handling of set_txpower() to r201822
Pass the channel argument as a real argument and not through
RXON. The RXON version seems to have problem with both the older
228.57.2.23 firmware and the latest 228.61.2.24 version resulting
in device initialization errors like:
wpa_supplicant[2928]: Failed to initiate AP scan.
kernel: firmware error log:
kernel: error type = "SYSASSERT" (0x00000005)
kernel: program counter = 0x0000147C
kernel: source line = 0x0000058B
kernel: error data = 0x0000058B00000000
kernel: branch link = 0x0000145A00001492
kernel: interrupt link = 0x000006DE00000000
kernel: time = 7310
...
kernel: iwn0: iwn_config: could not set TX power
kernel: iwn0: iwn_init_locked: could not configure device, error 35
By passing the current channel to hal->set_txpower() the firmware
error is fixed, at least for the 4965 chipset of my Thinkpad and
the ones tested by Bernhard.
Submitted by: Bernhard Schmidt <bschmidt at techwires.net>
Approved by: rpaulo
Modified:
head/sys/dev/iwn/if_iwn.c
head/sys/dev/iwn/if_iwnvar.h
Modified: head/sys/dev/iwn/if_iwn.c
==============================================================================
--- head/sys/dev/iwn/if_iwn.c Sat Jan 9 03:08:22 2010 (r201881)
+++ head/sys/dev/iwn/if_iwn.c Sat Jan 9 04:00:22 2010 (r201882)
@@ -171,8 +171,10 @@ void iwn_set_led(struct iwn_softc *, ui
int iwn_set_critical_temp(struct iwn_softc *);
int iwn_set_timing(struct iwn_softc *, struct ieee80211_node *);
void iwn4965_power_calibration(struct iwn_softc *, int);
-int iwn4965_set_txpower(struct iwn_softc *, int);
-int iwn5000_set_txpower(struct iwn_softc *, int);
+int iwn4965_set_txpower(struct iwn_softc *,
+ struct ieee80211_channel *, int);
+int iwn5000_set_txpower(struct iwn_softc *,
+ struct ieee80211_channel *, int);
int iwn4965_get_rssi(struct iwn_softc *, struct iwn_rx_stat *);
int iwn5000_get_rssi(struct iwn_softc *, struct iwn_rx_stat *);
int iwn_get_noise(const struct iwn_rx_general_stats *);
@@ -3694,13 +3696,16 @@ iwn_set_timing(struct iwn_softc *sc, str
void
iwn4965_power_calibration(struct iwn_softc *sc, int temp)
{
+ struct ifnet *ifp = sc->sc_ifp;
+ struct ieee80211com *ic = ifp->if_l2com;
+
/* Adjust TX power if need be (delta >= 3 degC.) */
DPRINTF(sc, IWN_DEBUG_CALIBRATE, "%s: temperature %d->%d\n",
__func__, sc->temp, temp);
if (abs(temp - sc->temp) >= 3) {
/* Record temperature of last calibration. */
sc->temp = temp;
- (void)iwn4965_set_txpower(sc, 1);
+ (void)iwn4965_set_txpower(sc, ic->ic_bsschan, 1);
}
}
@@ -3710,7 +3715,8 @@ iwn4965_power_calibration(struct iwn_sof
* the current temperature and the current voltage.
*/
int
-iwn4965_set_txpower(struct iwn_softc *sc, int async)
+iwn4965_set_txpower(struct iwn_softc *sc, struct ieee80211_channel *ch,
+ int async)
{
/* Fixed-point arithmetic division using a n-bit fractional part. */
#define fdivround(a, b, n) \
@@ -3723,7 +3729,6 @@ iwn4965_set_txpower(struct iwn_softc *sc
struct ifnet *ifp = sc->sc_ifp;
struct ieee80211com *ic = ifp->if_l2com;
struct iwn_ucode_info *uc = &sc->ucode_info;
- struct ieee80211_channel *ch;
struct iwn4965_cmd_txpower cmd;
struct iwn4965_eeprom_chan_samples *chans;
int32_t vdiff, tdiff;
@@ -3731,11 +3736,10 @@ iwn4965_set_txpower(struct iwn_softc *sc
const uint8_t *rf_gain, *dsp_gain;
uint8_t chan;
- /* Retrieve current channel from last RXON. */
- chan = sc->rxon.chan;
+ /* Retrieve channel number. */
+ chan = ieee80211_chan2ieee(ic, ch);
DPRINTF(sc, IWN_DEBUG_RESET, "setting TX power for channel %d\n",
chan);
- ch = &ic->ic_channels[chan];
memset(&cmd, 0, sizeof cmd);
cmd.band = IEEE80211_IS_CHAN_5GHZ(ch) ? 0 : 1;
@@ -3863,7 +3867,8 @@ iwn4965_set_txpower(struct iwn_softc *sc
}
int
-iwn5000_set_txpower(struct iwn_softc *sc, int async)
+iwn5000_set_txpower(struct iwn_softc *sc, struct ieee80211_channel *ch,
+ int async)
{
struct iwn5000_cmd_txpower cmd;
@@ -4519,7 +4524,7 @@ iwn_config(struct iwn_softc *sc)
}
/* Configuration has changed, set TX power accordingly. */
- error = hal->set_txpower(sc, 0);
+ error = hal->set_txpower(sc, ic->ic_curchan, 0);
if (error != 0) {
device_printf(sc->sc_dev,
"%s: could not set TX power\n", __func__);
@@ -4765,7 +4770,7 @@ iwn_auth(struct iwn_softc *sc, struct ie
}
/* Configuration has changed, set TX power accordingly. */
- error = hal->set_txpower(sc, 1);
+ error = hal->set_txpower(sc, ni->ni_chan, 1);
if (error != 0) {
device_printf(sc->sc_dev,
"%s: could not set Tx power, error %d\n", __func__, error);
@@ -4882,7 +4887,7 @@ iwn_run(struct iwn_softc *sc, struct iee
/* Configuration has changed, set TX power accordingly. */
- error = hal->set_txpower(sc, 1);
+ error = hal->set_txpower(sc, ni->ni_chan, 1);
if (error != 0) {
device_printf(sc->sc_dev,
"%s: could not set Tx power, error %d\n", __func__, error);
Modified: head/sys/dev/iwn/if_iwnvar.h
==============================================================================
--- head/sys/dev/iwn/if_iwnvar.h Sat Jan 9 03:08:22 2010 (r201881)
+++ head/sys/dev/iwn/if_iwnvar.h Sat Jan 9 04:00:22 2010 (r201882)
@@ -166,7 +166,8 @@ struct iwn_hal {
uint16_t);
int (*get_temperature)(struct iwn_softc *);
int (*get_rssi)(struct iwn_softc *, struct iwn_rx_stat *);
- int (*set_txpower)(struct iwn_softc *, int);
+ int (*set_txpower)(struct iwn_softc *,
+ struct ieee80211_channel *, int);
int (*init_gains)(struct iwn_softc *);
int (*set_gains)(struct iwn_softc *);
int (*add_node)(struct iwn_softc *, struct iwn_node_info *,
More information about the svn-src-head
mailing list