Skip to contentSkip to conversation

ath11k/wmi: Remove wmi service abstraction

PATCH In review Vasanthakumar Thiagarajan 2 participants 5 messages Jun 26, 2019 – Jun 27, 2019 Qualcomm Atheros ATH11K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 ath11k/wmi: Remove wmi service abstraction

There is going to be only one version of WMI TLV.

---
 drivers/net/wireless/ath/ath11k/core.h |   1 -
 drivers/net/wireless/ath/ath11k/mac.c  |   5 +-
 drivers/net/wireless/ath/ath11k/wmi.c  |  47 ++-
 drivers/net/wireless/ath/ath11k/wmi.h  | 568 +--------------------------------
 4 files changed, 39 insertions(+), 582 deletions(-)
drivers/net/wireless/ath/ath11k/core.h +0 -1
index af5c66f..d4b44f8 100644
@@ -609,7 +609,6 @@ struct ath11k_base {
 	struct ath11k_ext_irq_grp ext_irq_grp[ATH11K_EXT_IRQ_GRP_NUM_MAX];
 	struct napi_struct *napi;
 	struct ath11k_targ_cap target_caps;
-	u32 service_bitmap[WMI_SERVICE_BM_SIZE];
 	u32 ext_service_bitmap[WMI_SERVICE_EXT_BM_SIZE];
 	bool pdevs_macaddr_valid;
 	int bd_api;
drivers/net/wireless/ath/ath11k/mac.c +2 -3
index 1a4a333..0787d0d 100644
@@ -4996,9 +4996,8 @@ static void ath11k_mac_disable_peer_fixed_rate(void *data,
 
 	lockdep_assert_held(&ar->conf_mutex);
 
-	if (!test_bit(WMI_SERVICE_BSS_CHANNEL_INFO_64,
-		      ar->ab->wmi_sc.svc_map) ||
-	    (ar->rx_channel != channel))
+	if (!test_bit(WMI_TLV_SERVICE_BSS_CHANNEL_INFO_64, ar->ab->wmi_sc.svc_map) ||
+	    ar->rx_channel != channel)
 		return;
 
 	if (ar->scan.state != ATH11K_SCAN_IDLE) {
drivers/net/wireless/ath/ath11k/wmi.c +34 -13

74 lines not on this page · raw message

drivers/net/wireless/ath/ath11k/wmi.h +3 -565

586 lines not on this page · raw message

Signature · 7 lines
1.9.1


_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k
#1 lore raw

PATCH 2/4 ath11k/wmi: Clean up few indentations in wmi

Also make ath11k_hw_mode_pri_map[] static const.

---
 drivers/net/wireless/ath/ath11k/wmi.c | 187 +++++++++++++++-------------------
 1 file changed, 80 insertions(+), 107 deletions(-)
drivers/net/wireless/ath/ath11k/wmi.c +80 -107
index 9b0c7d4..6807ee5 100644
@@ -102,7 +102,7 @@ struct wmi_tlv_rdy_parse {
 #define PRIMAP(_hw_mode_) \
 	[_hw_mode_] = _hw_mode_##_PRI
 
-static int ath11k_hw_mode_pri_map[] = {
+static const int ath11k_hw_mode_pri_map[] = {
 	PRIMAP(WMI_HOST_HW_MODE_SINGLE),
 	PRIMAP(WMI_HOST_HW_MODE_DBS),
 	PRIMAP(WMI_HOST_HW_MODE_SBS_PASSIVE),
@@ -254,17 +254,18 @@ int ath11k_wmi_cmd_send(struct ath11k_pdev_wmi *wmi, struct sk_buff *skb,
 	return ret;
 }
 
-static int ath11k_pull_service_ready_ext(
-		struct ath11k_pdev_wmi *wmi_handle,
-		struct wmi_service_ready_ext_event *ev,
-		struct ath11k_service_ext_param *param)
+static int ath11k_pull_svc_ready_ext(struct ath11k_pdev_wmi *wmi_handle,
+				     const void *ptr,
+				     struct ath11k_service_ext_param *param)
 {
+	struct wmi_service_ready_ext_event *ev;
+
+	ev = (struct wmi_service_ready_ext_event *)ptr;
 	if (!ev)
 		return -EINVAL;
 
 	/* Move this to host based bitmap */
-	param->default_conc_scan_config_bits =
-		 ev->default_conc_scan_config_bits;
+	param->default_conc_scan_config_bits = ev->default_conc_scan_config_bits;
 	param->default_fw_config_bits =	ev->default_fw_config_bits;
 	param->he_cap_info = ev->he_cap_info;
 	param->mpdu_density = ev->mpdu_density;
@@ -274,14 +275,14 @@ static int ath11k_pull_service_ready_ext(
 	return 0;
 }
 
-static int ath11k_pull_mac_phy_cap_service_ready_ext(
-		struct ath11k_pdev_wmi *wmi_handle,
-		struct wmi_soc_mac_phy_hw_mode_caps *hw_caps,
-		struct wmi_hw_mode_capabilities *wmi_hw_mode_caps,
-		struct wmi_soc_hal_reg_capabilities *soc_hal_reg_caps,
-		struct wmi_mac_phy_capabilities *wmi_mac_phy_caps,
-		u8 hw_mode_id, u8 phy_id,
-		struct ath11k_pdev *pdev)
+static int
+ath11k_pull_mac_phy_cap_svc_ready_ext(struct ath11k_pdev_wmi *wmi_handle,
+				      struct wmi_soc_mac_phy_hw_mode_caps *hw_caps,
+				      struct wmi_hw_mode_capabilities *wmi_hw_mode_caps,
+				      struct wmi_soc_hal_reg_capabilities *hal_reg_caps,
+				      struct wmi_mac_phy_capabilities *wmi_mac_phy_caps,
+				      u8 hw_mode_id, u8 phy_id,
+				      struct ath11k_pdev *pdev)
 {
 	struct wmi_mac_phy_capabilities *mac_phy_caps;
 	struct ath11k_band_cap *cap_band;
@@ -289,7 +290,7 @@ static int ath11k_pull_mac_phy_cap_service_ready_ext(
 	u32 phy_map;
 	u32 hw_idx, phy_idx = 0;
 
-	if (!hw_caps || !wmi_hw_mode_caps || !soc_hal_reg_caps)
+	if (!hw_caps || !wmi_hw_mode_caps || !hal_reg_caps)
 		return -EINVAL;
 
 	for (hw_idx = 0; hw_idx < hw_caps->num_hw_modes; hw_idx++) {
@@ -307,7 +308,7 @@ static int ath11k_pull_mac_phy_cap_service_ready_ext(
 		return -EINVAL;
 
 	phy_idx += phy_id;
-	if (phy_id >= soc_hal_reg_caps->num_phy)
+	if (phy_id >= hal_reg_caps->num_phy)
 		return -EINVAL;
 
 	mac_phy_caps = &wmi_mac_phy_caps[phy_idx];
@@ -371,12 +372,12 @@ static int ath11k_pull_mac_phy_cap_service_ready_ext(
 	return 0;
 }
 
-static int ath11k_pull_reg_cap_svc_rdy_ext(
-		struct ath11k_pdev_wmi *wmi_handle,
-		struct wmi_soc_hal_reg_capabilities *reg_caps,
-		struct wmi_hal_reg_capabilities_ext *wmi_ext_reg_cap,
-		u8 phy_idx,
-		struct ath11k_hal_reg_capabilities_ext *param)
+static int
+ath11k_pull_reg_cap_svc_rdy_ext(struct ath11k_pdev_wmi *wmi_handle,
+				struct wmi_soc_hal_reg_capabilities *reg_caps,
+				struct wmi_hal_reg_capabilities_ext *wmi_ext_reg_cap,
+				u8 phy_idx,
+				struct ath11k_hal_reg_capabilities_ext *param)
 {
 	struct wmi_hal_reg_capabilities_ext *ext_reg_cap;
 
@@ -407,11 +408,10 @@ static int ath11k_pull_service_ready_tlv(struct ath11k_base *ab,
 					 const void *evt_buf,
 					 struct ath11k_targ_cap *cap)
 {
-	struct wmi_service_ready_event *ev;
+	struct wmi_service_ready_event *ev = (struct wmi_service_ready_event *)evt_buf;
 
-	ev = (struct wmi_service_ready_event *)evt_buf;
 	if (!ev) {
-		ath11k_err(ab, "%s: failed by Null Param\n",
+		ath11k_err(ab, "%s: failed by NULL param\n",
 			   __func__);
 		return -EINVAL;
 	}
@@ -2460,7 +2460,7 @@ int ath11k_wmi_pdev_pktlog_disable(struct ath11k *ar)
 	return ret;
 }
 
-static inline void
+static void
 ath11k_fill_band_to_mac_param(struct ath11k_base  *soc,
 			      struct wmi_host_pdev_band_to_mac *band_to_mac)
 {
@@ -2574,7 +2574,7 @@ static int ath11k_init_cmd_send(struct ath11k_pdev_wmi *wmi,
 			      (param->num_band_to_mac * sizeof(*band_to_mac));
 
 	len = sizeof(*cmd) + TLV_HDR_SIZE + sizeof(*cfg) + hw_mode_len +
-		(sizeof(*host_mem_chunks) * WMI_MAX_MEM_REQS);
+	      (sizeof(*host_mem_chunks) * WMI_MAX_MEM_REQS);
 
 	skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, len);
 	if (!skb)
@@ -2878,11 +2878,10 @@ static int ath11k_wmi_tlv_ext_hal_reg_caps(struct ath11k_base *soc,
 	}
 
 	for (i = 0; i < svc_rdy_ext->param.num_phy; i++) {
-		ret = ath11k_pull_reg_cap_svc_rdy_ext
-				(wmi_handle,
-				 svc_rdy_ext->soc_hal_reg_caps,
-				 svc_rdy_ext->ext_hal_reg_caps, i,
-				 &reg_cap);
+		ret = ath11k_pull_reg_cap_svc_rdy_ext(wmi_handle,
+						      svc_rdy_ext->soc_hal_reg_caps,
+						      svc_rdy_ext->ext_hal_reg_caps, i,
+						      &reg_cap);
 		if (ret) {
 			ath11k_warn(soc, "failed to extract reg cap %d\n", i);
 			return ret;
@@ -2900,6 +2899,7 @@ static int ath11k_wmi_tlv_ext_soc_hal_reg_caps_parse(struct ath11k_base *soc,
 {
 	struct ath11k_pdev_wmi *wmi_handle = &soc->wmi_sc.wmi[0];
 	struct wmi_tlv_svc_rdy_ext_parse *svc_rdy_ext = data;
+	u8 hw_mode_id = svc_rdy_ext->pref_hw_mode_caps.hw_mode_id;
 	u32 phy_id_map;
 	int ret;
 
@@ -2910,15 +2910,13 @@ static int ath11k_wmi_tlv_ext_soc_hal_reg_caps_parse(struct ath11k_base *soc,
 	phy_id_map = svc_rdy_ext->pref_hw_mode_caps.phy_id_map;
 
 	while (phy_id_map && soc->num_radios < MAX_RADIOS) {
-		ret = ath11k_pull_mac_phy_cap_service_ready_ext
-			(wmi_handle,
-			 svc_rdy_ext->hw_caps,
-			 svc_rdy_ext->hw_mode_caps,
-			 svc_rdy_ext->soc_hal_reg_caps,
-			 svc_rdy_ext->mac_phy_caps,
-			 svc_rdy_ext->pref_hw_mode_caps.hw_mode_id,
-			 soc->num_radios,
-			 &soc->pdevs[soc->num_radios]);
+		ret = ath11k_pull_mac_phy_cap_svc_ready_ext(wmi_handle,
+							    svc_rdy_ext->hw_caps,
+							    svc_rdy_ext->hw_mode_caps,
+							    svc_rdy_ext->soc_hal_reg_caps,
+							    svc_rdy_ext->mac_phy_caps,
+							    hw_mode_id, soc->num_radios,
+							    &soc->pdevs[soc->num_radios]);
 		if (ret) {
 			ath11k_warn(soc, "failed to extract mac caps, idx :%d\n",
 				    soc->num_radios);
@@ -2943,10 +2941,8 @@ static int ath11k_wmi_tlv_svc_rdy_ext_parse(struct ath11k_base *ab,
 
 	switch (tag) {
 	case WMI_TAG_SERVICE_READY_EXT_EVENT:
-		ret =
-		 ath11k_pull_service_ready_ext(wmi_handle,
-					       (struct wmi_service_ready_ext_event *)ptr,
-					       &svc_rdy_ext->param);
+		ret = ath11k_pull_svc_ready_ext(wmi_handle, ptr,
+						&svc_rdy_ext->param);
 		if (ret) {
 			ath11k_warn(ab, "unable to extract ext params\n");
 			return ret;
@@ -3140,20 +3136,15 @@ static int ath11k_pull_reg_chan_list_update_ev(struct ath11k_base *ab,
 	reg_info->reg_dmn_pair = chan_list_event_hdr->domain_code;
 	if (chan_list_event_hdr->status_code == WMI_REG_SET_CC_STATUS_PASS)
 		reg_info->status_code = REG_SET_CC_STATUS_PASS;
-	else if (chan_list_event_hdr->status_code ==
-		 WMI_REG_CURRENT_ALPHA2_NOT_FOUND)
+	else if (chan_list_event_hdr->status_code == WMI_REG_CURRENT_ALPHA2_NOT_FOUND)
 		reg_info->status_code = REG_CURRENT_ALPHA2_NOT_FOUND;
-	else if (chan_list_event_hdr->status_code ==
-		 WMI_REG_INIT_ALPHA2_NOT_FOUND)
+	else if (chan_list_event_hdr->status_code == WMI_REG_INIT_ALPHA2_NOT_FOUND)
 		reg_info->status_code = REG_INIT_ALPHA2_NOT_FOUND;
-	else if (chan_list_event_hdr->status_code ==
-		 WMI_REG_SET_CC_CHANGE_NOT_ALLOWED)
+	else if (chan_list_event_hdr->status_code == WMI_REG_SET_CC_CHANGE_NOT_ALLOWED)
 		reg_info->status_code = REG_SET_CC_CHANGE_NOT_ALLOWED;
-	else if (chan_list_event_hdr->status_code ==
-		 WMI_REG_SET_CC_STATUS_NO_MEMORY)
+	else if (chan_list_event_hdr->status_code == WMI_REG_SET_CC_STATUS_NO_MEMORY)
 		reg_info->status_code = REG_SET_CC_STATUS_NO_MEMORY;
-	else if (chan_list_event_hdr->status_code ==
-		 WMI_REG_SET_CC_STATUS_FAIL)
+	else if (chan_list_event_hdr->status_code == WMI_REG_SET_CC_STATUS_FAIL)
 		reg_info->status_code = REG_SET_CC_STATUS_FAIL;
 
 	reg_info->min_bw_2g = chan_list_event_hdr->min_bw_2g;
@@ -3180,9 +3171,8 @@ static int ath11k_pull_reg_chan_list_update_ev(struct ath11k_base *ab,
 						+ sizeof(struct wmi_tlv));
 
 	if (num_2g_reg_rules) {
-		reg_info->reg_rules_2g_ptr =
-			create_reg_rules_from_wmi(num_2g_reg_rules,
-						  wmi_reg_rule);
+		reg_info->reg_rules_2g_ptr = create_reg_rules_from_wmi(num_2g_reg_rules,
+								       wmi_reg_rule);
 		if (!reg_info->reg_rules_2g_ptr) {
 			kfree(tb);
 			ath11k_warn(ab, "Unable to Allocate memory for 2g rules\n");
@@ -3192,9 +3182,8 @@ static int ath11k_pull_reg_chan_list_update_ev(struct ath11k_base *ab,
 
 	if (num_5g_reg_rules) {
 		wmi_reg_rule += num_2g_reg_rules;
-		reg_info->reg_rules_5g_ptr =
-			create_reg_rules_from_wmi(num_5g_reg_rules,
-						  wmi_reg_rule);
+		reg_info->reg_rules_5g_ptr = create_reg_rules_from_wmi(num_5g_reg_rules,
+								       wmi_reg_rule);
 		if (!reg_info->reg_rules_5g_ptr) {
 			kfree(tb);
 			ath11k_warn(ab, "Unable to Allocate memory for 5g rules\n");
@@ -3702,7 +3691,6 @@ static int ath11k_pull_chan_info_ev(struct ath11k_base *ab, u8 *evt_buf,
 
 static int
 ath11k_pull_pdev_bss_chan_info_ev(struct ath11k_base *ab, u8 *evt_buf,
-				  u32 len,
 				  struct wmi_pdev_bss_chan_info_event *bss_ch_info_ev)
 {
 	const void **tb;
@@ -3741,9 +3729,9 @@ static int ath11k_pull_chan_info_ev(struct ath11k_base *ab, u8 *evt_buf,
 	return 0;
 }
 
-static int ath11k_pull_vdev_install_key_compl_ev(struct ath11k_base *ab, u8 *evt_buf,
-						 u32 len,
-						 struct wmi_vdev_install_key_complete_arg *install_key_compl)
+static int
+ath11k_pull_vdev_install_key_compl_ev(struct ath11k_base *ab, u8 *evt_buf, u32 len,
+				      struct wmi_vdev_install_key_complete_arg *arg)
 {
 	const void **tb;
 	const struct wmi_vdev_install_key_compl_event *ev;
@@ -3763,11 +3751,11 @@ static int ath11k_pull_vdev_install_key_compl_ev(struct ath11k_base *ab, u8 *evt
 		return -EPROTO;
 	}
 
-	install_key_compl->vdev_id = ev->vdev_id;
-	install_key_compl->macaddr = ev->peer_macaddr.addr;
-	install_key_compl->key_idx = ev->key_idx;
-	install_key_compl->key_flags = ev->key_flags;
-	install_key_compl->status = ev->status;
+	arg->vdev_id = ev->vdev_id;
+	arg->macaddr = ev->peer_macaddr.addr;
+	arg->key_idx = ev->key_idx;
+	arg->key_flags = ev->key_flags;
+	arg->status = ev->status;
 
 	kfree(tb);
 	return 0;
@@ -3879,24 +3867,19 @@ static void ath11k_wmi_pull_pdev_stats_rx(const struct wmi_pdev_stats_rx *src,
 	dst->num_tx_not_acked = src->num_tx_not_acked;
 
 	for (i = 0; i < ARRAY_SIZE(src->num_tx_frames); i++)
-		dst->num_tx_frames[i] =
-			src->num_tx_frames[i];
+		dst->num_tx_frames[i] = src->num_tx_frames[i];
 
 	for (i = 0; i < ARRAY_SIZE(src->num_tx_frames_retries); i++)
-		dst->num_tx_frames_retries[i] =
-			src->num_tx_frames_retries[i];
+		dst->num_tx_frames_retries[i] = src->num_tx_frames_retries[i];
 
 	for (i = 0; i < ARRAY_SIZE(src->num_tx_frames_failures); i++)
-		dst->num_tx_frames_failures[i] =
-			src->num_tx_frames_failures[i];
+		dst->num_tx_frames_failures[i] = src->num_tx_frames_failures[i];
 
 	for (i = 0; i < ARRAY_SIZE(src->tx_rate_history); i++)
-		dst->tx_rate_history[i] =
-			src->tx_rate_history[i];
+		dst->tx_rate_history[i] = src->tx_rate_history[i];
 
 	for (i = 0; i < ARRAY_SIZE(src->beacon_rssi_history); i++)
-		dst->beacon_rssi_history[i] =
-			src->beacon_rssi_history[i];
+		dst->beacon_rssi_history[i] = src->beacon_rssi_history[i];
 }
 
 static void
@@ -4399,14 +4382,14 @@ static size_t ath11k_wmi_fw_stats_num_bcn(struct list_head *head)
 	struct ath11k_vif *arvif = ath11k_mac_get_arvif(ar, bcn->vdev_id);
 	u8 *vdev_macaddr;
 
-	if (arvif) {
-		vdev_macaddr = arvif->vif->addr;
-	} else {
+	if (!arvif) {
 		ath11k_warn(ar->ab, "invalid vdev id %d in bcn stats",
 			    bcn->vdev_id);
 		return;
 	}
 
+	vdev_macaddr = arvif->vif->addr;
+
 	len += scnprintf(buf + len, buf_len - len, "%30s %u\n",
 			 "VDEV ID", bcn->vdev_id);
 	len += scnprintf(buf + len, buf_len - len, "%30s %pM\n",
@@ -4459,9 +4442,8 @@ void ath11k_wmi_fw_stats_fill(struct ath11k *ar,
 		len += scnprintf(buf + len, buf_len - len, "%30s\n\n",
 				 "=================");
 
-		list_for_each_entry(vdev, &fw_stats->vdevs, list) {
+		list_for_each_entry(vdev, &fw_stats->vdevs, list)
 			ath11k_wmi_fw_vdev_stats_fill(ar, vdev, buf, &len);
-		}
 	}
 
 	if (stats_id == WMI_REQUEST_BCN_STAT) {
@@ -4473,9 +4455,8 @@ void ath11k_wmi_fw_stats_fill(struct ath11k *ar,
 		len += scnprintf(buf + len, buf_len - len, "%30s\n\n",
 				 "===================");
 
-		list_for_each_entry(bcn, &fw_stats->bcn, list) {
+		list_for_each_entry(bcn, &fw_stats->bcn, list)
 			ath11k_wmi_fw_bcn_stats_fill(ar, bcn, buf, &len);
-		}
 	}
 
 	if (stats_id & WMI_REQUEST_PEER_STAT) {
@@ -4486,9 +4467,8 @@ void ath11k_wmi_fw_stats_fill(struct ath11k *ar,
 		len += scnprintf(buf + len, buf_len - len, "%30s\n\n",
 				 "=================");
 
-		list_for_each_entry(peer, &fw_stats->peers, list) {
+		list_for_each_entry(peer, &fw_stats->peers, list)
 			ath11k_wmi_fw_peer_stats_fill(peer, buf, &len);
-		}
 	}
 
 	if (stats_id & WMI_REQUEST_PEER_EXTD_STAT) {
@@ -4500,9 +4480,8 @@ void ath11k_wmi_fw_stats_fill(struct ath11k *ar,
 		len += scnprintf(buf + len, buf_len - len, "%30s\n\n",
 				 "======================");
 
-		list_for_each_entry(peer_extd, &fw_stats->peers_extd, list) {
+		list_for_each_entry(peer_extd, &fw_stats->peers_extd, list)
 			ath11k_wmi_fw_peer_extd_stats_fill(peer_extd, buf, &len);
-		}
 	}
 
 unlock:
@@ -4970,8 +4949,7 @@ static void ath11k_scan_event(struct ath11k_base *ab, u8 *evt_buf, u32 len)
 	struct ath11k *ar;
 	struct wmi_scan_event scan_ev = {0};
 
-	if (ath11k_pull_scan_ev(ab, evt_buf, len,
-				&scan_ev) != 0) {
+	if (ath11k_pull_scan_ev(ab, evt_buf, len, &scan_ev) != 0) {
 		ath11k_warn(ab, "failed to extract scan event");
 		return;
 	}
@@ -5000,8 +4978,7 @@ static void ath11k_scan_event(struct ath11k_base *ab, u8 *evt_buf, u32 len)
 
 	ath11k_dbg(ab, ATH11K_DBG_WMI,
 		   "scan event %s type %d reason %d freq %d req_id %d scan_id %d vdev_id %d state %s (%d)\n",
-		   ath11k_wmi_event_scan_type_str(scan_ev.event_type,
-						  scan_ev.reason),
+		   ath11k_wmi_event_scan_type_str(scan_ev.event_type, scan_ev.reason),
 		   scan_ev.event_type, scan_ev.reason, scan_ev.channel_freq,
 		   scan_ev.scan_req_id, scan_ev.scan_id, scan_ev.vdev_id,
 		   ath11k_scan_state_str(ar->scan.state), ar->scan.state);
@@ -5306,8 +5283,7 @@ static void ath11k_vdev_install_key_compl_event(struct ath11k_base *ab, u8 *evt_
 
 	ar->install_key_status = 0;
 
-	if (install_key_compl.status !=
-		WMI_VDEV_INSTALL_KEY_COMPL_STATUS_SUCCESS) {
+	if (install_key_compl.status != WMI_VDEV_INSTALL_KEY_COMPL_STATUS_SUCCESS) {
 		ath11k_warn(ab, "install key failed for %pM status %d\n",
 			    install_key_compl.macaddr, install_key_compl.status);
 		ar->install_key_status = install_key_compl.status;
@@ -5697,7 +5673,7 @@ static int ath11k_connect_pdev_htc_service(struct ath11k_base *sc,
 	int ret;
 	int i;
 
-	arg_len = (sizeof(u32) * ut_cmd.num_args);
+	arg_len = sizeof(u32) * ut_cmd.num_args;
 	buf_len = sizeof(ut_cmd) + arg_len + TLV_HDR_SIZE;
 
 	skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, buf_len);
@@ -5705,10 +5681,8 @@ static int ath11k_connect_pdev_htc_service(struct ath11k_base *sc,
 		return -ENOMEM;
 
 	cmd = (struct wmi_unit_test_cmd *)skb->data;
-	cmd->tlv_header =
-		FIELD_PREP(WMI_TLV_TAG,
-			   WMI_TAG_UNIT_TEST_CMD) |
-		FIELD_PREP(WMI_TLV_LEN, sizeof(ut_cmd) - TLV_HDR_SIZE);
+	cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_UNIT_TEST_CMD) |
+			  FIELD_PREP(WMI_TLV_LEN, sizeof(ut_cmd) - TLV_HDR_SIZE);
 
 	cmd->vdev_id = ut_cmd.vdev_id;
 	cmd->module_id = ut_cmd.module_id;
@@ -5727,15 +5701,14 @@ static int ath11k_connect_pdev_htc_service(struct ath11k_base *sc,
 	for (i = 0; i < ut_cmd.num_args; i++)
 		ut_cmd_args[i] = test_args[i];
 
-	ret = ath11k_wmi_cmd_send(wmi, skb,
-				  WMI_UNIT_TEST_CMDID);
+	ret = ath11k_wmi_cmd_send(wmi, skb, WMI_UNIT_TEST_CMDID);
 
 	if (ret) {
-		ath11k_warn(ar->ab,
-			    "failed to send WMI_UNIT_TEST CMD :%d\n",
+		ath11k_warn(ar->ab, "failed to send WMI_UNIT_TEST CMD :%d\n",
 			    ret);
 		dev_kfree_skb(skb);
 	}
+
 	ath11k_dbg(ar->ab, ATH11K_DBG_WMI,
 		   "WMI unit test : module %d vdev %d n_args %d token %d\n",
 		   cmd->module_id, cmd->vdev_id, cmd->num_args,
Signature · 7 lines
1.9.1


_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k
#2 lore raw

PATCH 3/4 ath11k/wmi: Remove unnecessary type casting

In reply to Vasanthakumar Thiagarajan

- Remove unnecessary type cast of void *
- Remove type casting in ether_addr_copy() and use u8 *mac_addr.addri directly.
- Remove the type cast in ath11k_wmi_vdev_install_key() with memcpy().

---
 drivers/net/wireless/ath/ath11k/wmi.c | 58 +++++++++++++++++------------------
 1 file changed, 29 insertions(+), 29 deletions(-)
drivers/net/wireless/ath/ath11k/wmi.c +29 -29
index 6807ee5..713f8b3 100644
@@ -604,7 +604,7 @@ int ath11k_wmi_vdev_create(struct ath11k *ar, u8 *macaddr,
 	cmd->vdev_subtype = param->subtype;
 	cmd->num_cfg_txrx_streams = WMI_NUM_SUPPORTED_BAND_MAX;
 	cmd->pdev_id = param->pdev_id;
-	ether_addr_copy((u8 *)&cmd->vdev_macaddr, macaddr);
+	ether_addr_copy(cmd->vdev_macaddr.addr, macaddr);
 
 	ptr = skb->data + sizeof(*cmd);
 	len = WMI_NUM_SUPPORTED_BAND_MAX * sizeof(*txrx_streams);
@@ -614,7 +614,7 @@ int ath11k_wmi_vdev_create(struct ath11k *ar, u8 *macaddr,
 		      FIELD_PREP(WMI_TLV_LEN, len);
 
 	ptr += TLV_HDR_SIZE;
-	txrx_streams = (void *)ptr;
+	txrx_streams = ptr;
 	len = sizeof(*txrx_streams);
 	txrx_streams->tlv_header =
 		FIELD_PREP(WMI_TLV_TAG, WMI_TAG_VDEV_TXRX_STREAMS) |
@@ -822,8 +822,8 @@ int ath11k_wmi_vdev_start(struct ath11k *ar, struct wmi_vdev_start_req_arg *arg,
 
 	cmd->flags |= WMI_VDEV_START_LDPC_RX_ENABLED;
 
-	ptr = (void *)skb->data + sizeof(*cmd);
-	chan = (struct wmi_channel *)ptr;
+	ptr = skb->data + sizeof(*cmd);
+	chan = ptr;
 
 	ath11k_wmi_put_wmi_channel(chan, arg);
 
@@ -910,7 +910,7 @@ int ath11k_wmi_send_peer_create_cmd(struct ath11k *ar,
 	cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_PEER_CREATE_CMD) |
 			  FIELD_PREP(WMI_TLV_LEN, sizeof(*cmd) - TLV_HDR_SIZE);
 
-	ether_addr_copy((u8 *)&cmd->peer_macaddr, param->peer_addr);
+	ether_addr_copy(cmd->peer_macaddr.addr, param->peer_addr);
 	cmd->peer_type = param->peer_type;
 	cmd->vdev_id = param->vdev_id;
 
@@ -943,7 +943,7 @@ int ath11k_wmi_send_peer_delete_cmd(struct ath11k *ar,
 	cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_PEER_DELETE_CMD) |
 			  FIELD_PREP(WMI_TLV_LEN, sizeof(*cmd) - TLV_HDR_SIZE);
 
-	ether_addr_copy((u8 *)&cmd->peer_macaddr, peer_addr);
+	ether_addr_copy(cmd->peer_macaddr.addr, peer_addr);
 	cmd->vdev_id = vdev_id;
 
 	ath11k_dbg(ar->ab, ATH11K_DBG_WMI,
@@ -1049,7 +1049,7 @@ int ath11k_wmi_send_peer_flush_tids_cmd(struct ath11k *ar,
 	cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_PEER_FLUSH_TIDS_CMD) |
 			  FIELD_PREP(WMI_TLV_LEN, sizeof(*cmd) - TLV_HDR_SIZE);
 
-	ether_addr_copy((u8 *)&cmd->peer_macaddr, peer_addr);
+	ether_addr_copy(cmd->peer_macaddr.addr, peer_addr);
 	cmd->peer_tid_bitmap = param->peer_tid_bitmap;
 	cmd->vdev_id = param->vdev_id;
 
@@ -1086,7 +1086,7 @@ int ath11k_wmi_peer_rx_reorder_queue_setup(struct ath11k *ar,
 				     WMI_TAG_REORDER_QUEUE_SETUP_CMD) |
 			  FIELD_PREP(WMI_TLV_LEN, sizeof(*cmd) - TLV_HDR_SIZE);
 
-	ether_addr_copy((u8 *)&cmd->peer_macaddr, (u8 *)addr);
+	ether_addr_copy(cmd->peer_macaddr.addr, addr);
 	cmd->vdev_id = vdev_id;
 	cmd->tid = tid;
 	cmd->queue_ptr_lo = lower_32_bits(paddr);
@@ -1128,7 +1128,7 @@ int ath11k_wmi_peer_rx_reorder_queue_setup(struct ath11k *ar,
 				     WMI_TAG_REORDER_QUEUE_REMOVE_CMD) |
 			  FIELD_PREP(WMI_TLV_LEN, sizeof(*cmd) - TLV_HDR_SIZE);
 
-	ether_addr_copy((u8 *)&cmd->peer_macaddr, param->peer_macaddr);
+	ether_addr_copy(cmd->peer_macaddr.addr, param->peer_macaddr);
 	cmd->vdev_id = param->vdev_id;
 	cmd->tid_mask = param->peer_tid_bitmap;
 
@@ -1294,7 +1294,7 @@ int ath11k_wmi_send_set_ap_ps_param_cmd(struct ath11k *ar, u8 *peer_addr,
 			  FIELD_PREP(WMI_TLV_LEN, sizeof(*cmd) - TLV_HDR_SIZE);
 
 	cmd->vdev_id = param->vdev_id;
-	ether_addr_copy((u8 *)&cmd->peer_macaddr, peer_addr);
+	ether_addr_copy(cmd->peer_macaddr.addr, peer_addr);
 	cmd->param = param->param;
 	cmd->value = param->value;
 
@@ -1552,7 +1552,7 @@ int ath11k_wmi_vdev_install_key(struct ath11k *ar,
 	cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_VDEV_INSTALL_KEY_CMD) |
 			  FIELD_PREP(WMI_TLV_LEN, sizeof(*cmd) - TLV_HDR_SIZE);
 	cmd->vdev_id = arg->vdev_id;
-	ether_addr_copy((u8 *)&cmd->peer_macaddr, arg->macaddr);
+	ether_addr_copy(cmd->peer_macaddr.addr, arg->macaddr);
 	cmd->key_idx = arg->key_idx;
 	cmd->key_flags = arg->key_flags;
 	cmd->key_cipher = arg->key_cipher;
@@ -1561,7 +1561,7 @@ int ath11k_wmi_vdev_install_key(struct ath11k *ar,
 	cmd->key_rxmic_len = arg->key_rxmic_len;
 
 	if (arg->key_rsc_counter)
-		memcpy((u8 *)&cmd->key_rsc_counter, (u8 *)&arg->key_rsc_counter,
+		memcpy(&cmd->key_rsc_counter, &arg->key_rsc_counter,
 		       sizeof(struct wmi_key_seq_counter));
 
 	tlv = (struct wmi_tlv *)(skb->data + sizeof(*cmd));
@@ -1692,7 +1692,7 @@ int ath11k_wmi_send_peer_assoc_cmd(struct ath11k *ar,
 
 	ptr = skb->data;
 
-	cmd = (struct wmi_peer_assoc_complete_cmd *)ptr;
+	cmd = ptr;
 	cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG,
 				     WMI_TAG_PEER_ASSOC_COMPLETE_CMD) |
 			  FIELD_PREP(WMI_TLV_LEN, sizeof(*cmd) - TLV_HDR_SIZE);
@@ -1704,7 +1704,7 @@ int ath11k_wmi_send_peer_assoc_cmd(struct ath11k *ar,
 
 	ath11k_wmi_copy_peer_flags(cmd, param);
 
-	ether_addr_copy((u8 *)&cmd->peer_macaddr, param->peer_mac);
+	ether_addr_copy(cmd->peer_macaddr.addr, param->peer_mac);
 
 	cmd->peer_rate_caps = param->peer_rate_caps;
 	cmd->peer_caps = param->peer_caps;
@@ -1752,7 +1752,7 @@ int ath11k_wmi_send_peer_assoc_cmd(struct ath11k *ar,
 	/* VHT Rates */
 	ptr += peer_ht_rates_align;
 
-	mcs = (struct wmi_vht_rate_set *)ptr;
+	mcs = ptr;
 
 	mcs->tlv_header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_VHT_RATE_SET) |
 			  FIELD_PREP(WMI_TLV_LEN, sizeof(*mcs) - TLV_HDR_SIZE);
@@ -1784,7 +1784,7 @@ int ath11k_wmi_send_peer_assoc_cmd(struct ath11k *ar,
 
 	/* Loop through the HE rate set */
 	for (i = 0; i < param->peer_he_mcs_count; i++) {
-		he_mcs = (struct wmi_he_rate_set *)ptr;
+		he_mcs = ptr;
 		he_mcs->tlv_header = FIELD_PREP(WMI_TLV_TAG,
 						WMI_TAG_HE_RATE_SET) |
 				     FIELD_PREP(WMI_TLV_LEN,
@@ -1949,7 +1949,7 @@ int ath11k_wmi_send_scan_start_cmd(struct ath11k *ar,
 
 	ptr = skb->data;
 
-	cmd = (struct wmi_start_scan_cmd *)ptr;
+	cmd = ptr;
 	cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_START_SCAN_CMD) |
 			  FIELD_PREP(WMI_TLV_LEN, sizeof(*cmd) - TLV_HDR_SIZE);
 
@@ -2001,7 +2001,7 @@ int ath11k_wmi_send_scan_start_cmd(struct ath11k *ar,
 	ptr += TLV_HDR_SIZE;
 
 	if (params->num_ssids) {
-		ssid = (struct wmi_ssid *)ptr;
+		ssid = ptr;
 		for (i = 0; i < params->num_ssids; ++i) {
 			ssid->ssid_len = params->ssid[i].length;
 			memcpy(ssid->ssid, params->ssid[i].ssid,
@@ -2017,12 +2017,12 @@ int ath11k_wmi_send_scan_start_cmd(struct ath11k *ar,
 		      FIELD_PREP(WMI_TLV_LEN, len);
 
 	ptr += TLV_HDR_SIZE;
-	bssid = (struct wmi_mac_addr *)ptr;
+	bssid = ptr;
 
 	if (params->num_bssid) {
 		for (i = 0; i < params->num_bssid; ++i) {
-			ether_addr_copy((u8 *)bssid,
-					(u8 *)&params->bssid_list[i]);
+			ether_addr_copy(bssid->addr,
+					params->bssid_list[i].addr);
 			bssid++;
 		}
 	}
@@ -2139,7 +2139,7 @@ int ath11k_wmi_send_scan_chan_list_cmd(struct ath11k *ar,
 	tchan_info = &chan_list->ch_param[0];
 
 	for (i = 0; i < chan_list->nallchans; ++i) {
-		chan_info = (struct wmi_channel *)ptr;
+		chan_info = ptr;
 		memset(chan_info, 0, sizeof(*chan_info));
 		len = sizeof(*chan_info);
 		chan_info->tlv_header = FIELD_PREP(WMI_TLV_TAG,
@@ -2331,7 +2331,7 @@ int ath11k_wmi_pdev_peer_pktlog_filter(struct ath11k *ar, u8 *addr, u8 enable)
 		      FIELD_PREP(WMI_TLV_LEN, 0);
 
 	ptr += TLV_HDR_SIZE;
-	info = (struct wmi_pdev_pktlog_filter_info *)ptr;
+	info = ptr;
 
 	ether_addr_copy(info->peer_macaddr.addr, addr);
 	info->tlv_header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_PDEV_PEER_PKTLOG_FILTER_INFO) |
@@ -2586,7 +2586,7 @@ static int ath11k_init_cmd_send(struct ath11k_pdev_wmi *wmi,
 			  FIELD_PREP(WMI_TLV_LEN, sizeof(*cmd) - TLV_HDR_SIZE);
 
 	ptr = skb->data + sizeof(*cmd);
-	cfg = (struct wmi_resource_config *)ptr;
+	cfg = ptr;
 
 	ath11k_wmi_copy_resource_config(cfg, param->res_cfg);
 
@@ -2594,7 +2594,7 @@ static int ath11k_init_cmd_send(struct ath11k_pdev_wmi *wmi,
 			  FIELD_PREP(WMI_TLV_LEN, sizeof(*cfg) - TLV_HDR_SIZE);
 
 	ptr += sizeof(*cfg);
-	host_mem_chunks = (struct wlan_host_mem_chunk *)(ptr + TLV_HDR_SIZE);
+	host_mem_chunks = ptr + TLV_HDR_SIZE;
 	len = sizeof(struct wlan_host_mem_chunk);
 
 	for (idx = 0; idx < param->num_mem_chunks; ++idx) {
@@ -3221,8 +3221,8 @@ static int ath11k_pull_peer_del_resp_ev(struct ath11k_base *ab, u8 *evt_buf, u32
 	memset(peer_del_resp, 0, sizeof(*peer_del_resp));
 
 	peer_del_resp->vdev_id = ev->vdev_id;
-	ether_addr_copy((u8 *)&peer_del_resp->peer_macaddr,
-			(u8 *)&ev->peer_macaddr);
+	ether_addr_copy(peer_del_resp->peer_macaddr.addr,
+			ev->peer_macaddr.addr);
 
 	kfree(tb);
 	return 0;
@@ -4631,7 +4631,7 @@ static int ath11k_wmi_tlv_rdy_parse(struct ath11k_base *ab, u16 tag, u16 len,
 		ab->wlan_init_status = fixed_param->status;
 		rdy_parse->num_extra_mac_addr = fixed_param->num_extra_mac_addr;
 
-		ether_addr_copy(ab->mac_addr, (u8 *)&fixed_param->mac_addr);
+		ether_addr_copy(ab->mac_addr, fixed_param->mac_addr.addr);
 		ab->wmi_ready = true;
 		break;
 	case WMI_TAG_ARRAY_FIXED_STRUCT:
@@ -4643,7 +4643,7 @@ static int ath11k_wmi_tlv_rdy_parse(struct ath11k_base *ab, u16 tag, u16 len,
 
 		for (i = 0; i < ab->num_radios; i++) {
 			pdev = &ab->pdevs[i];
-			ether_addr_copy(pdev->mac_addr, (u8 *)&addr_list[i]);
+			ether_addr_copy(pdev->mac_addr, addr_list[i].addr);
 		}
 		ab->pdevs_macaddr_valid = true;
 		break;
Signature · 7 lines
1.9.1


_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k
#3 lore raw

PATCH 4/4 ath11k/wmi: Clean up function parameter list in wmi event handlers

In reply to Vasanthakumar Thiagarajan

Instead of passing skb->data and skb->len to the wmi event handlers pass skb itself and retrieve data and len from inside the handlers from skb.

---
 drivers/net/wireless/ath/ath11k/debug.c |   4 +-
 drivers/net/wireless/ath/ath11k/debug.h |   7 +-
 drivers/net/wireless/ath/ath11k/wmi.c   | 212 +++++++++++++++-----------------
 drivers/net/wireless/ath/ath11k/wmi.h   |   2 +-
 4 files changed, 103 insertions(+), 122 deletions(-)
drivers/net/wireless/ath/ath11k/debug.c +2 -2
index 6aa260c..76cbd22 100644
@@ -166,7 +166,7 @@ static void ath11k_debug_fw_stats_reset(struct ath11k *ar)
 	spin_unlock_bh(&ar->data_lock);
 }
 
-void ath11k_debug_fw_stats_process(struct ath11k_base *ab, u8 *evt_buf, u32 len)
+void ath11k_debug_fw_stats_process(struct ath11k_base *ab, struct sk_buff *skb)
 {
 	struct ath11k_fw_stats stats = {};
 	struct ath11k *ar;
@@ -184,7 +184,7 @@ void ath11k_debug_fw_stats_process(struct ath11k_base *ab, u8 *evt_buf, u32 len)
 	INIT_LIST_HEAD(&stats.bcn);
 	INIT_LIST_HEAD(&stats.peers_extd);
 
-	ret = ath11k_wmi_pull_fw_stats(ab, evt_buf, len, &stats);
+	ret = ath11k_wmi_pull_fw_stats(ab, skb, &stats);
 	if (ret) {
 		ath11k_warn(ab, "failed to pull fw stats: %d\n", ret);
 		goto free;
drivers/net/wireless/ath/ath11k/debug.h +3 -4
index d0c69c4..e73a4f7 100644
@@ -136,8 +136,7 @@ static inline void ath11k_dbg_dump(struct ath11k_base *ab,
 void ath11k_debug_unregister(struct ath11k *ar);
 void ath11k_dbg_htt_ext_stats_handler(struct ath11k_base *ab,
 				      struct sk_buff *skb);
-void ath11k_debug_fw_stats_process(struct ath11k_base *ab, u8 *evt_buf,
-				   u32 len);
+void ath11k_debug_fw_stats_process(struct ath11k_base *ab, struct sk_buff *skb);
 
 void ath11k_debug_fw_stats_init(struct ath11k *ar);
 int ath11k_dbg_htt_stats_req(struct ath11k *ar);
@@ -191,8 +190,8 @@ static inline void ath11k_dbg_htt_ext_stats_handler(struct ath11k_base *ab,
 {
 }
 
-static inline void ath11k_debug_fw_stats_process(struct ath11k_base *ab, u8 *evt_buf,
-						 u32 len)
+static inline void ath11k_debug_fw_stats_process(struct ath11k_base *ab,
+						 struct sk_buff *skb)
 {
 }
 
drivers/net/wireless/ath/ath11k/wmi.c +97 -115

655 lines not on this page · raw message

drivers/net/wireless/ath/ath11k/wmi.h +1 -1
index 248326e..e6566f7 100644
@@ -4703,7 +4703,7 @@ int ath11k_wmi_send_bcn_offload_control_cmd(struct ath11k *ar,
 				 struct rx_reorder_queue_remove_params *param);
 int ath11k_wmi_send_pdev_set_regdomain(struct ath11k *ar,
 				       struct pdev_set_regdomain_params *param);
-int ath11k_wmi_pull_fw_stats(struct ath11k_base *ab, u8 *evt_buf, u32 len,
+int ath11k_wmi_pull_fw_stats(struct ath11k_base *ab, struct sk_buff *skb,
 			     struct ath11k_fw_stats *stats);
 size_t ath11k_wmi_fw_stats_num_peers(struct list_head *head);
 size_t ath11k_wmi_fw_stats_num_peers_extd(struct list_head *head);
Signature · 7 lines
1.9.1


_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k
#4 lore raw
In reply to Vasanthakumar Thiagarajan
Quoted 4 lines · Vasanthakumar Thiagarajan

There is going to be only one version of WMI TLV.

4 patches applied to ath11k-bringup branch of ath.git, thanks.

5cbfcf7e1e73 ath11k/wmi: Remove wmi service abstraction fcafe58d61d3 ath11k/wmi: Clean up few indentations in wmi 3e3dd4c0b842 ath11k/wmi: Remove unnecessary type casting eed27be604a2 ath11k/wmi: Clean up function parameter list in wmi event handlers

Signature · 9 lines
https://patchwork.kernel.org/patch/11017539/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k