software/drivers/sd8887/src/wlan/mlinux/moal_priv.c
/**
 * @brief Set SDIO Multi-point aggregation control parameters
 *
 * @param priv     A pointer to moal_private structure
 * @param wrq      A pointer to iwreq structure
 *
 * @return         0/MLAN_STATUS_PENDING --success, otherwise fail
 */
@brief Set SDIO Multi-point aggregation control parameters
@param priv     A pointer to moal_private structure
@param wrq      A pointer to iwreq structure

@return         0/MLAN_STATUS_PENDING --success, otherwise fail
@brief Set SDIO Multi - point aggregation control parameters @param priv A pointer to moal_private structure @param wrq A pointer to iwreq structure @return 0 / MLAN_STATUS_PENDING -- success otherwise fail
static int
woal_do_sdio_mpa_ctrl(moal_private *priv, struct iwreq *wrq)
{
	int data[6], data_length = wrq->u.data.length, copy_len;
	int ret = 0;
	mlan_ds_misc_cfg *misc = NULL;
	mlan_ioctl_req *req = NULL;
	mlan_status status = MLAN_STATUS_SUCCESS;
	ENTER();
	if (sizeof(int) * wrq->u.data.length > sizeof(data)) {
		PRINTM(MERROR, "Too many arguments\n");
		ret = -EINVAL;
		goto done;
	}
	copy_len = MIN(sizeof(data), sizeof(int) * data_length);
	req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg));
	if (req == NULL) {
		ret = -ENOMEM;
		goto done;
	}
	misc = (mlan_ds_misc_cfg *)req->pbuf;
	memset(misc, 0, sizeof(mlan_ds_misc_cfg));
	misc->sub_command = MLAN_OID_MISC_SDIO_MPA_CTRL;
	req->req_id = MLAN_IOCTL_MISC_CFG;
	req->action = MLAN_ACT_GET;
	status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT);
	if (status != MLAN_STATUS_SUCCESS) {
		PRINTM(MERROR, "woal_request_ioctl returned %d\n", ret);
		ret = -EFAULT;
		goto done;
	}
	if (data_length == 0) {
		data[0] = misc->param.mpa_ctrl.tx_enable;
		data[1] = misc->param.mpa_ctrl.rx_enable;
		data[2] = misc->param.mpa_ctrl.tx_buf_size;
		data[3] = misc->param.mpa_ctrl.rx_buf_size;
		data[4] = misc->param.mpa_ctrl.tx_max_ports;
		data[5] = misc->param.mpa_ctrl.rx_max_ports;
		PRINTM(MINFO, "Get Param: %d %d %d %d %d %d\n", data[0],
		       data[1], data[2], data[3], data[4], data[5]);
		if (copy_to_user(wrq->u.data.pointer, data, sizeof(data))) {
			ret = -EFAULT;
			goto done;
		}
		wrq->u.data.length = ARRAY_SIZE(data);
		goto done;
	}
	if (copy_from_user(data, wrq->u.data.pointer, copy_len)) {
		PRINTM(MINFO, "Copy from user failed\n");
		ret = -EFAULT;
		goto done;
	}
	switch (data_length) {
	case 6:
		misc->param.mpa_ctrl.rx_max_ports = data[5];
	case 5:
		misc->param.mpa_ctrl.tx_max_ports = data[4];
	case 4:
		misc->param.mpa_ctrl.rx_buf_size = data[3];
	case 3:
		misc->param.mpa_ctrl.tx_buf_size = data[2];
	case 2:
		misc->param.mpa_ctrl.rx_enable = data[1];
	case 1:
		req->action = MLAN_ACT_SET;
		PRINTM(MINFO, "Set Param: %d %d %d %d %d %d\n", data[0],
		       data[1], data[2], data[3], data[4], data[5]);
		misc->param.mpa_ctrl.tx_enable = data[0];
		break;
	default:
		PRINTM(MERROR, "Default case error\n");
		ret = -EINVAL;
		goto done;
	}
	status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT);
	if (status != MLAN_STATUS_SUCCESS) {
		PRINTM(MERROR, "woal_request_ioctl returned %d\n", ret);
		ret = -EFAULT;
		goto done;
	}
