pcwl.c revision 42516a0c6ebf6e259c2abcd1ca315fec43268f39
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright (c) 1997, 1998, 1999
* Bill Paul <wpaul@ctr.columbia.edu>. 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
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Bill Paul.
* 4. Neither the name of the author nor the names of any co-contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``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 Bill Paul OR THE VOICES IN HIS HEAD
* 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/ethernet.h>
#include <sys/byteorder.h>
#include "pcwl.h"
#include <sys/mac_wifi.h>
#include <inet/wifi_ioctl.h>
#ifdef DEBUG
#define PCWL_DBG_BASIC 0x1
#define PCWL_DBG_INFO 0x2
#define PCWL_DBG_SEND 0x4
#define PCWL_DBG_RCV 0x8
#define PCWL_DBG_LINKINFO 0x10
uint32_t pcwl_debug = 0;
#define PCWLDBG(x) \
#else
#define PCWLDBG(x)
#endif
/* for pci card */
static ddi_device_acc_attr_t accattr = {
};
void *pcwl_soft_state_p = NULL;
static int pcwl_device_type;
NULL,
};
static char *pcwl_name_str = "pcwl";
extern struct mod_ops mod_driverops;
};
static struct modlinkage modlinkage = {
};
int
_init(void)
{
int stat;
/* Allocate soft state */
return (stat);
if (stat != DDI_SUCCESS) {
}
return (stat);
}
int
_fini(void)
{
int stat;
return (stat);
return (stat);
}
int
{
}
static int
{
char *buf;
if (ret != DDI_SUCCESS)
return (DDI_PROBE_FAILURE);
} else {
}
return (ret);
}
static int
{
int ret, i;
int instance;
wifi_data_t wd = { 0 };
char strbuf[256];
if (cmd != DDI_ATTACH)
goto attach_fail1;
/*
* Allocate soft state associated with this instance.
*/
goto attach_fail1;
}
if (ddi_regs_map_setup(dip, 0,
" failed\n");
goto attach_fail2;
}
(PCI_COMM_IO | PCI_COMM_MAE)) {
" reg enable failed\n");
goto attach_fail2a;
}
!= DDI_SUCCESS) {
" failed\n");
goto attach_fail2a;
}
/*
* tricky! copy from freebsd code.
*/
drv_usecwait(500000);
drv_usecwait(500000);
for (i = 0; i < WL_TIMEOUT; i++) {
if (stat & WL_CMD_BUSY)
drv_usecwait(10);
else
break;
}
if (i == WL_TIMEOUT) {
" failed\n");
goto attach_fail3;
}
/*
* magic number verification.
* tricky! copy from freebsd code.
*/
if (stat != 0x4a2d) {
" failed\n");
goto attach_fail3;
}
}
if (ddi_get_iblock_cookie(dip,
goto attach_fail3;
}
goto attach_fail3a;
}
"register_cs err %x\n", ret);
goto attach_fail3a;
}
} else {
goto attach_fail3a;
}
goto attach_fail4;
}
goto attach_fail4;
}
/*
* Provide initial settings for the WiFi plugin; whenever this
* information changes, we need to call mac_pdata_update()
*/
"MAC version mismatch\n"));
goto attach_fail4;
}
if (err != 0) {
"mac_register err\n"));
goto attach_fail4;
}
/*
* turn on CS interrupt
*/
}
" failed %x\n", ret);
goto attach_fail5;
}
goto attach_fail5;
}
pcwl_p->pcwl_scan_num = 0;
goto attach_fail6;
}
}
return (DDI_SUCCESS);
if (pcwl_p->pcwl_scanlist_timeout_id != 0) {
}
}
return (DDI_FAILURE);
}
static int
{
int ret;
if (cmd != DDI_DETACH)
return (DDI_FAILURE);
return (DDI_FAILURE);
if (ret != 0)
return (DDI_FAILURE);
}
if (pcwl_p->pcwl_scanlist_timeout_id != 0) {
}
if (pcwl_p->pcwl_connect_timeout_id != 0) {
}
while (scan_item0) {
}
}
return (DDI_SUCCESS);
}
/*
* card services and event handlers
*/
static int
{
int ret;
goto regcs_ret;
}
"pcwl: register_cs: Sock=%x CState=%x SState=%x rState=%x\n",
/* card is not present, why are we attaching ? */
ret = CS_NO_CARD;
goto regcs_unreg;
}
goto regcs_fail;
}
"pcwl: register_cs: LogSock=%x PhyAdapter=%x PhySock=%x\n",
/* turn on initialization events */
goto regcs_fail;
}
/* wait for and process card insertion events */
return (PCWL_SUCCESS);
(void) csx_DeregisterClient(chdl);
return (ret);
}
static void
{
int ret;
/*
* The card service not registered means register_cs function
* doesnot return TRUE. Then all the lelated resource has been
* released in register_cs.
*/
return;
}
}
static void
{
}
static int
{
int ret = CS_SUCCESS;
switch (event) {
case CS_EVENT_CARD_INSERTION:
break;
break;
case CS_EVENT_CARD_REMOVAL:
if (priority & CS_EVENT_PRI_HIGH)
break;
break;
case CS_EVENT_CLIENT_INFO:
break;
break;
default:
break;
}
return (ret);
}
static int
{
goto insert_ret;
}
goto insert_ret;
}
/*
* verify manufacture ID
*/
goto insert_ret;
}
goto insert_ret;
}
/*
* verify function ID
*/
goto insert_ret;
}
goto insert_ret;
}
"pcwl: config present=%x nr=%x hr=%x regs[0]=%x base=%x last=%x\n",
hi = 0;
ret);
break;
}
ret);
break;
}
}
}
}
}
}
goto insert_ret;
}
goto insert_ret;
}
goto un_io;
}
goto un_irq;
}
return (CS_SUCCESS);
return (ret);
}
/*
* assume card is already removed, don't touch the hardware
*/
static void
{
int ret;
/*
* The card not ready means Insert function doesnot return TRUE.
* then the IO and IRQ has been released in Insert
*/
return;
}
/*
* mac operation interface routines
*/
static int
pcwl_start(void *arg)
{
return (PCWL_FAIL);
}
return (PCWL_SUCCESS);
}
static void
{
return;
}
if (pcwl_p->pcwl_connect_timeout_id != 0) {
}
}
static int
{
int ret = PCWL_SUCCESS;
goto done;
}
goto done;
}
if (pcwl_saddr_locked(pcwl_p)) {
goto done;
}
}
done:
if (ret)
return (ret);
}
static int
{
int i = 0;
struct ieee80211_frame *wh;
struct ieee80211_llc *llc;
(PCWL_CARD_READY | PCWL_CARD_LINKUP)) {
return (PCWL_SUCCESS); /* drop packet */
}
return (PCWL_SUCCESS); /* drop packet */
}
/*
* check whether there is a xmt buffer available
*/
while ((i < WL_XMT_BUF_NUM) &&
i++;
}
if (i == WL_XMT_BUF_NUM) {
pcwl_p->pcwl_noxmtbuf++;
return (PCWL_FAIL);
}
#ifdef DEBUG
if (pcwl_debug & PCWL_DBG_SEND) {
}
#endif
return (PCWL_SUCCESS); /* drop packet */
}
return (PCWL_SUCCESS); /* drop packet */
}
#ifdef DEBUG
if (pcwl_debug & PCWL_DBG_SEND) {
for (i = 0; i < pkt_len; i++)
*((unsigned char *)buf + i));
}
#endif
pkt_len - 0x2e));
if (ret) {
goto done;
}
done:
return (PCWL_SUCCESS);
}
static mblk_t *
{
(PCWL_CARD_LINKUP | PCWL_CARD_READY)) {
return (mp);
}
break;
}
}
return (mp);
}
static int
{
int ret = PCWL_SUCCESS;
goto done;
}
if (on)
else
}
done:
if (ret)
return (ret);
}
static int
{
int ret = PCWL_SUCCESS;
goto done;
}
goto done;
}
switch (pcwl_p->pcwl_chip_type) {
case PCWL_CHIP_PRISMII:
switch (rate) {
default: rate = 0; break;
}
break;
case PCWL_CHIP_LUCENT:
default:
if (rate == 6)
speed = 5500000;
break;
}
switch (statitem) {
case MAC_STAT_IFSPEED:
break;
case MAC_STAT_NOXMTBUF:
break;
case MAC_STAT_NORCVBUF:
break;
case MAC_STAT_IERRORS:
*val = 0;
break;
case MAC_STAT_OERRORS:
break;
case MAC_STAT_RBYTES:
break;
case MAC_STAT_IPACKETS:
break;
case MAC_STAT_OBYTES:
break;
case MAC_STAT_OPACKETS:
break;
case WIFI_STAT_TX_FAILED:
break;
case WIFI_STAT_TX_RETRANS:
break;
case WIFI_STAT_FCS_ERRORS:
break;
case WIFI_STAT_WEP_ERRORS:
break;
case WIFI_STAT_MCAST_TX:
break;
case WIFI_STAT_MCAST_RX:
break;
case WIFI_STAT_TX_FRAGS:
break;
case WIFI_STAT_RX_FRAGS:
break;
case WIFI_STAT_RTS_SUCCESS:
case WIFI_STAT_RTS_FAILURE:
case WIFI_STAT_ACK_FAILURE:
case WIFI_STAT_RX_DUPS:
*val = 0;
break;
default:
}
done:
return (ret);
}
static int
{
int ret = PCWL_SUCCESS;
uint16_t i;
goto done;
}
if (add) { /* enable multicast on eth_p, search for available entries */
break;
}
if (i < 16) /* already part of the filter */
goto done;
break;
}
if (i >= 16) /* can't find a vacant entry */
goto done;
} else { /* disable multicast, locate the entry and clear it */
break;
}
if (i >= 16)
goto done;
mc_p[0] = 0;
mc_p[1] = 0;
mc_p[2] = 0;
}
/*
* re-blow the entire 16 entries buffer
*/
pcwl_p->pcwl_mcast)) {
}
done:
if (ret)
return (ret);
}
static uint_t
{
(PCWL_CARD_READY | PCWL_CARD_INTREN)) {
return (DDI_INTR_UNCLAIMED);
}
return (DDI_INTR_UNCLAIMED);
}
}
}
}
}
if (stat & WL_EV_ALLOC) {
}
if (stat & WL_EV_INFO) {
}
if (stat & WL_EV_TX_EXC) {
}
}
}
if (stat & WL_EV_INFO_DROP) {
}
return (DDI_INTR_CLAIMED);
}
static uint_t
{
(PCWL_CARD_READY | PCWL_CARD_INTREN)) {
return (DDI_INTR_UNCLAIMED);
}
return (DDI_INTR_UNCLAIMED);
}
return (DDI_INTR_CLAIMED);
}
/*
* called at interrupt context to retrieve data from card
*/
static void
{
if (!mp)
return;
if (id == WL_INVALID_FID) {
goto done;
}
goto done;
}
goto done;
}
#ifdef DEBUG
if (pcwl_debug & PCWL_DBG_RCV) {
int i;
for (i = 0; i < WL_802_11_HDRLEN; i++)
}
#endif
/*
* this driver deal with WEP by itself. so plugin always thinks no wep.
*/
case WL_STAT_1042:
case WL_STAT_TUNNEL:
case WL_STAT_WMP_MSG:
sizeof (struct ieee80211_frame));
/*
* discard those frames which are not from the AP we connect or
* without 'ap->sta' direction
*/
goto done;
}
sizeof (struct ieee80211_frame));
sizeof (struct ieee80211_llc));
sizeof (struct ieee80211_llc));
break;
default:
break;
}
goto done;
}
if (len & 1)
len++;
done:
if (ret) {
return;
}
#ifdef DEBUG
if (pcwl_debug & PCWL_DBG_RCV) {
int i;
for (i = 0; i < len+14; i++)
}
#endif
}
static uint32_t
{
for (i = 0; i < WL_XMT_BUF_NUM; i++) {
break;
}
}
if (i == WL_XMT_BUF_NUM)
return (PCWL_FAIL);
return (PCWL_SUCCESS);
}
static void
{
wifi_data_t wd = { 0 };
if (id == WL_INVALID_FID) {
return;
}
ret));
return;
}
switch (linkStatus[1]) {
case WL_INFO_LINK_STAT:
sizeof (linkStat));
linkStat == WL_LINK_CONNECT) {
#ifdef DEBUG
if (pcwl_debug & PCWL_DBG_LINKINFO)
#endif
if (pcwl_p->pcwl_connect_timeout_id != 0) {
}
sizeof (wd));
}
((linkStat == WL_LINK_DISCONNECT) ||
(linkStat == WL_LINK_AP_OOR))) {
#ifdef DEBUG
if (pcwl_debug & PCWL_DBG_LINKINFO)
#endif
linkStat));
if (linkStat == WL_LINK_AP_OOR)
}
break;
case WL_INFO_SCAN_RESULTS:
case WL_INFO_HSCAN_RESULTS:
break;
case WL_INFO_COUNTERS:
linkStatus[0]--;
if (linkStatus[0] > WLC_STAT_CNT) {
}
/*
* accumulate all the statistics items for kstat use.
*/
for (i = 0; i < WLC_STAT_CNT; i++)
break;
default:
break;
}
}
static uint16_t
{
int i;
if (((cmd == WL_CMD_ENABLE) &&
((cmd == WL_CMD_DISABLE) &&
return (PCWL_SUCCESS);
for (i = 0; i < WL_TIMEOUT; i++) {
if (stat & WL_CMD_BUSY) {
drv_usecwait(1);
} else {
break;
}
}
if (i == WL_TIMEOUT) {
return (PCWL_TIMEDOUT_CMD);
}
if (cmd == WL_CMD_INI)
for (i = 0; i < WL_TIMEOUT; i++) {
drv_usecwait(1);
} else {
break;
}
}
if (i == WL_TIMEOUT) {
return (PCWL_TIMEDOUT_CMD);
}
return (PCWL_FAILURE_CMD);
}
if (cmd == WL_CMD_ENABLE)
if (cmd == WL_CMD_DISABLE)
return (PCWL_SUCCESS);
}
static uint16_t
{
int i;
if (channel) {
} else {
}
for (stat = 0, i = 0; i < WL_TIMEOUT; i++) {
break;
else {
drv_usecwait(1);
}
}
if (i == WL_TIMEOUT) {
return (PCWL_TIMEDOUT_TARGET);
}
return (PCWL_SUCCESS);
}
static uint16_t
{
/*
* 1. select read mode
*/
return (stat);
/*
* 2. select Buffer Access Path (channel) 1 for PIO
*/
return (stat);
/*
* 3. read length
*/
}
/*
* 4. read type
*/
return (PCWL_BADTYPE);
/*
* 5. read value
*/
}
return (PCWL_SUCCESS);
}
static uint16_t
{
/*
* 1. select Buffer Access Path (channel) 1 for PIO
*/
return (stat);
/*
* 2. write length
*/
/*
* 3. write type
*/
/*
* 4. fill value
*/
}
/*
* 5. select write mode
*/
}
static uint16_t
{
/*
* 1. select Buffer Access Path (channel) 1 for PIO
*/
return (stat);
/*
* 2. write length
*/
/*
* 3. write type
*/
/*
* 4. write value
*/
}
/*
* 5. select write mode
*/
}
#define PCWL_COMPSTR_LEN 34
static uint16_t
{
}
/*ARGSUSED*/
static uint16_t
{
uint16_t o;
/*
* It seems that for PrismII chip, frequently overlap use of path0
* and path1 may hang the hardware. So for PrismII chip, just use
* path1. Test proves this workaround is OK.
*/
return (type);
o = WL_DATA1;
} else {
return (type);
o = WL_DATA0;
}
len >>= 1;
}
return (PCWL_SUCCESS);
}
/*ARGSUSED*/
static uint16_t
{
return (type);
len >>= 1;
}
return (PCWL_SUCCESS);
}
static uint16_t
{
int i;
return (stat);
for (stat = 0, i = 0; i < WL_TIMEOUT; i++) {
if (stat & WL_EV_ALLOC)
break;
else
drv_usecwait(1);
}
if (i == WL_TIMEOUT)
return (PCWL_TIMEDOUT_ALLOC);
/*
* zero fill the allocated NIC mem - sort of pcwl_fill_ch
*/
}
return (PCWL_SUCCESS);
}
static int
{
return (PCWL_FAIL);
}
pcwl_p->pcwl_scan_num++;
return (PCWL_SUCCESS);
}
static void
{
kmem_free(s, sizeof (*s));
pcwl_p->pcwl_scan_num--;
}
static void
pcwl_scanlist_timeout(void *arg)
{
for (; scan_item0; ) {
scan_item0->wl_timeout));
if (scan_item0->wl_timeout == 0) {
} else {
scan_item0->wl_timeout--;
}
}
}
static void
{
for (; scan_item0; ) {
}
}
}
}
/*
* Note:
* PrismII chipset has 2 extra space for the reason why scan is initiated
*/
static void
{
switch (pcwl_p->pcwl_chip_type) {
case PCWL_CHIP_PRISMII:
off += 4;
break;
case PCWL_CHIP_LUCENT:
default:
szbuf = 25;
}
for (i = 0; i < ssidNum; i++) {
#ifdef DEBUG
if (pcwl_debug & PCWL_DBG_INFO) {
int j;
for (j = 0; j < sizeof (sctbl); j++)
}
#endif
/*
* sometimes, those empty items are recorded by hardware,
* this is wrong, just ignore those items here.
*/
bssid_t, 6) == 0) {
continue;
}
}
/*
*/
check_num = 0;
if (scan_item0 == NULL) {
!= 0) {
return;
}
}
for (; scan_item0; ) {
break;
} else {
check_num++;
}
}
!= 0) {
return;
}
}
sctbl.wl_srt_ssid));
sctbl.wl_srt_chid));
sctbl.wl_srt_anl));
" %x %x %x %x %x %x\n\n", i+1,
sctbl.wl_srt_bssid[0],
}
}
/*
* delay in which the mutex is not hold.
* assuming the mutex has already been hold.
*/
static void
{
}
static int
{
return ((int)ret);
}
return ((int)ret);
}
return (PCWL_SUCCESS);
}
/*
* get card capability (WEP, default channel), setup broadcast, mac addresses
*/
static int
{
" %x\n", stat);
return ((int)stat);
}
&pcwl_p->pcwl_has_wep)) {
" %x\n", stat);
return ((int)stat);
}
" %x\n", stat);
return ((int)stat);
}
/*
* don't assume m_xxx members are 16-bit aligned
*/
return (PCWL_SUCCESS);
}
static int
{
for (i = 0; i < WL_XMT_BUF_NUM; i++) {
if (ret) {
"pcwl: alloc NIC Tx buf failed %x\n", ret);
return (PCWL_FAIL);
}
}
if (ret) {
return (PCWL_FAIL);
}
pcwl_p->pcwl_mgmt_id));
return (PCWL_SUCCESS);
}
static int
{
return (pcwl_config_rf(pcwl_p));
}
static int
{
/*
* Lucent card:
* PrismII card:
* 3 Join ESS or IBSS(do not create IBSS);
*/
if (rf_p->rf_create_ibss == 0)
create_ibss = 3;
}
/*
* Lucent card:
* 1 BSS; 3 pseudo IBSS(only for test,not the 802.11 IBSS)
* so porttype register should always be set to 1
* PrismII card:
* 0 IBSS; 1 BSS; 2 WDS; 3 pseudo IBSS; 6 hostAP
*/
switch (pcwl_p->pcwl_chip_type) {
case PCWL_CHIP_PRISMII:
porttype = 1;
porttype = 0;
else
porttype = 0;
break;
case PCWL_CHIP_LUCENT:
default:
porttype = 1;
}
if (!pcwl_p->pcwl_has_wep)
goto done;
switch (pcwl_p->pcwl_chip_type) {
case PCWL_CHIP_PRISMII: {
int i;
for (i = 0; i < 4; i++) {
if (k_len == 0)
continue;
}
rf_p->rf_authtype);
}
break;
case PCWL_CHIP_LUCENT:
default:
rf_p->rf_authtype);
break;
}
done:
return (PCWL_SUCCESS);
}
static void
{
}
static void
{
}
/*ARGSUSED*/
static int
{
int ret;
if (ret) {
return (PCWL_FAIL);
}
return (PCWL_SUCCESS);
}
static void
{
return; /* lucent */
bzero(&f, sizeof (f));
PCWL_SWAP16((uint16_t *)&f, sizeof (f));
}
/*
* for wificonfig and dladm ioctl
*/
static int
{
char ssid[36];
char *value;
char *buf;
int iret;
MAX_BUF_LEN));
return (ENOMEM);
}
if (cmd == WLAN_GET_PARAM) {
WL_RID_PORTSTATUS, &val);
if (ret) {
goto done;
}
} else if (val == WL_PORT_TO_IBSS ||
val == WL_PORT_TO_BSS ||
val == WL_PORT_OOR) {
} else {
}
rf_p->rf_desired_ssid));
} else if (cmd == WLAN_SET_PARAM) {
rf_p->rf_desired_ssid));
} else {
return (EINVAL);
}
done:
for (i = 0; i < (outfp->wldp_length); i++)
return (iret);
}
static int
{
int iret;
char *buf;
MAX_BUF_LEN));
return (ENOMEM);
}
if (cmd == WLAN_GET_PARAM) {
WL_RID_PORTSTATUS, &ret)) {
goto done;
}
sizeof (wl_bssid_t));
} else if (ret == WL_PORT_TO_IBSS ||
sizeof (wl_bssid_t));
}
} else if (cmd == WLAN_SET_PARAM) {
} else {
return (EINVAL);
}
done:
for (i = 0; i < (outfp->wldp_length); i++)
return (iret);
}
/*ARGSUSED*/
static int
{
/*
* The logic of this funtion is really tricky.
* Firstly, the chip can only scan in BSS mode, so necessary
* backup and restore is required before and after the scan
* command.
* Secondly, for Lucent chip, Alrealy associated with an AP
* can only scan the APes on the fixed channel, so we must
* set the desired_ssid as "" before scan and restore after.
* Thirdly, scan cmd is effective only when the card is enabled
* and any 'set' operation(such as set bsstype, ssid)must disable
* the card first and then enable the card after the 'set'
*/
if ((enable) &&
ret = (int)WL_HW_ERROR;
goto done;
}
}
if ((enable) &&
ret = (int)WL_HW_ERROR;
goto done;
}
}
ret = (int)WL_HW_ERROR;
goto done;
}
switch (pcwl_p->pcwl_chip_type) {
case PCWL_CHIP_PRISMII:
for (i = 0; i < WL_MAX_SCAN_TIMES; i++) {
break;
}
break;
case PCWL_CHIP_LUCENT:
default:
for (i = 0; i < WL_MAX_SCAN_TIMES; i++) {
ret = (int)WL_HW_ERROR;
goto done;
}
break;
}
break;
}
ret = (int)WL_HW_ERROR;
goto done;
}
ret = (int)WL_HW_ERROR;
goto done;
}
ret = (int)WL_HW_ERROR;
goto done;
}
}
ret = (int)WL_HW_ERROR;
}
done:
if (ret)
return (ret);
}
/*ARGSUSED*/
static int
{
char *buf;
uint16_t i;
MAX_BUF_LEN));
return (ENOMEM);
}
for (i = 0; i < pcwl_p->pcwl_scan_num; i++) {
if (!scan_item)
goto done;
i * sizeof (wl_ess_conf_t));
= WL_DSSS;
15);
} else {
else
* 15 / 127));
}
}
done:
for (i = 0; i < (outfp->wldp_length); i++)
return (WL_SUCCESS);
}
/*ARGSUSED*/
static int
{
char *buf;
int iret;
MAX_BUF_LEN));
return (ENOMEM);
}
WL_RID_PORTSTATUS, &val);
if (ret) {
goto done;
}
sizeof (wl_linkstatus_t);
} else if (val == WL_PORT_TO_IBSS ||
sizeof (wl_linkstatus_t);
} else {
}
done:
for (i = 0; i < (outfp->wldp_length); i++)
return (iret);
}
static int
{
char *buf;
int iret;
MAX_BUF_LEN));
return (ENOMEM);
}
if (cmd == WLAN_GET_PARAM) {
rf_p->rf_porttype));
} else if (cmd == WLAN_SET_PARAM) {
if ((ret != WL_BSS_BSS) &&
(ret != WL_BSS_IBSS) &&
(ret != WL_BSS_ANY)) {
goto done;
}
} else {
return (EINVAL);
}
done:
for (i = 0; i < (outfp->wldp_length); i++)
return (iret);
}
static int
{
char *buf;
int iret;
MAX_BUF_LEN));
return (ENOMEM);
}
if (cmd == WLAN_GET_PARAM) {
WL_RID_CURRENT_CHNL, &retval)) {
goto done;
}
} else if (cmd == WLAN_SET_PARAM) {
goto done;
}
} else {
return (EINVAL);
}
done:
for (i = 0; i < (outfp->wldp_length); i++)
return (iret);
}
static int
{
uint16_t i;
char *buf;
int iret;
char rates[4];
char maxrate;
MAX_BUF_LEN));
return (ENOMEM);
}
if (cmd == WLAN_GET_PARAM) {
goto done;
}
1 * sizeof (char);
switch (rate) {
case WL_SPEED_1Mbps_P2:
wl_rates_rates)[0] = WL_RATE_1M;
break;
case WL_SPEED_2Mbps_P2:
wl_rates_rates)[0] = WL_RATE_2M;
break;
case WL_SPEED_55Mbps_P2:
wl_rates_rates)[0] = WL_RATE_5_5M;
break;
case WL_SPEED_11Mbps_P2:
wl_rates_rates)[0] = WL_RATE_11M;
break;
default:
goto done;
}
} else {
switch (rate) {
case WL_L_TX_RATE_FIX_1M:
wl_rates_num = 1;
wl_rates_rates)[0] = WL_RATE_1M;
1 * sizeof (char);
break;
case WL_L_TX_RATE_FIX_2M:
wl_rates_num = 1;
wl_rates_rates)[0] = WL_RATE_2M;
1 * sizeof (char);
break;
case WL_L_TX_RATE_AUTO_H:
wl_rates_num = 4;
wl_rates_rates)[0] = WL_RATE_1M;
4 * sizeof (char);
break;
case WL_L_TX_RATE_FIX_5M:
wl_rates_num = 1;
wl_rates_rates)[0] = WL_RATE_5_5M;
1 * sizeof (char);
break;
case WL_L_TX_RATE_FIX_11M:
wl_rates_num = 1;
wl_rates_rates)[0] = WL_RATE_11M;
1 * sizeof (char);
break;
case WL_L_TX_RATE_AUTO_L:
wl_rates_num = 2;
wl_rates_rates)[0] = WL_RATE_1M;
2 * sizeof (char);
break;
case WL_L_TX_RATE_AUTO_M:
wl_rates_num = 3;
wl_rates_rates)[0] = WL_RATE_1M;
3 * sizeof (char);
break;
default:
goto done;
}
}
} else if (cmd == WLAN_SET_PARAM) {
for (i = 0; i < 4; i++) {
rates[i] = (((wl_rates_t *)
i, rates[i]));
}
->wl_rates_num));
switch (((wl_rates_t *)
case 1:
switch (rates[0]) {
case WL_RATE_1M:
break;
case WL_RATE_2M:
break;
case WL_RATE_11M:
break;
case WL_RATE_5_5M:
break;
default:
goto done;
}
break;
case 2:
switch (maxrate) {
case WL_RATE_2M:
break;
case WL_RATE_11M:
break;
case WL_RATE_5_5M:
break;
default:
goto done;
}
break;
case 3:
switch (maxrate) {
case WL_RATE_11M:
break;
case WL_RATE_5_5M:
break;
default:
goto done;
}
break;
case 4:
break;
default:
goto done;
}
} else {
return (EINVAL);
}
done:
for (i = 0; i < (outfp->wldp_length); i++)
return (iret);
}
/*ARGSUSED*/
static int
{
uint16_t i;
char *buf;
MAX_BUF_LEN));
return (ENOMEM);
}
if (cmd == WLAN_GET_PARAM) {
= WL_RATE_1M;
= WL_RATE_2M;
= WL_RATE_5_5M;
= WL_RATE_11M;
4 * sizeof (char);
for (i = 0; i < (outfp->wldp_length); i++)
return (WL_SUCCESS);
} else {
return (EINVAL);
}
}
static int
{
char *buf;
int iret;
MAX_BUF_LEN));
return (ENOMEM);
}
if (cmd == WLAN_GET_PARAM) {
} else if (cmd == WLAN_SET_PARAM) {
->wl_ps_mode);
goto done;
}
} else {
return (EINVAL);
}
done:
for (i = 0; i < (outfp->wldp_length); i++)
return (iret);
}
static int
{
char *buf;
int iret;
MAX_BUF_LEN));
return (ENOMEM);
}
if (cmd == WLAN_GET_PARAM) {
} else if (cmd == WLAN_SET_PARAM) {
goto done;
}
} else {
return (EINVAL);
}
done:
for (i = 0; i < (outfp->wldp_length); i++)
return (iret);
}
static int
{
char *buf;
int iret;
MAX_BUF_LEN));
return (ENOMEM);
}
if (cmd == WLAN_GET_PARAM) {
} else if (cmd == WLAN_SET_PARAM) {
goto done;
}
} else {
return (EINVAL);
}
done:
for (i = 0; i < (outfp->wldp_length); i++)
return (iret);
}
static int
{
char *buf;
int iret;
MAX_BUF_LEN));
return (ENOMEM);
}
if (cmd == WLAN_GET_PARAM) {
} else if (cmd == WLAN_SET_PARAM) {
if (ret >= MAX_NWEPKEYS) {
goto done;
}
} else {
return (EINVAL);
}
done:
for (i = 0; i < (outfp->wldp_length); i++)
return (iret);
}
static int
{
char *buf;
int iret;
MAX_BUF_LEN));
return (ENOMEM);
}
if (cmd == WLAN_GET_PARAM) {
} else if (cmd == WLAN_SET_PARAM) {
goto done;
}
} else {
return (EINVAL);
}
done:
for (i = 0; i < (outfp->wldp_length); i++)
return (iret);
}
static int
{
uint16_t i;
int iret;
char *buf;
MAX_BUF_LEN));
return (ENOMEM);
}
if (cmd == WLAN_GET_PARAM) {
} else {
/*
* According to the description of the
* datasheet(Lucent card), the signal level
* value is between 27 -- 154.
* we reflect these value to 1-15 as rssi.
*/
else
* 15 / 127));
}
} else if (cmd == WLAN_SET_PARAM) {
} else {
return (EINVAL);
}
done:
for (i = 0; i < (outfp->wldp_length); i++)
return (iret);
}
/*ARGSUSED*/
static int
{
uint16_t i;
int iret;
char *buf;
MAX_BUF_LEN));
return (ENOMEM);
}
if (cmd == WLAN_GET_PARAM) {
} else if (cmd == WLAN_SET_PARAM) {
} else {
return (EINVAL);
}
for (i = 0; i < (outfp->wldp_length); i++)
return (iret);
}
static int
{
uint16_t i;
char *buf;
int iret;
MAX_BUF_LEN));
return (ENOMEM);
}
if (cmd == WLAN_GET_PARAM) {
} else if (cmd == WLAN_SET_PARAM) {
for (i = 0; i < MAX_NWEPKEYS; i++) {
PCWL_SWAP16((uint16_t *)
}
}
} else {
return (EINVAL);
}
done:
for (i = 0; i < (outfp->wldp_length); i++)
return (iret);
}
static void
pcwl_connect_timeout(void *arg)
{
goto done;
}
goto done;
}
goto done;
}
done:
if (ret)
}
static int
{
int ret = WL_SUCCESS;
int connect = 0;
return (PCWL_FAIL);
}
case WL_ESSID:
connect = 1;
break;
case WL_BSSID:
connect = 1;
break;
case WL_ESS_LIST:
break;
case WL_LINKSTATUS:
break;
case WL_BSS_TYPE:
connect = 1;
break;
case WL_PHY_CONFIG:
connect = 1;
break;
case WL_DESIRED_RATES:
connect = 1;
break;
case WL_SUPPORTED_RATES:
break;
case WL_POWER_MODE:
break;
case WL_AUTH_MODE:
connect = 1;
break;
case WL_ENCRYPTION:
connect = 1;
break;
case WL_WEP_KEY_ID:
connect = 1;
break;
case WL_CREATE_IBSS:
connect = 1;
break;
case WL_RSSI:
break;
case WL_RADIO:
break;
case WL_WEP_KEY_TAB:
connect = 1;
break;
case WL_SCAN:
if (pcwl_p->pcwl_connect_timeout_id != 0) {
}
break;
case WL_LOAD_DEFAULTS:
if (pcwl_p->pcwl_connect_timeout_id != 0) {
}
ret = (int)WL_HW_ERROR;
break;
}
ret = (int)WL_HW_ERROR;
break;
}
ret = (int)WL_HW_ERROR;
break;
}
ret = (int)WL_HW_ERROR;
break;
}
break;
case WL_DISASSOCIATE:
if (pcwl_p->pcwl_connect_timeout_id != 0) {
}
ret = (int)WL_HW_ERROR;
break;
}
/*
* A workaround here: If the card is in ad-hoc mode, the
* following scan will not work correctly, so any
* 'dladm connect-wifi' which need a scan first will not
* succeed. software reset the card here as a workround.
*/
ret = (int)WL_HW_ERROR;
break;
}
ret = (int)WL_HW_ERROR;
break;
}
}
ret = (int)WL_HW_ERROR;
break;
}
ret = (int)WL_HW_ERROR;
break;
}
ret = (int)WL_HW_ERROR;
break;
}
break;
case WL_REASSOCIATE:
case WL_ASSOCIAT:
if (pcwl_p->pcwl_connect_timeout_id != 0) {
}
ret = (int)WL_HW_ERROR;
break;
}
ret = (int)WL_HW_ERROR;
break;
}
ret = (int)WL_HW_ERROR;
break;
}
break;
default:
break;
}
if (pcwl_p->pcwl_connect_timeout_id != 0) {
}
}
return (ret);
}
static void
{
/*
* sanity check
*/
return;
}
/*
* assuming single data block
*/
}
/*
* we will overwrite everything
*/
}
static void
{
/*
* Validate the command before bothering with the mutexen ...
*/
switch (cmd) {
default:
return;
case WLAN_GET_PARAM:
break;
case WLAN_SET_PARAM:
case WLAN_COMMAND:
break;
}
else
}