From f51174ad815569027db993ef8685327f24082e28 Mon Sep 17 00:00:00 2001 From: Aloka Dixit Date: Thu, 20 Jan 2022 18:04:51 -0800 Subject: [PATCH 06/14] ath12k: create a structure for WMI vdev up parameters Include an instance of the structure instead of individual parameters as input to ath12k_wmi_vdev_up(). Signed-off-by: Aloka Dixit --- drivers/net/wireless/ath/ath12k/mac.c | 31 +++++++++++++++++++++------ drivers/net/wireless/ath/ath12k/wmi.c | 15 +++++++------ drivers/net/wireless/ath/ath12k/wmi.h | 16 ++++++++++---- 3 files changed, 45 insertions(+), 17 deletions(-) --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -854,8 +854,11 @@ static int ath12k_mac_vdev_setup_sync(st static int ath12k_monitor_vdev_up(struct ath12k *ar, int vdev_id) { int ret = 0; + struct vdev_up_params params = { 0 }; - ret = ath12k_wmi_vdev_up(ar, vdev_id, 0, ar->mac_addr); + params.vdev_id = vdev_id; + params.bssid = ar->mac_addr; + ret = ath12k_wmi_vdev_up(ar, ¶ms); if (ret) { ath12k_warn(ar->ab, "failed to put up monitor vdev %i: %d\n", vdev_id, ret); @@ -873,6 +876,7 @@ static int ath12k_mac_monitor_vdev_start struct ieee80211_channel *channel = NULL; struct wmi_vdev_start_req_arg arg = {}; int ret = 0; + struct vdev_up_params params = { 0 }; lockdep_assert_held(&ar->conf_mutex); @@ -914,7 +918,9 @@ static int ath12k_mac_monitor_vdev_start return ret; } - ret = ath12k_wmi_vdev_up(ar, vdev_id, 0, ar->mac_addr); + params.vdev_id = vdev_id; + params.bssid = ar->mac_addr; + ret = ath12k_wmi_vdev_up(ar, ¶ms); if (ret) { ath12k_warn(ar->ab, "failed to put up monitor vdev %i: %d\n", vdev_id, ret); @@ -1218,6 +1224,7 @@ static void ath12k_control_beaconing(str { struct ath12k *ar = arvif->ar; int ret = 0; + struct vdev_up_params params = { 0 }; lockdep_assert_held(&arvif->ar->conf_mutex); @@ -1245,8 +1252,10 @@ static void ath12k_control_beaconing(str ether_addr_copy(arvif->bssid, info->bssid); - ret = ath12k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, - arvif->bssid); + params.vdev_id = arvif->vdev_id; + params.aid = arvif->aid; + params.bssid = arvif->bssid; + ret = ath12k_wmi_vdev_up(arvif->ar, ¶ms); if (ret) { ath12k_warn(ar->ab, "failed to bring up vdev %d: %i\n", arvif->vdev_id, ret); @@ -2854,6 +2863,7 @@ static void ath12k_bss_assoc struct ieee80211_sta_he_cap he_cap; bool is_auth = false; int ret; + struct vdev_up_params params = { 0 }; lockdep_assert_held(&ar->conf_mutex); @@ -2955,7 +2965,10 @@ static void ath12k_bss_assoc(struct ieee arvif->aid = vif->cfg.aid; ether_addr_copy(arvif->bssid, bss_conf->bssid); - ret = ath12k_wmi_vdev_up(ar, arvif->vdev_id, arvif->aid, arvif->bssid); + params.vdev_id = arvif->vdev_id; + params.aid = arvif->aid; + params.bssid = arvif->bssid; + ret = ath12k_wmi_vdev_up(ar, ¶ms); if (ret) { ath12k_warn(ar->ab, "failed to set vdev %d up: %d\n", arvif->vdev_id, ret); @@ -7008,6 +7021,8 @@ ath12k_mac_update_vif_chan(struct ath12k /* TODO: Update ar->rx_channel */ for (i = 0; i < n_vifs; i++) { + struct vdev_up_params params = { 0 }; + arvif = (void *)vifs[i].vif->drv_priv; if (WARN_ON(!arvif->is_started)) @@ -7028,8 +7043,10 @@ ath12k_mac_update_vif_chan(struct ath12k ath12k_warn(ab, "failed to update bcn tmpl during csa: %d\n", ret); - ret = ath12k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, - arvif->bssid); + params.vdev_id = arvif->vdev_id; + params.aid = arvif->aid; + params.bssid = arvif->bssid; + ret = ath12k_wmi_vdev_up(arvif->ar, ¶ms); if (ret) { ath12k_warn(ab, "failed to bring vdev up %d: %d\n", arvif->vdev_id, ret); --- a/drivers/net/wireless/ath/ath12k/wmi.c +++ b/drivers/net/wireless/ath/ath12k/wmi.c @@ -1042,7 +1042,7 @@ int ath12k_wmi_vdev_start(struct ath12k return ret; } -int ath12k_wmi_vdev_up(struct ath12k *ar, u32 vdev_id, u32 aid, const u8 *bssid) +int ath12k_wmi_vdev_up(struct ath12k *ar, struct vdev_up_params *params) { struct ath12k_pdev_wmi *wmi = ar->wmi; struct wmi_vdev_up_cmd *cmd; @@ -1057,10 +1057,13 @@ int ath12k_wmi_vdev_up(struct ath12k *ar cmd->tlv_header = ath12k_wmi_tlv_cmd_hdr(WMI_TAG_VDEV_UP_CMD, sizeof(*cmd)); - cmd->vdev_id = cpu_to_le32(vdev_id); - cmd->vdev_assoc_id = cpu_to_le32(aid); - - ether_addr_copy(cmd->vdev_bssid.addr, bssid); + cmd->vdev_id = cpu_to_le32(params->vdev_id); + cmd->vdev_assoc_id = cpu_to_le16(params->aid); + ether_addr_copy(cmd->vdev_bssid.addr, params->bssid); + cmd->profile_idx = cpu_to_le32(params->profile_idx); + cmd->profile_count = cpu_to_le32(params->profile_count); + if (params->tx_bssid) + ether_addr_copy(cmd->tx_vdev_bssid.addr, params->tx_bssid); ret = ath12k_wmi_cmd_send(wmi, skb, WMI_VDEV_UP_CMDID); if (ret) { @@ -1070,7 +1073,7 @@ int ath12k_wmi_vdev_up(struct ath12k *ar ath12k_dbg(ar->ab, ATH12K_DBG_WMI, "WMI mgmt vdev up id 0x%x assoc id %d bssid %pM\n", - vdev_id, aid, bssid); + params->vdev_id, params->aid, params->bssid); return ret; } --- a/drivers/net/wireless/ath/ath12k/wmi.h +++ b/drivers/net/wireless/ath/ath12k/wmi.h @@ -2711,14 +2711,23 @@ struct wmi_vdev_delete_cmd { __le32 vdev_id; } __packed; +struct vdev_up_params { + __le32 vdev_id; + __le16 aid; + const u8 *bssid; + __le32 profile_idx; + __le32 profile_count; + u8 *tx_bssid; +} __packed; + struct wmi_vdev_up_cmd { __le32 tlv_header; __le32 vdev_id; __le32 vdev_assoc_id; struct wmi_mac_addr vdev_bssid; - struct wmi_mac_addr trans_bssid; + struct wmi_mac_addr tx_vdev_bssid; __le32 profile_idx; - __le32 profile_num; + __le32 profile_count; } __packed; struct wmi_vdev_stop_cmd { @@ -5568,8 +5577,7 @@ int ath12k_wmi_bcn_tmpl(struct ath12k *a struct ieee80211_mutable_offsets *offs, struct sk_buff *bcn); int ath12k_wmi_vdev_down(struct ath12k *ar, u8 vdev_id); -int ath12k_wmi_vdev_up(struct ath12k *ar, u32 vdev_id, u32 aid, - const u8 *bssid); +int ath12k_wmi_vdev_up(struct ath12k *ar, struct vdev_up_params *params); int ath12k_wmi_vdev_stop(struct ath12k *ar, u8 vdev_id); int ath12k_wmi_vdev_start(struct ath12k *ar, struct wmi_vdev_start_req_arg *arg, bool restart);