Пример #1
0
/**
 *  @brief This function handles domain info data from UAP interface.
 *         Checks conditions, sets up domain_reg, then downloads CMD.
 *
 *  @param pmpriv       A pointer to mlan_private structure
 *  @param band         Band interface is operating on
 *  @param domain_tlv   Pointer to domain_info tlv
 *  @param pioctl_buf   Pointer to the IOCTL buffer
 *
 *  @return             MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
 */
mlan_status
wlan_11d_handle_uap_domain_info(mlan_private * pmpriv,
                                t_u8 band,
                                t_u8 * domain_tlv, t_void * pioctl_buf)
{
    mlan_status ret = MLAN_STATUS_SUCCESS;
    mlan_adapter *pmadapter = pmpriv->adapter;
    MrvlIEtypes_DomainParamSet_t *pdomain_tlv;
    t_u8 num_sub_band = 0;
    t_u8 region_code = 0;

    ENTER();

    pdomain_tlv = (MrvlIEtypes_DomainParamSet_t *) domain_tlv;

    // update region code & table based on country string
    if (wlan_11d_region_2_code(pmadapter, pdomain_tlv->country_code,
                               &region_code) == MLAN_STATUS_SUCCESS) {
        pmadapter->region_code = region_code;
        ret = wlan_set_regiontable(pmpriv, region_code, pmadapter->fw_bands);
    }

    num_sub_band = ((pdomain_tlv->header.len - COUNTRY_CODE_LEN) /
                    sizeof(IEEEtypes_SubbandSet_t));

    // TODO: don't just clobber pmadapter->domain_reg.
    // Add some checking or merging between STA & UAP domain_info

    wlan_11d_set_domain_info(pmpriv, band, pdomain_tlv->country_code,
                             num_sub_band, pdomain_tlv->sub_band);
    ret = wlan_11d_send_domain_info(pmpriv, pioctl_buf);

    LEAVE();
    return ret;
}
Пример #2
0
/** 
 *  @brief This function handles the command response of get_hw_spec
 *  
 *  @param priv    A pointer to wlan_private structure
 *  @param resp	   A pointer to HostCmd_DS_COMMAND
 *  @return 	   WLAN_STATUS_SUCCESS or WLAN_STATUS_FAILURE
 */
static int wlan_ret_get_hw_spec(WlanCard *cardinfo, HostCmd_DS_COMMAND * resp)
{
	u32 i;
	HostCmd_DS_GET_HW_SPEC *hwspec = &resp->params.hwspec;
	WlanCard *card = cardinfo;
	int ret = WLAN_STATUS_SUCCESS;

	card->fwCapInfo = hwspec->fwCapInfo;

	card->RegionCode = hwspec->RegionCode;
	WlanDebug(WlanMsg,"RegionCode %x,set 0x10",card->RegionCode);
	card->RegionCode = 0x10;
	for (i = 0; i < MRVDRV_MAX_REGION_CODE; i++)
	{
		/* use the region code to search for the index */
		if (card->RegionCode == RegionCodeToIndex[i])
		{
			break;
		}
	}

	/* if it's unidentified region code, use the default (USA) */
	if (i >= MRVDRV_MAX_REGION_CODE)
	{
		card->RegionCode = 0x10;
		WlanDebug(WlanMsg,"unidentified region code, use the default (USA)\n");
	}

	if (card->MyMacAddress[0] == 0xff)
	{
		rt_memmove(card->MyMacAddress, hwspec->PermanentAddr, ETH_ALEN);
		hexdump("default Mac address:", card->MyMacAddress, ETH_ALEN);
	}

	/* firmware release number */
	WlanDebug(WlanMsg, "FW release number: 0x%08x\n", hwspec->FWReleaseNumber);
	WlanDebug(WlanMsg, "HW version: 0x%08x\n", hwspec->Version);

	if (wlan_set_regiontable(card, card->RegionCode, 0))
	{
		ret = WLAN_STATUS_FAILURE;
		goto done;
	}

	if (wlan_set_universaltable(card, 0))
	{
		ret = WLAN_STATUS_FAILURE;
		goto done;
	}

done: 
    return ret;
}
Пример #3
0
/**
 *  @brief This function sets up domain_reg and downloads CMD to FW
 *
 *  @param pmadapter    A pointer to mlan_adapter structure
 *  @param pioctl_req   Pointer to the IOCTL request buffer
 *
 *  @return             MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
 */
