Exemplo n.º 1
0
/** 
 * @brief  Call back function to handle the status of the Tx data URB
 *
 * @param urb      Pointer to urb structure
 *
 * @return         N/A
 */
static void
woal_usb_tx_complete(struct urb *urb)
#endif
{
    urb_context *context = (urb_context *) (urb->context);
    moal_handle *handle = context->handle;
    struct usb_card_rec *cardp = handle->card;

    ENTER();

    /* Decrease pending URB counter */
    if (context->ep == cardp->tx_data_ep)
        atomic_dec(&cardp->tx_data_urb_pending);
    if (context->ep == cardp->tx_cmd_ep)
        atomic_dec(&cardp->tx_cmd_urb_pending);
    /* Handle the transmission complete validations */
    if (urb->status) {
        PRINTM(ERROR, "Tx data URB in failure status: %d\n", urb->status);
        mlan_write_data_async_complete(handle->pmlan_adapter, context->pmbuf,
                                       context->ep, MLAN_STATUS_FAILURE);
    } else {
        mlan_write_data_async_complete(handle->pmlan_adapter, context->pmbuf,
                                       context->ep, MLAN_STATUS_SUCCESS);
    }
    mlan_main_process(handle->pmlan_adapter);

    LEAVE();
    return;
}
Exemplo n.º 2
0
/**
 *  @brief This function will resend addba request to all 
 *          the peer in the TxBAStreamTbl 
 *  
 *  @param priv     A pointer to mlan_private
 *
 *  @return         N/A	       
 */
void
wlan_11n_update_addba_request(mlan_private * priv)
{

    TxBAStreamTbl *ptx_tbl;

    ENTER();

    if (!
        (ptx_tbl =
         (TxBAStreamTbl *) util_peek_list(priv->adapter->pmoal_handle,
                                          &priv->tx_ba_stream_tbl_ptr,
                                          priv->adapter->callbacks.
                                          moal_spin_lock,
                                          priv->adapter->callbacks.
                                          moal_spin_unlock))) {
        LEAVE();
        return;
    }

    while (ptx_tbl != (TxBAStreamTbl *) & priv->tx_ba_stream_tbl_ptr) {
        wlan_send_addba(priv, ptx_tbl->tid, ptx_tbl->ra);
        ptx_tbl = ptx_tbl->pnext;
    }

    mlan_main_process(priv->adapter);
    LEAVE();
    return;
}
/**
 *  @brief  This function initializes firmware
 *
 *  @param pmadapter		A pointer to mlan_adapter
 *
 *  @return		MLAN_STATUS_SUCCESS, MLAN_STATUS_PENDING or MLAN_STATUS_FAILURE
 */
mlan_status
wlan_init_fw(IN pmlan_adapter pmadapter)
{
	mlan_status ret = MLAN_STATUS_SUCCESS;
	pmlan_private priv = MNULL;
	t_u8 i = 0;

	ENTER();

	/* Initialize adapter structure */
	wlan_init_adapter(pmadapter);

	for (i = 0; i < pmadapter->priv_num; i++) {
		if (pmadapter->priv[i]) {
			priv = pmadapter->priv[i];

			/* Initialize private structure */
			ret = wlan_init_priv(priv);
			if (ret) {
				ret = MLAN_STATUS_FAILURE;
				goto done;
			}
		}
	}
#ifdef MFG_CMD_SUPPORT
	if (pmadapter->mfg_mode != MTRUE) {
#endif
		/* Issue firmware initialize commands for first BSS, for other
		   interfaces it will be called after getting the last init
		   command response of previous interface */
		priv = wlan_get_priv(pmadapter, MLAN_BSS_ROLE_ANY);
		ret = priv->ops.init_cmd(priv, MTRUE);
		if (ret == MLAN_STATUS_FAILURE)
			goto done;
#ifdef MFG_CMD_SUPPORT
	}
#endif

	if (util_peek_list(pmadapter->pmoal_handle, &pmadapter->cmd_pending_q,
			   pmadapter->callbacks.moal_spin_lock,
			   pmadapter->callbacks.moal_spin_unlock)) {
		/* Send the first command in queue and return */
		if (mlan_main_process(pmadapter) == MLAN_STATUS_FAILURE)
			ret = MLAN_STATUS_FAILURE;
		else
			ret = MLAN_STATUS_PENDING;
	} else {
		pmadapter->hw_status = WlanHardwareStatusReady;
	}
done:
	LEAVE();
	return ret;
}
/**
 *  @brief  This function initializes firmware
 *
 *  @param pmadapter		A pointer to mlan_adapter
 *
 *  @return		MLAN_STATUS_SUCCESS or error code
 */
