Browse Source

qcacld-3.0: Add intra bss forwarded packets count

Propagation from qcacld-2.0 to qcacld-3.0.

In lpm qos voting, no. of packets or bytes sent or received in a
particular amount of time is recorded and decision of disabling
or enabling lpm is done based on that. These packets are recorded
in HDD layer. In case when packets are forwarded to tx only, packets
don't come upto HDD layer and so in case of intra bss forwarding,
lpm qos voting is not being executed appropriately.

Add code to calculate the intra bss forwarded packets in txrx layer
and update them in calculating lpm qos voting.

Change-Id: I805663688cb300c8735b3e2f9680818a7b50bc9f
CRs-Fixed: 990868
Himanshu Agarwal 9 years ago
parent
commit
11c874abae

+ 27 - 0
core/dp/txrx/ol_rx_fwd.c

@@ -39,6 +39,8 @@
 #include <ol_rx.h>              /* ol_rx_deliver */
 #include <ol_txrx_internal.h>   /* TXRX_ASSERT1 */
 #include <ol_tx.h>
+#include <ol_txrx.h>
+
 /*
  * Porting from Ap11PrepareForwardedPacket.
  * This routine is called when a RX data frame from an associated station is
@@ -197,6 +199,7 @@ ol_rx_fwd_check(struct ol_txrx_vdev_t *vdev,
 				qdf_net_buf_debug_release_skb(msdu);
 				ol_rx_fwd_to_tx(tx_vdev, msdu);
 				msdu = NULL;    /* already handled this MSDU */
+				vdev->fwd_to_tx_packets++;
 				TXRX_STATS_ADD(pdev,
 					 pub.rx.intra_bss_fwd.packets_fwd, 1);
 			} else {
@@ -229,3 +232,27 @@ ol_rx_fwd_check(struct ol_txrx_vdev_t *vdev,
 		}
 	}
 }
+
+/* ol_rx_get_fwd_to_tx_packet_count() - to get the total rx packets that has
+ * been forwarded to tx without going to OS layer.
+ *
+ * @vdev_id: vdev id
+ *
+ * Return: forwarded packet count if vdev is valid
+ *         0 if vdev is NULL
+ *
+ */
+uint64_t ol_rx_get_fwd_to_tx_packet_count(uint8_t vdev_id)
+{
+	struct ol_txrx_vdev_t *vdev = NULL;
+
+	vdev = (struct ol_txrx_vdev_t *)ol_txrx_get_vdev_from_vdev_id(vdev_id);
+	if (!vdev) {
+		TXRX_PRINT(TXRX_PRINT_LEVEL_ERR,
+			"%s: vdev is NULL for vdev id %d", __func__, vdev_id);
+		return 0;
+	}
+
+	return vdev->fwd_to_tx_packets;
+}
+

+ 5 - 0
core/dp/txrx/ol_rx_fwd.h

@@ -72,4 +72,9 @@ ol_rx_fwd_check(struct ol_txrx_vdev_t *vdev,
 		struct ol_txrx_peer_t *peer,
 		unsigned tid, qdf_nbuf_t msdu_list);
 
+uint64_t
+ol_rx_get_fwd_to_tx_packet_count(
+	uint8_t vdev_id);
+
+
 #endif /* _OL_RX_FWD_H_ */

+ 1 - 0
core/dp/txrx/ol_txrx.c

