software/drivers/sd8887/src/wlan/mlinux/moal_priv.c
/**
 *  @brief Set/Get beacon interval
 *
 *  @param priv     A pointer to moal_private structure
 *  @param wrq      A pointer to iwreq structure
 *
 *  @return         0 --success, otherwise fail
 */
@brief Set/Get beacon interval
@param priv     A pointer to moal_private structure
@param wrq      A pointer to iwreq structure

@return         0 --success, otherwise fail
@brief Set / Get beacon interval @param priv A pointer to moal_private structure @param wrq A pointer to iwreq structure @return 0 -- success otherwise fail
static int
woal_beacon_interval(moal_private *priv, struct iwreq *wrq)
{
	int ret = 0;
	mlan_ds_bss *bss = NULL;
	mlan_ioctl_req *req = NULL;
	int bcn = 0;
	mlan_status status = MLAN_STATUS_SUCCESS;
	ENTER();
	if (wrq->u.data.length) {
		if (copy_from_user(&bcn, wrq->u.data.pointer, sizeof(int))) {
			PRINTM(MERROR, "Copy from user failed\n");
			ret = -EFAULT;
			goto done;
		}
		if ((bcn < MLAN_MIN_BEACON_INTERVAL) ||
		    (bcn > MLAN_MAX_BEACON_INTERVAL)) {
			ret = -EINVAL;
			goto done;
		}
	}
	req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_bss));
	if (req == NULL) {
		ret = -ENOMEM;
		goto done;
	}
	bss = (mlan_ds_bss *)req->pbuf;
	bss->sub_command = MLAN_OID_IBSS_BCN_INTERVAL;
	req->req_id = MLAN_IOCTL_BSS;
	if (!wrq->u.data.length)
		req->action = MLAN_ACT_GET;
	else {
		req->action = MLAN_ACT_SET;
		bss->param.bcn_interval = bcn;
	}
	status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT);
	if (status != MLAN_STATUS_SUCCESS) {
		ret = -EFAULT;
		goto done;
	}
	if (copy_to_user
	    (wrq->u.data.pointer, (t_u8 *)&bss->param.bcn_interval,
	     sizeof(int))) {
		ret = -EFAULT;
		goto done;
	}
	wrq->u.data.length = 1;
done:
	if (status != MLAN_STATUS_PENDING)
		kfree(req);
	LEAVE();
	return ret;
}
static int woal_beacon_interval ( moal_private * priv , struct iwreq * wrq ) { int ret = 0 ; mlan_ds_bss * bss = NULL ; mlan_ioctl_req * req = NULL ; int bcn = 0 ; mlan_status status = MLAN_STATUS_SUCCESS ; ENTER ( ) ; if ( wrq -> u . data . length ) { if ( copy_from_user ( & bcn , wrq -> u . data . pointer , sizeof ( int ) ) ) { PRINTM ( MERROR , " \n " ) ; ret = - EFAULT ; goto done ; } if ( ( bcn < MLAN_MIN_BEACON_INTERVAL ) || ( bcn > MLAN_MAX_BEACON_INTERVAL ) ) { ret = - EINVAL ; goto done ; } } req = woal_alloc_mlan_ioctl_req ( sizeof ( mlan_ds_bss ) ) ; if ( req == NULL ) { ret = - ENOMEM ; goto done ; } bss = ( mlan_ds_bss * ) req -> pbuf ; bss -> sub_command = MLAN_OID_IBSS_BCN_INTERVAL ; req -> req_id = MLAN_IOCTL_BSS ; if ( ! wrq -> u . data . length ) req -> action = MLAN_ACT_GET ; else { req -> action = MLAN_ACT_SET ; bss -> param . bcn_interval = bcn ; } status = woal_request_ioctl ( priv , req , MOAL_IOCTL_WAIT ) ; if ( status != MLAN_STATUS_SUCCESS ) { ret = - EFAULT ; goto done ; } if ( copy_to_user ( wrq -> u . data . pointer , ( t_u8 * ) & bss -> param . bcn_interval , sizeof ( int ) ) ) { ret = - EFAULT ; goto done ; } wrq -> u . data . length = 1 ; done : if ( status != MLAN_STATUS_PENDING ) kfree ( req ) ; LEAVE ( ) ; return ret ; }
@brief Set/Get beacon interval
  @param priv     A pointer to moal_private structure
  @param wrq      A pointer to iwreq structure
@brief Set / Get beacon interval @param priv A pointer to moal_private structure @param wrq A pointer to iwreq structure