mlan_status
wlan_init_fw(IN pmlan_adapter pmadapter)
{
    mlan_status ret = MLAN_STATUS_SUCCESS;
    pmlan_private priv;
    t_s32 i = 0;

    ENTER();

    /* Allocate adapter structure */
    ret = wlan_allocate_adapter(pmadapter);
    if (ret) {
        ret = MLAN_STATUS_FAILURE;
        goto done;
    }

    /* Initialize adapter structure */
    wlan_init_adapter(pmadapter);

    for (i = 0; i < MLAN_MAX_BSS_NUM; i++) {
        if (pmadapter->priv[i]) {
            priv = pmadapter->priv[i];

            /* Initialize private structure */
            wlan_init_priv(priv);

            if ((ret = wlan_add_bsspriotbl(pmadapter, i))) {
                ret = MLAN_STATUS_FAILURE;
                goto done;
            }
        }
    }
#ifdef MFG_CMD_SUPPORT
    if (pmadapter->mfgmode != MTRUE)
#endif
        ret = wlan_init_cmd(pmadapter);
#ifdef MFG_CMD_SUPPORT
    if (pmadapter->mfgmode == MTRUE) {
        pmadapter->hw_status = WlanHardwareStatusReady;
        goto done;
    }
#endif

    /* Send the first command in queue and return */
    if (mlan_main_process(pmadapter) == MLAN_STATUS_FAILURE)
        ret = MLAN_STATUS_FAILURE;
    else
        ret = MLAN_STATUS_PENDING;

done:
    LEAVE();
    return ret;
}
/**
 *  @brief  This function initializes firmware
 *
 *  @param pmadapter		A pointer to mlan_adapter
 *
 *  @return		MLAN_STATUS_SUCCESS or error code
 */
mlan_status
wlan_init_fw(IN pmlan_adapter pmadapter)
{
    mlan_status ret = MLAN_STATUS_SUCCESS;
    pmlan_private priv = MNULL;
    t_s32 i = 0;
    t_u8 first_sta = MTRUE;

    ENTER();

    /* Allocate memory for member of adapter structure */
    ret = wlan_allocate_adapter(pmadapter);
    if (ret) {
        ret = MLAN_STATUS_FAILURE;
        goto done;
    }

    /* Initialize adapter structure */
    wlan_init_adapter(pmadapter);

    for (i = 0; i < MLAN_MAX_BSS_NUM; i++) {
        if (pmadapter->priv[i]) {
            priv = pmadapter->priv[i];

            /* Initialize private structure */
            wlan_init_priv(priv);

            if ((ret = wlan_add_bsspriotbl(pmadapter, i))) {
                ret = MLAN_STATUS_FAILURE;
                goto done;
            }
        }
    }
#ifdef MFG_CMD_SUPPORT
    if (pmadapter->mfg_mode != MTRUE) {
#endif
        for (i = 0; i < MLAN_MAX_BSS_NUM; i++) {
            if (pmadapter->priv[i]) {
                ret =
                    pmadapter->priv[i]->ops.init_cmd(pmadapter->priv[i],
                                                     first_sta);
                if (ret == MLAN_STATUS_FAILURE)
                    goto done;
                first_sta = MFALSE;
            }
        }
#ifdef MFG_CMD_SUPPORT
    }
#endif

    if (util_peek_list(&pmadapter->cmd_pending_q,
                       pmadapter->callbacks.moal_spin_lock,
                       pmadapter->callbacks.moal_spin_unlock)) {
        /* Send the first command in queue and return */
        if (mlan_main_process(pmadapter) == MLAN_STATUS_FAILURE)
	    ret = MLAN_STATUS_FAILURE;
	else
            ret = MLAN_STATUS_PENDING;
    } else {
        pmadapter->hw_status = WlanHardwareStatusReady;
    }
  done:
    LEAVE();
    return ret;
}
Exemplo n.º 6
0
/**
 * @brief This function receive packet of the data/cmd/event packet
 *         and pass to MLAN 
 *
 *  @param urb		Pointer to struct urb
 *
 *  @return 	   	N/A
 */