@@ -1145,6 +1145,7 @@ ol_txrx_vdev_attach(ol_txrx_pdev_handle pdev,
 	vdev->safemode = 0;
 	vdev->drop_unenc = 1;
 	vdev->num_filters = 0;
+	vdev->fwd_to_tx_packets = 0;
 
 	qdf_mem_copy(&vdev->mac_addr.raw[0], vdev_mac_addr,
 		     OL_TXRX_MAC_ADDR_LEN);

+ 3 - 0
core/dp/txrx/ol_txrx_types.h

@@ -880,6 +880,9 @@ struct ol_txrx_vdev_t {
 #ifdef QCA_LL_TX_FLOW_CONTROL_V2
 	struct ol_tx_flow_pool_t *pool;
 #endif
+
+	/* packet count that only forwarded and not sent to OS layer */
+	uint64_t fwd_to_tx_packets;
 };
 
 struct ol_rx_reorder_array_elem_t {

+ 1 - 0
core/hdd/inc/wlan_hdd_main.h

@@ -993,6 +993,7 @@ struct hdd_adapter_s {
 #ifdef MSM_PLATFORM
 	unsigned long prev_rx_packets;
 	unsigned long prev_tx_packets;
+	unsigned long prev_fwd_packets;
 	int connection;
 #endif
 	bool is_roc_inprogress;

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

@@ -56,6 +56,7 @@
 #include "ol_txrx_ctrl_api.h"
 #include "ol_txrx_types.h"
 #include "ol_txrx.h"
+#include "ol_rx_fwd.h"
 #include "cdp_txrx_flow_ctrl_legacy.h"
 #include "cdp_txrx_peer_ops.h"
 
@@ -863,6 +864,8 @@ static void hdd_send_association_event(struct net_device *dev,
 		spin_lock_bh(&pHddCtx->bus_bw_lock);
 		pAdapter->prev_tx_packets = pAdapter->stats.tx_packets;
 		pAdapter->prev_rx_packets = pAdapter->stats.rx_packets;
+		pAdapter->prev_fwd_packets =
+			ol_rx_get_fwd_to_tx_packet_count(pAdapter->sessionId);
 		spin_unlock_bh(&pHddCtx->bus_bw_lock);
 		hdd_start_bus_bw_compute_timer(pAdapter);
 #endif
@@ -918,6 +921,7 @@ static void hdd_send_association_event(struct net_device *dev,
 		spin_lock_bh(&pHddCtx->bus_bw_lock);
 		pAdapter->prev_tx_packets = 0;
 		pAdapter->prev_rx_packets = 0;
+		pAdapter->prev_fwd_packets = 0;
 		spin_unlock_bh(&pHddCtx->bus_bw_lock);
 		hdd_stop_bus_bw_compute_timer(pAdapter);
 #endif

+ 5 - 0
core/hdd/src/wlan_hdd_hostapd.c

@@ -75,6 +75,7 @@
 #include "cds_concurrency.h"
 #include "wlan_hdd_tsf.h"
 #include "wlan_hdd_green_ap.h"
+#include "ol_rx_fwd.h"
 
 #define    IS_UP(_dev) \
 	(((_dev)->flags & (IFF_RUNNING|IFF_UP)) == (IFF_RUNNING|IFF_UP))
@@ -1398,6 +1399,9 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent,
 				pHostapdAdapter->stats.tx_packets;
 			pHostapdAdapter->prev_rx_packets =
 				pHostapdAdapter->stats.rx_packets;
+			pHostapdAdapter->prev_fwd_packets =
+				ol_rx_get_fwd_to_tx_packet_count(
+					pHostapdAdapter->sessionId);
 			spin_unlock_bh(&pHddCtx->bus_bw_lock);
 			hdd_start_bus_bw_compute_timer(pHostapdAdapter);
 		}
@@ -1593,6 +1597,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent,
 			spin_lock_bh(&pHddCtx->bus_bw_lock);
 			pHostapdAdapter->prev_tx_packets = 0;
 			pHostapdAdapter->prev_rx_packets = 0;
+			pHostapdAdapter->prev_fwd_packets = 0;
 			spin_unlock_bh(&pHddCtx->bus_bw_lock);
 			hdd_stop_bus_bw_compute_timer(pHostapdAdapter);
 		}

+ 7 - 1
core/hdd/src/wlan_hdd_main.c

@@ -102,6 +102,7 @@
 #include "wlan_hdd_green_ap.h"
 #include "bmi.h"
 #include <wlan_hdd_regulatory.h>
+#include "ol_rx_fwd.h"
 
 #ifdef MODULE
 #define WLAN_MODULE_NAME  module_name(THIS_MODULE)
@@ -4651,7 +4652,7 @@ static void hdd_bus_bw_compute_cbk(void *priv)
 {
 	hdd_context_t *hdd_ctx = (hdd_context_t *) priv;
 	hdd_adapter_t *adapter = NULL;
-	uint64_t tx_packets = 0, rx_packets = 0;
+	uint64_t tx_packets = 0, rx_packets = 0, fwd_packets = 0;
 	uint64_t total_tx = 0, total_rx = 0;
 	hdd_adapter_list_node_t *adapterNode = NULL;
 	QDF_STATUS status = 0;
@@ -4686,6 +4687,10 @@ static void hdd_bus_bw_compute_cbk(void *priv)
 					      adapter->prev_tx_packets);
 		rx_packets += HDD_BW_GET_DIFF(adapter->stats.rx_packets,
 					      adapter->prev_rx_packets);
+		fwd_packets = ol_rx_get_fwd_to_tx_packet_count(
+					adapter->sessionId);
+		tx_packets += HDD_BW_GET_DIFF(fwd_packets,
+					      adapter->prev_fwd_packets);
 
 		total_rx += adapter->stats.rx_packets;
 		total_tx += adapter->stats.tx_packets;
@@ -4693,6 +4698,7 @@ static void hdd_bus_bw_compute_cbk(void *priv)
 		spin_lock_bh(&hdd_ctx->bus_bw_lock);
 		adapter->prev_tx_packets = adapter->stats.tx_packets;
 		adapter->prev_rx_packets = adapter->stats.rx_packets;
+		adapter->prev_fwd_packets = fwd_packets;
 		spin_unlock_bh(&hdd_ctx->bus_bw_lock);
 		connected = true;
 	}