ソースを参照

qcacmn: Add APIs to support RCSA and puncturing

Add API utils_dfs_get_radar_bitmap_from_nolie() to fetch the puncture
bitmap from NOL IE. Also, move dfs_convert_wlan_phymode_to_chwidth()
from oss to common code. Also, add a 11BE version of
utils_dfs_convert_wlan_phymode_to_chwidth() API.

CRs-Fixed: 3538818
Change-Id: I258452e122d259c7b16655b760f217073b8e2e9b
Priyadarshnee Srinivasan 2 年 前
コミット
596b68de2e

+ 28 - 0
umac/dfs/core/src/dfs.h

@@ -2951,6 +2951,34 @@ void dfs_set_rcsa_flags(struct wlan_dfs *dfs, bool is_rcsa_ie_sent,
 }
 #endif
 
+/**
+ * dfs_get_radar_bitmap_from_nolie() - Read the NOL IE bitmap of the RCSA
+ * frame, puncture the nol infected channels and formulate the radar puncture
+ * bitmap.
+ * @dfs: Pointer to wlan_dfs structure.
+ * @phymode: Phymode of enum wlan_phymode.
+ * @nol_ie_start_freq: NOL IE start frequency
+ * @nol_ie_bitmap: NOL bitmap
+ *
+ * Return: radar puncture bitmap
+ */
+#if defined(WLAN_FEATURE_11BE) && defined(QCA_DFS_BW_PUNCTURE) && \
+	defined(QCA_DFS_RCSA_SUPPORT)
+uint16_t
+dfs_get_radar_bitmap_from_nolie(struct wlan_dfs *dfs,
+				enum wlan_phymode phymode,
+				qdf_freq_t nol_ie_start_freq,
+				uint8_t nol_ie_bitmap);
+#else
+static inline uint16_t
+dfs_get_radar_bitmap_from_nolie(struct wlan_dfs *dfs, enum wlan_phymode phymode,
+				qdf_freq_t nol_ie_start_freq,
+				uint8_t nol_ie_bitmap)
+{
+	return NO_SCHANS_PUNC;
+}
+#endif
+
 /**
  * dfs_get_rcsa_flags() - Get flags that are required for sending RCSA and
  * NOL IE.

+ 39 - 0
umac/dfs/dispatcher/inc/wlan_dfs_utils_api.h

@@ -989,4 +989,43 @@ QDF_STATUS utils_dfs_radar_enable(struct wlan_objmgr_pdev *pdev);
  * Return: None.
  */
 void utils_dfs_convert_freq_to_index(qdf_freq_t freq, int8_t *index);
+
+/**
+ * utils_dfs_convert_wlan_phymode_to_chwidth() - Map phymode to
+ * channel width.
+ * @phymode: phymode of type wlan_phymode.
+ *
+ * Return channel width of type phy_ch_width
+ */
+enum phy_ch_width
+utils_dfs_convert_wlan_phymode_to_chwidth(enum wlan_phymode phymode);
+
+/**
+ * utils_dfs_get_radar_bitmap_from_nolie() - Read the NOL IE bitmap of the RCSA
+ * frame, puncture the nol infected channels and formulate the radar puncture
+ * bitmap.
+ * @pdev: Pointer to struct wlan_objmgr_pdev
+ * @phy_mode: Phymode of enum wlan_phymode.
+ * @nol_ie_start_freq: Start frequency of the NOL infected channels
+ * @nol_ie_bitmap : NOL IE bitmap
+ *
+ * Return: Punctured radar bitmap
+ */
+#if defined(WLAN_FEATURE_11BE) && defined(QCA_DFS_BW_EXPAND) && \
+	defined(QCA_DFS_RCSA_SUPPORT)
+uint16_t
+utils_dfs_get_radar_bitmap_from_nolie(struct wlan_objmgr_pdev *pdev,
+				      enum wlan_phymode phy_mode,
+				      qdf_freq_t nol_ie_start_freq,
+				      uint8_t nol_ie_bitmap);
+#else
+static inline uint16_t
+utils_dfs_get_radar_bitmap_from_nolie(struct wlan_objmgr_pdev *pdev,
+				      enum wlan_phymode phy_mode,
+				      qdf_freq_t nol_ie_start_freq,
+				      uint8_t nol_ie_bitmap)
+{
+	return NO_SCHANS_PUNC;
+}
+#endif
 #endif /* _WLAN_DFS_UTILS_API_H_ */

+ 109 - 0
umac/dfs/dispatcher/src/wlan_dfs_utils_api.c

