/* System Includes */
#define WLAN_DBVAR prism2_debug
-#include "version.h"
-
-
#include <linux/version.h>
#include <linux/module.h>
#include <asm/bitops.h>
#include <linux/list.h>
#include <linux/usb.h>
+#include <linux/byteorder/generic.h>
#include "wlan_compat.h"
-#if (WLAN_HOSTIF != WLAN_USB)
-#error "This file is specific to USB"
-#endif
-
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
-static int
-wait_for_completion_interruptible(struct completion *x)
-{
- int ret = 0;
-
- might_sleep();
-
- spin_lock_irq(&x->wait.lock);
- if (!x->done) {
- DECLARE_WAITQUEUE(wait, current);
-
- wait.flags |= WQ_FLAG_EXCLUSIVE;
- __add_wait_queue_tail(&x->wait, &wait);
- do {
- if (signal_pending(current)) {
- ret = -ERESTARTSYS;
- __remove_wait_queue(&x->wait, &wait);
- goto out;
- }
- __set_current_state(TASK_INTERRUPTIBLE);
- spin_unlock_irq(&x->wait.lock);
- schedule();
- spin_lock_irq(&x->wait.lock);
- } while (!x->done);
- __remove_wait_queue(&x->wait, &wait);
- }
- x->done--;
-out:
- spin_unlock_irq(&x->wait.lock);
-
- return ret;
-}
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,69)
-static void
-usb_init_urb(struct urb *urb)
-{
- memset(urb, 0, sizeof(*urb));
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) /* tune me! */
- urb->count = (atomic_t)ATOMIC_INIT(1);
-#endif
- spin_lock_init(&urb->lock);
-}
-#endif
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) /* tune me! */
-# define SUBMIT_URB(u,f) usb_submit_urb(u,f)
-#else
-# define SUBMIT_URB(u,f) usb_submit_urb(u)
-#endif
+#define SUBMIT_URB(u,f) usb_submit_urb(u,f)
/*================================================================*/
/* Project Includes */
typedef enum cmd_mode CMD_MODE;
#define THROTTLE_JIFFIES (HZ/8)
+#define URB_ASYNC_UNLINK 0
+#define USB_QUEUE_BULK 0
/*================================================================*/
/* Local Macros */
/*---------------------------------------------------*/
/* Callbacks */
-#ifdef URB_ONLY_CALLBACK
static void
hfa384x_usbout_callback(struct urb *urb);
static void
hfa384x_ctlxout_callback(struct urb *urb);
static void
hfa384x_usbin_callback(struct urb *urb);
-#else
-static void
-hfa384x_usbout_callback(struct urb *urb, struct pt_regs *regs);
-static void
-hfa384x_ctlxout_callback(struct urb *urb, struct pt_regs *regs);
-static void
-hfa384x_usbin_callback(struct urb *urb, struct pt_regs *regs);
-#endif
static void
hfa384x_usbin_txcompl(wlandevice_t *wlandev, hfa384x_usbin_t *usbin);
hfa384x_dorrid(
hfa384x_t *hw,
CMD_MODE mode,
- UINT16 rid,
+ u16 rid,
void *riddata,
- UINT riddatalen,
+ unsigned int riddatalen,
ctlx_cmdcb_t cmdcb,
ctlx_usercb_t usercb,
void *usercb_data);
hfa384x_dowrid(
hfa384x_t *hw,
CMD_MODE mode,
- UINT16 rid,
+ u16 rid,
void *riddata,
- UINT riddatalen,
+ unsigned int riddatalen,
ctlx_cmdcb_t cmdcb,
ctlx_usercb_t usercb,
void *usercb_data);
hfa384x_dormem(
hfa384x_t *hw,
CMD_MODE mode,
- UINT16 page,
- UINT16 offset,
+ u16 page,
+ u16 offset,
void *data,
- UINT len,
+ unsigned int len,
ctlx_cmdcb_t cmdcb,
ctlx_usercb_t usercb,
void *usercb_data);
hfa384x_dowmem(
hfa384x_t *hw,
CMD_MODE mode,
- UINT16 page,
- UINT16 offset,
+ u16 page,
+ u16 offset,
void *data,
- UINT len,
+ unsigned int len,
ctlx_cmdcb_t cmdcb,
ctlx_usercb_t usercb,
void *usercb_data);
static int
-hfa384x_isgood_pdrcode(UINT16 pdrcode);
+hfa384x_isgood_pdrcode(u16 pdrcode);
/*================================================================*/
/* Function Definitions */
WLAN_LOG_DEBUG(3,"urb->pipe=0x%08x\n", urb->pipe);
WLAN_LOG_DEBUG(3,"urb->status=0x%08x\n", urb->status);
WLAN_LOG_DEBUG(3,"urb->transfer_flags=0x%08x\n", urb->transfer_flags);
- WLAN_LOG_DEBUG(3,"urb->transfer_buffer=0x%08x\n", (UINT)urb->transfer_buffer);
+ WLAN_LOG_DEBUG(3,"urb->transfer_buffer=0x%08x\n", (unsigned int)urb->transfer_buffer);
WLAN_LOG_DEBUG(3,"urb->transfer_buffer_length=0x%08x\n", urb->transfer_buffer_length);
WLAN_LOG_DEBUG(3,"urb->actual_length=0x%08x\n", urb->actual_length);
WLAN_LOG_DEBUG(3,"urb->bandwidth=0x%08x\n", urb->bandwidth);
- WLAN_LOG_DEBUG(3,"urb->setup_packet(ctl)=0x%08x\n", (UINT)urb->setup_packet);
+ WLAN_LOG_DEBUG(3,"urb->setup_packet(ctl)=0x%08x\n", (unsigned int)urb->setup_packet);
WLAN_LOG_DEBUG(3,"urb->start_frame(iso/irq)=0x%08x\n", urb->start_frame);
WLAN_LOG_DEBUG(3,"urb->interval(irq)=0x%08x\n", urb->interval);
WLAN_LOG_DEBUG(3,"urb->error_count(iso)=0x%08x\n", urb->error_count);
WLAN_LOG_DEBUG(3,"urb->timeout=0x%08x\n", urb->timeout);
- WLAN_LOG_DEBUG(3,"urb->context=0x%08x\n", (UINT)urb->context);
- WLAN_LOG_DEBUG(3,"urb->complete=0x%08x\n", (UINT)urb->complete);
+ WLAN_LOG_DEBUG(3,"urb->context=0x%08x\n", (unsigned int)urb->context);
+ WLAN_LOG_DEBUG(3,"urb->complete=0x%08x\n", (unsigned int)urb->complete);
}
#endif
struct sk_buff *skb;
int result;
- DBFENTER;
-
skb = dev_alloc_skb(sizeof(hfa384x_usbin_t));
if (skb == NULL) {
result = -ENOMEM;
/* Check whether we need to reset the RX pipe */
if (result == -EPIPE) {
- WLAN_LOG_WARNING("%s rx pipe stalled: requesting reset\n",
+ printk(KERN_WARNING "%s rx pipe stalled: requesting reset\n",
hw->wlandev->netdev->name);
if ( !test_and_set_bit(WORK_RX_HALT, &hw->usb_flags) )
schedule_work(&hw->usb_work);
}
done:
-
- DBFEXIT;
return result;
}
struct net_device *netdev = hw->wlandev->netdev;
int result;
- DBFENTER;
-
result = -ENOLINK;
if ( netif_running(netdev) ) {
/* Test whether we need to reset the TX pipe */
if (result == -EPIPE) {
- WLAN_LOG_WARNING("%s tx pipe stalled: requesting reset\n",
+ printk(KERN_WARNING "%s tx pipe stalled: requesting reset\n",
netdev->name);
set_bit(WORK_TX_HALT, &hw->usb_flags);
schedule_work(&hw->usb_work);
}
}
- DBFEXIT;
-
return result;
}
hfa384x_t *hw = container_of(data, struct hfa384x, usb_work);
struct net_device *netdev = hw->wlandev->netdev;
- DBFENTER;
-
/* Don't bother trying to reset anything if the plug
* has been pulled ...
*/
if ( hw->wlandev->hwremoved ) {
- DBFEXIT;
return;
}
/* Resume transmitting. */
if ( test_and_clear_bit(WORK_TX_RESUME, &hw->usb_flags) ) {
- p80211netdev_wake_queue(hw->wlandev);
+ netif_wake_queue(hw->wlandev->netdev);
}
-
- DBFEXIT;
}
void
hfa384x_create( hfa384x_t *hw, struct usb_device *usb)
{
- DBFENTER;
-
memset(hw, 0, sizeof(hfa384x_t));
hw->usb = usb;
tasklet_init(&hw->completion_bh,
hfa384x_usbctlx_completion_task,
(unsigned long)hw);
- INIT_WORK2(&hw->link_bh, prism2sta_processing_defer);
- INIT_WORK2(&hw->usb_work, hfa384x_usb_defer);
+ INIT_WORK(&hw->link_bh, prism2sta_processing_defer);
+ INIT_WORK(&hw->usb_work, hfa384x_usb_defer);
init_timer(&hw->throttle);
hw->throttle.function = hfa384x_usb_throttlefn;
hw->link_status = HFA384x_LINK_NOTCONNECTED;
hw->state = HFA384x_STATE_INIT;
- INIT_WORK2(&hw->commsqual_bh, prism2sta_commsqual_defer);
+ INIT_WORK(&hw->commsqual_bh, prism2sta_commsqual_defer);
init_timer(&hw->commsqual_timer);
hw->commsqual_timer.data = (unsigned long) hw;
hw->commsqual_timer.function = prism2sta_commsqual_timer;
-
- DBFEXIT;
}
{
struct sk_buff *skb;
- DBFENTER;
-
if ( hw->state == HFA384x_STATE_RUNNING ) {
hfa384x_drvr_stop(hw);
}
while ( (skb = skb_dequeue(&hw->authq)) ) {
dev_kfree_skb(skb);
}
-
- DBFEXIT;
}
usbctlx_get_status(const hfa384x_usb_cmdresp_t *cmdresp,
hfa384x_cmdresult_t *result)
{
- DBFENTER;
-
result->status = hfa384x2host_16(cmdresp->status);
result->resp0 = hfa384x2host_16(cmdresp->resp0);
result->resp1 = hfa384x2host_16(cmdresp->resp1);
result->resp1,
result->resp2);
- DBFEXIT;
return (result->status & HFA384x_STATUS_RESULT);
}
usbctlx_get_rridresult(const hfa384x_usb_rridresp_t *rridresp,
hfa384x_rridresult_t *result)
{
- DBFENTER;
-
result->rid = hfa384x2host_16(rridresp->rid);
result->riddata = rridresp->data;
result->riddata_len = ((hfa384x2host_16(rridresp->frmlen) - 1) * 2);
- DBFEXIT;
}
const hfa384x_usb_rridresp_t *rridresp;
void *riddata;
- UINT riddatalen;
+ unsigned int riddatalen;
};
typedef struct usbctlx_rrid_completor usbctlx_rrid_completor_t;
/* Validate the length, note body len calculation in bytes */
if ( rridresult.riddata_len != complete->riddatalen ) {
- WLAN_LOG_WARNING(
+ printk(KERN_WARNING
"RID len mismatch, rid=0x%04x hlen=%d fwlen=%d\n",
rridresult.rid,
complete->riddatalen,
init_rrid_completor(usbctlx_rrid_completor_t *completor,
const hfa384x_usb_rridresp_t *rridresp,
void *riddata,
- UINT riddatalen)
+ unsigned int riddatalen)
{
completor->head.complete = usbctlx_rrid_completor_fn;
completor->rridresp = rridresp;
const hfa384x_usb_rmemresp_t *rmemresp;
void *data;
- UINT len;
+ unsigned int len;
};
typedef struct usbctlx_rmem_completor usbctlx_rmem_completor_t;
init_rmem_completor(usbctlx_rmem_completor_t *completor,
hfa384x_usb_rmemresp_t *rmemresp,
void *data,
- UINT len)
+ unsigned int len)
{
completor->head.complete = usbctlx_rmem_completor_fn;
completor->rmemresp = rmemresp;
static void
hfa384x_cb_status(hfa384x_t *hw, const hfa384x_usbctlx_t *ctlx)
{
- DBFENTER;
-
if ( ctlx->usercb != NULL ) {
hfa384x_cmdresult_t cmdresult;
ctlx->usercb(hw, &cmdresult, ctlx->usercb_data);
}
-
- DBFEXIT;
}
static void
hfa384x_cb_rrid(hfa384x_t *hw, const hfa384x_usbctlx_t *ctlx)
{
- DBFENTER;
-
if ( ctlx->usercb != NULL ) {
hfa384x_rridresult_t rridresult;
ctlx->usercb(hw, &rridresult, ctlx->usercb_data);
}
-
- DBFEXIT;
}
static inline int
}
static inline int
-hfa384x_dorrid_wait(hfa384x_t *hw, UINT16 rid, void *riddata, UINT riddatalen)
+hfa384x_dorrid_wait(hfa384x_t *hw, u16 rid, void *riddata, unsigned int riddatalen)
{
return hfa384x_dorrid(hw, DOWAIT,
rid, riddata, riddatalen,
static inline int
hfa384x_dorrid_async(hfa384x_t *hw,
- UINT16 rid, void *riddata, UINT riddatalen,
+ u16 rid, void *riddata, unsigned int riddatalen,
ctlx_cmdcb_t cmdcb,
ctlx_usercb_t usercb,
void *usercb_data)
}
static inline int
-hfa384x_dowrid_wait(hfa384x_t *hw, UINT16 rid, void *riddata, UINT riddatalen)
+hfa384x_dowrid_wait(hfa384x_t *hw, u16 rid, void *riddata, unsigned int riddatalen)
{
return hfa384x_dowrid(hw, DOWAIT,
rid, riddata, riddatalen,
static inline int
hfa384x_dowrid_async(hfa384x_t *hw,
- UINT16 rid, void *riddata, UINT riddatalen,
+ u16 rid, void *riddata, unsigned int riddatalen,
ctlx_cmdcb_t cmdcb,
ctlx_usercb_t usercb,
void *usercb_data)
static inline int
hfa384x_dormem_wait(hfa384x_t *hw,
- UINT16 page, UINT16 offset, void *data, UINT len)
+ u16 page, u16 offset, void *data, unsigned int len)
{
return hfa384x_dormem(hw, DOWAIT,
page, offset, data, len,
static inline int
hfa384x_dormem_async(hfa384x_t *hw,
- UINT16 page, UINT16 offset, void *data, UINT len,
+ u16 page, u16 offset, void *data, unsigned int len,
ctlx_cmdcb_t cmdcb,
ctlx_usercb_t usercb,
void *usercb_data)
static inline int
hfa384x_dowmem_wait(
hfa384x_t *hw,
- UINT16 page,
- UINT16 offset,
+ u16 page,
+ u16 offset,
void *data,
- UINT len)
+ unsigned int len)
{
return hfa384x_dowmem(hw, DOWAIT,
page, offset, data, len,
static inline int
hfa384x_dowmem_async(
hfa384x_t *hw,
- UINT16 page,
- UINT16 offset,
+ u16 page,
+ u16 offset,
void *data,
- UINT len,
+ unsigned int len,
ctlx_cmdcb_t cmdcb,
ctlx_usercb_t usercb,
void *usercb_data)
int i;
hfa384x_metacmd_t cmd;
- DBFENTER;
-
-
cmd.cmd = HFA384x_CMDCODE_INIT;
cmd.parm0 = 0;
cmd.parm1 = 0;
hw->link_status = HFA384x_LINK_NOTCONNECTED;
- DBFEXIT;
return result;
}
* Call context:
* process
----------------------------------------------------------------*/
-int hfa384x_cmd_disable(hfa384x_t *hw, UINT16 macport)
+int hfa384x_cmd_disable(hfa384x_t *hw, u16 macport)
{
int result = 0;
hfa384x_metacmd_t cmd;
- DBFENTER;
-
cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_DISABLE) |
HFA384x_CMD_MACPORT_SET(macport);
cmd.parm0 = 0;
result = hfa384x_docmd_wait(hw, &cmd);
- DBFEXIT;
return result;
}
* Call context:
* process
----------------------------------------------------------------*/
-int hfa384x_cmd_enable(hfa384x_t *hw, UINT16 macport)
+int hfa384x_cmd_enable(hfa384x_t *hw, u16 macport)
{
int result = 0;
hfa384x_metacmd_t cmd;
- DBFENTER;
-
cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_ENABLE) |
HFA384x_CMD_MACPORT_SET(macport);
cmd.parm0 = 0;
result = hfa384x_docmd_wait(hw, &cmd);
- DBFEXIT;
- return result;
-}
-
-
-/*----------------------------------------------------------------
-* hfa384x_cmd_notify
-*
-* Sends an info frame to the firmware to alter the behavior
-* of the f/w asynch processes. Can only be called when the MAC
-* is in the enabled state.
-*
-* Arguments:
-* hw device structure
-* reclaim [0|1] indicates whether the given FID will
-* be handed back (via Alloc event) for reuse.
-* (host order)
-* fid FID of buffer containing the frame that was
-* previously copied to MAC memory via the bap.
-* (host order)
-*
-* Returns:
-* 0 success
-* >0 f/w reported failure - f/w status code
-* <0 driver reported error (timeout|bad arg)
-*
-* Side effects:
-* hw->resp0 will contain the FID being used by async notify
-* process. If reclaim==0, resp0 will be the same as the fid
-* argument. If reclaim==1, resp0 will be the different.
-*
-* Call context:
-* process
-----------------------------------------------------------------*/
-int hfa384x_cmd_notify(hfa384x_t *hw, UINT16 reclaim, UINT16 fid,
- void *buf, UINT16 len)
-{
-#if 0
- int result = 0;
- UINT16 cmd;
- DBFENTER;
- cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_NOTIFY) |
- HFA384x_CMD_RECL_SET(reclaim);
- result = hfa384x_docmd_wait(hw, cmd);
-
- DBFEXIT;
- return result;
-#endif
-return 0;
-}
-
-
-#if 0
-/*----------------------------------------------------------------
-* hfa384x_cmd_inquiry
-*
-* Requests an info frame from the firmware. The info frame will
-* be delivered asynchronously via the Info event.
-*
-* Arguments:
-* hw device structure
-* fid FID of the info frame requested. (host order)
-*
-* Returns:
-* 0 success
-* >0 f/w reported failure - f/w status code
-* <0 driver reported error (timeout|bad arg)
-*
-* Side effects:
-*
-* Call context:
-* process
-----------------------------------------------------------------*/
-int hfa384x_cmd_inquiry(hfa384x_t *hw, UINT16 fid)
-{
- int result = 0;
- hfa384x_metacmd_t cmd;
-
- DBFENTER;
-
- cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_INQ);
- cmd.parm0 = 0;
- cmd.parm1 = 0;
- cmd.parm2 = 0;
-
- result = hfa384x_docmd_wait(hw, &cmd);
-
- DBFEXIT;
return result;
}
-#endif
-
/*----------------------------------------------------------------
* hfa384x_cmd_monitor
* Call context:
* process
----------------------------------------------------------------*/
-int hfa384x_cmd_monitor(hfa384x_t *hw, UINT16 enable)
+int hfa384x_cmd_monitor(hfa384x_t *hw, u16 enable)
{
int result = 0;
hfa384x_metacmd_t cmd;
- DBFENTER;
-
cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
HFA384x_CMD_AINFO_SET(enable);
cmd.parm0 = 0;
result = hfa384x_docmd_wait(hw, &cmd);
- DBFEXIT;
return result;
}
* Call context:
* process
----------------------------------------------------------------*/
-int hfa384x_cmd_download(hfa384x_t *hw, UINT16 mode, UINT16 lowaddr,
- UINT16 highaddr, UINT16 codelen)
+int hfa384x_cmd_download(hfa384x_t *hw, u16 mode, u16 lowaddr,
+ u16 highaddr, u16 codelen)
{
int result = 0;
hfa384x_metacmd_t cmd;
- DBFENTER;
WLAN_LOG_DEBUG(5,
"mode=%d, lowaddr=0x%04x, highaddr=0x%04x, codelen=%d\n",
mode, lowaddr, highaddr, codelen);
result = hfa384x_docmd_wait(hw, &cmd);
- DBFEXIT;
return result;
}
----------------------------------------------------------------*/
void
hfa384x_copy_from_aux(
- hfa384x_t *hw, UINT32 cardaddr, UINT32 auxctl, void *buf, UINT len)
+ hfa384x_t *hw, u32 cardaddr, u32 auxctl, void *buf, unsigned int len)
{
- DBFENTER;
- WLAN_LOG_ERROR("not used in USB.\n");
- DBFEXIT;
+ printk(KERN_ERR "not used in USB.\n");
}
----------------------------------------------------------------*/
void
hfa384x_copy_to_aux(
- hfa384x_t *hw, UINT32 cardaddr, UINT32 auxctl, void *buf, UINT len)
+ hfa384x_t *hw, u32 cardaddr, u32 auxctl, void *buf, unsigned int len)
{
- DBFENTER;
- WLAN_LOG_ERROR("not used in USB.\n");
- DBFEXIT;
+ printk(KERN_ERR "not used in USB.\n");
}
----------------------------------------------------------------*/
int hfa384x_corereset(hfa384x_t *hw, int holdtime, int settletime, int genesis)
{
-#if 0
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
- struct usb_device *parent = hw->usb->parent;
- int i;
- int port = -1;
-#endif
-#endif
int result = 0;
-
-#define P2_USB_RT_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER)
-#define P2_USB_FEAT_RESET 4
-#define P2_USB_FEAT_C_RESET 20
-
- DBFENTER;
-
-#if 0
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
- /* Find the hub port */
- for ( i = 0; i < parent->maxchild; i++) {
- if (parent->children[i] == hw->usb) {
- port = i;
- break;
- }
- }
- if (port < 0) return -ENOENT;
-
- /* Set and clear the reset */
- usb_control_msg(parent, usb_sndctrlpipe(parent, 0),
- USB_REQ_SET_FEATURE, P2_USB_RT_PORT, P2_USB_FEAT_RESET,
- port+1, NULL, 0, 1*HZ);
- wait_ms(holdtime);
- usb_control_msg(parent, usb_sndctrlpipe(parent, 0),
- USB_REQ_CLEAR_FEATURE, P2_USB_RT_PORT, P2_USB_FEAT_C_RESET,
- port+1, NULL, 0, 1*HZ);
- wait_ms(settletime);
-
- /* Set the device address */
- result=usb_set_address(hw->usb);
- if (result < 0) {
- WLAN_LOG_ERROR("reset_usbdev: Dev not accepting address, "
- "result=%d\n", result);
- clear_bit(hw->usb->devnum, &hw->usb->bus->devmap.devicemap);
- hw->usb->devnum = -1;
- goto done;
- }
- /* Let the address settle */
- wait_ms(20);
-
- /* Assume we're reusing the original descriptor data */
-
- /* Set the configuration. */
- WLAN_LOG_DEBUG(3, "Setting Configuration %d\n",
- hw->usb->config[0].bConfigurationValue);
- result=usb_set_configuration(hw->usb, hw->usb->config[0].bConfigurationValue);
- if ( result ) {
- WLAN_LOG_ERROR("usb_set_configuration() failed, result=%d.\n",
- result);
- goto done;
- }
- /* Let the configuration settle */
- wait_ms(20);
-
- done:
-#else
result=usb_reset_device(hw->usb);
if(result<0) {
- WLAN_LOG_ERROR("usb_reset_device() failed, result=%d.\n",result);
+ printk(KERN_ERR "usb_reset_device() failed, result=%d.\n",result);
}
-#endif
-#endif
- result=usb_reset_device(hw->usb);
- if(result<0) {
- WLAN_LOG_ERROR("usb_reset_device() failed, result=%d.\n",result);
- }
-
- DBFEXIT;
return result;
}
unsigned long flags;
int result;
- DBFENTER;
-
result = wait_for_completion_interruptible(&ctlx->done);
spin_lock_irqsave(&hw->ctlxq.lock, flags);
if (ctlx->state == CTLX_COMPLETE) {
result = completor->complete(completor);
} else {
- WLAN_LOG_WARNING("CTLX[%d] error: state(%s)\n",
+ printk(KERN_WARNING "CTLX[%d] error: state(%s)\n",
hfa384x2host_16(ctlx->outbuf.type),
ctlxstr(ctlx->state));
result = -EIO;
kfree(ctlx);
}
- DBFEXIT;
return result;
}
int result;
hfa384x_usbctlx_t *ctlx;
- DBFENTER;
ctlx = usbctlx_alloc();
if ( ctlx == NULL ) {
result = -ENOMEM;
}
done:
- DBFEXIT;
return result;
}
hfa384x_dorrid(
hfa384x_t *hw,
CMD_MODE mode,
- UINT16 rid,
+ u16 rid,
void *riddata,
- UINT riddatalen,
+ unsigned int riddatalen,
ctlx_cmdcb_t cmdcb,
ctlx_usercb_t usercb,
void *usercb_data)
int result;
hfa384x_usbctlx_t *ctlx;
- DBFENTER;
ctlx = usbctlx_alloc();
if ( ctlx == NULL ) {
result = -ENOMEM;
}
done:
- DBFEXIT;
return result;
}
hfa384x_dowrid(
hfa384x_t *hw,
CMD_MODE mode,
- UINT16 rid,
+ u16 rid,
void *riddata,
- UINT riddatalen,
+ unsigned int riddatalen,
ctlx_cmdcb_t cmdcb,
ctlx_usercb_t usercb,
void *usercb_data)
int result;
hfa384x_usbctlx_t *ctlx;
- DBFENTER;
ctlx = usbctlx_alloc();
if ( ctlx == NULL ) {
result = -ENOMEM;
}
done:
- DBFEXIT;
return result;
}
hfa384x_dormem(
hfa384x_t *hw,
CMD_MODE mode,
- UINT16 page,
- UINT16 offset,
+ u16 page,
+ u16 offset,
void *data,
- UINT len,
+ unsigned int len,
ctlx_cmdcb_t cmdcb,
ctlx_usercb_t usercb,
void *usercb_data)
int result;
hfa384x_usbctlx_t *ctlx;
- DBFENTER;
ctlx = usbctlx_alloc();
if ( ctlx == NULL ) {
result = -ENOMEM;
}
done:
- DBFEXIT;
return result;
}
hfa384x_dowmem(
hfa384x_t *hw,
CMD_MODE mode,
- UINT16 page,
- UINT16 offset,
+ u16 page,
+ u16 offset,
void *data,
- UINT len,
+ unsigned int len,
ctlx_cmdcb_t cmdcb,
ctlx_usercb_t usercb,
void *usercb_data)
int result;
hfa384x_usbctlx_t *ctlx;
- DBFENTER;
WLAN_LOG_DEBUG(5, "page=0x%04x offset=0x%04x len=%d\n",
page,offset,len);
}
done:
- DBFEXIT;
return result;
}
{
hfa384x_metacmd_t cmd;
- DBFENTER;
-
cmd.cmd = HFA384x_CMDCODE_INQ;
cmd.parm0 = HFA384x_IT_COMMTALLIES;
cmd.parm1 = 0;
hfa384x_docmd_async(hw, &cmd, NULL, NULL, NULL);
- DBFEXIT;
return 0;
}
* Call context:
* process
----------------------------------------------------------------*/
-int hfa384x_drvr_disable(hfa384x_t *hw, UINT16 macport)
+int hfa384x_drvr_disable(hfa384x_t *hw, u16 macport)
{
int result = 0;
- DBFENTER;
if ((!hw->isap && macport != 0) ||
(hw->isap && !(macport <= HFA384x_PORTID_MAX)) ||
!(hw->port_enabled[macport]) ){
hw->port_enabled[macport] = 0;
}
}
- DBFEXIT;
return result;
}
* Call context:
* process
----------------------------------------------------------------*/
-int hfa384x_drvr_enable(hfa384x_t *hw, UINT16 macport)
+int hfa384x_drvr_enable(hfa384x_t *hw, u16 macport)
{
int result = 0;
- DBFENTER;
if ((!hw->isap && macport != 0) ||
(hw->isap && !(macport <= HFA384x_PORTID_MAX)) ||
(hw->port_enabled[macport]) ){
hw->port_enabled[macport] = 1;
}
}
- DBFEXIT;
return result;
}
int result = 0;
int i;
- DBFENTER;
/* Check that a port isn't active */
for ( i = 0; i < HFA384x_PORTID_MAX; i++) {
if ( hw->port_enabled[i] ) {
WLAN_LOG_DEBUG(1,"flashdl_enable\n");
hw->dlstate = HFA384x_DLSTATE_FLASHENABLED;
- DBFEXIT;
+
return result;
}
----------------------------------------------------------------*/
int hfa384x_drvr_flashdl_disable(hfa384x_t *hw)
{
- DBFENTER;
/* Check that we're already in the download state */
if ( hw->dlstate != HFA384x_DLSTATE_FLASHENABLED ) {
return -EINVAL;
hfa384x_cmd_download(hw, HFA384x_PROGMODE_DISABLE, 0, 0 , 0);
hw->dlstate = HFA384x_DLSTATE_DISABLED;
- DBFEXIT;
return 0;
}
int
hfa384x_drvr_flashdl_write(
hfa384x_t *hw,
- UINT32 daddr,
+ u32 daddr,
void *buf,
- UINT32 len)
+ u32 len)
{
int result = 0;
- UINT32 dlbufaddr;
+ u32 dlbufaddr;
int nburns;
- UINT32 burnlen;
- UINT32 burndaddr;
- UINT16 burnlo;
- UINT16 burnhi;
+ u32 burnlen;
+ u32 burndaddr;
+ u16 burnlo;
+ u16 burnhi;
int nwrites;
- UINT8 *writebuf;
- UINT16 writepage;
- UINT16 writeoffset;
- UINT32 writelen;
+ u8 *writebuf;
+ u16 writepage;
+ u16 writeoffset;
+ u32 writelen;
int i;
int j;
- DBFENTER;
WLAN_LOG_DEBUG(5,"daddr=0x%08x len=%d\n", daddr, len);
/* Check that we're in the flash download state */
return -EINVAL;
}
- WLAN_LOG_INFO("Download %d bytes to flash @0x%06x\n", len, daddr);
+ printk(KERN_INFO "Download %d bytes to flash @0x%06x\n", len, daddr);
/* Convert to flat address for arithmetic */
/* NOTE: dlbuffer RID stores the address in AUX format */
hw->bufinfo.page, hw->bufinfo.offset, dlbufaddr);
#if 0
-WLAN_LOG_WARNING("dlbuf@0x%06lx len=%d to=%d\n", dlbufaddr, hw->bufinfo.len, hw->dltimeout);
+printk(KERN_WARNING "dlbuf@0x%06lx len=%d to=%d\n", dlbufaddr, hw->bufinfo.len, hw->dltimeout);
#endif
/* Calculations to determine how many fills of the dlbuffer to do
* and how many USB wmemreq's to do for each fill. At this point
burnlo = HFA384x_ADDR_CMD_MKOFF(burndaddr);
burnhi = HFA384x_ADDR_CMD_MKPAGE(burndaddr);
- WLAN_LOG_INFO("Writing %d bytes to flash @0x%06x\n",
+ printk(KERN_INFO "Writing %d bytes to flash @0x%06x\n",
burnlen, burndaddr);
/* Set the download mode */
result = hfa384x_cmd_download(hw, HFA384x_PROGMODE_NV,
burnlo, burnhi, burnlen);
if ( result ) {
- WLAN_LOG_ERROR("download(NV,lo=%x,hi=%x,len=%x) "
+ printk(KERN_ERR "download(NV,lo=%x,hi=%x,len=%x) "
"cmd failed, result=%d. Aborting d/l\n",
burnlo, burnhi, burnlen, result);
goto exit_proc;
Comment out for debugging, assume the write was successful.
if (result) {
- WLAN_LOG_ERROR(
+ printk(KERN_ERR
"Write to dl buffer failed, "
"result=0x%04x. Aborting.\n",
result);
HFA384x_PROGMODE_NVWRITE,
0,0,0);
if ( result ) {
- WLAN_LOG_ERROR(
+ printk(KERN_ERR
"download(NVWRITE,lo=%x,hi=%x,len=%x) "
"cmd failed, result=%d. Aborting d/l\n",
burnlo, burnhi, burnlen, result);
/* actually disable programming mode. Remember, that will cause the */
/* the firmware to effectively reset itself. */
- DBFEXIT;
return result;
}
* Call context:
* process
----------------------------------------------------------------*/
-int hfa384x_drvr_getconfig(hfa384x_t *hw, UINT16 rid, void *buf, UINT16 len)
+int hfa384x_drvr_getconfig(hfa384x_t *hw, u16 rid, void *buf, u16 len)
{
int result;
- DBFENTER;
result = hfa384x_dorrid_wait(hw, rid, buf, len);
- DBFEXIT;
return result;
}
int
hfa384x_drvr_getconfig_async(
hfa384x_t *hw,
- UINT16 rid,
+ u16 rid,
ctlx_usercb_t usercb,
void *usercb_data)
{
int
hfa384x_drvr_setconfig_async(
hfa384x_t *hw,
- UINT16 rid,
+ u16 rid,
void *buf,
- UINT16 len,
+ u16 len,
ctlx_usercb_t usercb,
void *usercb_data)
{
* Call context:
* process
----------------------------------------------------------------*/
-int hfa384x_drvr_handover( hfa384x_t *hw, UINT8 *addr)
+int hfa384x_drvr_handover( hfa384x_t *hw, u8 *addr)
{
- DBFENTER;
- WLAN_LOG_ERROR("Not currently supported in USB!\n");
- DBFEXIT;
+ printk(KERN_ERR "Not currently supported in USB!\n");
return -EIO;
}
int hfa384x_drvr_low_level(hfa384x_t *hw, hfa384x_metacmd_t *cmd)
{
int result;
- DBFENTER;
/* Do i need a host2hfa... conversion ? */
result = hfa384x_docmd_wait(hw, cmd);
- DBFEXIT;
return result;
}
-/*----------------------------------------------------------------
-* hfa384x_drvr_mmi_read
-*
-* Read mmi registers. mmi is intersil-speak for the baseband
-* processor registers.
-*
-* Arguments:
-* hw device structure
-* register The test register to be accessed (must be even #).
-*
-* Returns:
-* 0 success
-* >0 f/w reported error - f/w status code
-* <0 driver reported error
-*
-* Side effects:
-*
-* Call context:
-* process
-----------------------------------------------------------------*/
-int hfa384x_drvr_mmi_read(hfa384x_t *hw, UINT32 addr, UINT32 *resp)
-{
-#if 0
- int result = 0;
- UINT16 cmd_code = (UINT16) 0x30;
- UINT16 param = (UINT16) addr;
- DBFENTER;
-
- /* Do i need a host2hfa... conversion ? */
- result = hfa384x_docmd_wait(hw, cmd_code);
-
- DBFEXIT;
- return result;
-#endif
-return 0;
-}
-
-/*----------------------------------------------------------------
-* hfa384x_drvr_mmi_write
-*
-* Read mmi registers. mmi is intersil-speak for the baseband
-* processor registers.
-*
-* Arguments:
-* hw device structure
-* addr The test register to be accessed (must be even #).
-* data The data value to write to the register.
-*
-* Returns:
-* 0 success
-* >0 f/w reported error - f/w status code
-* <0 driver reported error
-*
-* Side effects:
-*
-* Call context:
-* process
-----------------------------------------------------------------*/
-
-int
-hfa384x_drvr_mmi_write(hfa384x_t *hw, UINT32 addr, UINT32 data)
-{
-#if 0
- int result = 0;
- UINT16 cmd_code = (UINT16) 0x31;
- UINT16 param0 = (UINT16) addr;
- UINT16 param1 = (UINT16) data;
- DBFENTER;
-
- WLAN_LOG_DEBUG(1,"mmi write : addr = 0x%08lx\n", addr);
- WLAN_LOG_DEBUG(1,"mmi write : data = 0x%08lx\n", data);
-
- /* Do i need a host2hfa... conversion ? */
- result = hfa384x_docmd_wait(hw, cmd_code);
-
- DBFEXIT;
- return result;
-#endif
-return 0;
-}
-
-
/*----------------------------------------------------------------
* hfa384x_drvr_ramdl_disable
*
int
hfa384x_drvr_ramdl_disable(hfa384x_t *hw)
{
- DBFENTER;
/* Check that we're already in the download state */
if ( hw->dlstate != HFA384x_DLSTATE_RAMENABLED ) {
return -EINVAL;
hfa384x_cmd_download(hw, HFA384x_PROGMODE_DISABLE, 0, 0 , 0);
hw->dlstate = HFA384x_DLSTATE_DISABLED;
- DBFEXIT;
return 0;
}
* process
----------------------------------------------------------------*/
int
-hfa384x_drvr_ramdl_enable(hfa384x_t *hw, UINT32 exeaddr)
+hfa384x_drvr_ramdl_enable(hfa384x_t *hw, u32 exeaddr)
{
int result = 0;
- UINT16 lowaddr;
- UINT16 hiaddr;
+ u16 lowaddr;
+ u16 hiaddr;
int i;
- DBFENTER;
+
/* Check that a port isn't active */
for ( i = 0; i < HFA384x_PORTID_MAX; i++) {
if ( hw->port_enabled[i] ) {
- WLAN_LOG_ERROR(
+ printk(KERN_ERR
"Can't download with a macport enabled.\n");
return -EINVAL;
}
/* Check that we're not already in a download state */
if ( hw->dlstate != HFA384x_DLSTATE_DISABLED ) {
- WLAN_LOG_ERROR(
+ printk(KERN_ERR
"Download state not disabled.\n");
return -EINVAL;
}
result);
}
- DBFEXIT;
return result;
}
* process
----------------------------------------------------------------*/
int
-hfa384x_drvr_ramdl_write(hfa384x_t *hw, UINT32 daddr, void* buf, UINT32 len)
+hfa384x_drvr_ramdl_write(hfa384x_t *hw, u32 daddr, void* buf, u32 len)
{
int result = 0;
int nwrites;
- UINT8 *data = buf;
+ u8 *data = buf;
int i;
- UINT32 curraddr;
- UINT16 currpage;
- UINT16 curroffset;
- UINT16 currlen;
- DBFENTER;
+ u32 curraddr;
+ u16 currpage;
+ u16 curroffset;
+ u16 currlen;
+
/* Check that we're in the ram download state */
if ( hw->dlstate != HFA384x_DLSTATE_RAMENABLED ) {
return -EINVAL;
}
- WLAN_LOG_INFO("Writing %d bytes to ram @0x%06x\n", len, daddr);
+ printk(KERN_INFO "Writing %d bytes to ram @0x%06x\n", len, daddr);
/* How many dowmem calls? */
nwrites = len / HFA384x_USB_RWMEM_MAXLEN;
/* TODO: We really should have a readback. */
}
- DBFEXIT;
return result;
}
* Call context:
* process or non-card interrupt.
----------------------------------------------------------------*/
-int hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, UINT len)
+int hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, unsigned int len)
{
int result = 0;
- UINT16 *pda = buf;
+ u16 *pda = buf;
int pdaok = 0;
int morepdrs = 1;
int currpdr = 0; /* word offset of the current pdr */
size_t i;
- UINT16 pdrlen; /* pdr length in bytes, host order */
- UINT16 pdrcode; /* pdr code, host order */
- UINT16 currpage;
- UINT16 curroffset;
+ u16 pdrlen; /* pdr length in bytes, host order */
+ u16 pdrcode; /* pdr code, host order */
+ u16 currpage;
+ u16 curroffset;
struct pdaloc {
- UINT32 cardaddr;
- UINT16 auxctl;
+ u32 cardaddr;
+ u16 auxctl;
} pdaloc[] =
{
{ HFA3842_PDA_BASE, 0},
{ HFA3841_PDA_BOGUS_BASE, 0}
};
- DBFENTER;
-
/* Read the pda from each known address. */
for ( i = 0; i < ARRAY_SIZE(pdaloc); i++) {
/* Make address */
len); /* units of bytes */
if (result) {
- WLAN_LOG_WARNING(
+ printk(KERN_WARNING
"Read from index %zd failed, continuing\n",
i );
continue;
pdrcode = hfa384x2host_16(pda[currpdr+1]);
/* Test the record length */
if ( pdrlen > HFA384x_PDR_LEN_MAX || pdrlen == 0) {
- WLAN_LOG_ERROR("pdrlen invalid=%d\n",
+ printk(KERN_ERR "pdrlen invalid=%d\n",
pdrlen);
pdaok = 0;
break;
}
/* Test the code */
if ( !hfa384x_isgood_pdrcode(pdrcode) ) {
- WLAN_LOG_ERROR("pdrcode invalid=%d\n",
+ printk(KERN_ERR "pdrcode invalid=%d\n",
pdrcode);
pdaok = 0;
break;
}
}
if ( pdaok ) {
- WLAN_LOG_INFO(
+ printk(KERN_INFO
"PDA Read from 0x%08x in %s space.\n",
pdaloc[i].cardaddr,
pdaloc[i].auxctl == 0 ? "EXTDS" :
WLAN_LOG_DEBUG(3,"Failure: pda is not okay\n");
}
- DBFEXIT;
return result;
}
* Call context:
* process
----------------------------------------------------------------*/
-int hfa384x_drvr_setconfig(hfa384x_t *hw, UINT16 rid, void *buf, UINT16 len)
+int hfa384x_drvr_setconfig(hfa384x_t *hw, u16 rid, void *buf, u16 len)
{
return hfa384x_dowrid_wait(hw, rid, buf, len);
}
* Call context:
* process
----------------------------------------------------------------*/
+
int hfa384x_drvr_start(hfa384x_t *hw)
{
- int result;
- DBFENTER;
+ int result, result1, result2;
+ u16 status;
might_sleep();
- if (usb_clear_halt(hw->usb, hw->endp_in)) {
- WLAN_LOG_ERROR(
+ /* Clear endpoint stalls - but only do this if the endpoint
+ * is showing a stall status. Some prism2 cards seem to behave
+ * badly if a clear_halt is called when the endpoint is already
+ * ok
+ */
+ result = usb_get_status(hw->usb, USB_RECIP_ENDPOINT, hw->endp_in, &status);
+ if (result < 0) {
+ printk(KERN_ERR
+ "Cannot get bulk in endpoint status.\n");
+ goto done;
+ }
+ if ((status == 1) && usb_clear_halt(hw->usb, hw->endp_in)) {
+ printk(KERN_ERR
"Failed to reset bulk in endpoint.\n");
}
- if (usb_clear_halt(hw->usb, hw->endp_out)) {
- WLAN_LOG_ERROR(
+ result = usb_get_status(hw->usb, USB_RECIP_ENDPOINT, hw->endp_out, &status);
+ if (result < 0) {
+ printk(KERN_ERR
+ "Cannot get bulk out endpoint status.\n");
+ goto done;
+ }
+ if ((status == 1) && usb_clear_halt(hw->usb, hw->endp_out)) {
+ printk(KERN_ERR
"Failed to reset bulk out endpoint.\n");
}
/* Post the IN urb */
result = submit_rx_urb(hw, GFP_KERNEL);
if (result != 0) {
- WLAN_LOG_ERROR(
+ printk(KERN_ERR
"Fatal, failed to submit RX URB, result=%d\n",
result);
goto done;
}
- /* call initialize */
- result = hfa384x_cmd_initialize(hw);
- if (result != 0) {
- usb_kill_urb(&hw->rx_urb);
- WLAN_LOG_ERROR(
- "cmd_initialize() failed, result=%d\n",
- result);
- goto done;
+ /* Call initialize twice, with a 1 second sleep in between.
+ * This is a nasty work-around since many prism2 cards seem to
+ * need time to settle after an init from cold. The second
+ * call to initialize in theory is not necessary - but we call
+ * it anyway as a double insurance policy:
+ * 1) If the first init should fail, the second may well succeed
+ * and the card can still be used
+ * 2) It helps ensures all is well with the card after the first
+ * init and settle time.
+ */
+ result1 = hfa384x_cmd_initialize(hw);
+ msleep(1000);
+ result = result2 = hfa384x_cmd_initialize(hw);
+ if (result1 != 0) {
+ if (result2 != 0) {
+ printk(KERN_ERR
+ "cmd_initialize() failed on two attempts, results %d and %d\n",
+ result1, result2);
+ usb_kill_urb(&hw->rx_urb);
+ goto done;
+ } else {
+ WLAN_LOG_DEBUG(0, "First cmd_initialize() failed (result %d),\n",
+ result1);
+ WLAN_LOG_DEBUG(0, "but second attempt succeeded. All should be ok\n");
+ }
+ } else if (result2 != 0) {
+ printk(KERN_WARNING
+ "First cmd_initialize() succeeded, but second attempt failed (result=%d)\n",
+ result2);
+ printk(KERN_WARNING "Most likely the card will be functional\n");
+ goto done;
}
hw->state = HFA384x_STATE_RUNNING;
done:
- DBFEXIT;
return result;
}
{
int result = 0;
int i;
- DBFENTER;
might_sleep();
hw->port_enabled[i] = 0;
}
- DBFEXIT;
return result;
}
int ret;
char *ptr;
- DBFENTER;
-
if (hw->tx_urb.status == -EINPROGRESS) {
- WLAN_LOG_WARNING("TX URB already in use\n");
+ printk(KERN_WARNING "TX URB already in use\n");
result = 3;
goto exit;
}
result = 1;
ret = submit_tx_urb(hw, &hw->tx_urb, GFP_ATOMIC);
if ( ret != 0 ) {
- WLAN_LOG_ERROR(
+ printk(KERN_ERR
"submit_tx_urb() failed, error=%d\n", ret);
result = 3;
}
exit:
- DBFEXIT;
return result;
}
hfa384x_t *hw = wlandev->priv;
unsigned long flags;
- DBFENTER;
-
spin_lock_irqsave(&hw->ctlxq.lock, flags);
if ( !hw->wlandev->hwremoved &&
}
spin_unlock_irqrestore(&hw->ctlxq.lock, flags);
-
- DBFEXIT;
}
/*----------------------------------------------------------------
struct list_head *temp;
unsigned long flags;
- DBFENTER;
-
spin_lock_irqsave(&hw->ctlxq.lock, flags);
/* This list is guaranteed to be empty if someone
spin_unlock_irqrestore(&hw->ctlxq.lock, flags);
- DBFEXIT;
}
/*----------------------------------------------------------------
int reap = 0;
- DBFENTER;
-
spin_lock_irqsave(&hw->ctlxq.lock, flags);
/* This list is guaranteed to be empty if someone
if (reap)
tasklet_schedule(&hw->reaper_bh);
-
- DBFEXIT;
}
/*----------------------------------------------------------------
{
int ret;
- DBFENTER;
-
/*
* Try to delete the URB containing our request packet.
* If we succeed, then its completion handler will be
ret = 0;
}
- DBFEXIT;
-
return ret;
}
----------------------------------------------------------------*/
static void unlocked_usbctlx_complete(hfa384x_t *hw, hfa384x_usbctlx_t *ctlx)
{
- DBFENTER;
-
/* Timers have been stopped, and ctlx should be in
* a terminal state. Retire it from the "active"
* queue.
break;
default:
- WLAN_LOG_ERROR("CTLX[%d] not in a terminating state(%s)\n",
+ printk(KERN_ERR "CTLX[%d] not in a terminating state(%s)\n",
hfa384x2host_16(ctlx->outbuf.type),
ctlxstr(ctlx->state));
break;
} /* switch */
-
- DBFEXIT;
}
/*----------------------------------------------------------------
hfa384x_usbctlxq_run(hfa384x_t *hw)
{
unsigned long flags;
- DBFENTER;
/* acquire lock */
spin_lock_irqsave(&hw->ctlxq.lock, flags);
* this CTLX back in the "pending" queue
* and schedule a reset ...
*/
- WLAN_LOG_WARNING("%s tx pipe stalled: requesting reset\n",
+ printk(KERN_WARNING "%s tx pipe stalled: requesting reset\n",
hw->wlandev->netdev->name);
list_move(&head->list, &hw->ctlxq.pending);
set_bit(WORK_TX_HALT, &hw->usb_flags);
}
if (result == -ESHUTDOWN) {
- WLAN_LOG_WARNING("%s urb shutdown!\n",
+ printk(KERN_WARNING "%s urb shutdown!\n",
hw->wlandev->netdev->name);
break;
}
- WLAN_LOG_ERROR("Failed to submit CTLX[%d]: error=%d\n",
+ printk(KERN_ERR "Failed to submit CTLX[%d]: error=%d\n",
hfa384x2host_16(head->outbuf.type), result);
unlocked_usbctlx_complete(hw, head);
} /* while */
unlock:
spin_unlock_irqrestore(&hw->ctlxq.lock, flags);
-
- DBFEXIT;
}
* Call context:
* interrupt
----------------------------------------------------------------*/
-#ifdef URB_ONLY_CALLBACK
static void hfa384x_usbin_callback(struct urb *urb)
-#else
-static void hfa384x_usbin_callback(struct urb *urb, struct pt_regs *regs)
-#endif
{
wlandevice_t *wlandev = urb->context;
hfa384x_t *hw;
struct sk_buff *skb = NULL;
int result;
int urb_status;
- UINT16 type;
+ u16 type;
enum USBIN_ACTION {
HANDLE,
ABORT
} action;
- DBFENTER;
-
if ( !wlandev ||
!wlandev->netdev ||
- !netif_device_present(wlandev->netdev) )
+ wlandev->hwremoved )
goto exit;
hw = wlandev->priv;
break;
case -EPIPE:
- WLAN_LOG_WARNING("%s rx pipe stalled: requesting reset\n",
+ printk(KERN_WARNING "%s rx pipe stalled: requesting reset\n",
wlandev->netdev->name);
if ( !test_and_set_bit(WORK_RX_HALT, &hw->usb_flags) )
schedule_work(&hw->usb_work);
result = submit_rx_urb(hw, GFP_ATOMIC);
if (result != 0) {
- WLAN_LOG_ERROR(
+ printk(KERN_ERR
"Fatal, failed to resubmit rx_urb. error=%d\n",
result);
}
if (skb)
dev_kfree_skb(skb);
-
- DBFEXIT;
}
int run_queue = 0;
unsigned long flags;
- DBFENTER;
-
retry:
spin_lock_irqsave(&hw->ctlxq.lock, flags);
if (unlocked_usbctlx_cancel_async(hw, ctlx) == 0)
run_queue = 1;
} else {
- const UINT16 intype = (usbin->type&~host2hfa384x_16(0x8000));
+ const u16 intype = (usbin->type&~host2hfa384x_16(0x8000));
/*
* Check that our message is what we're expecting ...
*/
if (ctlx->outbuf.type != intype) {
- WLAN_LOG_WARNING("Expected IN[%d], received IN[%d] - ignored.\n",
+ printk(KERN_WARNING "Expected IN[%d], received IN[%d] - ignored.\n",
hfa384x2host_16(ctlx->outbuf.type),
hfa384x2host_16(intype));
goto unlock;
/*
* Throw this CTLX away ...
*/
- WLAN_LOG_ERROR("Matched IN URB, CTLX[%d] in invalid state(%s)."
+ printk(KERN_ERR "Matched IN URB, CTLX[%d] in invalid state(%s)."
" Discarded.\n",
hfa384x2host_16(ctlx->outbuf.type),
ctlxstr(ctlx->state));
if (run_queue)
hfa384x_usbctlxq_run(hw);
-
- DBFEXIT;
}
----------------------------------------------------------------*/
static void hfa384x_usbin_txcompl(wlandevice_t *wlandev, hfa384x_usbin_t *usbin)
{
- UINT16 status;
- DBFENTER;
+ u16 status;
status = hfa384x2host_16(usbin->type); /* yeah I know it says type...*/
prism2sta_ev_tx(wlandev, status);
}
// prism2sta_ev_alloc(wlandev);
-
- DBFEXIT;
}
hfa384x_t *hw = wlandev->priv;
int hdrlen;
p80211_rxmeta_t *rxmeta;
- UINT16 data_len;
- UINT16 fc;
-
- DBFENTER;
+ u16 data_len;
+ u16 fc;
/* Byte order convert once up front. */
usbin->rxfrm.desc.status =
switch( HFA384x_RXSTATUS_MACPORT_GET(usbin->rxfrm.desc.status) )
{
case 0:
- fc = ieee2host16(usbin->rxfrm.desc.frame_control);
+ fc = le16_to_cpu(usbin->rxfrm.desc.frame_control);
/* If exclude and we receive an unencrypted, drop it */
if ( (wlandev->hostwep & HOSTWEP_EXCLUDEUNENCRYPTED) &&
break;
default:
- WLAN_LOG_WARNING("Received frame on unsupported port=%d\n",
+ printk(KERN_WARNING "Received frame on unsupported port=%d\n",
HFA384x_RXSTATUS_MACPORT_GET(usbin->rxfrm.desc.status) );
goto done;
break;
}
done:
- DBFEXIT;
return;
}
static void hfa384x_int_rxmonitor( wlandevice_t *wlandev, hfa384x_usb_rxfrm_t *rxfrm)
{
hfa384x_rx_frame_t *rxdesc = &(rxfrm->desc);
- UINT hdrlen = 0;
- UINT datalen = 0;
- UINT skblen = 0;
- p80211msg_lnxind_wlansniffrm_t *msg;
- UINT8 *datap;
- UINT16 fc;
+ unsigned int hdrlen = 0;
+ unsigned int datalen = 0;
+ unsigned int skblen = 0;
+ u8 *datap;
+ u16 fc;
struct sk_buff *skb;
hfa384x_t *hw = wlandev->priv;
-
- DBFENTER;
/* Don't forget the status, time, and data_len fields are in host order */
/* Figure out how big the frame is */
- fc = ieee2host16(rxdesc->frame_control);
+ fc = le16_to_cpu(rxdesc->frame_control);
hdrlen = p80211_headerlen(fc);
datalen = hfa384x2host_16(rxdesc->data_len);
/* Allocate an ind message+framesize skb */
- skblen = sizeof(p80211msg_lnxind_wlansniffrm_t) +
+ skblen = sizeof(p80211_caphdr_t) +
hdrlen + datalen + WLAN_CRC_LEN;
/* sanity check the length */
if ( skblen >
- (sizeof(p80211msg_lnxind_wlansniffrm_t) +
- WLAN_HDR_A4_LEN + WLAN_DATA_MAXLEN + WLAN_CRC_LEN) ) {
+ (sizeof(p80211_caphdr_t) +
+ WLAN_HDR_A4_LEN + WLAN_DATA_MAXLEN + WLAN_CRC_LEN) ) {
WLAN_LOG_DEBUG(1, "overlen frm: len=%zd\n",
- skblen - sizeof(p80211msg_lnxind_wlansniffrm_t));
+ skblen - sizeof(p80211_caphdr_t));
}
if ( (skb = dev_alloc_skb(skblen)) == NULL ) {
- WLAN_LOG_ERROR("alloc_skb failed trying to allocate %d bytes\n", skblen);
+ printk(KERN_ERR "alloc_skb failed trying to allocate %d bytes\n", skblen);
return;
}
/* only prepend the prism header if in the right mode */
if ((wlandev->netdev->type == ARPHRD_IEEE80211_PRISM) &&
- (hw->sniffhdr == 0)) {
- datap = skb_put(skb, sizeof(p80211msg_lnxind_wlansniffrm_t));
- msg = (p80211msg_lnxind_wlansniffrm_t*) datap;
-
- /* Initialize the message members */
- msg->msgcode = DIDmsg_lnxind_wlansniffrm;
- msg->msglen = sizeof(p80211msg_lnxind_wlansniffrm_t);
- strcpy(msg->devname, wlandev->name);
-
- msg->hosttime.did = DIDmsg_lnxind_wlansniffrm_hosttime;
- msg->hosttime.status = 0;
- msg->hosttime.len = 4;
- msg->hosttime.data = jiffies;
-
- msg->mactime.did = DIDmsg_lnxind_wlansniffrm_mactime;
- msg->mactime.status = 0;
- msg->mactime.len = 4;
- msg->mactime.data = rxdesc->time;
-
- msg->channel.did = DIDmsg_lnxind_wlansniffrm_channel;
- msg->channel.status = 0;
- msg->channel.len = 4;
- msg->channel.data = hw->sniff_channel;
-
- msg->rssi.did = DIDmsg_lnxind_wlansniffrm_rssi;
- msg->rssi.status = P80211ENUM_msgitem_status_no_value;
- msg->rssi.len = 4;
- msg->rssi.data = 0;
-
- msg->sq.did = DIDmsg_lnxind_wlansniffrm_sq;
- msg->sq.status = P80211ENUM_msgitem_status_no_value;
- msg->sq.len = 4;
- msg->sq.data = 0;
-
- msg->signal.did = DIDmsg_lnxind_wlansniffrm_signal;
- msg->signal.status = 0;
- msg->signal.len = 4;
- msg->signal.data = rxdesc->signal;
-
- msg->noise.did = DIDmsg_lnxind_wlansniffrm_noise;
- msg->noise.status = 0;
- msg->noise.len = 4;
- msg->noise.data = rxdesc->silence;
-
- msg->rate.did = DIDmsg_lnxind_wlansniffrm_rate;
- msg->rate.status = 0;
- msg->rate.len = 4;
- msg->rate.data = rxdesc->rate / 5; /* set to 802.11 units */
-
- msg->istx.did = DIDmsg_lnxind_wlansniffrm_istx;
- msg->istx.status = 0;
- msg->istx.len = 4;
- msg->istx.data = P80211ENUM_truth_false;
-
- msg->frmlen.did = DIDmsg_lnxind_wlansniffrm_frmlen;
- msg->frmlen.status = 0;
- msg->frmlen.len = 4;
- msg->frmlen.data = hdrlen + datalen + WLAN_CRC_LEN;
- } else if ((wlandev->netdev->type == ARPHRD_IEEE80211_PRISM) &&
- (hw->sniffhdr != 0)) {
+ (hw->sniffhdr != 0)) {
p80211_caphdr_t *caphdr;
/* The NEW header format! */
datap = skb_put(skb, sizeof(p80211_caphdr_t));
/* pass it back up */
prism2sta_ev_rx(wlandev, skb);
- DBFEXIT;
return;
}
----------------------------------------------------------------*/
static void hfa384x_usbin_info(wlandevice_t *wlandev, hfa384x_usbin_t *usbin)
{
- DBFENTER;
-
usbin->infofrm.info.framelen = hfa384x2host_16(usbin->infofrm.info.framelen);
prism2sta_ev_info(wlandev, &usbin->infofrm.info);
-
- DBFEXIT;
}
* Call context:
* interrupt
----------------------------------------------------------------*/
-#ifdef URB_ONLY_CALLBACK
static void hfa384x_usbout_callback(struct urb *urb)
-#else
-static void hfa384x_usbout_callback(struct urb *urb, struct pt_regs *regs)
-#endif
{
wlandevice_t *wlandev = urb->context;
hfa384x_usbout_t *usbout = urb->transfer_buffer;
- DBFENTER;
#ifdef DEBUG_USB
dbprint_urb(urb);
case -EPIPE:
{
hfa384x_t *hw = wlandev->priv;
- WLAN_LOG_WARNING("%s tx pipe stalled: requesting reset\n",
+ printk(KERN_WARNING "%s tx pipe stalled: requesting reset\n",
wlandev->netdev->name);
if ( !test_and_set_bit(WORK_TX_HALT, &hw->usb_flags) )
schedule_work(&hw->usb_work);
break;
default:
- WLAN_LOG_INFO("unknown urb->status=%d\n", urb->status);
+ printk(KERN_INFO "unknown urb->status=%d\n", urb->status);
++(wlandev->linux_stats.tx_errors);
break;
} /* switch */
}
-
- DBFEXIT;
}
* Call context:
* interrupt
----------------------------------------------------------------*/
-#ifdef URB_ONLY_CALLBACK
static void hfa384x_ctlxout_callback(struct urb *urb)
-#else
-static void hfa384x_ctlxout_callback(struct urb *urb, struct pt_regs *regs)
-#endif
{
hfa384x_t *hw = urb->context;
int delete_resptimer = 0;
hfa384x_usbctlx_t *ctlx;
unsigned long flags;
- DBFENTER;
-
WLAN_LOG_DEBUG(3,"urb->status=%d\n", urb->status);
#ifdef DEBUG_USB
dbprint_urb(urb);
default:
/* This is NOT a valid CTLX "success" state! */
- WLAN_LOG_ERROR(
+ printk(KERN_ERR
"Illegal CTLX[%d] success state(%s, %d) in OUT URB\n",
hfa384x2host_16(ctlx->outbuf.type),
ctlxstr(ctlx->state), urb->status);
/* If the pipe has stalled then we need to reset it */
if ( (urb->status == -EPIPE) &&
!test_and_set_bit(WORK_TX_HALT, &hw->usb_flags) ) {
- WLAN_LOG_WARNING("%s tx pipe stalled: requesting reset\n",
+ printk(KERN_WARNING "%s tx pipe stalled: requesting reset\n",
hw->wlandev->netdev->name);
schedule_work(&hw->usb_work);
}
hfa384x_usbctlxq_run(hw);
done:
- DBFEXIT;
+ ;
}
{
hfa384x_t *hw = (hfa384x_t*)data;
unsigned long flags;
- DBFENTER;
spin_lock_irqsave(&hw->ctlxq.lock, flags);
}
spin_unlock_irqrestore(&hw->ctlxq.lock, flags);
-
- DBFEXIT;
}
hfa384x_t *hw = (hfa384x_t*)data;
unsigned long flags;
- DBFENTER;
-
spin_lock_irqsave(&hw->ctlxq.lock, flags);
hw->resp_timer_done = 1;
spin_unlock_irqrestore(&hw->ctlxq.lock, flags);
done:
- DBFEXIT;
+ ;
+
}
/*----------------------------------------------------------------
hfa384x_t *hw = (hfa384x_t*)data;
unsigned long flags;
- DBFENTER;
-
spin_lock_irqsave(&hw->ctlxq.lock, flags);
/*
}
spin_unlock_irqrestore(&hw->ctlxq.lock, flags);
-
- DBFEXIT;
}
unsigned long flags;
int ret;
- DBFENTER;
-
spin_lock_irqsave(&hw->ctlxq.lock, flags);
if (hw->wlandev->hwremoved) {
ret = 0;
}
- DBFEXIT;
return ret;
}
----------------------------------------------------------------*/
static void hfa384x_usbout_tx(wlandevice_t *wlandev, hfa384x_usbout_t *usbout)
{
- DBFENTER;
-
prism2sta_ev_alloc(wlandev);
-
- DBFEXIT;
}
/*----------------------------------------------------------------
* Call context:
----------------------------------------------------------------*/
static int
-hfa384x_isgood_pdrcode(UINT16 pdrcode)
+hfa384x_isgood_pdrcode(u16 pdrcode)
{
switch(pdrcode) {
case HFA384x_PDR_END_OF_PDA: