software/drivers/sd8887/src/wlan/mlinux/moal_priv.c
static int
woal_addba_reject(moal_private *priv, struct iwreq *wrq)
{
	int data[MAX_NUM_TID], ret = 0, i, copy_len;
	mlan_ioctl_req *req = NULL;
	mlan_ds_11n_cfg *cfg_11n = NULL;
	int data_length = wrq->u.data.length;
	mlan_status status = MLAN_STATUS_SUCCESS;
	ENTER();

	copy_len = MIN(sizeof(data), sizeof(int) * data_length);
	req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_11n_cfg));
	if (req == NULL) {
		LEAVE();
		return -ENOMEM;
	}
	cfg_11n = (mlan_ds_11n_cfg *)req->pbuf;
	cfg_11n->sub_command = MLAN_OID_11N_CFG_ADDBA_REJECT;
	req->req_id = MLAN_IOCTL_11N_CFG;

	if (data_length == 0) {
		PRINTM(MERROR, "Addba reject moal\n");
		/* Get aggr priority table from MLAN */
		req->action = MLAN_ACT_GET;
		status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT);
		if (status != MLAN_STATUS_SUCCESS) {
			ret = -EFAULT;
			goto error;
		}

		wrq->u.data.length = MAX_NUM_TID;
		for (i = 0; i < (wrq->u.data.length); ++i)
			data[i] = cfg_11n->param.addba_reject[i];

		if (copy_to_user(wrq->u.data.pointer, data,
				 sizeof(int) * wrq->u.data.length)) {
			PRINTM(MERROR, "Copy to user failed\n");
			ret = -EFAULT;
			goto error;
		}
	} else if (data_length == 8) {
		if (copy_from_user(data, wrq->u.data.pointer, copy_len)) {
			PRINTM(MERROR, "Copy from user failed\n");
			ret = -EFAULT;
			goto error;
		}
		for (i = 0; i < (data_length); ++i) {
			if (data[i] != 0 && data[i] != 1) {
				PRINTM(MERROR,
				       "addba reject only takes argument as 0 or 1\n");
				ret = -EFAULT;
				goto error;
			}
			cfg_11n->param.addba_reject[i] = data[i];
		}

		/* Update aggr priority table in MLAN */
		req->action = MLAN_ACT_SET;
		status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT);
		if (status != MLAN_STATUS_SUCCESS) {
			ret = -EFAULT;
			goto error;
		}
	} else {
		PRINTM(MERROR, "Invalid number of arguments\n");
		ret = -EINVAL;
		goto error;
	}
error:
	if (status != MLAN_STATUS_PENDING)
		kfree(req);
	LEAVE();
	return ret;
}
/**
 *  @brief Set/Get add BA Reject parameters
 *
 *  @param priv     Pointer to the moal_private driver data struct
 *  @param wrq      A pointer to iwreq structure
 *
 *  @return         0 --success, otherwise fail
 */
@brief Set/Get add BA Reject parameters
@param priv     Pointer to the moal_private driver data struct
@param wrq      A pointer to iwreq structure

@return         0 --success, otherwise fail
@brief Set / Get add BA Reject parameters @param priv Pointer to the moal_private driver data struct @param wrq A pointer to iwreq structure @return 0 -- success otherwise fail
static int
woal_addba_reject(moal_private *priv, struct iwreq *wrq)
{
	int data[MAX_NUM_TID], ret = 0, i, copy_len;
	mlan_ioctl_req *req = NULL;
	mlan_ds_11n_cfg *cfg_11n = NULL;
	int data_length = wrq->u.data.length;
	mlan_status status = MLAN_STATUS_SUCCESS;
	ENTER();
	copy_len = MIN(sizeof(data), sizeof(int) * data_length);
	req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_11n_cfg));
	if (req == NULL) {
		LEAVE();
		return -ENOMEM;
	}
	cfg_11n = (mlan_ds_11n_cfg *)req->pbuf;
	cfg_11n->sub_command = MLAN_OID_11N_CFG_ADDBA_REJECT;
	req->req_id = MLAN_IOCTL_11N_CFG;
	if (data_length == 0) {
		PRINTM(MERROR, "Addba reject moal\n");
		req->action = MLAN_ACT_GET;
		status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT);
		if (status != MLAN_STATUS_SUCCESS) {
			ret = -EFAULT;
			goto error;
		}
		wrq->u.data.length = MAX_NUM_TID;
		for (i = 0; i < (wrq->u.data.length); ++i)
			data[i] = cfg_11n->param.addba_reject[i];
		if (copy_to_user(wrq->u.data.pointer, data,
				 sizeof(int) * wrq->u.data.length)) {
			PRINTM(MERROR, "Copy to user failed\n");
			ret = -EFAULT;
			goto error;
		}
	} else if (data_length == 8) {
		if (copy_from_user(data, wrq->u.data.pointer, copy_len)) {
			PRINTM(MERROR, "Copy from user failed\n");
			ret = -EFAULT;
			goto error;
		}
		for (i = 0; i < (data_length); ++i) {
			if (data[i] != 0 && data[i] != 1) {
				PRINTM(MERROR,
				       "addba reject only takes argument as 0 or 1\n");
				ret = -EFAULT;
				goto error;
			}
			cfg_11n->param.addba_reject[i] = data[i];
		}
		req->action = MLAN_ACT_SET;
		status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT);
		if (status != MLAN_STATUS_SUCCESS) {
			ret = -EFAULT;
			goto error;
		}
	} else {
		PRINTM(MERROR, "Invalid number of arguments\n");
		ret = -EINVAL;
		goto error;
	}
error:
	if (status != MLAN_STATUS_PENDING)
		kfree(req);
	LEAVE();
	return ret;
}
static int woal_addba_reject ( moal_private * priv , struct iwreq * wrq ) { int data [ MAX_NUM_TID ] , ret = 0 , i , copy_len ; mlan_ioctl_req * req = NULL ; mlan_ds_11n_cfg * cfg_11n = NULL ; int data_length = wrq -> u . data . length ; mlan_status status = MLAN_STATUS_SUCCESS ; ENTER ( ) ; copy_len = MIN ( sizeof ( data ) , sizeof ( int ) * data_length ) ; req = woal_alloc_mlan_ioctl_req ( sizeof ( mlan_ds_11n_cfg ) ) ; if ( req == NULL ) { LEAVE ( ) ; return - ENOMEM ; } cfg_11n = ( mlan_ds_11n_cfg * ) req -> pbuf ; cfg_11n -> sub_command = MLAN_OID_11N_CFG_ADDBA_REJECT ; req -> req_id = MLAN_IOCTL_11N_CFG ; if ( data_length == 0 ) { PRINTM ( MERROR , " \n " ) ; req -> action = MLAN_ACT_GET ; status = woal_request_ioctl ( priv , req , MOAL_IOCTL_WAIT ) ; if ( status != MLAN_STATUS_SUCCESS ) { ret = - EFAULT ; goto error ; } wrq -> u . data . length = MAX_NUM_TID ; for ( i = 0 ; i < ( wrq -> u . data . length ) ; ++ i ) data [ i ] = cfg_11n -> param . addba_reject [ i ] ; if ( copy_to_user ( wrq -> u . data . pointer , data , sizeof ( int ) * wrq -> u . data . length ) ) { PRINTM ( MERROR , " \n " ) ; ret = - EFAULT ; goto error ; } } else if ( data_length == 8 ) { if ( copy_from_user ( data , wrq -> u . data . pointer , copy_len ) ) { PRINTM ( MERROR , " \n " ) ; ret = - EFAULT ; goto error ; } for ( i = 0 ; i < ( data_length ) ; ++ i ) { if ( data [ i ] != 0 && data [ i ] != 1 ) { PRINTM ( MERROR , " \n " ) ; ret = - EFAULT ; goto error ; } cfg_11n -> param . addba_reject [ i ] = data [ i ] ; } req -> action = MLAN_ACT_SET ; status = woal_request_ioctl ( priv , req , MOAL_IOCTL_WAIT ) ; if ( status != MLAN_STATUS_SUCCESS ) { ret = - EFAULT ; goto error ; } } else { PRINTM ( MERROR , " \n " ) ; ret = - EINVAL ; goto error ; } error : if ( status != MLAN_STATUS_PENDING ) kfree ( req ) ; LEAVE ( ) ; return ret ; }
@brief Set/Get add BA Reject parameters
  @param priv     Pointer to the moal_private driver data struct
  @param wrq      A pointer to iwreq structure
@brief Set / Get add BA Reject parameters @param priv Pointer to the moal_private driver data struct @param wrq A pointer to iwreq structure
/* Get aggr priority table from MLAN */ /* Update aggr priority table in MLAN */