Pārlūkot izejas kodu

qcacmn: Add API to get MAC-PHY number from target IF

Add API target_if_get_active_mac_phy_number to get max
active MAC-PHY pairs from target IF.
The API will loop through all HW mode and get max MAC-PHY
number in all HW modes.

Change-Id: I2755197c043f9d2df6f8aaf6bf50093a2d1b1596
CRs-Fixed: 3154072
Liangwei Dong 3 gadi atpakaļ
vecāks
revīzija
3c555431b1
2 mainītis faili ar 36 papildinājumiem un 0 dzēšanām
  1. 11 0
      target_if/dp/inc/target_if_dp.h
  2. 25 0
      target_if/dp/src/target_if_dp.c

+ 11 - 0
target_if/dp/inc/target_if_dp.h

@@ -58,6 +58,17 @@ struct reorder_q_setup {
 	uint16_t ba_window_size;
 };
 
+/**
+ * target_if_get_active_mac_phy_number() - Get max MAC-PHY number enabled by
+ * target
+ * @psoc: psoc
+ *
+ * Get max active MAC-PHY number in all type of hw modes.
+ *
+ * return: active number of MAC-PHY pairs
+ */
+uint32_t target_if_get_active_mac_phy_number(struct wlan_objmgr_psoc *psoc);
+
 /**
  * target_if_peer_set_default_routing() - set peer default routing
  * @psoc: psoc pointer

+ 25 - 0
target_if/dp/src/target_if_dp.c

@@ -25,6 +25,31 @@
 #include "target_if_dp.h"
 #include <init_deinit_lmac.h>
 
+uint32_t target_if_get_active_mac_phy_number(struct wlan_objmgr_psoc *psoc)
+{
+	struct target_psoc_info *psoc_info = wlan_psoc_get_tgt_if_handle(psoc);
+	struct target_supported_modes *hw_modes;
+	uint32_t i, phy_bit_map, mac_phy_cnt, max_mac_phy_cnt = 0;
+
+	if (!psoc_info) {
+		target_if_err("invalid psoc info");
+		return 0;
+	}
+	hw_modes = &psoc_info->info.hw_modes;
+	for (i = 0; i < hw_modes->num_modes; i++) {
+		phy_bit_map = hw_modes->phy_bit_map[i];
+		mac_phy_cnt = 0;
+		while (phy_bit_map) {
+			mac_phy_cnt++;
+			phy_bit_map &= (phy_bit_map - 1);
+		}
+		if (mac_phy_cnt > max_mac_phy_cnt)
+			max_mac_phy_cnt = mac_phy_cnt;
+	}
+
+	return max_mac_phy_cnt;
+}
+
 void
 target_if_peer_set_default_routing(struct cdp_ctrl_objmgr_psoc *psoc,
 				   uint8_t pdev_id, uint8_t *peer_macaddr,