示例#1
0
void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata,
				     struct ieee80211_sta_ht_cap *ht_cap)
{
	u8 *scaps = (u8 *)(&sdata->u.mgd.ht_capa.mcs.rx_mask);
	u8 *smask = (u8 *)(&sdata->u.mgd.ht_capa_mask.mcs.rx_mask);
	int i;

	if (sdata->vif.type != NL80211_IFTYPE_STATION) {
		/* AP interfaces call this code when adding new stations,
		 * so just silently ignore non station interfaces.
		 */
		return;
	}

	/* NOTE:  If you add more over-rides here, update register_hw
	 * ht_capa_mod_msk logic in main.c as well.
	 * And, if this method can ever change ht_cap.ht_supported, fix
	 * the check in ieee80211_add_ht_ie.
	 */

	/* check for HT over-rides, MCS rates first. */
	for (i = 0; i < IEEE80211_HT_MCS_MASK_LEN; i++) {
		u8 m = smask[i];
		ht_cap->mcs.rx_mask[i] &= ~m; /* turn off all masked bits */
		/* Add back rates that are supported */
		ht_cap->mcs.rx_mask[i] |= (m & scaps[i]);
	}

	/* Force removal of HT-40 capabilities? */
	__check_htcap_disable(sdata, ht_cap, IEEE80211_HT_CAP_SUP_WIDTH_20_40);
	__check_htcap_disable(sdata, ht_cap, IEEE80211_HT_CAP_SGI_40);

	/* Allow user to disable SGI-20 (SGI-40 is handled above) */
	__check_htcap_disable(sdata, ht_cap, IEEE80211_HT_CAP_SGI_20);

	/* Allow user to disable the max-AMSDU bit. */
	__check_htcap_disable(sdata, ht_cap, IEEE80211_HT_CAP_MAX_AMSDU);

	/* Allow user to decrease AMPDU factor */
	if (sdata->u.mgd.ht_capa_mask.ampdu_params_info &
	    IEEE80211_HT_AMPDU_PARM_FACTOR) {
		u8 n = sdata->u.mgd.ht_capa.ampdu_params_info
			& IEEE80211_HT_AMPDU_PARM_FACTOR;
		if (n < ht_cap->ampdu_factor)
			ht_cap->ampdu_factor = n;
	}

	/* Allow the user to increase AMPDU density. */
	if (sdata->u.mgd.ht_capa_mask.ampdu_params_info &
	    IEEE80211_HT_AMPDU_PARM_DENSITY) {
		u8 n = (sdata->u.mgd.ht_capa.ampdu_params_info &
			IEEE80211_HT_AMPDU_PARM_DENSITY)
			>> IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT;
		if (n > ht_cap->ampdu_density)
			ht_cap->ampdu_density = n;
	}
示例#2
0
void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata,
				     struct ieee80211_sta_ht_cap *ht_cap)
{
	u8 *scaps = (u8 *)(&sdata->u.mgd.ht_capa.mcs.rx_mask);
	u8 *smask = (u8 *)(&sdata->u.mgd.ht_capa_mask.mcs.rx_mask);
	int i;

