Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-2-0]: src/sys/dev/ic Pull up revision 1.161 (requested by dyoung ...
details: https://anonhg.NetBSD.org/src/rev/b7506b57ba31
branches: netbsd-2-0
changeset: 561296:b7506b57ba31
user: jdc <jdc%NetBSD.org@localhost>
date: Mon Jun 07 06:37:28 2004 +0000
description:
Pull up revision 1.161 (requested by dyoung in ticket #449).
Finally, refactor wi_media_change and ieee80211_media_change.
ieee80211_media_change handles a lot more conditions than
wi_media_change did.
This helps with the second bug mentioned in kern/25604, which causes
"SIOCSIFMEDIA: Invalid argument."
diffstat:
sys/dev/ic/wi.c | 47 ++++-------------------------------------------
1 files changed, 4 insertions(+), 43 deletions(-)
diffs (74 lines):
diff -r f0ec2f00a63c -r b7506b57ba31 sys/dev/ic/wi.c
--- a/sys/dev/ic/wi.c Mon Jun 07 06:36:41 2004 +0000
+++ b/sys/dev/ic/wi.c Mon Jun 07 06:37:28 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wi.c,v 1.159 2004/03/26 06:43:25 dyoung Exp $ */
+/* $NetBSD: wi.c,v 1.159.2.1 2004/06/07 06:37:28 jdc Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -70,7 +70,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wi.c,v 1.159 2004/03/26 06:43:25 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wi.c,v 1.159.2.1 2004/06/07 06:37:28 jdc Exp $");
#define WI_HERMES_AUTOINC_WAR /* Work around data write autoinc bug. */
#define WI_HERMES_STATS_WAR /* Work around stats counter bug. */
@@ -1255,53 +1255,14 @@
return error;
}
-/* TBD factor with ieee80211_media_change */
static int
wi_media_change(struct ifnet *ifp)
{
struct wi_softc *sc = ifp->if_softc;
struct ieee80211com *ic = &sc->sc_ic;
- struct ifmedia_entry *ime;
- enum ieee80211_opmode newmode;
- int i, rate, error = 0;
+ int error;
- ime = ic->ic_media.ifm_cur;
- if (IFM_SUBTYPE(ime->ifm_media) == IFM_AUTO) {
- i = -1;
- } else {
- struct ieee80211_rateset *rs =
- &ic->ic_sup_rates[ieee80211_chan2mode(ic,
- ic->ic_bss->ni_chan)];
- rate = ieee80211_media2rate(ime->ifm_media);
- if (rate == 0)
- return EINVAL;
- for (i = 0; i < rs->rs_nrates; i++) {
- if ((rs->rs_rates[i] & IEEE80211_RATE_VAL) == rate)
- break;
- }
- if (i == rs->rs_nrates)
- return EINVAL;
- }
- if (ic->ic_fixed_rate != i) {
- ic->ic_fixed_rate = i;
- error = ENETRESET;
- }
-
- if ((ime->ifm_media & IFM_IEEE80211_ADHOC) &&
- (ime->ifm_media & IFM_FLAG0))
- newmode = IEEE80211_M_AHDEMO;
- else if (ime->ifm_media & IFM_IEEE80211_ADHOC)
- newmode = IEEE80211_M_IBSS;
- else if (ime->ifm_media & IFM_IEEE80211_HOSTAP)
- newmode = IEEE80211_M_HOSTAP;
- else if (ime->ifm_media & IFM_IEEE80211_MONITOR)
- newmode = IEEE80211_M_MONITOR;
- else
- newmode = IEEE80211_M_STA;
- if (ic->ic_opmode != newmode) {
- ic->ic_opmode = newmode;
- error = ENETRESET;
- }
+ error = ieee80211_media_change(ifp);
if (error == ENETRESET) {
if (sc->sc_enabled)
error = wi_init(ifp);
Home |
Main Index |
Thread Index |
Old Index