Ver Fonte

qcacld-3.0: Modify static inline API's for net dev stats handling

Currently net dev stats are handled using QDF MACROS which is not
ideal approach. So modified it to OS agnostic inline API's for
handling net dev stats.

Change-Id: I1739779c4fa7699e867b9aa75aff48546b7754ac
CRs-Fixed: 3250935
Azmath Mohammed há 2 anos atrás
pai
commit
69c27376be

+ 21 - 20
components/dp/core/src/wlan_dp_bus_bandwidth.c

@@ -35,9 +35,9 @@
 #include "qdf_trace.h"
 #include <wlan_cm_ucfg_api.h>
 #include <qdf_threads.h>
+#include <qdf_net_stats.h>
 #include "wlan_dp_periodic_sta_stats.h"
 #include "wlan_mlme_ucfg_api.h"
-#include <i_qdf_net_stats.h>
 #include "wlan_dp_txrx.h"
 #include "cdp_txrx_host_stats.h"
 #include "wlan_cm_roam_api.h"
@@ -1729,8 +1729,9 @@ dp_link_monitoring(struct wlan_dp_psoc_context *dp_ctx,
 	psoc = dp_ctx->psoc;
 	/* If no rx packets received for N sec, set link speed to poor */
 	if (link_mon.is_rx_linkspeed_good) {
-		rx_packets = DP_BW_GET_DIFF(QDF_NET_DEV_STATS_RX_PKTS(&dp_intf->stats),
-					    dp_intf->prev_rx_packets);
+		rx_packets = DP_BW_GET_DIFF(
+			qdf_net_stats_get_rx_pkts(&dp_intf->stats),
+			dp_intf->prev_rx_packets);
 		if (!rx_packets)
 			no_rx_times++;
 		else
@@ -1855,13 +1856,13 @@ static void __dp_bus_bw_work_handler(struct wlan_dp_psoc_context *dp_ctx)
 			dp_rx_check_qdisc_for_intf(dp_intf);
 
 		tx_packets += DP_BW_GET_DIFF(
-			QDF_NET_DEV_STATS_TX_PKTS(&dp_intf->stats),
+			qdf_net_stats_get_tx_pkts(&dp_intf->stats),
 			dp_intf->prev_tx_packets);
 		rx_packets += DP_BW_GET_DIFF(
-			QDF_NET_DEV_STATS_RX_PKTS(&dp_intf->stats),
+			qdf_net_stats_get_rx_pkts(&dp_intf->stats),
 			dp_intf->prev_rx_packets);
 		tx_bytes = DP_BW_GET_DIFF(
-			QDF_NET_DEV_STATS_TX_BYTES(&dp_intf->stats),
+			qdf_net_stats_get_tx_bytes(&dp_intf->stats),
 			dp_intf->prev_tx_bytes);
 
 		if (dp_intf->device_mode == QDF_STA_MODE &&
@@ -1891,12 +1892,12 @@ static void __dp_bus_bw_work_handler(struct wlan_dp_psoc_context *dp_ctx)
 		if (dp_intf->device_mode == QDF_SAP_MODE) {
 			con_sap_dp_intf = dp_intf;
 			sap_tx_bytes =
-				QDF_NET_DEV_STATS_TX_BYTES(&dp_intf->stats);
+				qdf_net_stats_get_tx_bytes(&dp_intf->stats);
 		}
 
 		if (dp_intf->device_mode == QDF_STA_MODE)
 			sta_tx_bytes =
-				QDF_NET_DEV_STATS_TX_BYTES(&dp_intf->stats);
+				qdf_net_stats_get_tx_bytes(&dp_intf->stats);
 
 		dp_set_driver_del_ack_enable(dp_intf->intf_id, dp_ctx,
 					     rx_packets);
@@ -1904,18 +1905,18 @@ static void __dp_bus_bw_work_handler(struct wlan_dp_psoc_context *dp_ctx)
 		dp_set_vdev_bundle_require_flag(dp_intf->intf_id, dp_ctx,
 						tx_bytes);
 
-		total_rx += QDF_NET_DEV_STATS_RX_PKTS(&dp_intf->stats);
-		total_tx += QDF_NET_DEV_STATS_TX_PKTS(&dp_intf->stats);
+		total_rx += qdf_net_stats_get_rx_pkts(&dp_intf->stats);
+		total_tx += qdf_net_stats_get_tx_pkts(&dp_intf->stats);
 
 		qdf_spin_lock_bh(&dp_ctx->bus_bw_lock);
 		dp_intf->prev_tx_packets =
-			QDF_NET_DEV_STATS_TX_PKTS(&dp_intf->stats);
+			qdf_net_stats_get_tx_pkts(&dp_intf->stats);
 		dp_intf->prev_rx_packets =
-			QDF_NET_DEV_STATS_RX_PKTS(&dp_intf->stats);
+			qdf_net_stats_get_rx_pkts(&dp_intf->stats);
 		dp_intf->prev_fwd_tx_packets = fwd_tx_packets;
 		dp_intf->prev_fwd_rx_packets = fwd_rx_packets;
 		dp_intf->prev_tx_bytes =
-			QDF_NET_DEV_STATS_TX_BYTES(&dp_intf->stats);
+			qdf_net_stats_get_tx_bytes(&dp_intf->stats);
 		qdf_spin_unlock_bh(&dp_ctx->bus_bw_lock);
 		connected = true;
 
@@ -1937,10 +1938,10 @@ static void __dp_bus_bw_work_handler(struct wlan_dp_psoc_context *dp_ctx)
 	dp_ipa_set_perf_level(dp_ctx, &tx_packets, &rx_packets,
 			      &ipa_tx_packets, &ipa_rx_packets);
 	if (con_sap_dp_intf) {
-		QDF_NET_DEV_STATS_TX_PKTS(&con_sap_dp_intf->stats) +=
-			ipa_tx_packets;
-		QDF_NET_DEV_STATS_RX_PKTS(&con_sap_dp_intf->stats) +=
-			ipa_rx_packets;
+		qdf_net_stats_add_tx_pkts(&con_sap_dp_intf->stats,
+					  ipa_tx_packets);
+		qdf_net_stats_add_rx_pkts(&con_sap_dp_intf->stats,
+					  ipa_rx_packets);
 	}
 
 	tx_packets = tx_packets * bw_interval_us;
@@ -2153,9 +2154,9 @@ void dp_bus_bw_compute_prev_txrx_stats(struct wlan_objmgr_vdev *vdev)
 		return;
 
 	qdf_spin_lock_bh(&dp_ctx->bus_bw_lock);
-	dp_intf->prev_tx_packets = QDF_NET_DEV_STATS_TX_PKTS(&dp_intf->stats);
-	dp_intf->prev_rx_packets = QDF_NET_DEV_STATS_RX_PKTS(&dp_intf->stats);
-	dp_intf->prev_tx_bytes = QDF_NET_DEV_STATS_TX_BYTES(&dp_intf->stats);
+	dp_intf->prev_tx_packets = qdf_net_stats_get_tx_pkts(&dp_intf->stats);
+	dp_intf->prev_rx_packets = qdf_net_stats_get_rx_pkts(&dp_intf->stats);
+	dp_intf->prev_tx_bytes = qdf_net_stats_get_tx_bytes(&dp_intf->stats);
 
 	cdp_get_intra_bss_fwd_pkts_count(cds_get_context(QDF_MODULE_ID_SOC),
 					 dp_intf->intf_id,

+ 10 - 9
components/dp/core/src/wlan_dp_softap_txrx.c

@@ -41,6 +41,7 @@
 #include <wlan_tdls_ucfg_api.h>
 #include <qdf_trace.h>
 #include <qdf_nbuf.h>
+#include <qdf_net_stats.h>
 
 /* Preprocessor definitions and constants */
 #undef QCA_DP_SAP_DUMP_SK_BUFF
@@ -645,13 +646,13 @@ QDF_STATUS dp_softap_start_xmit(qdf_nbuf_t nbuf, struct wlan_dp_intf *dp_intf)
 
 	qdf_net_buf_debug_acquire_skb(nbuf, __FILE__, __LINE__);
 
-	QDF_NET_DEV_STATS_TX_BYTES(&dp_intf->stats) += qdf_nbuf_len(nbuf);
+	qdf_net_stats_add_tx_bytes(&dp_intf->stats, qdf_nbuf_len(nbuf));
 
 	if (qdf_nbuf_is_tso(nbuf)) {
 		num_seg = qdf_nbuf_get_tso_num_seg(nbuf);
-		QDF_NET_DEV_STATS_TX_PKTS(&dp_intf->stats) += num_seg;
+		qdf_net_stats_add_tx_pkts(&dp_intf->stats, num_seg);
 	} else {
-		QDF_NET_DEV_STATS_INC_TX_PKTS(&dp_intf->stats);
+		qdf_net_stats_add_tx_pkts(&dp_intf->stats, 1);
 		dp_ctx->no_tx_offload_pkt_cnt++;
 	}
 
@@ -695,7 +696,7 @@ drop_pkt:
 			      QDF_TX);
 	qdf_nbuf_kfree(nbuf);
 drop_pkt_accounting:
-	QDF_NET_DEV_STATS_INC_TX_DROPEED(&dp_intf->stats);
+	qdf_net_stats_inc_tx_dropped(&dp_intf->stats);
 
 	return QDF_STATUS_E_FAILURE;
 }
@@ -827,12 +828,12 @@ QDF_STATUS dp_softap_rx_packet_cbk(void *intf_ctx, qdf_nbuf_t rx_buf)
 
 		cpu_index = qdf_get_cpu();
 		++stats->per_cpu[cpu_index].rx_packets;
-		QDF_NET_DEV_STATS_INC_RX_PKTS(&dp_intf->stats);
+		qdf_net_stats_add_rx_pkts(&dp_intf->stats, 1);
 		/* count aggregated RX frame into stats */
-		QDF_NET_DEV_STATS_RX_PKTS(&dp_intf->stats) +=
-			qdf_nbuf_get_gso_segs(nbuf);
-		QDF_NET_DEV_STATS_RX_BYTES(&dp_intf->stats) +=
-			qdf_nbuf_len(nbuf);
+		qdf_net_stats_add_rx_pkts(&dp_intf->stats,
+					  qdf_nbuf_get_gso_segs(nbuf));
+		qdf_net_stats_add_rx_bytes(&dp_intf->stats,
+					   qdf_nbuf_len(nbuf));
 
 		dp_softap_inspect_dhcp_packet(dp_intf, nbuf, QDF_RX);
 

+ 14 - 13
components/dp/core/src/wlan_dp_txrx.c

@@ -42,6 +42,7 @@
 #include <wlan_dp_bus_bandwidth.h>
 #include <wlan_tdls_ucfg_api.h>
 #include <qdf_trace.h>
+#include <qdf_net_stats.h>
 
 uint32_t wlan_dp_intf_get_pkt_type_bitmap_value(void *intf_ctx)
 {
@@ -632,13 +633,13 @@ dp_start_xmit(struct wlan_dp_intf *dp_intf, qdf_nbuf_t nbuf)
 	 */
 	qdf_net_buf_debug_acquire_skb(nbuf, __FILE__, __LINE__);
 
-	QDF_NET_DEV_STATS_TX_BYTES(&dp_intf->stats) += qdf_nbuf_len(nbuf);
+	qdf_net_stats_add_tx_bytes(&dp_intf->stats, qdf_nbuf_len(nbuf));
 
 	if (qdf_nbuf_is_tso(nbuf)) {
-		QDF_NET_DEV_STATS_TX_PKTS(&dp_intf->stats) +=
-			qdf_nbuf_get_tso_num_seg(nbuf);
+		qdf_net_stats_add_tx_pkts(&dp_intf->stats,
+					  qdf_nbuf_get_tso_num_seg(nbuf));
 	} else {
-		QDF_NET_DEV_STATS_INC_TX_PKTS(&dp_intf->stats);
+		qdf_net_stats_add_tx_pkts(&dp_intf->stats, 1);
 		dp_ctx->no_tx_offload_pkt_cnt++;
 	}
 
@@ -701,7 +702,7 @@ drop_pkt:
 
 drop_pkt_accounting:
 
-	QDF_NET_DEV_STATS_INC_TX_DROPEED(&dp_intf->stats);
+	qdf_net_stats_inc_tx_dropped(&dp_intf->stats);
 	++stats->per_cpu[cpu].tx_dropped;
 	if (is_arp) {
 		++dp_intf->dp_stats.arp_stats.tx_dropped;
@@ -839,9 +840,9 @@ QDF_STATUS dp_mon_rx_packet_cbk(void *context, qdf_nbuf_t rxbuf)
 		qdf_nbuf_set_dev(nbuf, dp_intf->dev);
 
 		++stats->per_cpu[cpu_index].rx_packets;
-		QDF_NET_DEV_STATS_INC_RX_PKTS(&dp_intf->stats);
-		QDF_NET_DEV_STATS_RX_BYTES(&dp_intf->stats) +=
-			qdf_nbuf_len(nbuf);
+		qdf_net_stats_add_rx_pkts(&dp_intf->stats, 1);
+		qdf_net_stats_add_rx_bytes(&dp_intf->stats,
+					   qdf_nbuf_len(nbuf));
 
 		/* Remove SKB from internal tracking table before submitting
 		 * it to stack
@@ -1727,12 +1728,12 @@ QDF_STATUS dp_rx_packet_cbk(void *dp_intf_context,
 		qdf_nbuf_set_dev(nbuf, dp_intf->dev);
 		qdf_nbuf_set_protocol_eth_tye_trans(nbuf);
 		++stats->per_cpu[cpu_index].rx_packets;
-		QDF_NET_DEV_STATS_INC_RX_PKTS(&dp_intf->stats);
+		qdf_net_stats_add_rx_pkts(&dp_intf->stats, 1);
 		/* count aggregated RX frame into stats */
-		QDF_NET_DEV_STATS_RX_PKTS(&dp_intf->stats) +=
-			qdf_nbuf_get_gso_segs(nbuf);
-		QDF_NET_DEV_STATS_RX_BYTES(&dp_intf->stats) +=
-			qdf_nbuf_len(nbuf);
+		qdf_net_stats_add_rx_pkts(&dp_intf->stats,
+					  qdf_nbuf_get_gso_segs(nbuf));
+		qdf_net_stats_add_rx_bytes(&dp_intf->stats,
+					   qdf_nbuf_len(nbuf));
 
 		/* Incr GW Rx count for NUD tracking based on GW mac addr */
 		dp_nud_incr_gw_rx_pkt_cnt(dp_intf, mac_addr);

+ 3 - 2
components/dp/dispatcher/src/wlan_dp_ucfg_api.c

@@ -36,6 +36,7 @@
 #include "wlan_nlink_common.h"
 #include "wlan_pkt_capture_ucfg_api.h"
 #include <cdp_txrx_ctrl.h>
+#include <qdf_net_stats.h>
 
 void ucfg_dp_update_inf_mac(struct wlan_objmgr_psoc *psoc,
 			    struct qdf_mac_addr *cur_mac,
@@ -1299,8 +1300,8 @@ void ucfg_dp_inc_rx_pkt_stats(struct wlan_objmgr_vdev *vdev,
 	stats = &dp_intf->dp_stats.tx_rx_stats;
 
 	++stats->per_cpu[cpu_index].rx_packets;
-	QDF_NET_DEV_STATS_INC_RX_PKTS(&dp_intf->stats);
-	QDF_NET_DEV_STATS_RX_BYTES(&dp_intf->stats) += pkt_len;
+	qdf_net_stats_add_rx_pkts(&dp_intf->stats, 1);
+	qdf_net_stats_add_rx_bytes(&dp_intf->stats, pkt_len);
 
 	if (delivered)
 		++stats->per_cpu[cpu_index].rx_delivered;