software/drivers/sd8887/src/wlan/mlinux/moal_priv.c
/**
 *  @brief Private IOCTL entry to send a DELTS TSPEC
 *
 *  Receive a DELTS command from the application.  The command structure
 *    contains a TSPEC and reason code along with space for a command result
 *    to be returned.  The information is packaged is sent to the wlan_cmd.c
 *    firmware command prep and send routines for execution in the firmware.
 *
 *  The reason code is not used for WMM implementations but is indicated in
 *    the 802.11e specification.
 *
 *  The return value to the application layer indicates a driver execution
 *    success or failure.  A successful return could still indicate a firmware
 *    failure via the cmd_result field copied back to the application.
 *
 *  @param priv    Pointer to the mlan_private driver data struct
 *  @param wrq     A pointer to iwreq structure containing the
 *                 wlan_ioctl_wmm_delts_req_t struct for this DELTS request
 *
 *  @return        0 if successful; IOCTL error code otherwise
 */
@brief Private IOCTL entry to send a DELTS TSPEC
Receive a DELTS command from the application.  The command structure
contains a TSPEC and reason code along with space for a command result
to be returned.  The information is packaged is sent to the wlan_cmd.c
firmware command prep and send routines for execution in the firmware.

The reason code is not used for WMM implementations but is indicated in
the 802.11e specification.

The return value to the application layer indicates a driver execution
success or failure.  A successful return could still indicate a firmware
failure via the cmd_result field copied back to the application.

@param priv    Pointer to the mlan_private driver data struct
@param wrq     A pointer to iwreq structure containing the
wlan_ioctl_wmm_delts_req_t struct for this DELTS request

@return        0 if successful; IOCTL error code otherwise
@brief Private IOCTL entry to send a DELTS TSPEC Receive a DELTS command from the application . The command structure contains a TSPEC and reason code along with space for a command result to be returned . The information is packaged is sent to the wlan_cmd . c firmware command prep and send routines for execution in the firmware . The reason code is not used for WMM implementations but is indicated in the 802 . 11e specification . The return value to the application layer indicates a driver execution success or failure . A successful return could still indicate a firmware failure via the cmd_result field copied back to the application . @param priv Pointer to the mlan_private driver data struct @param wrq A pointer to iwreq structure containing the wlan_ioctl_wmm_delts_req_t struct for this DELTS request @return 0 if successful ; IOCTL error code otherwise
static int
woal_wmm_delts_req_ioctl(moal_private *priv, struct iwreq *wrq)
{
	mlan_ioctl_req *req = NULL;
	mlan_ds_wmm_cfg *cfg = NULL;
	wlan_ioctl_wmm_delts_req_t delts_ioctl;
	int ret = 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;
	}
	req->req_id = MLAN_IOCTL_WMM_CFG;
	cfg = (mlan_ds_wmm_cfg *)req->pbuf;
	cfg->sub_command = MLAN_OID_WMM_CFG_DELTS;
	memset(&delts_ioctl, 0x00, sizeof(delts_ioctl));
	if (wrq->u.data.length) {
		if (copy_from_user(&delts_ioctl, wrq->u.data.pointer,
				   MIN(wrq->u.data.length,
				       sizeof(delts_ioctl)))) {
			PRINTM(MERROR, "TSPEC: DELTS copy from user failed\n");
			ret = -EFAULT;
			goto done;
		}
		cfg->param.delts.status_code =
			(t_u32)delts_ioctl.ieee_reason_code;
		cfg->param.delts.ie_data_len = (t_u8)delts_ioctl.ie_data_len;
		if ((cfg->param.delts.ie_data_len) >
		    sizeof(cfg->param.delts.ie_data)) {
			PRINTM(MERROR, "IE data length too large\n");
			ret = -EFAULT;
			goto done;
		}
		memcpy(cfg->param.delts.ie_data,
		       delts_ioctl.ie_data, cfg->param.delts.ie_data_len);
		status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT);
		if (status != MLAN_STATUS_SUCCESS) {
			ret = -EFAULT;
			goto done;
		}
		delts_ioctl.cmd_result = cfg->param.delts.result;
		wrq->u.data.length = sizeof(delts_ioctl);
		if (copy_to_user(wrq->u.data.pointer,
				 &delts_ioctl, wrq->u.data.length)) {
			PRINTM(MERROR, "TSPEC: DELTS copy to user failed\n");
			ret = -EFAULT;
			goto done;
		}
	}
done:
	if (status != MLAN_STATUS_PENDING)
		kfree(req);
	LEAVE();
	return ret;
}
static int woal_wmm_delts_req_ioctl ( moal_private * priv , struct iwreq * wrq ) { mlan_ioctl_req * req = NULL ; mlan_ds_wmm_cfg * cfg = NULL ; wlan_ioctl_wmm_delts_req_t delts_ioctl ; int ret = 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 ; } req -> req_id = MLAN_IOCTL_WMM_CFG ; cfg = ( mlan_ds_wmm_cfg * ) req -> pbuf ; cfg -> sub_command = MLAN_OID_WMM_CFG_DELTS ; memset ( & delts_ioctl , 0x00 , sizeof ( delts_ioctl ) ) ; if ( wrq -> u . data . length ) { if ( copy_from_user ( & delts_ioctl , wrq -> u . data . pointer , MIN ( wrq -> u . data . length , sizeof ( delts_ioctl ) ) ) ) { PRINTM ( MERROR , " \n " ) ; ret = - EFAULT ; goto done ; } cfg -> param . delts . status_code = ( t_u32 ) delts_ioctl . ieee_reason_code ; cfg -> param . delts . ie_data_len = ( t_u8 ) delts_ioctl . ie_data_len ; if ( ( cfg -> param . delts . ie_data_len ) > sizeof ( cfg -> param . delts . ie_data ) ) { PRINTM ( MERROR , " \n " ) ; ret = - EFAULT ; goto done ; } memcpy ( cfg -> param . delts . ie_data , delts_ioctl . ie_data , cfg -> param . delts . ie_data_len ) ; status = woal_request_ioctl ( priv , req , MOAL_IOCTL_WAIT ) ; if ( status != MLAN_STATUS_SUCCESS ) { ret = - EFAULT ; goto done ; } delts_ioctl . cmd_result = cfg -> param . delts . result ; wrq -> u . data . length = sizeof ( delts_ioctl ) ; if ( copy_to_user ( wrq -> u . data . pointer , & delts_ioctl , wrq -> u . data . length ) ) { PRINTM ( MERROR , " \n " ) ; ret = - EFAULT ; goto done ; } } done : if ( status != MLAN_STATUS_PENDING ) kfree ( req ) ; LEAVE ( ) ; return ret ; }
@brief Private IOCTL entry to send a DELTS TSPEC
  Receive a DELTS command from the application.
@brief Private IOCTL entry to send a DELTS TSPEC Receive a DELTS command from the application .
/* Return the firmware command result back to the application layer */