Browse Source

Merge changes Id53cc788,I27fe45e9,Ic15bada7,Ib2cb73f5,If2f86924 into wlan-cmn.driver.lnx.2.0

* changes:
  qcacmn: Set the initial wake flag on MSI resume
  qcacmn: Add support to query RCPI info
  qcacmn: Inc the peer->peer_objmgr.ref_cnt in time
  qcacmn: fix spinlock paring issue
  qcacmn: Separate TcpDelAck and TcpAdvWinScale
CNSS_WLAN Service 7 years ago
parent
commit
e663867057

+ 3 - 1
dp/wifi3.0/dp_tx_flow_control.c

@@ -147,8 +147,10 @@ struct dp_tx_desc_pool_s *dp_tx_create_flow_pool(struct dp_soc *soc,
 		return pool;
 	}
 
-	if (dp_tx_desc_pool_alloc(soc, flow_pool_id, flow_pool_size))
+	if (dp_tx_desc_pool_alloc(soc, flow_pool_id, flow_pool_size)) {
+		qdf_spin_unlock_bh(&pool->flow_pool_lock);
 		return NULL;
+	}
 
 	stop_threshold = wlan_cfg_get_tx_flow_stop_queue_th(soc->wlan_cfg_ctx);
 	start_threshold = stop_threshold +

+ 12 - 0
hif/inc/hif.h

@@ -922,4 +922,16 @@ void hif_print_napi_stats(struct hif_opaque_softc *hif_ctx);
 
 void *hif_get_dev_ba(struct hif_opaque_softc *hif_handle);
 
+/**
+ * hif_set_initial_wakeup_cb() - set the initial wakeup event handler function
+ * @hif_ctx - the HIF context to assign the callback to
+ * @callback - the callback to assign
+ * @priv - the private data to pass to the callback when invoked
+ *
+ * Return: None
+ */
+void hif_set_initial_wakeup_cb(struct hif_opaque_softc *hif_ctx,
+			       void (*callback)(void *),
+			       void *priv);
+
 #endif /* _HIF_H_ */

+ 19 - 0
hif/src/hif_main.c

@@ -1217,6 +1217,9 @@ irqreturn_t hif_wake_interrupt_handler(int irq, void *context)
 
 	HIF_INFO("wake interrupt received on irq %d", irq);
 
+	if (scn->initial_wakeup_cb)
+		scn->initial_wakeup_cb(scn->initial_wakeup_priv);
+
 	if (hif_is_ut_suspended(scn))
 		hif_ut_fw_resume(scn);
 
@@ -1225,8 +1228,24 @@ irqreturn_t hif_wake_interrupt_handler(int irq, void *context)
 #else /* WLAN_SUSPEND_RESUME_TEST */
 irqreturn_t hif_wake_interrupt_handler(int irq, void *context)
 {
+	struct hif_softc *scn = context;
+
 	HIF_INFO("wake interrupt received on irq %d", irq);
 
+	if (scn->initial_wakeup_cb)
+		scn->initial_wakeup_cb(scn->initial_wakeup_priv);
+
 	return IRQ_HANDLED;
 }
 #endif /* WLAN_SUSPEND_RESUME_TEST */
+
+void hif_set_initial_wakeup_cb(struct hif_opaque_softc *hif_ctx,
+			       void (*callback)(void *),
+			       void *priv)
+{
+	struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx);
+
+	scn->initial_wakeup_cb = callback;
+	scn->initial_wakeup_priv = priv;
+}
+

+ 2 - 0
hif/src/hif_main.h

@@ -169,6 +169,8 @@ struct hif_softc {
 	struct hif_ut_suspend_context ut_suspend_ctx;
 	uint32_t hif_attribute;
 	int wake_irq;
+	void (*initial_wakeup_cb)(void *);
+	void *initial_wakeup_priv;
 };
 
 static inline void *hif_get_hal_handle(void *hif_hdl)

+ 3 - 0
htc/htc.c

