[Midnightbsd-cvs] src: dev/if_ndis: Remove the legacy freebsd version support.
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sun Jan 18 14:27:18 EST 2009
Log Message:
-----------
Remove the legacy freebsd version support. Fix the mode setting for 48.
Modified Files:
--------------
src/sys/dev/if_ndis:
if_ndis.c (r1.1.1.2 -> r1.2)
if_ndis_pci.c (r1.1.1.1 -> r1.2)
if_ndisvar.h (r1.1.1.2 -> r1.2)
-------------- next part --------------
Index: if_ndis_pci.c
===================================================================
RCS file: /home/cvs/src/sys/dev/if_ndis/if_ndis_pci.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/dev/if_ndis/if_ndis_pci.c -L sys/dev/if_ndis/if_ndis_pci.c -u -r1.1.1.1 -r1.2
--- sys/dev/if_ndis/if_ndis_pci.c
+++ sys/dev/if_ndis/if_ndis_pci.c
@@ -187,11 +187,7 @@
rl = BUS_GET_RESOURCE_LIST(device_get_parent(dev), dev);
if (rl != NULL) {
-#if __FreeBSD_version < 600022
- SLIST_FOREACH(rle, rl, link) {
-#else
STAILQ_FOREACH(rle, rl, link) {
-#endif
switch (rle->type) {
case SYS_RES_IOPORT:
sc->ndis_io_rid = rle->rid;
Index: if_ndisvar.h
===================================================================
RCS file: /home/cvs/src/sys/dev/if_ndis/if_ndisvar.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/dev/if_ndis/if_ndisvar.h -L sys/dev/if_ndis/if_ndisvar.h -u -r1.1.1.2 -r1.2
--- sys/dev/if_ndis/if_ndisvar.h
+++ sys/dev/if_ndis/if_ndisvar.h
@@ -32,7 +32,7 @@
* $FreeBSD: src/sys/dev/if_ndis/if_ndisvar.h,v 1.27 2007/07/12 02:54:05 thompsa Exp $
*/
-#define NDIS_DEFAULT_NODENAME "FreeBSD NDIS node"
+#define NDIS_DEFAULT_NODENAME "MidnightBSD NDIS node"
#define NDIS_NODENAME_LEN 32
/* For setting/getting OIDs from userspace. */
@@ -89,10 +89,6 @@
#define NDIS_INC(x) \
(x)->ndis_txidx = ((x)->ndis_txidx + 1) % NDIS_TXPKTS
-#if __FreeBSD_version < 600007
-#define arpcom ic.ic_ac
-#endif
-
#define NDIS_EVENTS 4
#define NDIS_EVTINC(x) (x) = ((x) + 1) % NDIS_EVENTS
@@ -150,10 +146,6 @@
int ndis_if_flags;
int ndis_skip;
-#if __FreeBSD_version < 502113
- struct sysctl_ctx_list ndis_ctx;
- struct sysctl_oid *ndis_tree;
-#endif
int ndis_devidx;
interface_type ndis_iftype;
driver_object *ndis_dobj;
@@ -176,9 +168,6 @@
kspin_lock ndis_rxlock;
struct taskqueue *ndis_tq; /* private task queue */
-#if __FreeBSD_version < 700000
- struct proc *ndis_tqproc;
-#endif
struct task ndis_scantask;
int (*ndis_newstate)(struct ieee80211com *,
enum ieee80211_state, int);
Index: if_ndis.c
===================================================================
RCS file: /home/cvs/src/sys/dev/if_ndis/if_ndis.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/dev/if_ndis/if_ndis.c -L sys/dev/if_ndis/if_ndis.c -u -r1.1.1.2 -r1.2
--- sys/dev/if_ndis/if_ndis.c
+++ sys/dev/if_ndis/if_ndis.c
@@ -72,10 +72,6 @@
#include <net80211/ieee80211_ioctl.h>
#include <net80211/ieee80211_regdomain.h>
-#if __FreeBSD_version < 700046
-#include <dev/wi/if_wavelan_ieee.h>
-#endif
-
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
@@ -144,10 +140,6 @@
static void ndis_resettask (device_object *, void *);
static void ndis_inputtask (device_object *, void *);
static int ndis_ioctl (struct ifnet *, u_long, caddr_t);
-#if __FreeBSD_version < 700046
-static int ndis_wi_ioctl_get (struct ifnet *, u_long, caddr_t);
-static int ndis_wi_ioctl_set (struct ifnet *, u_long, caddr_t);
-#endif
static int ndis_80211_ioctl_get (struct ifnet *, u_long, caddr_t);
static int ndis_80211_ioctl_set (struct ifnet *, u_long, caddr_t);
static int ndis_newstate (struct ieee80211com *, enum ieee80211_state,
@@ -534,16 +526,11 @@
int i;
sc = device_get_softc(dev);
-#if __FreeBSD_version < 600031
- sc->ifp = &sc->arpcom.ac_if;
- ifp = sc->ifp;
-#else
ifp = sc->ifp = if_alloc(IFT_ETHER);
if (ifp == NULL) {
error = ENOSPC;
goto fail;
}
-#endif
ifp->if_softc = sc;
KeInitializeSpinLock(&sc->ndis_spinlock);
@@ -559,10 +546,6 @@
}
}
-#if __FreeBSD_version < 502113
- sysctl_ctx_init(&sc->ndis_ctx);
-#endif
-
/* Create sysctl registry nodes */
ndis_create_sysctls(sc);
@@ -699,14 +682,6 @@
/* Check for task offload support. */
ndis_probe_offload(sc);
-#if __FreeBSD_version < 502109
- /*
- * An NDIS device was detected. Inform the world.
- */
- device_printf(dev, "%s address: %6D\n",
- sc->ndis_80211 ? "802.11" : "Ethernet", eaddr, ":");
-#endif
-
if_initname(ifp, device_get_name(dev), device_get_unit(dev));
ifp->if_mtu = ETHERMTU;
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
@@ -715,13 +690,9 @@
ifp->if_watchdog = ndis_watchdog;
ifp->if_init = ndis_init;
ifp->if_baudrate = 10000000;
-#if __FreeBSD_version < 502114
- ifp->if_snd.ifq_maxlen = 50;
-#else
IFQ_SET_MAXLEN(&ifp->if_snd, 50);
ifp->if_snd.ifq_drv_maxlen = 25;
IFQ_SET_READY(&ifp->if_snd);
-#endif
ifp->if_capenable = ifp->if_capabilities;
ifp->if_hwassist = sc->ndis_hwassist;
@@ -733,22 +704,13 @@
uint32_t arg;
int r;
-#if __FreeBSD_version >= 700000
sc->ndis_tq = taskqueue_create("nids_taskq", M_NOWAIT | M_ZERO,
taskqueue_thread_enqueue, &sc->ndis_tq);
taskqueue_start_threads(&sc->ndis_tq, 1, PI_NET, "%s taskq",
device_get_nameunit(dev));
-#else
- sc->ndis_tq = taskqueue_create("ndis_taskq", M_NOWAIT | M_ZERO,
- taskqueue_thread_enqueue, &sc->ndis_tq, &sc->sc_tqproc);
- kthread_create(taskqueue_thread_loop, &sc->ndis_tq, &sc->sc_tqproc,
- 0, 0, "%s taskq", device_get_nameunit(dev));
-#endif
TASK_INIT(&sc->ndis_scantask, 0, ndis_scan, sc);
-#if __FreeBSD_version >= 600007
ic->ic_ifp = ifp;
-#endif
ic->ic_phytype = IEEE80211_T_DS;
ic->ic_opmode = IEEE80211_M_STA;
ic->ic_caps = IEEE80211_C_IBSS;
@@ -867,13 +829,13 @@
IEEE80211_RATE_BASIC|22);
}
if (isset(ic->ic_modecaps, IEEE80211_MODE_11G)) {
- TESTSETRATE(IEEE80211_MODE_11G, 47);
+ TESTSETRATE(IEEE80211_MODE_11G, 48);
TESTSETRATE(IEEE80211_MODE_11G, 72);
TESTSETRATE(IEEE80211_MODE_11G, 96);
TESTSETRATE(IEEE80211_MODE_11G, 108);
}
if (isset(ic->ic_modecaps, IEEE80211_MODE_11A)) {
- TESTSETRATE(IEEE80211_MODE_11A, 47);
+ TESTSETRATE(IEEE80211_MODE_11A, 48);
TESTSETRATE(IEEE80211_MODE_11A, 72);
TESTSETRATE(IEEE80211_MODE_11A, 96);
TESTSETRATE(IEEE80211_MODE_11A, 108);
@@ -933,15 +895,9 @@
if (r == 0)
ic->ic_caps |= IEEE80211_C_PMGT;
bcopy(eaddr, &ic->ic_myaddr, sizeof(eaddr));
-#if __FreeBSD_version < 600007
- ieee80211_ifattach(ifp);
- ieee80211_media_init(ifp, ieee80211_media_change,
- ndis_media_status);
-#else
ieee80211_ifattach(ic);
ieee80211_media_init(ic, ieee80211_media_change,
ndis_media_status);
-#endif
ic->ic_scan_start = ndis_scan_start;
ic->ic_scan_end = ndis_scan_end;
ic->ic_set_channel = ndis_set_channel;
@@ -1004,11 +960,7 @@
NDIS_UNLOCK(sc);
ndis_stop(sc);
if (sc->ndis_80211)
-#if __FreeBSD_version < 600007
- ieee80211_ifdetach(ifp);
-#else
ieee80211_ifdetach(&sc->ic);
-#endif
else
ether_ifdetach(ifp);
} else
@@ -1040,10 +992,8 @@
bus_release_resource(dev, SYS_RES_MEMORY,
sc->ndis_altmem_rid, sc->ndis_res_altmem);
-#if __FreeBSD_version >= 600031
if (ifp != NULL)
if_free(ifp);
-#endif
if (sc->ndis_iftype == PCMCIABus)
ndis_free_amem(sc);
@@ -1076,9 +1026,6 @@
bus_dma_tag_destroy(sc->ndis_parent_tag);
taskqueue_free(sc->ndis_tq);
-#if __FreeBSD_version < 502113
- sysctl_ctx_free(&sc->ndis_ctx);
-#endif
return(0);
}
@@ -1699,13 +1646,8 @@
}
NDIS_LOCK(sc);
#ifdef LINK_STATE_UP
-#if __FreeBSD_version > 600006
if_link_state_change(sc->ifp, LINK_STATE_UP);
#else
- sc->ifp->if_link_state = LINK_STATE_UP;
- rt_ifmsg(sc->ifp);
-#endif
-#else
device_printf(sc->ndis_dev, "link state changed to UP\n");
#endif /* LINK_STATE_UP */
}
@@ -1716,13 +1658,8 @@
if (sc->ndis_80211)
ieee80211_new_state(ic, IEEE80211_S_SCAN, 0);
#ifdef LINK_STATE_DOWN
-#if __FreeBSD_version > 600006
if_link_state_change(sc->ifp, LINK_STATE_DOWN);
#else
- sc->ifp->if_link_state = LINK_STATE_DOWN;
- rt_ifmsg(sc->ifp);
-#endif
-#else
device_printf(sc->ndis_dev, "link state changed to DOWN\n");
#endif /* LINK_STATE_DOWN */
}
@@ -1768,11 +1705,7 @@
ifp = arg;
-#if __FreeBSD_version < 502114
- if (ifp->if_snd.ifq_head != NULL)
-#else
if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
-#endif
ndis_start(ifp);
return;
}
@@ -1812,11 +1745,7 @@
p0 = &sc->ndis_txarray[sc->ndis_txidx];
while(sc->ndis_txpending) {
-#if __FreeBSD_version < 502114
- IF_DEQUEUE(&ifp->if_snd, m);
-#else
IFQ_DRV_DEQUEUE(&ifp->if_snd, m);
-#endif
if (m == NULL)
break;
@@ -1827,13 +1756,8 @@
break;
if (ndis_mtop(m, &sc->ndis_txarray[sc->ndis_txidx])) {
-#if __FreeBSD_version >= 502114
IFQ_DRV_PREPEND(&ifp->if_snd, m);
-#endif
NDIS_UNLOCK(sc);
-#if __FreeBSD_version < 502114
- IF_PREPEND(&ifp->if_snd, m);
-#endif
return;
}
@@ -2002,12 +1926,7 @@
sc->ndis_link = 0;
#ifdef LINK_STATE_UNKNOWN
-#if __FreeBSD_version > 600006
if_link_state_change(sc->ifp, LINK_STATE_UNKNOWN);
-#else
- sc->ifp->if_link_state = LINK_STATE_DOWN;
- rt_ifmsg(sc->ifp);
-#endif
#endif /* LINK_STATE_UNKNOWN */
if (ic->ic_opmode != IEEE80211_M_MONITOR) {
@@ -2334,15 +2253,10 @@
/* Set WEP */
-#if __FreeBSD_version < 600007
- if (ic->ic_flags & IEEE80211_F_WEPON) {
-#else
if (ic->ic_flags & IEEE80211_F_PRIVACY &&
!(ic->ic_flags & IEEE80211_F_WPA)) {
-#endif
int keys_set = 0;
-#if __FreeBSD_version >= 600007
if (ic->ic_bss->ni_authmode == IEEE80211_AUTH_SHARED) {
len = sizeof(arg);
arg = NDIS_80211_AUTHMODE_SHARED;
@@ -2350,14 +2264,11 @@
ndis_set_info(sc, OID_802_11_AUTHENTICATION_MODE,
&arg, &len);
}
-#endif
for (i = 0; i < IEEE80211_WEP_NKID; i++) {
if (ic->ic_nw_keys[i].wk_keylen) {
-#if __FreeBSD_version >= 600007
if (ic->ic_nw_keys[i].wk_cipher->ic_cipher !=
IEEE80211_CIPHER_WEP)
continue;
-#endif
bzero((char *)&wep, sizeof(wep));
wep.nw_keylen = ic->ic_nw_keys[i].wk_keylen;
@@ -2755,7 +2666,6 @@
* reporting isn't supported prior to FreeBSD 6.x.
*/
-#if __FreeBSD_version >= 600007
len = sizeof(arg);
rval = ndis_get_info(sc, OID_802_11_AUTHENTICATION_MODE, &arg, &len);
if (rval)
@@ -2789,7 +2699,6 @@
break;
}
}
-#endif
len = sizeof(arg);
rval = ndis_get_info(sc, OID_802_11_WEP_STATUS, &arg, &len);
@@ -2798,19 +2707,11 @@
device_printf (sc->ndis_dev,
"get wep status failed: %d\n", rval);
-#if __FreeBSD_version < 600007
- if (arg == NDIS_80211_WEPSTAT_ENABLED)
- ic->ic_flags |= IEEE80211_F_WEPON;
- else
- ic->ic_flags &= ~IEEE80211_F_WEPON;
-#else
if (arg == NDIS_80211_WEPSTAT_ENABLED)
ic->ic_flags |= IEEE80211_F_PRIVACY|IEEE80211_F_DROPUNENC;
else
ic->ic_flags &= ~(IEEE80211_F_PRIVACY|IEEE80211_F_DROPUNENC);
-#endif
-
return;
}
@@ -2867,11 +2768,7 @@
case SIOCGIFMEDIA:
case SIOCSIFMEDIA:
if (sc->ndis_80211) {
-#if __FreeBSD_version < 600007
- error = ieee80211_ioctl(ifp, command, data);
-#else
error = ieee80211_ioctl(&sc->ic, command, data);
-#endif
if (error == ENETRESET) {
ndis_setstate_80211(sc);
/*ndis_init(sc);*/
@@ -3003,28 +2900,11 @@
NDIS_EVTINC(sc->ndis_evtcidx);
NDIS_UNLOCK(sc);
break;
-#if __FreeBSD_version < 700046
- case SIOCGIFGENERIC:
- case SIOCSIFGENERIC:
- if (sc->ndis_80211 && NDIS_INITIALIZED(sc)) {
- if (command == SIOCGIFGENERIC)
- error = ndis_wi_ioctl_get(ifp, command, data);
- else
- error = ndis_wi_ioctl_set(ifp, command, data);
- } else
- error = ENOTTY;
- if (error != ENOTTY)
- break;
-#endif
default:
do_80211:
sc->ndis_skip = 1;
if (sc->ndis_80211) {
-#if __FreeBSD_version < 600007
- error = ieee80211_ioctl(ifp, command, data);
-#else
error = ieee80211_ioctl(&sc->ic, command, data);
-#endif
if (error == ENETRESET) {
ndis_setstate_80211(sc);
error = 0;
@@ -3040,126 +2920,6 @@
return(error);
}
-#if __FreeBSD_version < 700046
-static int
-ndis_wi_ioctl_get(ifp, command, data)
- struct ifnet *ifp;
- u_long command;
- caddr_t data;
-{
- struct wi_req wreq;
- struct ifreq *ifr;
- struct ndis_softc *sc;
- ndis_80211_bssid_list_ex *bl;
- ndis_wlan_bssid_ex *wb;
- struct wi_apinfo *api;
- int error, i, j, len, maxaps;
-
- sc = ifp->if_softc;
- ifr = (struct ifreq *)data;
- error = copyin(ifr->ifr_data, &wreq, sizeof(wreq));
- if (error)
- return (error);
-
- switch (wreq.wi_type) {
- case WI_RID_READ_APS:
- len = 0;
- error = ndis_set_info(sc, OID_802_11_BSSID_LIST_SCAN,
- NULL, &len);
- if (error == 0)
- tsleep(&error, PPAUSE|PCATCH, "ssidscan", hz * 2);
- len = 0;
- error = ndis_get_info(sc, OID_802_11_BSSID_LIST, NULL, &len);
- if (error != ENOSPC)
- len = 65536;
- bl = malloc(len, M_DEVBUF, M_NOWAIT|M_ZERO);
- error = ndis_get_info(sc, OID_802_11_BSSID_LIST, bl, &len);
- if (error) {
- free(bl, M_DEVBUF);
- break;
- }
- maxaps = (2 * wreq.wi_len - sizeof(int)) / sizeof(*api);
- maxaps = MIN(maxaps, bl->nblx_items);
- wreq.wi_len = (maxaps * sizeof(*api) + sizeof(int)) / 2;
- *(int *)&wreq.wi_val = maxaps;
- api = (struct wi_apinfo *)&((int *)&wreq.wi_val)[1];
- wb = bl->nblx_bssid;
- while (maxaps--) {
- bzero(api, sizeof(*api));
- bcopy(&wb->nwbx_macaddr, &api->bssid,
- sizeof(api->bssid));
- api->namelen = wb->nwbx_ssid.ns_ssidlen;
- bcopy(&wb->nwbx_ssid.ns_ssid, &api->name, api->namelen);
- if (wb->nwbx_privacy)
- api->capinfo |= IEEE80211_CAPINFO_PRIVACY;
- /* XXX Where can we get noise information? */
- api->signal = wb->nwbx_rssi + 149; /* XXX */
- api->quality = api->signal;
- api->channel =
- ieee80211_mhz2ieee(wb->nwbx_config.nc_dsconfig /
- 1000, 0);
- /* In "auto" infrastructure mode, this is useless. */
- if (wb->nwbx_netinfra == NDIS_80211_NET_INFRA_IBSS)
- api->capinfo |= IEEE80211_CAPINFO_IBSS;
- if (wb->nwbx_len > sizeof(ndis_wlan_bssid)) {
- j = sizeof(ndis_80211_rates_ex);
- /* handle other extended things */
- } else
- j = sizeof(ndis_80211_rates);
- for (i = api->rate = 0; i < j; i++)
- api->rate = MAX(api->rate, 5 *
- (wb->nwbx_supportedrates[i] & 0x7f));
- api++;
- wb = (ndis_wlan_bssid_ex *)((char *)wb + wb->nwbx_len);
- }
- free(bl, M_DEVBUF);
- error = copyout(&wreq, ifr->ifr_data, sizeof(wreq));
- break;
- default:
- error = ENOTTY;
- break;
- }
- return (error);
-}
-
-static int
-ndis_wi_ioctl_set(ifp, command, data)
- struct ifnet *ifp;
- u_long command;
- caddr_t data;
-{
- struct wi_req wreq;
- struct ifreq *ifr;
- struct ndis_softc *sc;
- uint32_t foo;
- int error, len;
-
- error = priv_check(curthread, PRIV_DRIVER);
- if (error)
- return (error);
-
- sc = ifp->if_softc;
- ifr = (struct ifreq *)data;
- error = copyin(ifr->ifr_data, &wreq, sizeof(wreq));
- if (error)
- return (error);
-
- switch (wreq.wi_type) {
- case WI_RID_SCAN_APS:
- case WI_RID_SCAN_REQ: /* arguments ignored */
- len = sizeof(foo);
- foo = 0;
- error = ndis_set_info(sc, OID_802_11_BSSID_LIST_SCAN, &foo,
- &len);
- break;
- default:
- error = ENOTTY;
- break;
- }
- return (error);
-}
-#endif
-
static int
ndis_80211_ioctl_get(struct ifnet *ifp, u_long command, caddr_t data)
{
@@ -3195,11 +2955,7 @@
RtlFreeAnsiString(&as);
break;
default:
-#if __FreeBSD_version < 600007
- error = ieee80211_ioctl(ifp, command, data);
-#else
error = ieee80211_ioctl(&sc->ic, command, data);
-#endif
break;
}
@@ -3362,11 +3118,7 @@
RtlFreeUnicodeString(&us);
break;
default:
-#if __FreeBSD_version < 600007
- error = ieee80211_ioctl(ifp, command, data);
-#else
error = ieee80211_ioctl(&sc->ic, command, data);
-#endif
if (error == ENETRESET) {
ndis_setstate_80211(sc);
error = 0;
More information about the Midnightbsd-cvs
mailing list