[RFC 08/10] wpa_supplicant: add P2P device driver priv

Arend van Spriel arend
Mon Feb 11 03:15:45 PST 2013


From: David Spinadel <david.spinadel at intel.com>

Add driver priv for P2P device in wpa_supplicant structure.
Add P2P dedicated wrappers for the driver API, and use p2p_drv_priv
instead of drv_priv.

Signed-hostap: David Spinadel <david.spinadel at intel.com>
---
 wpa_supplicant/driver_i.h         |   64 +++++++++++++++++++++++++++++++++++++
 wpa_supplicant/wpa_supplicant_i.h |    2 ++
 2 files changed, 66 insertions(+)

diff --git a/wpa_supplicant/driver_i.h b/wpa_supplicant/driver_i.h
index 79f0641..d79493e 100644
--- a/wpa_supplicant/driver_i.h
+++ b/wpa_supplicant/driver_i.h
@@ -690,6 +690,70 @@ static inline int wpa_drv_wnm_oper(struct wpa_supplicant *wpa_s,
 }
 
 #ifdef CONFIG_P2P
+static inline void *wpa_p2p_get_priv(struct wpa_supplicant *wpa_s)
+{
+	return wpa_s->p2p_drv_priv ? wpa_s->p2p_drv_priv : wpa_s->drv_priv;
+}
+
+static inline int wpa_drv_p2p_scan(struct wpa_supplicant *wpa_s,
+				   struct wpa_driver_scan_params *params)
+{
+	if (wpa_s->driver->scan2)
+		return wpa_s->driver->scan2(wpa_p2p_get_priv(wpa_s), params);
+	return -1;
+}
+
+static inline int wpa_drv_p2p_send_mlme(struct wpa_supplicant *wpa_s,
+					const u8 *data, size_t data_len,
+					int noack)
+{
+	if (wpa_s->driver->send_mlme)
+		return wpa_s->driver->send_mlme(wpa_p2p_get_priv(wpa_s), data,
+						data_len, noack);
+	return -1;
+}
+
+static inline int wpa_drv_p2p_send_action(struct wpa_supplicant *wpa_s,
+					  unsigned int freq,
+					  unsigned int wait,
+					  const u8 *dst, const u8 *src,
+					  const u8 *bssid,
+					  const u8 *data, size_t data_len,
+					  int no_cck)
+{
+	if (wpa_s->driver->send_action)
+		return wpa_s->driver->send_action(wpa_p2p_get_priv(wpa_s), freq,
+						  wait, dst, src, bssid,
+						  data, data_len, no_cck);
+	return -1;
+}
+
+static inline void
+wpa_drv_p2p_send_action_cancel_wait(struct wpa_supplicant *wpa_s)
+{
+	if (wpa_s->driver->send_action_cancel_wait)
+		wpa_s->driver->send_action_cancel_wait(wpa_p2p_get_priv(wpa_s));
+}
+
+static inline int wpa_drv_p2p_remain_on_channel(struct wpa_supplicant *wpa_s,
+						unsigned int freq,
+						unsigned int duration)
+{
+	if (wpa_s->driver->remain_on_channel)
+		return wpa_s->driver->remain_on_channel(wpa_p2p_get_priv(wpa_s),
+							freq, duration);
+	return -1;
+}
+
+static inline int
+wpa_drv_p2p_cancel_remain_on_channel(struct wpa_supplicant *wpa_s)
+{
+	if (wpa_s->driver->cancel_remain_on_channel)
+		return wpa_s->driver->cancel_remain_on_channel(
+						wpa_p2p_get_priv(wpa_s));
+	return -1;
+}
+
 static inline void *wpa_drv_init_p2p_dev(struct wpa_supplicant *wpa_s,
 					 const char *ifname, u8 *addr)
 {
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index 0f51f8e..e84584e 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -617,6 +617,8 @@ struct wpa_supplicant {
 	int p2p_go_intent;
 	int p2p_connect_freq;
 	struct os_time p2p_auto_started;
+
+	void *p2p_drv_priv; /* private data used by driver_ops for p2p device*/
 #endif /* CONFIG_P2P */
 
 	struct wpa_ssid *bgscan_ssid;
-- 
1.7.10.4





More information about the Hostap mailing list