mlan_status
wlan_11d_cfg_domain_info(IN pmlan_adapter pmadapter,
			 IN mlan_ioctl_req * pioctl_req)
{
	mlan_status ret = MLAN_STATUS_SUCCESS;
	mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index];
	mlan_ds_11d_domain_info *domain_info = MNULL;
	mlan_ds_11d_cfg *cfg_11d = MNULL;
	t_u8 cfp_bg = 0, cfp_a = 0;

	ENTER();

	cfg_11d = (mlan_ds_11d_cfg *) pioctl_req->pbuf;
	domain_info = &cfg_11d->param.domain_info;
	memcpy(pmadapter, pmadapter->country_code, domain_info->country_code,
	       COUNTRY_CODE_LEN);
	wlan_11d_set_domain_info(pmpriv, domain_info->band,
				 domain_info->country_code,
				 domain_info->no_of_sub_band,
				 (IEEEtypes_SubbandSet_t *) domain_info->
				 sub_band);
	ret = wlan_11d_send_domain_info(pmpriv, pioctl_req);

	if (ret == MLAN_STATUS_SUCCESS)
		ret = MLAN_STATUS_PENDING;

	/* Update region code and table based on country code */
	if (wlan_misc_country_2_cfp_table_code(pmadapter,
					       domain_info->country_code,
					       &cfp_bg, &cfp_a)) {
		PRINTM(MIOCTL, "Country code %c%c not found!\n",
		       domain_info->country_code[0],
		       domain_info->country_code[1]);
		goto done;
	}
	pmadapter->cfp_code_bg = cfp_bg;
	pmadapter->cfp_code_a = cfp_a;
	if (cfp_bg && cfp_a && (cfp_bg == cfp_a))
		pmadapter->region_code = cfp_a;
	else
		pmadapter->region_code = 0;
	if (wlan_set_regiontable(pmpriv, pmadapter->region_code,
				 pmadapter->config_bands | pmadapter->
				 adhoc_start_band)) {
		PRINTM(MIOCTL, "Fail to set regiontabl\n");
		goto done;
	}
done:
	LEAVE();
	return ret;
}
Пример #4
0
/**
 *  @brief This function handles domain info data from UAP interface.
 *         Checks conditions, sets up domain_reg, then downloads CMD.
 *
 *  @param pmpriv       A pointer to mlan_private structure
 *  @param band         Band interface is operating on
 *  @param domain_tlv   Pointer to domain_info tlv
 *  @param pioctl_buf   Pointer to the IOCTL buffer
 *
 *  @return             MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
 */
mlan_status
wlan_11d_handle_uap_domain_info(mlan_private * pmpriv,
				t_u8 band,
				t_u8 * domain_tlv, t_void * pioctl_buf)
{
	mlan_status ret = MLAN_STATUS_SUCCESS;
	mlan_adapter *pmadapter = pmpriv->adapter;
	MrvlIEtypes_DomainParamSet_t *pdomain_tlv;
	t_u8 num_sub_band = 0;
	t_u8 cfp_bg = 0, cfp_a = 0;

	ENTER();

	pdomain_tlv = (MrvlIEtypes_DomainParamSet_t *) domain_tlv;

	/* update region code & table based on country string */
	if (wlan_misc_country_2_cfp_table_code(pmadapter,
					       pdomain_tlv->country_code,
					       &cfp_bg,
					       &cfp_a) == MLAN_STATUS_SUCCESS) {
		pmadapter->cfp_code_bg = cfp_bg;
		pmadapter->cfp_code_a = cfp_a;
		if (cfp_bg && cfp_a && (cfp_bg == cfp_a))
			pmadapter->region_code = cfp_a;
		else
			pmadapter->region_code = 0;
		if (wlan_set_regiontable(pmpriv, pmadapter->region_code,
					 pmadapter->config_bands | pmadapter->
					 adhoc_start_band)) {
			ret = MLAN_STATUS_FAILURE;
			goto done;
		}
	}

	memcpy(pmadapter, pmadapter->country_code, pdomain_tlv->country_code,
	       COUNTRY_CODE_LEN);
	num_sub_band =
		((pdomain_tlv->header.len -
		  COUNTRY_CODE_LEN) / sizeof(IEEEtypes_SubbandSet_t));

	/* TODO: don't just clobber pmadapter->domain_reg.  Add some checking
	   or merging between STA & UAP domain_info */
	wlan_11d_set_domain_info(pmpriv, band, pdomain_tlv->country_code,
				 num_sub_band, pdomain_tlv->sub_band);
	ret = wlan_11d_send_domain_info(pmpriv, pioctl_buf);

done:
	LEAVE();
	return ret;
}