@@ -317,6 +317,9 @@ HTC_HANDLE htc_create(void *ol_sc, struct htc_init_info *pInfo,
 		hif_post_init(target->hif_dev, target, &htcCallbacks);
 		hif_get_default_pipe(target->hif_dev, &pEndpoint->UL_PipeID,
 				     &pEndpoint->DL_PipeID);
+		hif_set_initial_wakeup_cb(target->hif_dev,
+					  pInfo->target_initial_wakeup_cb,
+					  pInfo->target_psoc);
 
 	} while (false);
 

+ 4 - 2
umac/cmn_services/obj_mgr/src/wlan_objmgr_peer_obj.c

@@ -167,6 +167,10 @@ struct wlan_objmgr_peer *wlan_objmgr_peer_obj_create(
 				macaddr[3], macaddr[4], macaddr[5]);
 		return NULL;
 	}
+	qdf_atomic_init(&peer->peer_objmgr.ref_cnt);
+	for (id = 0; id < WLAN_REF_ID_MAX; id++)
+		qdf_atomic_init(&peer->peer_objmgr.ref_id_dbg[id]);
+	wlan_objmgr_peer_get_ref(peer, WLAN_OBJMGR_ID);
 	/* set vdev to peer */
 	wlan_peer_set_vdev(peer, vdev);
 	/* set peer type */
