wcn36xx: Tidy up BSS/STA config
v5 cover wcn36xx: Tidy up BSS/STA config
This series is three in a set of seven to add support for wcn3680 at 802.11ac data-rates.
Both the BSS and STA config paths have redundant/duplicate code. Before adding more code to either it makes sense to reduce/reuse and functionally decompose as much as possible.
While not strictly necessary to get the wcn3680/80211.ac functioning in this driver, it seems like a missed opportunity to leave the code as is.
Lets reduce down before adding more.
V5:
- Fixes -W=1 warning caught in this set by kernel build robot I'm still declaring some functions standalone for the purposes of granularity and bisectability, a later patch makes relevant functions static.
V4:
- No functional change.
Sending out full set again using --base=ath-202009090652 to aid kernel
test robot
- https://lore.kernel.org/linux-wireless/[email protected]/T/#t
V3:
- No functional difference to V2
https://lore.kernel.org/linux-wireless/CAMZdPi___9yry0icuZVdnyiO7ZT0w=Xt8f8Pn7wkxRejxhXyYw@mail.gmail.com/T/#t
- Adds Loic's Reviewed-by as indicated
https://lore.kernel.org/linux-wireless/CAMZdPi___9yry0icuZVdnyiO7ZT0w=Xt8f8Pn7wkxRejxhXyYw@mail.gmail.com/T/#m2256137b97859c8eac26a2836f96db5e82475d3f
V2:
- Adds a memset to wcn36xx_smd_config_bss_v1()
Since we are doing one less kzalloc() we need to make sure we clear out the bss config.
V1:
https://lore.kernel.org/linux-wireless/[email protected]/T/#t
Bryan O'Donoghue (7):
wcn36xx: Functionally decompose wcn36xx_smd_config_sta()
wcn36xx: Move wcn36xx_smd_set_sta_params() inside
wcn36xx_smd_config_bss()
wcn36xx: Move BSS parameter setup to wcn36xx_smd_set_bss_params()
wcn36xx: Update wcn36xx_smd_config_bss_v1() to operate internally
wcn36xx: Add wcn36xx_smd_config_bss_v0
wcn36xx: Convert to using wcn36xx_smd_config_bss_v0()
wcn36xx: Remove dead code in wcn36xx_smd_config_bss()
drivers/net/wireless/ath/wcn36xx/smd.c | 422 ++++++++++++++----------- 1 file changed, 234 insertions(+), 188 deletions(-)
base-commit: 160b351d75cb50a0dd2abf9b63e1891935aa9e4a
prerequisite-patch-id: 9a4ac7faca179f6594c9b3a115ee69a2da540a69
prerequisite-patch-id: 183286f9c22d1aaa12f356651224e6b337ef1938
prerequisite-patch-id: af468d413daaf8d2aad195fcb43c6e66390d8468
prerequisite-patch-id: 08122a9557904ce5358f52dd08cc33270fa202c1
prerequisite-patch-id: 82e0b7c5b2e9fa80baca001cce12577d98e306a9
prerequisite-patch-id: 8ee7f5bd6cb5b7b7d713947b554ad93bb90d8230
prerequisite-patch-id: d05c2253e4523b05b2e43491aa13ceeef68fd2f0
prerequisite-patch-id: 8be29513d3efa64df15297bcf81ec3db55088ee1
prerequisite-patch-id: d267dcd834afad75a69bcd2adcccfdad6566a7ba
Signature · 1 line
2.27.0
PATCH v5 1/7 wcn36xx: Functionally decompose wcn36xx_smd_config_sta()
This commit functionally decomposes wcn36xx_smd_config_sta into a clearly defined wcn36xx_smd_config_sta_v0 and wcn36xx_smd_config_sta_v1 path.
--- drivers/net/wireless/ath/wcn36xx/smd.c | 53 ++++++++++++++++---------- 1 file changed, 32 insertions(+), 21 deletions(-)
drivers/net/wireless/ath/wcn36xx/smd.c +32 -21
@@ -1326,54 +1326,65 @@ static int wcn36xx_smd_config_sta_rsp(struct wcn36xx *wcn, }static int wcn36xx_smd_config_sta_v1 (struct wcn36xx *wcn, -const struct wcn36xx_hal_config_sta_req_msg *orig) +struct ieee80211_vif *vif, +struct ieee80211_sta *sta) {struct wcn36xx_hal_config_sta_req_msg_v1 msg_body; -struct wcn36xx_hal_config_sta_params_v1 *sta = &msg_body.sta_params; +struct wcn36xx_hal_config_sta_params_v1 *sta_params;INIT_HAL_MSG (msg_body,WCN36XX_HAL_CONFIG_STA_REQ ); msg_body.header.len -=WCN36XX_DIFF_STA_PARAMS_V1_NOVHT ; -wcn36xx_smd_convert_sta_to_v1 (wcn, &orig->sta_params, - &msg_body.sta_params); + sta_params = &msg_body.sta_params; + +wcn36xx_smd_set_sta_params_v1 (wcn, vif, sta, sta_params);PREPARE_HAL_BUF (wcn->hal_buf, msg_body);wcn36xx_dbg (WCN36XX_DBG_HAL ,"hal config sta v1 action %d sta_index %d bssid_index %d bssid %pM type %d mac %pM aid %d\n" , - sta->action, sta->sta_index, sta->bssid_index, - sta->bssid, sta->type, sta->mac, sta->aid); + sta_params->action, sta_params->sta_index, sta_params->bssid_index, + sta_params->bssid, sta_params->type, sta_params->mac, sta_params->aid);return wcn36xx_smd_send_and_wait (wcn, msg_body.header.len); } -int wcn36xx_smd_config_sta (struct wcn36xx *wcn,struct ieee80211_vif *vif, -struct ieee80211_sta *sta) +static int wcn36xx_smd_config_sta_v0 (struct wcn36xx *wcn, +struct ieee80211_vif *vif, +struct ieee80211_sta *sta) {struct wcn36xx_hal_config_sta_req_msg msg;struct wcn36xx_hal_config_sta_params *sta_params; -int ret; -mutex_lock (&wcn->hal_mutex);INIT_HAL_MSG (msg,WCN36XX_HAL_CONFIG_STA_REQ ); sta_params = &msg.sta_params;wcn36xx_smd_set_sta_params (wcn, vif, sta, sta_params); -if (!wcn36xx_is_fw_version (wcn,1 ,2 ,2 ,24 )) { - ret =wcn36xx_smd_config_sta_v1 (wcn, &msg); - }else { -PREPARE_HAL_BUF (wcn->hal_buf, msg); +PREPARE_HAL_BUF (wcn->hal_buf, msg); -wcn36xx_dbg (WCN36XX_DBG_HAL , -"hal config sta action %d sta_index %d bssid_index %d bssid %pM type %d mac %pM aid %d\n" , - sta_params->action, sta_params->sta_index, - sta_params->bssid_index, sta_params->bssid, - sta_params->type, sta_params->mac, sta_params->aid); +wcn36xx_dbg (WCN36XX_DBG_HAL , +"hal config sta action %d sta_index %d bssid_index %d bssid %pM type %d mac %pM aid %d\n" , + sta_params->action, sta_params->sta_index, + sta_params->bssid_index, sta_params->bssid, + sta_params->type, sta_params->mac, sta_params->aid); + +return wcn36xx_smd_send_and_wait (wcn, msg.header.len); +} + +int wcn36xx_smd_config_sta (struct wcn36xx *wcn,struct ieee80211_vif *vif, +struct ieee80211_sta *sta) +{ +int ret; + +mutex_lock (&wcn->hal_mutex); + +if (!wcn36xx_is_fw_version (wcn,1 ,2 ,2 ,24 )) + ret =wcn36xx_smd_config_sta_v1 (wcn, vif, sta); +else + ret =wcn36xx_smd_config_sta_v0 (wcn, vif, sta); - ret =wcn36xx_smd_send_and_wait (wcn, msg.header.len); - }if (ret) {wcn36xx_err ("Sending hal_config_sta failed\n" ); goto out;
Signature · 1 line
2.27.0
Re: [PATCH v5 1/7] wcn36xx: Functionally decompose wcn36xx_smd_config_sta()
Quoted 6 lines · Bryan O'Donoghue
This commit functionally decomposes
wcn36xx_smd_config_stainto a clearly definedwcn36xx_smd_config_sta_v0andwcn36xx_smd_config_sta_v1path.Signed-off-by Bryan O'Donoghue <[email protected]>Reviewed-by Loic Poulain <[email protected]>Signed-off-by Kalle Valo <[email protected]>
7 patches applied to ath-next branch of ath.git, thanks.
fe784c28fee1 wcn36xx: Functionally decompose wcn36xx_smd_config_sta() 9e212908b547 wcn36xx: Move wcn36xx_smd_set_sta_params() inside wcn36xx_smd_config_bss() 683693102072 wcn36xx: Move BSS parameter setup to wcn36xx_smd_set_bss_params() 7656d1798556 wcn36xx: Update wcn36xx_smd_config_bss_v1() to operate internally 1cdab0f89663 wcn36xx: Add wcn36xx_smd_config_bss_v05a7b60ad56d7 wcn36xx: Convert to using wcn36xx_smd_config_bss_v0() d1e11d5f2167 wcn36xx: Remove dead code in wcn36xx_smd_config_bss()
Signature · 3 lines
https://patchwork.kernel.org/patch/11768939/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
PATCH v5 2/7 wcn36xx: Move wcn36xx_smd_set_sta_params() inside wcn36xx_smd_config_bss()
In reply to Bryan O'DonoghueIn order to facilitate functional decomposition of wcn36xx_smd_config_bss() we need to move wcn36xx_smd_set_sta_params() later in function.
--- drivers/net/wireless/ath/wcn36xx/smd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/wcn36xx/smd.c +2 -1
@@ -1624,7 +1624,6 @@ int wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif, bss->ext_channel =IEEE80211_HT_PARAM_CHA_SEC_NONE ; bss->reserved =0 ; -wcn36xx_smd_set_sta_params (wcn, vif, sta, sta_params);/* wcn->ssid is only valid in AP and IBSS mode */ bss->ssid.length = vif_priv->ssid.length;
@@ -1650,6 +1649,8 @@ int wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif, vif_priv->bss_type = bss->bss_type; +wcn36xx_smd_set_sta_params (wcn, vif, sta, sta_params); + wcn36xx_dbg(WCN36XX_DBG_HAL, "hal config bss bssid %pM self_mac_addr %pM bss_type %d oper_mode %d nw_type %d\n", bss->bssid, bss->self_mac_addr, bss->bss_type,
Signature · 1 line
2.27.0
PATCH v5 3/7 wcn36xx: Move BSS parameter setup to wcn36xx_smd_set_bss_params()
In reply to Bryan O'DonoghueThis commit moves BSS parameter setup to a separate function wcn36xx_smd_set_bss_params(). This will allow for further functional decomposition and fewer kzalloc() operations in subsequent patches.
--- drivers/net/wireless/ath/wcn36xx/smd.c | 175 ++++++++++++++----------- 1 file changed, 95 insertions(+), 80 deletions(-)
drivers/net/wireless/ath/wcn36xx/smd.c +95 -80
@@ -1402,6 +1402,100 @@ int wcn36xx_smd_config_sta(struct wcn36xx *wcn, struct ieee80211_vif *vif,return ret; } +void wcn36xx_smd_set_bss_params (struct wcn36xx *wcn, +struct ieee80211_vif *vif, +struct ieee80211_sta *sta, +const u8 *bssid, +bool update, +struct wcn36xx_hal_config_bss_params *bss); +void wcn36xx_smd_set_bss_params (struct wcn36xx *wcn, +struct ieee80211_vif *vif, +struct ieee80211_sta *sta, +const u8 *bssid, +bool update, +struct wcn36xx_hal_config_bss_params *bss) +{ +struct wcn36xx_vif *vif_priv =wcn36xx_vif_to_priv (vif); + +WARN_ON (is_zero_ether_addr (bssid)); + +memcpy (&bss->bssid, bssid,ETH_ALEN ); + +memcpy (bss->self_mac_addr, vif->addr,ETH_ALEN ); + +if (vif->type ==NL80211_IFTYPE_STATION ) { + bss->bss_type =WCN36XX_HAL_INFRASTRUCTURE_MODE ; + +/* STA */ + bss->oper_mode =1 ; + bss->wcn36xx_hal_persona =WCN36XX_HAL_STA_MODE ; + }else if (vif->type ==NL80211_IFTYPE_AP || + vif->type ==NL80211_IFTYPE_MESH_POINT ) { + bss->bss_type =WCN36XX_HAL_INFRA_AP_MODE ; + +/* AP */ + bss->oper_mode =0 ; + bss->wcn36xx_hal_persona =WCN36XX_HAL_STA_SAP_MODE ; + }else if (vif->type ==NL80211_IFTYPE_ADHOC ) { + bss->bss_type =WCN36XX_HAL_IBSS_MODE ; + +/* STA */ + bss->oper_mode =1 ; + }else { +wcn36xx_warn ("Unknown type for bss config: %d\n" , vif->type); + } + +if (vif->type ==NL80211_IFTYPE_STATION ) +wcn36xx_smd_set_bss_nw_type (wcn, sta, bss); +else + bss->nw_type =WCN36XX_HAL_11N_NW_TYPE ; + + bss->short_slot_time_supported = vif->bss_conf.use_short_slot; + bss->lla_coexist =0 ; + bss->llb_coexist =0 ; + bss->llg_coexist =0 ; + bss->rifs_mode =0 ; + bss->beacon_interval = vif->bss_conf.beacon_int; + bss->dtim_period = vif_priv->dtim_period; + +wcn36xx_smd_set_bss_ht_params (vif, sta, bss); + + bss->oper_channel =WCN36XX_HW_CHANNEL (wcn); + +if (conf_is_ht40_minus (&wcn->hw->conf)) + bss->ext_channel =IEEE80211_HT_PARAM_CHA_SEC_BELOW ; +else if (conf_is_ht40_plus (&wcn->hw->conf)) + bss->ext_channel =IEEE80211_HT_PARAM_CHA_SEC_ABOVE ; +else + bss->ext_channel =IEEE80211_HT_PARAM_CHA_SEC_NONE ; + + bss->reserved =0 ; + +/* wcn->ssid is only valid in AP and IBSS mode */ + bss->ssid.length = vif_priv->ssid.length; +memcpy (bss->ssid.ssid, vif_priv->ssid.ssid, vif_priv->ssid.length); + + bss->obss_prot_enabled =0 ; + bss->rmf =0 ; + bss->max_probe_resp_retry_limit =0 ; + bss->hidden_ssid = vif->bss_conf.hidden_ssid; + bss->proxy_probe_resp =0 ; + bss->edca_params_valid =0 ; + +/* FIXME: set acbe, acbk, acvi and acvo */ + + bss->ext_set_sta_key_param_valid =0 ; + +/* FIXME: set ext_set_sta_key_param */ + + bss->spectrum_mgt_enable =0 ; + bss->tx_mgmt_power =0 ; + bss->max_tx_power =WCN36XX_MAX_POWER (wcn); + bss->action = update; + + vif_priv->bss_type = bss->bss_type; +} +static int wcn36xx_smd_config_bss_v1 (struct wcn36xx *wcn,const struct wcn36xx_hal_config_bss_req_msg *orig) {
@@ -1505,7 +1599,6 @@ static int wcn36xx_smd_config_bss_v1(struct wcn36xx *wcn,return ret; } - static int wcn36xx_smd_config_bss_rsp(struct wcn36xx *wcn, struct ieee80211_vif *vif, struct ieee80211_sta *sta,
@@ -1557,7 +1650,6 @@ int wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif,struct wcn36xx_hal_config_bss_req_msg *msg;struct wcn36xx_hal_config_bss_params *bss;struct wcn36xx_hal_config_sta_params *sta_params; -struct wcn36xx_vif *vif_priv =wcn36xx_vif_to_priv (vif);int ret;mutex_lock (&wcn->hal_mutex);
@@ -1571,84 +1663,7 @@ int wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif, bss = &msg->bss_params; sta_params = &bss->sta; -WARN_ON (is_zero_ether_addr (bssid)); - -memcpy (&bss->bssid, bssid,ETH_ALEN ); - -memcpy (bss->self_mac_addr, vif->addr,ETH_ALEN ); - -if (vif->type ==NL80211_IFTYPE_STATION ) { - bss->bss_type =WCN36XX_HAL_INFRASTRUCTURE_MODE ; - -/* STA */ - bss->oper_mode =1 ; - bss->wcn36xx_hal_persona =WCN36XX_HAL_STA_MODE ; - }else if (vif->type ==NL80211_IFTYPE_AP || - vif->type ==NL80211_IFTYPE_MESH_POINT ) { - bss->bss_type =WCN36XX_HAL_INFRA_AP_MODE ; - -/* AP */ - bss->oper_mode =0 ; - bss->wcn36xx_hal_persona =WCN36XX_HAL_STA_SAP_MODE ; - }else if (vif->type ==NL80211_IFTYPE_ADHOC ) { - bss->bss_type =WCN36XX_HAL_IBSS_MODE ; - -/* STA */ - bss->oper_mode =1 ; - }else { -wcn36xx_warn ("Unknown type for bss config: %d\n" , vif->type); - } - -if (vif->type ==NL80211_IFTYPE_STATION ) -wcn36xx_smd_set_bss_nw_type (wcn, sta, bss); -else - bss->nw_type =WCN36XX_HAL_11N_NW_TYPE ; - - bss->short_slot_time_supported = vif->bss_conf.use_short_slot; - bss->lla_coexist =0 ; - bss->llb_coexist =0 ; - bss->llg_coexist =0 ; - bss->rifs_mode =0 ; - bss->beacon_interval = vif->bss_conf.beacon_int; - bss->dtim_period = vif_priv->dtim_period; - -wcn36xx_smd_set_bss_ht_params (vif, sta, bss); - - bss->oper_channel =WCN36XX_HW_CHANNEL (wcn); - -if (conf_is_ht40_minus (&wcn->hw->conf)) - bss->ext_channel =IEEE80211_HT_PARAM_CHA_SEC_BELOW ; -else if (conf_is_ht40_plus (&wcn->hw->conf)) - bss->ext_channel =IEEE80211_HT_PARAM_CHA_SEC_ABOVE ; -else - bss->ext_channel =IEEE80211_HT_PARAM_CHA_SEC_NONE ; - - bss->reserved =0 ; - -/* wcn->ssid is only valid in AP and IBSS mode */ - bss->ssid.length = vif_priv->ssid.length; -memcpy (bss->ssid.ssid, vif_priv->ssid.ssid, vif_priv->ssid.length); - - bss->obss_prot_enabled =0 ; - bss->rmf =0 ; - bss->max_probe_resp_retry_limit =0 ; - bss->hidden_ssid = vif->bss_conf.hidden_ssid; - bss->proxy_probe_resp =0 ; - bss->edca_params_valid =0 ; - -/* FIXME: set acbe, acbk, acvi and acvo */ - - bss->ext_set_sta_key_param_valid =0 ; - -/* FIXME: set ext_set_sta_key_param */ - - bss->spectrum_mgt_enable =0 ; - bss->tx_mgmt_power =0 ; - bss->max_tx_power =WCN36XX_MAX_POWER (wcn); - bss->action = update; - - vif_priv->bss_type = bss->bss_type; - +wcn36xx_smd_set_bss_params (wcn, vif, sta, bssid, update, bss);wcn36xx_smd_set_sta_params (wcn, vif, sta, sta_params); wcn36xx_dbg(WCN36XX_DBG_HAL,
Signature · 1 line
2.27.0
PATCH v5 4/7 wcn36xx: Update wcn36xx_smd_config_bss_v1() to operate internally
In reply to Bryan O'DonoghueThis patch updates wcn36xx_smd_config_bss_v1() to update on internally derived parameters only, specifically making use of STA v1 wrapper routines previously added.
Once done we no longer need to pass a struct wcn36xx_hal_config_bss_req_msg which gives us options in later patches to eliminate the kzalloc() in wcn36xx_smd_config_bss entirely.
--- drivers/net/wireless/ath/wcn36xx/smd.c | 116 +++++++++++++------------ 1 file changed, 61 insertions(+), 55 deletions(-)
drivers/net/wireless/ath/wcn36xx/smd.c +61 -55
@@ -1497,10 +1497,14 @@ void wcn36xx_smd_set_bss_params(struct wcn36xx *wcn, }static int wcn36xx_smd_config_bss_v1 (struct wcn36xx *wcn, -const struct wcn36xx_hal_config_bss_req_msg *orig) +struct ieee80211_vif *vif, +struct ieee80211_sta *sta_80211, +const u8 *bssid, +bool update) {struct wcn36xx_hal_config_bss_req_msg_v1 *msg_body;struct wcn36xx_hal_config_bss_params_v1 *bss; +struct wcn36xx_hal_config_bss_params bss_v0;struct wcn36xx_hal_config_sta_params_v1 *sta;int ret;
@@ -1514,72 +1518,74 @@ static int wcn36xx_smd_config_bss_v1(struct wcn36xx *wcn, bss = &msg_body->bss_params; sta = &bss->sta; +memset (&bss_v0,0x00 ,sizeof (bss_v0)); +wcn36xx_smd_set_bss_params (wcn, vif, sta_80211, bssid, update, &bss_v0); +wcn36xx_smd_set_sta_params_v1 (wcn, vif, sta_80211, sta); +/* convert orig to v1 */ -memcpy (bss->bssid, &orig->bss_params.bssid,ETH_ALEN ); -memcpy (bss->self_mac_addr, &orig->bss_params.self_mac_addr,ETH_ALEN ); +memcpy (bss->bssid, &bss_v0.bssid,ETH_ALEN ); +memcpy (bss->self_mac_addr, &bss_v0.self_mac_addr,ETH_ALEN ); - bss->bss_type = orig->bss_params.bss_type; - bss->oper_mode = orig->bss_params.oper_mode; - bss->nw_type = orig->bss_params.nw_type; + bss->bss_type = bss_v0.bss_type; + bss->oper_mode = bss_v0.oper_mode; + bss->nw_type = bss_v0.nw_type; bss->short_slot_time_supported = - orig->bss_params.short_slot_time_supported; - bss->lla_coexist = orig->bss_params.lla_coexist; - bss->llb_coexist = orig->bss_params.llb_coexist; - bss->llg_coexist = orig->bss_params.llg_coexist; - bss->ht20_coexist = orig->bss_params.ht20_coexist; - bss->lln_non_gf_coexist = orig->bss_params.lln_non_gf_coexist; + bss_v0.short_slot_time_supported; + bss->lla_coexist = bss_v0.lla_coexist; + bss->llb_coexist = bss_v0.llb_coexist; + bss->llg_coexist = bss_v0.llg_coexist; + bss->ht20_coexist = bss_v0.ht20_coexist; + bss->lln_non_gf_coexist = bss_v0.lln_non_gf_coexist; bss->lsig_tx_op_protection_full_support = - orig->bss_params.lsig_tx_op_protection_full_support; - bss->rifs_mode = orig->bss_params.rifs_mode; - bss->beacon_interval = orig->bss_params.beacon_interval; - bss->dtim_period = orig->bss_params.dtim_period; - bss->tx_channel_width_set = orig->bss_params.tx_channel_width_set; - bss->oper_channel = orig->bss_params.oper_channel; - bss->ext_channel = orig->bss_params.ext_channel; - - bss->reserved = orig->bss_params.reserved; - -memcpy (&bss->ssid, &orig->bss_params.ssid, -sizeof (orig->bss_params.ssid)); - - bss->action = orig->bss_params.action; - bss->rateset = orig->bss_params.rateset; - bss->ht = orig->bss_params.ht; - bss->obss_prot_enabled = orig->bss_params.obss_prot_enabled; - bss->rmf = orig->bss_params.rmf; - bss->ht_oper_mode = orig->bss_params.ht_oper_mode; - bss->dual_cts_protection = orig->bss_params.dual_cts_protection; + bss_v0.lsig_tx_op_protection_full_support; + bss->rifs_mode = bss_v0.rifs_mode; + bss->beacon_interval = bss_v0.beacon_interval; + bss->dtim_period = bss_v0.dtim_period; + bss->tx_channel_width_set = bss_v0.tx_channel_width_set; + bss->oper_channel = bss_v0.oper_channel; + bss->ext_channel = bss_v0.ext_channel; + + bss->reserved = bss_v0.reserved; + +memcpy (&bss->ssid, &bss_v0.ssid, +sizeof (bss_v0.ssid)); + + bss->action = bss_v0.action; + bss->rateset = bss_v0.rateset; + bss->ht = bss_v0.ht; + bss->obss_prot_enabled = bss_v0.obss_prot_enabled; + bss->rmf = bss_v0.rmf; + bss->ht_oper_mode = bss_v0.ht_oper_mode; + bss->dual_cts_protection = bss_v0.dual_cts_protection; bss->max_probe_resp_retry_limit = - orig->bss_params.max_probe_resp_retry_limit; - bss->hidden_ssid = orig->bss_params.hidden_ssid; - bss->proxy_probe_resp = orig->bss_params.proxy_probe_resp; - bss->edca_params_valid = orig->bss_params.edca_params_valid; - -memcpy (&bss->acbe, &orig->bss_params.acbe, -sizeof (orig->bss_params.acbe)); -memcpy (&bss->acbk, &orig->bss_params.acbk, -sizeof (orig->bss_params.acbk)); -memcpy (&bss->acvi, &orig->bss_params.acvi, -sizeof (orig->bss_params.acvi)); -memcpy (&bss->acvo, &orig->bss_params.acvo, -sizeof (orig->bss_params.acvo)); + bss_v0.max_probe_resp_retry_limit; + bss->hidden_ssid = bss_v0.hidden_ssid; + bss->proxy_probe_resp = bss_v0.proxy_probe_resp; + bss->edca_params_valid = bss_v0.edca_params_valid; + +memcpy (&bss->acbe, &bss_v0.acbe, +sizeof (bss_v0.acbe)); +memcpy (&bss->acbk, &bss_v0.acbk, +sizeof (bss_v0.acbk)); +memcpy (&bss->acvi, &bss_v0.acvi, +sizeof (bss_v0.acvi)); +memcpy (&bss->acvo, &bss_v0.acvo, +sizeof (bss_v0.acvo)); bss->ext_set_sta_key_param_valid = - orig->bss_params.ext_set_sta_key_param_valid; + bss_v0.ext_set_sta_key_param_valid;memcpy (&bss->ext_set_sta_key_param, - &orig->bss_params.ext_set_sta_key_param, -sizeof (orig->bss_params.acvo)); - - bss->wcn36xx_hal_persona = orig->bss_params.wcn36xx_hal_persona; - bss->spectrum_mgt_enable = orig->bss_params.spectrum_mgt_enable; - bss->tx_mgmt_power = orig->bss_params.tx_mgmt_power; - bss->max_tx_power = orig->bss_params.max_tx_power; + &bss_v0.ext_set_sta_key_param, +sizeof (bss_v0.acvo)); -wcn36xx_smd_convert_sta_to_v1 (wcn, &orig->bss_params.sta, sta); + bss->wcn36xx_hal_persona = bss_v0.wcn36xx_hal_persona; + bss->spectrum_mgt_enable = bss_v0.spectrum_mgt_enable; + bss->tx_mgmt_power = bss_v0.tx_mgmt_power; + bss->max_tx_power = bss_v0.max_tx_power;PREPARE_HAL_BUF (wcn->hal_buf, (*msg_body));
@@ -1679,7 +1685,7 @@ int wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif, sta_params->mac);if (!wcn36xx_is_fw_version (wcn,1 ,2 ,2 ,24 )) { - ret =wcn36xx_smd_config_bss_v1 (wcn, msg); + ret =wcn36xx_smd_config_bss_v1 (wcn, vif, sta, bssid, update); }else {PREPARE_HAL_BUF (wcn->hal_buf, (*msg));
Signature · 1 line
2.27.0
PATCH v5 5/7 wcn36xx: Add wcn36xx_smd_config_bss_v0
In reply to Bryan O'DonoghueThis commit adds wcn36xx_smd_config_bss_v0() as a step along the road of functionally decomposing wcn36xx_smd_config_bss().
--- drivers/net/wireless/ath/wcn36xx/smd.c | 44 ++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)
drivers/net/wireless/ath/wcn36xx/smd.c +44 -0
@@ -1605,6 +1605,50 @@ static int wcn36xx_smd_config_bss_v1(struct wcn36xx *wcn,return ret; } +int wcn36xx_smd_config_bss_v0 (struct wcn36xx *wcn,struct ieee80211_vif *vif, +struct ieee80211_sta *sta,const u8 *bssid, +bool update); +int wcn36xx_smd_config_bss_v0 (struct wcn36xx *wcn,struct ieee80211_vif *vif, +struct ieee80211_sta *sta,const u8 *bssid, +bool update) +{ +struct wcn36xx_hal_config_bss_req_msg *msg; +struct wcn36xx_hal_config_bss_params *bss; +struct wcn36xx_hal_config_sta_params *sta_params; +int ret; + + msg =kzalloc (sizeof (*msg),GFP_KERNEL ); +if (!msg) +return -ENOMEM ; + +INIT_HAL_MSG ((*msg),WCN36XX_HAL_CONFIG_BSS_REQ ); + + bss = &msg->bss_params; + sta_params = &bss->sta; + +wcn36xx_smd_set_bss_params (wcn, vif, sta, bssid, update, bss); +wcn36xx_smd_set_sta_params (wcn, vif, sta, sta_params); + +PREPARE_HAL_BUF (wcn->hal_buf, (*msg)); + +wcn36xx_dbg (WCN36XX_DBG_HAL , +"hal config bss bssid %pM self_mac_addr %pM bss_type %d oper_mode %d nw_type %d\n" , + bss->bssid, bss->self_mac_addr, bss->bss_type, + bss->oper_mode, bss->nw_type); + +wcn36xx_dbg (WCN36XX_DBG_HAL , +"- sta bssid %pM action %d sta_index %d bssid_index %d aid %d type %d mac %pM\n" , + sta_params->bssid, sta_params->action, + sta_params->sta_index, sta_params->bssid_index, + sta_params->aid, sta_params->type, + sta_params->mac); + + ret =wcn36xx_smd_send_and_wait (wcn, msg->header.len); +kfree (msg); + +return ret; +} + static int wcn36xx_smd_config_bss_rsp(struct wcn36xx *wcn, struct ieee80211_vif *vif, struct ieee80211_sta *sta,
Signature · 1 line
2.27.0
PATCH v5 6/7 wcn36xx: Convert to using wcn36xx_smd_config_bss_v0()
In reply to Bryan O'DonoghueA previous patch added wcn36xx_smd_config_bss_v0() this patch converts the version 0 data-path in wcn36xx_smd_config_bss() to use wcn36xx_smd_config_bss_v0().
--- drivers/net/wireless/ath/wcn36xx/smd.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/wireless/ath/wcn36xx/smd.c +1 -3
@@ -1731,9 +1731,7 @@ int wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif,if (!wcn36xx_is_fw_version (wcn,1 ,2 ,2 ,24 )) { ret =wcn36xx_smd_config_bss_v1 (wcn, vif, sta, bssid, update); }else { -PREPARE_HAL_BUF (wcn->hal_buf, (*msg)); - - ret =wcn36xx_smd_send_and_wait (wcn, msg->header.len); + ret =wcn36xx_smd_config_bss_v0 (wcn, vif, sta, bssid, update); }if (ret) {wcn36xx_err ("Sending hal_config_bss failed\n" );
Signature · 1 line
2.27.0
PATCH v5 7/7 wcn36xx: Remove dead code in wcn36xx_smd_config_bss()
In reply to Bryan O'Donoghuewcn36xx_smd_config_bss_v0() and wcn36xx_smd_config_bss_v1() have been designed to operate in standalone fashion. As a result we can drop the dead code now present in wcn36xx_smd_config_bss() and happily remove one kzalloc from the BSS config path as we do so.
--- drivers/net/wireless/ath/wcn36xx/smd.c | 39 ++++---------------------- 1 file changed, 5 insertions(+), 34 deletions(-)
drivers/net/wireless/ath/wcn36xx/smd.c +5 -34
@@ -1697,42 +1697,15 @@ int wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif, struct ieee80211_sta *sta, const u8 *bssid, bool update) { - struct wcn36xx_hal_config_bss_req_msg *msg; -struct wcn36xx_hal_config_bss_params *bss; -struct wcn36xx_hal_config_sta_params *sta_params; int ret;mutex_lock (&wcn->hal_mutex); - msg =kzalloc (sizeof (*msg),GFP_KERNEL ); -if (!msg) { - ret = -ENOMEM ; - goto out; - } -INIT_HAL_MSG ((*msg),WCN36XX_HAL_CONFIG_BSS_REQ ); - - bss = &msg->bss_params; - sta_params = &bss->sta; - -wcn36xx_smd_set_bss_params (wcn, vif, sta, bssid, update, bss); -wcn36xx_smd_set_sta_params (wcn, vif, sta, sta_params); - -wcn36xx_dbg (WCN36XX_DBG_HAL , -"hal config bss bssid %pM self_mac_addr %pM bss_type %d oper_mode %d nw_type %d\n" , - bss->bssid, bss->self_mac_addr, bss->bss_type, - bss->oper_mode, bss->nw_type); -wcn36xx_dbg (WCN36XX_DBG_HAL , -"- sta bssid %pM action %d sta_index %d bssid_index %d aid %d type %d mac %pM\n" , - sta_params->bssid, sta_params->action, - sta_params->sta_index, sta_params->bssid_index, - sta_params->aid, sta_params->type, - sta_params->mac); - -if (!wcn36xx_is_fw_version (wcn,1 ,2 ,2 ,24 )) { +if (!wcn36xx_is_fw_version (wcn,1 ,2 ,2 ,24 )) ret =wcn36xx_smd_config_bss_v1 (wcn, vif, sta, bssid, update); - }else { +else ret =wcn36xx_smd_config_bss_v0 (wcn, vif, sta, bssid, update); - } +if (ret) {wcn36xx_err ("Sending hal_config_bss failed\n" ); goto out;
@@ -1742,12 +1715,10 @@ int wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif, sta, wcn->hal_buf, wcn->hal_rsp_len); -if (ret) { +if (ret)wcn36xx_err ("hal_config_bss response failed err=%d\n" , ret); - goto out; - } + out: -kfree (msg);mutex_unlock (&wcn->hal_mutex);return ret; }
Signature · 1 line
2.27.0