software/drivers/sd8887/src/wlan/mlinux/moal_priv.c
/**
 *  @brief implement WMM enable command
 *
 *  @param priv     Pointer to the moal_private driver data struct
 *  @param wrq      Pointer to the iwreq structure
 *
 *  @return         0 --success, otherwise fail
 */
@brief implement WMM enable command
@param priv     Pointer to the moal_private driver data struct
@param wrq      Pointer to the iwreq structure

@return         0 --success, otherwise fail
@brief implement WMM enable command @param priv Pointer to the moal_private driver data struct @param wrq Pointer to the iwreq structure @return 0 -- success otherwise fail
static int
woal_wmm_enable_ioctl(moal_private *priv, struct iwreq *wrq)
{
	int ret = 0;
	mlan_ds_wmm_cfg *wmm = NULL;
	mlan_ioctl_req *req = NULL;
	int data = 0;
	mlan_status status = MLAN_STATUS_SUCCESS;
	ENTER();
	req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_wmm_cfg));
	if (req == NULL) {
		ret = -ENOMEM;
		goto done;
	}
	wmm = (mlan_ds_wmm_cfg *)req->pbuf;
	req->req_id = MLAN_IOCTL_WMM_CFG;
	wmm->sub_command = MLAN_OID_WMM_CFG_ENABLE;
	if (wrq->u.data.length) {
		if (copy_from_user(&data, wrq->u.data.pointer, sizeof(int))) {
			PRINTM(MERROR, "Copy from user failed\n");
			ret = -EFAULT;
			goto done;
		}
		if ((data < CMD_DISABLED) || (data > CMD_ENABLED)) {
			ret = -EINVAL;
			goto done;
		}
		req->action = MLAN_ACT_SET;
		if (data == CMD_DISABLED)
			wmm->param.wmm_enable = MFALSE;
		else
			wmm->param.wmm_enable = MTRUE;
	} else {
		req->action = MLAN_ACT_GET;
	}
	status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT);
	if (status != MLAN_STATUS_SUCCESS) {
		ret = -EFAULT;
		goto done;
	}
	if (wrq->u.data.pointer) {
		if (copy_to_user
		    (wrq->u.data.pointer, &wmm->param.wmm_enable,
		     sizeof(wmm->param.wmm_enable))) {
			PRINTM(MERROR, "Copy to user failed\n");
			ret = -EFAULT;
			goto done;
		}
		wrq->u.data.length = 1;
	}
done:
	if (status != MLAN_STATUS_PENDING)
		kfree(req);
	LEAVE();
	return ret;
}
static int woal_wmm_enable_ioctl ( moal_private * priv , struct iwreq * wrq ) { int ret = 0 ; mlan_ds_wmm_cfg * wmm = NULL ; mlan_ioctl_req * req = NULL ; int data = 0 ; mlan_status status = MLAN_STATUS_SUCCESS ; ENTER ( ) ; req = woal_alloc_mlan_ioctl_req ( sizeof ( mlan_ds_wmm_cfg ) ) ; if ( req == NULL ) { ret = - ENOMEM ; goto done ; } wmm = ( mlan_ds_wmm_cfg * ) req -> pbuf ; req -> req_id = MLAN_IOCTL_WMM_CFG ; wmm -> sub_command = MLAN_OID_WMM_CFG_ENABLE ; if ( wrq -> u . data . length ) { if ( copy_from_user ( & data , wrq -> u . data . pointer , sizeof ( int ) ) ) { PRINTM ( MERROR , " \n " ) ; ret = - EFAULT ; goto done ; } if ( ( data < CMD_DISABLED ) || ( data > CMD_ENABLED ) ) { ret = - EINVAL ; goto done ; } req -> action = MLAN_ACT_SET ; if ( data == CMD_DISABLED ) wmm -> param . wmm_enable = MFALSE ; else wmm -> param . wmm_enable = MTRUE ; } else { req -> action = MLAN_ACT_GET ; } status = woal_request_ioctl ( priv , req , MOAL_IOCTL_WAIT ) ; if ( status != MLAN_STATUS_SUCCESS ) { ret = - EFAULT ; goto done ; } if ( wrq -> u . data . pointer ) { if ( copy_to_user ( wrq -> u . data . pointer , & wmm -> param . wmm_enable , sizeof ( wmm -> param . wmm_enable ) ) ) { PRINTM ( MERROR , " \n " ) ; ret = - EFAULT ; goto done ; } wrq -> u . data . length = 1 ; } done : if ( status != MLAN_STATUS_PENDING ) kfree ( req ) ; LEAVE ( ) ; return ret ; }
@brief implement WMM enable command
  @param priv     Pointer to the moal_private driver data struct
  @param wrq      Pointer to the iwreq structure
@brief implement WMM enable command @param priv Pointer to the moal_private driver data struct @param wrq Pointer to the iwreq structure
/* Set WMM configuration */ /* Get WMM status */