diff mbox series

[5/6] Add support for the driver init data for Intel Lantiq vendor

Message ID 20181126093444.516-1-sarada.prasanna.garnayak@intel.com
State Changes Requested
Headers show
Series [1/6] Add a header file defining Intel Lantiq OUI and vendor extensions | expand

Commit Message

Sarada Prasanna Garnayak Nov. 26, 2018, 9:34 a.m. UTC
When setting up the interface, send to the driver the following
parameters via vendor commands: country_code, is_11b, is_radar_detection.

Signed-off-by: Sarada Prasanna Garnayak <sarada.prasanna.garnayak@intel.com>
---
 src/common/intel-ltq-vendor.h | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

Comments

Jouni Malinen Nov. 26, 2018, 11 a.m. UTC | #1
On Mon, Nov 26, 2018 at 03:04:44PM +0530, Sarada Prasanna Garnayak wrote:
> When setting up the interface, send to the driver the following
> parameters via vendor commands: country_code, is_11b, is_radar_detection.

> diff --git a/src/common/intel-ltq-vendor.h b/src/common/intel-ltq-vendor.h
> @@ -55,12 +55,16 @@
>   * 	module support eapol functionality in the driver, this vendor
>   * 	cmd used to offload the eapol tx status work from hostapd
>   * 	to the driver.
> + *
> + * @INTEL_LTQ_NL80211_VENDOR_SUBCMD_INITIAL_DATA: Init vendor Data
> + * 	for country code, ieee80211b support, radar detection support.
>   */
>  enum intel_ltq_nl80211_vendor_subcmds {
>  	INTEL_LTQ_NL80211_VENDOR_SUBCMD_UNSPEC = 0,
>  	INTEL_LTQ_NL80211_VENDOR_SUBCMD_GET_AID = 1,
>  	INTEL_LTQ_NL80211_VENDOR_SUBCMD_FREE_AID = 2,
>  	INTEL_LTQ_NL80211_VENDOR_SUBCMD_TX_EAPOL = 3,
> +	INTEL_LTQ_NL80211_VENDOR_SUBCMD_INITIAL_DATA = 4,
>  };

As far as location for different definitions and implementation is
concerned, this is a good example of what could be in this header file
while everything following this should not..

As far as the proposed vendor specific parameters are concerned, isn't
country code and IEEE 802.11b related information already available
through upstream cfg80211? If not, I'd rather consider adding these in
upstream nl80211 (and same for that radar detection/802.11h part) so
that they would be available in more generic manner for all drivers.
diff mbox series

Patch

diff --git a/src/common/intel-ltq-vendor.h b/src/common/intel-ltq-vendor.h
index 6b9fac849..63e908080 100644
--- a/src/common/intel-ltq-vendor.h
+++ b/src/common/intel-ltq-vendor.h
@@ -55,12 +55,16 @@ 
  * 	module support eapol functionality in the driver, this vendor
  * 	cmd used to offload the eapol tx status work from hostapd
  * 	to the driver.
+ *
+ * @INTEL_LTQ_NL80211_VENDOR_SUBCMD_INITIAL_DATA: Init vendor Data
+ * 	for country code, ieee80211b support, radar detection support.
  */
 enum intel_ltq_nl80211_vendor_subcmds {
 	INTEL_LTQ_NL80211_VENDOR_SUBCMD_UNSPEC = 0,
 	INTEL_LTQ_NL80211_VENDOR_SUBCMD_GET_AID = 1,
 	INTEL_LTQ_NL80211_VENDOR_SUBCMD_FREE_AID = 2,
 	INTEL_LTQ_NL80211_VENDOR_SUBCMD_TX_EAPOL = 3,
+	INTEL_LTQ_NL80211_VENDOR_SUBCMD_INITIAL_DATA = 4,
 };
 
 /*
@@ -74,7 +78,35 @@  enum intel_ltq_nl80211_vendor_events {
 	INTEL_LTQ_NL80211_VENDOR_EVENT_RX_EAPOL = 0,
 };
 
+#define COUNTRY_CODE_MAX_LEN 3
+struct intel_ltq_hostapd_initial_data {
+	char	alpha2[COUNTRY_CODE_MAX_LEN];
+	u8	is_11b;
+	u8	radar_detection;
+};
+
 #ifdef CONFIG_DRIVER_NL80211_INTEL_LTQ
+static inline int
+send_initial_params_to_driver(struct hostapd_data *hapd, const char *country)
+{
+        struct intel_ltq_hostapd_initial_data data;
+
+        os_memset(&data, 0, sizeof(data));
+        os_memcpy(data.alpha2, country, 2);
+	data.is_11b = (HOSTAPD_MODE_IEEE80211B == hapd->iconf->hw_mode);
+        data.radar_detection = hapd->iconf->ieee80211h;
+
+        if (hostapd_drv_vendor_cmd(hapd, OUI_INTEL_LTQ,
+                                   INTEL_LTQ_NL80211_VENDOR_SUBCMD_INITIAL_DATA,
+                                   (const u8*)&data, sizeof(data), NULL)) {
+                wpa_printf(MSG_ERROR,
+                           "Failed to send intel ltq init data vendor cmd");
+                return -1;
+        }
+
+        return 0;
+}
+
 static inline void ap_sta_remove_in_other_bss_now(struct hostapd_data *hapd,
 						  const u8 *addr)
 {