Search Linux Wireless

Re: [PATCH 3/7] mac80211: add combined power type definition for 6 GHz

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 9/6/2022 16:31, Johannes Berg wrote:
On Mon, 2022-07-04 at 15:53 +0530, Aditya Kumar Singh wrote:

+/**
+ * enum nl80211_regulatory_power_modes - 6 GHz regulatory power
+ *					 modes
+ * @NL80211_REG_AP_LPI: Low Power Indoor (Access Point)
+ * @NL80211_REG_AP_SP: Standard Power (Access Point)
+ * @NL80211_REG_AP_VLP: Very Low Power (Access Point)
+ * @NL80211_REG_REGULAR_CLIENT_LPI: Low Power Indoor (Regular
+ *				    or Default Client)

REG_REGULAR reads a bit weird, and anyway "REG" as the prefix for
"regulatory_power_mode" is a bit strange?

Maybe use something like REG_PWR_MODE_... ?
Sure will use. Thanks for the suggestion.



+++ b/net/wireless/util.c
@@ -190,6 +190,66 @@ struct ieee80211_channel *ieee80211_get_channel_khz(struct wiphy *wiphy,
  }
  EXPORT_SYMBOL(ieee80211_get_channel_khz);
+enum nl80211_regulatory_power_modes
+ieee80211_ap_reg_power_to_reg_power_mode(enum ieee80211_ap_reg_power ap_type)
+{
+	switch (ap_type) {
+	case IEEE80211_REG_LPI_AP:
+		return NL80211_REG_AP_LPI;
+	case IEEE80211_REG_SP_AP:
+		return NL80211_REG_AP_SP;
+	case IEEE80211_REG_VLP_AP:
+		return NL80211_REG_AP_VLP;
+	default:
+		return NL80211_REG_MAX_POWER_MODES + 1;
+	}
+}
+EXPORT_SYMBOL(ieee80211_ap_reg_power_to_reg_power_mode);

What is the use of that, why export it? Same for the other function.
We have two enum - one defined in ieee80211 header file having
two separate enum of AP and client power modes respectively and one in nl80211 header which is combined power type. At times there can be use-case to convert from enum in ieee80211 to nl80211. These helper
function will do that.

And in kernel layer whenever we need we can call these function. But if driver needs to call it, at that point we need these functions to be exported (called from different kernel module).


johannes




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux