[PATCH 2/4] hal: add support for config sta v1 command

Eugene Krasnikov k.eugene.e at gmail.com
Tue May 21 12:34:02 EDT 2013


Let's have it like this for now, and in future we'll make it more
smart by supporting more than 2 firmwares ;)

2013/5/21 Kalle Valo <kvalo at qca.qualcomm.com>:
> Mako firmware interface (1.3.1.0) needs a bit different
> config sta command. To handle that, create struct
> wcn36xx_hal_config_sta_req_msg_v1 which is to be used with mako firmware.
> wcn36xx will dynamically detect from firmware API version if older (_v1) or
> newer version of the command structure needs to be used.
>
> I implemented it so that we always populate the new structure first and then if
> we detect that older structure is needed we just copy the values from the
> original structure to the v1 structure. That way structure needs to be
> populated only once.
>
> Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>
> ---
>  hal.h |  113 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  smd.c |   44 +++++++++++++++++++++++++
>  2 files changed, 157 insertions(+)
>
> diff --git a/hal.h b/hal.h
> index 47f1880..d2d9b39 100644
> --- a/hal.h
> +++ b/hal.h
> @@ -1166,6 +1166,119 @@ struct wcn36xx_hal_config_sta_req_msg {
>         struct wcn36xx_hal_config_sta_params sta_params;
>  } __packed;
>
> +struct wcn36xx_hal_config_sta_params_v1 {
> +       /* BSSID of STA */
> +       u8 bssid[ETH_ALEN];
> +
> +       /* ASSOC ID, as assigned by UMAC */
> +       u16 aid;
> +
> +       /* STA entry Type: 0 - Self, 1 - Other/Peer, 2 - BSSID, 3 - BCAST */
> +       u8 type;
> +
> +       /* Short Preamble Supported. */
> +       u8 short_preamble_supported;
> +
> +       /* MAC Address of STA */
> +       u8 mac[ETH_ALEN];
> +
> +       /* Listen interval of the STA */
> +       u16 listen_interval;
> +
> +       /* Support for 11e/WMM */
> +       u8 wmm_enabled;
> +
> +       /* 11n HT capable STA */
> +       u8 ht_capable;
> +
> +       /* TX Width Set: 0 - 20 MHz only, 1 - 20/40 MHz */
> +       u8 tx_channel_width_set;
> +
> +       /* RIFS mode 0 - NA, 1 - Allowed */
> +       u8 rifs_mode;
> +
> +       /* L-SIG TXOP Protection mechanism
> +          0 - No Support, 1 - Supported
> +          SG - there is global field */
> +       u8 lsig_txop_protection;
> +
> +       /* Max Ampdu Size supported by STA. TPE programming.
> +          0 : 8k , 1 : 16k, 2 : 32k, 3 : 64k */
> +       u8 max_ampdu_size;
> +
> +       /* Max Ampdu density. Used by RA.  3 : 0~7 : 2^(11nAMPDUdensity -4) */
> +       u8 max_ampdu_density;
> +
> +       /* Max AMSDU size 1 : 3839 bytes, 0 : 7935 bytes */
> +       u8 max_amsdu_size;
> +
> +       /* Short GI support for 40Mhz packets */
> +       u8 sgi_40mhz;
> +
> +       /* Short GI support for 20Mhz packets */
> +       u8 sgi_20Mhz;
> +
> +       /* Robust Management Frame (RMF) enabled/disabled */
> +       u8 rmf;
> +
> +       /* The unicast encryption type in the association */
> +       u32 encrypt_type;
> +
> +       /* HAL should update the existing STA entry, if this flag is set. UMAC
> +          will set this flag in case of RE-ASSOC, where we want to reuse the old
> +          STA ID. 0 = Add, 1 = Update */
> +       u8 action;
> +
> +       /* U-APSD Flags: 1b per AC.  Encoded as follows:
> +          b7 b6 b5 b4 b3 b2 b1 b0 =
> +          X  X  X  X  BE BK VI VO */
> +       u8 uapsd;
> +
> +       /* Max SP Length */
> +       u8 max_sp_len;
> +
> +       /* 11n Green Field preamble support
> +          0 - Not supported, 1 - Supported */
> +       u8 green_field_capable;
> +
> +       /* MIMO Power Save mode */
> +       enum wcn36xx_hal_ht_mimo_state mimo_ps;
> +
> +       /* Delayed BA Support */
> +       u8 delayed_ba_support;
> +
> +       /* Max AMPDU duration in 32us */
> +       u8 max_ampdu_duration;
> +
> +       /* HT STA should set it to 1 if it is enabled in BSS. HT STA should
> +        * set it to 0 if AP does not support it. This indication is sent
> +        * to HAL and HAL uses this flag to pickup up appropriate 40Mhz
> +        * rates. */
> +       u8 dsss_cck_mode_40mhz;
> +
> +       /* Valid STA Idx when action=Update. Set to 0xFF when invalid!
> +        * Retained for backward compalibity with existing HAL code */
> +       u8 sta_index;
> +
> +       /* BSSID of BSS to which station is associated. Set to 0xFF when
> +        * invalid. Retained for backward compalibity with existing HAL
> +        * code */
> +       u8 bssid_index;
> +
> +       u8 p2p;
> +
> +       /* Reserved to align next field on a dword boundary */
> +       u8 reserved;
> +
> +       /* These rates are the intersection of peer and self capabilities. */
> +       struct wcn36xx_hal_supported_rates supported_rates;
> +} __packed;
> +
> +struct wcn36xx_hal_config_sta_req_msg_v1 {
> +       struct wcn36xx_hal_msg_header header;
> +       struct wcn36xx_hal_config_sta_params_v1 sta_params;
> +} __packed;
> +
>  struct config_sta_rsp_params {
>         /* success or failure */
>         u32 status;
> diff --git a/smd.c b/smd.c
> index 6986fe3..daaeb4f 100644
> --- a/smd.c
> +++ b/smd.c
> @@ -344,6 +344,47 @@ int wcn36xx_smd_set_link_st(struct wcn36xx *wcn, u8 *bssid, u8 *sta_mac, enum wc
>         return wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
>  }
>
> +static void wcn36xx_smd_convert_sta_to_v1(struct wcn36xx *wcn,
> +                                         const struct wcn36xx_hal_config_sta_params *orig,
> +                                         struct wcn36xx_hal_config_sta_params_v1 *v1)
> +{
> +       /* convert orig to v1 format */
> +       memcpy(&v1->bssid, orig->bssid, ETH_ALEN);
> +       memcpy(&v1->mac, orig->mac, ETH_ALEN);
> +       v1->aid = orig->aid;
> +       v1->type = orig->type;
> +       v1->listen_interval = orig->listen_interval;
> +       v1->ht_capable = orig->ht_capable;
> +
> +       v1->max_ampdu_size = orig->max_ampdu_size;
> +       v1->max_ampdu_density = orig->max_ampdu_density;
> +       v1->sgi_40mhz = orig->sgi_40mhz;
> +       v1->sgi_20Mhz = orig->sgi_20Mhz;
> +
> +       memcpy(&v1->supported_rates, &orig->supported_rates,
> +              sizeof(orig->supported_rates));
> +       v1->sta_index = orig->sta_index;
> +}
> +
> +static int wcn36xx_smd_config_sta_v1(struct wcn36xx *wcn,
> +                                    const struct wcn36xx_hal_config_sta_req_msg *orig)
> +{
> +       struct wcn36xx_hal_config_sta_req_msg_v1 msg_body;
> +
> +       INIT_HAL_MSG(msg_body, WCN36XX_HAL_CONFIG_STA_REQ);
> +
> +       wcn36xx_smd_convert_sta_to_v1(wcn, &orig->sta_params,
> +                                     &msg_body.sta_params);
> +
> +       PREPARE_HAL_BUF(wcn->smd_buf, msg_body);
> +
> +       wcn36xx_dbg(WCN36XX_DBG_HAL,
> +                   "hal config sta v1 bssid %pM mac %pM",
> +                   msg_body.sta_params.bssid, msg_body.sta_params.mac);
> +
> +       return wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
> +}
> +
>  int wcn36xx_smd_config_sta(struct wcn36xx *wcn, u8 *bssid, u16 ass_id, u8 *sta_mac)
>  {
>         struct wcn36xx_hal_config_sta_req_msg msg_body;
> @@ -366,6 +407,9 @@ int wcn36xx_smd_config_sta(struct wcn36xx *wcn, u8 *bssid, u16 ass_id, u8 *sta_m
>                 sizeof(wcn->supported_rates));
>         msg_body.sta_params.sta_index = 1;
>
> +       if (wcn->fw_minor <= 3)
> +               return wcn36xx_smd_config_sta_v1(wcn, &msg_body);
> +
>         PREPARE_HAL_BUF(wcn->smd_buf, msg_body);
>
>         wcn36xx_dbg(WCN36XX_DBG_HAL,
>
>
> _______________________________________________
> wcn36xx mailing list
> wcn36xx at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/wcn36xx



-- 
Best regards,
Eugene



More information about the wcn36xx mailing list