Just finished adding updates for queued commands. We're working w/

ESS and a fixed BSSID.
This commit is contained in:
mark 2001-10-15 21:38:28 +00:00
parent 66da69b518
commit 6e072db4b4
6 changed files with 1138 additions and 1201 deletions

21
CHANGES
View File

@ -42,6 +42,27 @@
*
* --------------------------------------------------------------------
0.1.11
- IMPORTANT! Note that we've changed the up/down behavior. You now
must 'up' the linux netdevice interface (e.g. ifconfig wlan0 up) prior
to using wlanctl-ng. Also, wlanctl commands aren't available after
"ifconfig down". From a low-level perspective, this is how most
linux netdevices work. We originally started trying to create a
setup where "ifconfig up" on an interface that wasn't associated would
fail. With PCI and even more so with USB, that has proven unworkable.
The idea now is:
Step 1: ifconfig wlan0 up
Enables the hardware so it's ready to handle wlanctl-ng commands.
Step 2: wlanctl-ng <various commands>, repeat
Set up the dot11 configuration and get yourself associated or
whatever.
Step 3: ifconfig wlan0 <address>
After getting a "real" 802.11 connection, assign the address
to the interface (via static numbers, dhcp or whatever).
Note that it is very important that you do _not_ down the interface
between the initial 'ifconfig up' and the later ifconfig that assigns
the address. 'ifconfig down' will shut down and reset the hardware.
If you down the interface, all that good work in step 2 will be lost.
- Moved all memmapped/irq interface elements from prism2*.c to hfa384x.c
in preparation for adding USB support.
- Fixed 'make clean' so it doesn't generate .depend files.

View File

@ -2627,6 +2627,17 @@ int hfa384x_drvr_initialize(hfa384x_t *hw)
hfa384x_setreg(hw, 0, HFA384x_INTEN);
hfa384x_setreg(hw, 0xffff, HFA384x_EVACK);
/* Initialize FID stack */
#ifdef USE_FID_STACK
spin_lock_init(&(hw->txfid_lock));
hw->txfid_top = HFA384x_DRVR_FIDSTACKLEN_MAX;
memset(hw->txfid_stack, 0, sizeof(hw->txfid_stack));
#else
hw->txfid_head = 0;
hw->txfid_tail = 0;
hw->txfid_N = HFA384x_DRVR_FIDSTACKLEN_MAX;
memset(hw->txfid_queue, 0, sizeof(hw->txfid_queue));
#endif
/* Allocate tx and notify FIDs */
/* First, tx */
for ( i = 0; i < HFA384x_DRVR_FIDSTACKLEN_MAX-1; i++) {

File diff suppressed because it is too large Load Diff

View File

@ -754,8 +754,11 @@ int prism2mgmt_reset(wlandevice_t *wlandev, void *msgp)
memcpy(priv->name, name, WLAN_DEVNAMELEN_MAX);
#endif
priv->hw = hw;
prism2sta_initmac(wlandev);
#if 0
/* initmac() calls moved to open */
prism2sta_initmac(wlandev);
#endif
DBFEXIT;
return 0;
}
@ -2163,19 +2166,6 @@ int prism2mgmt_autojoin(wlandevice_t *wlandev, void *msgp)
}
/*** STATION ***/
#if (WLAN_HOSTIF == WLAN_USB)
if ( prism2sta_initmac(wlandev) != 0) {
WLAN_LOG_ERROR0("MAC Initialization failed.\n");
kfree_s(priv->hw, sizeof(hfa384x_t));
kfree_s(wlandev->priv, sizeof(prism2sta_priv_t));
kfree_s(wlandev, sizeof(wlandevice_t));
/* usb_dec_dev_use(dev); */
wlandev = NULL;
/* goto failed; */
}
#endif /* (WLAN_HOSTIF == WLAN_USB) */
#if (WLAN_HOSTIF != WLAN_USB)
/* Set the TxRates */
reg = 0x000f;
hfa384x_drvr_setconfig16(hw, HFA384x_RID_TXRATECNTL, &reg);
@ -2217,7 +2207,6 @@ int prism2mgmt_autojoin(wlandevice_t *wlandev, void *msgp)
/* Set the resultcode */
msg->resultcode.status = P80211ENUM_msgitem_status_data_ok;
msg->resultcode.data = P80211ENUM_resultcode_success;
#endif
done:
DBFEXIT;

