software/drivers/sd8887/src/wlan/mlinux/moal_priv.c
/**
 *  @brief Set/Get Port Control mode
 *
 *  @param priv     Pointer to the moal_private driver data struct
 *  @param wrq      A pointer to iwreq structure
 *
 *  @return         0 --success, otherwise fail
 */
@brief Set/Get Port Control mode
@param priv     Pointer to the moal_private driver data struct
@param wrq      A pointer to iwreq structure

@return         0 --success, otherwise fail
@brief Set / Get Port Control mode @param priv Pointer to the moal_private driver data struct @param wrq A pointer to iwreq structure @return 0 -- success otherwise fail
static int
woal_port_ctrl(moal_private *priv, struct iwreq *wrq)
{
	mlan_ioctl_req *req = NULL;
	mlan_ds_sec_cfg *sec = NULL;
	int ret = 0;
	mlan_status status = MLAN_STATUS_SUCCESS;
	ENTER();
	req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_sec_cfg));
	if (req == NULL) {
		ret = -ENOMEM;
		goto done;
	}
	sec = (mlan_ds_sec_cfg *)req->pbuf;
	sec->sub_command = MLAN_OID_SEC_CFG_PORT_CTRL_ENABLED;
	req->req_id = MLAN_IOCTL_SEC_CFG;
	if (wrq->u.data.length) {
		if (copy_from_user(&sec->param.port_ctrl_enabled,
				   wrq->u.data.pointer, sizeof(int)) != 0) {
			PRINTM(MERROR, "port_ctrl:Copy from user failed\n");
			ret = -EFAULT;
			goto done;
		}
		req->action = MLAN_ACT_SET;
	} 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.length) {
		if (copy_to_user
		    (wrq->u.data.pointer, &sec->param.port_ctrl_enabled,
		     sizeof(int))) {
			PRINTM(MERROR, "port_ctrl: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_port_ctrl ( moal_private * priv , struct iwreq * wrq ) { mlan_ioctl_req * req = NULL ; mlan_ds_sec_cfg * sec = NULL ; int ret = 0 ; mlan_status status = MLAN_STATUS_SUCCESS ; ENTER ( ) ; req = woal_alloc_mlan_ioctl_req ( sizeof ( mlan_ds_sec_cfg ) ) ; if ( req == NULL ) { ret = - ENOMEM ; goto done ; } sec = ( mlan_ds_sec_cfg * ) req -> pbuf ; sec -> sub_command = MLAN_OID_SEC_CFG_PORT_CTRL_ENABLED ; req -> req_id = MLAN_IOCTL_SEC_CFG ; if ( wrq -> u . data . length ) { if ( copy_from_user ( & sec -> param . port_ctrl_enabled , wrq -> u . data . pointer , sizeof ( int ) ) != 0 ) { PRINTM ( MERROR , " \n " ) ; ret = - EFAULT ; goto done ; } req -> action = MLAN_ACT_SET ; } 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 . length ) { if ( copy_to_user ( wrq -> u . data . pointer , & sec -> param . port_ctrl_enabled , sizeof ( int ) ) ) { PRINTM ( MERROR , " \n " ) ; ret = - EFAULT ; goto done ; } wrq -> u . data . length = 1 ; } done : if ( status != MLAN_STATUS_PENDING ) kfree ( req ) ; LEAVE ( ) ; return ret ; }
@brief Set/Get Port Control mode
  @param priv     Pointer to the moal_private driver data struct
  @param wrq      A pointer to iwreq structure
@brief Set / Get Port Control mode @param priv Pointer to the moal_private driver data struct @param wrq A pointer to iwreq structure
/* Allocate an IOCTL request buffer */ /* Fill request buffer */ /* Send IOCTL request to MLAN */