qcacld-3.0: Add support of request peer stats info(part 3)

qcacld-2.0 to qcacld-3.0 propagation

FW has limitation to support old WMI_REQUEST_STATS_CMDID and
WMI_UPDATE_STATS_EVENTID interface on AP vDev. FW suggest to use new
WMI_REQUEST_PEER_STATS_INFO_CMDID and WMI_PEER_STATS_INFO_EVENTID to
get tx/rx rate.

This checkin is about HDD layer, provide APIs/callbacks to upper layer
to query rssi/tx/rx statistics of peer station associated with SAP,
and provide a default disabled ini setting and checking FW's
WMI_SERVICE_PEER_STATS_INFO capability to control this get peer info
interface. Add/change iwpriv/QCA_NL80211_VENDOR_SUBCMD_GET_STATION/
cfg80211_ops.get_station interfaces to upper layer.

Change-Id: Ib1571219faa16e3bc8c3eb1260137ae08b8b6016
CRs-Fixed: 2059507
diff --git a/core/hdd/src/wlan_hdd_softap_tx_rx.c b/core/hdd/src/wlan_hdd_softap_tx_rx.c
index 8c298e6..17b1f23 100644
--- a/core/hdd/src/wlan_hdd_softap_tx_rx.c
+++ b/core/hdd/src/wlan_hdd_softap_tx_rx.c
@@ -256,6 +256,7 @@
 	hdd_ap_ctx_t *pHddApCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter);
 	struct qdf_mac_addr *pDestMacAddress;
 	uint8_t STAId;
+	uint32_t num_seg;
 
 	++pAdapter->hdd_stats.hddTxRxStats.txXmitCalled;
 	/* Prevent this function from being called during SSR since TL
@@ -395,11 +396,17 @@
 	qdf_net_buf_debug_acquire_skb(skb, __FILE__, __LINE__);
 
 	pAdapter->stats.tx_bytes += skb->len;
+	pAdapter->aStaInfo[STAId].tx_bytes += skb->len;
 
-	if (qdf_nbuf_is_tso(skb))
-		pAdapter->stats.tx_packets += qdf_nbuf_get_tso_num_seg(skb);
-	else
+	if (qdf_nbuf_is_tso(skb)) {
+		num_seg = qdf_nbuf_get_tso_num_seg(skb);
+		pAdapter->stats.tx_packets += num_seg;
+		pAdapter->aStaInfo[STAId].tx_packets += num_seg;
+	} else {
 		++pAdapter->stats.tx_packets;
+		pAdapter->aStaInfo[STAId].tx_packets++;
+	}
+	pAdapter->aStaInfo[STAId].last_tx_rx_ts = qdf_system_ticks();
 
 	hdd_event_eapol_log(skb, QDF_TX);
 	qdf_dp_trace_log_pkt(pAdapter->sessionId, skb, QDF_TX,
@@ -686,6 +693,8 @@
 	struct sk_buff *skb = NULL;
 	struct sk_buff *next = NULL;
 	hdd_context_t *pHddCtx = NULL;
+	struct qdf_mac_addr src_mac;
+	uint8_t staid;
 
 	/* Sanity check on inputs */
 	if (unlikely((NULL == context) || (NULL == rxBuf))) {
@@ -737,6 +746,17 @@
 		++pAdapter->stats.rx_packets;
 		pAdapter->stats.rx_bytes += skb->len;
 
+	qdf_mem_copy(&src_mac, skb->data + QDF_NBUF_SRC_MAC_OFFSET,
+		     sizeof(src_mac));
+	if (QDF_STATUS_SUCCESS ==
+		hdd_softap_get_sta_id(pAdapter, &src_mac, &staid)) {
+		if (staid < WLAN_MAX_STA_COUNT) {
+			pAdapter->aStaInfo[staid].rx_packets++;
+			pAdapter->aStaInfo[staid].rx_bytes += skb->len;
+			pAdapter->aStaInfo[staid].last_tx_rx_ts =
+				qdf_system_ticks();
+		}
+	}
 		hdd_event_eapol_log(skb, QDF_RX);
 		DPTRACE(qdf_dp_trace(skb,
 			QDF_DP_TRACE_RX_HDD_PACKET_PTR_RECORD,