@@ -176,7 +180,6 @@ struct wlan_objmgr_peer *wlan_objmgr_peer_obj_create(
 	/* initialize peer state */
 	wlan_peer_mlme_set_state(peer, WLAN_INIT_STATE);
 	wlan_peer_mlme_reset_seq_num(peer);
-	qdf_atomic_init(&peer->peer_objmgr.ref_cnt);
 	peer->peer_objmgr.print_cnt = 0;
 	/* Attach peer to psoc, psoc maintains the node table for the device */
 	if (wlan_objmgr_psoc_peer_attach(psoc, peer) !=
@@ -201,7 +204,6 @@ struct wlan_objmgr_peer *wlan_objmgr_peer_obj_create(
 		return NULL;
 	}
 	qdf_spinlock_create(&peer->peer_lock);
-	wlan_objmgr_peer_get_ref(peer, WLAN_OBJMGR_ID);
 	/* Increment ref count for BSS peer, so that BSS peer deletes last*/
 	if ((type == WLAN_PEER_STA) || (type == WLAN_PEER_STA_TEMP)
 				    || (type == WLAN_PEER_P2P_CLI))

+ 16 - 0
utils/nlink/inc/wlan_nlink_common.h

@@ -250,4 +250,20 @@ struct wlan_core_minfreq {
 	uint16_t freq;
 };
 
+/* Indication to enable TCP delayed ack in TPUT indication */
+#define TCP_DEL_ACK_IND	(1 << 0)
+/* Indication to enable TCP advance window scaling in TPUT indication */
+#define TCP_ADV_WIN_SCL	(1 << 1)
+
+/**
+ * struct wlan_rx_tp_data - msg to TCP delayed ack and advance window scaling
+ * @level:            Throughput level.
+ * @rx_tp_flags:      Bit map of flags, for which this indcation will take
+ *                    effect, bit map for TCP_ADV_WIN_SCL and TCP_DEL_ACK_IND.
+ */
+struct wlan_rx_tp_data {
+	enum wlan_tp_level level;
+	uint16_t rx_tp_flags;
+};
+
 #endif /* WLAN_NLINK_COMMON_H__ */

+ 22 - 0
wmi/inc/wmi_unified_api.h

@@ -1551,6 +1551,28 @@ QDF_STATUS wmi_unified_roam_send_hlp_cmd(void *wmi_hdl,
 					struct hlp_params *req_buf);
 #endif
 
+/**
+ * wmi_unified_send_request_get_rcpi_cmd() - command to request rcpi value
+ * @wmi_hdl: wma handle
+ * @get_rcpi_param: rcpi params
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_unified_send_request_get_rcpi_cmd(void *wmi_hdl,
+					struct rcpi_req *get_rcpi_param);
+
+/**
+ * wmi_extract_rcpi_response_event - api to extract RCPI event params
+ * @wmi_handle: wma handle
+ * @evt_buf: pointer to event buffer
+ * @res: pointer to hold rcpi response from firmware
+ *
+ * Return: QDF_STATUS_SUCCESS for successful event parse
+ *         else QDF_STATUS_E_INVAL or QDF_STATUS_E_FAILURE
+ */
+QDF_STATUS wmi_extract_rcpi_response_event(void *wmi_hdl, void *evt_buf,
+					   struct rcpi_res *res);
+
 #ifdef WMI_INTERFACE_EVENT_LOGGING
 void wmi_print_cmd_log(wmi_unified_t wmi, uint32_t count,
 		       qdf_abstract_print *print, void *print_priv);

+ 43 - 0
wmi/inc/wmi_unified_param.h

@@ -5405,6 +5405,7 @@ typedef enum {
 	wmi_11d_new_country_event_id,
 	wmi_get_arp_stats_req_id,
 	wmi_service_available_event_id,
+	wmi_update_rcpi_event_id,
 
 	wmi_events_max,
 } wmi_conv_event_id;
@@ -7555,6 +7556,48 @@ typedef struct {
 	uint32_t usr_list[GID_OVERLOAD_GROUP_COUNT];
 } wmi_host_peer_gid_userpos_list_event;
 
+/**
+ * enum rcpi_measurement_type - for identifying type of rcpi measurement
+ * @RCPI_MEASUREMENT_TYPE_AVG_MGMT: avg rcpi of mgmt frames
+ * @RCPI_MEASUREMENT_TYPE_AVG_DATA: avg rcpi of data frames
+ * @RCPI_MEASUREMENT_TYPE_LAST_MGMT: rcpi of last mgmt frame
+ * @RCPI_MEASUREMENT_TYPE_LAST_DATA: rcpi of last data frame
+ * @RCPI_MEASUREMENT_TYPE_INVALID: invalid rcpi measurement type
+ */
+enum rcpi_measurement_type {
+	RCPI_MEASUREMENT_TYPE_AVG_MGMT  = 0x1,
+	RCPI_MEASUREMENT_TYPE_AVG_DATA  = 0x2,
+	RCPI_MEASUREMENT_TYPE_LAST_MGMT = 0x3,
+	RCPI_MEASUREMENT_TYPE_LAST_DATA = 0x4,
+	RCPI_MEASUREMENT_TYPE_INVALID = 0x5,
+};
+
+/**
+ * struct rcpi_req - RCPI req parameter
+ * @vdev_id: virtual device id
+ * @measurement_type: type of rcpi from enum wmi_rcpi_measurement_type
+ * @mac_addr: peer mac addr for which measurement is required
+ */
+struct rcpi_req {
+	uint32_t vdev_id;
+	enum rcpi_measurement_type measurement_type;
+	uint8_t mac_addr[IEEE80211_ADDR_LEN];
+};
+
+/**
+ * struct rcpi_res - RCPI response parameter
+ * @vdev_id: virtual device id
+ * @measurement_type: type of rcpi from enum wmi_rcpi_measurement_type
+ * @mac_addr: peer mac addr for which measurement is required
+ * @rcpi_value: value of RCPI computed by firmware
+ */
+struct rcpi_res {
+	uint32_t vdev_id;
+	enum rcpi_measurement_type measurement_type;
+	uint8_t mac_addr[IEEE80211_ADDR_LEN];
+	int32_t rcpi_value;
+};
+
 #define WMI_HOST_BOARD_MCN_STRING_MAX_SIZE 19
 #define WMI_HOST_BOARD_MCN_STRING_BUF_SIZE \
 	(WMI_HOST_BOARD_MCN_STRING_MAX_SIZE+1) /* null-terminator */

+ 7 - 0
wmi/inc/wmi_unified_priv.h

@@ -1368,6 +1368,13 @@ QDF_STATUS (*extract_chainmask_tables)(wmi_unified_t wmi_handle,
 		uint8_t *evt_buf,
 		struct wlan_psoc_host_chainmask_table *chainmask_table);
 
+QDF_STATUS (*send_get_rcpi_cmd)(wmi_unified_t wmi_handle,
+				struct rcpi_req *get_rcpi_param);
+
+QDF_STATUS (*extract_rcpi_response_event)(wmi_unified_t wmi_handle,
+					  void *evt_buf,
+					  struct rcpi_res *res);
+
 #ifdef DFS_COMPONENT_ENABLE
 QDF_STATUS (*extract_dfs_cac_complete_event)(wmi_unified_t wmi_handle,
 		uint8_t *evt_buf,

+ 25 - 0
wmi/src/wmi_unified_api.c

@@ -6718,6 +6718,31 @@ QDF_STATUS wmi_unified_send_coex_config_cmd(void *wmi_hdl,
 	return QDF_STATUS_E_FAILURE;
 }
 
+QDF_STATUS wmi_unified_send_request_get_rcpi_cmd(void *wmi_hdl,
+					struct rcpi_req *get_rcpi_param)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->send_get_rcpi_cmd)
+		return wmi_handle->ops->send_get_rcpi_cmd(wmi_handle,
+			   get_rcpi_param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+QDF_STATUS wmi_extract_rcpi_response_event(void *wmi_hdl, void *evt_buf,
+					   struct rcpi_res *res)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
+	struct wmi_ops *ops = wmi_handle->ops;
+
+	if (ops->extract_rcpi_response_event)
+		return ops->extract_rcpi_response_event(wmi_handle, evt_buf,
+							res);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
 /**
  * wmi_extract_peer_delete_response_event() -
  *       extract vdev id and peer mac addresse from peer delete response event

+ 102 - 0
wmi/src/wmi_unified_tlv.c

@@ -19078,6 +19078,105 @@ static QDF_STATUS extract_dfs_radar_detection_event_tlv(
 }
 #endif
 
+/**
+ * send_get_rcpi_cmd_tlv() - send request for rcpi value
+ * @wmi_handle: wmi handle
+ * @get_rcpi_param: rcpi params
+ *
+ * Return: QDF status
+ */
+static QDF_STATUS send_get_rcpi_cmd_tlv(wmi_unified_t wmi_handle,
+					struct rcpi_req  *get_rcpi_param)
+{
+	wmi_buf_t buf;
+	wmi_request_rcpi_cmd_fixed_param *cmd;
+	uint8_t len = sizeof(wmi_request_rcpi_cmd_fixed_param);
+
+	buf = wmi_buf_alloc(wmi_handle, len);
+	if (!buf) {
+		WMI_LOGE("%s: Failed to allocate wmi buffer", __func__);
+		return QDF_STATUS_E_NOMEM;
+	}
+
+	cmd = (wmi_request_rcpi_cmd_fixed_param *) wmi_buf_data(buf);
+	WMITLV_SET_HDR(&cmd->tlv_header,
+		       WMITLV_TAG_STRUC_wmi_request_rcpi_cmd_fixed_param,
+		       WMITLV_GET_STRUCT_TLVLEN
+		       (wmi_request_rcpi_cmd_fixed_param));
+
+	cmd->vdev_id = get_rcpi_param->vdev_id;
+	WMI_CHAR_ARRAY_TO_MAC_ADDR(get_rcpi_param->mac_addr,
+				   &cmd->peer_macaddr);
+	cmd->measurement_type = get_rcpi_param->measurement_type;
+	WMI_LOGD("RCPI REQ VDEV_ID:%d-->", cmd->vdev_id);
+	if (wmi_unified_cmd_send(wmi_handle, buf, len,
+				 WMI_REQUEST_RCPI_CMDID)) {
+
+		WMI_LOGE("%s: Failed to send WMI_REQUEST_RCPI_CMDID",
+			 __func__);
+		wmi_buf_free(buf);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * extract_rcpi_response_event_tlv() - Extract RCPI event params
+ * @wmi_handle: wmi handle
+ * @evt_buf: pointer to event buffer
+ * @res: pointer to hold rcpi response from firmware
+ *
+ * Return: QDF_STATUS_SUCCESS for successful event parse
+ *         else QDF_STATUS_E_INVAL or QDF_STATUS_E_FAILURE
+ */
+static QDF_STATUS
+extract_rcpi_response_event_tlv(wmi_unified_t wmi_handle,
+				void *evt_buf, struct rcpi_res *res)
+{
+	WMI_UPDATE_RCPI_EVENTID_param_tlvs *param_buf;
+	wmi_update_rcpi_event_fixed_param *event;
+
+	param_buf = (WMI_UPDATE_RCPI_EVENTID_param_tlvs *)evt_buf;
+	if (!param_buf) {
+		WMI_LOGE(FL("Invalid rcpi event"));
+		return QDF_STATUS_E_INVAL;
+	}
+
+	event = param_buf->fixed_param;
+	res->vdev_id = event->vdev_id;
+	WMI_MAC_ADDR_TO_CHAR_ARRAY(&event->peer_macaddr, res->mac_addr);
+
+	switch (event->measurement_type) {
+
+	case WMI_RCPI_MEASUREMENT_TYPE_AVG_MGMT:
+		res->measurement_type = RCPI_MEASUREMENT_TYPE_AVG_MGMT;
+		break;
+
+	case WMI_RCPI_MEASUREMENT_TYPE_AVG_DATA:
+		res->measurement_type = RCPI_MEASUREMENT_TYPE_AVG_DATA;
+		break;
+
+	case WMI_RCPI_MEASUREMENT_TYPE_LAST_MGMT:
+		res->measurement_type = RCPI_MEASUREMENT_TYPE_LAST_MGMT;
+		break;
+
+	case WMI_RCPI_MEASUREMENT_TYPE_LAST_DATA:
+		res->measurement_type = RCPI_MEASUREMENT_TYPE_LAST_DATA;
+		break;
+
+	default:
+		WMI_LOGE(FL("Invalid rcpi measurement type from firmware"));
+		res->measurement_type = RCPI_MEASUREMENT_TYPE_INVALID;
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	if (event->status)
+		return QDF_STATUS_E_FAILURE;
+	else
+		return QDF_STATUS_SUCCESS;
+}
+
 /**
  * convert_host_pdev_id_to_target_pdev_id_legacy() - Convert pdev_id from
  *           host to target defines. For legacy there is not conversion
@@ -19825,6 +19924,8 @@ struct wmi_ops tlv_ops =  {
 		extract_chainmask_tables_tlv,
 	.extract_thermal_stats = extract_thermal_stats_tlv,
 	.extract_thermal_level_stats = extract_thermal_level_stats_tlv,
+	.send_get_rcpi_cmd = send_get_rcpi_cmd_tlv,
+	.extract_rcpi_response_event = extract_rcpi_response_event_tlv,
 #ifdef DFS_COMPONENT_ENABLE
 	.extract_dfs_cac_complete_event = extract_dfs_cac_complete_event_tlv,
 	.extract_dfs_radar_detection_event =
@@ -20084,6 +20185,7 @@ static void populate_tlv_events_id(uint32_t *event_ids)
 	event_ids[wmi_get_arp_stats_req_id] = WMI_VDEV_GET_ARP_STAT_EVENTID;
 	event_ids[wmi_service_available_event_id] =
 						WMI_SERVICE_AVAILABLE_EVENTID;
+	event_ids[wmi_update_rcpi_event_id] = WMI_UPDATE_RCPI_EVENTID;
 }
 
 #ifndef CONFIG_MCL