done:
	if (status != MLAN_STATUS_PENDING)
		kfree(req);
	LEAVE();
	return ret;
}
static int woal_do_sdio_mpa_ctrl ( moal_private * priv , struct iwreq * wrq ) { int data [ 6 ] , data_length = wrq -> u . data . length , copy_len ; int ret = 0 ; mlan_ds_misc_cfg * misc = NULL ; mlan_ioctl_req * req = NULL ; mlan_status status = MLAN_STATUS_SUCCESS ; ENTER ( ) ; if ( sizeof ( int ) * wrq -> u . data . length > sizeof ( data ) ) { 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_misc_cfg ) ) ; if ( req == NULL ) { ret = - ENOMEM ; goto done ; } misc = ( mlan_ds_misc_cfg * ) req -> pbuf ; memset ( misc , 0 , sizeof ( mlan_ds_misc_cfg ) ) ; misc -> sub_command = MLAN_OID_MISC_SDIO_MPA_CTRL ; req -> req_id = MLAN_IOCTL_MISC_CFG ; req -> action = MLAN_ACT_GET ; status = woal_request_ioctl ( priv , req , MOAL_IOCTL_WAIT ) ; if ( status != MLAN_STATUS_SUCCESS ) { PRINTM ( MERROR , " \n " , ret ) ; ret = - EFAULT ; goto done ; } if ( data_length == 0 ) { data [ 0 ] = misc -> param . mpa_ctrl . tx_enable ; data [ 1 ] = misc -> param . mpa_ctrl . rx_enable ; data [ 2 ] = misc -> param . mpa_ctrl . tx_buf_size ; data [ 3 ] = misc -> param . mpa_ctrl . rx_buf_size ; data [ 4 ] = misc -> param . mpa_ctrl . tx_max_ports ; data [ 5 ] = misc -> param . mpa_ctrl . rx_max_ports ; PRINTM ( MINFO , " \n " , data [ 0 ] , data [ 1 ] , data [ 2 ] , data [ 3 ] , data [ 4 ] , data [ 5 ] ) ; if ( copy_to_user ( wrq -> u . data . pointer , data , sizeof ( data ) ) ) { ret = - EFAULT ; goto done ; } wrq -> u . data . length = ARRAY_SIZE ( data ) ; goto done ; } if ( copy_from_user ( data , wrq -> u . data . pointer , copy_len ) ) { PRINTM ( MINFO , " \n " ) ; ret = - EFAULT ; goto done ; } switch ( data_length ) { case 6 : misc -> param . mpa_ctrl . rx_max_ports = data [ 5 ] ; case 5 : misc -> param . mpa_ctrl . tx_max_ports = data [ 4 ] ; case 4 : misc -> param . mpa_ctrl . rx_buf_size = data [ 3 ] ; case 3 : misc -> param . mpa_ctrl . tx_buf_size = data [ 2 ] ; case 2 : misc -> param . mpa_ctrl . rx_enable = data [ 1 ] ; case 1 : req -> action = MLAN_ACT_SET ; PRINTM ( MINFO , " \n " , data [ 0 ] , data [ 1 ] , data [ 2 ] , data [ 3 ] , data [ 4 ] , data [ 5 ] ) ; misc -> param . mpa_ctrl . tx_enable = data [ 0 ] ; break ; default : PRINTM ( MERROR , " \n " ) ; ret = - EINVAL ; goto done ; } status = woal_request_ioctl ( priv , req , MOAL_IOCTL_WAIT ) ; if ( status != MLAN_STATUS_SUCCESS ) { PRINTM ( MERROR , " \n " , ret ) ; ret = - EFAULT ; goto done ; } done : if ( status != MLAN_STATUS_PENDING ) kfree ( req ) ; LEAVE ( ) ; return ret ; }
@brief Set SDIO Multi-point aggregation control parameters
 @param priv     A pointer to moal_private structure
 @param wrq      A pointer to iwreq structure
@brief Set SDIO Multi - point aggregation control parameters @param priv A pointer to moal_private structure @param wrq A pointer to iwreq structure
/* Get the values first, then modify these values if
	 * user had modified them */ /* Set cmd */