software/drivers/sd8887/src/wlan/mlinux/moal_priv.c
/**
 *  @brief Private IOCTL entry to get and start/stop queue stats on a WMM AC
 *
 *  Receive a AC Queue statistics command from the application for a specific
 *    WMM AC.  The command can:
 *         - Turn stats on
 *         - Turn stats off
 *         - Collect and clear the stats
 *
 *  @param priv    Pointer to the moal_private driver data struct
 *  @param wrq     A pointer to iwreq structure containing the
 *                 wlan_ioctl_wmm_queue_stats_t struct
 *
 *  @return        0 if successful; IOCTL error code otherwise
 */
@brief Private IOCTL entry to get and start/stop queue stats on a WMM AC
Receive a AC Queue statistics command from the application for a specific
WMM AC.  The command can:
- Turn stats on
- Turn stats off
- Collect and clear the stats

@param priv    Pointer to the moal_private driver data struct
@param wrq     A pointer to iwreq structure containing the
wlan_ioctl_wmm_queue_stats_t struct

@return        0 if successful; IOCTL error code otherwise
@brief Private IOCTL entry to get and start / stop queue stats on a WMM AC Receive a AC Queue statistics command from the application for a specific WMM AC . The command can : - Turn stats on - Turn stats off - Collect and clear the stats @param priv Pointer to the moal_private driver data struct @param wrq A pointer to iwreq structure containing the wlan_ioctl_wmm_queue_stats_t struct @return 0 if successful ; IOCTL error code otherwise
static int
woal_wmm_queue_stats_ioctl(moal_private *priv, struct iwreq *wrq)
{
	mlan_ioctl_req *req = NULL;
	mlan_ds_wmm_cfg *pwmm = NULL;
	mlan_ds_wmm_queue_stats *pqstats = NULL;
	wlan_ioctl_wmm_queue_stats_t qstats_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;
	pwmm = (mlan_ds_wmm_cfg *)req->pbuf;
	pwmm->sub_command = MLAN_OID_WMM_CFG_QUEUE_STATS;
	memset(&qstats_ioctl, 0x00, sizeof(qstats_ioctl));
	pqstats = (mlan_ds_wmm_queue_stats *)&pwmm->param.q_stats;
	if (wrq->u.data.length) {
		if (copy_from_user(&qstats_ioctl, wrq->u.data.pointer,
				   MIN(wrq->u.data.length,
				       sizeof(qstats_ioctl)))) {
			PRINTM(MERROR, "QSTATS: copy from user failed\n");
			ret = -EFAULT;
			goto done;
		}
		memcpy((void *)pqstats, (void *)&qstats_ioctl,
		       sizeof(qstats_ioctl));
		PRINTM(MINFO, "QSTATS: IOCTL [%d,%d]\n", qstats_ioctl.action,
		       qstats_ioctl.user_priority);
		status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT);
		if (status != MLAN_STATUS_SUCCESS) {
			ret = -EFAULT;
			goto done;
		}
		memset(&qstats_ioctl, 0x00, sizeof(qstats_ioctl));
		memcpy((void *)&qstats_ioctl, (void *)pqstats,
		       sizeof(qstats_ioctl));
		wrq->u.data.length = sizeof(qstats_ioctl);
		if (copy_to_user
		    (wrq->u.data.pointer, &qstats_ioctl, wrq->u.data.length)) {
			PRINTM(MERROR, "QSTATS: copy to user failed\n");
			ret = -EFAULT;
			goto done;
		}
	}
done:
	if (status != MLAN_STATUS_PENDING)
		kfree(req);
	LEAVE();
	return ret;
}
static int woal_wmm_queue_stats_ioctl ( moal_private * priv , struct iwreq * wrq ) { mlan_ioctl_req * req = NULL ; mlan_ds_wmm_cfg * pwmm = NULL ; mlan_ds_wmm_queue_stats * pqstats = NULL ; wlan_ioctl_wmm_queue_stats_t qstats_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 ; pwmm = ( mlan_ds_wmm_cfg * ) req -> pbuf ; pwmm -> sub_command = MLAN_OID_WMM_CFG_QUEUE_STATS ; memset ( & qstats_ioctl , 0x00 , sizeof ( qstats_ioctl ) ) ; pqstats = ( mlan_ds_wmm_queue_stats * ) & pwmm -> param . q_stats ; if ( wrq -> u . data . length ) { if ( copy_from_user ( & qstats_ioctl , wrq -> u . data . pointer , MIN ( wrq -> u . data . length , sizeof ( qstats_ioctl ) ) ) ) { PRINTM ( MERROR , " \n " ) ; ret = - EFAULT ; goto done ; } memcpy ( ( void * ) pqstats , ( void * ) & qstats_ioctl , sizeof ( qstats_ioctl ) ) ; PRINTM ( MINFO , " \n " , qstats_ioctl . action , qstats_ioctl . user_priority ) ; status = woal_request_ioctl ( priv , req , MOAL_IOCTL_WAIT ) ; if ( status != MLAN_STATUS_SUCCESS ) { ret = - EFAULT ; goto done ; } memset ( & qstats_ioctl , 0x00 , sizeof ( qstats_ioctl ) ) ; memcpy ( ( void * ) & qstats_ioctl , ( void * ) pqstats , sizeof ( qstats_ioctl ) ) ; wrq -> u . data . length = sizeof ( qstats_ioctl ) ; if ( copy_to_user ( wrq -> u . data . pointer , & qstats_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 get and start/stop queue stats on a WMM AC
  Receive a AC Queue statistics command from the application for a specific
    WMM AC.
@brief Private IOCTL entry to get and start / stop queue stats on a WMM AC Receive a AC Queue statistics command from the application for a specific WMM AC .