qcacmn: Get phymode from HE phy capability

WLAN phy mode is calculated from HE capability.

Change-Id: I217cf6609f526a761c183395fe67f67adc95c4af
CRs-Fixed: 2550362
diff --git a/umac/cmn_services/cmn_defs/inc/wlan_cmn_ieee80211.h b/umac/cmn_services/cmn_defs/inc/wlan_cmn_ieee80211.h
index 2db8c0e..b0bec37 100644
--- a/umac/cmn_services/cmn_defs/inc/wlan_cmn_ieee80211.h
+++ b/umac/cmn_services/cmn_defs/inc/wlan_cmn_ieee80211.h
@@ -165,6 +165,15 @@
 /* 80 + 80 MHz Operating Channel  (revised signalling) */
 #define WLAN_VHTOP_CHWIDTH_REVSIG_80_80  1
 
+#define WLAN_HEOP_VHTOP_PRESENT_MASK       0x00004000  /* B14 */
+#define WLAN_HEOP_CO_LOCATED_BSS_MASK      0x00008000  /* B15 */
+#define WLAN_HEOP_6GHZ_INFO_PRESENT_MASK   0X00020000  /* B17 */
+
+#define WLAN_HE_6GHZ_CHWIDTH_20           0 /* 20MHz Oper Ch width */
+#define WLAN_HE_6GHZ_CHWIDTH_40           1 /* 40MHz Oper Ch width */
+#define WLAN_HE_6GHZ_CHWIDTH_80           2 /* 80MHz Oper Ch width */
+#define WLAN_HE_6GHZ_CHWIDTH_160_80_80    3 /* 160/80+80 MHz Oper Ch width */
+
 #define WLAN_RATE_VAL              0x7f
 
 #define WLAN_RV(v)     ((v) & WLAN_RATE_VAL)
@@ -186,6 +195,20 @@
 	((vhtop)->vht_op_ch_freq_seg2 != 0) && \
 	(abs((vhtop)->vht_op_ch_freq_seg2 - (vhtop)->vht_op_ch_freq_seg1) > 8))
 
+/* Check if channel width is HE160 in HE 6ghz params */
+#define WLAN_IS_HE160(he_6g_param) (((he_6g_param)->width == \
+	WLAN_HE_6GHZ_CHWIDTH_160_80_80) && \
+	((he_6g_param)->chan_freq_seg1 != 0) && \
+	(abs((he_6g_param)->chan_freq_seg1 - \
+	(he_6g_param)->chan_freq_seg0) == 8))
+
+/* Check if channel width is HE80p80 in HE 6ghz params */
+#define WLAN_IS_HE80_80(he_6g_param) (((he_6g_param)->width == \
+	WLAN_HE_6GHZ_CHWIDTH_160_80_80) && \
+	((he_6g_param)->chan_freq_seg1 != 0) && \
+	(abs((he_6g_param)->chan_freq_seg1 - \
+	(he_6g_param)->chan_freq_seg0) > 8))
+
 #define LE_READ_2(p) \
 	((uint16_t)\
 	((((const uint8_t *)(p))[0]) |\
@@ -949,6 +972,26 @@
 } qdf_packed;
 
 /**
+ * struct he_oper_6g_param: 6 Ghz params for HE
+ * @primary_channel: HE 6GHz Primary channel number
+ * @width: HE 6GHz BSS Channel Width
+ * @duplicate_beacon: HE 6GHz Duplicate beacon field
+ * @reserved: Reserved bits
+ * @chan_freq_seg0: HE 6GHz Channel Centre Frequency Segment 0
+ * @chan_freq_seg1: HE 6GHz Channel Centre Frequency Segment 1
+ * @minimum_rate: HE 6GHz Minimum Rate
+ */
+struct he_oper_6g_param {
+	uint8_t primary_channel;
+	uint8_t width:2,
+		duplicate_beacon:1,
+		reserved:5;
+	uint8_t chan_freq_seg0;
+	uint8_t chan_freq_seg1;
+	uint8_t minimum_rate;
+} qdf_packed;
+
+/**
  * struct wlan_country_ie: country IE
  * @ie: country IE
  * @len: IE len
diff --git a/umac/cmn_services/inc/wlan_cmn.h b/umac/cmn_services/inc/wlan_cmn.h
index e23330b..42e516d 100644
--- a/umac/cmn_services/inc/wlan_cmn.h
+++ b/umac/cmn_services/inc/wlan_cmn.h
@@ -422,6 +422,26 @@
 	((mode) == WLAN_PHYMODE_11AXG_HE40PLUS)  || \
 	((mode) == WLAN_PHYMODE_11AXG_HE40MINUS); })
 
+#define IS_WLAN_PHYMODE_HT(_mode) ({typeof(_mode) mode = (_mode); \
+	((mode) == WLAN_PHYMODE_11NA_HT20) || \
+	((mode) == WLAN_PHYMODE_11NG_HT20)     || \
+	((mode) == WLAN_PHYMODE_11NA_HT40)  || \
+	((mode) == WLAN_PHYMODE_11NG_HT40PLUS)  || \
+	((mode) == WLAN_PHYMODE_11NG_HT40MINUS)  || \
+	((mode) == WLAN_PHYMODE_11NG_HT40); })
+
+#define IS_WLAN_PHYMODE_VHT(_mode) ({typeof(_mode) mode = (_mode); \
+	((mode) == WLAN_PHYMODE_11AC_VHT20) || \
+	((mode) == WLAN_PHYMODE_11AC_VHT20_2G)     || \
+	((mode) == WLAN_PHYMODE_11AC_VHT40)  || \
+	((mode) == WLAN_PHYMODE_11AC_VHT40PLUS_2G)  || \
+	((mode) == WLAN_PHYMODE_11AC_VHT40MINUS_2G)  || \
+	((mode) == WLAN_PHYMODE_11AC_VHT40_2G)  || \
+	((mode) == WLAN_PHYMODE_11AC_VHT80)  || \
+	((mode) == WLAN_PHYMODE_11AC_VHT80_2G)  || \
+	((mode) == WLAN_PHYMODE_11AC_VHT160)  || \
+	((mode) == WLAN_PHYMODE_11AC_VHT80_80); })
+
 #define IS_WLAN_PHYMODE_HE(_mode) ({typeof(_mode) mode = (_mode); \
 	((mode) == WLAN_PHYMODE_11AXA_HE20) || \
 	((mode) == WLAN_PHYMODE_11AXG_HE20)     || \