software/drivers/sd8887/src/wlan/mlinux/moal_priv.c
/**
 *  @brief Enable/Disable amsdu_aggr_ctrl
 *
 *  @param priv     Pointer to the moal_private driver data struct
 *  @param wrq      A pointer to iwreq structure
 *
 *  @return         0 --success, otherwise fail
 */
@brief Enable/Disable amsdu_aggr_ctrl
@param priv     Pointer to the moal_private driver data struct
@param wrq      A pointer to iwreq structure

@return         0 --success, otherwise fail
@brief Enable / Disable amsdu_aggr_ctrl @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_11n_amsdu_aggr_ctrl(moal_private *priv, struct iwreq *wrq)
{
	int data[2], copy_len;
	mlan_ioctl_req *req = NULL;
	mlan_ds_11n_cfg *cfg_11n = NULL;
	int ret = 0;
	int data_length = wrq->u.data.length;
	mlan_status status = MLAN_STATUS_SUCCESS;
	ENTER();
	if ((data_length != 0) && (data_length != 1)) {
		PRINTM(MERROR, "Invalid number of arguments\n");
		ret = -EINVAL;
		goto done;
	}
	copy_len = MIN(sizeof(data), sizeof(int) * data_length);
	req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_11n_cfg));
	if (req == NULL) {
		ret = -ENOMEM;
		goto done;
	}
	cfg_11n = (mlan_ds_11n_cfg *)req->pbuf;
	cfg_11n->sub_command = MLAN_OID_11N_CFG_AMSDU_AGGR_CTRL;
	req->req_id = MLAN_IOCTL_11N_CFG;
	if (data_length == 0) {
		req->action = MLAN_ACT_GET;
	} else if (data_length == 1) {
		if (copy_from_user(data, wrq->u.data.pointer, copy_len)) {
			PRINTM(MERROR, "Copy from user failed\n");
			ret = -EFAULT;
			goto done;
		}
		cfg_11n->param.amsdu_aggr_ctrl.enable = data[0];
		req->action = MLAN_ACT_SET;
	}
	status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT);
	if (status != MLAN_STATUS_SUCCESS) {
		ret = -EFAULT;
		goto done;
	}
	data[0] = cfg_11n->param.amsdu_aggr_ctrl.enable;
	data[1] = cfg_11n->param.amsdu_aggr_ctrl.curr_buf_size;
	if (copy_to_user(wrq->u.data.pointer, data, sizeof(data))) {
		PRINTM(MERROR, "Copy to user failed\n");
		ret = -EFAULT;
		goto done;
	}
	wrq->u.data.length = 2;
done:
	if (status != MLAN_STATUS_PENDING)
		kfree(req);
	LEAVE();
	return ret;
}
static int woal_11n_amsdu_aggr_ctrl ( moal_private * priv , struct iwreq * wrq ) { int data [ 2 ] , copy_len ; mlan_ioctl_req * req = NULL ; mlan_ds_11n_cfg * cfg_11n = NULL ; int ret = 0 ; int data_length = wrq -> u . data . length ; mlan_status status = MLAN_STATUS_SUCCESS ; ENTER ( ) ; if ( ( data_length != 0 ) && ( data_length != 1 ) ) { PRINTM ( MERROR , " \n " ) ; ret = - EINVAL ; goto done ; } copy_len = MIN ( sizeof ( data ) , sizeof ( int ) * data_length ) ; req = woal_alloc_mlan_ioctl_req ( sizeof ( mlan_ds_11n_cfg ) ) ; if ( req == NULL ) { ret = - ENOMEM ; goto done ; } cfg_11n = ( mlan_ds_11n_cfg * ) req -> pbuf ; cfg_11n -> sub_command = MLAN_OID_11N_CFG_AMSDU_AGGR_CTRL ; req -> req_id = MLAN_IOCTL_11N_CFG ; if ( data_length == 0 ) { req -> action = MLAN_ACT_GET ; } else if ( data_length == 1 ) { if ( copy_from_user ( data , wrq -> u . data . pointer , copy_len ) ) { PRINTM ( MERROR , " \n " ) ; ret = - EFAULT ; goto done ; } cfg_11n -> param . amsdu_aggr_ctrl . enable = data [ 0 ] ; req -> action = MLAN_ACT_SET ; } status = woal_request_ioctl ( priv , req , MOAL_IOCTL_WAIT ) ; if ( status != MLAN_STATUS_SUCCESS ) { ret = - EFAULT ; goto done ; } data [ 0 ] = cfg_11n -> param . amsdu_aggr_ctrl . enable ; data [ 1 ] = cfg_11n -> param . amsdu_aggr_ctrl . curr_buf_size ; if ( copy_to_user ( wrq -> u . data . pointer , data , sizeof ( data ) ) ) { PRINTM ( MERROR , " \n " ) ; ret = - EFAULT ; goto done ; } wrq -> u . data . length = 2 ; done : if ( status != MLAN_STATUS_PENDING ) kfree ( req ) ; LEAVE ( ) ; return ret ; }
@brief Enable/Disable amsdu_aggr_ctrl
  @param priv     Pointer to the moal_private driver data struct
  @param wrq      A pointer to iwreq structure
@brief Enable / Disable amsdu_aggr_ctrl @param priv Pointer to the moal_private driver data struct @param wrq A pointer to iwreq structure
/* Get 11n tx parameters from MLAN */ /* Update 11n tx parameters in MLAN */