View File

@ -359,9 +359,11 @@ int prism2_irq_evread_max=20; /* Maximum number of
* ev_reads (loops)
* in irq handler
*/
int prism2_nousbreset=0; /* Boolean, skip USB reset? */
MODULE_PARM( prism2_debug, "i");
MODULE_PARM( prism2_irq_evread_max, "i");
MODULE_PARM( prism2_nousbreset, "i");
#if (WLAN_HOSTIF == WLAN_PCMCIA)
static u_int irq_mask = 0xdeb8; /* Interrupt mask */
@ -585,6 +587,19 @@ int prism2sta_open(wlandevice_t *wlandev)
int i;
DBFENTER;
result = prism2sta_initmac(wlandev);
if ( result != 0 ) {
WLAN_LOG_ERROR1(
"initmac() failed. result=%d\n", result);
result = -ENODEV;
goto bail;
}
MOD_INC_USE_COUNT;
#if 0
/* We no longer test for this. The linux netdevice can be opened without
* an enabled port now.
*/
/* Make sure at least 1 port is enabled */
for ( i = 0; i < HFA384x_NUMPORTS_MAX; i++) {
if ( priv->hw->port_enabled[i] != 0 ) break;
@ -594,6 +609,7 @@ int prism2sta_open(wlandevice_t *wlandev)
} else {
MOD_INC_USE_COUNT;
}
#endif
/* We don't currently have to do anything else. */
/* The setup of the MAC should have been done previously */
@ -601,7 +617,7 @@ int prism2sta_open(wlandevice_t *wlandev)
/* Higher layers know we're ready from dev->start==1 and */
/* dev->tbusy==0. Our rx path knows to pass up received */
/* frames because of dev->flags&IFF_UP is true. */
bail:
DBFEXIT;
return result;
}
@ -630,17 +646,19 @@ int prism2sta_open(wlandevice_t *wlandev)
----------------------------------------------------------------*/
int prism2sta_close(wlandevice_t *wlandev)
{
prism2sta_priv_t *priv = (prism2sta_priv_t*)wlandev->priv;
hfa384x_t *hw = priv->hw;
DBFENTER;
/* Shut down the MAC by issuing an "Initialize" command */
hfa384x_cmd_initialize(priv->hw);
MOD_DEC_USE_COUNT;
/* We don't currently have to do anything else. */
/* Higher layers know we're not ready from dev->start==0 and */
/* dev->tbusy==1. Our rx path knows to not pass up received */
/* frames because of dev->flags&IFF_UP is false. */
/* We leave the port enabled in case someone needs to receive */
/* Info frames or send Notify frames. All rx data frames after this */
/* will be dropped. */
DBFEXIT;
return 0;
@ -918,6 +936,7 @@ int prism2sta_initmac(wlandevice_t *wlandev)
goto failed;
}
#if (WLAN_HOSTIF != WLAN_USB)
/* Read the PDA */
result = hfa384x_drvr_readpda(hw, priv->pda, HFA384x_PDA_LEN_MAX);
@ -925,6 +944,7 @@ int prism2sta_initmac(wlandevice_t *wlandev)
WLAN_LOG_DEBUG0(2,"drvr_readpda() failed\n");
goto failed;
}
#endif
/* Collect version and compatibility info */
/* Some are critical, some are not */
@ -1444,6 +1464,12 @@ void prism2sta_inf_linkstatus(wlandevice_t *wlandev, hfa384x_InfFrame_t *inf)
* Enable Transmits, Receives and pass up data frames
*/
WLAN_LOG_DEBUG0(1,"linkstatus=CONNECTED\n");
#if 0
getconfig_async(hw,rid,buf,len,fn);
/* Collect the BSSID, and set state to allow tx */
result = hfa384x_drvr_getconfig(hw,
HFA384x_RID_CURRENTBSSID,
@ -1468,6 +1494,12 @@ void prism2sta_inf_linkstatus(wlandevice_t *wlandev, hfa384x_InfFrame_t *inf)
wlandev->macmode =
portstatus == HFA384x_PSTATUS_CONN_IBSS ?
WLAN_MACMODE_IBSS_STA : WLAN_MACMODE_ESS_STA;
#endif
{
UINT8 tmp[] = { 0x00, 0x01, 0xa5, 0x00, 0x01, 0x35};
memcpy(wlandev->bssid, tmp, 6);
wlandev->macmode = WLAN_MACMODE_ESS_STA;
}
break;
case HFA384x_LINK_DISCONNECTED:
@ -1686,7 +1718,6 @@ void prism2sta_inf_authreq( wlandevice_t *wlandev, hfa384x_InfFrame_t *inf)
*/
memcpy(rec.address, inf->info.authreq.sta_addr, WLAN_ADDR_LEN);
rec.status = P80211ENUM_status_unspec_failure;
/*
@ -2661,12 +2692,15 @@ static int prism2sta_event (event_t event, int priority, event_callback_args_t *
((prism2sta_priv_t*)wlandev->priv)->hw,
wlandev->netdev->irq,
wlandev->netdev->base_addr, 0);
#if 0
/* Most initmac() calls moved to _open() */
result = prism2sta_initmac(wlandev);
if ( result != 0 ) {
WLAN_LOG_ERROR1(
"MAC Initialization failed. result=%d\n",
result);
}
#endif
}
break;
@ -2723,18 +2757,21 @@ static int prism2sta_event (event_t event, int priority, event_callback_args_t *
((prism2sta_priv_t*)wlandev->priv)->hw,
wlandev->netdev->irq,
wlandev->netdev->base_addr, 0);
result=prism2sta_initmac(wlandev);
if ( result != 0 ) {
WLAN_LOG_ERROR1(
"MAC Initialization failed, result=%d.\n",
result);
} else {
/* We only call initmac() if the i/f is already up */
if ( wlandev->netdev->flags & IFF_UP ) {
result=prism2sta_initmac(wlandev);
if ( result != 0 ) {
WLAN_LOG_ERROR1(
"initmac() failed, result=%d.\n",
result);
} else {
#if (LINUX_VERSION_CODE < WLAN_KVERSION(2,3,38) )
wlandev->netdev->tbusy = 0;
wlandev->netdev->start = 1;
wlandev->netdev->tbusy = 0;
wlandev->netdev->start = 1;
#else
netif_start_queue(wlandev->netdev);
netif_start_queue(wlandev->netdev);
#endif
}
}
}
break;
@ -2892,12 +2929,15 @@ static int prism2sta_probe_pci(struct pci_dev *pdev,
kfree_s(link, sizeof(pci_link_t));
wlandev = NULL;
} else {
#if 0
/* Most initmac() calls moved to open() */
if ( prism2sta_initmac(wlandev) != 0) {
WLAN_LOG_ERROR0("MAC Initialization failed.\n");
WLAN_LOG_ERROR0("initmac() failed.\n");
return -EIO;
}
/* Don't actually hook up the IRQ until we
#endif
/* Shouldn't actually hook up the IRQ until we
* _know_ things are alright. A test routine would help.
*/
request_irq(wlandev->netdev->irq, hfa384x_interrupt,
@ -3073,10 +3113,13 @@ static int prism2sta_probe_plx(struct pci_dev *pdev,
hfa384x_create(((prism2sta_priv_t*)wlandev->priv)->hw,
wlandev->netdev->irq, wlandev->netdev->base_addr, 0);
#if 0
/* Most initmac() calls moved to open() */
if ( prism2sta_initmac(wlandev) != 0) {
WLAN_LOG_ERROR0("MAC Initialization failed.");
return -EIO;
}
#endif
return 0;
}
@ -3095,6 +3138,7 @@ static int prism2sta_reset_usbdev(struct usb_device *dev)
int result;
int port = -1;
DBFENTER;
/* Find the hub port */
for ( i = 0; i < parent->maxchild; i++) {
if (parent->children[i] == dev) {
@ -3126,6 +3170,7 @@ static int prism2sta_reset_usbdev(struct usb_device *dev)
/* Assume we're reusing the original descriptor data */
DBFEXIT;
return 0;
}
@ -3176,14 +3221,16 @@ prism2sta_probe_usb(struct usb_device *dev, unsigned int ifnum)
"with devnum %d\n",
usb_id_tbl[i].name, dev->devnum);
/* Now, do a reset */
result = prism2sta_reset_usbdev(dev);
if ( result < 0 ) {
WLAN_LOG_ERROR1(
"prism2sta_reset_usbdev() failed, result=%d.\n",
result);
wlandev = NULL;
goto failed;
/* Now, if selected, do a reset */
if (!prism2_nousbreset ) {
result = prism2sta_reset_usbdev(dev);
if ( result < 0 ) {
WLAN_LOG_ERROR1(
"prism2sta_reset_usbdev() failed, result=%d.\n",
result);
wlandev = NULL;
goto failed;
}
}
/* Set the configuration. */
@ -3255,17 +3302,6 @@ prism2sta_probe_usb(struct usb_device *dev, unsigned int ifnum)
hfa384x_create(hw, dev, wlandev);
usb_inc_dev_use(dev);
#if 0
if ( prism2sta_initmac(wlandev) != 0) {
WLAN_LOG_ERROR0("MAC Initialization failed.\n");
kfree_s(priv->hw, sizeof(hfa384x_t));
kfree_s(wlandev->priv, sizeof(prism2sta_priv_t));
kfree_s(wlandev, sizeof(wlandevice_t));
usb_dec_dev_use(dev);
wlandev = NULL;
goto failed;
}
#endif
failed:
DBFEXIT;
@ -3300,12 +3336,16 @@ static void
prism2sta_disconnect_usb(struct usb_device *dev, void *ptr)
{
wlandevice_t *wlandev = (wlandevice_t*)ptr;
prism2sta_priv_t *priv = wlandev->priv;
hfa384x_t *hw = priv->hw;
prism2sta_priv_t *priv = NULL;
hfa384x_t *hw = NULL;
DBFENTER;
unregister_wlandev(wlandev);
/* kfree(wlandev); */
if ( wlandev != NULL ) {
priv = wlandev->priv;
hw = priv->hw;
unregister_wlandev(wlandev);
kfree(wlandev);
}
usb_dec_dev_use(hw->usb);
DBFEXIT;
return;

View File

@ -1033,7 +1033,7 @@ typedef struct hfa384x_authenticateStation_data
{
UINT8 address[WLAN_ADDR_LEN] __WLAN_ATTRIB_PACK__;
UINT16 status __WLAN_ATTRIB_PACK__;
UINT16 algorithm __WLAN_ATTRIB_PACK__;
UINT16 authalg __WLAN_ATTRIB_PACK__;
} __WLAN_ATTRIB_PACK__ hfa384x_authenticateStation_data_t;
/*-- Configuration Record: ChannelInfoRequest (data portion only) --*/
@ -1464,6 +1464,12 @@ Communication Frames: Field Masks for Transmit Frames
Communication Frames: Test/Get/Set Field Values for Transmit Frames
--------------------------------------------------------------------*/
/*-- Status Field --*/
#define HFA384x_TXSTATUS_ISERROR(v) \
(((UINT16)(v))&\
(HFA384x_TXSTATUS_ACKERR|HFA384x_TXSTATUS_FORMERR|\
HFA384x_TXSTATUS_DISCON|HFA384x_TXSTATUS_AGEDERR|\
HFA384x_TXSTATUS_RETRYERR))
#define HFA384x_TXSTATUS_ISACKERR(v) ((UINT16)(((UINT16)(v)) & HFA384x_TXSTATUS_ACKERR))
#define HFA384x_TXSTATUS_ISFORMERR(v) ((UINT16)(((UINT16)(v)) & HFA384x_TXSTATUS_FORMERR))
#define HFA384x_TXSTATUS_ISDISCON(v) ((UINT16)(((UINT16)(v)) & HFA384x_TXSTATUS_DISCON))
@ -1795,6 +1801,7 @@ typedef struct hfa384x_usb_cmdreq {
UINT16 parm0 __WLAN_ATTRIB_PACK__;
UINT16 parm1 __WLAN_ATTRIB_PACK__;
UINT16 parm2 __WLAN_ATTRIB_PACK__;
UINT8 pad[54] __WLAN_ATTRIB_PACK__;
} __WLAN_ATTRIB_PACK__ hfa384x_usb_cmdreq_t;
typedef struct hfa384x_usb_wridreq {
@ -1806,7 +1813,9 @@ typedef struct hfa384x_usb_wridreq {
typedef struct hfa384x_usb_rridreq {
UINT16 type __WLAN_ATTRIB_PACK__;
UINT16 frmlen __WLAN_ATTRIB_PACK__;
UINT16 rid __WLAN_ATTRIB_PACK__;
UINT8 pad[58] __WLAN_ATTRIB_PACK__;
} __WLAN_ATTRIB_PACK__ hfa384x_usb_rridreq_t;
typedef struct hfa384x_usb_wmemreq {
@ -1822,6 +1831,7 @@ typedef struct hfa384x_usb_rmemreq {
UINT16 frmlen __WLAN_ATTRIB_PACK__;
UINT16 offset __WLAN_ATTRIB_PACK__;
UINT16 page __WLAN_ATTRIB_PACK__;
UINT8 pad[58] __WLAN_ATTRIB_PACK__;
} __WLAN_ATTRIB_PACK__ hfa384x_usb_rmemreq_t;
/*------------------------------------*/
@ -1833,10 +1843,8 @@ typedef struct hfa384x_usb_rxfrm {
} __WLAN_ATTRIB_PACK__ hfa384x_usb_rxfrm_t;
typedef struct hfa384x_usb_infofrm {
UINT16 type __WLAN_ATTRIB_PACK__;
UINT16 frmlen __WLAN_ATTRIB_PACK__;
UINT16 inftype __WLAN_ATTRIB_PACK__;
UINT8 data[HFA384x_INFODATA_MAXLEN] __WLAN_ATTRIB_PACK__;
UINT16 type __WLAN_ATTRIB_PACK__;
hfa384x_InfFrame_t info __WLAN_ATTRIB_PACK__;
} __WLAN_ATTRIB_PACK__ hfa384x_usb_infofrm_t;
typedef struct hfa384x_usb_cmdresp {
@ -1902,6 +1910,7 @@ typedef union hfa384x_usbout {
typedef union hfa384x_usbin {
UINT16 type __WLAN_ATTRIB_PACK__;
hfa384x_usb_rxfrm_t rxfrm __WLAN_ATTRIB_PACK__;
hfa384x_usb_txfrm_t txfrm __WLAN_ATTRIB_PACK__;
hfa384x_usb_infofrm_t infofrm __WLAN_ATTRIB_PACK__;
hfa384x_usb_cmdresp_t cmdresp __WLAN_ATTRIB_PACK__;
hfa384x_usb_wridresp_t wridresp __WLAN_ATTRIB_PACK__;
@ -1910,6 +1919,7 @@ typedef union hfa384x_usbin {
hfa384x_usb_rmemresp_t rmemresp __WLAN_ATTRIB_PACK__;
hfa384x_usb_bufavail_t bufavail __WLAN_ATTRIB_PACK__;
hfa384x_usb_error_t usberror __WLAN_ATTRIB_PACK__;
UINT8 boguspad[3000] __WLAN_ATTRIB_PACK__;
} __WLAN_ATTRIB_PACK__ hfa384x_usbin_t;
#endif /* WLAN_USB */
@ -2155,6 +2165,53 @@ typedef struct hfa384x_pdrec
--- MAC state structure, argument to all functions --
--------------------------------------------------------------------*/
#if (WLAN_HOSTIF == WLAN_USB)
/* Types and constants to support the Prism2 USB command queue */
typedef void (*usbcmd_usercb_t)(wlandevice_t *wlandev, void *usercb_data);
typedef struct hfa384x_usbcmd
{
struct hfa384x_usbcmd *prev, *next;
struct urb outurb; /* OUT for req pkt */
struct urb inurb; /* IN for resp pkt */
hfa384x_usbout_t outbuf; /* pkt buf for OUT */
hfa384x_usbin_t inbuf; /* pkt buf for IN (copy) */
struct timer_list intimer; /* Timer for IN wait */
int is_async; /* Q'd by sync or async call */
wait_queue_head_t waitq; /* Sleeper for sync callers */
usbcmd_usercb_t usercb; /* Async user callback, */
void *usercb_data; /* called on resp IN. */
void *userbuf; /* getconfig, readmem arg */
int userbuflen; /* buffer. */
volatile UINT32 state; /* Tracks running state */
} hfa384x_usbcmd_t;
/* hfa384x_usbcmd_t.state values */
#define HFA384x_USBCMD_INACTIVE 0 /* Not queued, data invalid */
#define HFA384x_USBCMD_QUEUED 1 /* Queued, data valid */
#define HFA384x_USBCMD_RUNNINGTX 2 /* OUT URB sent, wait on cb */
#define HFA384x_USBCMD_RUNNINGRX 3 /* OUT cb called, wait on IN
* cb
*/
#define HFA384x_USBCMD_TXFAIL 4 /* OUT cb called w/ err, cmd
* dequeued and canceled.
*/
#define HFA384x_USBCMD_RXTIMEOUT 5 /* OUT cb called w/ success,
* timout waiting for IN cb,
* cmd dequeued and cancelled.
*/
#define HFA384x_USBCMD_COMPLETE 6 /* IN cb called and matched
* this cmd. Cmd dequeued
*/
typedef struct hfa384x_usbcmdq
{
spinlock_t lock;
hfa384x_usbcmd_t *head;
hfa384x_usbcmd_t *tail;
} hfa384x_usbcmdq_t;
#endif
typedef struct hfa384x
{
#if (WLAN_HOSTIF != WLAN_USB)
@ -2163,22 +2220,18 @@ typedef struct hfa384x
UINT32 membase;
UINT32 irq;
#else
/* USB support data */
struct usb_device *usb;
void *usbcontext; /* actually a wlandev */
struct urb tx_urb;
struct urb rx_urb;
struct urb tx_urb;
struct urb int_urb;
hfa384x_usbin_t usbin;
hfa384x_usbout_t usbout;
UINT16 usbint[4];
hfa384x_usbin_t rxbuff;
hfa384x_usbout_t txbuff;
UINT16 intbuff[4];
#define HFA384x_USBFLAG_RXURB_BUSY 0x01
#define HFA384x_USBFLAG_TXURB_BUSY 0x02
#define HFA384x_USBFLAG_CMDPENDING 0x04
#define HFA384x_USBFLAG_CMDPENDINGRX 0x08
UINT usbflags;
wait_queue_head_t cmdq;
hfa384x_usbcmdq_t cmdq;
#endif /* !USB */