software/drivers/sd8887/src/wlan/mlinux/moal_ioctl.c
/**
 *  @brief Set auto arp resp
 *
 *  @param handle         A pointer to moal_handle structure
 *  @param enable         enable/disable
 *
 *  @return               MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, otherwise fail
 */
@brief Set auto arp resp
@param handle         A pointer to moal_handle structure
@param enable         enable/disable


@brief Set auto arp resp @param handle A pointer to moal_handle structure @param enable enable / disable
static mlan_status
woal_set_auto_arp(moal_handle *handle, t_u8 enable)
{
	mlan_status ret = MLAN_STATUS_SUCCESS;
	int i = 0;
	moal_private *priv = NULL;
	mlan_ds_misc_cfg *misc = NULL;
	mlan_ioctl_req *req = NULL;
	mlan_ds_misc_ipaddr_cfg ipaddr_cfg;
	ENTER();
	memset(&ipaddr_cfg, 0, sizeof(ipaddr_cfg));
	for (i = 0; i < handle->priv_num && (priv = handle->priv[i]); i++) {
		if (priv && priv->ip_addr_type != IPADDR_TYPE_NONE) {
			memcpy(ipaddr_cfg.ip_addr[ipaddr_cfg.ip_addr_num],
			       priv->ip_addr, IPADDR_LEN);
			ipaddr_cfg.ip_addr_num++;
		}
	}
	if (ipaddr_cfg.ip_addr_num == 0) {
		PRINTM(MIOCTL, "No IP addr configured.\n");
		goto done;
	}
	req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg));
	if (req == NULL) {
		PRINTM(MIOCTL, "IOCTL req allocated failed!\n");
		ret = MLAN_STATUS_FAILURE;
		goto done;
	}
	misc = (mlan_ds_misc_cfg *)req->pbuf;
	misc->sub_command = MLAN_OID_MISC_IP_ADDR;
	req->req_id = MLAN_IOCTL_MISC_CFG;
	req->action = MLAN_ACT_SET;
	memcpy(&misc->param.ipaddr_cfg, &ipaddr_cfg, sizeof(ipaddr_cfg));
	if (enable) {
		misc->param.ipaddr_cfg.op_code = MLAN_IPADDR_OP_ARP_FILTER |
			MLAN_IPADDR_OP_AUTO_ARP_RESP;
		misc->param.ipaddr_cfg.ip_addr_type = IPADDR_TYPE_IPV4;
	} else {
		misc->param.ipaddr_cfg.op_code = MLAN_IPADDR_OP_IP_REMOVE;
	}
	ret = woal_request_ioctl(woal_get_priv(handle, MLAN_BSS_ROLE_ANY), req,
				 MOAL_NO_WAIT);
	if (ret != MLAN_STATUS_SUCCESS && ret != MLAN_STATUS_PENDING)
		PRINTM(MIOCTL, "Set auto arp IOCTL failed!\n");
done:
	if (ret != MLAN_STATUS_PENDING)
		kfree(req);
	LEAVE();
	return ret;
}
static mlan_status woal_set_auto_arp ( moal_handle * handle , t_u8 enable ) { mlan_status ret = MLAN_STATUS_SUCCESS ; int i = 0 ; moal_private * priv = NULL ; mlan_ds_misc_cfg * misc = NULL ; mlan_ioctl_req * req = NULL ; mlan_ds_misc_ipaddr_cfg ipaddr_cfg ; ENTER ( ) ; memset ( & ipaddr_cfg , 0 , sizeof ( ipaddr_cfg ) ) ; for ( i = 0 ; i < handle -> priv_num && ( priv = handle -> priv [ i ] ) ; i ++ ) { if ( priv && priv -> ip_addr_type != IPADDR_TYPE_NONE ) { memcpy ( ipaddr_cfg . ip_addr [ ipaddr_cfg . ip_addr_num ] , priv -> ip_addr , IPADDR_LEN ) ; ipaddr_cfg . ip_addr_num ++ ; } } if ( ipaddr_cfg . ip_addr_num == 0 ) { PRINTM ( MIOCTL , " \n " ) ; goto done ; } req = woal_alloc_mlan_ioctl_req ( sizeof ( mlan_ds_misc_cfg ) ) ; if ( req == NULL ) { PRINTM ( MIOCTL , " \n " ) ; ret = MLAN_STATUS_FAILURE ; goto done ; } misc = ( mlan_ds_misc_cfg * ) req -> pbuf ; misc -> sub_command = MLAN_OID_MISC_IP_ADDR ; req -> req_id = MLAN_IOCTL_MISC_CFG ; req -> action = MLAN_ACT_SET ; memcpy ( & misc -> param . ipaddr_cfg , & ipaddr_cfg , sizeof ( ipaddr_cfg ) ) ; if ( enable ) { misc -> param . ipaddr_cfg . op_code = MLAN_IPADDR_OP_ARP_FILTER | MLAN_IPADDR_OP_AUTO_ARP_RESP ; misc -> param . ipaddr_cfg . ip_addr_type = IPADDR_TYPE_IPV4 ; } else { misc -> param . ipaddr_cfg . op_code = MLAN_IPADDR_OP_IP_REMOVE ; } ret = woal_request_ioctl ( woal_get_priv ( handle , MLAN_BSS_ROLE_ANY ) , req , MOAL_NO_WAIT ) ; if ( ret != MLAN_STATUS_SUCCESS && ret != MLAN_STATUS_PENDING ) PRINTM ( MIOCTL , " \n " ) ; done : if ( ret != MLAN_STATUS_PENDING ) kfree ( req ) ; LEAVE ( ) ; return ret ; }
@brief Set auto arp resp
  @param handle         A pointer to moal_handle structure
  @param enable         enable/disable
@brief Set auto arp resp @param handle A pointer to moal_handle structure @param enable enable / disable
/** remove ip */