[PATCH] Set HT caps in config_sta

Eugene Krasnikov k.eugene.e at gmail.com
Fri Jul 12 10:58:46 EDT 2013


https://github.com/KrasnikovEugene/wcn36xx/pull/82

2013/7/12 Eugene Krasnikov <k.eugene.e at gmail.com>:
> Configure HW with correct high throughput capabilities in config_sta.
>
> Signed-off-by: Eugene Krasnikov <k.eugene.e at gmail.com>
> ---
>  main.c |  8 ++++----
>  smd.c  | 56 +++++++++++++++++++++++++++++++++++++++++---------------
>  smd.h  |  3 ++-
>  3 files changed, 47 insertions(+), 20 deletions(-)
>
> diff --git a/main.c b/main.c
> index 872a993..0c578bb 100644
> --- a/main.c
> +++ b/main.c
> @@ -561,7 +561,7 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw *hw,
>                         sta = ieee80211_find_sta(vif, bss_conf->bssid);
>                         if(sta)
>                                 wcn36xx_update_allowed_rates(wcn, sta);
> -                       rcu_read_unlock();
> +
>
>                         wcn36xx_smd_set_link_st(wcn, bss_conf->bssid,
>                                                 vif->addr,
> @@ -569,9 +569,9 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw *hw,
>                         wcn36xx_smd_config_bss(wcn, vif,
>                                                bss_conf->bssid,
>                                                true, wcn->beacon_interval);
> -                       wcn36xx_smd_config_sta(wcn, vif, bss_conf->bssid,
> +                       wcn36xx_smd_config_sta(wcn, vif, sta, bss_conf->bssid,
>                                                vif->addr);
> -
> +                       rcu_read_unlock();
>                 } else {
>                         wcn36xx_dbg(WCN36XX_DBG_MAC,
>                                     "disassociated bss %pM vif %pM AID=%d",
> @@ -688,7 +688,7 @@ static int wcn36xx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
>             vif->type == NL80211_IFTYPE_AP ||
>             vif->type == NL80211_IFTYPE_MESH_POINT) {
>                 wcn->aid = sta->aid;
> -               wcn36xx_smd_config_sta(wcn, vif, vif->addr, sta->addr);
> +               wcn36xx_smd_config_sta(wcn, vif, sta, vif->addr, sta->addr);
>         }
>         return 0;
>  }
> diff --git a/smd.c b/smd.c
> index 3838b13..ae68679 100644
> --- a/smd.c
> +++ b/smd.c
> @@ -16,8 +16,46 @@
>
>  #include <linux/etherdevice.h>
>  #include <linux/firmware.h>
> +#include <linux/bitops.h>
>  #include "smd.h"
>
> +static void wcn36xx_smd_set_sta_ht_params(struct ieee80211_sta *sta,
> +               struct wcn36xx_hal_config_sta_params *sta_params)
> +{
> +       if (sta->ht_cap.ht_supported) {
> +               unsigned long caps = sta->ht_cap.cap;
> +               sta_params->ht_capable = sta->ht_cap.ht_supported;
> +               sta_params->tx_channel_width_set =
> +                       test_bit(IEEE80211_HT_CAP_SUP_WIDTH_20_40, &caps);
> +               sta_params->lsig_txop_protection =
> +                       test_bit(IEEE80211_HT_CAP_LSIG_TXOP_PROT, &caps);
> +
> +               sta_params->max_ampdu_size = sta->ht_cap.ampdu_factor;
> +               sta_params->max_ampdu_density = sta->ht_cap.ampdu_density;
> +               sta_params->max_amsdu_size =
> +                       test_bit(IEEE80211_HT_CAP_MAX_AMSDU, &caps);
> +               sta_params->sgi_20Mhz =
> +                       test_bit(IEEE80211_HT_CAP_SGI_20, &caps);
> +               sta_params->sgi_40mhz =
> +                       test_bit(IEEE80211_HT_CAP_SGI_40, &caps);
> +               sta_params->green_field_capable =
> +                       test_bit(IEEE80211_HT_CAP_GRN_FLD, &caps);
> +               sta_params->delayed_ba_support =
> +                       test_bit(IEEE80211_HT_CAP_DELAY_BA, &caps);
> +               sta_params->dsss_cck_mode_40mhz =
> +                       test_bit(IEEE80211_HT_CAP_DSSSCCK40, &caps);
> +       }
> +}
> +
> +static void wcn36xx_smd_set_sta_params(struct ieee80211_sta *sta,
> +               struct wcn36xx_hal_config_sta_params *sta_params)
> +{
> +       if (sta) {
> +               sta_params->wmm_enabled = sta->wme;
> +               sta_params->max_sp_len = sta->max_sp;
> +               wcn36xx_smd_set_sta_ht_params(sta, sta_params);
> +       }
> +}
>  static int wcn36xx_smd_send_and_wait(struct wcn36xx *wcn, size_t len)
>  {
>         int avail;
> @@ -499,7 +537,8 @@ static int wcn36xx_smd_config_sta_v1(struct wcn36xx *wcn,
>  }
>
>  int wcn36xx_smd_config_sta(struct wcn36xx *wcn, struct ieee80211_vif *vif,
> -                          const u8 *bssid, const u8 *sta_mac)
> +                          struct ieee80211_sta *sta, const u8 *bssid,
> +                          const u8 *sta_mac)
>  {
>         struct wcn36xx_hal_config_sta_req_msg msg;
>         struct wcn36xx_hal_config_sta_params *sta_params;
> @@ -522,18 +561,9 @@ int wcn36xx_smd_config_sta(struct wcn36xx *wcn, struct ieee80211_vif *vif,
>         sta_params->short_preamble_supported = 0;
>
>         memcpy(&sta_params->mac, sta_mac, ETH_ALEN);
> -
> +       wcn36xx_smd_set_sta_params(sta, sta_params);
>         sta_params->listen_interval = 0x8;
> -       sta_params->wmm_enabled = 0;
> -       sta_params->ht_capable =
> -               wcn->supported_rates.supported_mcs_set[0] ? 1 : 0;
> -       sta_params->tx_channel_width_set = 0;
>         sta_params->rifs_mode = 0;
> -       sta_params->lsig_txop_protection = 0;
> -       sta_params->max_ampdu_size = 0;
> -       sta_params->max_ampdu_density = 0;
> -       sta_params->sgi_40mhz = 0;
> -       sta_params->sgi_20Mhz = 0;
>
>         memcpy(&sta_params->supported_rates, &wcn->supported_rates,
>                 sizeof(wcn->supported_rates));
> @@ -542,12 +572,8 @@ int wcn36xx_smd_config_sta(struct wcn36xx *wcn, struct ieee80211_vif *vif,
>         sta_params->encrypt_type = 0;
>         sta_params->action = 0;
>         sta_params->uapsd = 0;
> -       sta_params->max_sp_len = 0;
> -       sta_params->green_field_capable = 0;
>         sta_params->mimo_ps = WCN36XX_HAL_HT_MIMO_PS_STATIC;
> -       sta_params->delayed_ba_support = 0;
>         sta_params->max_ampdu_duration = 0;
> -       sta_params->dsss_cck_mode_40mhz = 0;
>         if (vif->type == NL80211_IFTYPE_ADHOC ||
>             vif->type == NL80211_IFTYPE_AP ||
>             vif->type == NL80211_IFTYPE_MESH_POINT)
> diff --git a/smd.h b/smd.h
> index e7ee5be..dacb37c 100644
> --- a/smd.h
> +++ b/smd.h
> @@ -66,7 +66,8 @@ int wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif,
>                            const u8 *bssid, bool update, u16 beacon_interval);
>  int wcn36xx_smd_delete_bss(struct wcn36xx *wcn);
>  int wcn36xx_smd_config_sta(struct wcn36xx *wcn, struct ieee80211_vif *vif,
> -                          const u8 *bssid, const u8 *sta_mac);
> +                          struct ieee80211_sta *sta, const u8 *bssid,
> +                          const u8 *sta_mac);
>  int wcn36xx_smd_send_beacon(struct wcn36xx *wcn, struct sk_buff *skb_beacon,
>                             u16 tim_off, u16 p2p_off);
>  int wcn36xx_smd_switch_channel(struct wcn36xx *wcn, int ch);
> --
> 1.7.11.3
>



-- 
Best regards,
Eugene



More information about the wcn36xx mailing list