	if (sdata->vif.type != NL80211_IFTYPE_STATION) {
		return;
	}


	
	for (i = 0; i < IEEE80211_HT_MCS_MASK_LEN; i++) {
		u8 m = smask[i];
		ht_cap->mcs.rx_mask[i] &= ~m; 
		
		ht_cap->mcs.rx_mask[i] |= (m & scaps[i]);
	}

	
	__check_htcap_disable(sdata, ht_cap, IEEE80211_HT_CAP_SUP_WIDTH_20_40);
	__check_htcap_disable(sdata, ht_cap, IEEE80211_HT_CAP_SGI_40);

	
	__check_htcap_disable(sdata, ht_cap, IEEE80211_HT_CAP_MAX_AMSDU);

	
	if (sdata->u.mgd.ht_capa_mask.ampdu_params_info &
	    IEEE80211_HT_AMPDU_PARM_FACTOR) {
		u8 n = sdata->u.mgd.ht_capa.ampdu_params_info
			& IEEE80211_HT_AMPDU_PARM_FACTOR;
		if (n < ht_cap->ampdu_factor)
			ht_cap->ampdu_factor = n;
	}

	
	if (sdata->u.mgd.ht_capa_mask.ampdu_params_info &
	    IEEE80211_HT_AMPDU_PARM_DENSITY) {
		u8 n = (sdata->u.mgd.ht_capa.ampdu_params_info &
			IEEE80211_HT_AMPDU_PARM_DENSITY)
			>> IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT;
		if (n > ht_cap->ampdu_density)
			ht_cap->ampdu_density = n;
	}
示例#3
0
void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata,
                                     struct ieee80211_sta_ht_cap *ht_cap)
{
    struct ieee80211_ht_cap *ht_capa, *ht_capa_mask;
    u8 *scaps, *smask;
    int i;

    if (!ht_cap->ht_supported)
        return;

    switch (sdata->vif.type) {
    case NL80211_IFTYPE_STATION:
        ht_capa = &sdata->u.mgd.ht_capa;
        ht_capa_mask = &sdata->u.mgd.ht_capa_mask;
        break;
    case NL80211_IFTYPE_ADHOC:
        ht_capa = &sdata->u.ibss.ht_capa;
        ht_capa_mask = &sdata->u.ibss.ht_capa_mask;
        break;
    default:
        WARN_ON_ONCE(1);
        return;
    }

    scaps = (u8 *)(&ht_capa->mcs.rx_mask);
    smask = (u8 *)(&ht_capa_mask->mcs.rx_mask);

    /* NOTE:  If you add more over-rides here, update register_hw
     * ht_capa_mod_msk logic in main.c as well.
     * And, if this method can ever change ht_cap.ht_supported, fix
     * the check in ieee80211_add_ht_ie.
     */

    /* check for HT over-rides, MCS rates first. */
    for (i = 0; i < IEEE80211_HT_MCS_MASK_LEN; i++) {
        u8 m = smask[i];
        ht_cap->mcs.rx_mask[i] &= ~m; /* turn off all masked bits */
        /* Add back rates that are supported */
        ht_cap->mcs.rx_mask[i] |= (m & scaps[i]);
    }

    /* Force removal of HT-40 capabilities? */
    __check_htcap_disable(ht_capa, ht_capa_mask, ht_cap,
                          IEEE80211_HT_CAP_SUP_WIDTH_20_40);
    __check_htcap_disable(ht_capa, ht_capa_mask, ht_cap,
                          IEEE80211_HT_CAP_SGI_40);

    /* Allow user to disable SGI-20 (SGI-40 is handled above) */
    __check_htcap_disable(ht_capa, ht_capa_mask, ht_cap,
                          IEEE80211_HT_CAP_SGI_20);

    /* Allow user to disable the max-AMSDU bit. */
    __check_htcap_disable(ht_capa, ht_capa_mask, ht_cap,
                          IEEE80211_HT_CAP_MAX_AMSDU);

    /* Allow user to decrease AMPDU factor */
    if (ht_capa_mask->ampdu_params_info &
            IEEE80211_HT_AMPDU_PARM_FACTOR) {
        u8 n = ht_capa->ampdu_params_info &
               IEEE80211_HT_AMPDU_PARM_FACTOR;
        if (n < ht_cap->ampdu_factor)
            ht_cap->ampdu_factor = n;
    }

    /* Allow the user to increase AMPDU density. */
    if (ht_capa_mask->ampdu_params_info &
            IEEE80211_HT_AMPDU_PARM_DENSITY) {
        u8 n = (ht_capa->ampdu_params_info &
                IEEE80211_HT_AMPDU_PARM_DENSITY)
               >> IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT;
        if (n > ht_cap->ampdu_density)
            ht_cap->ampdu_density = n;
    }