[PATCH 01/10] nl80211_driver: Identify if nl80211 is capable of p2p device abstraction

dvdspndl at gmail.com dvdspndl
Mon Feb 18 12:30:27 PST 2013


From: Nirav Shah <nirav.j2.shah at intel.com>

Check the supported interfaces attribute to identify support for
a dedicated p2p device interface type. If set update the driver
capabilities flag to notify the supplicant.

Signed-off-by: David Spinadel <david.spinadel at intel.com>
---
 src/drivers/driver.h         |   12 ++++++++++--
 src/drivers/driver_nl80211.c |   12 ++++++++++++
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 7c6e2a5..c0c5982 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -807,7 +807,7 @@ struct wpa_driver_capa {
  * it cannot be used for P2P group operations or non-P2P purposes.
  */
 #define WPA_DRIVER_FLAGS_P2P_DEDICATED_INTERFACE	0x00000400
-/* This interface is P2P capable (P2P Device, GO, or P2P Client */
+/* This interface is P2P capable (P2P GO, or P2P Client */
 #define WPA_DRIVER_FLAGS_P2P_CAPABLE	0x00000800
 /* Driver supports concurrent operations on multiple channels */
 #define WPA_DRIVER_FLAGS_MULTI_CHANNEL_CONCURRENT	0x00001000
@@ -847,6 +847,8 @@ struct wpa_driver_capa {
 #define WPA_DRIVER_FLAGS_SAE				0x02000000
 /* Driver makes use of OBSS scan mechanism in wpa_supplicant */
 #define WPA_DRIVER_FLAGS_OBSS_SCAN			0x04000000
+/* Driver supports a dedicated interface for p2p device */
+#define WPA_DRIVER_FLAGS_DEDICATED_P2P_DEVICE		0x08000000
 	unsigned int flags;
 
 	int max_scan_ssids;
@@ -963,7 +965,13 @@ enum wpa_driver_if_type {
 	 * WPA_IF_P2P_GROUP - P2P Group interface (will become either
 	 * WPA_IF_P2P_GO or WPA_IF_P2P_CLIENT, but the role is not yet known)
 	 */
-	WPA_IF_P2P_GROUP
+	WPA_IF_P2P_GROUP,
+
+	/**
+	 * WPA_IF_P2P_DEVICE - P2P device interface is used to indentify the
+	 * abstracted p2p device function in the driver
+	 */
+	WPA_IF_P2P_DEVICE
 };
 
 struct wpa_init_params {
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 1133f5b..e2925c2 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -2469,6 +2469,7 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg)
 	struct wiphy_info_data *info = arg;
 	int p2p_go_supported = 0, p2p_client_supported = 0;
 	int p2p_concurrent = 0, p2p_multichan_concurrent = 0;
+	int p2p_device_supported = 0;
 	int auth_supported = 0, connect_supported = 0;
 	struct wpa_driver_capa *capa = info->capa;
 	static struct nla_policy
@@ -2513,6 +2514,9 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg)
 			case NL80211_IFTYPE_P2P_CLIENT:
 				p2p_client_supported = 1;
 				break;
+			case NL80211_IFTYPE_P2P_DEVICE:
+				p2p_device_supported = 1;
+				break;
 			case NL80211_IFTYPE_MONITOR:
 				info->monitor_supported = 1;
 				break;
@@ -2633,6 +2637,10 @@ broken_combination:
 
 	if (p2p_go_supported && p2p_client_supported)
 		capa->flags |= WPA_DRIVER_FLAGS_P2P_CAPABLE;
+
+	if (p2p_device_supported)
+		capa->flags |= WPA_DRIVER_FLAGS_DEDICATED_P2P_DEVICE;
+
 	if (p2p_concurrent) {
 		wpa_printf(MSG_DEBUG, "nl80211: Use separate P2P group "
 			   "interface (driver advertised support)");
@@ -5932,6 +5940,8 @@ static const char * nl80211_iftype_str(enum nl80211_iftype mode)
 		return "P2P_CLIENT";
 	case NL80211_IFTYPE_P2P_GO:
 		return "P2P_GO";
+	case NL80211_IFTYPE_P2P_DEVICE:
+		return "P2P_DEVICE";
 	default:
 		return "unknown";
 	}
@@ -8109,6 +8119,8 @@ static enum nl80211_iftype wpa_driver_nl80211_if_type(
 		return NL80211_IFTYPE_AP;
 	case WPA_IF_P2P_GO:
 		return NL80211_IFTYPE_P2P_GO;
+	case WPA_IF_P2P_DEVICE:
+		return NL80211_IFTYPE_P2P_DEVICE;
 	}
 	return -1;
 }
-- 
1.7.10.msysgit.1




More information about the Hostap mailing list