software/drivers/sd8887/src/wlan/mlan/mlan_uap_cmdevent.c
/**
 *  @brief This function handles the command response error
 *
 *  @param pmpriv       A pointer to mlan_private structure
 *  @param resp         A pointer to HostCmd_DS_COMMAND
 *  @param pioctl_buf   A pointer to command buffer
 *
 *  @return             N/A
 */
@brief This function handles the command response error
@param pmpriv       A pointer to mlan_private structure
@param resp         A pointer to HostCmd_DS_COMMAND
@param pioctl_buf   A pointer to command buffer

@return             N/A
@brief This function handles the command response error @param pmpriv A pointer to mlan_private structure @param resp A pointer to HostCmd_DS_COMMAND @param pioctl_buf A pointer to command buffer @return N / A
static mlan_status
uap_process_cmdresp_error(mlan_private *pmpriv, HostCmd_DS_COMMAND *resp,
			  mlan_ioctl_req *pioctl_buf)
{
	mlan_adapter *pmadapter = pmpriv->adapter;
	mlan_status ret = MLAN_STATUS_FAILURE;
	ENTER();
	if (resp->command != HostCmd_CMD_WMM_PARAM_CONFIG
	    || resp->command != HostCmd_CMD_CHAN_REGION_CFG)
		PRINTM(MERROR, "CMD_RESP: cmd %#x error, result=%#x\n",
		       resp->command, resp->result);
	if (pioctl_buf)
		pioctl_buf->status_code = resp->result;
	switch (resp->command) {
	case HostCmd_CMD_SDIO_SP_RX_AGGR_CFG:
		pmadapter->sdio_rx_aggr_enable = MFALSE;
		PRINTM(MMSG, "FW don't support SDIO single port rx aggr\n");
		break;
	case HOST_CMD_APCMD_SYS_CONFIGURE:
		{
			HostCmd_DS_SYS_CONFIG *sys_config =
				(HostCmd_DS_SYS_CONFIG *)&resp->params.
				sys_config;
			t_u16 resp_len = 0, travel_len = 0, index;
			mlan_ds_misc_custom_ie *cust_ie = MNULL;
			mlan_ds_misc_cfg *misc = MNULL;
			custom_ie *cptr;
			if (!pioctl_buf ||
			    (pioctl_buf->req_id != MLAN_IOCTL_MISC_CFG))
				break;
			misc = (mlan_ds_misc_cfg *)pioctl_buf->pbuf;
			if ((pioctl_buf->action == MLAN_ACT_SET) &&
			    (misc->sub_command == MLAN_OID_MISC_CUSTOM_IE)) {
				cust_ie =
					(mlan_ds_misc_custom_ie *)sys_config->
					tlv_buffer;
				if (cust_ie) {
					cust_ie->type =
						wlan_le16_to_cpu(cust_ie->type);
					resp_len = cust_ie->len =
						wlan_le16_to_cpu(cust_ie->len);
					travel_len = 0;
					if (resp_len == sizeof(t_u16))
						cust_ie->ie_data_list[0].
							ie_index =
							wlan_cpu_to_le16
							(cust_ie->
							 ie_data_list[0].
							 ie_index);
					while (resp_len > sizeof(t_u16)) {
						cptr = (custom_ie
							*)(((t_u8 *)cust_ie->
							    ie_data_list) +
							   travel_len);
						index = cptr->ie_index =
							wlan_le16_to_cpu(cptr->
									 ie_index);
						cptr->mgmt_subtype_mask =
							wlan_le16_to_cpu(cptr->
									 mgmt_subtype_mask);
						cptr->ie_length =
							wlan_le16_to_cpu(cptr->
									 ie_length);
						travel_len +=
							cptr->ie_length +
							sizeof(custom_ie) -
							MAX_IE_SIZE;
						resp_len -=
							cptr->ie_length +
							sizeof(custom_ie) -
							MAX_IE_SIZE;
						if ((pmpriv->mgmt_ie[index].
						     mgmt_subtype_mask ==
						     cptr->mgmt_subtype_mask) &&
						    (pmpriv->mgmt_ie[index].
						     ie_length ==
						     cptr->ie_length) &&
						    !memcmp(pmpriv->adapter,
							    pmpriv->
							    mgmt_ie[index].
							    ie_buffer,
							    cptr->ie_buffer,
							    cptr->ie_length)) {
							PRINTM(MERROR,
							       "set custom ie fail, remove ie index :%d\n",
							       index);
							memset(pmadapter,
							       &pmpriv->
							       mgmt_ie[index],
							       0,
							       sizeof
							       (custom_ie));
						}
					}
				}
			}
		}
		break;
	case HostCmd_CMD_CHAN_REGION_CFG:
		ret = MLAN_STATUS_SUCCESS;
		PRINTM(MCMND, "FW don't support chan region cfg command!\n");
		break;
	default:
		break;
	}
	wlan_request_cmd_lock(pmadapter);
	wlan_insert_cmd_to_free_q(pmadapter, pmadapter->curr_cmd);
	pmadapter->curr_cmd = MNULL;
	wlan_release_cmd_lock(pmadapter);
	LEAVE();
	return ret;
}
static mlan_status uap_process_cmdresp_error ( mlan_private * pmpriv , HostCmd_DS_COMMAND * resp , mlan_ioctl_req * pioctl_buf ) { mlan_adapter * pmadapter = pmpriv -> adapter ; mlan_status ret = MLAN_STATUS_FAILURE ; ENTER ( ) ; if ( resp -> command != HostCmd_CMD_WMM_PARAM_CONFIG || resp -> command != HostCmd_CMD_CHAN_REGION_CFG ) PRINTM ( MERROR , " \n " , resp -> command , resp -> result ) ; if ( pioctl_buf ) pioctl_buf -> status_code = resp -> result ; switch ( resp -> command ) { case HostCmd_CMD_SDIO_SP_RX_AGGR_CFG : pmadapter -> sdio_rx_aggr_enable = MFALSE ; PRINTM ( MMSG , " \n " ) ; break ; case HOST_CMD_APCMD_SYS_CONFIGURE : { HostCmd_DS_SYS_CONFIG * sys_config = ( HostCmd_DS_SYS_CONFIG * ) & resp -> params . sys_config ; t_u16 resp_len = 0 , travel_len = 0 , index ; mlan_ds_misc_custom_ie * cust_ie = MNULL ; mlan_ds_misc_cfg * misc = MNULL ; custom_ie * cptr ; if ( ! pioctl_buf || ( pioctl_buf -> req_id != MLAN_IOCTL_MISC_CFG ) ) break ; misc = ( mlan_ds_misc_cfg * ) pioctl_buf -> pbuf ; if ( ( pioctl_buf -> action == MLAN_ACT_SET ) && ( misc -> sub_command == MLAN_OID_MISC_CUSTOM_IE ) ) { cust_ie = ( mlan_ds_misc_custom_ie * ) sys_config -> tlv_buffer ; if ( cust_ie ) { cust_ie -> type = wlan_le16_to_cpu ( cust_ie -> type ) ; resp_len = cust_ie -> len = wlan_le16_to_cpu ( cust_ie -> len ) ; travel_len = 0 ; if ( resp_len == sizeof ( t_u16 ) ) cust_ie -> ie_data_list [ 0 ] . ie_index = wlan_cpu_to_le16 ( cust_ie -> ie_data_list [ 0 ] . ie_index ) ; while ( resp_len > sizeof ( t_u16 ) ) { cptr = ( custom_ie * ) ( ( ( t_u8 * ) cust_ie -> ie_data_list ) + travel_len ) ; index = cptr -> ie_index = wlan_le16_to_cpu ( cptr -> ie_index ) ; cptr -> mgmt_subtype_mask = wlan_le16_to_cpu ( cptr -> mgmt_subtype_mask ) ; cptr -> ie_length = wlan_le16_to_cpu ( cptr -> ie_length ) ; travel_len += cptr -> ie_length + sizeof ( custom_ie ) - MAX_IE_SIZE ; resp_len -= cptr -> ie_length + sizeof ( custom_ie ) - MAX_IE_SIZE ; if ( ( pmpriv -> mgmt_ie [ index ] . mgmt_subtype_mask == cptr -> mgmt_subtype_mask ) && ( pmpriv -> mgmt_ie [ index ] . ie_length == cptr -> ie_length ) && ! memcmp ( pmpriv -> adapter , pmpriv -> mgmt_ie [ index ] . ie_buffer , cptr -> ie_buffer , cptr -> ie_length ) ) { PRINTM ( MERROR , " \n " , index ) ; memset ( pmadapter , & pmpriv -> mgmt_ie [ index ] , 0 , sizeof ( custom_ie ) ) ; } } } } } break ; case HostCmd_CMD_CHAN_REGION_CFG : ret = MLAN_STATUS_SUCCESS ; PRINTM ( MCMND , " \n " ) ; break ; default : break ; } wlan_request_cmd_lock ( pmadapter ) ; wlan_insert_cmd_to_free_q ( pmadapter , pmadapter -> curr_cmd ) ; pmadapter -> curr_cmd = MNULL ; wlan_release_cmd_lock ( pmadapter ) ; LEAVE ( ) ; return ret ; }
@brief This function handles the command response error
  @param pmpriv       A pointer to mlan_private structure
  @param resp         A pointer to HostCmd_DS_COMMAND
  @param pioctl_buf   A pointer to command buffer
@brief This function handles the command response error @param pmpriv A pointer to mlan_private structure @param resp A pointer to HostCmd_DS_COMMAND @param pioctl_buf A pointer to command buffer
/*
	 * Handling errors here
	 */ /* conversion for index, mask, len */