@@ -1597,3 +1597,112 @@ QDF_STATUS utils_dfs_radar_enable(struct wlan_objmgr_pdev *pdev)
 {
 	return tgt_dfs_radar_enable(pdev, 0, 0, true);
 }
+
+#ifdef WLAN_FEATURE_11BE
+enum phy_ch_width
+utils_dfs_convert_wlan_phymode_to_chwidth(enum wlan_phymode phymode)
+{
+		switch (phymode) {
+		case WLAN_PHYMODE_11NA_HT20:
+		case WLAN_PHYMODE_11NG_HT20:
+		case WLAN_PHYMODE_11AC_VHT20:
+		case WLAN_PHYMODE_11AC_VHT20_2G:
+		case WLAN_PHYMODE_11AXA_HE20:
+		case WLAN_PHYMODE_11AXG_HE20:
+		case WLAN_PHYMODE_11BEG_EHT20:
+		case WLAN_PHYMODE_11BEA_EHT20:
+			return CH_WIDTH_20MHZ;
+		case WLAN_PHYMODE_11NA_HT40:
+		case WLAN_PHYMODE_11NG_HT40PLUS:
+		case WLAN_PHYMODE_11NG_HT40MINUS:
+		case WLAN_PHYMODE_11NG_HT40:
+		case WLAN_PHYMODE_11AC_VHT40:
+		case WLAN_PHYMODE_11AC_VHT40PLUS_2G:
+		case WLAN_PHYMODE_11AC_VHT40MINUS_2G:
+		case WLAN_PHYMODE_11AC_VHT40_2G:
+		case WLAN_PHYMODE_11AXG_HE40PLUS:
+		case WLAN_PHYMODE_11AXG_HE40MINUS:
+		case WLAN_PHYMODE_11AXG_HE40:
+		case WLAN_PHYMODE_11BEA_EHT40:
+		case WLAN_PHYMODE_11BEG_EHT40PLUS:
+		case WLAN_PHYMODE_11BEG_EHT40MINUS:
+		case WLAN_PHYMODE_11BEG_EHT40:
+			return CH_WIDTH_40MHZ;
+		case WLAN_PHYMODE_11AC_VHT80:
+		case WLAN_PHYMODE_11AC_VHT80_2G:
+		case WLAN_PHYMODE_11AXA_HE80:
+		case WLAN_PHYMODE_11AXG_HE80:
+		case WLAN_PHYMODE_11BEA_EHT80:
+			return CH_WIDTH_80MHZ;
+		case WLAN_PHYMODE_11AC_VHT160:
+		case WLAN_PHYMODE_11AXA_HE160:
+		case WLAN_PHYMODE_11BEA_EHT160:
+			return CH_WIDTH_160MHZ;
+		case WLAN_PHYMODE_11AC_VHT80_80:
+		case WLAN_PHYMODE_11AXA_HE80_80:
+			return CH_WIDTH_80P80MHZ;
+		case WLAN_PHYMODE_11BEA_EHT320:
+			return CH_WIDTH_320MHZ;
+		default:
+			return CH_WIDTH_INVALID;
+		}
+}
+#else
+enum phy_ch_width
+utils_dfs_convert_wlan_phymode_to_chwidth(enum wlan_phymode phymode)
+{
+		switch (phymode) {
+		case WLAN_PHYMODE_11NA_HT20:
+		case WLAN_PHYMODE_11NG_HT20:
+		case WLAN_PHYMODE_11AC_VHT20:
+		case WLAN_PHYMODE_11AC_VHT20_2G:
+		case WLAN_PHYMODE_11AXA_HE20:
+		case WLAN_PHYMODE_11AXG_HE20:
+			return CH_WIDTH_20MHZ;
+		case WLAN_PHYMODE_11NA_HT40:
+		case WLAN_PHYMODE_11NG_HT40PLUS:
+		case WLAN_PHYMODE_11NG_HT40MINUS:
+		case WLAN_PHYMODE_11NG_HT40:
+		case WLAN_PHYMODE_11AC_VHT40:
+		case WLAN_PHYMODE_11AC_VHT40PLUS_2G:
+		case WLAN_PHYMODE_11AC_VHT40MINUS_2G:
+		case WLAN_PHYMODE_11AC_VHT40_2G:
+		case WLAN_PHYMODE_11AXG_HE40PLUS:
+		case WLAN_PHYMODE_11AXG_HE40MINUS:
+		case WLAN_PHYMODE_11AXG_HE40:
+			return CH_WIDTH_40MHZ;
+		case WLAN_PHYMODE_11AC_VHT80:
+		case WLAN_PHYMODE_11AC_VHT80_2G:
+		case WLAN_PHYMODE_11AXA_HE80:
+		case WLAN_PHYMODE_11AXG_HE80:
+			return CH_WIDTH_80MHZ;
+		case WLAN_PHYMODE_11AC_VHT160:
+		case WLAN_PHYMODE_11AXA_HE160:
+			return CH_WIDTH_160MHZ;
+		case WLAN_PHYMODE_11AC_VHT80_80:
+		case WLAN_PHYMODE_11AXA_HE80_80:
+			return CH_WIDTH_80P80MHZ;
+		default:
+			return CH_WIDTH_INVALID;
+		}
+}
+#endif
+
+#if defined(WLAN_FEATURE_11BE) && defined(QCA_DFS_BW_EXPAND) && \
+	defined(QCA_DFS_RCSA_SUPPORT)
+uint16_t
+utils_dfs_get_radar_bitmap_from_nolie(struct wlan_objmgr_pdev *pdev,
+				      enum wlan_phymode phy_mode,
+				      qdf_freq_t nol_ie_start_freq,
+				      uint8_t nol_ie_bitmap)
+{
+	struct wlan_dfs *dfs;
+
+	dfs = wlan_pdev_get_dfs_obj(pdev);
+	if (!dfs)
+		return 0;
+
+	return dfs_get_radar_bitmap_from_nolie(dfs, phy_mode, nol_ie_start_freq,
+					       nol_ie_bitmap);
+}
+#endif

