PERFORCE change 121288 for review
Andrew Thompson
thompsa at FreeBSD.org
Sat Jun 9 19:49:42 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=121288
Change 121288 by thompsa at thompsa_heff on 2007/06/09 19:48:50
Remove the scan naming for the command queue, its generic now.
Affected files ...
.. //depot/projects/wifi/sys/dev/iwi/if_iwi.c#45 edit
.. //depot/projects/wifi/sys/dev/iwi/if_iwivar.h#19 edit
Differences ...
==== //depot/projects/wifi/sys/dev/iwi/if_iwi.c#45 (text+ko) ====
@@ -174,7 +174,7 @@
static void iwi_assoc(struct ieee80211com *ic);
static void iwi_disassoc(struct ieee80211com *);
static void iwi_ops(void *, int);
-static int iwi_scan_cmd(struct iwi_softc *, int);
+static int iwi_queue_cmd(struct iwi_softc *, int);
static int iwi_auth_and_assoc(struct iwi_softc *);
static int iwi_disassociate(struct iwi_softc *, int quiet);
static void iwi_init(void *);
@@ -261,7 +261,7 @@
sc->sc_dev = dev;
IWI_LOCK_INIT(sc);
- IWI_SCAN_LOCK_INIT(sc);
+ IWI_CMD_LOCK_INIT(sc);
sc->sc_unr = new_unrhdr(1, IWI_MAX_IBSSNODE-1, &sc->sc_mtx);
@@ -488,7 +488,7 @@
delete_unrhdr(sc->sc_unr);
IWI_LOCK_DESTROY(sc);
- IWI_SCAN_LOCK_DESTROY(sc);
+ IWI_CMD_LOCK_DESTROY(sc);
return 0;
}
@@ -1079,7 +1079,7 @@
* will get sent down to the adapter as part of the
* work iwi_auth_and_assoc does.
*/
- return (iwi_scan_cmd(sc, IWI_SET_WME));
+ return (iwi_queue_cmd(sc, IWI_SET_WME));
}
static int
@@ -3510,16 +3510,16 @@
int cmd;
again:
- IWI_SCAN_LOCK(sc);
- cmd = sc->sc_scanop[sc->sc_scan_cur];
+ IWI_CMD_LOCK(sc);
+ cmd = sc->sc_cmd[sc->sc_cmd_cur];
if (cmd == 0) {
/* No more commands to process */
- IWI_SCAN_UNLOCK(sc);
+ IWI_CMD_UNLOCK(sc);
return;
}
- sc->sc_scanop[sc->sc_scan_cur] = 0; /* free the slot */
- sc->sc_scan_cur = (sc->sc_scan_cur + 1) % IWI_SCAN_OPS;
- IWI_SCAN_UNLOCK(sc);
+ sc->sc_cmd[sc->sc_cmd_cur] = 0; /* free the slot */
+ sc->sc_cmd_cur = (sc->sc_cmd_cur + 1) % IWI_CMD_MAXOPS;
+ IWI_CMD_UNLOCK(sc);
IWI_LOCK(sc);
while ((ic->ic_state != IEEE80211_S_INIT) && (sc->flags & IWI_FLAG_BUSY)) {
@@ -3566,19 +3566,19 @@
}
static int
-iwi_scan_cmd(struct iwi_softc *sc, int cmd)
+iwi_queue_cmd(struct iwi_softc *sc, int cmd)
{
- IWI_SCAN_LOCK(sc);
- if (sc->sc_scanop[sc->sc_scan_next] != 0) {
- IWI_SCAN_UNLOCK(sc);
- DPRINTF(("%s: scan command %d dropped\n", __func__, cmd));
+ IWI_CMD_LOCK(sc);
+ if (sc->sc_cmd[sc->sc_cmd_next] != 0) {
+ IWI_CMD_UNLOCK(sc);
+ DPRINTF(("%s: command %d dropped\n", __func__, cmd));
return (EBUSY);
}
- sc->sc_scanop[sc->sc_scan_next] = cmd;
- sc->sc_scan_next = (sc->sc_scan_next + 1) % IWI_SCAN_OPS;
+ sc->sc_cmd[sc->sc_cmd_next] = cmd;
+ sc->sc_cmd_next = (sc->sc_cmd_next + 1) % IWI_CMD_MAXOPS;
taskqueue_enqueue(sc->sc_tq, &sc->sc_opstask);
- IWI_SCAN_UNLOCK(sc);
+ IWI_CMD_UNLOCK(sc);
return (0);
}
@@ -3588,7 +3588,7 @@
struct ifnet *ifp = ic->ic_ifp;
struct iwi_softc *sc = ifp->if_softc;
- iwi_scan_cmd(sc, IWI_SCAN_START);
+ iwi_queue_cmd(sc, IWI_SCAN_START);
}
static void
@@ -3607,7 +3607,7 @@
struct iwi_softc *sc = ifp->if_softc;
sc->sc_maxdwell = maxdwell;
- iwi_scan_cmd(sc, IWI_SCAN_CURCHAN);
+ iwi_queue_cmd(sc, IWI_SCAN_CURCHAN);
}
#if 0
@@ -3618,7 +3618,7 @@
struct iwi_softc *sc = ifp->if_softc;
sc->sc_maxdwell = maxdwell;
- iwi_scan_cmd(sc, IWI_SCAN_ALLCHAN);
+ iwi_queue_cmd(sc, IWI_SCAN_ALLCHAN);
}
#endif
@@ -3634,7 +3634,7 @@
struct ifnet *ifp = ic->ic_ifp;
struct iwi_softc *sc = ifp->if_softc;
- iwi_scan_cmd(sc, IWI_SCAN_END);
+ iwi_queue_cmd(sc, IWI_SCAN_END);
}
static void
@@ -3643,7 +3643,7 @@
struct ifnet *ifp = ic->ic_ifp;
struct iwi_softc *sc = ifp->if_softc;
- iwi_scan_cmd(sc, IWI_ASSOC);
+ iwi_queue_cmd(sc, IWI_ASSOC);
}
static void
@@ -3652,5 +3652,5 @@
struct ifnet *ifp = ic->ic_ifp;
struct iwi_softc *sc = ifp->if_softc;
- iwi_scan_cmd(sc, IWI_DISASSOC);
+ iwi_queue_cmd(sc, IWI_DISASSOC);
}
==== //depot/projects/wifi/sys/dev/iwi/if_iwivar.h#19 (text+ko) ====
@@ -123,8 +123,8 @@
device_t sc_dev;
struct mtx sc_mtx;
- struct mtx sc_scanlock;
- char sc_scanname[12]; /* e.g. "iwi0_scan" */
+ struct mtx sc_cmdlock;
+ char sc_cmdname[12]; /* e.g. "iwi0_cmd" */
uint8_t sc_mcast[IEEE80211_ADDR_LEN];
struct unrhdr *sc_unr;
struct taskqueue *sc_tq; /* private task queue */
@@ -215,10 +215,10 @@
#define IWI_SCAN_CURCHAN (1 << 5)
#define IWI_SCAN_ALLCHAN (1 << 6)
#define IWI_SET_WME (1 << 7)
-#define IWI_SCAN_OPS 5
- int sc_scanop[IWI_SCAN_OPS];
- int sc_scan_cur; /* current queued scan task */
- int sc_scan_next; /* last queued scan task */
+#define IWI_CMD_MAXOPS 10
+ int sc_cmd[IWI_CMD_MAXOPS];
+ int sc_cmd_cur; /* current queued scan task */
+ int sc_cmd_next; /* last queued scan task */
unsigned long sc_maxdwell; /* max dwell time for curchan */
struct bpf_if *sc_drvbpf;
@@ -255,11 +255,11 @@
if (!__waslocked) \
mtx_unlock(&(sc)->sc_mtx); \
} while (0)
-#define IWI_SCAN_LOCK_INIT(sc) do { \
- snprintf((sc)->sc_scanname, sizeof((sc)->sc_scanname), "%s_scan", \
+#define IWI_CMD_LOCK_INIT(sc) do { \
+ snprintf((sc)->sc_cmdname, sizeof((sc)->sc_cmdname), "%s_cmd", \
device_get_nameunit((sc)->sc_dev)); \
- mtx_init(&(sc)->sc_scanlock, (sc)->sc_scanname, NULL, MTX_DEF); \
+ mtx_init(&(sc)->sc_cmdlock, (sc)->sc_cmdname, NULL, MTX_DEF); \
} while (0)
-#define IWI_SCAN_LOCK_DESTROY(sc) mtx_destroy(&(sc)->sc_scanlock)
-#define IWI_SCAN_LOCK(sc) mtx_lock(&(sc)->sc_scanlock)
-#define IWI_SCAN_UNLOCK(sc) mtx_unlock(&(sc)->sc_scanlock)
+#define IWI_CMD_LOCK_DESTROY(sc) mtx_destroy(&(sc)->sc_cmdlock)
+#define IWI_CMD_LOCK(sc) mtx_lock(&(sc)->sc_cmdlock)
+#define IWI_CMD_UNLOCK(sc) mtx_unlock(&(sc)->sc_cmdlock)
More information about the p4-projects
mailing list