static void
woal_usb_receive(struct urb *urb)
#endif
{
    urb_context *context = (urb_context *) urb->context;
    moal_handle *handle = context->handle;
    mlan_buffer *pmbuf = context->pmbuf;
    struct usb_card_rec *cardp = NULL;
    int recv_length = urb->actual_length;
    int size;
    mlan_status status;

    ENTER();

    if (!handle || !handle->card) {
        PRINTM(ERROR, "moal handle or card structure is not valid\n");
        LEAVE();
        return;
    }
    cardp = (struct usb_card_rec *) handle->card;
    if (cardp->rx_cmd_ep == context->ep)
        atomic_dec(&cardp->rx_cmd_urb_pending);
    else
        atomic_dec(&cardp->rx_data_urb_pending);

    if (recv_length) {
        if (urb->status || (handle->surprise_removed == MTRUE)) {
            PRINTM(ERROR, "URB status is failed: %d\n", urb->status);
            /* Do not free mlan_buffer in case of command ep */
            if (cardp->rx_cmd_ep != context->ep)
                woal_free_mlan_buffer(pmbuf);
            goto setup_for_next;
        }
        /* Send packet to MLAN */
        pmbuf->data_len = recv_length;
        atomic_inc(&handle->rx_pending);
        status = mlan_recv(handle->pmlan_adapter, pmbuf, context->ep);
        PRINTM(INFO, "Receive length = 0x%x, status=%d\n", recv_length, status);
        if (status == MLAN_STATUS_PENDING) {
            mlan_main_process(handle->pmlan_adapter);
            /* urb for data_ep is re-submitted now */
            /* urb for cmd_ep will be re-submitted in callback
               moal_recv_complete */
            if (cardp->rx_cmd_ep == context->ep)
                goto rx_exit;
        } else {
            atomic_dec(&handle->rx_pending);
            if (status == MLAN_STATUS_FAILURE)
                PRINTM(ERROR, "MLAN fail to process the receive data\n");
            /* Do not free mlan_buffer in case of command ep */
            if (cardp->rx_cmd_ep != context->ep)
                woal_free_mlan_buffer(pmbuf);
        }
    } else if (urb->status) {
        if (!cardp->rx_urb_recall) {
            PRINTM(MSG, "Card is removed: %d\n", urb->status);
            handle->surprise_removed = MTRUE;
        }
        woal_free_mlan_buffer(pmbuf);
        goto rx_exit;
    } else {
        /* Do not free mlan_buffer in case of command ep */
        if (cardp->rx_cmd_ep != context->ep)
            woal_free_mlan_buffer(pmbuf);
        goto setup_for_next;
    }
  setup_for_next:
    if (cardp->rx_cmd_ep == context->ep)
        size = MLAN_RX_CMD_BUF_SIZE;
    else
        size = MLAN_RX_DATA_BUF_SIZE;
    woal_usb_submit_rx_urb(context, size);
  rx_exit:

    LEAVE();
    return;
}