فهرست منبع

qcacld-3.0: Register STA tx completion cb to update stats

Register STA tx completion callback with dp as part of
vdev registration to update successful ack stats.

Change-Id: I27f36336f0e37d43cc2cdff204c0217667a48b13
CRs-Fixed: 2682020
Yeshwanth Sriram Guntuka 4 سال پیش
والد
کامیت
e0fe1711e5

+ 0 - 9
core/cds/inc/cds_api.h

@@ -525,13 +525,6 @@ bool cds_is_group_addr(uint8_t *mac_addr)
 		return false;
 }
 
-/**
- * cds_get_arp_stats_gw_ip() - get arp stats track IP
- * @context: osif dev
- *
- * Return: ARP stats IP to track.
- */
-uint32_t cds_get_arp_stats_gw_ip(void *context);
 /**
  * cds_get_connectivity_stats_pkt_bitmap() - get pkt-type bitmap
  * @context: osif dev context
@@ -539,8 +532,6 @@ uint32_t cds_get_arp_stats_gw_ip(void *context);
  * Return: pkt bitmap to track
  */
 uint32_t cds_get_connectivity_stats_pkt_bitmap(void *context);
-void cds_incr_arp_stats_tx_tgt_delivered(void);
-void cds_incr_arp_stats_tx_tgt_acked(void);
 
 #ifdef FEATURE_ALIGN_STATS_FROM_DP
 /**

+ 0 - 73
core/cds/src/cds_api.c

@@ -2796,79 +2796,6 @@ uint32_t cds_get_connectivity_stats_pkt_bitmap(void *context)
 	return adapter->pkt_type_bitmap;
 }
 
-/**
- * cds_get_arp_stats_gw_ip() - get arp stats track IP
- *
- * Return: ARP stats IP to track
- */
-uint32_t cds_get_arp_stats_gw_ip(void *context)
-{
-	struct hdd_adapter *adapter = NULL;
-
-	if (!context)
-		return 0;
-
-	adapter = (struct hdd_adapter *)context;
-
-	if (unlikely(adapter->magic != WLAN_HDD_ADAPTER_MAGIC)) {
-		cds_err("Magic cookie(%x) for adapter sanity verification is invalid",
-			adapter->magic);
-		return 0;
-	}
-
-	return adapter->track_arp_ip;
-}
-
-/**
- * cds_incr_arp_stats_tx_tgt_delivered() - increment ARP stats
- *
- * Return: none
- */
-void cds_incr_arp_stats_tx_tgt_delivered(void)
-{
-	struct hdd_context *hdd_ctx;
-	struct hdd_adapter *adapter = NULL;
-
-	hdd_ctx = gp_cds_context->hdd_context;
-	if (!hdd_ctx) {
-		cds_err("Hdd Context is Null");
-		return;
-	}
-
-	hdd_for_each_adapter(hdd_ctx, adapter) {
-		if (QDF_STA_MODE == adapter->device_mode)
-			break;
-	}
-
-	if (adapter)
-		adapter->hdd_stats.hdd_arp_stats.tx_host_fw_sent++;
-}
-
-/**
- * cds_incr_arp_stats_tx_tgt_acked() - increment ARP stats
- *
- * Return: none
- */
-void cds_incr_arp_stats_tx_tgt_acked(void)
-{
-	struct hdd_context *hdd_ctx;
-	struct hdd_adapter *adapter = NULL;
-
-	hdd_ctx = gp_cds_context->hdd_context;
-	if (!hdd_ctx) {
-		cds_err("Hdd Context is Null");
-		return;
-	}
-
-	hdd_for_each_adapter(hdd_ctx, adapter) {
-		if (QDF_STA_MODE == adapter->device_mode)
-			break;
-	}
-
-	if (adapter)
-		adapter->hdd_stats.hdd_arp_stats.tx_ack_cnt++;
-}
-
 #ifdef FEATURE_ALIGN_STATS_FROM_DP
 /**
  * cds_get_cdp_vdev_stats() - Function which retrieves cdp vdev stats

+ 9 - 0
core/hdd/inc/wlan_hdd_tx_rx.h

@@ -552,4 +552,13 @@ wlan_hdd_dump_queue_history_state(struct hdd_netif_queue_history *q_hist,
 bool wlan_hdd_rx_rpm_mark_last_busy(struct hdd_context *hdd_ctx,
 				    void *hif_ctx);
 
+/**
+ * hdd_sta_notify_tx_comp_cb() - notify tx comp callback registered with dp
+ * @skb: pointer to skb
+ * @ctx: osif context
+ * @flag: tx status flag
+ *
+ * Return: None
+ */
+void hdd_sta_notify_tx_comp_cb(qdf_nbuf_t skb, void *ctx, uint16_t flag);
 #endif /* end #if !defined(WLAN_HDD_TX_RX_H) */