+ 2 - 2
umac/regulatory/core/src/reg_services_common.c

@@ -5137,8 +5137,9 @@ reg_get_320_bonded_chan_array(struct wlan_objmgr_pdev *pdev,
 #define BW_160MHZ 160
 #define  REG_IS_TOT_CHAN_BW_BELOW_160(_x, _y) \
 	(reg_is_state_allowed((_x)) && (_y) < BW_160MHZ)
+#endif
 
-static inline qdf_freq_t
+qdf_freq_t
 reg_get_endchan_cen_from_bandstart(qdf_freq_t band_start,
 				   uint16_t bw)
 {
@@ -5146,7 +5147,6 @@ reg_get_endchan_cen_from_bandstart(qdf_freq_t band_start,
 
 	return left_edge_freq + bw - BW_10_MHZ;
 }
-#endif
 
 #ifdef WLAN_FEATURE_11BE
 enum channel_state

+ 12 - 0
umac/regulatory/core/src/reg_services_common.h

@@ -3064,4 +3064,16 @@ reg_get_num_rules_of_ap_pwr_type(struct wlan_objmgr_pdev *pdev,
  */
 QDF_STATUS reg_process_r2p_table_update_response(struct wlan_objmgr_psoc *psoc,
 						 uint32_t pdev_id);
+
+/**
+ * reg_get_endchan_cen_from_bandstart() - Get the center frequency of the
+ * end channel given the bandstart frequency.
+ * @band_start: Frequency band start in MHz
+ * @bw: Bandwidth in MHz
+ *
+ * Return: End frequency in MHz
+ */
+qdf_freq_t
+reg_get_endchan_cen_from_bandstart(qdf_freq_t band_start,
+				   uint16_t bw);
 #endif

+ 12 - 0
umac/regulatory/dispatcher/inc/wlan_reg_services_api.h

@@ -2916,4 +2916,16 @@ wlan_reg_register_is_chan_connected_callback(struct wlan_objmgr_psoc *psoc,
 void
 wlan_reg_unregister_is_chan_connected_callback(struct wlan_objmgr_psoc *psoc,
 					       void *cbk);
+
+/**
+ * wlan_reg_get_endchan_cen_from_bandstart() - Get the end channel frequency
+ * from the band start frequency.
+ * @band_start: Band start frequency in MHz
+ * @bw: Bandwidth in MHz
+ *
+ * Return: End frequency in MHz
+ */
+qdf_freq_t
+wlan_reg_get_endchan_cen_from_bandstart(qdf_freq_t band_start,
+					uint16_t bw);
 #endif

+ 7 - 0
umac/regulatory/dispatcher/src/wlan_reg_services_api.c

@@ -1973,3 +1973,10 @@ wlan_reg_unregister_is_chan_connected_callback(struct wlan_objmgr_psoc *psoc,
 	reg_unregister_is_chan_connected_callback(psoc,
 					(reg_is_chan_connected_callback)cbk);
 }
+
+qdf_freq_t
+wlan_reg_get_endchan_cen_from_bandstart(qdf_freq_t band_start,
+					uint16_t bw)
+{
+	return reg_get_endchan_cen_from_bandstart(band_start, bw);
+}