[PATCH] Remove redundant parameters from config_sta

Eugene Krasnikov k.eugene.e at gmail.com
Fri Jul 12 11:40:01 EDT 2013


Sorry for spamming but this is last patch for today ;)

2013/7/12 Eugene Krasnikov <k.eugene.e at gmail.com>:
> vif and sta already contains bssid address and address
> of the station that is trying to connect to bss.
>
> Signed-off-by: Eugene Krasnikov <k.eugene.e at gmail.com>
> ---
>  main.c |  5 ++---
>  smd.c  | 23 ++++++++++++++++-------
>  smd.h  |  3 +--
>  3 files changed, 19 insertions(+), 12 deletions(-)
>
> diff --git a/main.c b/main.c
> index 0c578bb..121eedd 100644
> --- a/main.c
> +++ b/main.c
> @@ -569,8 +569,7 @@ 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, sta, bss_conf->bssid,
> -                                              vif->addr);
> +                       wcn36xx_smd_config_sta(wcn, vif, sta);
>                         rcu_read_unlock();
>                 } else {
>                         wcn36xx_dbg(WCN36XX_DBG_MAC,
> @@ -688,7 +687,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, sta, vif->addr, sta->addr);
> +               wcn36xx_smd_config_sta(wcn, vif, sta);
>         }
>         return 0;
>  }
> diff --git a/smd.c b/smd.c
> index ae68679..de8a10f 100644
> --- a/smd.c
> +++ b/smd.c
> @@ -47,9 +47,22 @@ static void wcn36xx_smd_set_sta_ht_params(struct ieee80211_sta *sta,
>         }
>  }
>
> -static void wcn36xx_smd_set_sta_params(struct ieee80211_sta *sta,
> +static void wcn36xx_smd_set_sta_params(struct ieee80211_vif *vif,
> +                                      struct ieee80211_sta *sta,
>                 struct wcn36xx_hal_config_sta_params *sta_params)
>  {
> +       /*
> +        * In STA mode ieee80211_sta contains bssid and ieee80211_vif contains
> +        * our mac address. In  AP mode we are bssid so vif contains bssid and
> +        * ieee80211_sta contains mac.
> +        */
> +       if (NL80211_IFTYPE_STATION == vif->type) {
> +               memcpy(&sta_params->bssid, sta->addr, ETH_ALEN);
> +               memcpy(&sta_params->mac, vif->addr, ETH_ALEN);
> +       } else {
> +               memcpy(&sta_params->bssid, vif->addr, ETH_ALEN);
> +               memcpy(&sta_params->mac, sta->addr, ETH_ALEN);
> +       }
>         if (sta) {
>                 sta_params->wmm_enabled = sta->wme;
>                 sta_params->max_sp_len = sta->max_sp;
> @@ -537,8 +550,7 @@ static int wcn36xx_smd_config_sta_v1(struct wcn36xx *wcn,
>  }
>
>  int wcn36xx_smd_config_sta(struct wcn36xx *wcn, struct ieee80211_vif *vif,
> -                          struct ieee80211_sta *sta, const u8 *bssid,
> -                          const u8 *sta_mac)
> +                          struct ieee80211_sta *sta)
>  {
>         struct wcn36xx_hal_config_sta_req_msg msg;
>         struct wcn36xx_hal_config_sta_params *sta_params;
> @@ -547,8 +559,6 @@ int wcn36xx_smd_config_sta(struct wcn36xx *wcn, struct ieee80211_vif *vif,
>
>         sta_params = &msg.sta_params;
>
> -       memcpy(&sta_params->bssid, bssid, ETH_ALEN);
> -
>         sta_params->aid = wcn->aid;
>
>         if (vif->type == NL80211_IFTYPE_ADHOC ||
> @@ -560,8 +570,7 @@ 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);
> +       wcn36xx_smd_set_sta_params(vif, sta, sta_params);
>         sta_params->listen_interval = 0x8;
>         sta_params->rifs_mode = 0;
>
> diff --git a/smd.h b/smd.h
> index dacb37c..2bd700e 100644
> --- a/smd.h
> +++ b/smd.h
> @@ -66,8 +66,7 @@ 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,
> -                          struct ieee80211_sta *sta, const u8 *bssid,
> -                          const u8 *sta_mac);
> +                          struct ieee80211_sta *sta);
>  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