+ 1 - 0
core/hdd/src/wlan_hdd_assoc.c

@@ -2239,6 +2239,7 @@ QDF_STATUS hdd_roam_register_sta(struct hdd_adapter *adapter,
 
 	txrx_ops.rx.stats_rx = hdd_tx_rx_collect_connectivity_stats_info;
 
+	txrx_ops.tx.tx_comp = hdd_sta_notify_tx_comp_cb;
 	txrx_ops.tx.tx = NULL;
 	cdp_vdev_register(soc, adapter->vdev_id, (ol_osif_vdev_handle)adapter,
 			  &txrx_ops);

+ 0 - 2
core/hdd/src/wlan_hdd_cfg80211.c

@@ -14176,8 +14176,6 @@ static int __wlan_hdd_cfg80211_get_nud_stats(struct wiphy *wiphy,
 		goto exit;
 	}
 
-	hdd_update_sta_arp_stats(adapter);
-
 	if (nla_put_u16(skb, COUNT_FROM_NETDEV,
 			adapter->hdd_stats.hdd_arp_stats.tx_arp_req_count) ||
 	    nla_put_u16(skb, COUNT_TO_LOWER_MAC,

+ 2 - 1
core/hdd/src/wlan_hdd_softap_tx_rx.c

@@ -1014,11 +1014,12 @@ static inline void hdd_softap_tsf_timestamp_rx(struct hdd_context *hdd_ctx,
  * hdd_softap_notify_tx_compl_cbk() - callback to notify tx completion
  * @skb: pointer to skb data
  * @adapter: pointer to vdev apdapter
+ * @flags: tx status flag
  *
  * Return: None
  */
 static void hdd_softap_notify_tx_compl_cbk(struct sk_buff *skb,
-					   void *context)
+					   void *context, uint16_t flag)
 {
 	int errno;
 	struct hdd_adapter *adapter = context;

+ 0 - 32
core/hdd/src/wlan_hdd_stats.c

@@ -6358,35 +6358,3 @@ void wlan_hdd_register_cp_stats_cb(struct hdd_context *hdd_ctx)
 					hdd_lost_link_cp_stats_info_cb);
 }
 #endif
-
-QDF_STATUS hdd_update_sta_arp_stats(struct hdd_adapter *adapter)
-{
-	struct cdp_peer_stats *peer_stats;
-	struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
-	struct hdd_arp_stats_s *arp_stats;
-	QDF_STATUS status;
-
-	peer_stats = qdf_mem_malloc(sizeof(*peer_stats));
-	if (!peer_stats)
-		return QDF_STATUS_E_NOMEM;
-
-	status = cdp_host_get_peer_stats(cds_get_context(QDF_MODULE_ID_SOC),
-					 adapter->vdev_id,
-					 sta_ctx->conn_info.bssid.bytes,
-					 peer_stats);
-
-	if (QDF_IS_STATUS_ERROR(status)) {
-		qdf_mem_free(peer_stats);
-		return status;
-	}
-
-	arp_stats = &adapter->hdd_stats.hdd_arp_stats;
-
-	arp_stats->tx_host_fw_sent =
-			arp_stats->tx_arp_req_count - arp_stats->tx_dropped;
-	arp_stats->tx_ack_cnt = arp_stats->tx_host_fw_sent -
-				peer_stats->tx.no_ack_count[QDF_PROTO_ARP_REQ];
-	qdf_mem_free(peer_stats);
-
-	return QDF_STATUS_SUCCESS;
-}

+ 0 - 8
core/hdd/src/wlan_hdd_stats.h

@@ -537,12 +537,4 @@ void wlan_hdd_register_cp_stats_cb(struct hdd_context *hdd_ctx);
 #else
 static inline void wlan_hdd_register_cp_stats_cb(struct hdd_context *hdd_ctx) {}
 #endif
-
-/**
- * hdd_update_sta_arp_stats() - update arp stats
- * @adapter: adapter context
- *
- * Return: An error code or 0 on success.
- */
-QDF_STATUS hdd_update_sta_arp_stats(struct hdd_adapter *adapter);
 #endif /* end #if !defined(WLAN_HDD_STATS_H) */

+ 41 - 0
core/hdd/src/wlan_hdd_tx_rx.c

@@ -986,6 +986,7 @@ static void __hdd_hard_start_xmit(struct sk_buff *skb,
 		if (qdf_nbuf_data_is_arp_req(skb) &&
 		    (adapter->track_arp_ip == qdf_nbuf_get_arp_tgt_ip(skb))) {
 			is_arp = true;
+			QDF_NBUF_CB_TX_EXTRA_FRAG_FLAGS_NOTIFY_COMP(skb) = 1;
 			++adapter->hdd_stats.hdd_arp_stats.tx_arp_req_count;
 			QDF_TRACE(QDF_MODULE_ID_HDD_DATA,
 				  QDF_TRACE_LEVEL_INFO_HIGH,
@@ -996,9 +997,11 @@ static void __hdd_hard_start_xmit(struct sk_buff *skb,
 		subtype = qdf_nbuf_get_eapol_subtype(skb);
 		if (subtype == QDF_PROTO_EAPOL_M2) {
 			++adapter->hdd_stats.hdd_eapol_stats.eapol_m2_count;
+			QDF_NBUF_CB_TX_EXTRA_FRAG_FLAGS_NOTIFY_COMP(skb) = 1;
 			is_eapol = true;
 		} else if (subtype == QDF_PROTO_EAPOL_M4) {
 			++adapter->hdd_stats.hdd_eapol_stats.eapol_m4_count;
+			QDF_NBUF_CB_TX_EXTRA_FRAG_FLAGS_NOTIFY_COMP(skb) = 1;
 			is_eapol = true;
 		}
 	} else if (QDF_NBUF_CB_GET_PACKET_TYPE(skb) ==
@@ -1006,9 +1009,11 @@ static void __hdd_hard_start_xmit(struct sk_buff *skb,
 		subtype = qdf_nbuf_get_dhcp_subtype(skb);
 		if (subtype == QDF_PROTO_DHCP_DISCOVER) {
 			++adapter->hdd_stats.hdd_dhcp_stats.dhcp_dis_count;
+			QDF_NBUF_CB_TX_EXTRA_FRAG_FLAGS_NOTIFY_COMP(skb) = 1;
 			is_dhcp = true;
 		} else if (subtype == QDF_PROTO_DHCP_REQUEST) {
 			++adapter->hdd_stats.hdd_dhcp_stats.dhcp_req_count;
+			QDF_NBUF_CB_TX_EXTRA_FRAG_FLAGS_NOTIFY_COMP(skb) = 1;
 			is_dhcp = true;
 		}
 	}
@@ -3369,3 +3374,39 @@ bool wlan_hdd_rx_rpm_mark_last_busy(struct hdd_context *hdd_ctx,
 	else
 		return false;
 }
+
+void hdd_sta_notify_tx_comp_cb(qdf_nbuf_t skb, void *ctx, uint16_t flag)
+{
+	struct hdd_adapter *adapter = ctx;
+	enum qdf_proto_subtype subtype;
+
+	if (hdd_validate_adapter(adapter))
+		return;
+
+	switch (QDF_NBUF_CB_GET_PACKET_TYPE(skb)) {
+	case QDF_NBUF_CB_PACKET_TYPE_ARP:
+		if (flag & BIT(QDF_TX_RX_STATUS_DOWNLOAD_SUCC))
+			++adapter->hdd_stats.hdd_arp_stats.
+				tx_host_fw_sent;
+		if (flag & BIT(QDF_TX_RX_STATUS_OK))
+			++adapter->hdd_stats.hdd_arp_stats.tx_ack_cnt;
+		break;
+	case QDF_NBUF_CB_PACKET_TYPE_EAPOL:
+		subtype = qdf_nbuf_get_eapol_subtype(skb);
+		if (!(flag & BIT(QDF_TX_RX_STATUS_OK)) &&
+		    subtype != QDF_PROTO_INVALID)
+			++adapter->hdd_stats.hdd_eapol_stats.
+				tx_noack_cnt[subtype - QDF_PROTO_EAPOL_M1];
+		break;
+	case QDF_NBUF_CB_PACKET_TYPE_DHCP:
+		subtype = qdf_nbuf_get_dhcp_subtype(skb);
+		if (!(flag & BIT(QDF_TX_RX_STATUS_OK)) &&
+		    subtype != QDF_PROTO_INVALID &&
+		    subtype <= QDF_PROTO_DHCP_ACK)
+			++adapter->hdd_stats.hdd_dhcp_stats.
+				tx_noack_cnt[subtype - QDF_PROTO_DHCP_DISCOVER];
+		break;
+	default:
+		break;
+	}
+}