merged changes from FreeBSD 9.0 for most wlan drivers and net80211.
* merged changes from FreeBSD 9.0 for most wlan drivers except atheroswifi and net80211. * added iwlwifi-6000g2b-ucode-18.168.6.1
This commit is contained in:
parent
b22f58132d
commit
5f1c0791b3
Binary file not shown.
@ -102,7 +102,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include <sys/module.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/bus.h>
|
||||
#include <machine/bus.h>
|
||||
#include <sys/rman.h>
|
||||
@ -140,9 +139,11 @@ static void an_reset(struct an_softc *);
|
||||
static int an_init_mpi350_desc(struct an_softc *);
|
||||
static int an_ioctl(struct ifnet *, u_long, caddr_t);
|
||||
static void an_init(void *);
|
||||
static void an_init_locked(struct an_softc *);
|
||||
static int an_init_tx_ring(struct an_softc *);
|
||||
static void an_start(struct ifnet *);
|
||||
static void an_watchdog(struct ifnet *);
|
||||
static void an_start_locked(struct ifnet *);
|
||||
static void an_watchdog(struct an_softc *);
|
||||
static void an_rxeof(struct an_softc *);
|
||||
static void an_txeof(struct an_softc *, int);
|
||||
|
||||
@ -314,7 +315,7 @@ an_pci_probe(device_t dev)
|
||||
struct an_softc *sc = device_get_softc(dev);
|
||||
|
||||
mtx_init(&sc->an_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
|
||||
MTX_DEF | MTX_RECURSE);
|
||||
MTX_DEF);
|
||||
|
||||
return(0);
|
||||
}
|
||||
@ -347,10 +348,6 @@ an_probe(device_t dev)
|
||||
* to be able to issue commands and call some of the
|
||||
* other routines.
|
||||
*/
|
||||
sc->an_bhandle = rman_get_bushandle(sc->port_res);
|
||||
sc->an_btag = rman_get_bustag(sc->port_res);
|
||||
sc->an_unit = device_get_unit(dev);
|
||||
|
||||
ssid.an_len = sizeof(ssid);
|
||||
ssid.an_type = AN_RID_SSIDLIST;
|
||||
|
||||
@ -360,7 +357,7 @@ an_probe(device_t dev)
|
||||
CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), 0xFFFF);
|
||||
|
||||
mtx_init(&sc->an_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
|
||||
MTX_DEF | MTX_RECURSE);
|
||||
MTX_DEF);
|
||||
AN_LOCK(sc);
|
||||
an_reset(sc);
|
||||
|
||||
@ -600,8 +597,7 @@ an_init_mpi350_desc(struct an_softc *sc)
|
||||
cmd_struct.an_parm1 = AN_RX_DESC_OFFSET;
|
||||
cmd_struct.an_parm2 = AN_MAX_RX_DESC;
|
||||
if (an_cmd_struct(sc, &cmd_struct, &reply)) {
|
||||
printf("an%d: failed to allocate RX descriptor\n",
|
||||
sc->an_unit);
|
||||
if_printf(sc->an_ifp, "failed to allocate RX descriptor\n");
|
||||
return(EIO);
|
||||
}
|
||||
|
||||
@ -629,8 +625,7 @@ an_init_mpi350_desc(struct an_softc *sc)
|
||||
cmd_struct.an_parm1 = AN_TX_DESC_OFFSET;
|
||||
cmd_struct.an_parm2 = AN_MAX_TX_DESC;
|
||||
if (an_cmd_struct(sc, &cmd_struct, &reply)) {
|
||||
printf("an%d: failed to allocate TX descriptor\n",
|
||||
sc->an_unit);
|
||||
if_printf(sc->an_ifp, "failed to allocate TX descriptor\n");
|
||||
return(EIO);
|
||||
}
|
||||
|
||||
@ -659,8 +654,7 @@ an_init_mpi350_desc(struct an_softc *sc)
|
||||
cmd_struct.an_parm1 = AN_HOST_DESC_OFFSET;
|
||||
cmd_struct.an_parm2 = 1;
|
||||
if (an_cmd_struct(sc, &cmd_struct, &reply)) {
|
||||
printf("an%d: failed to allocate host descriptor\n",
|
||||
sc->an_unit);
|
||||
if_printf(sc->an_ifp, "failed to allocate host descriptor\n");
|
||||
return(EIO);
|
||||
}
|
||||
|
||||
@ -678,7 +672,7 @@ an_init_mpi350_desc(struct an_softc *sc)
|
||||
}
|
||||
|
||||
int
|
||||
an_attach(struct an_softc *sc, int unit, int flags)
|
||||
an_attach(struct an_softc *sc, int flags)
|
||||
{
|
||||
struct ifnet *ifp;
|
||||
int error = EIO;
|
||||
@ -687,7 +681,7 @@ an_attach(struct an_softc *sc, int unit, int flags)
|
||||
|
||||
ifp = sc->an_ifp = if_alloc(IFT_ETHER);
|
||||
if (ifp == NULL) {
|
||||
printf("an%d: can not if_alloc()\n", sc->an_unit);
|
||||
device_printf(sc->an_dev, "can not if_alloc()\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@ -708,7 +702,7 @@ an_attach(struct an_softc *sc, int unit, int flags)
|
||||
|
||||
/* Load factory config */
|
||||
if (an_cmd(sc, AN_CMD_READCFG, 0)) {
|
||||
printf("an%d: failed to load config data\n", sc->an_unit);
|
||||
device_printf(sc->an_dev, "failed to load config data\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@ -716,7 +710,7 @@ an_attach(struct an_softc *sc, int unit, int flags)
|
||||
sc->an_config.an_type = AN_RID_GENCONFIG;
|
||||
sc->an_config.an_len = sizeof(struct an_ltv_genconfig);
|
||||
if (an_read_record(sc, (struct an_ltv_gen *)&sc->an_config)) {
|
||||
printf("an%d: read record failed\n", sc->an_unit);
|
||||
device_printf(sc->an_dev, "read record failed\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@ -724,7 +718,7 @@ an_attach(struct an_softc *sc, int unit, int flags)
|
||||
sc->an_caps.an_type = AN_RID_CAPABILITIES;
|
||||
sc->an_caps.an_len = sizeof(struct an_ltv_caps);
|
||||
if (an_read_record(sc, (struct an_ltv_gen *)&sc->an_caps)) {
|
||||
printf("an%d: read record failed\n", sc->an_unit);
|
||||
device_printf(sc->an_dev, "read record failed\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@ -732,7 +726,7 @@ an_attach(struct an_softc *sc, int unit, int flags)
|
||||
sc->an_ssidlist.an_type = AN_RID_SSIDLIST;
|
||||
sc->an_ssidlist.an_len = sizeof(struct an_ltv_ssidlist_new);
|
||||
if (an_read_record(sc, (struct an_ltv_gen *)&sc->an_ssidlist)) {
|
||||
printf("an%d: read record failed\n", sc->an_unit);
|
||||
device_printf(sc->an_dev, "read record failed\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@ -740,7 +734,7 @@ an_attach(struct an_softc *sc, int unit, int flags)
|
||||
sc->an_aplist.an_type = AN_RID_APLIST;
|
||||
sc->an_aplist.an_len = sizeof(struct an_ltv_aplist);
|
||||
if (an_read_record(sc, (struct an_ltv_gen *)&sc->an_aplist)) {
|
||||
printf("an%d: read record failed\n", sc->an_unit);
|
||||
device_printf(sc->an_dev, "read record failed\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@ -751,26 +745,25 @@ an_attach(struct an_softc *sc, int unit, int flags)
|
||||
sc->an_rssimap.an_type = AN_RID_RSSI_MAP;
|
||||
sc->an_rssimap.an_len = sizeof(struct an_ltv_rssi_map);
|
||||
if (an_read_record(sc, (struct an_ltv_gen *)&sc->an_rssimap)) {
|
||||
printf("an%d: unable to get RSSI <-> dBM map\n", sc->an_unit);
|
||||
device_printf(sc->an_dev,
|
||||
"unable to get RSSI <-> dBM map\n");
|
||||
} else {
|
||||
printf("an%d: got RSSI <-> dBM map\n", sc->an_unit);
|
||||
device_printf(sc->an_dev, "got RSSI <-> dBM map\n");
|
||||
sc->an_have_rssimap = 1;
|
||||
}
|
||||
} else {
|
||||
printf("an%d: no RSSI <-> dBM map\n", sc->an_unit);
|
||||
device_printf(sc->an_dev, "no RSSI <-> dBM map\n");
|
||||
}
|
||||
#endif
|
||||
AN_UNLOCK(sc);
|
||||
|
||||
ifp->if_softc = sc;
|
||||
sc->an_unit = unit;
|
||||
if_initname(ifp, device_get_name(sc->an_dev),
|
||||
device_get_unit(sc->an_dev));
|
||||
ifp->if_mtu = ETHERMTU;
|
||||
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
|
||||
ifp->if_ioctl = an_ioctl;
|
||||
ifp->if_start = an_start;
|
||||
ifp->if_watchdog = an_watchdog;
|
||||
ifp->if_init = an_init;
|
||||
ifp->if_baudrate = 10000000;
|
||||
IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen);
|
||||
@ -897,7 +890,7 @@ an_rxeof(struct an_softc *sc)
|
||||
*/
|
||||
|
||||
if (!(sc->an_monitor & AN_MONITOR_INCLUDE_BEACON) &&
|
||||
(rx_frame.an_frame_ctl &
|
||||
(rx_frame.an_frame_ctl &
|
||||
IEEE80211_FC0_SUBTYPE_BEACON)) {
|
||||
return;
|
||||
}
|
||||
@ -907,9 +900,9 @@ an_rxeof(struct an_softc *sc)
|
||||
+ sizeof(rx_frame);
|
||||
/* Check for insane frame length */
|
||||
if (len > sizeof(sc->buf_802_11)) {
|
||||
printf("an%d: oversized packet "
|
||||
if_printf(ifp, "oversized packet "
|
||||
"received (%d, %d)\n",
|
||||
sc->an_unit, len, MCLBYTES);
|
||||
len, MCLBYTES);
|
||||
ifp->if_ierrors++;
|
||||
return;
|
||||
}
|
||||
@ -933,9 +926,9 @@ an_rxeof(struct an_softc *sc)
|
||||
+ ieee80211_header_len;
|
||||
/* Check for insane frame length */
|
||||
if (len > sizeof(sc->buf_802_11)) {
|
||||
printf("an%d: oversized packet "
|
||||
if_printf(ifp, "oversized packet "
|
||||
"received (%d, %d)\n",
|
||||
sc->an_unit, len, MCLBYTES);
|
||||
len, MCLBYTES);
|
||||
ifp->if_ierrors++;
|
||||
return;
|
||||
}
|
||||
@ -993,9 +986,9 @@ an_rxeof(struct an_softc *sc)
|
||||
len = rx_frame_802_3.an_rx_802_3_payload_len;
|
||||
if (len > sizeof(sc->buf_802_11)) {
|
||||
m_freem(m);
|
||||
printf("an%d: oversized packet "
|
||||
if_printf(ifp, "oversized packet "
|
||||
"received (%d, %d)\n",
|
||||
sc->an_unit, len, MCLBYTES);
|
||||
len, MCLBYTES);
|
||||
ifp->if_ierrors++;
|
||||
return;
|
||||
}
|
||||
@ -1073,9 +1066,9 @@ an_rxeof(struct an_softc *sc)
|
||||
len = an_rx_desc.an_len + 12;
|
||||
if (len > MCLBYTES) {
|
||||
m_freem(m);
|
||||
printf("an%d: oversized packet "
|
||||
if_printf(ifp, "oversized packet "
|
||||
"received (%d, %d)\n",
|
||||
sc->an_unit, len, MCLBYTES);
|
||||
len, MCLBYTES);
|
||||
ifp->if_ierrors++;
|
||||
return;
|
||||
}
|
||||
@ -1116,9 +1109,8 @@ an_rxeof(struct an_softc *sc)
|
||||
((u_int32_t *)(void *)&an_rx_desc)[i]);
|
||||
|
||||
} else {
|
||||
printf("an%d: Didn't get valid RX packet "
|
||||
if_printf(ifp, "Didn't get valid RX packet "
|
||||
"%x %x %d\n",
|
||||
sc->an_unit,
|
||||
an_rx_desc.an_done,
|
||||
an_rx_desc.an_valid, an_rx_desc.an_len);
|
||||
}
|
||||
@ -1135,7 +1127,7 @@ an_txeof(struct an_softc *sc, int status)
|
||||
AN_LOCK_ASSERT(sc);
|
||||
ifp = sc->an_ifp;
|
||||
|
||||
ifp->if_timer = 0;
|
||||
sc->an_timer = 0;
|
||||
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
|
||||
|
||||
if (!sc->mpi350) {
|
||||
@ -1188,6 +1180,8 @@ an_stats_update(void *xsc)
|
||||
sc = xsc;
|
||||
AN_LOCK_ASSERT(sc);
|
||||
ifp = sc->an_ifp;
|
||||
if (sc->an_timer > 0 && --sc->an_timer == 0)
|
||||
an_watchdog(sc);
|
||||
|
||||
sc->an_status.an_type = AN_RID_STATUS;
|
||||
sc->an_status.an_len = sizeof(struct an_ltv_status);
|
||||
@ -1233,10 +1227,8 @@ an_intr(void *xsc)
|
||||
|
||||
ifp = sc->an_ifp;
|
||||
|
||||
#if !defined(__HAIKU__)
|
||||
/* Disable interrupts. */
|
||||
CSR_WRITE_2(sc, AN_INT_EN(sc->mpi350), 0);
|
||||
#endif
|
||||
|
||||
status = CSR_READ_2(sc, AN_EVENT_STAT(sc->mpi350));
|
||||
CSR_WRITE_2(sc, AN_EVENT_ACK(sc->mpi350), ~AN_INTRS(sc->mpi350));
|
||||
@ -1281,7 +1273,7 @@ an_intr(void *xsc)
|
||||
CSR_WRITE_2(sc, AN_INT_EN(sc->mpi350), AN_INTRS(sc->mpi350));
|
||||
|
||||
if ((ifp->if_flags & IFF_UP) && !IFQ_DRV_IS_EMPTY(&ifp->if_snd))
|
||||
an_start(ifp);
|
||||
an_start_locked(ifp);
|
||||
|
||||
AN_UNLOCK(sc);
|
||||
|
||||
@ -1395,7 +1387,7 @@ an_reset(struct an_softc *sc)
|
||||
an_cmd(sc, AN_CMD_NOOP2, 0);
|
||||
|
||||
if (an_cmd(sc, AN_CMD_FORCE_SYNCLOSS, 0) == ETIMEDOUT)
|
||||
printf("an%d: reset failed\n", sc->an_unit);
|
||||
if_printf(sc->an_ifp, "reset failed\n");
|
||||
|
||||
an_cmd(sc, AN_CMD_DISABLE, 0);
|
||||
|
||||
@ -1412,6 +1404,7 @@ an_read_record(struct an_softc *sc, struct an_ltv_gen *ltv)
|
||||
struct an_card_rid_desc an_rid_desc;
|
||||
struct an_command cmd;
|
||||
struct an_reply reply;
|
||||
struct ifnet *ifp;
|
||||
u_int16_t *ptr;
|
||||
u_int8_t *ptr2;
|
||||
int i, len;
|
||||
@ -1420,16 +1413,17 @@ an_read_record(struct an_softc *sc, struct an_ltv_gen *ltv)
|
||||
if (ltv->an_len < 4 || ltv->an_type == 0)
|
||||
return(EINVAL);
|
||||
|
||||
ifp = sc->an_ifp;
|
||||
if (!sc->mpi350){
|
||||
/* Tell the NIC to enter record read mode. */
|
||||
if (an_cmd(sc, AN_CMD_ACCESS|AN_ACCESS_READ, ltv->an_type)) {
|
||||
printf("an%d: RID access failed\n", sc->an_unit);
|
||||
if_printf(ifp, "RID access failed\n");
|
||||
return(EIO);
|
||||
}
|
||||
|
||||
/* Seek to the record. */
|
||||
if (an_seek(sc, ltv->an_type, 0, AN_BAP1)) {
|
||||
printf("an%d: seek to record failed\n", sc->an_unit);
|
||||
if_printf(ifp, "seek to record failed\n");
|
||||
return(EIO);
|
||||
}
|
||||
|
||||
@ -1441,8 +1435,8 @@ an_read_record(struct an_softc *sc, struct an_ltv_gen *ltv)
|
||||
*/
|
||||
len = CSR_READ_2(sc, AN_DATA1);
|
||||
if (len > (ltv->an_len - 2)) {
|
||||
printf("an%d: record length mismatch -- expected %d, "
|
||||
"got %d for Rid %x\n", sc->an_unit,
|
||||
if_printf(ifp, "record length mismatch -- expected %d, "
|
||||
"got %d for Rid %x\n",
|
||||
ltv->an_len - 2, len, ltv->an_type);
|
||||
len = ltv->an_len - 2;
|
||||
} else {
|
||||
@ -1478,8 +1472,8 @@ an_read_record(struct an_softc *sc, struct an_ltv_gen *ltv)
|
||||
|
||||
if (an_cmd_struct(sc, &cmd, &reply)
|
||||
|| reply.an_status & AN_CMD_QUAL_MASK) {
|
||||
printf("an%d: failed to read RID %x %x %x %x %x, %d\n",
|
||||
sc->an_unit, ltv->an_type,
|
||||
if_printf(ifp, "failed to read RID %x %x %x %x %x, %d\n",
|
||||
ltv->an_type,
|
||||
reply.an_status,
|
||||
reply.an_resp0,
|
||||
reply.an_resp1,
|
||||
@ -1495,8 +1489,8 @@ an_read_record(struct an_softc *sc, struct an_ltv_gen *ltv)
|
||||
|
||||
len = an_rid_desc.an_len;
|
||||
if (len > (ltv->an_len - 2)) {
|
||||
printf("an%d: record length mismatch -- expected %d, "
|
||||
"got %d for Rid %x\n", sc->an_unit,
|
||||
if_printf(ifp, "record length mismatch -- expected %d, "
|
||||
"got %d for Rid %x\n",
|
||||
ltv->an_len - 2, len, ltv->an_type);
|
||||
len = ltv->an_len - 2;
|
||||
} else {
|
||||
@ -1588,8 +1582,9 @@ an_write_record(struct an_softc *sc, struct an_ltv_gen *ltv)
|
||||
DELAY(100000);
|
||||
|
||||
if ((i = an_cmd_struct(sc, &cmd, &reply))) {
|
||||
printf("an%d: failed to write RID 1 %x %x %x %x %x, %d\n",
|
||||
sc->an_unit, ltv->an_type,
|
||||
if_printf(sc->an_ifp,
|
||||
"failed to write RID 1 %x %x %x %x %x, %d\n",
|
||||
ltv->an_type,
|
||||
reply.an_status,
|
||||
reply.an_resp0,
|
||||
reply.an_resp1,
|
||||
@ -1600,8 +1595,9 @@ an_write_record(struct an_softc *sc, struct an_ltv_gen *ltv)
|
||||
|
||||
|
||||
if (reply.an_status & AN_CMD_QUAL_MASK) {
|
||||
printf("an%d: failed to write RID 2 %x %x %x %x %x, %d\n",
|
||||
sc->an_unit, ltv->an_type,
|
||||
if_printf(sc->an_ifp,
|
||||
"failed to write RID 2 %x %x %x %x %x, %d\n",
|
||||
ltv->an_type,
|
||||
reply.an_status,
|
||||
reply.an_resp0,
|
||||
reply.an_resp1,
|
||||
@ -1625,11 +1621,11 @@ an_dump_record(struct an_softc *sc, struct an_ltv_gen *ltv, char *string)
|
||||
char buf[17], temp;
|
||||
|
||||
len = ltv->an_len - 4;
|
||||
printf("an%d: RID %4x, Length %4d, Mode %s\n",
|
||||
sc->an_unit, ltv->an_type, ltv->an_len - 4, string);
|
||||
if_printf(sc->an_ifp, "RID %4x, Length %4d, Mode %s\n",
|
||||
ltv->an_type, ltv->an_len - 4, string);
|
||||
|
||||
if (an_dump == 1 || (an_dump == ltv->an_type)) {
|
||||
printf("an%d:\t", sc->an_unit);
|
||||
if_printf(sc->an_ifp, "\t");
|
||||
bzero(buf,sizeof(buf));
|
||||
|
||||
ptr2 = (u_int8_t *)<v->an_val;
|
||||
@ -1644,7 +1640,7 @@ an_dump_record(struct an_softc *sc, struct an_ltv_gen *ltv, char *string)
|
||||
if (++count == 16) {
|
||||
count = 0;
|
||||
printf("%s\n",buf);
|
||||
printf("an%d:\t", sc->an_unit);
|
||||
if_printf(sc->an_ifp, "\t");
|
||||
bzero(buf,sizeof(buf));
|
||||
}
|
||||
}
|
||||
@ -1671,7 +1667,7 @@ an_seek(struct an_softc *sc, int id, int off, int chan)
|
||||
offreg = AN_OFF1;
|
||||
break;
|
||||
default:
|
||||
printf("an%d: invalid data path: %x\n", sc->an_unit, chan);
|
||||
if_printf(sc->an_ifp, "invalid data path: %x\n", chan);
|
||||
return(EIO);
|
||||
}
|
||||
|
||||
@ -1745,8 +1741,8 @@ an_alloc_nicmem(struct an_softc *sc, int len, int *id)
|
||||
int i;
|
||||
|
||||
if (an_cmd(sc, AN_CMD_ALLOC_MEM, len)) {
|
||||
printf("an%d: failed to allocate %d bytes on NIC\n",
|
||||
sc->an_unit, len);
|
||||
if_printf(sc->an_ifp, "failed to allocate %d bytes on NIC\n",
|
||||
len);
|
||||
return(ENOMEM);
|
||||
}
|
||||
|
||||
@ -1828,9 +1824,7 @@ an_setdef(struct an_softc *sc, struct an_req *areq)
|
||||
case AN_RID_WEP_PERM:
|
||||
case AN_RID_LEAPUSERNAME:
|
||||
case AN_RID_LEAPPASSWORD:
|
||||
AN_UNLOCK(sc);
|
||||
an_init(sc);
|
||||
AN_LOCK(sc);
|
||||
an_init_locked(sc);
|
||||
|
||||
/* Disable the MAC. */
|
||||
an_cmd(sc, AN_CMD_DISABLE, 0);
|
||||
@ -1865,17 +1859,14 @@ an_setdef(struct an_softc *sc, struct an_req *areq)
|
||||
}
|
||||
break;
|
||||
default:
|
||||
printf("an%d: unknown RID: %x\n", sc->an_unit, areq->an_type);
|
||||
if_printf(ifp, "unknown RID: %x\n", areq->an_type);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Reinitialize the card. */
|
||||
if (ifp->if_flags) {
|
||||
AN_UNLOCK(sc);
|
||||
an_init(sc);
|
||||
AN_LOCK(sc);
|
||||
}
|
||||
if (ifp->if_flags)
|
||||
an_init_locked(sc);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -1893,11 +1884,8 @@ an_promisc(struct an_softc *sc, int promisc)
|
||||
if (sc->mpi350)
|
||||
an_init_mpi350_desc(sc);
|
||||
}
|
||||
if (sc->an_monitor || sc->an_was_monitor) {
|
||||
AN_UNLOCK(sc);
|
||||
an_init(sc);
|
||||
AN_LOCK(sc);
|
||||
}
|
||||
if (sc->an_monitor || sc->an_was_monitor)
|
||||
an_init_locked(sc);
|
||||
|
||||
sc->an_was_monitor = sc->an_monitor;
|
||||
an_cmd(sc, AN_CMD_SET_MODE, promisc ? 0xffff : 0);
|
||||
@ -1951,20 +1939,14 @@ an_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
|
||||
!(ifp->if_flags & IFF_PROMISC) &&
|
||||
sc->an_if_flags & IFF_PROMISC) {
|
||||
an_promisc(sc, 0);
|
||||
} else {
|
||||
AN_UNLOCK(sc);
|
||||
an_init(sc);
|
||||
AN_LOCK(sc);
|
||||
}
|
||||
} else
|
||||
an_init_locked(sc);
|
||||
} else {
|
||||
if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
|
||||
AN_UNLOCK(sc);
|
||||
if (ifp->if_drv_flags & IFF_DRV_RUNNING)
|
||||
an_stop(sc);
|
||||
AN_LOCK(sc);
|
||||
}
|
||||
}
|
||||
AN_UNLOCK(sc);
|
||||
sc->an_if_flags = ifp->if_flags;
|
||||
AN_UNLOCK(sc);
|
||||
error = 0;
|
||||
break;
|
||||
case SIOCSIFMEDIA:
|
||||
@ -2488,7 +2470,6 @@ an_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
|
||||
AN_UNLOCK(sc);
|
||||
break;
|
||||
}
|
||||
AN_UNLOCK(sc);
|
||||
if (ireq->i_val == 4) {
|
||||
config->an_home_product |= AN_HOME_NETWORK;
|
||||
ireq->i_val = 0;
|
||||
@ -2500,10 +2481,9 @@ an_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
|
||||
= config->an_home_product;
|
||||
|
||||
/* update configuration */
|
||||
an_init(sc);
|
||||
an_init_locked(sc);
|
||||
|
||||
bzero(&sc->areq, sizeof(struct an_ltv_key));
|
||||
AN_LOCK(sc);
|
||||
sc->areq.an_len = sizeof(struct an_ltv_key);
|
||||
sc->areq.an_type = AN_RID_WEP_PERM;
|
||||
key->kindex = 0xffff;
|
||||
@ -2586,6 +2566,9 @@ an_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
|
||||
an_setdef(sc, &sc->areq);
|
||||
AN_UNLOCK(sc);
|
||||
break;
|
||||
default:
|
||||
AN_UNLOCK(sc);
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2635,14 +2618,21 @@ static void
|
||||
an_init(void *xsc)
|
||||
{
|
||||
struct an_softc *sc = xsc;
|
||||
struct ifnet *ifp = sc->an_ifp;
|
||||
|
||||
AN_LOCK(sc);
|
||||
an_init_locked(sc);
|
||||
AN_UNLOCK(sc);
|
||||
}
|
||||
|
||||
if (sc->an_gone) {
|
||||
AN_UNLOCK(sc);
|
||||
static void
|
||||
an_init_locked(struct an_softc *sc)
|
||||
{
|
||||
struct ifnet *ifp;
|
||||
|
||||
AN_LOCK_ASSERT(sc);
|
||||
ifp = sc->an_ifp;
|
||||
if (sc->an_gone)
|
||||
return;
|
||||
}
|
||||
|
||||
if (ifp->if_drv_flags & IFF_DRV_RUNNING)
|
||||
an_stop(sc);
|
||||
@ -2655,9 +2645,7 @@ an_init(void *xsc)
|
||||
if (sc->mpi350)
|
||||
an_init_mpi350_desc(sc);
|
||||
if (an_init_tx_ring(sc)) {
|
||||
printf("an%d: tx buffer allocation "
|
||||
"failed\n", sc->an_unit);
|
||||
AN_UNLOCK(sc);
|
||||
if_printf(ifp, "tx buffer allocation failed\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -2697,8 +2685,7 @@ an_init(void *xsc)
|
||||
sc->an_ssidlist.an_type = AN_RID_SSIDLIST;
|
||||
sc->an_ssidlist.an_len = sizeof(struct an_ltv_ssidlist_new);
|
||||
if (an_write_record(sc, (struct an_ltv_gen *)&sc->an_ssidlist)) {
|
||||
printf("an%d: failed to set ssid list\n", sc->an_unit);
|
||||
AN_UNLOCK(sc);
|
||||
if_printf(ifp, "failed to set ssid list\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2706,8 +2693,7 @@ an_init(void *xsc)
|
||||
sc->an_aplist.an_type = AN_RID_APLIST;
|
||||
sc->an_aplist.an_len = sizeof(struct an_ltv_aplist);
|
||||
if (an_write_record(sc, (struct an_ltv_gen *)&sc->an_aplist)) {
|
||||
printf("an%d: failed to set AP list\n", sc->an_unit);
|
||||
AN_UNLOCK(sc);
|
||||
if_printf(ifp, "failed to set AP list\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2715,15 +2701,13 @@ an_init(void *xsc)
|
||||
sc->an_config.an_len = sizeof(struct an_ltv_genconfig);
|
||||
sc->an_config.an_type = AN_RID_GENCONFIG;
|
||||
if (an_write_record(sc, (struct an_ltv_gen *)&sc->an_config)) {
|
||||
printf("an%d: failed to set configuration\n", sc->an_unit);
|
||||
AN_UNLOCK(sc);
|
||||
if_printf(ifp, "failed to set configuration\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Enable the MAC */
|
||||
if (an_cmd(sc, AN_CMD_ENABLE, 0)) {
|
||||
printf("an%d: failed to enable MAC\n", sc->an_unit);
|
||||
AN_UNLOCK(sc);
|
||||
if_printf(ifp, "failed to enable MAC\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2737,13 +2721,23 @@ an_init(void *xsc)
|
||||
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
|
||||
|
||||
callout_reset(&sc->an_stat_ch, hz, an_stats_update, sc);
|
||||
AN_UNLOCK(sc);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
an_start(struct ifnet *ifp)
|
||||
{
|
||||
struct an_softc *sc;
|
||||
|
||||
sc = ifp->if_softc;
|
||||
AN_LOCK(sc);
|
||||
an_start_locked(ifp);
|
||||
AN_UNLOCK(sc);
|
||||
}
|
||||
|
||||
static void
|
||||
an_start_locked(struct ifnet *ifp)
|
||||
{
|
||||
struct an_softc *sc;
|
||||
struct mbuf *m0 = NULL;
|
||||
@ -2756,6 +2750,7 @@ an_start(struct ifnet *ifp)
|
||||
|
||||
sc = ifp->if_softc;
|
||||
|
||||
AN_LOCK_ASSERT(sc);
|
||||
if (sc->an_gone)
|
||||
return;
|
||||
|
||||
@ -2778,7 +2773,6 @@ an_start(struct ifnet *ifp)
|
||||
|
||||
idx = sc->an_rdata.an_tx_prod;
|
||||
|
||||
AN_LOCK(sc);
|
||||
if (!sc->mpi350) {
|
||||
bzero((char *)&tx_frame_802_3, sizeof(tx_frame_802_3));
|
||||
|
||||
@ -2805,7 +2799,7 @@ an_start(struct ifnet *ifp)
|
||||
tx_frame_802_3.an_tx_802_3_payload_len,
|
||||
(caddr_t)&sc->an_txbuf);
|
||||
|
||||
txcontrol = AN_TXCTL_8023;
|
||||
txcontrol = AN_TXCTL_8023 | AN_TXCTL_HW(sc->mpi350);
|
||||
/* write the txcontrol only */
|
||||
an_write_data(sc, id, 0x08, (caddr_t)&txcontrol,
|
||||
sizeof(txcontrol));
|
||||
@ -2829,14 +2823,14 @@ an_start(struct ifnet *ifp)
|
||||
|
||||
sc->an_rdata.an_tx_ring[idx] = id;
|
||||
if (an_cmd(sc, AN_CMD_TX, id))
|
||||
printf("an%d: xmit failed\n", sc->an_unit);
|
||||
if_printf(ifp, "xmit failed\n");
|
||||
|
||||
AN_INC(idx, AN_TX_RING_CNT);
|
||||
|
||||
/*
|
||||
* Set a timeout in case the chip goes out to lunch.
|
||||
*/
|
||||
ifp->if_timer = 5;
|
||||
sc->an_timer = 5;
|
||||
}
|
||||
} else { /* MPI-350 */
|
||||
/* Disable interrupts. */
|
||||
@ -2868,7 +2862,7 @@ an_start(struct ifnet *ifp)
|
||||
tx_frame_802_3.an_tx_802_3_payload_len,
|
||||
(caddr_t)&sc->an_txbuf);
|
||||
|
||||
txcontrol = AN_TXCTL_8023;
|
||||
txcontrol = AN_TXCTL_8023 | AN_TXCTL_HW(sc->mpi350);
|
||||
/* write the txcontrol only */
|
||||
bcopy((caddr_t)&txcontrol, &buf[0x08],
|
||||
sizeof(txcontrol));
|
||||
@ -2890,7 +2884,7 @@ an_start(struct ifnet *ifp)
|
||||
tx_frame_802_3.an_tx_802_3_payload_len;
|
||||
an_tx_desc.an_phys
|
||||
= sc->an_tx_buffer[idx].an_dma_paddr;
|
||||
for (i = 0; i < sizeof(an_tx_desc) / 4 ; i++) {
|
||||
for (i = sizeof(an_tx_desc) / 4 - 1; i >= 0; i--) {
|
||||
CSR_MEM_AUX_WRITE_4(sc, AN_TX_DESC_OFFSET
|
||||
/* zero for now */
|
||||
+ (0 * sizeof(an_tx_desc))
|
||||
@ -2913,13 +2907,12 @@ an_start(struct ifnet *ifp)
|
||||
/*
|
||||
* Set a timeout in case the chip goes out to lunch.
|
||||
*/
|
||||
ifp->if_timer = 5;
|
||||
sc->an_timer = 5;
|
||||
}
|
||||
|
||||
/* Re-enable interrupts. */
|
||||
CSR_WRITE_2(sc, AN_INT_EN(sc->mpi350), AN_INTRS(sc->mpi350));
|
||||
}
|
||||
AN_UNLOCK(sc);
|
||||
|
||||
if (m0 != NULL)
|
||||
ifp->if_drv_flags |= IFF_DRV_OACTIVE;
|
||||
@ -2935,12 +2928,10 @@ an_stop(struct an_softc *sc)
|
||||
struct ifnet *ifp;
|
||||
int i;
|
||||
|
||||
AN_LOCK(sc);
|
||||
AN_LOCK_ASSERT(sc);
|
||||
|
||||
if (sc->an_gone) {
|
||||
AN_UNLOCK(sc);
|
||||
if (sc->an_gone)
|
||||
return;
|
||||
}
|
||||
|
||||
ifp = sc->an_ifp;
|
||||
|
||||
@ -2959,36 +2950,27 @@ an_stop(struct an_softc *sc)
|
||||
free(sc->an_flash_buffer, M_DEVBUF);
|
||||
sc->an_flash_buffer = NULL;
|
||||
}
|
||||
|
||||
AN_UNLOCK(sc);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
an_watchdog(struct ifnet *ifp)
|
||||
an_watchdog(struct an_softc *sc)
|
||||
{
|
||||
struct an_softc *sc;
|
||||
struct ifnet *ifp;
|
||||
|
||||
sc = ifp->if_softc;
|
||||
AN_LOCK(sc);
|
||||
AN_LOCK_ASSERT(sc);
|
||||
|
||||
if (sc->an_gone) {
|
||||
AN_UNLOCK(sc);
|
||||
if (sc->an_gone)
|
||||
return;
|
||||
}
|
||||
|
||||
printf("an%d: device timeout\n", sc->an_unit);
|
||||
ifp = sc->an_ifp;
|
||||
if_printf(ifp, "device timeout\n");
|
||||
|
||||
an_reset(sc);
|
||||
if (sc->mpi350)
|
||||
an_init_mpi350_desc(sc);
|
||||
AN_UNLOCK(sc);
|
||||
an_init(sc);
|
||||
an_init_locked(sc);
|
||||
|
||||
ifp->if_oerrors++;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
@ -2997,10 +2979,12 @@ an_shutdown(device_t dev)
|
||||
struct an_softc *sc;
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
AN_LOCK(sc);
|
||||
an_stop(sc);
|
||||
sc->an_gone = 1;
|
||||
AN_UNLOCK(sc);
|
||||
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
@ -3018,7 +3002,7 @@ an_resume(device_t dev)
|
||||
an_reset(sc);
|
||||
if (sc->mpi350)
|
||||
an_init_mpi350_desc(sc);
|
||||
an_init(sc);
|
||||
an_init_locked(sc);
|
||||
|
||||
/* Recovery temporary keys */
|
||||
for (i = 0; i < 4; i++) {
|
||||
@ -3030,7 +3014,7 @@ an_resume(device_t dev)
|
||||
}
|
||||
|
||||
if (ifp->if_flags & IFF_UP)
|
||||
an_start(ifp);
|
||||
an_start_locked(ifp);
|
||||
AN_UNLOCK(sc);
|
||||
|
||||
return;
|
||||
@ -3129,7 +3113,7 @@ an_cache_store(struct an_softc *sc, struct ether_header *eh, struct mbuf *m,
|
||||
}
|
||||
|
||||
#ifdef SIGDEBUG
|
||||
printf("an: q value %x (MSB=0x%x, LSB=0x%x) \n",
|
||||
if_printf(sc->an_ifp, "q value %x (MSB=0x%x, LSB=0x%x) \n",
|
||||
rx_rssi & 0xffff, rx_rssi >> 8, rx_rssi & 0xff);
|
||||
#endif
|
||||
|
||||
@ -3255,12 +3239,12 @@ an_media_change(struct ifnet *ifp)
|
||||
int otype = sc->an_config.an_opmode;
|
||||
int orate = sc->an_tx_rate;
|
||||
|
||||
AN_LOCK(sc);
|
||||
sc->an_tx_rate = ieee80211_media2rate(
|
||||
IFM_SUBTYPE(sc->an_ifmedia.ifm_cur->ifm_media));
|
||||
if (sc->an_tx_rate < 0)
|
||||
sc->an_tx_rate = 0;
|
||||
|
||||
AN_LOCK(sc);
|
||||
if (orate != sc->an_tx_rate) {
|
||||
/* Read the current configuration */
|
||||
sc->an_config.an_type = AN_RID_GENCONFIG;
|
||||
@ -3281,11 +3265,11 @@ an_media_change(struct ifnet *ifp)
|
||||
sc->an_config.an_opmode &= ~AN_OPMODE_INFRASTRUCTURE_STATION;
|
||||
else
|
||||
sc->an_config.an_opmode |= AN_OPMODE_INFRASTRUCTURE_STATION;
|
||||
AN_UNLOCK(sc);
|
||||
|
||||
if (otype != sc->an_config.an_opmode ||
|
||||
orate != sc->an_tx_rate)
|
||||
an_init(sc);
|
||||
an_init_locked(sc);
|
||||
AN_UNLOCK(sc);
|
||||
|
||||
return(0);
|
||||
}
|
||||
@ -3306,7 +3290,6 @@ an_media_status(struct ifnet *ifp, struct ifmediareq *imr)
|
||||
imr->ifm_active = sc->an_ifmedia.ifm_cur->ifm_media;
|
||||
imr->ifm_status = IFM_AVALID|IFM_ACTIVE;
|
||||
}
|
||||
AN_UNLOCK(sc);
|
||||
|
||||
if (sc->an_tx_rate == 0) {
|
||||
imr->ifm_active = IFM_IEEE80211|IFM_AUTO;
|
||||
@ -3319,6 +3302,7 @@ an_media_status(struct ifnet *ifp, struct ifmediareq *imr)
|
||||
imr->ifm_status = IFM_AVALID;
|
||||
if (status.an_opmode & AN_STATUS_OPMODE_ASSOCIATED)
|
||||
imr->ifm_status |= IFM_ACTIVE;
|
||||
AN_UNLOCK(sc);
|
||||
}
|
||||
|
||||
/********************** Cisco utility support routines *************/
|
||||
@ -3563,14 +3547,13 @@ cmdreset(struct ifnet *ifp)
|
||||
int status;
|
||||
struct an_softc *sc = ifp->if_softc;
|
||||
|
||||
AN_LOCK(sc);
|
||||
an_stop(sc);
|
||||
|
||||
AN_LOCK(sc);
|
||||
an_cmd(sc, AN_CMD_DISABLE, 0);
|
||||
|
||||
if (!(status = WaitBusy(ifp, AN_TIMEOUT))) {
|
||||
printf("an%d: Waitbusy hang b4 RESET =%d\n",
|
||||
sc->an_unit, status);
|
||||
if_printf(ifp, "Waitbusy hang b4 RESET =%d\n", status);
|
||||
AN_UNLOCK(sc);
|
||||
return -EBUSY;
|
||||
}
|
||||
@ -3580,8 +3563,7 @@ cmdreset(struct ifnet *ifp)
|
||||
|
||||
|
||||
if (!(status = WaitBusy(ifp, 100))) {
|
||||
printf("an%d: Waitbusy hang AFTER RESET =%d\n",
|
||||
sc->an_unit, status);
|
||||
if_printf(ifp, "Waitbusy hang AFTER RESET =%d\n", status);
|
||||
AN_UNLOCK(sc);
|
||||
return -EBUSY;
|
||||
}
|
||||
@ -3689,8 +3671,7 @@ flashpchar(struct ifnet *ifp, int byte, int dwelltime)
|
||||
/* timeout for busy clear wait */
|
||||
|
||||
if (waittime <= 0) {
|
||||
printf("an%d: flash putchar busywait timeout! \n",
|
||||
sc->an_unit);
|
||||
if_printf(ifp, "flash putchar busywait timeout!\n");
|
||||
return -1;
|
||||
}
|
||||
/*
|
||||
@ -3756,9 +3737,7 @@ flashrestart(struct ifnet *ifp)
|
||||
|
||||
FLASH_DELAY(sc, 1024); /* Added 12/7/00 */
|
||||
|
||||
AN_UNLOCK(sc);
|
||||
an_init(sc);
|
||||
AN_LOCK(sc);
|
||||
an_init_locked(sc);
|
||||
|
||||
FLASH_DELAY(sc, 1024); /* Added 12/7/00 */
|
||||
return status;
|
||||
@ -3776,8 +3755,7 @@ flashcard(struct ifnet *ifp, struct aironet_ioctl *l_ioctl)
|
||||
|
||||
sc = ifp->if_softc;
|
||||
if (sc->mpi350) {
|
||||
printf("an%d: flashing not supported on MPI 350 yet\n",
|
||||
sc->an_unit);
|
||||
if_printf(ifp, "flashing not supported on MPI 350 yet\n");
|
||||
return(-1);
|
||||
}
|
||||
status = l_ioctl->command;
|
||||
@ -3822,7 +3800,7 @@ flashcard(struct ifnet *ifp, struct aironet_ioctl *l_ioctl)
|
||||
break;
|
||||
case AIROFLPUTBUF: /* Send 32k to card */
|
||||
if (l_ioctl->len > FLASH_SIZE) {
|
||||
printf("an%d: Buffer to big, %x %x\n", sc->an_unit,
|
||||
if_printf(ifp, "Buffer to big, %x %x\n",
|
||||
l_ioctl->len, FLASH_SIZE);
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -3839,8 +3817,7 @@ flashcard(struct ifnet *ifp, struct aironet_ioctl *l_ioctl)
|
||||
break;
|
||||
case AIRORESTART:
|
||||
if ((status = flashrestart(ifp)) != 0) {
|
||||
printf("an%d: FLASHRESTART returned %d\n",
|
||||
sc->an_unit, status);
|
||||
if_printf(ifp, "FLASHRESTART returned %d\n", status);
|
||||
return -EIO;
|
||||
} else
|
||||
return 0;
|
||||
|
@ -111,11 +111,9 @@ an_attach_isa(device_t dev)
|
||||
an_alloc_port(dev, sc->port_rid, 1);
|
||||
an_alloc_irq(dev, sc->irq_rid, 0);
|
||||
|
||||
sc->an_bhandle = rman_get_bushandle(sc->port_res);
|
||||
sc->an_btag = rman_get_bustag(sc->port_res);
|
||||
sc->an_dev = dev;
|
||||
|
||||
error = an_attach(sc, device_get_unit(dev), flags);
|
||||
error = an_attach(sc, flags);
|
||||
if (error) {
|
||||
an_release_resources(dev);
|
||||
return (error);
|
||||
|
@ -141,11 +141,9 @@ an_pccard_attach(device_t dev)
|
||||
|
||||
an_alloc_irq(dev, sc->irq_rid, 0);
|
||||
|
||||
sc->an_bhandle = rman_get_bushandle(sc->port_res);
|
||||
sc->an_btag = rman_get_bustag(sc->port_res);
|
||||
sc->an_dev = dev;
|
||||
|
||||
error = an_attach(sc, device_get_unit(dev), flags);
|
||||
error = an_attach(sc, flags);
|
||||
if (error)
|
||||
goto fail;
|
||||
|
||||
|
@ -103,6 +103,7 @@ struct an_type {
|
||||
|
||||
static struct an_type an_devs[] = {
|
||||
{ AIRONET_VENDORID, AIRONET_DEVICEID_35x, "Cisco Aironet 350 Series" },
|
||||
{ AIRONET_VENDORID, AIRONET_DEVICEID_MPI350, "Cisco Aironet MPI350" },
|
||||
{ AIRONET_VENDORID, AIRONET_DEVICEID_4500, "Aironet PCI4500" },
|
||||
{ AIRONET_VENDORID, AIRONET_DEVICEID_4800, "Aironet PCI4800" },
|
||||
{ AIRONET_VENDORID, AIRONET_DEVICEID_4xxx, "Aironet PCI4500/PCI4800" },
|
||||
@ -133,13 +134,6 @@ an_probe_pci(device_t dev)
|
||||
t++;
|
||||
}
|
||||
|
||||
if (pci_get_vendor(dev) == AIRONET_VENDORID &&
|
||||
pci_get_device(dev) == AIRONET_DEVICEID_MPI350) {
|
||||
device_set_desc(dev, "Cisco Aironet MPI350");
|
||||
an_pci_probe(dev);
|
||||
return(BUS_PROBE_DEFAULT);
|
||||
}
|
||||
|
||||
return(ENXIO);
|
||||
}
|
||||
|
||||
@ -149,10 +143,9 @@ an_attach_pci(dev)
|
||||
{
|
||||
u_int32_t command;
|
||||
struct an_softc *sc;
|
||||
int unit, flags, error = 0;
|
||||
int flags, error = 0;
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
unit = device_get_unit(dev);
|
||||
flags = device_get_flags(dev);
|
||||
|
||||
if (pci_get_vendor(dev) == AIRONET_VENDORID &&
|
||||
@ -169,7 +162,7 @@ an_attach_pci(dev)
|
||||
command = pci_read_config(dev, PCIR_COMMAND, 4);
|
||||
|
||||
if (!(command & PCIM_CMD_PORTEN)) {
|
||||
printf("an%d: failed to enable I/O ports!\n", unit);
|
||||
device_printf(dev, "failed to enable I/O ports!\n");
|
||||
error = ENXIO;
|
||||
goto fail;
|
||||
}
|
||||
@ -178,35 +171,28 @@ an_attach_pci(dev)
|
||||
error = an_alloc_port(dev, sc->port_rid, 1);
|
||||
|
||||
if (error) {
|
||||
printf("an%d: couldn't map ports\n", unit);
|
||||
device_printf(dev, "couldn't map ports\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
sc->an_btag = rman_get_bustag(sc->port_res);
|
||||
sc->an_bhandle = rman_get_bushandle(sc->port_res);
|
||||
|
||||
/* Allocate memory for MPI350 */
|
||||
if (sc->mpi350) {
|
||||
/* Allocate memory */
|
||||
sc->mem_rid = PCIR_BAR(1);
|
||||
error = an_alloc_memory(dev, sc->mem_rid, 1);
|
||||
if (error) {
|
||||
printf("an%d: couldn't map memory\n", unit);
|
||||
device_printf(dev, "couldn't map memory\n");
|
||||
goto fail;
|
||||
}
|
||||
sc->an_mem_btag = rman_get_bustag(sc->mem_res);
|
||||
sc->an_mem_bhandle = rman_get_bushandle(sc->mem_res);
|
||||
|
||||
/* Allocate aux. memory */
|
||||
sc->mem_aux_rid = PCIR_BAR(2);
|
||||
error = an_alloc_aux_memory(dev, sc->mem_aux_rid,
|
||||
AN_AUX_MEM_SIZE);
|
||||
if (error) {
|
||||
printf("an%d: couldn't map aux memory\n", unit);
|
||||
device_printf(dev, "couldn't map aux memory\n");
|
||||
goto fail;
|
||||
}
|
||||
sc->an_mem_aux_btag = rman_get_bustag(sc->mem_aux_res);
|
||||
sc->an_mem_aux_bhandle = rman_get_bushandle(sc->mem_aux_res);
|
||||
|
||||
/* Allocate DMA region */
|
||||
error = bus_dma_tag_create(NULL, /* parent */
|
||||
@ -222,7 +208,7 @@ an_attach_pci(dev)
|
||||
NULL, /* lockarg */
|
||||
&sc->an_dtag);
|
||||
if (error) {
|
||||
printf("an%d: couldn't get DMA region\n", unit);
|
||||
device_printf(dev, "couldn't get DMA region\n");
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
@ -230,12 +216,14 @@ an_attach_pci(dev)
|
||||
/* Allocate interrupt */
|
||||
error = an_alloc_irq(dev, 0, RF_SHAREABLE);
|
||||
if (error) {
|
||||
device_printf(dev, "couldn't get interrupt\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
sc->an_dev = dev;
|
||||
error = an_attach(sc, device_get_unit(dev), flags);
|
||||
error = an_attach(sc, flags);
|
||||
if (error) {
|
||||
device_printf(dev, "couldn't attach\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@ -244,6 +232,8 @@ an_attach_pci(dev)
|
||||
*/
|
||||
error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET,
|
||||
NULL, an_intr, sc, &sc->irq_handle);
|
||||
if (error)
|
||||
device_printf(dev, "couldn't setup interrupt\n");
|
||||
|
||||
fail:
|
||||
if (error)
|
||||
|
@ -45,47 +45,39 @@
|
||||
/*
|
||||
* register space access macros
|
||||
*/
|
||||
#define CSR_WRITE_2(sc, reg, val) \
|
||||
bus_space_write_2(sc->an_btag, sc->an_bhandle, reg, val)
|
||||
#define CSR_WRITE_2(sc, reg, val) bus_write_2(sc->port_res, reg, val)
|
||||
|
||||
#define CSR_READ_2(sc, reg) \
|
||||
bus_space_read_2(sc->an_btag, sc->an_bhandle, reg)
|
||||
#define CSR_READ_2(sc, reg) bus_read_2(sc->port_res, reg)
|
||||
|
||||
#define CSR_WRITE_1(sc, reg, val) \
|
||||
bus_space_write_1(sc->an_btag, sc->an_bhandle, reg, val)
|
||||
#define CSR_WRITE_1(sc, reg, val) bus_write_1(sc->port_res, reg, val)
|
||||
|
||||
#define CSR_READ_1(sc, reg) \
|
||||
bus_space_read_1(sc->an_btag, sc->an_bhandle, reg)
|
||||
#define CSR_READ_1(sc, reg) bus_read_1(sc->port_res, reg)
|
||||
|
||||
/*
|
||||
* memory space access macros
|
||||
*/
|
||||
#define CSR_MEM_WRITE_2(sc, reg, val) \
|
||||
bus_space_write_2(sc->an_mem_btag, sc->an_mem_bhandle, reg, val)
|
||||
#define CSR_MEM_WRITE_2(sc, reg, val) bus_write_2(sc->mem_res, reg, val)
|
||||
|
||||
#define CSR_MEM_READ_2(sc, reg) \
|
||||
bus_space_read_2(sc->an_mem_btag, sc->an_mem_bhandle, reg)
|
||||
#define CSR_MEM_READ_2(sc, reg) bus_read_2(sc->mem_res, reg)
|
||||
|
||||
#define CSR_MEM_WRITE_1(sc, reg, val) \
|
||||
bus_space_write_1(sc->an_mem_btag, sc->an_mem_bhandle, reg, val)
|
||||
#define CSR_MEM_WRITE_1(sc, reg, val) bus_write_1(sc->mem_res, reg, val)
|
||||
|
||||
#define CSR_MEM_READ_1(sc, reg) \
|
||||
bus_space_read_1(sc->an_mem_btag, sc->an_mem_bhandle, reg)
|
||||
#define CSR_MEM_READ_1(sc, reg) bus_read_1(sc->mem_res, reg)
|
||||
|
||||
/*
|
||||
* aux. memory space access macros
|
||||
*/
|
||||
#define CSR_MEM_AUX_WRITE_4(sc, reg, val) \
|
||||
bus_space_write_4(sc->an_mem_aux_btag, sc->an_mem_aux_bhandle, reg, val)
|
||||
bus_write_4(sc->mem_aux_res, reg, val)
|
||||
|
||||
#define CSR_MEM_AUX_READ_4(sc, reg) \
|
||||
bus_space_read_4(sc->an_mem_aux_btag, sc->an_mem_aux_bhandle, reg)
|
||||
bus_read_4(sc->mem_aux_res, reg)
|
||||
|
||||
#define CSR_MEM_AUX_WRITE_1(sc, reg, val) \
|
||||
bus_space_write_1(sc->an_mem_aux_btag, sc->an_mem_aux_bhandle, reg, val)
|
||||
bus_write_1(sc->mem_aux_res, reg, val)
|
||||
|
||||
#define CSR_MEM_AUX_READ_1(sc, reg) \
|
||||
bus_space_read_1(sc->an_mem_aux_btag, sc->an_mem_aux_bhandle, reg)
|
||||
bus_read_1(sc->mem_aux_res, reg)
|
||||
|
||||
/*
|
||||
* Size of Aironet I/O space.
|
||||
@ -394,13 +386,18 @@ struct an_txframe_802_3 {
|
||||
#define AN_PAYLOADTYPE_ETHER 0x0000
|
||||
#define AN_PAYLOADTYPE_LLC 0x0010
|
||||
|
||||
#define AN_TXCTL_80211 \
|
||||
(AN_TXCTL_TXOK_INTR|AN_TXCTL_TXERR_INTR|AN_HEADERTYPE_80211| \
|
||||
AN_PAYLOADTYPE_LLC|AN_TXCTL_NORELEASE)
|
||||
#define AN_TXCTL_80211 (AN_HEADERTYPE_80211|AN_PAYLOADTYPE_LLC)
|
||||
|
||||
#define AN_TXCTL_8023 \
|
||||
(AN_TXCTL_TXOK_INTR|AN_TXCTL_TXERR_INTR|AN_HEADERTYPE_8023| \
|
||||
AN_PAYLOADTYPE_ETHER|AN_TXCTL_NORELEASE)
|
||||
#define AN_TXCTL_8023 (AN_HEADERTYPE_8023|AN_PAYLOADTYPE_ETHER)
|
||||
|
||||
/*
|
||||
* Additions to transmit control bits for MPI350
|
||||
*/
|
||||
#define AN_TXCTL_HW(x) \
|
||||
( x ? (AN_TXCTL_NORELEASE) \
|
||||
: \
|
||||
(AN_TXCTL_TXOK_INTR|AN_TXCTL_TXERR_INTR|AN_TXCTL_NORELEASE) \
|
||||
)
|
||||
|
||||
#define AN_TXGAP_80211 0
|
||||
#define AN_TXGAP_8023 0
|
||||
@ -442,8 +439,6 @@ struct an_tx_ring_data {
|
||||
struct an_softc {
|
||||
struct ifnet *an_ifp;
|
||||
|
||||
int an_unit;
|
||||
|
||||
int port_rid; /* resource id for port range */
|
||||
struct resource* port_res; /* resource for port range */
|
||||
int mem_rid; /* resource id for memory range */
|
||||
@ -456,11 +451,6 @@ struct an_softc {
|
||||
void* irq_handle; /* handle for irq handler */
|
||||
struct resource* irq_res; /* resource for irq */
|
||||
|
||||
bus_space_handle_t an_bhandle_p;
|
||||
bus_space_handle_t an_bhandle;
|
||||
bus_space_tag_t an_btag;
|
||||
bus_space_handle_t an_mem_bhandle;
|
||||
bus_space_tag_t an_mem_btag;
|
||||
bus_space_handle_t an_mem_aux_bhandle;
|
||||
bus_space_tag_t an_mem_aux_btag;
|
||||
bus_dma_tag_t an_dtag;
|
||||
@ -491,6 +481,7 @@ struct an_softc {
|
||||
struct ifmedia an_ifmedia;
|
||||
int an_monitor;
|
||||
int an_was_monitor;
|
||||
int an_timer;
|
||||
u_char buf_802_11[MCLBYTES];
|
||||
struct an_req areq;
|
||||
unsigned short* an_flash_buffer;
|
||||
@ -513,7 +504,7 @@ int an_pci_probe (device_t);
|
||||
int an_probe (device_t);
|
||||
int an_shutdown (device_t);
|
||||
void an_resume (device_t);
|
||||
int an_attach (struct an_softc *, int, int);
|
||||
int an_attach (struct an_softc *, int);
|
||||
int an_detach (device_t);
|
||||
void an_stop (struct an_softc *);
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include <sys/bus.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/ethernet.h>
|
||||
|
@ -106,7 +106,7 @@ static void bwi_start(struct ifnet *);
|
||||
static void bwi_start_locked(struct ifnet *);
|
||||
static int bwi_raw_xmit(struct ieee80211_node *, struct mbuf *,
|
||||
const struct ieee80211_bpf_params *);
|
||||
static void bwi_watchdog(struct ifnet *);
|
||||
static void bwi_watchdog(void *);
|
||||
static void bwi_scan_start(struct ieee80211com *);
|
||||
static void bwi_set_channel(struct ieee80211com *);
|
||||
static void bwi_scan_end(struct ieee80211com *);
|
||||
@ -461,10 +461,10 @@ bwi_attach(struct bwi_softc *sc)
|
||||
ifp->if_init = bwi_init;
|
||||
ifp->if_ioctl = bwi_ioctl;
|
||||
ifp->if_start = bwi_start;
|
||||
ifp->if_watchdog = bwi_watchdog;
|
||||
IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen);
|
||||
ifp->if_snd.ifq_drv_maxlen = ifqmaxlen;
|
||||
IFQ_SET_READY(&ifp->if_snd);
|
||||
callout_init_mtx(&sc->sc_watchdog_timer, &sc->sc_mtx, 0);
|
||||
|
||||
/*
|
||||
* Setup ratesets, phytype, channels and get MAC address
|
||||
@ -537,11 +537,11 @@ bwi_attach(struct bwi_softc *sc)
|
||||
/*
|
||||
* Add sysctl nodes
|
||||
*/
|
||||
SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev),
|
||||
SYSCTL_ADD_INT(device_get_sysctl_ctx(dev),
|
||||
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
|
||||
"fw_version", CTLFLAG_RD, &sc->sc_fw_version, 0,
|
||||
"Firmware version");
|
||||
SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev),
|
||||
SYSCTL_ADD_INT(device_get_sysctl_ctx(dev),
|
||||
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
|
||||
"led_idle", CTLFLAG_RW, &sc->sc_led_idle, 0,
|
||||
"# ticks before LED enters idle state");
|
||||
@ -577,6 +577,7 @@ bwi_detach(struct bwi_softc *sc)
|
||||
bwi_stop(sc, 1);
|
||||
callout_drain(&sc->sc_led_blink_ch);
|
||||
callout_drain(&sc->sc_calib_ch);
|
||||
callout_drain(&sc->sc_watchdog_timer);
|
||||
ieee80211_ifdetach(ic);
|
||||
|
||||
for (i = 0; i < sc->sc_nmac; ++i)
|
||||
@ -1288,6 +1289,7 @@ bwi_init_statechg(struct bwi_softc *sc, int statechg)
|
||||
sc->sc_flags &= ~BWI_F_STOP;
|
||||
|
||||
ifp->if_drv_flags |= IFF_DRV_RUNNING;
|
||||
callout_reset(&sc->sc_watchdog_timer, hz, bwi_watchdog, sc);
|
||||
|
||||
/* Enable intrs */
|
||||
bwi_enable_intrs(sc, BWI_INIT_INTRS);
|
||||
@ -1426,7 +1428,7 @@ bwi_start_locked(struct ifnet *ifp)
|
||||
tbd->tbd_idx = idx;
|
||||
|
||||
if (trans)
|
||||
ifp->if_timer = 5;
|
||||
sc->sc_tx_timer = 5;
|
||||
}
|
||||
|
||||
static int
|
||||
@ -1467,7 +1469,7 @@ bwi_raw_xmit(struct ieee80211_node *ni, struct mbuf *m,
|
||||
if (++tbd->tbd_used + BWI_TX_NSPRDESC >= BWI_TX_NDESC)
|
||||
ifp->if_drv_flags |= IFF_DRV_OACTIVE;
|
||||
tbd->tbd_idx = (idx + 1) % BWI_TX_NDESC;
|
||||
ifp->if_timer = 5;
|
||||
sc->sc_tx_timer = 5;
|
||||
} else {
|
||||
/* NB: m is reclaimed on encap failure */
|
||||
ieee80211_free_node(ni);
|
||||
@ -1478,17 +1480,20 @@ bwi_raw_xmit(struct ieee80211_node *ni, struct mbuf *m,
|
||||
}
|
||||
|
||||
static void
|
||||
bwi_watchdog(struct ifnet *ifp)
|
||||
bwi_watchdog(void *arg)
|
||||
{
|
||||
struct bwi_softc *sc = ifp->if_softc;
|
||||
struct bwi_softc *sc;
|
||||
struct ifnet *ifp;
|
||||
|
||||
BWI_LOCK(sc);
|
||||
if ((ifp->if_drv_flags & IFF_DRV_RUNNING)) {
|
||||
sc = arg;
|
||||
ifp = sc->sc_ifp;
|
||||
BWI_ASSERT_LOCKED(sc);
|
||||
if (sc->sc_tx_timer != 0 && --sc->sc_tx_timer == 0) {
|
||||
if_printf(ifp, "watchdog timeout\n");
|
||||
ifp->if_oerrors++;
|
||||
taskqueue_enqueue(sc->sc_tq, &sc->sc_restart_task);
|
||||
}
|
||||
BWI_UNLOCK(sc);
|
||||
callout_reset(&sc->sc_watchdog_timer, hz, bwi_watchdog, sc);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1544,7 +1549,7 @@ bwi_stop_locked(struct bwi_softc *sc, int statechg)
|
||||
bwi_bbp_power_off(sc);
|
||||
|
||||
sc->sc_tx_timer = 0;
|
||||
ifp->if_timer = 0;
|
||||
callout_stop(&sc->sc_watchdog_timer);
|
||||
ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
|
||||
}
|
||||
|
||||
@ -3397,7 +3402,7 @@ _bwi_txeof(struct bwi_softc *sc, uint16_t tx_id, int acked, int data_txcnt)
|
||||
tb->tb_mbuf = NULL;
|
||||
|
||||
if (tbd->tbd_used == 0)
|
||||
ifp->if_timer = 0;
|
||||
sc->sc_tx_timer = 0;
|
||||
|
||||
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
|
||||
}
|
||||
@ -3899,7 +3904,7 @@ bwi_led_attach(struct bwi_softc *sc)
|
||||
"%dth led, act %d, lowact %d\n", i,
|
||||
led->l_act, led->l_flags & BWI_LED_F_ACTLOW);
|
||||
}
|
||||
callout_init(&sc->sc_led_blink_ch, CALLOUT_MPSAFE);
|
||||
callout_init_mtx(&sc->sc_led_blink_ch, &sc->sc_mtx, 0);
|
||||
}
|
||||
|
||||
static __inline uint16_t
|
||||
|
@ -571,6 +571,7 @@ struct bwi_softc {
|
||||
bus_space_handle_t sc_mem_bh;
|
||||
|
||||
struct callout sc_calib_ch;
|
||||
struct callout sc_watchdog_timer;
|
||||
|
||||
struct bwi_regwin *sc_cur_regwin;
|
||||
struct bwi_regwin sc_com_regwin;
|
||||
|
@ -199,6 +199,8 @@ static devclass_t ipw_devclass;
|
||||
|
||||
DRIVER_MODULE(ipw, pci, ipw_driver, ipw_devclass, 0, 0);
|
||||
|
||||
MODULE_VERSION(ipw, 1);
|
||||
|
||||
static int
|
||||
ipw_probe(device_t dev)
|
||||
{
|
||||
@ -289,8 +291,8 @@ ipw_attach(device_t dev)
|
||||
ifp->if_init = ipw_init;
|
||||
ifp->if_ioctl = ipw_ioctl;
|
||||
ifp->if_start = ipw_start;
|
||||
IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);
|
||||
ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN;
|
||||
IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen);
|
||||
ifp->if_snd.ifq_drv_maxlen = ifqmaxlen;
|
||||
IFQ_SET_READY(&ifp->if_snd);
|
||||
|
||||
ic->ic_ifp = ifp;
|
||||
@ -888,10 +890,10 @@ ipw_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
|
||||
/*
|
||||
* XXX when joining an ibss network we are called
|
||||
* with a SCAN -> RUN transition on scan complete.
|
||||
* Use that to call ipw_auth_and_assoc. On completing
|
||||
* the join we are then called again with an
|
||||
* AUTH -> RUN transition and we want to do nothing.
|
||||
* This is all totally bogus and needs to be redone.
|
||||
* Use that to call ipw_assoc. On completing the
|
||||
* join we are then called again with an AUTH -> RUN
|
||||
* transition and we want to do nothing. This is
|
||||
* all totally bogus and needs to be redone.
|
||||
*/
|
||||
if (ostate == IEEE80211_S_SCAN)
|
||||
ipw_assoc(ic, vap);
|
||||
@ -904,12 +906,19 @@ ipw_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
|
||||
break;
|
||||
|
||||
case IEEE80211_S_AUTH:
|
||||
/*
|
||||
* Move to ASSOC state after the ipw_assoc() call. Firmware
|
||||
* takes care of authentication, after the call we'll receive
|
||||
* only an assoc response which would otherwise be discared
|
||||
* if we are still in AUTH state.
|
||||
*/
|
||||
nstate = IEEE80211_S_ASSOC;
|
||||
ipw_assoc(ic, vap);
|
||||
break;
|
||||
|
||||
case IEEE80211_S_ASSOC:
|
||||
/*
|
||||
* If we are not transitioning from AUTH the resend the
|
||||
* If we are not transitioning from AUTH then resend the
|
||||
* association request.
|
||||
*/
|
||||
if (ostate != IEEE80211_S_AUTH)
|
||||
@ -1021,7 +1030,6 @@ ipw_rx_newstate_intr(struct ipw_softc *sc, struct ipw_soft_buf *sbuf)
|
||||
}
|
||||
sc->flags &= ~IPW_FLAG_ASSOCIATING;
|
||||
sc->flags |= IPW_FLAG_ASSOCIATED;
|
||||
ieee80211_new_state(vap, IEEE80211_S_RUN, -1);
|
||||
break;
|
||||
|
||||
case IPW_STATE_SCANNING:
|
||||
@ -1034,8 +1042,10 @@ ipw_rx_newstate_intr(struct ipw_softc *sc, struct ipw_soft_buf *sbuf)
|
||||
* we checked the 802.11 layer state.
|
||||
*/
|
||||
if (sc->flags & IPW_FLAG_ASSOCIATED) {
|
||||
IPW_UNLOCK(sc);
|
||||
/* XXX probably need to issue disassoc to fw */
|
||||
ieee80211_beacon_miss(ic);
|
||||
IPW_LOCK(sc);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1054,7 +1064,9 @@ ipw_rx_newstate_intr(struct ipw_softc *sc, struct ipw_soft_buf *sbuf)
|
||||
break;
|
||||
}
|
||||
if (sc->flags & IPW_FLAG_SCANNING) {
|
||||
IPW_UNLOCK(sc);
|
||||
ieee80211_scan_done(vap);
|
||||
IPW_LOCK(sc);
|
||||
sc->flags &= ~IPW_FLAG_SCANNING;
|
||||
sc->sc_scan_timer = 0;
|
||||
}
|
||||
@ -1064,8 +1076,11 @@ ipw_rx_newstate_intr(struct ipw_softc *sc, struct ipw_soft_buf *sbuf)
|
||||
DPRINTFN(2, ("Association lost (%s flags 0x%x)\n",
|
||||
IEEESTATE(vap), sc->flags));
|
||||
sc->flags &= ~(IPW_FLAG_ASSOCIATING | IPW_FLAG_ASSOCIATED);
|
||||
if (vap->iv_state == IEEE80211_S_RUN)
|
||||
if (vap->iv_state == IEEE80211_S_RUN) {
|
||||
IPW_UNLOCK(sc);
|
||||
ieee80211_new_state(vap, IEEE80211_S_SCAN, -1);
|
||||
IPW_LOCK(sc);
|
||||
}
|
||||
break;
|
||||
|
||||
case IPW_STATE_DISABLED:
|
||||
@ -1164,7 +1179,6 @@ ipw_rx_data_intr(struct ipw_softc *sc, struct ipw_status *status,
|
||||
bus_addr_t physaddr;
|
||||
int error;
|
||||
int8_t rssi, nf;
|
||||
IPW_LOCK_DECL;
|
||||
|
||||
DPRINTFN(5, ("received frame len=%u, rssi=%u\n", le32toh(status->len),
|
||||
status->rssi));
|
||||
@ -1234,10 +1248,10 @@ ipw_rx_data_intr(struct ipw_softc *sc, struct ipw_status *status,
|
||||
IPW_UNLOCK(sc);
|
||||
ni = ieee80211_find_rxnode(ic, mtod(m, struct ieee80211_frame_min *));
|
||||
if (ni != NULL) {
|
||||
(void) ieee80211_input(ni, m, rssi, nf);
|
||||
(void) ieee80211_input(ni, m, rssi - nf, nf);
|
||||
ieee80211_free_node(ni);
|
||||
} else
|
||||
(void) ieee80211_input_all(ic, m, rssi, nf);
|
||||
(void) ieee80211_input_all(ic, m, rssi - nf, nf);
|
||||
IPW_LOCK(sc);
|
||||
|
||||
bus_dmamap_sync(sc->rbd_dmat, sc->rbd_map, BUS_DMASYNC_PREWRITE);
|
||||
@ -1378,8 +1392,11 @@ ipw_fatal_error_intr(struct ipw_softc *sc)
|
||||
struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
|
||||
|
||||
device_printf(sc->sc_dev, "firmware error\n");
|
||||
if (vap != NULL)
|
||||
if (vap != NULL) {
|
||||
IPW_UNLOCK(sc);
|
||||
ieee80211_cancel_scan(vap);
|
||||
IPW_LOCK(sc);
|
||||
}
|
||||
ieee80211_runtask(ic, &sc->sc_init_task);
|
||||
}
|
||||
|
||||
@ -1388,7 +1405,6 @@ ipw_intr(void *arg)
|
||||
{
|
||||
struct ipw_softc *sc = arg;
|
||||
uint32_t r;
|
||||
IPW_LOCK_DECL;
|
||||
|
||||
IPW_LOCK(sc);
|
||||
|
||||
@ -1728,7 +1744,6 @@ static void
|
||||
ipw_start(struct ifnet *ifp)
|
||||
{
|
||||
struct ipw_softc *sc = ifp->if_softc;
|
||||
IPW_LOCK_DECL;
|
||||
|
||||
IPW_LOCK(sc);
|
||||
ipw_start_locked(ifp);
|
||||
@ -1785,7 +1800,9 @@ ipw_watchdog(void *arg)
|
||||
DPRINTFN(3, ("Scan timeout\n"));
|
||||
/* End the scan */
|
||||
if (sc->flags & IPW_FLAG_SCANNING) {
|
||||
IPW_UNLOCK(sc);
|
||||
ieee80211_scan_done(TAILQ_FIRST(&ic->ic_vaps));
|
||||
IPW_LOCK(sc);
|
||||
sc->flags &= ~IPW_FLAG_SCANNING;
|
||||
}
|
||||
}
|
||||
@ -1801,7 +1818,6 @@ ipw_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
|
||||
struct ieee80211com *ic = ifp->if_l2com;
|
||||
struct ifreq *ifr = (struct ifreq *) data;
|
||||
int error = 0, startall = 0;
|
||||
IPW_LOCK_DECL;
|
||||
|
||||
switch (cmd) {
|
||||
case SIOCSIFFLAGS:
|
||||
@ -2211,7 +2227,6 @@ ipw_assoc(struct ieee80211com *ic, struct ieee80211vap *vap)
|
||||
struct ipw_security security;
|
||||
uint32_t data;
|
||||
int error;
|
||||
IPW_LOCK_DECL;
|
||||
|
||||
IPW_LOCK(sc);
|
||||
error = ipw_disable(sc);
|
||||
@ -2270,8 +2285,8 @@ ipw_assoc(struct ieee80211com *ic, struct ieee80211vap *vap)
|
||||
if (error != 0)
|
||||
goto done;
|
||||
|
||||
if (vap->iv_appie_assocreq != NULL) {
|
||||
struct ieee80211_appie *ie = vap->iv_appie_assocreq;
|
||||
if (vap->iv_appie_wpa != NULL) {
|
||||
struct ieee80211_appie *ie = vap->iv_appie_wpa;
|
||||
error = ipw_setwpaie(sc, ie->ie_data, ie->ie_len);
|
||||
if (error != 0)
|
||||
goto done;
|
||||
@ -2301,7 +2316,6 @@ ipw_disassoc(struct ieee80211com *ic, struct ieee80211vap *vap)
|
||||
struct ifnet *ifp = vap->iv_ic->ic_ifp;
|
||||
struct ieee80211_node *ni = vap->iv_bss;
|
||||
struct ipw_softc *sc = ifp->if_softc;
|
||||
IPW_LOCK_DECL;
|
||||
|
||||
IPW_LOCK(sc);
|
||||
DPRINTF(("Disassociate from %6D\n", ni->ni_bssid, ":"));
|
||||
@ -2337,7 +2351,6 @@ ipw_init(void *priv)
|
||||
struct ipw_softc *sc = priv;
|
||||
struct ifnet *ifp = sc->sc_ifp;
|
||||
struct ieee80211com *ic = ifp->if_l2com;
|
||||
IPW_LOCK_DECL;
|
||||
|
||||
IPW_LOCK(sc);
|
||||
ipw_init_locked(sc);
|
||||
@ -2504,19 +2517,19 @@ ipw_config(struct ipw_softc *sc)
|
||||
if (error != 0)
|
||||
return error;
|
||||
|
||||
data = htole32(0x3); /* 1, 2 */
|
||||
data = htole32(0xf); /* 1, 2, 5.5, 11 */
|
||||
DPRINTF(("Setting basic tx rates to 0x%x\n", le32toh(data)));
|
||||
error = ipw_cmd(sc, IPW_CMD_SET_BASIC_TX_RATES, &data, sizeof data);
|
||||
if (error != 0)
|
||||
return error;
|
||||
|
||||
/* NB: use the same rate set */
|
||||
/* Use the same rate set */
|
||||
DPRINTF(("Setting msdu tx rates to 0x%x\n", le32toh(data)));
|
||||
error = ipw_cmd(sc, IPW_CMD_SET_MSDU_TX_RATES, &data, sizeof data);
|
||||
if (error != 0)
|
||||
return error;
|
||||
|
||||
data = htole32(0xf); /* 1, 2, 5.5, 11 */
|
||||
/* Use the same rate set */
|
||||
DPRINTF(("Setting tx rates to 0x%x\n", le32toh(data)));
|
||||
error = ipw_cmd(sc, IPW_CMD_SET_TX_RATES, &data, sizeof data);
|
||||
if (error != 0)
|
||||
@ -2544,7 +2557,6 @@ static void
|
||||
ipw_stop(void *priv)
|
||||
{
|
||||
struct ipw_softc *sc = priv;
|
||||
IPW_LOCK_DECL;
|
||||
|
||||
IPW_LOCK(sc);
|
||||
ipw_stop_locked(sc);
|
||||
@ -2671,7 +2683,6 @@ ipw_scan_start(struct ieee80211com *ic)
|
||||
{
|
||||
struct ifnet *ifp = ic->ic_ifp;
|
||||
struct ipw_softc *sc = ifp->if_softc;
|
||||
IPW_LOCK_DECL;
|
||||
|
||||
IPW_LOCK(sc);
|
||||
ipw_scan(sc);
|
||||
@ -2683,7 +2694,6 @@ ipw_set_channel(struct ieee80211com *ic)
|
||||
{
|
||||
struct ifnet *ifp = ic->ic_ifp;
|
||||
struct ipw_softc *sc = ifp->if_softc;
|
||||
IPW_LOCK_DECL;
|
||||
|
||||
IPW_LOCK(sc);
|
||||
if (ic->ic_opmode == IEEE80211_M_MONITOR) {
|
||||
@ -2711,7 +2721,6 @@ ipw_scan_end(struct ieee80211com *ic)
|
||||
{
|
||||
struct ifnet *ifp = ic->ic_ifp;
|
||||
struct ipw_softc *sc = ifp->if_softc;
|
||||
IPW_LOCK_DECL;
|
||||
|
||||
IPW_LOCK(sc);
|
||||
sc->flags &= ~IPW_FLAG_SCANNING;
|
||||
|
@ -168,13 +168,6 @@ struct ipw_softc {
|
||||
* NB.: This models the only instance of async locking in ipw_init_locked
|
||||
* and must be kept in sync.
|
||||
*/
|
||||
#define IPW_LOCK_DECL int __waslocked = 0
|
||||
#define IPW_LOCK(sc) do { \
|
||||
if (!(__waslocked = mtx_owned(&(sc)->sc_mtx))) \
|
||||
mtx_lock(&sc->sc_mtx); \
|
||||
} while (0)
|
||||
#define IPW_UNLOCK(sc) do { \
|
||||
if (!__waslocked) \
|
||||
mtx_unlock(&sc->sc_mtx); \
|
||||
} while (0)
|
||||
#define IPW_LOCK(sc) mtx_lock(&sc->sc_mtx);
|
||||
#define IPW_UNLOCK(sc) mtx_unlock(&sc->sc_mtx);
|
||||
#define IPW_LOCK_ASSERT(sc) mtx_assert(&(sc)->sc_mtx, MA_OWNED)
|
||||
|
@ -232,6 +232,8 @@ static devclass_t iwi_devclass;
|
||||
|
||||
DRIVER_MODULE(iwi, pci, iwi_driver, iwi_devclass, 0, 0);
|
||||
|
||||
MODULE_VERSION(iwi, 1);
|
||||
|
||||
static __inline uint8_t
|
||||
MEM_READ_1(struct iwi_softc *sc, uint32_t addr)
|
||||
{
|
||||
@ -397,11 +399,11 @@ iwi_attach(device_t dev)
|
||||
val = iwi_read_prom_word(sc, IWI_EEPROM_MAC + 2);
|
||||
macaddr[4] = val & 0xff;
|
||||
macaddr[5] = val >> 8;
|
||||
|
||||
|
||||
bands = 0;
|
||||
setbit(&bands, IEEE80211_MODE_11B);
|
||||
setbit(&bands, IEEE80211_MODE_11G);
|
||||
if (pci_get_device(dev) >= 0x4223)
|
||||
if (pci_get_device(dev) >= 0x4223)
|
||||
setbit(&bands, IEEE80211_MODE_11A);
|
||||
ieee80211_init_channels(ic, NULL, &bands);
|
||||
|
||||
@ -570,7 +572,7 @@ iwi_alloc_cmd_ring(struct iwi_softc *sc, struct iwi_cmd_ring *ring, int count)
|
||||
|
||||
error = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), 4, 0,
|
||||
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
|
||||
count * IWI_CMD_DESC_SIZE, 1, count * IWI_CMD_DESC_SIZE, 0,
|
||||
count * IWI_CMD_DESC_SIZE, 1, count * IWI_CMD_DESC_SIZE, 0,
|
||||
NULL, NULL, &ring->desc_dmat);
|
||||
if (error != 0) {
|
||||
device_printf(sc->sc_dev, "could not create desc DMA tag\n");
|
||||
@ -615,7 +617,7 @@ iwi_free_cmd_ring(struct iwi_softc *sc, struct iwi_cmd_ring *ring)
|
||||
}
|
||||
|
||||
if (ring->desc_dmat != NULL)
|
||||
bus_dma_tag_destroy(ring->desc_dmat);
|
||||
bus_dma_tag_destroy(ring->desc_dmat);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -632,7 +634,7 @@ iwi_alloc_tx_ring(struct iwi_softc *sc, struct iwi_tx_ring *ring, int count,
|
||||
|
||||
error = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), 4, 0,
|
||||
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
|
||||
count * IWI_TX_DESC_SIZE, 1, count * IWI_TX_DESC_SIZE, 0, NULL,
|
||||
count * IWI_TX_DESC_SIZE, 1, count * IWI_TX_DESC_SIZE, 0, NULL,
|
||||
NULL, &ring->desc_dmat);
|
||||
if (error != 0) {
|
||||
device_printf(sc->sc_dev, "could not create desc DMA tag\n");
|
||||
@ -911,7 +913,7 @@ iwi_node_free(struct ieee80211_node *ni)
|
||||
sc->sc_node_free(ni);
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Convert h/w rate code to IEEE rate code.
|
||||
*/
|
||||
static int
|
||||
@ -2937,7 +2939,7 @@ iwi_auth_and_assoc(struct iwi_softc *sc, struct ieee80211vap *vap)
|
||||
* key setup. This typically is due to a user app bug
|
||||
* but if we blindly grab the key the firmware will
|
||||
* barf so avoid it for now.
|
||||
*/
|
||||
*/
|
||||
if (vap->iv_def_txkey != IEEE80211_KEYIX_NONE)
|
||||
assoc->auth |= vap->iv_def_txkey << 4;
|
||||
|
||||
@ -3519,14 +3521,14 @@ iwi_ledattach(struct iwi_softc *sc)
|
||||
SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
|
||||
"softled", CTLTYPE_INT | CTLFLAG_RW, sc, 0,
|
||||
iwi_sysctl_softled, "I", "enable/disable software LED support");
|
||||
SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
|
||||
SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
|
||||
"ledpin", CTLFLAG_RW, &sc->sc_ledpin, 0,
|
||||
"pin setting to turn activity LED on");
|
||||
SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
|
||||
SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
|
||||
"ledidle", CTLFLAG_RW, &sc->sc_ledidle, 0,
|
||||
"idle time for inactivity LED (ticks)");
|
||||
/* XXX for debugging */
|
||||
SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
|
||||
SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
|
||||
"nictype", CTLFLAG_RD, &sc->sc_nictype, 0,
|
||||
"NIC type from EEPROM");
|
||||
|
||||
|
@ -29,7 +29,7 @@ __FBSDID("$FreeBSD$");
|
||||
* state and told to load boot firmware. The boot firmware loads an init and a
|
||||
* main binary firmware image into SRAM on the card via DMA.
|
||||
* Once the firmware is loaded, the driver/hw then
|
||||
* communicate by way of circular dma rings via the the SRAM to the firmware.
|
||||
* communicate by way of circular dma rings via the SRAM to the firmware.
|
||||
*
|
||||
* There is 6 memory rings. 1 command ring, 1 rx data ring & 4 tx data rings.
|
||||
* The 4 tx data rings allow for prioritization QoS.
|
||||
@ -181,7 +181,7 @@ static uint32_t wpi_mem_read(struct wpi_softc *, uint16_t);
|
||||
static void wpi_mem_write(struct wpi_softc *, uint16_t, uint32_t);
|
||||
static void wpi_mem_write_region_4(struct wpi_softc *, uint16_t,
|
||||
const uint32_t *, int);
|
||||
static int wpi_read_prom_data(struct wpi_softc *, uint32_t, void *, int);
|
||||
static uint16_t wpi_read_prom_data(struct wpi_softc *, uint32_t, void *, int);
|
||||
static int wpi_alloc_fwmem(struct wpi_softc *);
|
||||
static void wpi_free_fwmem(struct wpi_softc *);
|
||||
static int wpi_load_firmware(struct wpi_softc *);
|
||||
@ -273,6 +273,8 @@ static devclass_t wpi_devclass;
|
||||
|
||||
DRIVER_MODULE(wpi, pci, wpi_driver, wpi_devclass, 0, 0);
|
||||
|
||||
MODULE_VERSION(wpi, 1);
|
||||
|
||||
static const uint8_t wpi_ridx_to_plcp[] = {
|
||||
/* OFDM: IEEE Std 802.11a-1999, pp. 14 Table 80 */
|
||||
/* R1-R4 (ral/ural is R4-R1) */
|
||||
@ -488,7 +490,7 @@ wpi_attach(device_t dev)
|
||||
struct wpi_softc *sc = device_get_softc(dev);
|
||||
struct ifnet *ifp;
|
||||
struct ieee80211com *ic;
|
||||
int ac, error, result, supportsa = 1;
|
||||
int ac, error, supportsa = 1;
|
||||
uint32_t tmp;
|
||||
const struct wpi_ident *ident;
|
||||
uint8_t macaddr[IEEE80211_ADDR_LEN];
|
||||
@ -545,9 +547,6 @@ wpi_attach(device_t dev)
|
||||
sc->sc_sh = rman_get_bushandle(sc->mem);
|
||||
|
||||
sc->irq_rid = 0;
|
||||
if ((result = pci_msi_count(dev)) == 1 &&
|
||||
pci_alloc_msi(dev, &result) == 0)
|
||||
sc->irq_rid = 1;
|
||||
sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->irq_rid,
|
||||
RF_ACTIVE | RF_SHAREABLE);
|
||||
if (sc->irq == NULL) {
|
||||
@ -747,8 +746,6 @@ wpi_detach(device_t dev)
|
||||
if (sc->irq != NULL) {
|
||||
bus_teardown_intr(dev, sc->irq, sc->sc_ih);
|
||||
bus_release_resource(dev, SYS_RES_IRQ, sc->irq_rid, sc->irq);
|
||||
if (sc->irq_rid == 1)
|
||||
pci_release_msi(dev);
|
||||
}
|
||||
|
||||
if (sc->mem != NULL)
|
||||
@ -964,7 +961,7 @@ wpi_alloc_rx_ring(struct wpi_softc *sc, struct wpi_rx_ring *ring)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
error = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), 1, 0,
|
||||
error = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), 1, 0,
|
||||
BUS_SPACE_MAXADDR_32BIT,
|
||||
BUS_SPACE_MAXADDR, NULL, NULL, MJUMPAGESIZE, 1,
|
||||
MJUMPAGESIZE, BUS_DMA_NOWAIT, NULL, NULL, &ring->data_dmat);
|
||||
@ -1009,7 +1006,7 @@ wpi_alloc_rx_ring(struct wpi_softc *sc, struct wpi_rx_ring *ring)
|
||||
error = ENOMEM; /* XXX unique code */
|
||||
goto fail;
|
||||
}
|
||||
bus_dmamap_sync(ring->data_dmat, data->map,
|
||||
bus_dmamap_sync(ring->data_dmat, data->map,
|
||||
BUS_DMASYNC_PREWRITE);
|
||||
|
||||
data->m = m;
|
||||
@ -1364,7 +1361,7 @@ wpi_mem_write_region_4(struct wpi_softc *sc, uint16_t addr,
|
||||
* using the traditional bit-bang method. Data is read up until len bytes have
|
||||
* been obtained.
|
||||
*/
|
||||
static int
|
||||
static uint16_t
|
||||
wpi_read_prom_data(struct wpi_softc *sc, uint32_t addr, void *data, int len)
|
||||
{
|
||||
int ntries;
|
||||
@ -2308,7 +2305,7 @@ wpi_mrr_setup(struct wpi_softc *sc)
|
||||
}
|
||||
|
||||
/* setup MRR for control frames */
|
||||
mrr.which = htole32(WPI_MRR_CTL);
|
||||
mrr.which = WPI_MRR_CTL;
|
||||
error = wpi_cmd(sc, WPI_CMD_MRR_SETUP, &mrr, sizeof mrr, 0);
|
||||
if (error != 0) {
|
||||
device_printf(sc->sc_dev,
|
||||
@ -2317,7 +2314,7 @@ wpi_mrr_setup(struct wpi_softc *sc)
|
||||
}
|
||||
|
||||
/* setup MRR for data frames */
|
||||
mrr.which = htole32(WPI_MRR_DATA);
|
||||
mrr.which = WPI_MRR_DATA;
|
||||
error = wpi_cmd(sc, WPI_CMD_MRR_SETUP, &mrr, sizeof mrr, 0);
|
||||
if (error != 0) {
|
||||
device_printf(sc->sc_dev,
|
||||
|
@ -28,11 +28,11 @@ HAIKU_WIFI_FIRMWARE_PACKAGES on iprowifi4965 =
|
||||
iwlwifi-1000-ucode-39.31.5.1 iwlwifi-4965-ucode-228.61.2.24
|
||||
iwlwifi-5000-ucode-8.83.5.1 iwlwifi-5150-ucode-8.24.2.2
|
||||
iwlwifi-6000-ucode-9.221.4.1 iwlwifi-6000g2a-ucode-17.168.5.3
|
||||
iwlwifi-6050-ucode-41.28.5.1 ;
|
||||
iwlwifi-6000g2b-ucode-18.168.6.1 iwlwifi-6050-ucode-41.28.5.1 ;
|
||||
HAIKU_WIFI_FIRMWARE_ARCHIVES on iprowifi4965 =
|
||||
iwlwifi-1000-ucode-39.31.5.1.tgz iwlwifi-4965-ucode-228.61.2.24.tgz
|
||||
iwlwifi-5000-ucode-8.83.5.1.tgz iwlwifi-5150-ucode-8.24.2.2.tgz
|
||||
iwlwifi-6000-ucode-9.221.4.1.tgz iwlwifi-6000g2a-ucode-17.168.5.3.tgz
|
||||
iwlwifi-6050-ucode-41.28.5.1.tgz ;
|
||||
iwlwifi-6000g2b-ucode-18.168.6.1.tgz iwlwifi-6050-ucode-41.28.5.1.tgz ;
|
||||
HAIKU_WIFI_FIRMWARE_DO_EXTRACT on iprowifi4965 = true ;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -27,6 +27,9 @@
|
||||
#define IWN4965_NTXQUEUES 16
|
||||
#define IWN5000_NTXQUEUES 20
|
||||
|
||||
#define IWN4965_FIRSTAGGQUEUE 7
|
||||
#define IWN5000_FIRSTAGGQUEUE 10
|
||||
|
||||
#define IWN4965_NDMACHNLS 7
|
||||
#define IWN5000_NDMACHNLS 8
|
||||
|
||||
@ -50,9 +53,6 @@
|
||||
#define IWN_HIADDR(paddr) (0)
|
||||
#endif
|
||||
|
||||
/* Base Address Register. */
|
||||
#define IWN_PCI_BAR0 PCI_MAPREG_START
|
||||
|
||||
/*
|
||||
* Control and status registers.
|
||||
*/
|
||||
@ -73,6 +73,7 @@
|
||||
#define IWN_UCODE_GP1_CLR 0x05c
|
||||
#define IWN_LED 0x094
|
||||
#define IWN_DRAM_INT_TBL 0x0a0
|
||||
#define IWN_SHADOW_REG_CTRL 0x0a8
|
||||
#define IWN_GIO_CHICKEN 0x100
|
||||
#define IWN_ANA_PLL 0x20c
|
||||
#define IWN_HW_REV_WA 0x22c
|
||||
@ -82,10 +83,10 @@
|
||||
#define IWN_MEM_WADDR 0x410
|
||||
#define IWN_MEM_WDATA 0x418
|
||||
#define IWN_MEM_RDATA 0x41c
|
||||
#define IWN_PRPH_WADDR 0x444
|
||||
#define IWN_PRPH_RADDR 0x448
|
||||
#define IWN_PRPH_WDATA 0x44c
|
||||
#define IWN_PRPH_RDATA 0x450
|
||||
#define IWN_PRPH_WADDR 0x444
|
||||
#define IWN_PRPH_RADDR 0x448
|
||||
#define IWN_PRPH_WDATA 0x44c
|
||||
#define IWN_PRPH_RDATA 0x450
|
||||
#define IWN_HBUS_TARG_WRPTR 0x460
|
||||
|
||||
/*
|
||||
@ -218,6 +219,7 @@
|
||||
#define IWN_GP_DRIVER_RADIO_2X2_HYB (1 << 0)
|
||||
#define IWN_GP_DRIVER_RADIO_2X2_IPA (2 << 0)
|
||||
#define IWN_GP_DRIVER_CALIB_VER6 (1 << 2)
|
||||
#define IWN_GP_DRIVER_6050_1X2 (1 << 3)
|
||||
|
||||
/* Possible flags for register IWN_UCODE_GP1_CLR. */
|
||||
#define IWN_UCODE_GP1_RFKILL (1 << 1)
|
||||
@ -286,8 +288,7 @@
|
||||
#define IWN_FH_TX_CHICKEN_SCHED_RETRY (1 << 1)
|
||||
|
||||
/* Possible flags for register IWN_FH_TX_STATUS. */
|
||||
#define IWN_FH_TX_STATUS_IDLE(chnl) \
|
||||
(1 << ((chnl) + 24) | 1 << ((chnl) + 16))
|
||||
#define IWN_FH_TX_STATUS_IDLE(chnl) (1 << ((chnl) + 16))
|
||||
|
||||
/* Possible flags for register IWN_FH_RX_CONFIG. */
|
||||
#define IWN_FH_RX_CONFIG_ENA (1 << 31)
|
||||
@ -436,6 +437,8 @@ struct iwn_tx_cmd {
|
||||
#define IWN_CMD_SET_CRITICAL_TEMP 164
|
||||
#define IWN_CMD_SET_SENSITIVITY 168
|
||||
#define IWN_CMD_PHY_CALIB 176
|
||||
#define IWN_CMD_BT_COEX_PRIOTABLE 204
|
||||
#define IWN_CMD_BT_COEX_PROT 205
|
||||
|
||||
uint8_t flags;
|
||||
uint8_t idx;
|
||||
@ -489,6 +492,10 @@ struct iwn_rxon {
|
||||
#define IWN_RXON_ANTENNA_A (1 << 8)
|
||||
#define IWN_RXON_ANTENNA_B (1 << 9)
|
||||
#define IWN_RXON_TSF (1 << 15)
|
||||
#define IWN_RXON_HT_HT40MINUS (1 << 22)
|
||||
#define IWN_RXON_HT_PROTMODE(x) (x << 23)
|
||||
#define IWN_RXON_HT_MODEPURE40 (1 << 25)
|
||||
#define IWN_RXON_HT_MODEMIXED (2 << 25)
|
||||
#define IWN_RXON_CTS_TO_SELF (1 << 30)
|
||||
|
||||
uint32_t filter;
|
||||
@ -588,7 +595,10 @@ struct iwn_node_info {
|
||||
uint8_t txmic[8];
|
||||
|
||||
uint32_t htflags;
|
||||
#define IWN_SMPS_MIMO_PROT (1 << 17)
|
||||
#define IWN_AMDPU_SIZE_FACTOR(x) ((x) << 19)
|
||||
#define IWN_NODE_HT40 (1 << 21)
|
||||
#define IWN_SMPS_MIMO_DIS (1 << 22)
|
||||
#define IWN_AMDPU_DENSITY(x) ((x) << 23)
|
||||
|
||||
uint32_t mask;
|
||||
@ -625,8 +635,13 @@ struct iwn4965_node_info {
|
||||
uint32_t reserved7;
|
||||
} __packed;
|
||||
|
||||
#define IWN_RFLAG_CCK (1 << 1)
|
||||
#define IWN_RFLAG_ANT(x) ((x) << 6)
|
||||
#define IWN_RFLAG_MCS (1 << 8)
|
||||
#define IWN_RFLAG_CCK (1 << 9)
|
||||
#define IWN_RFLAG_GREENFIELD (1 << 10)
|
||||
#define IWN_RFLAG_HT40 (1 << 11)
|
||||
#define IWN_RFLAG_DUPLICATE (1 << 12)
|
||||
#define IWN_RFLAG_SGI (1 << 13)
|
||||
#define IWN_RFLAG_ANT(x) ((x) << 14)
|
||||
|
||||
/* Structure for command IWN_CMD_TX_DATA. */
|
||||
struct iwn_cmd_data {
|
||||
@ -647,9 +662,7 @@ struct iwn_cmd_data {
|
||||
#define IWN_TX_NEED_PADDING (1 << 20)
|
||||
|
||||
uint32_t scratch;
|
||||
uint8_t plcp;
|
||||
uint8_t rflags;
|
||||
uint16_t xrflags;
|
||||
uint32_t rate;
|
||||
|
||||
uint8_t id;
|
||||
uint8_t security;
|
||||
@ -690,11 +703,7 @@ struct iwn_cmd_link_quality {
|
||||
uint8_t ampdu_threshold;
|
||||
uint8_t ampdu_max;
|
||||
uint32_t reserved2;
|
||||
struct {
|
||||
uint8_t plcp;
|
||||
uint8_t rflags;
|
||||
uint16_t xrflags;
|
||||
} __packed retry[IWN_MAX_TX_RETRIES];
|
||||
uint32_t retry[IWN_MAX_TX_RETRIES];
|
||||
uint32_t reserved3;
|
||||
} __packed;
|
||||
|
||||
@ -730,6 +739,8 @@ struct iwn5000_wimax_coex {
|
||||
struct iwn5000_calib_elem {
|
||||
uint32_t enable;
|
||||
uint32_t start;
|
||||
#define IWN5000_CALIB_DC (1 << 1)
|
||||
|
||||
uint32_t send;
|
||||
uint32_t apply;
|
||||
uint32_t reserved;
|
||||
@ -831,7 +842,7 @@ struct iwn5000_cmd_txpower {
|
||||
uint8_t reserved;
|
||||
} __packed;
|
||||
|
||||
/* Structure for command IWN_CMD_BLUETOOTH. */
|
||||
/* Structures for command IWN_CMD_BLUETOOTH. */
|
||||
struct iwn_bluetooth {
|
||||
uint8_t flags;
|
||||
#define IWN_BT_COEX_CHAN_ANN (1 << 0)
|
||||
@ -849,6 +860,43 @@ struct iwn_bluetooth {
|
||||
uint32_t kill_cts;
|
||||
} __packed;
|
||||
|
||||
struct iwn6000_btcoex_config {
|
||||
uint8_t flags;
|
||||
uint8_t lead_time;
|
||||
uint8_t max_kill;
|
||||
uint8_t bt3_t7_timer;
|
||||
uint32_t kill_ack;
|
||||
uint32_t kill_cts;
|
||||
uint8_t sample_time;
|
||||
uint8_t bt3_t2_timer;
|
||||
uint16_t bt4_reaction;
|
||||
uint32_t lookup_table[12];
|
||||
uint16_t bt4_decision;
|
||||
uint16_t valid;
|
||||
uint8_t prio_boost;
|
||||
uint8_t tx_prio_boost;
|
||||
uint16_t rx_prio_boost;
|
||||
} __packed;
|
||||
|
||||
struct iwn_btcoex_priotable {
|
||||
uint8_t calib_init1;
|
||||
uint8_t calib_init2;
|
||||
uint8_t calib_periodic_low1;
|
||||
uint8_t calib_periodic_low2;
|
||||
uint8_t calib_periodic_high1;
|
||||
uint8_t calib_periodic_high2;
|
||||
uint8_t dtim;
|
||||
uint8_t scan52;
|
||||
uint8_t scan24;
|
||||
uint8_t reserved[7];
|
||||
} __packed;
|
||||
|
||||
struct iwn_btcoex_prot {
|
||||
uint8_t open;
|
||||
uint8_t type;
|
||||
uint8_t reserved[2];
|
||||
} __packed;
|
||||
|
||||
/* Structure for command IWN_CMD_SET_CRITICAL_TEMP. */
|
||||
struct iwn_critical_temp {
|
||||
uint32_t reserved;
|
||||
@ -860,7 +908,7 @@ struct iwn_critical_temp {
|
||||
#define IWN_CTOMUK(c) (((c) * 1000000) + 273150000)
|
||||
} __packed;
|
||||
|
||||
/* Structure for command IWN_CMD_SET_SENSITIVITY. */
|
||||
/* Structures for command IWN_CMD_SET_SENSITIVITY. */
|
||||
struct iwn_sensitivity_cmd {
|
||||
uint16_t which;
|
||||
#define IWN_SENSITIVITY_DEFAULTTBL 0
|
||||
@ -879,6 +927,34 @@ struct iwn_sensitivity_cmd {
|
||||
uint16_t energy_ofdm_th;
|
||||
} __packed;
|
||||
|
||||
struct iwn_enhanced_sensitivity_cmd {
|
||||
uint16_t which;
|
||||
uint16_t energy_cck;
|
||||
uint16_t energy_ofdm;
|
||||
uint16_t corr_ofdm_x1;
|
||||
uint16_t corr_ofdm_mrc_x1;
|
||||
uint16_t corr_cck_mrc_x4;
|
||||
uint16_t corr_ofdm_x4;
|
||||
uint16_t corr_ofdm_mrc_x4;
|
||||
uint16_t corr_barker;
|
||||
uint16_t corr_barker_mrc;
|
||||
uint16_t corr_cck_x4;
|
||||
uint16_t energy_ofdm_th;
|
||||
/* "Enhanced" part. */
|
||||
uint16_t ina_det_ofdm;
|
||||
uint16_t ina_det_cck;
|
||||
uint16_t corr_11_9_en;
|
||||
uint16_t ofdm_det_slope_mrc;
|
||||
uint16_t ofdm_det_icept_mrc;
|
||||
uint16_t ofdm_det_slope;
|
||||
uint16_t ofdm_det_icept;
|
||||
uint16_t cck_det_slope_mrc;
|
||||
uint16_t cck_det_icept_mrc;
|
||||
uint16_t cck_det_slope;
|
||||
uint16_t cck_det_icept;
|
||||
uint16_t reserved;
|
||||
} __packed;
|
||||
|
||||
/* Structures for command IWN_CMD_PHY_CALIB. */
|
||||
struct iwn_phy_calib {
|
||||
uint8_t code;
|
||||
@ -889,6 +965,8 @@ struct iwn_phy_calib {
|
||||
#define IWN5000_PHY_CALIB_CRYSTAL 15
|
||||
#define IWN5000_PHY_CALIB_BASE_BAND 16
|
||||
#define IWN5000_PHY_CALIB_TX_IQ_PERIODIC 17
|
||||
#define IWN5000_PHY_CALIB_TEMP_OFFSET 18
|
||||
|
||||
#define IWN5000_PHY_CALIB_RESET_NOISE_GAIN 18
|
||||
#define IWN5000_PHY_CALIB_NOISE_GAIN 19
|
||||
|
||||
@ -907,6 +985,17 @@ struct iwn5000_phy_calib_crystal {
|
||||
uint8_t reserved[2];
|
||||
} __packed;
|
||||
|
||||
struct iwn5000_phy_calib_temp_offset {
|
||||
uint8_t code;
|
||||
uint8_t group;
|
||||
uint8_t ngroups;
|
||||
uint8_t isvalid;
|
||||
int16_t offset;
|
||||
#define IWN_DEFAULT_TEMP_OFFSET 2700
|
||||
|
||||
uint16_t reserved;
|
||||
} __packed;
|
||||
|
||||
struct iwn_phy_calib_gain {
|
||||
uint8_t code;
|
||||
uint8_t group;
|
||||
@ -987,9 +1076,7 @@ struct iwn4965_tx_stat {
|
||||
uint8_t btkillcnt;
|
||||
uint8_t rtsfailcnt;
|
||||
uint8_t ackfailcnt;
|
||||
uint8_t rate;
|
||||
uint8_t rflags;
|
||||
uint16_t xrflags;
|
||||
uint32_t rate;
|
||||
uint16_t duration;
|
||||
uint16_t reserved;
|
||||
uint32_t power[2];
|
||||
@ -1001,9 +1088,7 @@ struct iwn5000_tx_stat {
|
||||
uint8_t btkillcnt;
|
||||
uint8_t rtsfailcnt;
|
||||
uint8_t ackfailcnt;
|
||||
uint8_t rate;
|
||||
uint8_t rflags;
|
||||
uint16_t xrflags;
|
||||
uint32_t rate;
|
||||
uint16_t duration;
|
||||
uint16_t reserved;
|
||||
uint32_t power[2];
|
||||
@ -1058,9 +1143,7 @@ struct iwn_rx_stat {
|
||||
|
||||
uint16_t chan;
|
||||
uint8_t phybuf[32];
|
||||
uint8_t rate;
|
||||
uint8_t rflags;
|
||||
uint16_t xrflags;
|
||||
uint32_t rate;
|
||||
uint16_t len;
|
||||
uint16_t reserve3;
|
||||
} __packed;
|
||||
@ -1283,6 +1366,8 @@ struct iwn_fw_tlv {
|
||||
#define IWN_FW_TLV_INIT_DATA 4
|
||||
#define IWN_FW_TLV_BOOT_TEXT 5
|
||||
#define IWN_FW_TLV_PBREQ_MAXLEN 6
|
||||
#define IWN_FW_TLV_ENH_SENS 14
|
||||
#define IWN_FW_TLV_PHY_CALIB 15
|
||||
|
||||
uint16_t alt;
|
||||
uint32_t len;
|
||||
@ -1300,6 +1385,7 @@ struct iwn_fw_tlv {
|
||||
* Offsets into EEPROM.
|
||||
*/
|
||||
#define IWN_EEPROM_MAC 0x015
|
||||
#define IWN_EEPROM_SKU_CAP 0x045
|
||||
#define IWN_EEPROM_RFCFG 0x048
|
||||
#define IWN4965_EEPROM_DOMAIN 0x060
|
||||
#define IWN4965_EEPROM_BAND1 0x063
|
||||
@ -1322,12 +1408,18 @@ struct iwn_fw_tlv {
|
||||
#define IWN5000_EEPROM_BAND4 0x02e
|
||||
#define IWN5000_EEPROM_BAND5 0x03a
|
||||
#define IWN5000_EEPROM_BAND6 0x041
|
||||
#define IWN6000_EEPROM_BAND6 0x040
|
||||
#define IWN5000_EEPROM_BAND7 0x049
|
||||
#define IWN6000_EEPROM_ENHINFO 0x054
|
||||
#define IWN5000_EEPROM_CRYSTAL 0x128
|
||||
#define IWN5000_EEPROM_TEMP 0x12a
|
||||
#define IWN5000_EEPROM_VOLT 0x12b
|
||||
|
||||
/* Possible flags for IWN_EEPROM_SKU_CAP. */
|
||||
#define IWN_EEPROM_SKU_CAP_11N (1 << 6)
|
||||
#define IWN_EEPROM_SKU_CAP_AMT (1 << 7)
|
||||
#define IWN_EEPROM_SKU_CAP_IPAN (1 << 8)
|
||||
|
||||
/* Possible flags for IWN_EEPROM_RFCFG. */
|
||||
#define IWN_RFCFG_TYPE(x) (((x) >> 0) & 0x3)
|
||||
#define IWN_RFCFG_STEP(x) (((x) >> 2) & 0x3)
|
||||
@ -1346,7 +1438,17 @@ struct iwn_eeprom_chan {
|
||||
} __packed;
|
||||
|
||||
struct iwn_eeprom_enhinfo {
|
||||
uint16_t chan;
|
||||
uint8_t flags;
|
||||
#define IWN_ENHINFO_VALID 0x01
|
||||
#define IWN_ENHINFO_5GHZ 0x02
|
||||
#define IWN_ENHINFO_OFDM 0x04
|
||||
#define IWN_ENHINFO_HT40 0x08
|
||||
#define IWN_ENHINFO_HTAP 0x10
|
||||
#define IWN_ENHINFO_RES1 0x20
|
||||
#define IWN_ENHINFO_RES2 0x40
|
||||
#define IWN_ENHINFO_COMMON 0x80
|
||||
|
||||
uint8_t chan;
|
||||
int8_t chain[3]; /* max power in half-dBm */
|
||||
uint8_t reserved;
|
||||
int8_t mimo2; /* max power in half-dBm */
|
||||
@ -1400,6 +1502,16 @@ static const uint32_t iwn5000_regulatory_bands[IWN_NBANDS] = {
|
||||
IWN5000_EEPROM_BAND7
|
||||
};
|
||||
|
||||
static const uint32_t iwn6000_regulatory_bands[IWN_NBANDS] = {
|
||||
IWN5000_EEPROM_BAND1,
|
||||
IWN5000_EEPROM_BAND2,
|
||||
IWN5000_EEPROM_BAND3,
|
||||
IWN5000_EEPROM_BAND4,
|
||||
IWN5000_EEPROM_BAND5,
|
||||
IWN6000_EEPROM_BAND6,
|
||||
IWN5000_EEPROM_BAND7
|
||||
};
|
||||
|
||||
#define IWN_CHAN_BANDS_COUNT 7
|
||||
#define IWN_MAX_CHAN_PER_BAND 14
|
||||
static const struct iwn_chan_band {
|
||||
@ -1419,35 +1531,13 @@ static const struct iwn_chan_band {
|
||||
{ 11, { 36, 44, 52, 60, 100, 108, 116, 124, 132, 149, 157 } }
|
||||
};
|
||||
|
||||
#define IWN1000_OTP_NBLOCKS 3
|
||||
#define IWN6000_OTP_NBLOCKS 4
|
||||
#define IWN1000_OTP_NBLOCKS 3
|
||||
#define IWN6000_OTP_NBLOCKS 4
|
||||
#define IWN6050_OTP_NBLOCKS 7
|
||||
|
||||
/* HW rate indices. */
|
||||
#define IWN_RIDX_CCK1 0
|
||||
#define IWN_RIDX_CCK11 3
|
||||
#define IWN_RIDX_OFDM6 4
|
||||
#define IWN_RIDX_OFDM54 11
|
||||
|
||||
static const struct iwn_rate {
|
||||
uint8_t rate;
|
||||
uint8_t plcp;
|
||||
uint8_t flags;
|
||||
} iwn_rates[IWN_RIDX_MAX + 1] = {
|
||||
{ 2, 10, IWN_RFLAG_CCK },
|
||||
{ 4, 20, IWN_RFLAG_CCK },
|
||||
{ 11, 55, IWN_RFLAG_CCK },
|
||||
{ 22, 110, IWN_RFLAG_CCK },
|
||||
{ 12, 0xd, 0 },
|
||||
{ 18, 0xf, 0 },
|
||||
{ 24, 0x5, 0 },
|
||||
{ 36, 0x7, 0 },
|
||||
{ 48, 0x9, 0 },
|
||||
{ 72, 0xb, 0 },
|
||||
{ 96, 0x1, 0 },
|
||||
{ 108, 0x3, 0 },
|
||||
{ 120, 0x3, 0 }
|
||||
};
|
||||
#define IWN_RIDX_CCK1 0
|
||||
#define IWN_RIDX_OFDM6 4
|
||||
|
||||
#define IWN4965_MAX_PWR_INDEX 107
|
||||
|
||||
@ -1611,13 +1701,13 @@ static const struct iwn_sensitivity_limits iwn5150_sensitivity_limits = {
|
||||
static const struct iwn_sensitivity_limits iwn1000_sensitivity_limits = {
|
||||
120, 155,
|
||||
240, 290,
|
||||
90, 120,
|
||||
90, 120,
|
||||
170, 210,
|
||||
125, 200,
|
||||
170, 400,
|
||||
95,
|
||||
95,
|
||||
95
|
||||
95,
|
||||
95,
|
||||
95
|
||||
};
|
||||
|
||||
static const struct iwn_sensitivity_limits iwn6000_sensitivity_limits = {
|
||||
|
@ -78,6 +78,7 @@ struct iwn_tx_ring {
|
||||
int qid;
|
||||
int queued;
|
||||
int cur;
|
||||
int read;
|
||||
};
|
||||
|
||||
struct iwn_softc;
|
||||
@ -101,7 +102,12 @@ struct iwn_node {
|
||||
struct ieee80211_node ni; /* must be the first */
|
||||
uint16_t disable_tid;
|
||||
uint8_t id;
|
||||
uint8_t ridx[IEEE80211_RATE_MAXSIZE];
|
||||
uint32_t ridx[256];
|
||||
struct {
|
||||
uint64_t bitmap;
|
||||
int startidx;
|
||||
int nframes;
|
||||
} agg[IEEE80211_TID_SIZE];
|
||||
};
|
||||
|
||||
struct iwn_calib_state {
|
||||
@ -157,7 +163,7 @@ struct iwn_fw_info {
|
||||
struct iwn_fw_part boot;
|
||||
};
|
||||
|
||||
struct iwn_hal {
|
||||
struct iwn_ops {
|
||||
int (*load_firmware)(struct iwn_softc *);
|
||||
void (*read_eeprom)(struct iwn_softc *);
|
||||
int (*post_alive)(struct iwn_softc *);
|
||||
@ -174,21 +180,10 @@ struct iwn_hal {
|
||||
int);
|
||||
void (*tx_done)(struct iwn_softc *, struct iwn_rx_desc *,
|
||||
struct iwn_rx_data *);
|
||||
#if 0 /* HT */
|
||||
void (*ampdu_tx_start)(struct iwn_softc *,
|
||||
struct ieee80211_node *, uint8_t, uint16_t);
|
||||
void (*ampdu_tx_stop)(struct iwn_softc *, uint8_t,
|
||||
struct ieee80211_node *, int, uint8_t, uint16_t);
|
||||
void (*ampdu_tx_stop)(struct iwn_softc *, int, uint8_t,
|
||||
uint16_t);
|
||||
#endif
|
||||
int ntxqs;
|
||||
int ndmachnls;
|
||||
uint8_t broadcast_id;
|
||||
int rxonsz;
|
||||
int schedsz;
|
||||
uint32_t fw_text_maxsz;
|
||||
uint32_t fw_data_maxsz;
|
||||
uint32_t fwsz;
|
||||
bus_size_t sched_txfact_addr;
|
||||
};
|
||||
|
||||
struct iwn_vap {
|
||||
@ -201,31 +196,40 @@ struct iwn_vap {
|
||||
#define IWN_VAP(_vap) ((struct iwn_vap *)(_vap))
|
||||
|
||||
struct iwn_softc {
|
||||
device_t sc_dev;
|
||||
|
||||
struct ifnet *sc_ifp;
|
||||
int sc_debug;
|
||||
|
||||
/* Locks */
|
||||
struct mtx sc_mtx;
|
||||
|
||||
/* Bus */
|
||||
device_t sc_dev;
|
||||
int mem_rid;
|
||||
int irq_rid;
|
||||
struct resource *mem;
|
||||
struct resource *irq;
|
||||
|
||||
u_int sc_flags;
|
||||
#define IWN_FLAG_HAS_5GHZ (1 << 0)
|
||||
#define IWN_FLAG_HAS_OTPROM (1 << 1)
|
||||
#define IWN_FLAG_CALIB_DONE (1 << 2)
|
||||
#define IWN_FLAG_USE_ICT (1 << 3)
|
||||
#define IWN_FLAG_INTERNAL_PA (1 << 4)
|
||||
#define IWN_FLAG_HAS_11N (1 << 6)
|
||||
#define IWN_FLAG_ENH_SENS (1 << 7)
|
||||
#define IWN_FLAG_ADV_BTCOEX (1 << 8)
|
||||
|
||||
uint8_t hw_type;
|
||||
const struct iwn_hal *sc_hal;
|
||||
|
||||
struct iwn_ops ops;
|
||||
const char *fwname;
|
||||
const struct iwn_sensitivity_limits
|
||||
*limits;
|
||||
int ntxqs;
|
||||
int firstaggqueue;
|
||||
int ndmachnls;
|
||||
uint8_t broadcast_id;
|
||||
int rxonsz;
|
||||
int schedsz;
|
||||
uint32_t fw_text_maxsz;
|
||||
uint32_t fw_data_maxsz;
|
||||
uint32_t fwsz;
|
||||
bus_size_t sched_txfact_addr;
|
||||
uint32_t reset_noise_gain;
|
||||
uint32_t noise_gain;
|
||||
|
||||
/* TX scheduler rings. */
|
||||
struct iwn_dma_info sched_dma;
|
||||
@ -250,37 +254,28 @@ struct iwn_softc {
|
||||
struct iwn_tx_ring txq[IWN5000_NTXQUEUES];
|
||||
struct iwn_rx_ring rxq;
|
||||
|
||||
int mem_rid;
|
||||
struct resource *mem;
|
||||
bus_space_tag_t sc_st;
|
||||
bus_space_handle_t sc_sh;
|
||||
int irq_rid;
|
||||
struct resource *irq;
|
||||
void *sc_ih;
|
||||
bus_size_t sc_sz;
|
||||
int sc_cap_off; /* PCIe Capabilities. */
|
||||
|
||||
/* Tasks used by the driver */
|
||||
struct task sc_reinit_task;
|
||||
struct task sc_reinit_task;
|
||||
struct task sc_radioon_task;
|
||||
struct task sc_radiooff_task;
|
||||
|
||||
struct callout calib_to;
|
||||
int calib_cnt;
|
||||
struct iwn_calib_state calib;
|
||||
u_int calib_init;
|
||||
u_int calib_runtime;
|
||||
#define IWN_CALIB_XTAL (1 << IWN_CALIB_IDX_XTAL)
|
||||
#define IWN_CALIB_DC (1 << IWN_CALIB_IDX_DC)
|
||||
#define IWN_CALIB_LO (1 << IWN_CALIB_IDX_LO)
|
||||
#define IWN_CALIB_TX_IQ (1 << IWN_CALIB_IDX_TX_IQ)
|
||||
#define IWN_CALIB_TX_IQ_PERIODIC (1 << IWN_CALIB_IDX_TX_IQ_PERIODIC)
|
||||
#define IWN_CALIB_BASE_BAND (1 << IWN_CALIB_IDX_BASE_BAND)
|
||||
#define IWN_CALIB_NUM 6
|
||||
struct iwn_calib_info calib_results[IWN_CALIB_NUM];
|
||||
#define IWN_CALIB_IDX_XTAL 0
|
||||
#define IWN_CALIB_IDX_DC 1
|
||||
#define IWN_CALIB_IDX_LO 2
|
||||
#define IWN_CALIB_IDX_TX_IQ 3
|
||||
#define IWN_CALIB_IDX_TX_IQ_PERIODIC 4
|
||||
#define IWN_CALIB_IDX_BASE_BAND 5
|
||||
struct callout watchdog_to;
|
||||
|
||||
struct iwn_fw_info fw;
|
||||
struct iwn_calib_info calibcmd[5];
|
||||
uint32_t errptr;
|
||||
|
||||
struct iwn_rx_stat last_rx_stat;
|
||||
@ -299,11 +294,12 @@ struct iwn_softc {
|
||||
uint16_t rfcfg;
|
||||
uint8_t calib_ver;
|
||||
char eeprom_domain[4];
|
||||
uint32_t eeprom_crystal;
|
||||
int16_t eeprom_temp;
|
||||
int16_t eeprom_voltage;
|
||||
int8_t maxpwr2GHz;
|
||||
int8_t maxpwr5GHz;
|
||||
int8_t maxpwr[IEEE80211_CHAN_MAX];
|
||||
int8_t enh_maxpwr[35];
|
||||
|
||||
int32_t temp_off;
|
||||
uint32_t int_mask;
|
||||
@ -313,9 +309,22 @@ struct iwn_softc {
|
||||
uint8_t rxchainmask;
|
||||
uint8_t chainmask;
|
||||
|
||||
struct callout sc_timer_to;
|
||||
int sc_tx_timer;
|
||||
|
||||
struct ieee80211_tx_ampdu *qid2tap[IWN5000_NTXQUEUES];
|
||||
|
||||
int (*sc_ampdu_rx_start)(struct ieee80211_node *,
|
||||
struct ieee80211_rx_ampdu *, int, int, int);
|
||||
void (*sc_ampdu_rx_stop)(struct ieee80211_node *,
|
||||
struct ieee80211_rx_ampdu *);
|
||||
int (*sc_addba_request)(struct ieee80211_node *,
|
||||
struct ieee80211_tx_ampdu *, int, int, int);
|
||||
int (*sc_addba_response)(struct ieee80211_node *,
|
||||
struct ieee80211_tx_ampdu *, int, int, int);
|
||||
void (*sc_addba_stop)(struct ieee80211_node *,
|
||||
struct ieee80211_tx_ampdu *);
|
||||
|
||||
|
||||
struct iwn_rx_radiotap_header sc_rxtap;
|
||||
struct iwn_tx_radiotap_header sc_txtap;
|
||||
|
||||
|
@ -24,13 +24,14 @@ NO_HAIKU_FBSD_MII_DRIVER();
|
||||
NO_HAIKU_REENABLE_INTERRUPTS();
|
||||
HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_WLAN);
|
||||
HAIKU_FIRMWARE_VERSION(44417);
|
||||
HAIKU_FIRMWARE_NAME_MAP(7) = {
|
||||
HAIKU_FIRMWARE_NAME_MAP(8) = {
|
||||
{"iwn1000fw", "iwlwifi-1000-5.ucode"},
|
||||
{"iwn4965fw", "iwlwifi-4965-2.ucode"},
|
||||
{"iwn5000fw", "iwlwifi-5000-5.ucode"},
|
||||
{"iwn5150fw", "iwlwifi-5150-2.ucode"},
|
||||
{"iwn6000fw", "iwlwifi-6000-4.ucode"},
|
||||
{"iwn6005fw", "iwlwifi-6000g2a-5.ucode"},
|
||||
{"iwn6000g2afw", "iwlwifi-6000g2a-5.ucode"},
|
||||
{"iwn6000g2bfw", "iwlwifi-6000g2b-6.ucode"},
|
||||
{"iwn6050fw", "iwlwifi-6050-5.ucode"}
|
||||
};
|
||||
|
||||
|
@ -135,7 +135,7 @@ static int malo_setup_hwdma(struct malo_softc *);
|
||||
static void malo_txq_init(struct malo_softc *, struct malo_txq *, int);
|
||||
static void malo_tx_cleanupq(struct malo_softc *, struct malo_txq *);
|
||||
static void malo_start(struct ifnet *);
|
||||
static void malo_watchdog(struct ifnet *);
|
||||
static void malo_watchdog(void *);
|
||||
static int malo_ioctl(struct ifnet *, u_long, caddr_t);
|
||||
static void malo_updateslot(struct ifnet *);
|
||||
static int malo_newstate(struct ieee80211vap *, enum ieee80211_state, int);
|
||||
@ -168,8 +168,8 @@ malo_bar0_read4(struct malo_softc *sc, bus_size_t off)
|
||||
static void
|
||||
malo_bar0_write4(struct malo_softc *sc, bus_size_t off, uint32_t val)
|
||||
{
|
||||
DPRINTF(sc, MALO_DEBUG_FW, "%s: off 0x%zx val 0x%x\n",
|
||||
__func__, off, val);
|
||||
DPRINTF(sc, MALO_DEBUG_FW, "%s: off 0x%jx val 0x%x\n",
|
||||
__func__, (intmax_t)off, val);
|
||||
|
||||
bus_space_write_4(sc->malo_io0t, sc->malo_io0h, off, val);
|
||||
}
|
||||
@ -191,6 +191,7 @@ malo_attach(uint16_t devid, struct malo_softc *sc)
|
||||
ic = ifp->if_l2com;
|
||||
|
||||
MALO_LOCK_INIT(sc);
|
||||
callout_init_mtx(&sc->malo_watchdog_timer, &sc->malo_mtx, 0);
|
||||
|
||||
/* set these up early for if_printf use */
|
||||
if_initname(ifp, device_get_name(sc->malo_dev),
|
||||
@ -272,7 +273,6 @@ malo_attach(uint16_t devid, struct malo_softc *sc)
|
||||
ifp->if_softc = sc;
|
||||
ifp->if_flags = IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST;
|
||||
ifp->if_start = malo_start;
|
||||
ifp->if_watchdog = malo_watchdog;
|
||||
ifp->if_ioctl = malo_ioctl;
|
||||
ifp->if_init = malo_init;
|
||||
IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen);
|
||||
@ -1076,7 +1076,7 @@ malo_tx_proc(void *arg, int npending)
|
||||
|
||||
if (nreaped != 0) {
|
||||
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
|
||||
ifp->if_timer = 0;
|
||||
sc->malo_timer = 0;
|
||||
malo_start(ifp);
|
||||
}
|
||||
}
|
||||
@ -1260,7 +1260,7 @@ malo_tx_start(struct malo_softc *sc, struct ieee80211_node *ni,
|
||||
MALO_TXDESC_SYNC(txq, ds, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
|
||||
|
||||
ifp->if_opackets++;
|
||||
ifp->if_timer = 5;
|
||||
sc->malo_timer = 5;
|
||||
MALO_TXQ_UNLOCK(txq);
|
||||
return 0;
|
||||
#undef IEEE80211_DIR_DSTODS
|
||||
@ -1339,10 +1339,17 @@ malo_start(struct ifnet *ifp)
|
||||
}
|
||||
|
||||
static void
|
||||
malo_watchdog(struct ifnet *ifp)
|
||||
malo_watchdog(void *arg)
|
||||
{
|
||||
struct malo_softc *sc = ifp->if_softc;
|
||||
struct malo_softc *sc;
|
||||
struct ifnet *ifp;
|
||||
|
||||
sc = arg;
|
||||
callout_reset(&sc->malo_watchdog_timer, hz, malo_watchdog, sc);
|
||||
if (sc->malo_timer == 0 || --sc->malo_timer > 0)
|
||||
return;
|
||||
|
||||
ifp = sc->malo_ifp;
|
||||
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) && !sc->malo_invalid) {
|
||||
if_printf(ifp, "watchdog timeout\n");
|
||||
|
||||
@ -1536,6 +1543,7 @@ malo_init_locked(struct malo_softc *sc)
|
||||
|
||||
ifp->if_drv_flags |= IFF_DRV_RUNNING;
|
||||
malo_hal_intrset(mh, sc->malo_imask);
|
||||
callout_reset(&sc->malo_watchdog_timer, hz, malo_watchdog, sc);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1699,7 +1707,8 @@ malo_stop_locked(struct ifnet *ifp, int disable)
|
||||
* is gone (invalid).
|
||||
*/
|
||||
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
|
||||
ifp->if_timer = 0;
|
||||
callout_stop(&sc->malo_watchdog_timer);
|
||||
sc->malo_timer = 0;
|
||||
/* diable interrupt. */
|
||||
malo_hal_intrset(mh, 0);
|
||||
/* turn off the radio. */
|
||||
@ -2241,6 +2250,7 @@ malo_detach(struct malo_softc *sc)
|
||||
* Other than that, it's straightforward...
|
||||
*/
|
||||
ieee80211_ifdetach(ic);
|
||||
callout_drain(&sc->malo_watchdog_timer);
|
||||
malo_dma_cleanup(sc);
|
||||
malo_tx_cleanup(sc);
|
||||
malo_hal_detach(sc->malo_mh);
|
||||
|
@ -550,6 +550,8 @@ struct malo_softc {
|
||||
|
||||
struct malo_txq malo_txq[MALO_NUM_TX_QUEUES];
|
||||
struct task malo_txtask; /* tx int processing */
|
||||
struct callout malo_watchdog_timer;
|
||||
int malo_timer;
|
||||
|
||||
struct malo_tx_radiotap_header malo_tx_th;
|
||||
struct malo_rx_radiotap_header malo_rx_th;
|
||||
|
@ -149,21 +149,6 @@ malo_pci_probe(device_t dev)
|
||||
#undef N
|
||||
}
|
||||
|
||||
static int
|
||||
malo_pci_setup(device_t dev)
|
||||
{
|
||||
|
||||
/*
|
||||
* Enable memory mapping and bus mastering.
|
||||
*/
|
||||
if (pci_enable_busmaster(dev) != 0)
|
||||
return -1;
|
||||
if (pci_enable_io(dev, SYS_RES_MEMORY) != 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
malo_pci_attach(device_t dev)
|
||||
{
|
||||
@ -173,11 +158,7 @@ malo_pci_attach(device_t dev)
|
||||
|
||||
sc->malo_dev = dev;
|
||||
|
||||
/*
|
||||
* Enable memory mapping and bus mastering.
|
||||
*/
|
||||
if (malo_pci_setup(dev))
|
||||
return (ENXIO);
|
||||
pci_enable_busmaster(dev);
|
||||
|
||||
/*
|
||||
* Setup memory-mapping of PCI registers.
|
||||
@ -194,7 +175,7 @@ malo_pci_attach(device_t dev)
|
||||
*/
|
||||
sc->malo_invalid = 1;
|
||||
|
||||
if (pci_find_extcap(dev, PCIY_EXPRESS, ®) == 0) {
|
||||
if (pci_find_cap(dev, PCIY_EXPRESS, ®) == 0) {
|
||||
msic = pci_msi_count(dev);
|
||||
if (bootverbose)
|
||||
device_printf(dev, "MSI count : %d\n", msic);
|
||||
@ -342,9 +323,6 @@ malo_pci_resume(device_t dev)
|
||||
{
|
||||
struct malo_pci_softc *psc = device_get_softc(dev);
|
||||
|
||||
if (!malo_pci_setup(dev))
|
||||
return ENXIO;
|
||||
|
||||
malo_resume(&psc->malo_sc);
|
||||
|
||||
return (0);
|
||||
|
@ -133,7 +133,7 @@ struct malo_hal_hwstats {
|
||||
/*
|
||||
* Set Antenna Configuration (legacy operation).
|
||||
*
|
||||
* The RX antenna can be selected using the the bitmask
|
||||
* The RX antenna can be selected using the bitmask
|
||||
* ant (bit 0 = antenna 1, bit 1 = antenna 2, etc.)
|
||||
* (diversity?XXX)
|
||||
*/
|
||||
|
@ -98,7 +98,7 @@ static void mwl_start(struct ifnet *);
|
||||
static int mwl_raw_xmit(struct ieee80211_node *, struct mbuf *,
|
||||
const struct ieee80211_bpf_params *);
|
||||
static int mwl_media_change(struct ifnet *);
|
||||
static void mwl_watchdog(struct ifnet *);
|
||||
static void mwl_watchdog(void *);
|
||||
static int mwl_ioctl(struct ifnet *, u_long, caddr_t);
|
||||
static void mwl_radar_proc(void *, int);
|
||||
static void mwl_chanswitch_proc(void *, int);
|
||||
@ -304,7 +304,7 @@ mwl_attach(uint16_t devid, struct mwl_softc *sc)
|
||||
|
||||
ifp = sc->sc_ifp = if_alloc(IFT_IEEE80211);
|
||||
if (ifp == NULL) {
|
||||
device_printf(sc->sc_dev, "can not if_alloc()\n");
|
||||
device_printf(sc->sc_dev, "cannot if_alloc()\n");
|
||||
return ENOSPC;
|
||||
}
|
||||
ic = ifp->if_l2com;
|
||||
@ -360,6 +360,7 @@ mwl_attach(uint16_t devid, struct mwl_softc *sc)
|
||||
goto bad1;
|
||||
|
||||
callout_init(&sc->sc_timer, CALLOUT_MPSAFE);
|
||||
callout_init_mtx(&sc->sc_watchdog, &sc->sc_mtx, 0);
|
||||
|
||||
sc->sc_tq = taskqueue_create("mwl_taskq", M_NOWAIT,
|
||||
taskqueue_thread_enqueue, &sc->sc_tq);
|
||||
@ -401,7 +402,6 @@ mwl_attach(uint16_t devid, struct mwl_softc *sc)
|
||||
ifp->if_softc = sc;
|
||||
ifp->if_flags = IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST;
|
||||
ifp->if_start = mwl_start;
|
||||
ifp->if_watchdog = mwl_watchdog;
|
||||
ifp->if_ioctl = mwl_ioctl;
|
||||
ifp->if_init = mwl_init;
|
||||
IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen);
|
||||
@ -558,6 +558,7 @@ mwl_detach(struct mwl_softc *sc)
|
||||
* Other than that, it's straightforward...
|
||||
*/
|
||||
ieee80211_ifdetach(ic);
|
||||
callout_drain(&sc->sc_watchdog);
|
||||
mwl_dma_cleanup(sc);
|
||||
mwl_tx_cleanup(sc);
|
||||
mwl_hal_detach(sc->sc_mh);
|
||||
@ -1218,6 +1219,7 @@ mwl_init_locked(struct mwl_softc *sc)
|
||||
|
||||
ifp->if_drv_flags |= IFF_DRV_RUNNING;
|
||||
mwl_hal_intrset(mh, sc->sc_imask);
|
||||
callout_reset(&sc->sc_watchdog, hz, mwl_watchdog, sc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1255,7 +1257,8 @@ mwl_stop_locked(struct ifnet *ifp, int disable)
|
||||
* Shutdown the hardware and driver.
|
||||
*/
|
||||
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
|
||||
ifp->if_timer = 0;
|
||||
callout_stop(&sc->sc_watchdog);
|
||||
sc->sc_tx_timer = 0;
|
||||
mwl_draintxq(sc);
|
||||
}
|
||||
}
|
||||
@ -1742,6 +1745,10 @@ mwl_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k,
|
||||
* WEP keys when the sta reaches AUTH state.
|
||||
*/
|
||||
macaddr = vap->iv_bss->ni_bssid;
|
||||
if ((k->wk_flags & IEEE80211_KEY_GROUP) == 0) {
|
||||
/* XXX plumb to local sta db too for static key wep */
|
||||
mwl_hal_keyset(hvap, &hk, vap->iv_myaddr);
|
||||
}
|
||||
} else if (vap->iv_opmode == IEEE80211_M_WDS &&
|
||||
vap->iv_state != IEEE80211_S_RUN) {
|
||||
/*
|
||||
@ -2303,8 +2310,10 @@ mwl_dma_setup(struct mwl_softc *sc)
|
||||
int error, i;
|
||||
|
||||
error = mwl_rxdma_setup(sc);
|
||||
if (error != 0)
|
||||
if (error != 0) {
|
||||
mwl_rxdma_cleanup(sc);
|
||||
return error;
|
||||
}
|
||||
|
||||
for (i = 0; i < MWL_NUM_TX_QUEUES; i++) {
|
||||
error = mwl_txdma_setup(sc, &sc->sc_txq[i]);
|
||||
@ -3409,7 +3418,7 @@ mwl_tx_start(struct mwl_softc *sc, struct ieee80211_node *ni, struct mwl_txbuf *
|
||||
MWL_TXDESC_SYNC(txq, ds, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
|
||||
|
||||
ifp->if_opackets++;
|
||||
ifp->if_timer = 5;
|
||||
sc->sc_tx_timer = 5;
|
||||
MWL_TXQ_UNLOCK(txq);
|
||||
|
||||
return 0;
|
||||
@ -3556,7 +3565,7 @@ mwl_tx_proc(void *arg, int npending)
|
||||
|
||||
if (nreaped != 0) {
|
||||
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
|
||||
ifp->if_timer = 0;
|
||||
sc->sc_tx_timer = 0;
|
||||
if (!IFQ_IS_EMPTY(&ifp->if_snd)) {
|
||||
/* NB: kick fw; the tx thread may have been preempted */
|
||||
mwl_hal_txstart(sc->sc_mh, 0);
|
||||
@ -3622,7 +3631,7 @@ mwl_draintxq(struct mwl_softc *sc)
|
||||
for (i = 0; i < MWL_NUM_TX_QUEUES; i++)
|
||||
mwl_tx_draintxq(sc, &sc->sc_txq[i]);
|
||||
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
|
||||
ifp->if_timer = 0;
|
||||
sc->sc_tx_timer = 0;
|
||||
}
|
||||
|
||||
#ifdef MWL_DIAGAPI
|
||||
@ -4768,10 +4777,17 @@ mwl_txq_dump(struct mwl_txq *txq)
|
||||
#endif
|
||||
|
||||
static void
|
||||
mwl_watchdog(struct ifnet *ifp)
|
||||
mwl_watchdog(void *arg)
|
||||
{
|
||||
struct mwl_softc *sc = ifp->if_softc;
|
||||
struct mwl_softc *sc;
|
||||
struct ifnet *ifp;
|
||||
|
||||
sc = arg;
|
||||
callout_reset(&sc->sc_watchdog, hz, mwl_watchdog, sc);
|
||||
if (sc->sc_tx_timer == 0 || --sc->sc_tx_timer > 0)
|
||||
return;
|
||||
|
||||
ifp = sc->sc_ifp;
|
||||
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) && !sc->sc_invalid) {
|
||||
if (mwl_hal_setkeepalive(sc->sc_mh))
|
||||
if_printf(ifp, "transmit timeout (firmware hung?)\n");
|
||||
|
@ -255,6 +255,8 @@ struct mwl_softc {
|
||||
bus_space_tag_t sc_io1t;
|
||||
struct mtx sc_mtx; /* master lock (recursive) */
|
||||
struct taskqueue *sc_tq; /* private task queue */
|
||||
struct callout sc_watchdog;
|
||||
int sc_tx_timer;
|
||||
unsigned int sc_invalid : 1, /* disable hardware accesses */
|
||||
sc_recvsetup:1, /* recv setup */
|
||||
sc_csapending:1,/* 11h channel switch pending */
|
||||
|
@ -279,7 +279,7 @@ mwl_hal_attach(device_t dev, uint16_t devid,
|
||||
hvap->vap_type = MWL_HAL_STA;
|
||||
hvap->bss_type = htole16(WL_MAC_TYPE_PRIMARY_CLIENT);
|
||||
hvap->macid = i;
|
||||
for (i++; i < MWL_MBSS_STA_MAX; i++) {
|
||||
for (i++; i < MWL_MBSS_MAX; i++) {
|
||||
hvap = &mh->mh_vaps[i];
|
||||
hvap->vap_type = MWL_HAL_STA;
|
||||
hvap->bss_type = htole16(WL_MAC_TYPE_SECONDARY_CLIENT);
|
||||
|
@ -291,7 +291,7 @@ int mwl_hal_setradio(struct mwl_hal *mh, int onoff, MWL_HAL_PREAMBLE preamble);
|
||||
/*
|
||||
* Set Antenna Configuration (legacy operation).
|
||||
*
|
||||
* The RX antenna can be selected using the the bitmask
|
||||
* The RX antenna can be selected using the bitmask
|
||||
* ant (bit 0 = antenna 1, bit 1 = antenna 2, etc.)
|
||||
* (diversity?XXX)
|
||||
*/
|
||||
|
@ -144,7 +144,8 @@ static void rt2560_enable_tsf_sync(struct rt2560_softc *);
|
||||
static void rt2560_enable_tsf(struct rt2560_softc *);
|
||||
static void rt2560_update_plcp(struct rt2560_softc *);
|
||||
static void rt2560_update_slot(struct ifnet *);
|
||||
static void rt2560_set_basicrates(struct rt2560_softc *);
|
||||
static void rt2560_set_basicrates(struct rt2560_softc *,
|
||||
const struct ieee80211_rateset *);
|
||||
static void rt2560_update_led(struct rt2560_softc *, int, int);
|
||||
static void rt2560_set_bssid(struct rt2560_softc *, const uint8_t *);
|
||||
static void rt2560_set_macaddr(struct rt2560_softc *, uint8_t *);
|
||||
@ -779,7 +780,7 @@ rt2560_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
|
||||
|
||||
if (vap->iv_opmode != IEEE80211_M_MONITOR) {
|
||||
rt2560_update_plcp(sc);
|
||||
rt2560_set_basicrates(sc);
|
||||
rt2560_set_basicrates(sc, &ni->ni_rates);
|
||||
rt2560_set_bssid(sc, ni->ni_bssid);
|
||||
}
|
||||
|
||||
@ -2355,22 +2356,29 @@ rt2560_update_slot(struct ifnet *ifp)
|
||||
}
|
||||
|
||||
static void
|
||||
rt2560_set_basicrates(struct rt2560_softc *sc)
|
||||
rt2560_set_basicrates(struct rt2560_softc *sc,
|
||||
const struct ieee80211_rateset *rs)
|
||||
{
|
||||
#define RV(r) ((r) & IEEE80211_RATE_VAL)
|
||||
struct ifnet *ifp = sc->sc_ifp;
|
||||
struct ieee80211com *ic = ifp->if_l2com;
|
||||
uint32_t mask = 0;
|
||||
uint8_t rate;
|
||||
int i;
|
||||
|
||||
/* update basic rate set */
|
||||
if (ic->ic_curmode == IEEE80211_MODE_11B) {
|
||||
/* 11b basic rates: 1, 2Mbps */
|
||||
RAL_WRITE(sc, RT2560_ARSP_PLCP_1, 0x3);
|
||||
} else if (IEEE80211_IS_CHAN_5GHZ(ic->ic_curchan)) {
|
||||
/* 11a basic rates: 6, 12, 24Mbps */
|
||||
RAL_WRITE(sc, RT2560_ARSP_PLCP_1, 0x150);
|
||||
} else {
|
||||
/* 11g basic rates: 1, 2, 5.5, 11, 6, 12, 24Mbps */
|
||||
RAL_WRITE(sc, RT2560_ARSP_PLCP_1, 0x15f);
|
||||
for (i = 0; i < rs->rs_nrates; i++) {
|
||||
rate = rs->rs_rates[i];
|
||||
|
||||
if (!(rate & IEEE80211_RATE_BASIC))
|
||||
continue;
|
||||
|
||||
mask |= 1 << ic->ic_rt->rateCodeToIndex[RV(rate)];
|
||||
}
|
||||
|
||||
RAL_WRITE(sc, RT2560_ARSP_PLCP_1, mask);
|
||||
|
||||
DPRINTF(sc, "Setting basic rate mask to 0x%x\n", mask);
|
||||
#undef RV
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1917,7 +1917,7 @@ rt2661_set_basicrates(struct rt2661_softc *sc,
|
||||
struct ieee80211com *ic = ifp->if_l2com;
|
||||
uint32_t mask = 0;
|
||||
uint8_t rate;
|
||||
int i, j;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < rs->rs_nrates; i++) {
|
||||
rate = rs->rs_rates[i];
|
||||
@ -1925,13 +1925,7 @@ rt2661_set_basicrates(struct rt2661_softc *sc,
|
||||
if (!(rate & IEEE80211_RATE_BASIC))
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Find h/w rate index. We know it exists because the rate
|
||||
* set has already been negotiated.
|
||||
*/
|
||||
for (j = 0; ic->ic_sup_rates[IEEE80211_MODE_11G].rs_rates[j] != RV(rate); j++);
|
||||
|
||||
mask |= 1 << j;
|
||||
mask |= 1 << ic->ic_rt->rateCodeToIndex[RV(rate)];
|
||||
}
|
||||
|
||||
RAL_WRITE(sc, RT2661_TXRX_CSR5, mask);
|
||||
|
@ -295,7 +295,7 @@ wi_attach(device_t dev)
|
||||
SYSCTL_ADD_INT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO,
|
||||
"pri_version", CTLFLAG_RD, &sc->sc_pri_firmware_ver, 0,
|
||||
"Primary Firmware version");
|
||||
SYSCTL_ADD_XINT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "nic_id",
|
||||
SYSCTL_ADD_UINT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "nic_id",
|
||||
CTLFLAG_RD, &sc->sc_nic_id, 0, "NIC id");
|
||||
SYSCTL_ADD_STRING(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "nic_name",
|
||||
CTLFLAG_RD, sc->sc_nic_name, 0, "NIC name");
|
||||
|
@ -133,7 +133,7 @@ enum ieee80211_roamingmode {
|
||||
*/
|
||||
struct ieee80211_channel {
|
||||
uint32_t ic_flags; /* see below */
|
||||
uint16_t ic_freq; /* setting in Mhz */
|
||||
uint16_t ic_freq; /* setting in MHz */
|
||||
uint8_t ic_ieee; /* IEEE channel number */
|
||||
int8_t ic_maxregpower; /* maximum regulatory tx power in dBm */
|
||||
int8_t ic_maxpower; /* maximum tx power in .5 dBm */
|
||||
@ -335,7 +335,7 @@ struct ieee80211_rateset {
|
||||
* the structure such that it can be used interchangeably
|
||||
* with an ieee80211_rateset (modulo structure size).
|
||||
*/
|
||||
#define IEEE80211_HTRATE_MAXSIZE 127
|
||||
#define IEEE80211_HTRATE_MAXSIZE 77
|
||||
|
||||
struct ieee80211_htrateset {
|
||||
uint8_t rs_nrates;
|
||||
@ -387,9 +387,16 @@ struct ieee80211_regdomain {
|
||||
/*
|
||||
* MIMO antenna/radio state.
|
||||
*/
|
||||
|
||||
#define IEEE80211_MAX_CHAINS 3
|
||||
#define IEEE80211_MAX_EVM_PILOTS 6
|
||||
|
||||
/*
|
||||
* XXX This doesn't yet export both ctl/ext chain details
|
||||
*/
|
||||
struct ieee80211_mimo_info {
|
||||
int8_t rssi[3]; /* per-antenna rssi */
|
||||
int8_t noise[3]; /* per-antenna noise floor */
|
||||
int8_t rssi[IEEE80211_MAX_CHAINS]; /* per-antenna rssi */
|
||||
int8_t noise[IEEE80211_MAX_CHAINS]; /* per-antenna noise floor */
|
||||
uint8_t pad[2];
|
||||
uint32_t evm[3]; /* EVM data */
|
||||
};
|
||||
|
@ -203,6 +203,15 @@ ieee80211_chan_init(struct ieee80211com *ic)
|
||||
DEFAULTRATES(IEEE80211_MODE_11NA, ieee80211_rateset_11a);
|
||||
DEFAULTRATES(IEEE80211_MODE_11NG, ieee80211_rateset_11g);
|
||||
|
||||
/*
|
||||
* Setup required information to fill the mcsset field, if driver did
|
||||
* not. Assume a 2T2R setup for historic reasons.
|
||||
*/
|
||||
if (ic->ic_rxstream == 0)
|
||||
ic->ic_rxstream = 2;
|
||||
if (ic->ic_txstream == 0)
|
||||
ic->ic_txstream = 2;
|
||||
|
||||
/*
|
||||
* Set auto mode to reset active channel state and any desired channel.
|
||||
*/
|
||||
@ -413,6 +422,7 @@ ieee80211_vap_setup(struct ieee80211com *ic, struct ieee80211vap *vap,
|
||||
vap->iv_flags_ven = ic->ic_flags_ven;
|
||||
vap->iv_caps = ic->ic_caps &~ IEEE80211_C_OPMODE;
|
||||
vap->iv_htcaps = ic->ic_htcaps;
|
||||
vap->iv_htextcaps = ic->ic_htextcaps;
|
||||
vap->iv_opmode = opmode;
|
||||
vap->iv_caps |= ieee80211_opcap[opmode];
|
||||
switch (opmode) {
|
||||
@ -1073,10 +1083,18 @@ ieee80211_media_setup(struct ieee80211com *ic,
|
||||
isset(ic->ic_modecaps, IEEE80211_MODE_11NG)) {
|
||||
addmedia(media, caps, addsta,
|
||||
IEEE80211_MODE_AUTO, IFM_IEEE80211_MCS);
|
||||
/* XXX could walk htrates */
|
||||
/* XXX known array size */
|
||||
if (ieee80211_htrates[15].ht40_rate_400ns > maxrate)
|
||||
maxrate = ieee80211_htrates[15].ht40_rate_400ns;
|
||||
i = ic->ic_txstream * 8 - 1;
|
||||
if ((ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40) &&
|
||||
(ic->ic_htcaps & IEEE80211_HTCAP_SHORTGI40))
|
||||
rate = ieee80211_htrates[i].ht40_rate_400ns;
|
||||
else if ((ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40))
|
||||
rate = ieee80211_htrates[i].ht40_rate_800ns;
|
||||
else if ((ic->ic_htcaps & IEEE80211_HTCAP_SHORTGI20))
|
||||
rate = ieee80211_htrates[i].ht20_rate_400ns;
|
||||
else
|
||||
rate = ieee80211_htrates[i].ht20_rate_800ns;
|
||||
if (rate > maxrate)
|
||||
maxrate = rate;
|
||||
}
|
||||
return maxrate;
|
||||
}
|
||||
@ -1519,6 +1537,67 @@ ieee80211_rate2media(struct ieee80211com *ic, int rate, enum ieee80211_phymode m
|
||||
{ 13, IFM_IEEE80211_MCS },
|
||||
{ 14, IFM_IEEE80211_MCS },
|
||||
{ 15, IFM_IEEE80211_MCS },
|
||||
{ 16, IFM_IEEE80211_MCS },
|
||||
{ 17, IFM_IEEE80211_MCS },
|
||||
{ 18, IFM_IEEE80211_MCS },
|
||||
{ 19, IFM_IEEE80211_MCS },
|
||||
{ 20, IFM_IEEE80211_MCS },
|
||||
{ 21, IFM_IEEE80211_MCS },
|
||||
{ 22, IFM_IEEE80211_MCS },
|
||||
{ 23, IFM_IEEE80211_MCS },
|
||||
{ 24, IFM_IEEE80211_MCS },
|
||||
{ 25, IFM_IEEE80211_MCS },
|
||||
{ 26, IFM_IEEE80211_MCS },
|
||||
{ 27, IFM_IEEE80211_MCS },
|
||||
{ 28, IFM_IEEE80211_MCS },
|
||||
{ 29, IFM_IEEE80211_MCS },
|
||||
{ 30, IFM_IEEE80211_MCS },
|
||||
{ 31, IFM_IEEE80211_MCS },
|
||||
{ 32, IFM_IEEE80211_MCS },
|
||||
{ 33, IFM_IEEE80211_MCS },
|
||||
{ 34, IFM_IEEE80211_MCS },
|
||||
{ 35, IFM_IEEE80211_MCS },
|
||||
{ 36, IFM_IEEE80211_MCS },
|
||||
{ 37, IFM_IEEE80211_MCS },
|
||||
{ 38, IFM_IEEE80211_MCS },
|
||||
{ 39, IFM_IEEE80211_MCS },
|
||||
{ 40, IFM_IEEE80211_MCS },
|
||||
{ 41, IFM_IEEE80211_MCS },
|
||||
{ 42, IFM_IEEE80211_MCS },
|
||||
{ 43, IFM_IEEE80211_MCS },
|
||||
{ 44, IFM_IEEE80211_MCS },
|
||||
{ 45, IFM_IEEE80211_MCS },
|
||||
{ 46, IFM_IEEE80211_MCS },
|
||||
{ 47, IFM_IEEE80211_MCS },
|
||||
{ 48, IFM_IEEE80211_MCS },
|
||||
{ 49, IFM_IEEE80211_MCS },
|
||||
{ 50, IFM_IEEE80211_MCS },
|
||||
{ 51, IFM_IEEE80211_MCS },
|
||||
{ 52, IFM_IEEE80211_MCS },
|
||||
{ 53, IFM_IEEE80211_MCS },
|
||||
{ 54, IFM_IEEE80211_MCS },
|
||||
{ 55, IFM_IEEE80211_MCS },
|
||||
{ 56, IFM_IEEE80211_MCS },
|
||||
{ 57, IFM_IEEE80211_MCS },
|
||||
{ 58, IFM_IEEE80211_MCS },
|
||||
{ 59, IFM_IEEE80211_MCS },
|
||||
{ 60, IFM_IEEE80211_MCS },
|
||||
{ 61, IFM_IEEE80211_MCS },
|
||||
{ 62, IFM_IEEE80211_MCS },
|
||||
{ 63, IFM_IEEE80211_MCS },
|
||||
{ 64, IFM_IEEE80211_MCS },
|
||||
{ 65, IFM_IEEE80211_MCS },
|
||||
{ 66, IFM_IEEE80211_MCS },
|
||||
{ 67, IFM_IEEE80211_MCS },
|
||||
{ 68, IFM_IEEE80211_MCS },
|
||||
{ 69, IFM_IEEE80211_MCS },
|
||||
{ 70, IFM_IEEE80211_MCS },
|
||||
{ 71, IFM_IEEE80211_MCS },
|
||||
{ 72, IFM_IEEE80211_MCS },
|
||||
{ 73, IFM_IEEE80211_MCS },
|
||||
{ 74, IFM_IEEE80211_MCS },
|
||||
{ 75, IFM_IEEE80211_MCS },
|
||||
{ 76, IFM_IEEE80211_MCS },
|
||||
};
|
||||
int m;
|
||||
|
||||
|
@ -131,6 +131,7 @@ struct ieee80211_qosframe_addr4 {
|
||||
#define IEEE80211_FC0_SUBTYPE_AUTH 0xb0
|
||||
#define IEEE80211_FC0_SUBTYPE_DEAUTH 0xc0
|
||||
#define IEEE80211_FC0_SUBTYPE_ACTION 0xd0
|
||||
#define IEEE80211_FC0_SUBTYPE_ACTION_NOACK 0xe0
|
||||
/* for TYPE_CTL */
|
||||
#define IEEE80211_FC0_SUBTYPE_BAR 0x80
|
||||
#define IEEE80211_FC0_SUBTYPE_BA 0x90
|
||||
|
@ -77,7 +77,7 @@ struct acl {
|
||||
struct aclstate {
|
||||
acl_lock_t as_lock;
|
||||
int as_policy;
|
||||
int as_nacls;
|
||||
uint32_t as_nacls;
|
||||
TAILQ_HEAD(, acl) as_list; /* list of all ACL's */
|
||||
LIST_HEAD(, acl) as_hash[ACL_HASHSIZE];
|
||||
struct ieee80211vap *as_vap;
|
||||
@ -289,7 +289,8 @@ acl_getioctl(struct ieee80211vap *vap, struct ieee80211req *ireq)
|
||||
struct aclstate *as = vap->iv_as;
|
||||
struct acl *acl;
|
||||
struct ieee80211req_maclist *ap;
|
||||
int error, space, i;
|
||||
int error;
|
||||
uint32_t i, space;
|
||||
|
||||
switch (ireq->i_val) {
|
||||
case IEEE80211_MACCMD_POLICY:
|
||||
|
@ -285,7 +285,6 @@ doprint(struct ieee80211vap *vap, int subtype)
|
||||
static int
|
||||
adhoc_input(struct ieee80211_node *ni, struct mbuf *m, int rssi, int nf)
|
||||
{
|
||||
#define SEQ_LEQ(a,b) ((int)((a)-(b)) <= 0)
|
||||
#define HAS_SEQ(type) ((type & 0x4) == 0)
|
||||
struct ieee80211vap *vap = ni->ni_vap;
|
||||
struct ieee80211com *ic = ni->ni_ic;
|
||||
@ -412,9 +411,7 @@ adhoc_input(struct ieee80211_node *ni, struct mbuf *m, int rssi, int nf)
|
||||
TID_TO_WME_AC(tid) >= WME_AC_VI)
|
||||
ic->ic_wme.wme_hipri_traffic++;
|
||||
rxseq = le16toh(*(uint16_t *)wh->i_seq);
|
||||
if ((ni->ni_flags & IEEE80211_NODE_HT) == 0 &&
|
||||
(wh->i_fc[1] & IEEE80211_FC1_RETRY) &&
|
||||
SEQ_LEQ(rxseq, ni->ni_rxseqs[tid])) {
|
||||
if (! ieee80211_check_rxseq(ni, wh)) {
|
||||
/* duplicate, discard */
|
||||
IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT,
|
||||
bssid, "duplicate",
|
||||
@ -660,7 +657,6 @@ out:
|
||||
m_freem(m);
|
||||
}
|
||||
return type;
|
||||
#undef SEQ_LEQ
|
||||
}
|
||||
|
||||
static int
|
||||
@ -823,80 +819,44 @@ adhoc_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0,
|
||||
is11bclient(rates, xrates) ? IEEE80211_SEND_LEGACY_11B : 0);
|
||||
break;
|
||||
|
||||
case IEEE80211_FC0_SUBTYPE_ACTION: {
|
||||
const struct ieee80211_action *ia;
|
||||
|
||||
if (vap->iv_state != IEEE80211_S_RUN) {
|
||||
case IEEE80211_FC0_SUBTYPE_ACTION:
|
||||
case IEEE80211_FC0_SUBTYPE_ACTION_NOACK:
|
||||
if (ni == vap->iv_bss) {
|
||||
IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT,
|
||||
wh, NULL, "%s", "unknown node");
|
||||
vap->iv_stats.is_rx_mgtdiscard++;
|
||||
} else if (!IEEE80211_ADDR_EQ(vap->iv_myaddr, wh->i_addr1) &&
|
||||
!IEEE80211_IS_MULTICAST(wh->i_addr1)) {
|
||||
IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT,
|
||||
wh, NULL, "%s", "not for us");
|
||||
vap->iv_stats.is_rx_mgtdiscard++;
|
||||
} else if (vap->iv_state != IEEE80211_S_RUN) {
|
||||
IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT,
|
||||
wh, NULL, "wrong state %s",
|
||||
ieee80211_state_name[vap->iv_state]);
|
||||
vap->iv_stats.is_rx_mgtdiscard++;
|
||||
return;
|
||||
} else {
|
||||
if (ieee80211_parse_action(ni, m0) == 0)
|
||||
(void)ic->ic_recv_action(ni, wh, frm, efrm);
|
||||
}
|
||||
/*
|
||||
* action frame format:
|
||||
* [1] category
|
||||
* [1] action
|
||||
* [tlv] parameters
|
||||
*/
|
||||
IEEE80211_VERIFY_LENGTH(efrm - frm,
|
||||
sizeof(struct ieee80211_action), return);
|
||||
ia = (const struct ieee80211_action *) frm;
|
||||
|
||||
vap->iv_stats.is_rx_action++;
|
||||
IEEE80211_NODE_STAT(ni, rx_action);
|
||||
|
||||
/* verify frame payloads but defer processing */
|
||||
/* XXX maybe push this to method */
|
||||
switch (ia->ia_category) {
|
||||
case IEEE80211_ACTION_CAT_BA:
|
||||
switch (ia->ia_action) {
|
||||
case IEEE80211_ACTION_BA_ADDBA_REQUEST:
|
||||
IEEE80211_VERIFY_LENGTH(efrm - frm,
|
||||
sizeof(struct ieee80211_action_ba_addbarequest),
|
||||
return);
|
||||
break;
|
||||
case IEEE80211_ACTION_BA_ADDBA_RESPONSE:
|
||||
IEEE80211_VERIFY_LENGTH(efrm - frm,
|
||||
sizeof(struct ieee80211_action_ba_addbaresponse),
|
||||
return);
|
||||
break;
|
||||
case IEEE80211_ACTION_BA_DELBA:
|
||||
IEEE80211_VERIFY_LENGTH(efrm - frm,
|
||||
sizeof(struct ieee80211_action_ba_delba),
|
||||
return);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case IEEE80211_ACTION_CAT_HT:
|
||||
switch (ia->ia_action) {
|
||||
case IEEE80211_ACTION_HT_TXCHWIDTH:
|
||||
IEEE80211_VERIFY_LENGTH(efrm - frm,
|
||||
sizeof(struct ieee80211_action_ht_txchwidth),
|
||||
return);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
ic->ic_recv_action(ni, wh, frm, efrm);
|
||||
break;
|
||||
}
|
||||
|
||||
case IEEE80211_FC0_SUBTYPE_AUTH:
|
||||
case IEEE80211_FC0_SUBTYPE_ASSOC_REQ:
|
||||
case IEEE80211_FC0_SUBTYPE_REASSOC_REQ:
|
||||
case IEEE80211_FC0_SUBTYPE_ASSOC_RESP:
|
||||
case IEEE80211_FC0_SUBTYPE_REASSOC_REQ:
|
||||
case IEEE80211_FC0_SUBTYPE_REASSOC_RESP:
|
||||
case IEEE80211_FC0_SUBTYPE_DEAUTH:
|
||||
case IEEE80211_FC0_SUBTYPE_ATIM:
|
||||
case IEEE80211_FC0_SUBTYPE_DISASSOC:
|
||||
case IEEE80211_FC0_SUBTYPE_AUTH:
|
||||
case IEEE80211_FC0_SUBTYPE_DEAUTH:
|
||||
IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT,
|
||||
wh, NULL, "%s", "not handled");
|
||||
wh, NULL, "%s", "not handled");
|
||||
vap->iv_stats.is_rx_mgtdiscard++;
|
||||
return;
|
||||
break;
|
||||
|
||||
default:
|
||||
IEEE80211_DISCARD(vap, IEEE80211_MSG_ANY,
|
||||
wh, "mgt", "subtype 0x%x not handled", subtype);
|
||||
wh, "mgt", "subtype 0x%x not handled", subtype);
|
||||
vap->iv_stats.is_rx_badsubtype++;
|
||||
break;
|
||||
}
|
||||
@ -910,6 +870,7 @@ ahdemo_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0,
|
||||
{
|
||||
struct ieee80211vap *vap = ni->ni_vap;
|
||||
struct ieee80211com *ic = ni->ni_ic;
|
||||
struct ieee80211_frame *wh;
|
||||
|
||||
/*
|
||||
* Process management frames when scanning; useful for doing
|
||||
@ -917,11 +878,42 @@ ahdemo_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0,
|
||||
*/
|
||||
if (ic->ic_flags & IEEE80211_F_SCAN)
|
||||
adhoc_recv_mgmt(ni, m0, subtype, rssi, nf);
|
||||
else
|
||||
vap->iv_stats.is_rx_mgtdiscard++;
|
||||
else {
|
||||
wh = mtod(m0, struct ieee80211_frame *);
|
||||
switch (subtype) {
|
||||
case IEEE80211_FC0_SUBTYPE_ASSOC_REQ:
|
||||
case IEEE80211_FC0_SUBTYPE_ASSOC_RESP:
|
||||
case IEEE80211_FC0_SUBTYPE_REASSOC_REQ:
|
||||
case IEEE80211_FC0_SUBTYPE_REASSOC_RESP:
|
||||
case IEEE80211_FC0_SUBTYPE_PROBE_REQ:
|
||||
case IEEE80211_FC0_SUBTYPE_PROBE_RESP:
|
||||
case IEEE80211_FC0_SUBTYPE_BEACON:
|
||||
case IEEE80211_FC0_SUBTYPE_ATIM:
|
||||
case IEEE80211_FC0_SUBTYPE_DISASSOC:
|
||||
case IEEE80211_FC0_SUBTYPE_AUTH:
|
||||
case IEEE80211_FC0_SUBTYPE_DEAUTH:
|
||||
case IEEE80211_FC0_SUBTYPE_ACTION:
|
||||
case IEEE80211_FC0_SUBTYPE_ACTION_NOACK:
|
||||
IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT,
|
||||
wh, NULL, "%s", "not handled");
|
||||
vap->iv_stats.is_rx_mgtdiscard++;
|
||||
break;
|
||||
default:
|
||||
IEEE80211_DISCARD(vap, IEEE80211_MSG_ANY,
|
||||
wh, "mgt", "subtype 0x%x not handled", subtype);
|
||||
vap->iv_stats.is_rx_badsubtype++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
adhoc_recv_ctl(struct ieee80211_node *ni, struct mbuf *m0, int subtype)
|
||||
adhoc_recv_ctl(struct ieee80211_node *ni, struct mbuf *m, int subtype)
|
||||
{
|
||||
|
||||
switch (subtype) {
|
||||
case IEEE80211_FC0_SUBTYPE_BAR:
|
||||
ieee80211_recv_bar(ni, m);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$");
|
||||
void
|
||||
ieee80211_ageq_init(struct ieee80211_ageq *aq, int maxlen, const char *name)
|
||||
{
|
||||
memset(aq, 0, sizeof(aq));
|
||||
memset(aq, 0, sizeof(*aq));
|
||||
aq->aq_maxlen = maxlen;
|
||||
IEEE80211_AGEQ_INIT(aq, name); /* OS-dependent setup */
|
||||
}
|
||||
@ -154,7 +154,7 @@ ieee80211_ageq_drain_node(struct ieee80211_ageq *aq,
|
||||
* deltas (in seconds) relative to the head so we can check
|
||||
* and/or adjust only the head of the list. If a frame's age
|
||||
* exceeds the time quanta then remove it. The list of removed
|
||||
* frames is is returned to the caller joined by m_nextpkt.
|
||||
* frames is returned to the caller joined by m_nextpkt.
|
||||
*/
|
||||
struct mbuf *
|
||||
ieee80211_ageq_age(struct ieee80211_ageq *aq, int quanta)
|
||||
|
155
src/libs/compat/freebsd_wlan/net80211/ieee80211_alq.c
Normal file
155
src/libs/compat/freebsd_wlan/net80211/ieee80211_alq.c
Normal file
@ -0,0 +1,155 @@
|
||||
/*-
|
||||
* Copyright (c) 2011 Adrian Chadd, Xenion Lty Ltd
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifdef __FreeBSD__
|
||||
__FBSDID("$FreeBSD$");
|
||||
#endif
|
||||
|
||||
/*
|
||||
* net80211 fast-logging support, primarily for debugging.
|
||||
*
|
||||
* This implements a single debugging queue which includes
|
||||
* per-device enumeration where needed.
|
||||
*/
|
||||
|
||||
#include "opt_wlan.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/endian.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/pcpu.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/ucred.h>
|
||||
#include <sys/alq.h>
|
||||
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_var.h>
|
||||
#include <net/if_dl.h>
|
||||
#include <net/if_clone.h>
|
||||
#include <net/if_media.h>
|
||||
#include <net/if_types.h>
|
||||
|
||||
#include <net80211/ieee80211_var.h>
|
||||
#include <net80211/ieee80211_freebsd.h>
|
||||
#include <net80211/ieee80211_alq.h>
|
||||
|
||||
static struct alq *ieee80211_alq;
|
||||
static int ieee80211_alq_lost;
|
||||
static int ieee80211_alq_logged;
|
||||
static char ieee80211_alq_logfile[MAXPATHLEN] = "/tmp/net80211.log";
|
||||
static unsigned int ieee80211_alq_qsize = 64*1024;
|
||||
|
||||
static int
|
||||
ieee80211_alq_setlogging(int enable)
|
||||
{
|
||||
int error;
|
||||
|
||||
if (enable) {
|
||||
if (ieee80211_alq)
|
||||
alq_close(ieee80211_alq);
|
||||
|
||||
error = alq_open(&ieee80211_alq,
|
||||
ieee80211_alq_logfile,
|
||||
curthread->td_ucred,
|
||||
ALQ_DEFAULT_CMODE,
|
||||
sizeof (struct ieee80211_alq_rec),
|
||||
ieee80211_alq_qsize);
|
||||
ieee80211_alq_lost = 0;
|
||||
ieee80211_alq_logged = 0;
|
||||
printf("net80211: logging to %s enabled; struct size %d bytes\n",
|
||||
ieee80211_alq_logfile, sizeof(struct ieee80211_alq_rec));
|
||||
} else {
|
||||
if (ieee80211_alq)
|
||||
alq_close(ieee80211_alq);
|
||||
ieee80211_alq = NULL;
|
||||
printf("net80211: logging disabled\n");
|
||||
error = 0;
|
||||
}
|
||||
return (error);
|
||||
}
|
||||
|
||||
static int
|
||||
sysctl_ieee80211_alq_log(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
int error, enable;
|
||||
|
||||
enable = (ieee80211_alq != NULL);
|
||||
error = sysctl_handle_int(oidp, &enable, 0, req);
|
||||
if (error || !req->newptr)
|
||||
return (error);
|
||||
else
|
||||
return (ieee80211_alq_setlogging(enable));
|
||||
}
|
||||
|
||||
SYSCTL_PROC(_net_wlan, OID_AUTO, alq, CTLTYPE_INT|CTLFLAG_RW,
|
||||
0, 0, sysctl_ieee80211_alq_log, "I", "Enable net80211 alq logging");
|
||||
SYSCTL_INT(_net_wlan, OID_AUTO, alq_size, CTLFLAG_RW,
|
||||
&ieee80211_alq_qsize, 0, "In-memory log size (#records)");
|
||||
SYSCTL_INT(_net_wlan, OID_AUTO, alq_lost, CTLFLAG_RW,
|
||||
&ieee80211_alq_lost, 0, "Debugging operations not logged");
|
||||
SYSCTL_INT(_net_wlan, OID_AUTO, alq_logged, CTLFLAG_RW,
|
||||
&ieee80211_alq_logged, 0, "Debugging operations logged");
|
||||
|
||||
static struct ale *
|
||||
ieee80211_alq_get(void)
|
||||
{
|
||||
struct ale *ale;
|
||||
|
||||
ale = alq_get(ieee80211_alq, ALQ_NOWAIT);
|
||||
if (!ale)
|
||||
ieee80211_alq_lost++;
|
||||
else
|
||||
ieee80211_alq_logged++;
|
||||
return ale;
|
||||
}
|
||||
|
||||
void
|
||||
ieee80211_alq_log(struct ieee80211vap *vap, uint8_t op, u_char *p, int l)
|
||||
{
|
||||
struct ale *ale;
|
||||
struct ieee80211_alq_rec *r;
|
||||
|
||||
if (ieee80211_alq == NULL)
|
||||
return;
|
||||
|
||||
ale = ieee80211_alq_get();
|
||||
if (! ale)
|
||||
return;
|
||||
|
||||
r = (struct ieee80211_alq_rec *) ale->ae_data;
|
||||
r->r_timestamp = htonl(ticks);
|
||||
r->r_version = 1;
|
||||
r->r_wlan = htons(vap->iv_ifp->if_dunit);
|
||||
r->r_op = op;
|
||||
memcpy(&r->r_payload, p, MIN(l, sizeof(r->r_payload)));
|
||||
alq_post(ieee80211_alq, ale);
|
||||
}
|
51
src/libs/compat/freebsd_wlan/net80211/ieee80211_alq.h
Normal file
51
src/libs/compat/freebsd_wlan/net80211/ieee80211_alq.h
Normal file
@ -0,0 +1,51 @@
|
||||
/*-
|
||||
* Copyright (c) 2011 Adrian Chadd, Xenion Lty Ltd
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
#ifndef __IEEE80211_ALQ_H__
|
||||
#define __IEEE80211_ALQ_H__
|
||||
|
||||
#define IEEE80211_ALQ_PAYLOAD_SIZE 24
|
||||
|
||||
/*
|
||||
* timestamp
|
||||
* wlan interface
|
||||
* operation
|
||||
* sub-operation
|
||||
* rest of structure - operation specific
|
||||
*/
|
||||
struct ieee80211_alq_rec {
|
||||
uint32_t r_timestamp; /* XXX may wrap! */
|
||||
uint16_t r_wlan; /* wlan interface number */
|
||||
uint8_t r_version; /* version */
|
||||
uint8_t r_op; /* top-level operation id */
|
||||
u_char r_payload[IEEE80211_ALQ_PAYLOAD_SIZE];
|
||||
/* operation-specific payload */
|
||||
};
|
||||
|
||||
/* General logging function */
|
||||
extern void ieee80211_alq_log(struct ieee80211vap *vap, uint8_t op, u_char *p, int l);
|
||||
|
||||
#endif /* __IEEE80211_ALQ_H__ */
|
@ -308,10 +308,10 @@ amrr_sysctlattach(struct ieee80211vap *vap,
|
||||
"amrr_rate_interval", CTLTYPE_INT | CTLFLAG_RW, vap,
|
||||
0, amrr_sysctl_interval, "I", "amrr operation interval (ms)");
|
||||
/* XXX bounds check values */
|
||||
SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
|
||||
SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
|
||||
"amrr_max_sucess_threshold", CTLFLAG_RW,
|
||||
&amrr->amrr_max_success_threshold, 0, "");
|
||||
SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
|
||||
SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
|
||||
"amrr_min_sucess_threshold", CTLFLAG_RW,
|
||||
&amrr->amrr_min_success_threshold, 0, "");
|
||||
}
|
||||
|
@ -78,6 +78,7 @@ struct ieee80211_key {
|
||||
#define IEEE80211_KEY_XMIT 0x0001 /* key used for xmit */
|
||||
#define IEEE80211_KEY_RECV 0x0002 /* key used for recv */
|
||||
#define IEEE80211_KEY_GROUP 0x0004 /* key used for WPA group operation */
|
||||
#define IEEE80211_KEY_NOREPLAY 0x0008 /* ignore replay failures */
|
||||
#define IEEE80211_KEY_SWENCRYPT 0x0010 /* host-based encrypt */
|
||||
#define IEEE80211_KEY_SWDECRYPT 0x0020 /* host-based decrypt */
|
||||
#define IEEE80211_KEY_SWENMIC 0x0040 /* host-based enmic */
|
||||
@ -98,7 +99,8 @@ struct ieee80211_key {
|
||||
uint8_t wk_macaddr[IEEE80211_ADDR_LEN];
|
||||
};
|
||||
#define IEEE80211_KEY_COMMON /* common flags passed in by apps */\
|
||||
(IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV | IEEE80211_KEY_GROUP)
|
||||
(IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV | IEEE80211_KEY_GROUP | \
|
||||
IEEE80211_KEY_NOREPLAY)
|
||||
#define IEEE80211_KEY_DEVICE /* flags owned by device driver */\
|
||||
(IEEE80211_KEY_DEVKEY|IEEE80211_KEY_CIPHER0|IEEE80211_KEY_CIPHER1)
|
||||
|
||||
|
@ -226,7 +226,8 @@ ccmp_decap(struct ieee80211_key *k, struct mbuf *m, int hdrlen)
|
||||
}
|
||||
tid = ieee80211_gettid(wh);
|
||||
pn = READ_6(ivp[0], ivp[1], ivp[4], ivp[5], ivp[6], ivp[7]);
|
||||
if (pn <= k->wk_keyrsc[tid]) {
|
||||
if (pn <= k->wk_keyrsc[tid] &&
|
||||
(k->wk_flags & IEEE80211_KEY_NOREPLAY) == 0) {
|
||||
/*
|
||||
* Replay violation.
|
||||
*/
|
||||
|
@ -281,7 +281,8 @@ tkip_decap(struct ieee80211_key *k, struct mbuf *m, int hdrlen)
|
||||
|
||||
tid = ieee80211_gettid(wh);
|
||||
ctx->rx_rsc = READ_6(ivp[2], ivp[0], ivp[4], ivp[5], ivp[6], ivp[7]);
|
||||
if (ctx->rx_rsc <= k->wk_keyrsc[tid]) {
|
||||
if (ctx->rx_rsc <= k->wk_keyrsc[tid] &&
|
||||
(k->wk_flags & IEEE80211_KEY_NOREPLAY) == 0) {
|
||||
/*
|
||||
* Replay violation; notify upper layer.
|
||||
*/
|
||||
|
@ -318,6 +318,8 @@ ieee80211_dfs_notify_radar(struct ieee80211com *ic, struct ieee80211_channel *ch
|
||||
* on the NOL to expire.
|
||||
*/
|
||||
/*XXX*/
|
||||
if_printf(ic->ic_ifp, "%s: No free channels; waiting for entry "
|
||||
"on NOL to expire\n", __func__);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
|
@ -472,7 +472,6 @@ doprint(struct ieee80211vap *vap, int subtype)
|
||||
static int
|
||||
hostap_input(struct ieee80211_node *ni, struct mbuf *m, int rssi, int nf)
|
||||
{
|
||||
#define SEQ_LEQ(a,b) ((int)((a)-(b)) <= 0)
|
||||
#define HAS_SEQ(type) ((type & 0x4) == 0)
|
||||
struct ieee80211vap *vap = ni->ni_vap;
|
||||
struct ieee80211com *ic = ni->ni_ic;
|
||||
@ -572,9 +571,7 @@ hostap_input(struct ieee80211_node *ni, struct mbuf *m, int rssi, int nf)
|
||||
TID_TO_WME_AC(tid) >= WME_AC_VI)
|
||||
ic->ic_wme.wme_hipri_traffic++;
|
||||
rxseq = le16toh(*(uint16_t *)wh->i_seq);
|
||||
if ((ni->ni_flags & IEEE80211_NODE_HT) == 0 &&
|
||||
(wh->i_fc[1] & IEEE80211_FC1_RETRY) &&
|
||||
SEQ_LEQ(rxseq, ni->ni_rxseqs[tid])) {
|
||||
if (! ieee80211_check_rxseq(ni, wh)) {
|
||||
/* duplicate, discard */
|
||||
IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT,
|
||||
bssid, "duplicate",
|
||||
@ -914,7 +911,6 @@ out:
|
||||
m_freem(m);
|
||||
}
|
||||
return type;
|
||||
#undef SEQ_LEQ
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2194,18 +2190,38 @@ hostap_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0,
|
||||
}
|
||||
|
||||
case IEEE80211_FC0_SUBTYPE_ACTION:
|
||||
if (vap->iv_state == IEEE80211_S_RUN) {
|
||||
if (ieee80211_parse_action(ni, m0) == 0)
|
||||
ic->ic_recv_action(ni, wh, frm, efrm);
|
||||
} else
|
||||
case IEEE80211_FC0_SUBTYPE_ACTION_NOACK:
|
||||
if (ni == vap->iv_bss) {
|
||||
IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT,
|
||||
wh, NULL, "%s", "unknown node");
|
||||
vap->iv_stats.is_rx_mgtdiscard++;
|
||||
} else if (!IEEE80211_ADDR_EQ(vap->iv_myaddr, wh->i_addr1) &&
|
||||
!IEEE80211_IS_MULTICAST(wh->i_addr1)) {
|
||||
IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT,
|
||||
wh, NULL, "%s", "not for us");
|
||||
vap->iv_stats.is_rx_mgtdiscard++;
|
||||
} else if (vap->iv_state != IEEE80211_S_RUN) {
|
||||
IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT,
|
||||
wh, NULL, "wrong state %s",
|
||||
ieee80211_state_name[vap->iv_state]);
|
||||
vap->iv_stats.is_rx_mgtdiscard++;
|
||||
} else {
|
||||
if (ieee80211_parse_action(ni, m0) == 0)
|
||||
(void)ic->ic_recv_action(ni, wh, frm, efrm);
|
||||
}
|
||||
break;
|
||||
|
||||
case IEEE80211_FC0_SUBTYPE_ASSOC_RESP:
|
||||
case IEEE80211_FC0_SUBTYPE_REASSOC_RESP:
|
||||
case IEEE80211_FC0_SUBTYPE_ATIM:
|
||||
IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT,
|
||||
wh, NULL, "%s", "not handled");
|
||||
vap->iv_stats.is_rx_mgtdiscard++;
|
||||
break;
|
||||
|
||||
default:
|
||||
IEEE80211_DISCARD(vap, IEEE80211_MSG_ANY,
|
||||
wh, "mgt", "subtype 0x%x not handled", subtype);
|
||||
wh, "mgt", "subtype 0x%x not handled", subtype);
|
||||
vap->iv_stats.is_rx_badsubtype++;
|
||||
break;
|
||||
}
|
||||
|
@ -54,31 +54,86 @@ __FBSDID("$FreeBSD$");
|
||||
#define MS(_v, _f) (((_v) & _f) >> _f##_S)
|
||||
#define SM(_v, _f) (((_v) << _f##_S) & _f)
|
||||
|
||||
const struct ieee80211_mcs_rates ieee80211_htrates[16] = {
|
||||
{ 13, 14, 27, 30 }, /* MCS 0 */
|
||||
{ 26, 29, 54, 60 }, /* MCS 1 */
|
||||
{ 39, 43, 81, 90 }, /* MCS 2 */
|
||||
{ 52, 58, 108, 120 }, /* MCS 3 */
|
||||
{ 78, 87, 162, 180 }, /* MCS 4 */
|
||||
{ 104, 116, 216, 240 }, /* MCS 5 */
|
||||
{ 117, 130, 243, 270 }, /* MCS 6 */
|
||||
{ 130, 144, 270, 300 }, /* MCS 7 */
|
||||
{ 26, 29, 54, 60 }, /* MCS 8 */
|
||||
{ 52, 58, 108, 120 }, /* MCS 9 */
|
||||
{ 78, 87, 162, 180 }, /* MCS 10 */
|
||||
{ 104, 116, 216, 240 }, /* MCS 11 */
|
||||
{ 156, 173, 324, 360 }, /* MCS 12 */
|
||||
{ 208, 231, 432, 480 }, /* MCS 13 */
|
||||
{ 234, 260, 486, 540 }, /* MCS 14 */
|
||||
{ 260, 289, 540, 600 } /* MCS 15 */
|
||||
const struct ieee80211_mcs_rates ieee80211_htrates[IEEE80211_HTRATE_MAXSIZE] = {
|
||||
{ 13, 14, 27, 30 }, /* MCS 0 */
|
||||
{ 26, 29, 54, 60 }, /* MCS 1 */
|
||||
{ 39, 43, 81, 90 }, /* MCS 2 */
|
||||
{ 52, 58, 108, 120 }, /* MCS 3 */
|
||||
{ 78, 87, 162, 180 }, /* MCS 4 */
|
||||
{ 104, 116, 216, 240 }, /* MCS 5 */
|
||||
{ 117, 130, 243, 270 }, /* MCS 6 */
|
||||
{ 130, 144, 270, 300 }, /* MCS 7 */
|
||||
{ 26, 29, 54, 60 }, /* MCS 8 */
|
||||
{ 52, 58, 108, 120 }, /* MCS 9 */
|
||||
{ 78, 87, 162, 180 }, /* MCS 10 */
|
||||
{ 104, 116, 216, 240 }, /* MCS 11 */
|
||||
{ 156, 173, 324, 360 }, /* MCS 12 */
|
||||
{ 208, 231, 432, 480 }, /* MCS 13 */
|
||||
{ 234, 260, 486, 540 }, /* MCS 14 */
|
||||
{ 260, 289, 540, 600 }, /* MCS 15 */
|
||||
{ 39, 43, 81, 90 }, /* MCS 16 */
|
||||
{ 78, 87, 162, 180 }, /* MCS 17 */
|
||||
{ 117, 130, 243, 270 }, /* MCS 18 */
|
||||
{ 156, 173, 324, 360 }, /* MCS 19 */
|
||||
{ 234, 260, 486, 540 }, /* MCS 20 */
|
||||
{ 312, 347, 648, 720 }, /* MCS 21 */
|
||||
{ 351, 390, 729, 810 }, /* MCS 22 */
|
||||
{ 390, 433, 810, 900 }, /* MCS 23 */
|
||||
{ 52, 58, 108, 120 }, /* MCS 24 */
|
||||
{ 104, 116, 216, 240 }, /* MCS 25 */
|
||||
{ 156, 173, 324, 360 }, /* MCS 26 */
|
||||
{ 208, 231, 432, 480 }, /* MCS 27 */
|
||||
{ 312, 347, 648, 720 }, /* MCS 28 */
|
||||
{ 416, 462, 864, 960 }, /* MCS 29 */
|
||||
{ 468, 520, 972, 1080 }, /* MCS 30 */
|
||||
{ 520, 578, 1080, 1200 }, /* MCS 31 */
|
||||
{ 0, 0, 12, 13 }, /* MCS 32 */
|
||||
{ 78, 87, 162, 180 }, /* MCS 33 */
|
||||
{ 104, 116, 216, 240 }, /* MCS 34 */
|
||||
{ 130, 144, 270, 300 }, /* MCS 35 */
|
||||
{ 117, 130, 243, 270 }, /* MCS 36 */
|
||||
{ 156, 173, 324, 360 }, /* MCS 37 */
|
||||
{ 195, 217, 405, 450 }, /* MCS 38 */
|
||||
{ 104, 116, 216, 240 }, /* MCS 39 */
|
||||
{ 130, 144, 270, 300 }, /* MCS 40 */
|
||||
{ 130, 144, 270, 300 }, /* MCS 41 */
|
||||
{ 156, 173, 324, 360 }, /* MCS 42 */
|
||||
{ 182, 202, 378, 420 }, /* MCS 43 */
|
||||
{ 182, 202, 378, 420 }, /* MCS 44 */
|
||||
{ 208, 231, 432, 480 }, /* MCS 45 */
|
||||
{ 156, 173, 324, 360 }, /* MCS 46 */
|
||||
{ 195, 217, 405, 450 }, /* MCS 47 */
|
||||
{ 195, 217, 405, 450 }, /* MCS 48 */
|
||||
{ 234, 260, 486, 540 }, /* MCS 49 */
|
||||
{ 273, 303, 567, 630 }, /* MCS 50 */
|
||||
{ 273, 303, 567, 630 }, /* MCS 51 */
|
||||
{ 312, 347, 648, 720 }, /* MCS 52 */
|
||||
{ 130, 144, 270, 300 }, /* MCS 53 */
|
||||
{ 156, 173, 324, 360 }, /* MCS 54 */
|
||||
{ 182, 202, 378, 420 }, /* MCS 55 */
|
||||
{ 156, 173, 324, 360 }, /* MCS 56 */
|
||||
{ 182, 202, 378, 420 }, /* MCS 57 */
|
||||
{ 208, 231, 432, 480 }, /* MCS 58 */
|
||||
{ 234, 260, 486, 540 }, /* MCS 59 */
|
||||
{ 208, 231, 432, 480 }, /* MCS 60 */
|
||||
{ 234, 260, 486, 540 }, /* MCS 61 */
|
||||
{ 260, 289, 540, 600 }, /* MCS 62 */
|
||||
{ 260, 289, 540, 600 }, /* MCS 63 */
|
||||
{ 286, 318, 594, 660 }, /* MCS 64 */
|
||||
{ 195, 217, 405, 450 }, /* MCS 65 */
|
||||
{ 234, 260, 486, 540 }, /* MCS 66 */
|
||||
{ 273, 303, 567, 630 }, /* MCS 67 */
|
||||
{ 234, 260, 486, 540 }, /* MCS 68 */
|
||||
{ 273, 303, 567, 630 }, /* MCS 69 */
|
||||
{ 312, 347, 648, 720 }, /* MCS 70 */
|
||||
{ 351, 390, 729, 810 }, /* MCS 71 */
|
||||
{ 312, 347, 648, 720 }, /* MCS 72 */
|
||||
{ 351, 390, 729, 810 }, /* MCS 73 */
|
||||
{ 390, 433, 810, 900 }, /* MCS 74 */
|
||||
{ 390, 433, 810, 900 }, /* MCS 75 */
|
||||
{ 429, 477, 891, 990 }, /* MCS 76 */
|
||||
};
|
||||
|
||||
static const struct ieee80211_htrateset ieee80211_rateset_11n =
|
||||
{ 16, {
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
||||
10, 11, 12, 13, 14, 15 }
|
||||
};
|
||||
|
||||
#ifdef IEEE80211_AMPDU_AGE
|
||||
static int ieee80211_ampdu_age = -1; /* threshold for ampdu reorder q (ms) */
|
||||
SYSCTL_PROC(_net_wlan, OID_AUTO, ampdu_age, CTLTYPE_INT | CTLFLAG_RW,
|
||||
@ -162,6 +217,9 @@ static int ieee80211_addba_response(struct ieee80211_node *ni,
|
||||
int code, int baparamset, int batimeout);
|
||||
static void ieee80211_addba_stop(struct ieee80211_node *ni,
|
||||
struct ieee80211_tx_ampdu *tap);
|
||||
static void null_addba_response_timeout(struct ieee80211_node *ni,
|
||||
struct ieee80211_tx_ampdu *tap);
|
||||
|
||||
static void ieee80211_bar_response(struct ieee80211_node *ni,
|
||||
struct ieee80211_tx_ampdu *tap, int status);
|
||||
static void ampdu_tx_stop(struct ieee80211_tx_ampdu *tap);
|
||||
@ -179,6 +237,7 @@ ieee80211_ht_attach(struct ieee80211com *ic)
|
||||
ic->ic_ampdu_enable = ieee80211_ampdu_enable;
|
||||
ic->ic_addba_request = ieee80211_addba_request;
|
||||
ic->ic_addba_response = ieee80211_addba_response;
|
||||
ic->ic_addba_response_timeout = null_addba_response_timeout;
|
||||
ic->ic_addba_stop = ieee80211_addba_stop;
|
||||
ic->ic_bar_response = ieee80211_bar_response;
|
||||
ic->ic_ampdu_rx_start = ampdu_rx_start;
|
||||
@ -247,40 +306,149 @@ ieee80211_ht_vdetach(struct ieee80211vap *vap)
|
||||
{
|
||||
}
|
||||
|
||||
static int
|
||||
ht_getrate(struct ieee80211com *ic, int index, int mode, int ratetype)
|
||||
{
|
||||
int mword, rate;
|
||||
|
||||
mword = ieee80211_rate2media(ic, index | IEEE80211_RATE_MCS, mode);
|
||||
if (IFM_SUBTYPE(mword) != IFM_IEEE80211_MCS)
|
||||
return (0);
|
||||
switch (ratetype) {
|
||||
case 0:
|
||||
rate = ieee80211_htrates[index].ht20_rate_800ns;
|
||||
break;
|
||||
case 1:
|
||||
rate = ieee80211_htrates[index].ht20_rate_400ns;
|
||||
break;
|
||||
case 2:
|
||||
rate = ieee80211_htrates[index].ht40_rate_800ns;
|
||||
break;
|
||||
default:
|
||||
rate = ieee80211_htrates[index].ht40_rate_400ns;
|
||||
break;
|
||||
}
|
||||
return (rate);
|
||||
}
|
||||
|
||||
static struct printranges {
|
||||
int minmcs;
|
||||
int maxmcs;
|
||||
int txstream;
|
||||
int ratetype;
|
||||
int htcapflags;
|
||||
} ranges[] = {
|
||||
{ 0, 7, 1, 0, 0 },
|
||||
{ 8, 15, 2, 0, 0 },
|
||||
{ 16, 23, 3, 0, 0 },
|
||||
{ 24, 31, 4, 0, 0 },
|
||||
{ 32, 0, 1, 2, IEEE80211_HTC_TXMCS32 },
|
||||
{ 33, 38, 2, 0, IEEE80211_HTC_TXUNEQUAL },
|
||||
{ 39, 52, 3, 0, IEEE80211_HTC_TXUNEQUAL },
|
||||
{ 53, 76, 4, 0, IEEE80211_HTC_TXUNEQUAL },
|
||||
{ 0, 0, 0, 0, 0 },
|
||||
};
|
||||
|
||||
static void
|
||||
ht_announce(struct ieee80211com *ic, int mode,
|
||||
const struct ieee80211_htrateset *rs)
|
||||
ht_rateprint(struct ieee80211com *ic, int mode, int ratetype)
|
||||
{
|
||||
struct ifnet *ifp = ic->ic_ifp;
|
||||
int i, rate, mword;
|
||||
int minrate, maxrate;
|
||||
struct printranges *range;
|
||||
|
||||
if_printf(ifp, "%s MCS: ", ieee80211_phymode_name[mode]);
|
||||
for (i = 0; i < rs->rs_nrates; i++) {
|
||||
mword = ieee80211_rate2media(ic,
|
||||
rs->rs_rates[i] | IEEE80211_RATE_MCS, mode);
|
||||
if (IFM_SUBTYPE(mword) != IFM_IEEE80211_MCS)
|
||||
for (range = ranges; range->txstream != 0; range++) {
|
||||
if (ic->ic_txstream < range->txstream)
|
||||
continue;
|
||||
rate = ieee80211_htrates[rs->rs_rates[i]].ht40_rate_400ns;
|
||||
printf("%s%d%sMbps", (i != 0 ? " " : ""),
|
||||
rate / 2, ((rate & 0x1) != 0 ? ".5" : ""));
|
||||
if (range->htcapflags &&
|
||||
(ic->ic_htcaps & range->htcapflags) == 0)
|
||||
continue;
|
||||
if (ratetype < range->ratetype)
|
||||
continue;
|
||||
minrate = ht_getrate(ic, range->minmcs, mode, ratetype);
|
||||
maxrate = ht_getrate(ic, range->maxmcs, mode, ratetype);
|
||||
if (range->maxmcs) {
|
||||
if_printf(ifp, "MCS %d-%d: %d%sMbps - %d%sMbps\n",
|
||||
range->minmcs, range->maxmcs,
|
||||
minrate/2, ((minrate & 0x1) != 0 ? ".5" : ""),
|
||||
maxrate/2, ((maxrate & 0x1) != 0 ? ".5" : ""));
|
||||
} else {
|
||||
if_printf(ifp, "MCS %d: %d%sMbps\n", range->minmcs,
|
||||
minrate/2, ((minrate & 0x1) != 0 ? ".5" : ""));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ht_announce(struct ieee80211com *ic, int mode)
|
||||
{
|
||||
struct ifnet *ifp = ic->ic_ifp;
|
||||
const char *modestr = ieee80211_phymode_name[mode];
|
||||
|
||||
if_printf(ifp, "%s MCS 20MHz\n", modestr);
|
||||
ht_rateprint(ic, mode, 0);
|
||||
if (ic->ic_htcaps & IEEE80211_HTCAP_SHORTGI20) {
|
||||
if_printf(ifp, "%s MCS 20MHz SGI\n", modestr);
|
||||
ht_rateprint(ic, mode, 1);
|
||||
}
|
||||
if (ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40) {
|
||||
if_printf(ifp, "%s MCS 40MHz:\n", modestr);
|
||||
ht_rateprint(ic, mode, 2);
|
||||
}
|
||||
if ((ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40) &&
|
||||
(ic->ic_htcaps & IEEE80211_HTCAP_SHORTGI40)) {
|
||||
if_printf(ifp, "%s MCS 40MHz SGI:\n", modestr);
|
||||
ht_rateprint(ic, mode, 3);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void
|
||||
ieee80211_ht_announce(struct ieee80211com *ic)
|
||||
{
|
||||
struct ifnet *ifp = ic->ic_ifp;
|
||||
|
||||
if (isset(ic->ic_modecaps, IEEE80211_MODE_11NA) ||
|
||||
isset(ic->ic_modecaps, IEEE80211_MODE_11NG))
|
||||
if_printf(ifp, "%dT%dR\n", ic->ic_txstream, ic->ic_rxstream);
|
||||
if (isset(ic->ic_modecaps, IEEE80211_MODE_11NA))
|
||||
ht_announce(ic, IEEE80211_MODE_11NA, &ieee80211_rateset_11n);
|
||||
ht_announce(ic, IEEE80211_MODE_11NA);
|
||||
if (isset(ic->ic_modecaps, IEEE80211_MODE_11NG))
|
||||
ht_announce(ic, IEEE80211_MODE_11NG, &ieee80211_rateset_11n);
|
||||
ht_announce(ic, IEEE80211_MODE_11NG);
|
||||
}
|
||||
|
||||
static struct ieee80211_htrateset htrateset;
|
||||
|
||||
const struct ieee80211_htrateset *
|
||||
ieee80211_get_suphtrates(struct ieee80211com *ic,
|
||||
const struct ieee80211_channel *c)
|
||||
const struct ieee80211_channel *c)
|
||||
{
|
||||
return &ieee80211_rateset_11n;
|
||||
#define ADDRATE(x) do { \
|
||||
htrateset.rs_rates[htrateset.rs_nrates] = x; \
|
||||
htrateset.rs_nrates++; \
|
||||
} while (0)
|
||||
int i;
|
||||
|
||||
memset(&htrateset, 0, sizeof(struct ieee80211_htrateset));
|
||||
for (i = 0; i < ic->ic_txstream * 8; i++)
|
||||
ADDRATE(i);
|
||||
if ((ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40) &&
|
||||
(ic->ic_htcaps & IEEE80211_HTC_TXMCS32))
|
||||
ADDRATE(i);
|
||||
if (ic->ic_htcaps & IEEE80211_HTC_TXUNEQUAL) {
|
||||
if (ic->ic_txstream >= 2) {
|
||||
for (i = 33; i <= 38; i++)
|
||||
ADDRATE(i);
|
||||
}
|
||||
if (ic->ic_txstream >= 3) {
|
||||
for (i = 39; i <= 52; i++)
|
||||
ADDRATE(i);
|
||||
}
|
||||
if (ic->ic_txstream == 4) {
|
||||
for (i = 53; i <= 76; i++)
|
||||
ADDRATE(i);
|
||||
}
|
||||
}
|
||||
return &htrateset;
|
||||
#undef ADDRATE
|
||||
}
|
||||
|
||||
/*
|
||||
@ -396,6 +564,7 @@ ampdu_rx_start(struct ieee80211_node *ni, struct ieee80211_rx_ampdu *rap,
|
||||
static void
|
||||
ampdu_rx_stop(struct ieee80211_node *ni, struct ieee80211_rx_ampdu *rap)
|
||||
{
|
||||
|
||||
ampdu_rx_purge(rap);
|
||||
rap->rxa_flags &= ~(IEEE80211_AGGR_RUNNING | IEEE80211_AGGR_XCHGPEND);
|
||||
}
|
||||
@ -656,7 +825,7 @@ again:
|
||||
if (off < rap->rxa_wnd) {
|
||||
/*
|
||||
* Common case (hopefully): in the BA window.
|
||||
* Sec 9.10.7.6 a) (D2.04 p.118 line 47)
|
||||
* Sec 9.10.7.6.2 a) (p.137)
|
||||
*/
|
||||
#ifdef IEEE80211_AMPDU_AGE
|
||||
/*
|
||||
@ -721,7 +890,7 @@ again:
|
||||
/*
|
||||
* Outside the BA window, but within range;
|
||||
* flush the reorder q and move the window.
|
||||
* Sec 9.10.7.6 b) (D2.04 p.118 line 60)
|
||||
* Sec 9.10.7.6.2 b) (p.138)
|
||||
*/
|
||||
IEEE80211_NOTE(vap, IEEE80211_MSG_11N, ni,
|
||||
"move BA win <%u:%u> (%u frames) rxseq %u tid %u",
|
||||
@ -745,7 +914,7 @@ again:
|
||||
} else {
|
||||
/*
|
||||
* Outside the BA window and out of range; toss.
|
||||
* Sec 9.10.7.6 c) (D2.04 p.119 line 16)
|
||||
* Sec 9.10.7.6.2 c) (p.138)
|
||||
*/
|
||||
IEEE80211_DISCARD_MAC(vap,
|
||||
IEEE80211_MSG_INPUT | IEEE80211_MSG_11N, ni->ni_macaddr,
|
||||
@ -809,7 +978,7 @@ ieee80211_recv_bar(struct ieee80211_node *ni, struct mbuf *m0)
|
||||
if (off < IEEE80211_SEQ_BA_RANGE) {
|
||||
/*
|
||||
* Flush the reorder q up to rxseq and move the window.
|
||||
* Sec 9.10.7.6 a) (D2.04 p.119 line 22)
|
||||
* Sec 9.10.7.6.3 a) (p.138)
|
||||
*/
|
||||
IEEE80211_NOTE(vap, IEEE80211_MSG_11N, ni,
|
||||
"BAR moves BA win <%u:%u> (%u frames) rxseq %u tid %u",
|
||||
@ -830,7 +999,7 @@ ieee80211_recv_bar(struct ieee80211_node *ni, struct mbuf *m0)
|
||||
} else {
|
||||
/*
|
||||
* Out of range; toss.
|
||||
* Sec 9.10.7.6 b) (D2.04 p.119 line 41)
|
||||
* Sec 9.10.7.6.3 b) (p.138)
|
||||
*/
|
||||
IEEE80211_DISCARD_MAC(vap,
|
||||
IEEE80211_MSG_INPUT | IEEE80211_MSG_11N, ni->ni_macaddr,
|
||||
@ -1398,7 +1567,7 @@ ieee80211_ht_updatehtcap(struct ieee80211_node *ni, const uint8_t *htcapie)
|
||||
htcap_update_shortgi(ni);
|
||||
|
||||
/* NB: honor operating mode constraint */
|
||||
/* XXX 40 MHZ intolerant */
|
||||
/* XXX 40 MHz intolerant */
|
||||
htflags = (vap->iv_flags_ht & IEEE80211_FHT_HT) ?
|
||||
IEEE80211_CHAN_HT20 : 0;
|
||||
if ((ni->ni_htcap & IEEE80211_HTCAP_CHWIDTH40) &&
|
||||
@ -1417,10 +1586,22 @@ ieee80211_ht_updatehtcap(struct ieee80211_node *ni, const uint8_t *htcapie)
|
||||
int
|
||||
ieee80211_setup_htrates(struct ieee80211_node *ni, const uint8_t *ie, int flags)
|
||||
{
|
||||
struct ieee80211com *ic = ni->ni_ic;
|
||||
struct ieee80211vap *vap = ni->ni_vap;
|
||||
const struct ieee80211_ie_htcap *htcap;
|
||||
struct ieee80211_htrateset *rs;
|
||||
int i;
|
||||
int i, maxequalmcs, maxunequalmcs;
|
||||
|
||||
maxequalmcs = ic->ic_txstream * 8 - 1;
|
||||
if (ic->ic_htcaps & IEEE80211_HTC_TXUNEQUAL) {
|
||||
if (ic->ic_txstream >= 2)
|
||||
maxunequalmcs = 38;
|
||||
if (ic->ic_txstream >= 3)
|
||||
maxunequalmcs = 52;
|
||||
if (ic->ic_txstream >= 4)
|
||||
maxunequalmcs = 76;
|
||||
} else
|
||||
maxunequalmcs = 0;
|
||||
|
||||
rs = &ni->ni_htrates;
|
||||
memset(rs, 0, sizeof(*rs));
|
||||
@ -1439,6 +1620,13 @@ ieee80211_setup_htrates(struct ieee80211_node *ni, const uint8_t *ie, int flags)
|
||||
vap->iv_stats.is_rx_rstoobig++;
|
||||
break;
|
||||
}
|
||||
if (i <= 31 && i > maxequalmcs)
|
||||
continue;
|
||||
if (i == 32 &&
|
||||
(ic->ic_htcaps & IEEE80211_HTC_TXMCS32) == 0)
|
||||
continue;
|
||||
if (i > 32 && i > maxunequalmcs)
|
||||
continue;
|
||||
rs->rs_rates[rs->rs_nrates++] = i;
|
||||
}
|
||||
}
|
||||
@ -1507,14 +1695,23 @@ ampdu_tx_stop(struct ieee80211_tx_ampdu *tap)
|
||||
tap->txa_flags &= ~(IEEE80211_AGGR_SETUP | IEEE80211_AGGR_NAK);
|
||||
}
|
||||
|
||||
/*
|
||||
* ADDBA response timeout.
|
||||
*
|
||||
* If software aggregation and per-TID queue management was done here,
|
||||
* that queue would be unpaused after the ADDBA timeout occurs.
|
||||
*/
|
||||
static void
|
||||
addba_timeout(void *arg)
|
||||
{
|
||||
struct ieee80211_tx_ampdu *tap = arg;
|
||||
struct ieee80211_node *ni = tap->txa_ni;
|
||||
struct ieee80211com *ic = ni->ni_ic;
|
||||
|
||||
/* XXX ? */
|
||||
tap->txa_flags &= ~IEEE80211_AGGR_XCHGPEND;
|
||||
tap->txa_attempts++;
|
||||
ic->ic_addba_response_timeout(ni, tap);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1537,6 +1734,12 @@ addba_stop_timeout(struct ieee80211_tx_ampdu *tap)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
null_addba_response_timeout(struct ieee80211_node *ni,
|
||||
struct ieee80211_tx_ampdu *tap)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Default method for requesting A-MPDU tx aggregation.
|
||||
* We setup the specified state block and start a timer
|
||||
@ -1621,7 +1824,7 @@ ht_recv_action_ba_addba_request(struct ieee80211_node *ni,
|
||||
struct ieee80211_rx_ampdu *rap;
|
||||
uint8_t dialogtoken;
|
||||
uint16_t baparamset, batimeout, baseqctl;
|
||||
uint16_t args[4];
|
||||
uint16_t args[5];
|
||||
int tid;
|
||||
|
||||
dialogtoken = frm[2];
|
||||
@ -1671,6 +1874,7 @@ ht_recv_action_ba_addba_request(struct ieee80211_node *ni,
|
||||
| SM(rap->rxa_wnd, IEEE80211_BAPS_BUFSIZ)
|
||||
;
|
||||
args[3] = 0;
|
||||
args[4] = 0;
|
||||
ic->ic_send_action(ni, IEEE80211_ACTION_CAT_BA,
|
||||
IEEE80211_ACTION_BA_ADDBA_RESPONSE, args);
|
||||
return 0;
|
||||
@ -1874,7 +2078,7 @@ ieee80211_ampdu_request(struct ieee80211_node *ni,
|
||||
struct ieee80211_tx_ampdu *tap)
|
||||
{
|
||||
struct ieee80211com *ic = ni->ni_ic;
|
||||
uint16_t args[4];
|
||||
uint16_t args[5];
|
||||
int tid, dialogtoken;
|
||||
static int tokens = 0; /* XXX */
|
||||
|
||||
@ -1891,13 +2095,14 @@ ieee80211_ampdu_request(struct ieee80211_node *ni,
|
||||
tap->txa_start = ni->ni_txseqs[tid];
|
||||
|
||||
args[0] = dialogtoken;
|
||||
args[1] = IEEE80211_BAPS_POLICY_IMMEDIATE
|
||||
args[1] = 0; /* NB: status code not used */
|
||||
args[2] = IEEE80211_BAPS_POLICY_IMMEDIATE
|
||||
| SM(tid, IEEE80211_BAPS_TID)
|
||||
| SM(IEEE80211_AGGR_BAWMAX, IEEE80211_BAPS_BUFSIZ)
|
||||
;
|
||||
args[2] = 0; /* batimeout */
|
||||
args[3] = 0; /* batimeout */
|
||||
/* NB: do first so there's no race against reply */
|
||||
if (!ic->ic_addba_request(ni, tap, dialogtoken, args[1], args[2])) {
|
||||
if (!ic->ic_addba_request(ni, tap, dialogtoken, args[2], args[3])) {
|
||||
/* unable to setup state, don't make request */
|
||||
IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_11N,
|
||||
ni, "%s: could not setup BA stream for AC %d",
|
||||
@ -1911,7 +2116,7 @@ ieee80211_ampdu_request(struct ieee80211_node *ni,
|
||||
}
|
||||
tokens = dialogtoken; /* allocate token */
|
||||
/* NB: after calling ic_addba_request so driver can set txa_start */
|
||||
args[3] = SM(tap->txa_start, IEEE80211_BASEQ_START)
|
||||
args[4] = SM(tap->txa_start, IEEE80211_BASEQ_START)
|
||||
| SM(0, IEEE80211_BASEQ_FRAG)
|
||||
;
|
||||
return ic->ic_send_action(ni, IEEE80211_ACTION_CAT_BA,
|
||||
@ -2002,7 +2207,7 @@ bar_tx_complete(struct ieee80211_node *ni, void *arg, int status)
|
||||
callout_pending(&tap->txa_timer)) {
|
||||
struct ieee80211com *ic = ni->ni_ic;
|
||||
|
||||
if (status) /* ACK'd */
|
||||
if (status == 0) /* ACK'd */
|
||||
bar_stop_timer(tap);
|
||||
ic->ic_bar_response(ni, tap, status);
|
||||
/* NB: just let timer expire so we pace requests */
|
||||
@ -2014,7 +2219,7 @@ ieee80211_bar_response(struct ieee80211_node *ni,
|
||||
struct ieee80211_tx_ampdu *tap, int status)
|
||||
{
|
||||
|
||||
if (status != 0) { /* got ACK */
|
||||
if (status == 0) { /* got ACK */
|
||||
IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_11N,
|
||||
ni, "BAR moves BA win <%u:%u> (%u frames) txseq %u tid %u",
|
||||
tap->txa_start,
|
||||
@ -2104,11 +2309,15 @@ ieee80211_send_bar(struct ieee80211_node *ni,
|
||||
ni, "send BAR: tid %u ctl 0x%x start %u (attempt %d)",
|
||||
tid, barctl, seq, tap->txa_attempts);
|
||||
|
||||
/*
|
||||
* ic_raw_xmit will free the node reference
|
||||
* regardless of queue/TX success or failure.
|
||||
*/
|
||||
ret = ic->ic_raw_xmit(ni, m, NULL);
|
||||
if (ret != 0) {
|
||||
/* xmit failed, clear state flag */
|
||||
tap->txa_flags &= ~IEEE80211_AGGR_BARPEND;
|
||||
goto bad;
|
||||
return ret;
|
||||
}
|
||||
/* XXX hack against tx complete happening before timer is started */
|
||||
if (tap->txa_flags & IEEE80211_AGGR_BARPEND)
|
||||
@ -2157,12 +2366,12 @@ ht_send_action_ba_addba(struct ieee80211_node *ni,
|
||||
uint8_t *frm;
|
||||
|
||||
IEEE80211_NOTE(vap, IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, ni,
|
||||
"send ADDBA %s: dialogtoken %d "
|
||||
"send ADDBA %s: dialogtoken %d status %d "
|
||||
"baparamset 0x%x (tid %d) batimeout 0x%x baseqctl 0x%x",
|
||||
(action == IEEE80211_ACTION_BA_ADDBA_REQUEST) ?
|
||||
"request" : "response",
|
||||
args[0], args[1], MS(args[1], IEEE80211_BAPS_TID),
|
||||
args[2], args[3]);
|
||||
args[0], args[1], args[2], MS(args[2], IEEE80211_BAPS_TID),
|
||||
args[3], args[4]);
|
||||
|
||||
IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE,
|
||||
"ieee80211_ref_node (%s:%u) %p<%s> refcnt %d\n", __func__, __LINE__,
|
||||
@ -2179,10 +2388,12 @@ ht_send_action_ba_addba(struct ieee80211_node *ni,
|
||||
*frm++ = category;
|
||||
*frm++ = action;
|
||||
*frm++ = args[0]; /* dialog token */
|
||||
ADDSHORT(frm, args[1]); /* baparamset */
|
||||
ADDSHORT(frm, args[2]); /* batimeout */
|
||||
if (action == IEEE80211_ACTION_BA_ADDBA_RESPONSE)
|
||||
ADDSHORT(frm, args[1]); /* status code */
|
||||
ADDSHORT(frm, args[2]); /* baparamset */
|
||||
ADDSHORT(frm, args[3]); /* batimeout */
|
||||
if (action == IEEE80211_ACTION_BA_ADDBA_REQUEST)
|
||||
ADDSHORT(frm, args[3]); /* baseqctl */
|
||||
ADDSHORT(frm, args[4]); /* baseqctl */
|
||||
m->m_pkthdr.len = m->m_len = frm - mtod(m, uint8_t *);
|
||||
return ht_action_output(ni, m);
|
||||
} else {
|
||||
@ -2276,21 +2487,49 @@ ht_send_action_ht_txchwidth(struct ieee80211_node *ni,
|
||||
#undef ADDSHORT
|
||||
|
||||
/*
|
||||
* Construct the MCS bit mask for inclusion
|
||||
* in an HT information element.
|
||||
* Construct the MCS bit mask for inclusion in an HT capabilities
|
||||
* information element.
|
||||
*/
|
||||
static void
|
||||
ieee80211_set_htrates(uint8_t *frm, const struct ieee80211_htrateset *rs)
|
||||
static void
|
||||
ieee80211_set_mcsset(struct ieee80211com *ic, uint8_t *frm)
|
||||
{
|
||||
int i;
|
||||
uint8_t txparams;
|
||||
|
||||
for (i = 0; i < rs->rs_nrates; i++) {
|
||||
int r = rs->rs_rates[i] & IEEE80211_RATE_VAL;
|
||||
if (r < IEEE80211_HTRATE_MAXSIZE) { /* XXX? */
|
||||
/* NB: this assumes a particular implementation */
|
||||
setbit(frm, r);
|
||||
KASSERT((ic->ic_rxstream > 0 && ic->ic_rxstream <= 4),
|
||||
("ic_rxstream %d out of range", ic->ic_rxstream));
|
||||
KASSERT((ic->ic_txstream > 0 && ic->ic_txstream <= 4),
|
||||
("ic_txstream %d out of range", ic->ic_txstream));
|
||||
|
||||
for (i = 0; i < ic->ic_rxstream * 8; i++)
|
||||
setbit(frm, i);
|
||||
if ((ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40) &&
|
||||
(ic->ic_htcaps & IEEE80211_HTC_RXMCS32))
|
||||
setbit(frm, 32);
|
||||
if (ic->ic_htcaps & IEEE80211_HTC_RXUNEQUAL) {
|
||||
if (ic->ic_rxstream >= 2) {
|
||||
for (i = 33; i <= 38; i++)
|
||||
setbit(frm, i);
|
||||
}
|
||||
if (ic->ic_rxstream >= 3) {
|
||||
for (i = 39; i <= 52; i++)
|
||||
setbit(frm, i);
|
||||
}
|
||||
if (ic->ic_txstream >= 4) {
|
||||
for (i = 53; i <= 76; i++)
|
||||
setbit(frm, i);
|
||||
}
|
||||
}
|
||||
|
||||
if (ic->ic_rxstream != ic->ic_txstream) {
|
||||
txparams = 0x1; /* TX MCS set defined */
|
||||
txparams |= 0x2; /* TX RX MCS not equal */
|
||||
txparams |= (ic->ic_txstream - 1) << 2; /* num TX streams */
|
||||
if (ic->ic_htcaps & IEEE80211_HTC_TXUNEQUAL)
|
||||
txparams |= 0x16; /* TX unequal modulation sup */
|
||||
} else
|
||||
txparams = 0;
|
||||
frm[12] = txparams;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2304,8 +2543,9 @@ ieee80211_add_htcap_body(uint8_t *frm, struct ieee80211_node *ni)
|
||||
frm[1] = (v) >> 8; \
|
||||
frm += 2; \
|
||||
} while (0)
|
||||
struct ieee80211com *ic = ni->ni_ic;
|
||||
struct ieee80211vap *vap = ni->ni_vap;
|
||||
uint16_t caps;
|
||||
uint16_t caps, extcaps;
|
||||
int rxmax, density;
|
||||
|
||||
/* HT capabilities */
|
||||
@ -2327,6 +2567,17 @@ ieee80211_add_htcap_body(uint8_t *frm, struct ieee80211_node *ni)
|
||||
/* use advertised setting (XXX locally constraint) */
|
||||
rxmax = MS(ni->ni_htparam, IEEE80211_HTCAP_MAXRXAMPDU);
|
||||
density = MS(ni->ni_htparam, IEEE80211_HTCAP_MPDUDENSITY);
|
||||
|
||||
/*
|
||||
* NB: Hardware might support HT40 on some but not all
|
||||
* channels. We can't determine this earlier because only
|
||||
* after association the channel is upgraded to HT based
|
||||
* on the negotiated capabilities.
|
||||
*/
|
||||
if (ni->ni_chan != IEEE80211_CHAN_ANYC &&
|
||||
findhtchan(ic, ni->ni_chan, IEEE80211_CHAN_HT40U) == NULL &&
|
||||
findhtchan(ic, ni->ni_chan, IEEE80211_CHAN_HT40D) == NULL)
|
||||
caps &= ~IEEE80211_HTCAP_CHWIDTH40;
|
||||
} else {
|
||||
/* override 20/40 use based on current channel */
|
||||
if (IEEE80211_IS_CHAN_HT40(ni->ni_chan))
|
||||
@ -2356,15 +2607,24 @@ ieee80211_add_htcap_body(uint8_t *frm, struct ieee80211_node *ni)
|
||||
|
||||
/* supported MCS set */
|
||||
/*
|
||||
* XXX it would better to get the rate set from ni_htrates
|
||||
* so we can restrict it but for sta mode ni_htrates isn't
|
||||
* setup when we're called to form an AssocReq frame so for
|
||||
* now we're restricted to the default HT rate set.
|
||||
* XXX: For sta mode the rate set should be restricted based
|
||||
* on the AP's capabilities, but ni_htrates isn't setup when
|
||||
* we're called to form an AssocReq frame so for now we're
|
||||
* restricted to the device capabilities.
|
||||
*/
|
||||
ieee80211_set_htrates(frm, &ieee80211_rateset_11n);
|
||||
ieee80211_set_mcsset(ni->ni_ic, frm);
|
||||
|
||||
frm += __offsetof(struct ieee80211_ie_htcap, hc_extcap) -
|
||||
__offsetof(struct ieee80211_ie_htcap, hc_mcsset);
|
||||
|
||||
/* HT extended capabilities */
|
||||
extcaps = vap->iv_htextcaps & 0xffff;
|
||||
|
||||
ADDSHORT(frm, extcaps);
|
||||
|
||||
frm += sizeof(struct ieee80211_ie_htcap) -
|
||||
__offsetof(struct ieee80211_ie_htcap, hc_mcsset);
|
||||
__offsetof(struct ieee80211_ie_htcap, hc_txbf);
|
||||
|
||||
return frm;
|
||||
#undef ADDSHORT
|
||||
}
|
||||
|
@ -144,7 +144,8 @@ struct ieee80211_rx_ampdu {
|
||||
int rxa_age; /* age of oldest frame in window */
|
||||
int rxa_nframes; /* frames since ADDBA */
|
||||
struct mbuf *rxa_m[IEEE80211_AGGR_BAWMAX];
|
||||
uint64_t rxa_pad[4];
|
||||
void *rxa_private;
|
||||
uint64_t rxa_pad[3];
|
||||
};
|
||||
|
||||
void ieee80211_ht_attach(struct ieee80211com *);
|
||||
@ -160,7 +161,7 @@ struct ieee80211_mcs_rates {
|
||||
uint16_t ht40_rate_800ns;
|
||||
uint16_t ht40_rate_400ns;
|
||||
};
|
||||
extern const struct ieee80211_mcs_rates ieee80211_htrates[16];
|
||||
extern const struct ieee80211_mcs_rates ieee80211_htrates[];
|
||||
const struct ieee80211_htrateset *ieee80211_get_suphtrates(
|
||||
struct ieee80211com *, const struct ieee80211_channel *);
|
||||
|
||||
|
@ -57,8 +57,53 @@ __FBSDID("$FreeBSD$");
|
||||
#include <net/ethernet.h>
|
||||
#endif
|
||||
|
||||
static void
|
||||
ieee80211_process_mimo(struct ieee80211_node *ni, struct ieee80211_rx_stats *rx)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Verify the required MIMO bits are set */
|
||||
if ((rx->r_flags & (IEEE80211_R_C_CHAIN | IEEE80211_R_C_NF | IEEE80211_R_C_RSSI)) !=
|
||||
(IEEE80211_R_C_CHAIN | IEEE80211_R_C_NF | IEEE80211_R_C_RSSI))
|
||||
return;
|
||||
|
||||
/* XXX This assumes the MIMO radios have both ctl and ext chains */
|
||||
for (i = 0; i < MIN(rx->c_chain, IEEE80211_MAX_CHAINS); i++) {
|
||||
IEEE80211_RSSI_LPF(ni->ni_mimo_rssi_ctl[i], rx->c_rssi_ctl[i]);
|
||||
IEEE80211_RSSI_LPF(ni->ni_mimo_rssi_ext[i], rx->c_rssi_ext[i]);
|
||||
}
|
||||
|
||||
/* XXX This also assumes the MIMO radios have both ctl and ext chains */
|
||||
for(i = 0; i < MIN(rx->c_chain, IEEE80211_MAX_CHAINS); i++) {
|
||||
ni->ni_mimo_noise_ctl[i] = rx->c_nf_ctl[i];
|
||||
ni->ni_mimo_noise_ext[i] = rx->c_nf_ext[i];
|
||||
}
|
||||
ni->ni_mimo_chains = rx->c_chain;
|
||||
}
|
||||
|
||||
int
|
||||
ieee80211_input_mimo(struct ieee80211_node *ni, struct mbuf *m,
|
||||
struct ieee80211_rx_stats *rx)
|
||||
{
|
||||
/* XXX should assert IEEE80211_R_NF and IEEE80211_R_RSSI are set */
|
||||
ieee80211_process_mimo(ni, rx);
|
||||
return ieee80211_input(ni, m, rx->rssi, rx->nf);
|
||||
}
|
||||
|
||||
int
|
||||
ieee80211_input_all(struct ieee80211com *ic, struct mbuf *m, int rssi, int nf)
|
||||
{
|
||||
struct ieee80211_rx_stats rx;
|
||||
|
||||
rx.r_flags = IEEE80211_R_NF | IEEE80211_R_RSSI;
|
||||
rx.nf = nf;
|
||||
rx.rssi = rssi;
|
||||
return ieee80211_input_mimo_all(ic, m, &rx);
|
||||
}
|
||||
|
||||
int
|
||||
ieee80211_input_mimo_all(struct ieee80211com *ic, struct mbuf *m,
|
||||
struct ieee80211_rx_stats *rx)
|
||||
{
|
||||
struct ieee80211vap *vap;
|
||||
int type = -1;
|
||||
@ -96,7 +141,7 @@ ieee80211_input_all(struct ieee80211com *ic, struct mbuf *m, int rssi, int nf)
|
||||
m = NULL;
|
||||
}
|
||||
ni = ieee80211_ref_node(vap->iv_bss);
|
||||
type = ieee80211_input(ni, mcopy, rssi, nf);
|
||||
type = ieee80211_input_mimo(ni, mcopy, rx);
|
||||
ieee80211_free_node(ni);
|
||||
}
|
||||
if (m != NULL) /* no vaps, reclaim mbuf */
|
||||
@ -677,7 +722,6 @@ ieee80211_parse_action(struct ieee80211_node *ni, struct mbuf *m)
|
||||
IEEE80211_NODE_STAT(ni, rx_action);
|
||||
|
||||
/* verify frame payloads but defer processing */
|
||||
/* XXX maybe push this to method */
|
||||
switch (ia->ia_category) {
|
||||
case IEEE80211_ACTION_CAT_BA:
|
||||
switch (ia->ia_action) {
|
||||
|
@ -142,6 +142,104 @@ ishtinfooui(const uint8_t *frm)
|
||||
return frm[1] > 3 && LE_READ_4(frm+2) == ((BCM_OUI_HTINFO<<24)|BCM_OUI);
|
||||
}
|
||||
|
||||
#include <sys/endian.h> /* For le16toh() */
|
||||
|
||||
/*
|
||||
* Check the current frame sequence number against the current TID
|
||||
* state and return whether it's in sequence or should be dropped.
|
||||
*
|
||||
* Since out of order packet and duplicate packet eliminations should
|
||||
* be done by the AMPDU RX code, this routine blindly accepts all
|
||||
* frames from a HT station w/ a TID that is currently doing AMPDU-RX.
|
||||
* HT stations without WME or where the TID is not doing AMPDU-RX
|
||||
* are checked like non-HT stations.
|
||||
*
|
||||
* The routine only eliminates packets whose sequence/fragment
|
||||
* match or are less than the last seen sequence/fragment number
|
||||
* AND are retransmits It doesn't try to eliminate out of order packets.
|
||||
*
|
||||
* Since all frames after sequence number 4095 will be less than 4095
|
||||
* (as the seqnum wraps), handle that special case so packets aren't
|
||||
* incorrectly dropped - ie, if the next packet is sequence number 0
|
||||
* but a retransmit since the initial packet didn't make it.
|
||||
*/
|
||||
static __inline int
|
||||
ieee80211_check_rxseq(struct ieee80211_node *ni, struct ieee80211_frame *wh)
|
||||
{
|
||||
#define SEQ_LEQ(a,b) ((int)((a)-(b)) <= 0)
|
||||
#define SEQ_EQ(a,b) ((int)((a)-(b)) == 0)
|
||||
#define HAS_SEQ(type) ((type & 0x4) == 0)
|
||||
#define SEQNO(a) ((a) >> IEEE80211_SEQ_SEQ_SHIFT)
|
||||
#define FRAGNO(a) ((a) & IEEE80211_SEQ_FRAG_MASK)
|
||||
uint16_t rxseq;
|
||||
uint8_t type;
|
||||
uint8_t tid;
|
||||
struct ieee80211_rx_ampdu *rap;
|
||||
|
||||
rxseq = le16toh(*(uint16_t *)wh->i_seq);
|
||||
type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK;
|
||||
|
||||
/* Types with no sequence number are always treated valid */
|
||||
if (! HAS_SEQ(type))
|
||||
return 1;
|
||||
|
||||
tid = ieee80211_gettid(wh);
|
||||
|
||||
/*
|
||||
* Only do the HT AMPDU check for WME stations; non-WME HT stations
|
||||
* shouldn't exist outside of debugging. We should at least
|
||||
* handle that.
|
||||
*/
|
||||
if (tid < WME_NUM_TID) {
|
||||
rap = &ni->ni_rx_ampdu[tid];
|
||||
/* HT nodes currently doing RX AMPDU are always valid */
|
||||
if ((ni->ni_flags & IEEE80211_NODE_HT) &&
|
||||
(rap->rxa_flags & IEEE80211_AGGR_RUNNING))
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Otherwise, retries for packets below or equal to the last
|
||||
* seen sequence number should be dropped.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Treat frame seqnum 4095 as special due to boundary
|
||||
* wrapping conditions.
|
||||
*/
|
||||
if (SEQNO(ni->ni_rxseqs[tid]) == 4095) {
|
||||
/*
|
||||
* Drop retransmits on seqnum 4095/current fragment for itself.
|
||||
*/
|
||||
if (SEQ_EQ(rxseq, ni->ni_rxseqs[tid]) &&
|
||||
(wh->i_fc[1] & IEEE80211_FC1_RETRY))
|
||||
return 0;
|
||||
/*
|
||||
* Treat any subsequent frame as fine if the last seen frame
|
||||
* is 4095 and it's not a retransmit for the same sequence
|
||||
* number. However, this doesn't capture incorrectly ordered
|
||||
* fragments w/ sequence number 4095. It shouldn't be seen
|
||||
* in practice, but see the comment above for further info.
|
||||
*/
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* At this point we assume that retransmitted seq/frag numbers below
|
||||
* the current can simply be eliminated.
|
||||
*/
|
||||
if ((wh->i_fc[1] & IEEE80211_FC1_RETRY) &&
|
||||
SEQ_LEQ(rxseq, ni->ni_rxseqs[tid]))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
#undef SEQ_LEQ
|
||||
#undef SEQ_EQ
|
||||
#undef HAS_SEQ
|
||||
#undef SEQNO
|
||||
#undef FRAGNO
|
||||
}
|
||||
|
||||
void ieee80211_deliver_data(struct ieee80211vap *,
|
||||
struct ieee80211_node *, struct mbuf *);
|
||||
struct mbuf *ieee80211_defrag(struct ieee80211_node *,
|
||||
|
@ -70,6 +70,8 @@ __FBSDID("$FreeBSD$");
|
||||
static const uint8_t zerobssid[IEEE80211_ADDR_LEN];
|
||||
static struct ieee80211_channel *findchannel(struct ieee80211com *,
|
||||
int ieee, int mode);
|
||||
static int ieee80211_scanreq(struct ieee80211vap *,
|
||||
struct ieee80211_scan_req *);
|
||||
|
||||
static __noinline int
|
||||
ieee80211_ioctl_getkey(struct ieee80211vap *vap, struct ieee80211req *ireq)
|
||||
@ -141,7 +143,7 @@ static __noinline int
|
||||
ieee80211_ioctl_getchaninfo(struct ieee80211vap *vap, struct ieee80211req *ireq)
|
||||
{
|
||||
struct ieee80211com *ic = vap->iv_ic;
|
||||
int space;
|
||||
uint32_t space;
|
||||
|
||||
space = __offsetof(struct ieee80211req_chaninfo,
|
||||
ic_chans[ic->ic_nchans]);
|
||||
@ -205,7 +207,7 @@ ieee80211_ioctl_getstastats(struct ieee80211vap *vap, struct ieee80211req *ireq)
|
||||
{
|
||||
struct ieee80211_node *ni;
|
||||
uint8_t macaddr[IEEE80211_ADDR_LEN];
|
||||
const int off = __offsetof(struct ieee80211req_sta_stats, is_stats);
|
||||
const size_t off = __offsetof(struct ieee80211req_sta_stats, is_stats);
|
||||
int error;
|
||||
|
||||
if (ireq->i_len < off)
|
||||
@ -325,7 +327,7 @@ ieee80211_ioctl_getscanresults(struct ieee80211vap *vap,
|
||||
if (req.space > ireq->i_len)
|
||||
req.space = ireq->i_len;
|
||||
if (req.space > 0) {
|
||||
size_t space;
|
||||
uint32_t space;
|
||||
void *p;
|
||||
|
||||
space = req.space;
|
||||
@ -464,7 +466,7 @@ get_sta_info(void *arg, struct ieee80211_node *ni)
|
||||
|
||||
static __noinline int
|
||||
getstainfo_common(struct ieee80211vap *vap, struct ieee80211req *ireq,
|
||||
struct ieee80211_node *ni, int off)
|
||||
struct ieee80211_node *ni, size_t off)
|
||||
{
|
||||
struct ieee80211com *ic = vap->iv_ic;
|
||||
struct stainforeq req;
|
||||
@ -509,7 +511,7 @@ static __noinline int
|
||||
ieee80211_ioctl_getstainfo(struct ieee80211vap *vap, struct ieee80211req *ireq)
|
||||
{
|
||||
uint8_t macaddr[IEEE80211_ADDR_LEN];
|
||||
const int off = __offsetof(struct ieee80211req_sta_req, info);
|
||||
const size_t off = __offsetof(struct ieee80211req_sta_req, info);
|
||||
struct ieee80211_node *ni;
|
||||
int error;
|
||||
|
||||
@ -1479,14 +1481,15 @@ mlmelookup(void *arg, const struct ieee80211_scan_entry *se)
|
||||
}
|
||||
|
||||
static __noinline int
|
||||
setmlme_assoc(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN],
|
||||
int ssid_len, const uint8_t ssid[IEEE80211_NWID_LEN])
|
||||
setmlme_assoc_sta(struct ieee80211vap *vap,
|
||||
const uint8_t mac[IEEE80211_ADDR_LEN], int ssid_len,
|
||||
const uint8_t ssid[IEEE80211_NWID_LEN])
|
||||
{
|
||||
struct scanlookup lookup;
|
||||
|
||||
/* XXX ibss/ahdemo */
|
||||
if (vap->iv_opmode != IEEE80211_M_STA)
|
||||
return EINVAL;
|
||||
KASSERT(vap->iv_opmode == IEEE80211_M_STA,
|
||||
("expected opmode STA not %s",
|
||||
ieee80211_opmode_name[vap->iv_opmode]));
|
||||
|
||||
/* NB: this is racey if roaming is !manual */
|
||||
lookup.se = NULL;
|
||||
@ -1502,6 +1505,37 @@ setmlme_assoc(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN],
|
||||
return 0;
|
||||
}
|
||||
|
||||
static __noinline int
|
||||
setmlme_assoc_adhoc(struct ieee80211vap *vap,
|
||||
const uint8_t mac[IEEE80211_ADDR_LEN], int ssid_len,
|
||||
const uint8_t ssid[IEEE80211_NWID_LEN])
|
||||
{
|
||||
struct ieee80211_scan_req sr;
|
||||
|
||||
KASSERT(vap->iv_opmode == IEEE80211_M_IBSS ||
|
||||
vap->iv_opmode == IEEE80211_M_AHDEMO,
|
||||
("expected opmode IBSS or AHDEMO not %s",
|
||||
ieee80211_opmode_name[vap->iv_opmode]));
|
||||
|
||||
if (ssid_len == 0)
|
||||
return EINVAL;
|
||||
|
||||
/* NB: IEEE80211_IOC_SSID call missing for ap_scan=2. */
|
||||
memset(vap->iv_des_ssid[0].ssid, 0, IEEE80211_NWID_LEN);
|
||||
vap->iv_des_ssid[0].len = ssid_len;
|
||||
memcpy(vap->iv_des_ssid[0].ssid, ssid, ssid_len);
|
||||
vap->iv_des_nssid = 1;
|
||||
|
||||
memset(&sr, 0, sizeof(sr));
|
||||
sr.sr_flags = IEEE80211_IOC_SCAN_ACTIVE | IEEE80211_IOC_SCAN_ONCE;
|
||||
sr.sr_duration = IEEE80211_IOC_SCAN_FOREVER;
|
||||
memcpy(sr.sr_ssid[0].ssid, ssid, ssid_len);
|
||||
sr.sr_ssid[0].len = ssid_len;
|
||||
sr.sr_nssid = 1;
|
||||
|
||||
return ieee80211_scanreq(vap, &sr);
|
||||
}
|
||||
|
||||
static __noinline int
|
||||
ieee80211_ioctl_setmlme(struct ieee80211vap *vap, struct ieee80211req *ireq)
|
||||
{
|
||||
@ -1513,9 +1547,13 @@ ieee80211_ioctl_setmlme(struct ieee80211vap *vap, struct ieee80211req *ireq)
|
||||
error = copyin(ireq->i_data, &mlme, sizeof(mlme));
|
||||
if (error)
|
||||
return error;
|
||||
if (mlme.im_op == IEEE80211_MLME_ASSOC)
|
||||
return setmlme_assoc(vap, mlme.im_macaddr,
|
||||
if (vap->iv_opmode == IEEE80211_M_STA &&
|
||||
mlme.im_op == IEEE80211_MLME_ASSOC)
|
||||
return setmlme_assoc_sta(vap, mlme.im_macaddr,
|
||||
vap->iv_des_ssid[0].len, vap->iv_des_ssid[0].ssid);
|
||||
else if (mlme.im_op == IEEE80211_MLME_ASSOC)
|
||||
return setmlme_assoc_adhoc(vap, mlme.im_macaddr,
|
||||
mlme.im_ssid_len, mlme.im_ssid);
|
||||
else
|
||||
return setmlme_common(vap, mlme.im_op,
|
||||
mlme.im_macaddr, mlme.im_reason);
|
||||
@ -2344,8 +2382,8 @@ ieee80211_ioctl_chanswitch(struct ieee80211vap *vap, struct ieee80211req *ireq)
|
||||
return error;
|
||||
}
|
||||
|
||||
static __noinline int
|
||||
ieee80211_ioctl_scanreq(struct ieee80211vap *vap, struct ieee80211req *ireq)
|
||||
static int
|
||||
ieee80211_scanreq(struct ieee80211vap *vap, struct ieee80211_scan_req *sr)
|
||||
{
|
||||
#define IEEE80211_IOC_SCAN_FLAGS \
|
||||
(IEEE80211_IOC_SCAN_NOPICK | IEEE80211_IOC_SCAN_ACTIVE | \
|
||||
@ -2354,48 +2392,38 @@ ieee80211_ioctl_scanreq(struct ieee80211vap *vap, struct ieee80211req *ireq)
|
||||
IEEE80211_IOC_SCAN_NOJOIN | IEEE80211_IOC_SCAN_FLUSH | \
|
||||
IEEE80211_IOC_SCAN_CHECK)
|
||||
struct ieee80211com *ic = vap->iv_ic;
|
||||
struct ieee80211_scan_req sr; /* XXX off stack? */
|
||||
int error, i;
|
||||
|
||||
/* NB: parent must be running */
|
||||
if ((ic->ic_ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
|
||||
return ENXIO;
|
||||
|
||||
if (ireq->i_len != sizeof(sr))
|
||||
return EINVAL;
|
||||
error = copyin(ireq->i_data, &sr, sizeof(sr));
|
||||
if (error != 0)
|
||||
return error;
|
||||
/* convert duration */
|
||||
if (sr.sr_duration == IEEE80211_IOC_SCAN_FOREVER)
|
||||
sr.sr_duration = IEEE80211_SCAN_FOREVER;
|
||||
if (sr->sr_duration == IEEE80211_IOC_SCAN_FOREVER)
|
||||
sr->sr_duration = IEEE80211_SCAN_FOREVER;
|
||||
else {
|
||||
if (sr.sr_duration < IEEE80211_IOC_SCAN_DURATION_MIN ||
|
||||
sr.sr_duration > IEEE80211_IOC_SCAN_DURATION_MAX)
|
||||
if (sr->sr_duration < IEEE80211_IOC_SCAN_DURATION_MIN ||
|
||||
sr->sr_duration > IEEE80211_IOC_SCAN_DURATION_MAX)
|
||||
return EINVAL;
|
||||
sr.sr_duration = msecs_to_ticks(sr.sr_duration);
|
||||
if (sr.sr_duration < 1)
|
||||
sr.sr_duration = 1;
|
||||
sr->sr_duration = msecs_to_ticks(sr->sr_duration);
|
||||
if (sr->sr_duration < 1)
|
||||
sr->sr_duration = 1;
|
||||
}
|
||||
/* convert min/max channel dwell */
|
||||
if (sr.sr_mindwell != 0) {
|
||||
sr.sr_mindwell = msecs_to_ticks(sr.sr_mindwell);
|
||||
if (sr.sr_mindwell < 1)
|
||||
sr.sr_mindwell = 1;
|
||||
if (sr->sr_mindwell != 0) {
|
||||
sr->sr_mindwell = msecs_to_ticks(sr->sr_mindwell);
|
||||
if (sr->sr_mindwell < 1)
|
||||
sr->sr_mindwell = 1;
|
||||
}
|
||||
if (sr.sr_maxdwell != 0) {
|
||||
sr.sr_maxdwell = msecs_to_ticks(sr.sr_maxdwell);
|
||||
if (sr.sr_maxdwell < 1)
|
||||
sr.sr_maxdwell = 1;
|
||||
if (sr->sr_maxdwell != 0) {
|
||||
sr->sr_maxdwell = msecs_to_ticks(sr->sr_maxdwell);
|
||||
if (sr->sr_maxdwell < 1)
|
||||
sr->sr_maxdwell = 1;
|
||||
}
|
||||
/* NB: silently reduce ssid count to what is supported */
|
||||
if (sr.sr_nssid > IEEE80211_SCAN_MAX_SSID)
|
||||
sr.sr_nssid = IEEE80211_SCAN_MAX_SSID;
|
||||
for (i = 0; i < sr.sr_nssid; i++)
|
||||
if (sr.sr_ssid[i].len > IEEE80211_NWID_LEN)
|
||||
if (sr->sr_nssid > IEEE80211_SCAN_MAX_SSID)
|
||||
sr->sr_nssid = IEEE80211_SCAN_MAX_SSID;
|
||||
for (i = 0; i < sr->sr_nssid; i++)
|
||||
if (sr->sr_ssid[i].len > IEEE80211_NWID_LEN)
|
||||
return EINVAL;
|
||||
/* cleanse flags just in case, could reject if invalid flags */
|
||||
sr.sr_flags &= IEEE80211_IOC_SCAN_FLAGS;
|
||||
sr->sr_flags &= IEEE80211_IOC_SCAN_FLAGS;
|
||||
/*
|
||||
* Add an implicit NOPICK if the vap is not marked UP. This
|
||||
* allows applications to scan without joining a bss (or picking
|
||||
@ -2403,13 +2431,13 @@ ieee80211_ioctl_scanreq(struct ieee80211vap *vap, struct ieee80211req *ireq)
|
||||
* roaming mode--you just need to mark the parent device UP.
|
||||
*/
|
||||
if ((vap->iv_ifp->if_flags & IFF_UP) == 0)
|
||||
sr.sr_flags |= IEEE80211_IOC_SCAN_NOPICK;
|
||||
sr->sr_flags |= IEEE80211_IOC_SCAN_NOPICK;
|
||||
|
||||
IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN,
|
||||
"%s: flags 0x%x%s duration 0x%x mindwell %u maxdwell %u nssid %d\n",
|
||||
__func__, sr.sr_flags,
|
||||
__func__, sr->sr_flags,
|
||||
(vap->iv_ifp->if_flags & IFF_UP) == 0 ? " (!IFF_UP)" : "",
|
||||
sr.sr_duration, sr.sr_mindwell, sr.sr_maxdwell, sr.sr_nssid);
|
||||
sr->sr_duration, sr->sr_mindwell, sr->sr_maxdwell, sr->sr_nssid);
|
||||
/*
|
||||
* If we are in INIT state then the driver has never had a chance
|
||||
* to setup hardware state to do a scan; we must use the state
|
||||
@ -2424,13 +2452,13 @@ ieee80211_ioctl_scanreq(struct ieee80211vap *vap, struct ieee80211req *ireq)
|
||||
IEEE80211_LOCK(ic);
|
||||
if (vap->iv_state == IEEE80211_S_INIT) {
|
||||
/* NB: clobbers previous settings */
|
||||
vap->iv_scanreq_flags = sr.sr_flags;
|
||||
vap->iv_scanreq_duration = sr.sr_duration;
|
||||
vap->iv_scanreq_nssid = sr.sr_nssid;
|
||||
for (i = 0; i < sr.sr_nssid; i++) {
|
||||
vap->iv_scanreq_ssid[i].len = sr.sr_ssid[i].len;
|
||||
memcpy(vap->iv_scanreq_ssid[i].ssid, sr.sr_ssid[i].ssid,
|
||||
sr.sr_ssid[i].len);
|
||||
vap->iv_scanreq_flags = sr->sr_flags;
|
||||
vap->iv_scanreq_duration = sr->sr_duration;
|
||||
vap->iv_scanreq_nssid = sr->sr_nssid;
|
||||
for (i = 0; i < sr->sr_nssid; i++) {
|
||||
vap->iv_scanreq_ssid[i].len = sr->sr_ssid[i].len;
|
||||
memcpy(vap->iv_scanreq_ssid[i].ssid,
|
||||
sr->sr_ssid[i].ssid, sr->sr_ssid[i].len);
|
||||
}
|
||||
vap->iv_flags_ext |= IEEE80211_FEXT_SCANREQ;
|
||||
IEEE80211_UNLOCK(ic);
|
||||
@ -2438,25 +2466,45 @@ ieee80211_ioctl_scanreq(struct ieee80211vap *vap, struct ieee80211req *ireq)
|
||||
} else {
|
||||
vap->iv_flags_ext &= ~IEEE80211_FEXT_SCANREQ;
|
||||
IEEE80211_UNLOCK(ic);
|
||||
/* XXX neeed error return codes */
|
||||
if (sr.sr_flags & IEEE80211_IOC_SCAN_CHECK) {
|
||||
(void) ieee80211_check_scan(vap, sr.sr_flags,
|
||||
sr.sr_duration, sr.sr_mindwell, sr.sr_maxdwell,
|
||||
sr.sr_nssid,
|
||||
if (sr->sr_flags & IEEE80211_IOC_SCAN_CHECK) {
|
||||
error = ieee80211_check_scan(vap, sr->sr_flags,
|
||||
sr->sr_duration, sr->sr_mindwell, sr->sr_maxdwell,
|
||||
sr->sr_nssid,
|
||||
/* NB: cheat, we assume structures are compatible */
|
||||
(const struct ieee80211_scan_ssid *) &sr.sr_ssid[0]);
|
||||
(const struct ieee80211_scan_ssid *) &sr->sr_ssid[0]);
|
||||
} else {
|
||||
(void) ieee80211_start_scan(vap, sr.sr_flags,
|
||||
sr.sr_duration, sr.sr_mindwell, sr.sr_maxdwell,
|
||||
sr.sr_nssid,
|
||||
error = ieee80211_start_scan(vap, sr->sr_flags,
|
||||
sr->sr_duration, sr->sr_mindwell, sr->sr_maxdwell,
|
||||
sr->sr_nssid,
|
||||
/* NB: cheat, we assume structures are compatible */
|
||||
(const struct ieee80211_scan_ssid *) &sr.sr_ssid[0]);
|
||||
(const struct ieee80211_scan_ssid *) &sr->sr_ssid[0]);
|
||||
}
|
||||
if (error == 0)
|
||||
return EINPROGRESS;
|
||||
}
|
||||
return error;
|
||||
return 0;
|
||||
#undef IEEE80211_IOC_SCAN_FLAGS
|
||||
}
|
||||
|
||||
static __noinline int
|
||||
ieee80211_ioctl_scanreq(struct ieee80211vap *vap, struct ieee80211req *ireq)
|
||||
{
|
||||
struct ieee80211com *ic = vap->iv_ic;
|
||||
struct ieee80211_scan_req sr; /* XXX off stack? */
|
||||
int error;
|
||||
|
||||
/* NB: parent must be running */
|
||||
if ((ic->ic_ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
|
||||
return ENXIO;
|
||||
|
||||
if (ireq->i_len != sizeof(sr))
|
||||
return EINVAL;
|
||||
error = copyin(ireq->i_data, &sr, sizeof(sr));
|
||||
if (error != 0)
|
||||
return error;
|
||||
return ieee80211_scanreq(vap, &sr);
|
||||
}
|
||||
|
||||
static __noinline int
|
||||
ieee80211_ioctl_setstavlan(struct ieee80211vap *vap, struct ieee80211req *ireq)
|
||||
{
|
||||
|
@ -582,7 +582,7 @@ struct ieee80211req {
|
||||
char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */
|
||||
uint16_t i_type; /* req type */
|
||||
int16_t i_val; /* Index or simple value */
|
||||
int16_t i_len; /* Index or simple value */
|
||||
uint16_t i_len; /* Index or simple value */
|
||||
void *i_data; /* Extra data */
|
||||
};
|
||||
#define SIOCS80211 _IOW('i', 234, struct ieee80211req)
|
||||
@ -798,7 +798,7 @@ struct ieee80211req_scan_result {
|
||||
#endif
|
||||
int8_t isr_noise;
|
||||
int8_t isr_rssi;
|
||||
uint8_t isr_intval; /* beacon interval */
|
||||
uint16_t isr_intval; /* beacon interval */
|
||||
uint8_t isr_capinfo; /* capabilities */
|
||||
uint8_t isr_erp; /* ERP element */
|
||||
uint8_t isr_bssid[IEEE80211_ADDR_LEN];
|
||||
|
@ -82,6 +82,7 @@ static void mesh_forward(struct ieee80211vap *, struct mbuf *,
|
||||
static int mesh_input(struct ieee80211_node *, struct mbuf *, int, int);
|
||||
static void mesh_recv_mgmt(struct ieee80211_node *, struct mbuf *, int,
|
||||
int, int);
|
||||
static void mesh_recv_ctl(struct ieee80211_node *, struct mbuf *, int);
|
||||
static void mesh_peer_timeout_setup(struct ieee80211_node *);
|
||||
static void mesh_peer_timeout_backoff(struct ieee80211_node *);
|
||||
static void mesh_peer_timeout_cb(void *);
|
||||
@ -520,6 +521,7 @@ mesh_vattach(struct ieee80211vap *vap)
|
||||
vap->iv_input = mesh_input;
|
||||
vap->iv_opdetach = mesh_vdetach;
|
||||
vap->iv_recv_mgmt = mesh_recv_mgmt;
|
||||
vap->iv_recv_ctl = mesh_recv_ctl;
|
||||
ms = malloc(sizeof(struct ieee80211_mesh_state), M_80211_VAP,
|
||||
M_NOWAIT | M_ZERO);
|
||||
if (ms == NULL) {
|
||||
@ -1038,7 +1040,6 @@ mesh_isucastforme(struct ieee80211vap *vap, const struct ieee80211_frame *wh,
|
||||
static int
|
||||
mesh_input(struct ieee80211_node *ni, struct mbuf *m, int rssi, int nf)
|
||||
{
|
||||
#define SEQ_LEQ(a,b) ((int)((a)-(b)) <= 0)
|
||||
#define HAS_SEQ(type) ((type & 0x4) == 0)
|
||||
struct ieee80211vap *vap = ni->ni_vap;
|
||||
struct ieee80211com *ic = ni->ni_ic;
|
||||
@ -1092,9 +1093,7 @@ mesh_input(struct ieee80211_node *ni, struct mbuf *m, int rssi, int nf)
|
||||
TID_TO_WME_AC(tid) >= WME_AC_VI)
|
||||
ic->ic_wme.wme_hipri_traffic++;
|
||||
rxseq = le16toh(*(uint16_t *)wh->i_seq);
|
||||
if ((ni->ni_flags & IEEE80211_NODE_HT) == 0 &&
|
||||
(wh->i_fc[1] & IEEE80211_FC1_RETRY) &&
|
||||
SEQ_LEQ(rxseq, ni->ni_rxseqs[tid])) {
|
||||
if (! ieee80211_check_rxseq(ni, wh)) {
|
||||
/* duplicate, discard */
|
||||
IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT,
|
||||
wh->i_addr1, "duplicate",
|
||||
@ -1461,18 +1460,19 @@ mesh_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, int subtype,
|
||||
meshid = frm;
|
||||
break;
|
||||
}
|
||||
frm += frm[2] + 2;
|
||||
frm += frm[1] + 2;
|
||||
}
|
||||
IEEE80211_VERIFY_ELEMENT(ssid, IEEE80211_NWID_LEN, return);
|
||||
IEEE80211_VERIFY_ELEMENT(rates, IEEE80211_RATE_MAXSIZE, return);
|
||||
if (xrates != NULL)
|
||||
IEEE80211_VERIFY_ELEMENT(xrates,
|
||||
IEEE80211_RATE_MAXSIZE - rates[1], return);
|
||||
if (meshid != NULL)
|
||||
if (meshid != NULL) {
|
||||
IEEE80211_VERIFY_ELEMENT(meshid,
|
||||
IEEE80211_MESHID_LEN, return);
|
||||
/* NB: meshid, not ssid */
|
||||
IEEE80211_VERIFY_SSID(vap->iv_bss, meshid, return);
|
||||
/* NB: meshid, not ssid */
|
||||
IEEE80211_VERIFY_SSID(vap->iv_bss, meshid, return);
|
||||
}
|
||||
|
||||
/* XXX find a better class or define it's own */
|
||||
IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_INPUT, wh->i_addr2,
|
||||
@ -1486,46 +1486,42 @@ mesh_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, int subtype,
|
||||
ieee80211_send_proberesp(vap, wh->i_addr2, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
case IEEE80211_FC0_SUBTYPE_ACTION:
|
||||
if (vap->iv_state != IEEE80211_S_RUN) {
|
||||
vap->iv_stats.is_rx_mgtdiscard++;
|
||||
break;
|
||||
}
|
||||
/*
|
||||
* We received an action for an unknown neighbor.
|
||||
* XXX: wait for it to beacon or create ieee80211_node?
|
||||
*/
|
||||
case IEEE80211_FC0_SUBTYPE_ACTION_NOACK:
|
||||
if (ni == vap->iv_bss) {
|
||||
IEEE80211_DISCARD(vap, IEEE80211_MSG_MESH,
|
||||
IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT,
|
||||
wh, NULL, "%s", "unknown node");
|
||||
vap->iv_stats.is_rx_mgtdiscard++;
|
||||
break;
|
||||
}
|
||||
/*
|
||||
* Discard if not for us.
|
||||
*/
|
||||
if (!IEEE80211_ADDR_EQ(vap->iv_myaddr, wh->i_addr1) &&
|
||||
} else if (!IEEE80211_ADDR_EQ(vap->iv_myaddr, wh->i_addr1) &&
|
||||
!IEEE80211_IS_MULTICAST(wh->i_addr1)) {
|
||||
IEEE80211_DISCARD(vap, IEEE80211_MSG_MESH,
|
||||
wh, NULL, "%s", "not for me");
|
||||
IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT,
|
||||
wh, NULL, "%s", "not for us");
|
||||
vap->iv_stats.is_rx_mgtdiscard++;
|
||||
break;
|
||||
} else if (vap->iv_state != IEEE80211_S_RUN) {
|
||||
IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT,
|
||||
wh, NULL, "wrong state %s",
|
||||
ieee80211_state_name[vap->iv_state]);
|
||||
vap->iv_stats.is_rx_mgtdiscard++;
|
||||
} else {
|
||||
if (ieee80211_parse_action(ni, m0) == 0)
|
||||
(void)ic->ic_recv_action(ni, wh, frm, efrm);
|
||||
}
|
||||
/* XXX parse_action is a bit useless now */
|
||||
if (ieee80211_parse_action(ni, m0) == 0)
|
||||
ic->ic_recv_action(ni, wh, frm, efrm);
|
||||
break;
|
||||
case IEEE80211_FC0_SUBTYPE_AUTH:
|
||||
|
||||
case IEEE80211_FC0_SUBTYPE_ASSOC_REQ:
|
||||
case IEEE80211_FC0_SUBTYPE_REASSOC_REQ:
|
||||
case IEEE80211_FC0_SUBTYPE_ASSOC_RESP:
|
||||
case IEEE80211_FC0_SUBTYPE_REASSOC_REQ:
|
||||
case IEEE80211_FC0_SUBTYPE_REASSOC_RESP:
|
||||
case IEEE80211_FC0_SUBTYPE_DEAUTH:
|
||||
case IEEE80211_FC0_SUBTYPE_ATIM:
|
||||
case IEEE80211_FC0_SUBTYPE_DISASSOC:
|
||||
case IEEE80211_FC0_SUBTYPE_AUTH:
|
||||
case IEEE80211_FC0_SUBTYPE_DEAUTH:
|
||||
IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT,
|
||||
wh, NULL, "%s", "not handled");
|
||||
vap->iv_stats.is_rx_mgtdiscard++;
|
||||
return;
|
||||
break;
|
||||
|
||||
default:
|
||||
IEEE80211_DISCARD(vap, IEEE80211_MSG_ANY,
|
||||
wh, "mgt", "subtype 0x%x not handled", subtype);
|
||||
@ -1534,6 +1530,17 @@ mesh_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, int subtype,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
mesh_recv_ctl(struct ieee80211_node *ni, struct mbuf *m, int subtype)
|
||||
{
|
||||
|
||||
switch (subtype) {
|
||||
case IEEE80211_FC0_SUBTYPE_BAR:
|
||||
ieee80211_recv_bar(ni, m);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse meshpeering action ie's for open+confirm frames; the
|
||||
* important bits are returned in the supplied structure.
|
||||
@ -2283,6 +2290,7 @@ mesh_verify_meshconf(struct ieee80211vap *vap, const uint8_t *ie)
|
||||
const struct ieee80211_meshconf_ie *meshconf =
|
||||
(const struct ieee80211_meshconf_ie *) ie;
|
||||
const struct ieee80211_mesh_state *ms = vap->iv_mesh;
|
||||
uint16_t cap;
|
||||
|
||||
if (meshconf == NULL)
|
||||
return 1;
|
||||
@ -2316,8 +2324,10 @@ mesh_verify_meshconf(struct ieee80211vap *vap, const uint8_t *ie)
|
||||
meshconf->conf_pselid);
|
||||
return 1;
|
||||
}
|
||||
/* NB: conf_cap is only read correctly here */
|
||||
cap = LE_READ_2(&meshconf->conf_cap);
|
||||
/* Not accepting peers */
|
||||
if (!(meshconf->conf_cap & IEEE80211_MESHCONF_CAP_AP)) {
|
||||
if (!(cap & IEEE80211_MESHCONF_CAP_AP)) {
|
||||
IEEE80211_DPRINTF(vap, IEEE80211_MSG_MESH,
|
||||
"not accepting peers: 0x%x\n", meshconf->conf_cap);
|
||||
return 1;
|
||||
@ -2381,6 +2391,7 @@ uint8_t *
|
||||
ieee80211_add_meshconf(uint8_t *frm, struct ieee80211vap *vap)
|
||||
{
|
||||
const struct ieee80211_mesh_state *ms = vap->iv_mesh;
|
||||
uint16_t caps;
|
||||
|
||||
KASSERT(vap->iv_opmode == IEEE80211_M_MBSS, ("not a MBSS vap"));
|
||||
|
||||
@ -2396,11 +2407,12 @@ ieee80211_add_meshconf(uint8_t *frm, struct ieee80211vap *vap)
|
||||
if (ms->ms_flags & IEEE80211_MESHFLAGS_PORTAL)
|
||||
*frm |= IEEE80211_MESHCONF_FORM_MP;
|
||||
frm += 1;
|
||||
caps = 0;
|
||||
if (ms->ms_flags & IEEE80211_MESHFLAGS_AP)
|
||||
*frm |= IEEE80211_MESHCONF_CAP_AP;
|
||||
caps |= IEEE80211_MESHCONF_CAP_AP;
|
||||
if (ms->ms_flags & IEEE80211_MESHFLAGS_FWD)
|
||||
*frm |= IEEE80211_MESHCONF_CAP_FWRD;
|
||||
frm += 1;
|
||||
caps |= IEEE80211_MESHCONF_CAP_FWRD;
|
||||
ADDSHORT(frm, caps);
|
||||
return frm;
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ struct ieee80211_meshconf_ie {
|
||||
uint8_t conf_syncid; /* Sync. Protocol ID */
|
||||
uint8_t conf_authid; /* Auth. Protocol ID */
|
||||
uint8_t conf_form; /* Formation Information */
|
||||
uint8_t conf_cap;
|
||||
uint16_t conf_cap;
|
||||
} __packed;
|
||||
|
||||
/* Hybrid Wireless Mesh Protocol */
|
||||
@ -72,7 +72,8 @@ struct ieee80211_meshconf_ie {
|
||||
#define IEEE80211_MESHCONF_CAP_FWRD 0x08 /* forwarding enabled */
|
||||
#define IEEE80211_MESHCONF_CAP_BTR 0x10 /* Beacon Timing Report Enab */
|
||||
#define IEEE80211_MESHCONF_CAP_TBTTA 0x20 /* TBTT Adj. Enabled */
|
||||
#define IEEE80211_MESHCONF_CAP_PSL 0x40 /* Power Save Level */
|
||||
#define IEEE80211_MESHCONF_CAP_TBTT 0x40 /* TBTT Adjusting */
|
||||
#define IEEE80211_MESHCONF_CAP_PSL 0x80 /* Power Save Level */
|
||||
|
||||
/* Mesh Identifier */
|
||||
struct ieee80211_meshid_ie {
|
||||
|
@ -282,10 +282,7 @@ ieee80211_node_set_chan(struct ieee80211_node *ni,
|
||||
mode = ieee80211_chan2mode(chan);
|
||||
if (IEEE80211_IS_CHAN_HT(chan)) {
|
||||
/*
|
||||
* XXX Gotta be careful here; the rate set returned by
|
||||
* ieee80211_get_suprates is actually any HT rate
|
||||
* set so blindly copying it will be bad. We must
|
||||
* install the legacy rate est in ni_rates and the
|
||||
* We must install the legacy rate est in ni_rates and the
|
||||
* HT rate set in ni_htrates.
|
||||
*/
|
||||
ni->ni_htrates = *ieee80211_get_suphtrates(ic, chan);
|
||||
@ -1085,7 +1082,26 @@ static void
|
||||
node_getmimoinfo(const struct ieee80211_node *ni,
|
||||
struct ieee80211_mimo_info *info)
|
||||
{
|
||||
/* XXX zero data? */
|
||||
int i;
|
||||
uint32_t avgrssi;
|
||||
int32_t rssi;
|
||||
|
||||
bzero(info, sizeof(*info));
|
||||
|
||||
for (i = 0; i < ni->ni_mimo_chains; i++) {
|
||||
avgrssi = ni->ni_mimo_rssi_ctl[i];
|
||||
if (avgrssi == IEEE80211_RSSI_DUMMY_MARKER) {
|
||||
info->rssi[i] = 0;
|
||||
} else {
|
||||
rssi = IEEE80211_RSSI_GET(avgrssi);
|
||||
info->rssi[i] = rssi < 0 ? 0 : rssi > 127 ? 127 : rssi;
|
||||
}
|
||||
info->noise[i] = ni->ni_mimo_noise_ctl[i];
|
||||
}
|
||||
|
||||
/* XXX ext radios? */
|
||||
|
||||
/* XXX EVM? */
|
||||
}
|
||||
|
||||
struct ieee80211_node *
|
||||
|
@ -166,6 +166,13 @@ struct ieee80211_node {
|
||||
uint32_t ni_avgrssi; /* recv ssi state */
|
||||
int8_t ni_noise; /* noise floor */
|
||||
|
||||
/* mimo statistics */
|
||||
uint32_t ni_mimo_rssi_ctl[IEEE80211_MAX_CHAINS];
|
||||
uint32_t ni_mimo_rssi_ext[IEEE80211_MAX_CHAINS];
|
||||
uint8_t ni_mimo_noise_ctl[IEEE80211_MAX_CHAINS];
|
||||
uint8_t ni_mimo_noise_ext[IEEE80211_MAX_CHAINS];
|
||||
uint8_t ni_mimo_chains;
|
||||
|
||||
/* header */
|
||||
uint8_t ni_macaddr[IEEE80211_ADDR_LEN];
|
||||
uint8_t ni_bssid[IEEE80211_ADDR_LEN];
|
||||
|
@ -57,8 +57,11 @@ __FBSDID("$FreeBSD$");
|
||||
#include <net80211/ieee80211_wds.h>
|
||||
#include <net80211/ieee80211_mesh.h>
|
||||
|
||||
#ifdef INET
|
||||
#if defined(INET) || defined(INET6)
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#ifdef INET
|
||||
#include <netinet/if_ether.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
@ -67,6 +70,8 @@ __FBSDID("$FreeBSD$");
|
||||
#include <netinet/ip6.h>
|
||||
#endif
|
||||
|
||||
#include <security/mac/mac_framework.h>
|
||||
|
||||
#define ETHER_HEADER_COPY(dst, src) \
|
||||
memcpy(dst, src, sizeof(struct ether_header))
|
||||
|
||||
@ -396,14 +401,101 @@ ieee80211_output(struct ifnet *ifp, struct mbuf *m,
|
||||
senderr(ENETDOWN);
|
||||
}
|
||||
vap = ifp->if_softc;
|
||||
/*
|
||||
* Hand to the 802.3 code if not tagged as
|
||||
* a raw 802.11 frame.
|
||||
*/
|
||||
if (dst->sa_family != AF_IEEE80211)
|
||||
return vap->iv_output(ifp, m, dst, ro);
|
||||
#ifdef MAC
|
||||
error = mac_ifnet_check_transmit(ifp, m);
|
||||
if (error)
|
||||
senderr(error);
|
||||
#endif
|
||||
if (ifp->if_flags & IFF_MONITOR)
|
||||
senderr(ENETDOWN);
|
||||
if (!IFNET_IS_UP_RUNNING(ifp))
|
||||
senderr(ENETDOWN);
|
||||
if (vap->iv_state == IEEE80211_S_CAC) {
|
||||
IEEE80211_DPRINTF(vap,
|
||||
IEEE80211_MSG_OUTPUT | IEEE80211_MSG_DOTH,
|
||||
"block %s frame in CAC state\n", "raw data");
|
||||
vap->iv_stats.is_tx_badstate++;
|
||||
senderr(EIO); /* XXX */
|
||||
} else if (vap->iv_state == IEEE80211_S_SCAN)
|
||||
senderr(EIO);
|
||||
/* XXX bypass bridge, pfil, carp, etc. */
|
||||
|
||||
return vap->iv_output(ifp, m, dst, ro);
|
||||
if (m->m_pkthdr.len < sizeof(struct ieee80211_frame_ack))
|
||||
senderr(EIO); /* XXX */
|
||||
wh = mtod(m, struct ieee80211_frame *);
|
||||
if ((wh->i_fc[0] & IEEE80211_FC0_VERSION_MASK) !=
|
||||
IEEE80211_FC0_VERSION_0)
|
||||
senderr(EIO); /* XXX */
|
||||
|
||||
/* locate destination node */
|
||||
switch (wh->i_fc[1] & IEEE80211_FC1_DIR_MASK) {
|
||||
case IEEE80211_FC1_DIR_NODS:
|
||||
case IEEE80211_FC1_DIR_FROMDS:
|
||||
ni = ieee80211_find_txnode(vap, wh->i_addr1);
|
||||
break;
|
||||
case IEEE80211_FC1_DIR_TODS:
|
||||
case IEEE80211_FC1_DIR_DSTODS:
|
||||
if (m->m_pkthdr.len < sizeof(struct ieee80211_frame))
|
||||
senderr(EIO); /* XXX */
|
||||
ni = ieee80211_find_txnode(vap, wh->i_addr3);
|
||||
break;
|
||||
default:
|
||||
senderr(EIO); /* XXX */
|
||||
}
|
||||
if (ni == NULL) {
|
||||
/*
|
||||
* Permit packets w/ bpf params through regardless
|
||||
* (see below about sa_len).
|
||||
*/
|
||||
if (dst->sa_len == 0)
|
||||
senderr(EHOSTUNREACH);
|
||||
ni = ieee80211_ref_node(vap->iv_bss);
|
||||
}
|
||||
|
||||
/*
|
||||
* Sanitize mbuf for net80211 flags leaked from above.
|
||||
*
|
||||
* NB: This must be done before ieee80211_classify as
|
||||
* it marks EAPOL in frames with M_EAPOL.
|
||||
*/
|
||||
m->m_flags &= ~M_80211_TX;
|
||||
|
||||
/* calculate priority so drivers can find the tx queue */
|
||||
/* XXX assumes an 802.3 frame */
|
||||
if (ieee80211_classify(ni, m))
|
||||
senderr(EIO); /* XXX */
|
||||
|
||||
ifp->if_opackets++;
|
||||
IEEE80211_NODE_STAT(ni, tx_data);
|
||||
if (IEEE80211_IS_MULTICAST(wh->i_addr1)) {
|
||||
IEEE80211_NODE_STAT(ni, tx_mcast);
|
||||
m->m_flags |= M_MCAST;
|
||||
} else
|
||||
IEEE80211_NODE_STAT(ni, tx_ucast);
|
||||
/* NB: ieee80211_encap does not include 802.11 header */
|
||||
IEEE80211_NODE_STAT_ADD(ni, tx_bytes, m->m_pkthdr.len);
|
||||
|
||||
/*
|
||||
* NB: DLT_IEEE802_11_RADIO identifies the parameters are
|
||||
* present by setting the sa_len field of the sockaddr (yes,
|
||||
* this is a hack).
|
||||
* NB: we assume sa_data is suitably aligned to cast.
|
||||
*/
|
||||
return vap->iv_ic->ic_raw_xmit(ni, m,
|
||||
(const struct ieee80211_bpf_params *)(dst->sa_len ?
|
||||
dst->sa_data : NULL));
|
||||
bad:
|
||||
if (m != NULL)
|
||||
m_freem(m);
|
||||
if (ni != NULL)
|
||||
ieee80211_free_node(ni);
|
||||
ifp->if_oerrors++;
|
||||
|
||||
return error;
|
||||
#undef senderr
|
||||
}
|
||||
@ -424,6 +516,7 @@ ieee80211_send_setup(
|
||||
{
|
||||
#define WH4(wh) ((struct ieee80211_frame_addr4 *)wh)
|
||||
struct ieee80211vap *vap = ni->ni_vap;
|
||||
struct ieee80211_tx_ampdu *tap;
|
||||
struct ieee80211_frame *wh = mtod(m, struct ieee80211_frame *);
|
||||
ieee80211_seq seqno;
|
||||
|
||||
@ -491,9 +584,15 @@ ieee80211_send_setup(
|
||||
}
|
||||
*(uint16_t *)&wh->i_dur[0] = 0;
|
||||
|
||||
seqno = ni->ni_txseqs[tid]++;
|
||||
*(uint16_t *)&wh->i_seq[0] = htole16(seqno << IEEE80211_SEQ_SEQ_SHIFT);
|
||||
M_SEQNO_SET(m, seqno);
|
||||
tap = &ni->ni_tx_ampdu[TID_TO_WME_AC(tid)];
|
||||
if (tid != IEEE80211_NONQOS_TID && IEEE80211_AMPDU_RUNNING(tap))
|
||||
m->m_flags |= M_AMPDU_MPDU;
|
||||
else {
|
||||
seqno = ni->ni_txseqs[tid]++;
|
||||
*(uint16_t *)&wh->i_seq[0] =
|
||||
htole16(seqno << IEEE80211_SEQ_SEQ_SHIFT);
|
||||
M_SEQNO_SET(m, seqno);
|
||||
}
|
||||
|
||||
if (IEEE80211_IS_MULTICAST(wh->i_addr1))
|
||||
m->m_flags |= M_MCAST;
|
||||
@ -2693,6 +2792,8 @@ ieee80211_beacon_update(struct ieee80211_node *ni,
|
||||
struct ieee80211com *ic = ni->ni_ic;
|
||||
int len_changed = 0;
|
||||
uint16_t capinfo;
|
||||
struct ieee80211_frame *wh;
|
||||
ieee80211_seq seqno;
|
||||
|
||||
IEEE80211_LOCK(ic);
|
||||
/*
|
||||
@ -2724,6 +2825,12 @@ ieee80211_beacon_update(struct ieee80211_node *ni,
|
||||
return 1; /* just assume length changed */
|
||||
}
|
||||
|
||||
wh = mtod(m, struct ieee80211_frame *);
|
||||
seqno = ni->ni_txseqs[IEEE80211_NONQOS_TID]++;
|
||||
*(uint16_t *)&wh->i_seq[0] =
|
||||
htole16(seqno << IEEE80211_SEQ_SEQ_SHIFT);
|
||||
M_SEQNO_SET(m, seqno);
|
||||
|
||||
/* XXX faster to recalculate entirely or just changes? */
|
||||
capinfo = ieee80211_getcapinfo(vap, ni->ni_chan);
|
||||
*bo->bo_caps = htole16(capinfo);
|
||||
@ -2834,13 +2941,13 @@ ieee80211_beacon_update(struct ieee80211_node *ni,
|
||||
bo->bo_tim_trailer += adjust;
|
||||
bo->bo_erp += adjust;
|
||||
bo->bo_htinfo += adjust;
|
||||
#ifdef IEEE80211_SUPERG_SUPPORT
|
||||
#ifdef IEEE80211_SUPPORT_SUPERG
|
||||
bo->bo_ath += adjust;
|
||||
#endif
|
||||
#ifdef IEEE80211_TDMA_SUPPORT
|
||||
#ifdef IEEE80211_SUPPORT_TDMA
|
||||
bo->bo_tdma += adjust;
|
||||
#endif
|
||||
#ifdef IEEE80211_MESH_SUPPORT
|
||||
#ifdef IEEE80211_SUPPORT_MESH
|
||||
bo->bo_meshconf += adjust;
|
||||
#endif
|
||||
bo->bo_appie += adjust;
|
||||
@ -2888,13 +2995,13 @@ ieee80211_beacon_update(struct ieee80211_node *ni,
|
||||
bo->bo_erp += sizeof(*csa);
|
||||
bo->bo_htinfo += sizeof(*csa);
|
||||
bo->bo_wme += sizeof(*csa);
|
||||
#ifdef IEEE80211_SUPERG_SUPPORT
|
||||
#ifdef IEEE80211_SUPPORT_SUPERG
|
||||
bo->bo_ath += sizeof(*csa);
|
||||
#endif
|
||||
#ifdef IEEE80211_TDMA_SUPPORT
|
||||
#ifdef IEEE80211_SUPPORT_TDMA
|
||||
bo->bo_tdma += sizeof(*csa);
|
||||
#endif
|
||||
#ifdef IEEE80211_MESH_SUPPORT
|
||||
#ifdef IEEE80211_SUPPORT_MESH
|
||||
bo->bo_meshconf += sizeof(*csa);
|
||||
#endif
|
||||
bo->bo_appie += sizeof(*csa);
|
||||
|
@ -100,7 +100,7 @@ ieee80211_power_vdetach(struct ieee80211vap *vap)
|
||||
void
|
||||
ieee80211_psq_init(struct ieee80211_psq *psq, const char *name)
|
||||
{
|
||||
memset(psq, 0, sizeof(psq));
|
||||
memset(psq, 0, sizeof(*psq));
|
||||
psq->psq_maxlen = IEEE80211_PS_MAX_QUEUE;
|
||||
IEEE80211_PSQ_INIT(psq, name); /* OS-dependent setup */
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ const char *ieee80211_mgt_subtype_name[] = {
|
||||
"assoc_req", "assoc_resp", "reassoc_req", "reassoc_resp",
|
||||
"probe_req", "probe_resp", "reserved#6", "reserved#7",
|
||||
"beacon", "atim", "disassoc", "auth",
|
||||
"deauth", "action", "reserved#14", "reserved#15"
|
||||
"deauth", "action", "action_noack", "reserved#15"
|
||||
};
|
||||
const char *ieee80211_ctl_subtype_name[] = {
|
||||
"reserved#0", "reserved#1", "reserved#2", "reserved#3",
|
||||
@ -207,6 +207,21 @@ ieee80211_proto_vattach(struct ieee80211vap *vap)
|
||||
const struct ieee80211_rateset *rs = &ic->ic_sup_rates[i];
|
||||
|
||||
vap->iv_txparms[i].ucastrate = IEEE80211_FIXED_RATE_NONE;
|
||||
|
||||
/*
|
||||
* Setting the management rate to MCS 0 assumes that the
|
||||
* BSS Basic rate set is empty and the BSS Basic MCS set
|
||||
* is not.
|
||||
*
|
||||
* Since we're not checking this, default to the lowest
|
||||
* defined rate for this mode.
|
||||
*
|
||||
* At least one 11n AP (DLINK DIR-825) is reported to drop
|
||||
* some MCS management traffic (eg BA response frames.)
|
||||
*
|
||||
* See also: 9.6.0 of the 802.11n-2009 specification.
|
||||
*/
|
||||
#ifdef NOTYET
|
||||
if (i == IEEE80211_MODE_11NA || i == IEEE80211_MODE_11NG) {
|
||||
vap->iv_txparms[i].mgmtrate = 0 | IEEE80211_RATE_MCS;
|
||||
vap->iv_txparms[i].mcastrate = 0 | IEEE80211_RATE_MCS;
|
||||
@ -216,6 +231,9 @@ ieee80211_proto_vattach(struct ieee80211vap *vap)
|
||||
vap->iv_txparms[i].mcastrate =
|
||||
rs->rs_rates[0] & IEEE80211_RATE_VAL;
|
||||
}
|
||||
#endif
|
||||
vap->iv_txparms[i].mgmtrate = rs->rs_rates[0] & IEEE80211_RATE_VAL;
|
||||
vap->iv_txparms[i].mcastrate = rs->rs_rates[0] & IEEE80211_RATE_VAL;
|
||||
vap->iv_txparms[i].maxretry = IEEE80211_TXMAX_DEFAULT;
|
||||
}
|
||||
vap->iv_roaming = IEEE80211_ROAMING_AUTO;
|
||||
@ -877,6 +895,15 @@ ieee80211_wme_initparams_locked(struct ieee80211vap *vap)
|
||||
if ((ic->ic_caps & IEEE80211_C_WME) == 0 || ic->ic_nrunning > 1)
|
||||
return;
|
||||
|
||||
/*
|
||||
* Clear the wme cap_info field so a qoscount from a previous
|
||||
* vap doesn't confuse later code which only parses the beacon
|
||||
* field and updates hardware when said field changes.
|
||||
* Otherwise the hardware is programmed with defaults, not what
|
||||
* the beacon actually announces.
|
||||
*/
|
||||
wme->wme_wmeChanParams.cap_info = 0;
|
||||
|
||||
/*
|
||||
* Select mode; we can be called early in which case we
|
||||
* always use auto mode. We know we'll be called when
|
||||
@ -1474,6 +1501,11 @@ ieee80211_csa_startswitch(struct ieee80211com *ic,
|
||||
ieee80211_notify_csa(ic, c, mode, count);
|
||||
}
|
||||
|
||||
/*
|
||||
* Complete the channel switch by transitioning all CSA VAPs to RUN.
|
||||
* This is called by both the completion and cancellation functions
|
||||
* so each VAP is placed back in the RUN state and can thus transmit.
|
||||
*/
|
||||
static void
|
||||
csa_completeswitch(struct ieee80211com *ic)
|
||||
{
|
||||
@ -1491,15 +1523,27 @@ csa_completeswitch(struct ieee80211com *ic)
|
||||
* Complete an 802.11h channel switch started by ieee80211_csa_startswitch.
|
||||
* We clear state and move all vap's in CSA state to RUN state
|
||||
* so they can again transmit.
|
||||
*
|
||||
* Although this may not be completely correct, update the BSS channel
|
||||
* for each VAP to the newly configured channel. The setcurchan sets
|
||||
* the current operating channel for the interface (so the radio does
|
||||
* switch over) but the VAP BSS isn't updated, leading to incorrectly
|
||||
* reported information via ioctl.
|
||||
*/
|
||||
void
|
||||
ieee80211_csa_completeswitch(struct ieee80211com *ic)
|
||||
{
|
||||
struct ieee80211vap *vap;
|
||||
|
||||
IEEE80211_LOCK_ASSERT(ic);
|
||||
|
||||
KASSERT(ic->ic_flags & IEEE80211_F_CSAPENDING, ("csa not pending"));
|
||||
|
||||
ieee80211_setcurchan(ic, ic->ic_csa_newchan);
|
||||
TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next)
|
||||
if (vap->iv_state == IEEE80211_S_CSA)
|
||||
vap->iv_bss->ni_chan = ic->ic_curchan;
|
||||
|
||||
csa_completeswitch(ic);
|
||||
}
|
||||
|
||||
|
@ -63,9 +63,36 @@ void ieee80211_syncflag(struct ieee80211vap *, int flag);
|
||||
void ieee80211_syncflag_ht(struct ieee80211vap *, int flag);
|
||||
void ieee80211_syncflag_ext(struct ieee80211vap *, int flag);
|
||||
|
||||
#define IEEE80211_R_NF 0x0000001 /* global NF value valid */
|
||||
#define IEEE80211_R_RSSI 0x0000002 /* global RSSI value valid */
|
||||
#define IEEE80211_R_C_CHAIN 0x0000004 /* RX chain count valid */
|
||||
#define IEEE80211_R_C_NF 0x0000008 /* per-chain NF value valid */
|
||||
#define IEEE80211_R_C_RSSI 0x0000010 /* per-chain RSSI value valid */
|
||||
#define IEEE80211_R_C_EVM 0x0000020 /* per-chain EVM valid */
|
||||
#define IEEE80211_R_C_HT40 0x0000040 /* RX'ed packet is 40mhz, pilots 4,5 valid */
|
||||
|
||||
struct ieee80211_rx_stats {
|
||||
uint32_t r_flags; /* IEEE80211_R_* flags */
|
||||
uint8_t c_chain; /* number of RX chains involved */
|
||||
int16_t c_nf_ctl[IEEE80211_MAX_CHAINS]; /* per-chain NF */
|
||||
int16_t c_nf_ext[IEEE80211_MAX_CHAINS]; /* per-chain NF */
|
||||
int16_t c_rssi_ctl[IEEE80211_MAX_CHAINS]; /* per-chain RSSI */
|
||||
int16_t c_rssi_ext[IEEE80211_MAX_CHAINS]; /* per-chain RSSI */
|
||||
uint8_t nf; /* global NF */
|
||||
uint8_t rssi; /* global RSSI */
|
||||
uint8_t evm[IEEE80211_MAX_CHAINS][IEEE80211_MAX_EVM_PILOTS];
|
||||
/* per-chain, per-pilot EVM values */
|
||||
};
|
||||
|
||||
#define ieee80211_input(ni, m, rssi, nf) \
|
||||
((ni)->ni_vap->iv_input(ni, m, rssi, nf))
|
||||
int ieee80211_input_all(struct ieee80211com *, struct mbuf *, int, int);
|
||||
|
||||
int ieee80211_input_mimo(struct ieee80211_node *, struct mbuf *,
|
||||
struct ieee80211_rx_stats *);
|
||||
int ieee80211_input_mimo_all(struct ieee80211com *, struct mbuf *,
|
||||
struct ieee80211_rx_stats *);
|
||||
|
||||
struct ieee80211_bpf_params;
|
||||
int ieee80211_mgmt_output(struct ieee80211_node *, struct mbuf *, int,
|
||||
struct ieee80211_bpf_params *);
|
||||
|
@ -424,6 +424,8 @@ start_scan_locked(const struct ieee80211_scanner *scan,
|
||||
vap->iv_stats.is_scan_passive++;
|
||||
if (flags & IEEE80211_SCAN_FLUSH)
|
||||
ss->ss_ops->scan_flush(ss);
|
||||
if (flags & IEEE80211_SCAN_BGSCAN)
|
||||
ic->ic_flags_ext |= IEEE80211_FEXT_BGSCAN;
|
||||
|
||||
/* NB: flush frames rx'd before 1st channel change */
|
||||
SCAN_PRIVATE(ss)->ss_iflags |= ISCAN_DISCARD;
|
||||
@ -440,12 +442,13 @@ start_scan_locked(const struct ieee80211_scanner *scan,
|
||||
ic->ic_flags |= IEEE80211_F_SCAN;
|
||||
ieee80211_runtask(ic, &SCAN_PRIVATE(ss)->ss_scan_task);
|
||||
}
|
||||
return 1;
|
||||
} else {
|
||||
IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN,
|
||||
"%s: %s scan already in progress\n", __func__,
|
||||
ss->ss_flags & IEEE80211_SCAN_ACTIVE ? "active" : "passive");
|
||||
}
|
||||
return (ic->ic_flags & IEEE80211_F_SCAN);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -238,6 +238,7 @@ sta_add(struct ieee80211_scan_state *ss,
|
||||
const uint8_t *macaddr = wh->i_addr2;
|
||||
struct ieee80211vap *vap = ss->ss_vap;
|
||||
struct ieee80211com *ic = vap->iv_ic;
|
||||
struct ieee80211_channel *c;
|
||||
struct sta_entry *se;
|
||||
struct ieee80211_scan_entry *ise;
|
||||
int hash;
|
||||
@ -300,7 +301,6 @@ found:
|
||||
* association on the wrong channel.
|
||||
*/
|
||||
if (sp->status & IEEE80211_BPARSE_OFFCHAN) {
|
||||
struct ieee80211_channel *c;
|
||||
/*
|
||||
* Off-channel, locate the home/bss channel for the sta
|
||||
* using the value broadcast in the DSPARMS ie. We know
|
||||
@ -317,6 +317,14 @@ found:
|
||||
}
|
||||
} else
|
||||
ise->se_chan = ic->ic_curchan;
|
||||
if (IEEE80211_IS_CHAN_HT(ise->se_chan) && sp->htcap == NULL) {
|
||||
/* Demote legacy networks to a non-HT channel. */
|
||||
c = ieee80211_find_channel(ic, ise->se_chan->ic_freq,
|
||||
ise->se_chan->ic_flags & ~IEEE80211_CHAN_HT);
|
||||
KASSERT(c != NULL,
|
||||
("no legacy channel %u", ise->se_chan->ic_ieee));
|
||||
ise->se_chan = c;
|
||||
}
|
||||
ise->se_fhdwell = sp->fhdwell;
|
||||
ise->se_fhindex = sp->fhindex;
|
||||
ise->se_erp = sp->erp;
|
||||
@ -756,26 +764,38 @@ maxrate(const struct ieee80211_scan_entry *se)
|
||||
{
|
||||
const struct ieee80211_ie_htcap *htcap =
|
||||
(const struct ieee80211_ie_htcap *) se->se_ies.htcap_ie;
|
||||
int rmax, r, i;
|
||||
int rmax, r, i, txstream;
|
||||
uint16_t caps;
|
||||
uint8_t txparams;
|
||||
|
||||
rmax = 0;
|
||||
if (htcap != NULL) {
|
||||
/*
|
||||
* HT station; inspect supported MCS and then adjust
|
||||
* rate by channel width. Could also include short GI
|
||||
* in this if we want to be extra accurate.
|
||||
* rate by channel width.
|
||||
*/
|
||||
/* XXX assumes MCS15 is max */
|
||||
for (i = 15; i >= 0 && isclr(htcap->hc_mcsset, i); i--)
|
||||
;
|
||||
txparams = htcap->hc_mcsset[12];
|
||||
if (txparams & 0x3) {
|
||||
/*
|
||||
* TX MCS parameters defined and not equal to RX,
|
||||
* extract the number of spartial streams and
|
||||
* map it to the highest MCS rate.
|
||||
*/
|
||||
txstream = ((txparams & 0xc) >> 2) + 1;
|
||||
i = txstream * 8 - 1;
|
||||
} else
|
||||
for (i = 31; i >= 0 && isclr(htcap->hc_mcsset, i); i--);
|
||||
if (i >= 0) {
|
||||
caps = LE_READ_2(&htcap->hc_cap);
|
||||
/* XXX short/long GI */
|
||||
if (caps & IEEE80211_HTCAP_CHWIDTH40)
|
||||
if ((caps & IEEE80211_HTCAP_CHWIDTH40) &&
|
||||
(caps & IEEE80211_HTCAP_SHORTGI40))
|
||||
rmax = ieee80211_htrates[i].ht40_rate_400ns;
|
||||
else
|
||||
else if (caps & IEEE80211_HTCAP_CHWIDTH40)
|
||||
rmax = ieee80211_htrates[i].ht40_rate_800ns;
|
||||
else if (caps & IEEE80211_HTCAP_SHORTGI20)
|
||||
rmax = ieee80211_htrates[i].ht20_rate_400ns;
|
||||
else
|
||||
rmax = ieee80211_htrates[i].ht20_rate_800ns;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < se->se_rates[1]; i++) {
|
||||
|
@ -434,7 +434,7 @@ sta_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
|
||||
goto invalid;
|
||||
break;
|
||||
case IEEE80211_S_SLEEP:
|
||||
ieee80211_sta_pwrsave(vap, 0);
|
||||
ieee80211_sta_pwrsave(vap, 1);
|
||||
break;
|
||||
default:
|
||||
invalid:
|
||||
@ -512,7 +512,6 @@ doprint(struct ieee80211vap *vap, int subtype)
|
||||
static int
|
||||
sta_input(struct ieee80211_node *ni, struct mbuf *m, int rssi, int nf)
|
||||
{
|
||||
#define SEQ_LEQ(a,b) ((int)((a)-(b)) <= 0)
|
||||
#define HAS_SEQ(type) ((type & 0x4) == 0)
|
||||
struct ieee80211vap *vap = ni->ni_vap;
|
||||
struct ieee80211com *ic = ni->ni_ic;
|
||||
@ -591,9 +590,7 @@ sta_input(struct ieee80211_node *ni, struct mbuf *m, int rssi, int nf)
|
||||
TID_TO_WME_AC(tid) >= WME_AC_VI)
|
||||
ic->ic_wme.wme_hipri_traffic++;
|
||||
rxseq = le16toh(*(uint16_t *)wh->i_seq);
|
||||
if ((ni->ni_flags & IEEE80211_NODE_HT) == 0 &&
|
||||
(wh->i_fc[1] & IEEE80211_FC1_RETRY) &&
|
||||
SEQ_LEQ(rxseq, ni->ni_rxseqs[tid])) {
|
||||
if (! ieee80211_check_rxseq(ni, wh)) {
|
||||
/* duplicate, discard */
|
||||
IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT,
|
||||
bssid, "duplicate",
|
||||
@ -910,7 +907,6 @@ out:
|
||||
m_freem(m);
|
||||
}
|
||||
return type;
|
||||
#undef SEQ_LEQ
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1544,7 +1540,7 @@ sta_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0,
|
||||
htcap = frm;
|
||||
} else if (ishtinfooui(frm)) {
|
||||
if (htinfo == NULL)
|
||||
htcap = frm;
|
||||
htinfo = frm;
|
||||
}
|
||||
}
|
||||
/* XXX Atheros OUI support */
|
||||
@ -1718,21 +1714,35 @@ sta_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0,
|
||||
}
|
||||
|
||||
case IEEE80211_FC0_SUBTYPE_ACTION:
|
||||
if (vap->iv_state == IEEE80211_S_RUN) {
|
||||
if (ieee80211_parse_action(ni, m0) == 0)
|
||||
ic->ic_recv_action(ni, wh, frm, efrm);
|
||||
} else
|
||||
case IEEE80211_FC0_SUBTYPE_ACTION_NOACK:
|
||||
if (!IEEE80211_ADDR_EQ(vap->iv_myaddr, wh->i_addr1) &&
|
||||
!IEEE80211_IS_MULTICAST(wh->i_addr1)) {
|
||||
IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT,
|
||||
wh, NULL, "%s", "not for us");
|
||||
vap->iv_stats.is_rx_mgtdiscard++;
|
||||
} else if (vap->iv_state != IEEE80211_S_RUN) {
|
||||
IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT,
|
||||
wh, NULL, "wrong state %s",
|
||||
ieee80211_state_name[vap->iv_state]);
|
||||
vap->iv_stats.is_rx_mgtdiscard++;
|
||||
} else {
|
||||
if (ieee80211_parse_action(ni, m0) == 0)
|
||||
(void)ic->ic_recv_action(ni, wh, frm, efrm);
|
||||
}
|
||||
break;
|
||||
|
||||
case IEEE80211_FC0_SUBTYPE_PROBE_REQ:
|
||||
case IEEE80211_FC0_SUBTYPE_ASSOC_REQ:
|
||||
case IEEE80211_FC0_SUBTYPE_REASSOC_REQ:
|
||||
case IEEE80211_FC0_SUBTYPE_PROBE_REQ:
|
||||
case IEEE80211_FC0_SUBTYPE_ATIM:
|
||||
IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT,
|
||||
wh, NULL, "%s", "not handled");
|
||||
vap->iv_stats.is_rx_mgtdiscard++;
|
||||
return;
|
||||
break;
|
||||
|
||||
default:
|
||||
IEEE80211_DISCARD(vap, IEEE80211_MSG_ANY,
|
||||
wh, "mgt", "subtype 0x%x not handled", subtype);
|
||||
wh, "mgt", "subtype 0x%x not handled", subtype);
|
||||
vap->iv_stats.is_rx_badsubtype++;
|
||||
break;
|
||||
}
|
||||
@ -1741,6 +1751,11 @@ sta_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0,
|
||||
}
|
||||
|
||||
static void
|
||||
sta_recv_ctl(struct ieee80211_node *ni, struct mbuf *m0, int subtype)
|
||||
sta_recv_ctl(struct ieee80211_node *ni, struct mbuf *m, int subtype)
|
||||
{
|
||||
switch (subtype) {
|
||||
case IEEE80211_FC0_SUBTYPE_BAR:
|
||||
ieee80211_recv_bar(ni, m);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -140,6 +140,7 @@ struct ieee80211com {
|
||||
uint32_t ic_flags_ven; /* vendor state flags */
|
||||
uint32_t ic_caps; /* capabilities */
|
||||
uint32_t ic_htcaps; /* HT capabilities */
|
||||
uint32_t ic_htextcaps; /* HT extended capabilities */
|
||||
uint32_t ic_cryptocaps; /* crypto capabilities */
|
||||
uint8_t ic_modecaps[2]; /* set of mode capabilities */
|
||||
uint8_t ic_promisc; /* vap's needing promisc mode */
|
||||
@ -192,8 +193,8 @@ struct ieee80211com {
|
||||
struct ieee80211_dfs_state ic_dfs; /* DFS state */
|
||||
|
||||
struct ieee80211_scan_state *ic_scan; /* scan state */
|
||||
long long ic_lastdata; /* time of last data frame */
|
||||
long long ic_lastscan; /* time last scan completed */
|
||||
int ic_lastdata; /* time of last data frame */
|
||||
int ic_lastscan; /* time last scan completed */
|
||||
|
||||
/* NB: this is the union of all vap stations/neighbors */
|
||||
int ic_max_keyix; /* max h/w key index */
|
||||
@ -213,8 +214,10 @@ struct ieee80211com {
|
||||
uint16_t ic_ht40_sta_assoc;/* HT40 stations associated */
|
||||
uint8_t ic_curhtprotmode;/* HTINFO bss state */
|
||||
enum ieee80211_protmode ic_htprotmode; /* HT protection mode */
|
||||
long long ic_lastnonerp; /* last time non-ERP sta noted*/
|
||||
long long ic_lastnonht; /* last time non-HT sta noted */
|
||||
int ic_lastnonerp; /* last time non-ERP sta noted*/
|
||||
int ic_lastnonht; /* last time non-HT sta noted */
|
||||
uint8_t ic_rxstream; /* # RX streams */
|
||||
uint8_t ic_txstream; /* # TX streams */
|
||||
|
||||
/* optional state for Atheros SuperG protocol extensions */
|
||||
struct ieee80211_superg *ic_superg;
|
||||
@ -307,6 +310,8 @@ struct ieee80211com {
|
||||
int status, int baparamset, int batimeout);
|
||||
void (*ic_addba_stop)(struct ieee80211_node *,
|
||||
struct ieee80211_tx_ampdu *);
|
||||
void (*ic_addba_response_timeout)(struct ieee80211_node *,
|
||||
struct ieee80211_tx_ampdu *);
|
||||
/* BAR response received */
|
||||
void (*ic_bar_response)(struct ieee80211_node *,
|
||||
struct ieee80211_tx_ampdu *, int status);
|
||||
@ -316,7 +321,7 @@ struct ieee80211com {
|
||||
int batimeout, int baseqctl);
|
||||
void (*ic_ampdu_rx_stop)(struct ieee80211_node *,
|
||||
struct ieee80211_rx_ampdu *);
|
||||
uint64_t ic_spare[8];
|
||||
uint64_t ic_spare[7];
|
||||
};
|
||||
|
||||
struct ieee80211_aclator;
|
||||
@ -343,6 +348,7 @@ struct ieee80211vap {
|
||||
uint32_t iv_flags_ven; /* vendor state flags */
|
||||
uint32_t iv_caps; /* capabilities */
|
||||
uint32_t iv_htcaps; /* HT capabilities */
|
||||
uint32_t iv_htextcaps; /* HT extended capabilities */
|
||||
enum ieee80211_opmode iv_opmode; /* operation mode */
|
||||
enum ieee80211_state iv_state; /* state machine state */
|
||||
enum ieee80211_state iv_nstate; /* pending state */
|
||||
@ -576,7 +582,7 @@ struct ieee80211vap {
|
||||
|
||||
#define IEEE80211_FHT_BITS \
|
||||
"\20\1NONHT_PR" \
|
||||
"\23GF\24HT\25AMDPU_TX\26AMPDU_TX" \
|
||||
"\23GF\24HT\25AMPDU_TX\26AMPDU_TX" \
|
||||
"\27AMSDU_TX\30AMSDU_RX\31USEHT40\32PUREN\33SHORTGI20\34SHORTGI40" \
|
||||
"\35HTCOMPAT\36RIFS\37STBC_TX\40STBC_RX"
|
||||
|
||||
@ -635,6 +641,10 @@ struct ieee80211vap {
|
||||
#define IEEE80211_HTC_HT 0x00040000 /* CAPABILITY: HT operation */
|
||||
#define IEEE80211_HTC_SMPS 0x00080000 /* CAPABILITY: MIMO power save*/
|
||||
#define IEEE80211_HTC_RIFS 0x00100000 /* CAPABILITY: RIFS support */
|
||||
#define IEEE80211_HTC_RXUNEQUAL 0x00200000 /* CAPABILITY: RX unequal MCS */
|
||||
#define IEEE80211_HTC_RXMCS32 0x00400000 /* CAPABILITY: MCS32 support */
|
||||
#define IEEE80211_HTC_TXUNEQUAL 0x00800000 /* CAPABILITY: TX unequal MCS */
|
||||
#define IEEE80211_HTC_TXMCS32 0x01000000 /* CAPABILITY: MCS32 suport */
|
||||
|
||||
#define IEEE80211_C_HTCAP_BITS \
|
||||
"\20\1LDPC\2CHWIDTH40\5GREENFIELD\6SHORTGI20\7SHORTGI40\10TXSTBC" \
|
||||
|
@ -406,7 +406,6 @@ wds_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
|
||||
static int
|
||||
wds_input(struct ieee80211_node *ni, struct mbuf *m, int rssi, int nf)
|
||||
{
|
||||
#define SEQ_LEQ(a,b) ((int)((a)-(b)) <= 0)
|
||||
#define HAS_SEQ(type) ((type & 0x4) == 0)
|
||||
struct ieee80211vap *vap = ni->ni_vap;
|
||||
struct ieee80211com *ic = ni->ni_ic;
|
||||
@ -454,6 +453,9 @@ wds_input(struct ieee80211_node *ni, struct mbuf *m, int rssi, int nf)
|
||||
*/
|
||||
wh = mtod(m, struct ieee80211_frame *);
|
||||
|
||||
if (!IEEE80211_IS_MULTICAST(wh->i_addr1))
|
||||
ni->ni_inact = ni->ni_inact_reload;
|
||||
|
||||
if ((wh->i_fc[0] & IEEE80211_FC0_VERSION_MASK) !=
|
||||
IEEE80211_FC0_VERSION_0) {
|
||||
IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY,
|
||||
@ -492,9 +494,7 @@ wds_input(struct ieee80211_node *ni, struct mbuf *m, int rssi, int nf)
|
||||
TID_TO_WME_AC(tid) >= WME_AC_VI)
|
||||
ic->ic_wme.wme_hipri_traffic++;
|
||||
rxseq = le16toh(*(uint16_t *)wh->i_seq);
|
||||
if ((ni->ni_flags & IEEE80211_NODE_HT) == 0 &&
|
||||
(wh->i_fc[1] & IEEE80211_FC1_RETRY) &&
|
||||
SEQ_LEQ(rxseq, ni->ni_rxseqs[tid])) {
|
||||
if (! ieee80211_check_rxseq(ni, wh)) {
|
||||
/* duplicate, discard */
|
||||
IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT,
|
||||
wh->i_addr1, "duplicate",
|
||||
@ -536,8 +536,6 @@ wds_input(struct ieee80211_node *ni, struct mbuf *m, int rssi, int nf)
|
||||
vap->iv_stats.is_rx_wrongdir++;/*XXX*/
|
||||
goto out;
|
||||
}
|
||||
if (!IEEE80211_IS_MULTICAST(wh->i_addr1))
|
||||
ni->ni_inact = ni->ni_inact_reload;
|
||||
/*
|
||||
* Handle A-MPDU re-ordering. If the frame is to be
|
||||
* processed directly then ieee80211_ampdu_reorder
|
||||
@ -740,7 +738,6 @@ out:
|
||||
m_freem(m);
|
||||
}
|
||||
return type;
|
||||
#undef SEQ_LEQ
|
||||
}
|
||||
|
||||
static void
|
||||
@ -756,31 +753,47 @@ wds_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0,
|
||||
frm = (u_int8_t *)&wh[1];
|
||||
efrm = mtod(m0, u_int8_t *) + m0->m_len;
|
||||
switch (subtype) {
|
||||
case IEEE80211_FC0_SUBTYPE_DEAUTH:
|
||||
case IEEE80211_FC0_SUBTYPE_ACTION:
|
||||
case IEEE80211_FC0_SUBTYPE_ACTION_NOACK:
|
||||
if (ni == vap->iv_bss) {
|
||||
IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT,
|
||||
wh, NULL, "%s", "unknown node");
|
||||
vap->iv_stats.is_rx_mgtdiscard++;
|
||||
} else if (!IEEE80211_ADDR_EQ(vap->iv_myaddr, wh->i_addr1)) {
|
||||
/* NB: not interested in multicast frames. */
|
||||
IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT,
|
||||
wh, NULL, "%s", "not for us");
|
||||
vap->iv_stats.is_rx_mgtdiscard++;
|
||||
} else if (vap->iv_state != IEEE80211_S_RUN) {
|
||||
IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT,
|
||||
wh, NULL, "wrong state %s",
|
||||
ieee80211_state_name[vap->iv_state]);
|
||||
vap->iv_stats.is_rx_mgtdiscard++;
|
||||
} else {
|
||||
if (ieee80211_parse_action(ni, m0) == 0)
|
||||
(void)ic->ic_recv_action(ni, wh, frm, efrm);
|
||||
}
|
||||
break;
|
||||
|
||||
case IEEE80211_FC0_SUBTYPE_ASSOC_REQ:
|
||||
case IEEE80211_FC0_SUBTYPE_ASSOC_RESP:
|
||||
case IEEE80211_FC0_SUBTYPE_REASSOC_REQ:
|
||||
case IEEE80211_FC0_SUBTYPE_REASSOC_RESP:
|
||||
case IEEE80211_FC0_SUBTYPE_PROBE_REQ:
|
||||
case IEEE80211_FC0_SUBTYPE_PROBE_RESP:
|
||||
case IEEE80211_FC0_SUBTYPE_BEACON:
|
||||
case IEEE80211_FC0_SUBTYPE_PROBE_REQ:
|
||||
case IEEE80211_FC0_SUBTYPE_AUTH:
|
||||
case IEEE80211_FC0_SUBTYPE_ASSOC_REQ:
|
||||
case IEEE80211_FC0_SUBTYPE_REASSOC_REQ:
|
||||
case IEEE80211_FC0_SUBTYPE_ASSOC_RESP:
|
||||
case IEEE80211_FC0_SUBTYPE_REASSOC_RESP:
|
||||
case IEEE80211_FC0_SUBTYPE_ATIM:
|
||||
case IEEE80211_FC0_SUBTYPE_DISASSOC:
|
||||
case IEEE80211_FC0_SUBTYPE_AUTH:
|
||||
case IEEE80211_FC0_SUBTYPE_DEAUTH:
|
||||
IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT,
|
||||
wh, NULL, "%s", "not handled");
|
||||
vap->iv_stats.is_rx_mgtdiscard++;
|
||||
break;
|
||||
case IEEE80211_FC0_SUBTYPE_ACTION:
|
||||
if (vap->iv_state != IEEE80211_S_RUN ||
|
||||
IEEE80211_IS_MULTICAST(wh->i_addr1)) {
|
||||
vap->iv_stats.is_rx_mgtdiscard++;
|
||||
break;
|
||||
}
|
||||
ni->ni_inact = ni->ni_inact_reload;
|
||||
if (ieee80211_parse_action(ni, m0) == 0)
|
||||
ic->ic_recv_action(ni, wh, frm, efrm);
|
||||
break;
|
||||
|
||||
default:
|
||||
IEEE80211_DISCARD(vap, IEEE80211_MSG_ANY,
|
||||
wh, "mgt", "subtype 0x%x not handled", subtype);
|
||||
wh, "mgt", "subtype 0x%x not handled", subtype);
|
||||
vap->iv_stats.is_rx_badsubtype++;
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user