aironetwifi: Synchronize to the last version before it was removed.

This commit is contained in:
Augustin Cavalier
2024-06-25 18:32:53 -04:00
parent df49d6c934
commit 5a39afd352
6 changed files with 31 additions and 34 deletions
@@ -31,7 +31,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE. * THE POSSIBILITY OF SUCH DAMAGE.
* *
* $FreeBSD: releng/12.0/sys/dev/an/if_aironet_ieee.h 325966 2017-11-18 14:26:50Z pfg $ * $FreeBSD$
*/ */
#ifndef _IF_AIRONET_IEEE_H #ifndef _IF_AIRONET_IEEE_H
@@ -152,7 +152,6 @@ struct an_rssi_entry {
u_int8_t an_rss_dbm; u_int8_t an_rss_dbm;
}; };
struct an_ltv_key { struct an_ltv_key {
u_int16_t an_len; u_int16_t an_len;
u_int16_t an_type; u_int16_t an_type;
@@ -642,7 +641,6 @@ struct an_rxframe {
u_int8_t an_gaplen; /* 0x32 */ u_int8_t an_gaplen; /* 0x32 */
} __packed; } __packed;
/* Do not modify this unless you are modifying LEAP itself */ /* Do not modify this unless you are modifying LEAP itself */
#define LEAP_USERNAME_MAX 32 #define LEAP_USERNAME_MAX 32
#define LEAP_PASSWORD_MAX 32 #define LEAP_PASSWORD_MAX 32
@@ -40,7 +40,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__FBSDID("$FreeBSD: releng/12.0/sys/dev/an/if_an.c 331797 2018-03-30 18:50:13Z brooks $"); __FBSDID("$FreeBSD$");
/* /*
* The Aironet 4500/4800 series cards come in PCMCIA, ISA and PCI form. * The Aironet 4500/4800 series cards come in PCMCIA, ISA and PCI form.
@@ -206,7 +206,7 @@ static char an_conf_cache[256];
/* sysctl vars */ /* sysctl vars */
static SYSCTL_NODE(_hw, OID_AUTO, an, CTLFLAG_RD, 0, static SYSCTL_NODE(_hw, OID_AUTO, an, CTLFLAG_RD | CTLFLAG_MPSAFE, 0,
"Wireless driver parameters"); "Wireless driver parameters");
/* XXX violate ethernet/netgraph callback hooks */ /* XXX violate ethernet/netgraph callback hooks */
@@ -266,8 +266,10 @@ sysctl_an_dump(SYSCTL_HANDLER_ARGS)
return error; return error;
} }
SYSCTL_PROC(_hw_an, OID_AUTO, an_dump, CTLTYPE_STRING | CTLFLAG_RW, SYSCTL_PROC(_hw_an, OID_AUTO, an_dump,
0, sizeof(an_conf), sysctl_an_dump, "A", ""); CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_NEEDGIANT, 0, sizeof(an_conf),
sysctl_an_dump, "A",
"");
static int static int
sysctl_an_cache_mode(SYSCTL_HANDLER_ARGS) sysctl_an_cache_mode(SYSCTL_HANDLER_ARGS)
@@ -302,8 +304,10 @@ sysctl_an_cache_mode(SYSCTL_HANDLER_ARGS)
return error; return error;
} }
SYSCTL_PROC(_hw_an, OID_AUTO, an_cache_mode, CTLTYPE_STRING | CTLFLAG_RW, SYSCTL_PROC(_hw_an, OID_AUTO, an_cache_mode,
0, sizeof(an_conf_cache), sysctl_an_cache_mode, "A", ""); CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_NEEDGIANT, 0, sizeof(an_conf_cache),
sysctl_an_cache_mode, "A",
"");
/* /*
* We probe for an Aironet 4500/4800 card by attempting to * We probe for an Aironet 4500/4800 card by attempting to
@@ -1255,7 +1259,6 @@ an_intr(void *xsc)
return; return;
} }
static int static int
an_cmd_struct(struct an_softc *sc, struct an_command *cmd, an_cmd_struct(struct an_softc *sc, struct an_command *cmd,
struct an_reply *reply) struct an_reply *reply)
@@ -1568,7 +1571,6 @@ an_write_record(struct an_softc *sc, struct an_ltv_gen *ltv)
return(EIO); return(EIO);
} }
if (reply.an_status & AN_CMD_QUAL_MASK) { if (reply.an_status & AN_CMD_QUAL_MASK) {
if_printf(sc->an_ifp, if_printf(sc->an_ifp,
"failed to write RID 2 %x %x %x %x %x, %d\n", "failed to write RID 2 %x %x %x %x %x, %d\n",
@@ -1838,7 +1840,6 @@ an_setdef(struct an_softc *sc, struct an_req *areq)
return; return;
} }
/* Reinitialize the card. */ /* Reinitialize the card. */
if (ifp->if_flags) if (ifp->if_flags)
an_init_locked(sc); an_init_locked(sc);
@@ -1875,6 +1876,7 @@ an_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
int len; int len;
int i, max; int i, max;
struct an_softc *sc; struct an_softc *sc;
struct an_req *areq;
struct ifreq *ifr; struct ifreq *ifr;
struct thread *td = curthread; struct thread *td = curthread;
struct ieee80211req *ireq; struct ieee80211req *ireq;
@@ -1934,17 +1936,21 @@ an_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
error = 0; error = 0;
break; break;
case SIOCGAIRONET: case SIOCGAIRONET:
error = copyin(ifr_data_get_ptr(ifr), &sc->areq, error = priv_check(td, PRIV_DRIVER);
sizeof(sc->areq)); if (error)
if (error != 0)
break; break;
areq = malloc(sizeof(*areq), M_TEMP, M_WAITOK);
error = copyin(ifr_data_get_ptr(ifr), areq, sizeof(*areq));
if (error != 0) {
free(areq, M_TEMP);
break;
}
AN_LOCK(sc); AN_LOCK(sc);
memcpy(&sc->areq, areq, sizeof(sc->areq));
#ifdef ANCACHE #ifdef ANCACHE
if (sc->areq.an_type == AN_RID_ZERO_CACHE) { if (sc->areq.an_type == AN_RID_ZERO_CACHE) {
error = priv_check(td, PRIV_DRIVER);
if (error)
break;
sc->an_sigitems = sc->an_nextitem = 0; sc->an_sigitems = sc->an_nextitem = 0;
free(areq, M_TEMP);
break; break;
} else if (sc->areq.an_type == AN_RID_READ_CACHE) { } else if (sc->areq.an_type == AN_RID_READ_CACHE) {
char *pt = (char *)&sc->areq.an_val; char *pt = (char *)&sc->areq.an_val;
@@ -1960,12 +1966,14 @@ an_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
#endif #endif
if (an_read_record(sc, (struct an_ltv_gen *)&sc->areq)) { if (an_read_record(sc, (struct an_ltv_gen *)&sc->areq)) {
AN_UNLOCK(sc); AN_UNLOCK(sc);
free(areq, M_TEMP);
error = EINVAL; error = EINVAL;
break; break;
} }
memcpy(areq, &sc->areq, sizeof(*areq));
AN_UNLOCK(sc); AN_UNLOCK(sc);
error = copyout(&sc->areq, ifr_data_get_ptr(ifr), error = copyout(areq, ifr_data_get_ptr(ifr), sizeof(*areq));
sizeof(sc->areq)); free(areq, M_TEMP);
break; break;
case SIOCSAIRONET: case SIOCSAIRONET:
if ((error = priv_check(td, PRIV_DRIVER))) if ((error = priv_check(td, PRIV_DRIVER)))
@@ -2313,7 +2321,7 @@ an_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
} }
break; break;
case SIOCS80211: case SIOCS80211:
if ((error = priv_check(td, PRIV_NET80211_MANAGE))) if ((error = priv_check(td, PRIV_NET80211_VAP_MANAGE)))
goto out; goto out;
AN_LOCK(sc); AN_LOCK(sc);
sc->areq.an_len = sizeof(sc->areq); sc->areq.an_len = sizeof(sc->areq);
@@ -2856,7 +2864,6 @@ an_start_locked(struct ifnet *ifp)
bcopy((caddr_t)&sc->an_txbuf, &buf[0x44], bcopy((caddr_t)&sc->an_txbuf, &buf[0x44],
tx_frame_802_3.an_tx_802_3_payload_len); tx_frame_802_3.an_tx_802_3_payload_len);
bzero(&an_tx_desc, sizeof(an_tx_desc)); bzero(&an_tx_desc, sizeof(an_tx_desc));
an_tx_desc.an_offset = 0; an_tx_desc.an_offset = 0;
an_tx_desc.an_eoc = 1; an_tx_desc.an_eoc = 1;
@@ -3033,7 +3040,6 @@ int an_sigitems; /* number of cached entries */
struct an_sigcache an_sigcache[MAXANCACHE]; /* array of cache entries */ struct an_sigcache an_sigcache[MAXANCACHE]; /* array of cache entries */
int an_nextitem; /* index/# of entries */ int an_nextitem; /* index/# of entries */
#endif #endif
/* control variables for cache filtering. Basic idea is /* control variables for cache filtering. Basic idea is
@@ -3131,7 +3137,6 @@ an_cache_store(struct an_softc *sc, struct ether_header *eh, struct mbuf *m,
* if table full, then we need to replace LRU entry * if table full, then we need to replace LRU entry
*/ */
else { else {
/* check for space in cache table /* check for space in cache table
* note: an_nextitem also holds number of entries * note: an_nextitem also holds number of entries
* added in the cache table * added in the cache table
@@ -3172,7 +3177,6 @@ an_cache_store(struct an_softc *sc, struct ether_header *eh, struct mbuf *m,
} }
bcopy( eh->ether_shost, sc->an_sigcache[cache_slot].macsrc, 6); bcopy( eh->ether_shost, sc->an_sigcache[cache_slot].macsrc, 6);
switch (an_cache_mode) { switch (an_cache_mode) {
case DBM: case DBM:
if (sc->an_have_rssimap) { if (sc->an_have_rssimap) {
@@ -3542,7 +3546,6 @@ cmdreset(struct ifnet *ifp)
FLASH_DELAY(sc, 1000); /* WAS 600 12/7/00 */ FLASH_DELAY(sc, 1000); /* WAS 600 12/7/00 */
if (!(status = WaitBusy(ifp, 100))) { if (!(status = WaitBusy(ifp, 100))) {
if_printf(ifp, "Waitbusy hang AFTER RESET =%d\n", status); if_printf(ifp, "Waitbusy hang AFTER RESET =%d\n", status);
AN_UNLOCK(sc); AN_UNLOCK(sc);
@@ -3592,7 +3595,6 @@ flashgchar(struct ifnet *ifp, int matchbyte, int dwelltime)
int success = -1; int success = -1;
struct an_softc *sc = ifp->if_softc; struct an_softc *sc = ifp->if_softc;
do { do {
rchar = CSR_READ_2(sc, AN_SW1(sc->mpi350)); rchar = CSR_READ_2(sc, AN_SW1(sc->mpi350));
@@ -3665,7 +3667,6 @@ flashpchar(struct ifnet *ifp, int byte, int dwelltime)
echo = CSR_READ_2(sc, AN_SW1(sc->mpi350)); echo = CSR_READ_2(sc, AN_SW1(sc->mpi350));
} while (dwelltime >= 0 && echo != byte); } while (dwelltime >= 0 && echo != byte);
CSR_WRITE_2(sc, AN_SW1(sc->mpi350), 0); CSR_WRITE_2(sc, AN_SW1(sc->mpi350), 0);
return echo == byte; return echo == byte;
@@ -40,7 +40,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__FBSDID("$FreeBSD: releng/12.0/sys/dev/an/if_an_isa.c 327102 2017-12-23 06:49:27Z imp $"); __FBSDID("$FreeBSD$");
#include "opt_inet.h" #include "opt_inet.h"
@@ -40,7 +40,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__FBSDID("$FreeBSD: releng/12.0/sys/dev/an/if_an_pccard.c 325966 2017-11-18 14:26:50Z pfg $"); __FBSDID("$FreeBSD$");
#include "opt_inet.h" #include "opt_inet.h"
@@ -88,7 +88,6 @@ static device_method_t an_pccard_methods[] = {
DEVMETHOD(device_attach, an_pccard_attach), DEVMETHOD(device_attach, an_pccard_attach),
DEVMETHOD(device_detach, an_detach), DEVMETHOD(device_detach, an_detach),
DEVMETHOD(device_shutdown, an_shutdown), DEVMETHOD(device_shutdown, an_shutdown),
{ 0, 0 } { 0, 0 }
}; };
@@ -33,7 +33,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__FBSDID("$FreeBSD: releng/12.0/sys/dev/an/if_an_pci.c 338948 2018-09-26 17:12:14Z imp $"); __FBSDID("$FreeBSD$");
/* /*
* This is a PCI shim for the Aironet PC4500/4800 wireless network * This is a PCI shim for the Aironet PC4500/4800 wireless network
@@ -31,7 +31,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE. * THE POSSIBILITY OF SUCH DAMAGE.
* *
* $FreeBSD: releng/12.0/sys/dev/an/if_anreg.h 325966 2017-11-18 14:26:50Z pfg $ * $FreeBSD$
*/ */
#define AN_TIMEOUT 65536 #define AN_TIMEOUT 65536
@@ -354,7 +354,6 @@ struct an_rxframe_802_3 {
}; };
#define AN_RXGAP_MAX 8 #define AN_RXGAP_MAX 8
struct an_txframe_802_3 { struct an_txframe_802_3 {
/* /*
* Transmit 802.3 header structure. * Transmit 802.3 header structure.