* [RFC] cfg80211: Android P2P-Device workaround
@ 2013-04-23 12:45 Johannes Berg
2013-04-23 14:50 ` Marcel Holtmann
0 siblings, 1 reply; 8+ messages in thread
From: Johannes Berg @ 2013-04-23 12:45 UTC (permalink / raw)
To: linux-wireless; +Cc: Johannes Berg
From: Johannes Berg <johannes.berg@intel.com>
Android requires a "p2p0" netdev to exist for P2P Device
functionality, and will even set it "UP" to start the P2P
Device functionality.
This is a hack to provide it so not only is Android happy
but also the current version of wpa_supplicant can work
with P2P-Device functionality without needing changes to
support the P2P-Device commands, just a little bit to not
attempt to change the interface type to station.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
net/wireless/Kconfig | 7 +++
net/wireless/Makefile | 1 +
net/wireless/android.c | 148 +++++++++++++++++++++++++++++++++++++++++++++++++
net/wireless/core.c | 15 ++++-
net/wireless/core.h | 7 +++
net/wireless/nl80211.c | 28 +++++++++-
6 files changed, 204 insertions(+), 2 deletions(-)
create mode 100644 net/wireless/android.c
diff --git a/net/wireless/Kconfig b/net/wireless/Kconfig
index 16d08b3..7c2981c 100644
--- a/net/wireless/Kconfig
+++ b/net/wireless/Kconfig
@@ -139,6 +139,13 @@ config CFG80211_WEXT
Enable this option if you need old userspace for wireless
extensions with cfg80211-based drivers.
+config CFG80211_ANDROID_P2P_HACK
+ bool "Android P2P netdevice hack"
+ depends on CFG80211
+ depends on !CFG80211_WEXT
+ help
+ Enable this option for Android P2P w/ P2P Device.
+
config LIB80211
tristate
default n
diff --git a/net/wireless/Makefile b/net/wireless/Makefile
index a761670..2800e67 100644
--- a/net/wireless/Makefile
+++ b/net/wireless/Makefile
@@ -14,6 +14,7 @@ cfg80211-y += mlme.o ibss.o sme.o chan.o ethtool.o mesh.o ap.o trace.o
cfg80211-$(CONFIG_CFG80211_DEBUGFS) += debugfs.o
cfg80211-$(CONFIG_CFG80211_WEXT) += wext-compat.o wext-sme.o
cfg80211-$(CONFIG_CFG80211_INTERNAL_REGDB) += regdb.o
+cfg80211-$(CONFIG_CFG80211_ANDROID_P2P_HACK) += android.o
CFLAGS_trace.o := -I$(src)
diff --git a/net/wireless/android.c b/net/wireless/android.c
new file mode 100644
index 0000000..f1ab103
--- /dev/null
+++ b/net/wireless/android.c
@@ -0,0 +1,148 @@
+/******************************************************************************
+ *
+ * This file is provided under the GPLv2 license.
+ *
+ * GPL LICENSE SUMMARY
+ *
+ * Copyright(c) 2013 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
+ * USA
+ *
+ * The full GNU General Public License is included in this distribution
+ * in the file called COPYING.
+ *
+ * Contact Information:
+ * Intel Linux Wireless <ilw@linux.intel.com>
+ * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
+ *
+ * Author: Johannes Berg <johannes.berg@intel.com>
+ *
+ *****************************************************************************/
+#include <linux/kernel.h>
+#include <linux/netdevice.h>
+#include <linux/rtnetlink.h>
+#include <net/cfg80211.h>
+#include "core.h"
+#include "rdev-ops.h"
+
+static int cfg80211_android_p2pdev_open(struct net_device *dev)
+{
+ struct wireless_dev *wdev = dev->ieee80211_ptr;
+ struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
+ int err;
+
+ if (!rdev->ops->start_p2p_device)
+ return -EOPNOTSUPP;
+
+ if (wdev->iftype != NL80211_IFTYPE_P2P_DEVICE)
+ return -EOPNOTSUPP;
+
+ if (wdev->p2p_started)
+ return 0;
+
+ mutex_lock(&rdev->devlist_mtx);
+ err = cfg80211_can_add_interface(rdev, wdev->iftype);
+ mutex_unlock(&rdev->devlist_mtx);
+ if (err)
+ return err;
+
+ err = rdev_start_p2p_device(rdev, wdev);
+ if (err)
+ return err;
+
+ wdev->p2p_started = true;
+ mutex_lock(&rdev->devlist_mtx);
+ rdev->opencount++;
+ mutex_unlock(&rdev->devlist_mtx);
+
+ return 0;
+}
+
+static int cfg80211_android_p2pdev_stop(struct net_device *dev)
+{
+ struct wireless_dev *wdev = dev->ieee80211_ptr;
+ struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
+
+ if (!wdev->p2p_started)
+ return 0;
+
+ mutex_lock(&rdev->devlist_mtx);
+ mutex_lock(&rdev->sched_scan_mtx);
+ cfg80211_stop_p2p_device(rdev, wdev);
+ mutex_unlock(&rdev->sched_scan_mtx);
+ mutex_unlock(&rdev->devlist_mtx);
+
+ return 0;
+}
+
+static netdev_tx_t cfg80211_android_p2pdev_start_xmit(struct sk_buff *skb,
+ struct net_device *dev)
+{
+ dev_kfree_skb(skb);
+ return NETDEV_TX_OK;
+}
+
+static const struct net_device_ops cfg80211_android_p2pdev_ops = {
+ .ndo_open = cfg80211_android_p2pdev_open,
+ .ndo_stop = cfg80211_android_p2pdev_stop,
+ .ndo_start_xmit = cfg80211_android_p2pdev_start_xmit,
+};
+
+static void cfg80211_android_p2pdev_setup(struct net_device *dev)
+{
+ ether_setup(dev);
+ dev->features |= NETIF_F_NETNS_LOCAL;
+ dev->netdev_ops = &cfg80211_android_p2pdev_ops;
+ dev->destructor = free_netdev;
+}
+
+void cfg80211_android_create_p2p_device(struct wireless_dev *wdev,
+ const char *name)
+{
+ if (WARN_ON(wdev->netdev))
+ return;
+
+ wdev->netdev = alloc_netdev(0, name, cfg80211_android_p2pdev_setup);
+ if (WARN(!wdev->netdev,
+ "Failed to allocate P2P-Device netdev, things will fail\n"))
+ return;
+
+ memcpy(wdev->netdev->dev_addr, wdev->address, ETH_ALEN);
+ wdev->netdev->ieee80211_ptr = wdev;
+
+ SET_NETDEV_DEVTYPE(wdev->netdev, &wiphy_type);
+
+ if (WARN(register_netdevice(wdev->netdev),
+ "Failed to register P2P-Device netdev, things will fail!\n")) {
+ free_netdev(wdev->netdev);
+ return;
+ }
+
+ if (sysfs_create_link(&wdev->netdev->dev.kobj, &wdev->wiphy->dev.kobj,
+ "phy80211")) {
+ pr_err("failed to add phy80211 symlink to netdev!\n");
+ }
+}
+
+void cfg80211_android_destroy_p2p_device(struct wireless_dev *wdev)
+{
+ ASSERT_RTNL();
+
+ if (!wdev->netdev)
+ return;
+
+ dev_close(wdev->netdev);
+ unregister_netdevice(wdev->netdev);
+}
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 84c9ad7..70859e1 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -807,8 +807,10 @@ void cfg80211_unregister_wdev(struct wireless_dev *wdev)
ASSERT_RTNL();
+#ifndef CONFIG_CFG80211_ANDROID_P2P_HACK
if (WARN_ON(wdev->netdev))
return;
+#endif
mutex_lock(&rdev->devlist_mtx);
mutex_lock(&rdev->sched_scan_mtx);
@@ -818,6 +820,9 @@ void cfg80211_unregister_wdev(struct wireless_dev *wdev)
switch (wdev->iftype) {
case NL80211_IFTYPE_P2P_DEVICE:
cfg80211_stop_p2p_device(rdev, wdev);
+#ifdef CONFIG_CFG80211_ANDROID_P2P_HACK
+ cfg80211_android_destroy_p2p_device(wdev);
+#endif
break;
default:
WARN_ON_ONCE(1);
@@ -828,7 +833,10 @@ void cfg80211_unregister_wdev(struct wireless_dev *wdev)
}
EXPORT_SYMBOL(cfg80211_unregister_wdev);
-static struct device_type wiphy_type = {
+#ifndef CONFIG_CFG80211_ANDROID_P2P_HACK
+static
+#endif
+struct device_type wiphy_type = {
.name = "wlan",
};
@@ -898,6 +906,11 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
WARN_ON(wdev->iftype == NL80211_IFTYPE_UNSPECIFIED);
+#ifdef CONFIG_CFG80211_ANDROID_P2P_HACK
+ if (wdev->iftype == NL80211_IFTYPE_P2P_DEVICE)
+ return NOTIFY_DONE;
+#endif
+
switch (state) {
case NETDEV_POST_INIT:
SET_NETDEV_DEVTYPE(dev, &wiphy_type);
diff --git a/net/wireless/core.h b/net/wireless/core.h
index fd35dae..91d5a97 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -522,4 +522,11 @@ void cfg80211_stop_p2p_device(struct cfg80211_registered_device *rdev,
#define CFG80211_DEV_WARN_ON(cond) ({bool __r = (cond); __r; })
#endif
+#ifdef CONFIG_CFG80211_ANDROID_P2P_HACK
+extern struct device_type wiphy_type;
+void cfg80211_android_create_p2p_device(struct wireless_dev *wdev,
+ const char *name);
+void cfg80211_android_destroy_p2p_device(struct wireless_dev *wdev);
+#endif
+
#endif /* __NET_WIRELESS_CORE_H */
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index f687a8d..349e615 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -2350,6 +2350,14 @@ static int nl80211_set_interface(struct sk_buff *skb, struct genl_info *info)
return -EINVAL;
}
+#ifdef CONFIG_CFG80211_ANDROID_P2P_HACK
+ if (otype == NL80211_IFTYPE_P2P_DEVICE) {
+ if (ntype == NL80211_IFTYPE_P2P_DEVICE)
+ return 0;
+ return -EINVAL;
+ }
+#endif
+
if (info->attrs[NL80211_ATTR_MESH_ID]) {
struct wireless_dev *wdev = dev->ieee80211_ptr;
@@ -2479,6 +2487,10 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info)
INIT_LIST_HEAD(&wdev->mgmt_registrations);
spin_lock_init(&wdev->mgmt_registrations_lock);
+#ifdef CONFIG_CFG80211_ANDROID_P2P_HACK
+ cfg80211_android_create_p2p_device(wdev,
+ nla_data(info->attrs[NL80211_ATTR_IFNAME]));
+#endif
mutex_lock(&rdev->devlist_mtx);
wdev->identifier = ++rdev->wdev_id;
list_add_rcu(&wdev->list, &rdev->wdev_list);
@@ -8183,6 +8195,11 @@ static int nl80211_start_p2p_device(struct sk_buff *skb, struct genl_info *info)
return err;
wdev->p2p_started = true;
+
+#ifdef CONFIG_CFG80211_ANDROID_P2P_HACK
+ WARN_ON(wdev->netdev && dev_open(wdev->netdev));
+#endif
+
mutex_lock(&rdev->devlist_mtx);
rdev->opencount++;
mutex_unlock(&rdev->devlist_mtx);
@@ -8207,6 +8224,10 @@ static int nl80211_stop_p2p_device(struct sk_buff *skb, struct genl_info *info)
mutex_unlock(&rdev->sched_scan_mtx);
mutex_unlock(&rdev->devlist_mtx);
+#ifdef CONFIG_CFG80211_ANDROID_P2P_HACK
+ WARN_ON(wdev->netdev && dev_close(wdev->netdev));
+#endif
+
return 0;
}
@@ -8362,7 +8383,12 @@ static int nl80211_pre_doit(struct genl_ops *ops, struct sk_buff *skb,
rdev = wiphy_to_dev(wdev->wiphy);
if (ops->internal_flags & NL80211_FLAG_NEED_NETDEV) {
- if (!dev) {
+ if (!dev
+#ifdef CONFIG_CFG80211_ANDROID_P2P_HACK
+ || (wdev->iftype == NL80211_IFTYPE_P2P_DEVICE &&
+ info->genlhdr->cmd != NL80211_CMD_SET_INTERFACE)
+#endif
+ ) {
mutex_unlock(&cfg80211_mutex);
if (rtnl)
rtnl_unlock();
--
1.8.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [RFC] cfg80211: Android P2P-Device workaround
2013-04-23 12:45 [RFC] cfg80211: Android P2P-Device workaround Johannes Berg
@ 2013-04-23 14:50 ` Marcel Holtmann
2013-04-23 16:42 ` Johannes Berg
0 siblings, 1 reply; 8+ messages in thread
From: Marcel Holtmann @ 2013-04-23 14:50 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, Johannes Berg
Hi Johannes,
> Android requires a "p2p0" netdev to exist for P2P Device
> functionality, and will even set it "UP" to start the P2P
> Device functionality.
>
> This is a hack to provide it so not only is Android happy
> but also the current version of wpa_supplicant can work
> with P2P-Device functionality without needing changes to
> support the P2P-Device commands, just a little bit to not
> attempt to change the interface type to station.
>
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
> ---
> net/wireless/Kconfig | 7 +++
> net/wireless/Makefile | 1 +
> net/wireless/android.c | 148 +++++++++++++++++++++++++++++++++++++++++++++++++
> net/wireless/core.c | 15 ++++-
> net/wireless/core.h | 7 +++
> net/wireless/nl80211.c | 28 +++++++++-
> 6 files changed, 204 insertions(+), 2 deletions(-)
> create mode 100644 net/wireless/android.c
>
> diff --git a/net/wireless/Kconfig b/net/wireless/Kconfig
> index 16d08b3..7c2981c 100644
> --- a/net/wireless/Kconfig
> +++ b/net/wireless/Kconfig
> @@ -139,6 +139,13 @@ config CFG80211_WEXT
> Enable this option if you need old userspace for wireless
> extensions with cfg80211-based drivers.
>
> +config CFG80211_ANDROID_P2P_HACK
> + bool "Android P2P netdevice hack"
> + depends on CFG80211
> + depends on !CFG80211_WEXT
> + help
> + Enable this option for Android P2P w/ P2P Device.
> +
do you really think this is a good idea? Wouldn't it be better if Android just gets its userspace fixed. This way, they never will and you carry this workaround forever.
Has anybody actually looked into what it would take to just fix Android userspace to use nl80211 to bring up P2P. I just see tons of #ifdef added to the kernel.
<snip>
> @@ -8362,7 +8383,12 @@ static int nl80211_pre_doit(struct genl_ops *ops, struct sk_buff *skb,
> rdev = wiphy_to_dev(wdev->wiphy);
>
> if (ops->internal_flags & NL80211_FLAG_NEED_NETDEV) {
> - if (!dev) {
> + if (!dev
> +#ifdef CONFIG_CFG80211_ANDROID_P2P_HACK
> + || (wdev->iftype == NL80211_IFTYPE_P2P_DEVICE &&
> + info->genlhdr->cmd != NL80211_CMD_SET_INTERFACE)
> +#endif
> + ) {
> mutex_unlock(&cfg80211_mutex);
> if (rtnl)
> rtnl_unlock();
And doing an #ifdef in the middle of if-clause doesn't ring any alarm bells that this might be a really bad idea ;)
When I am looking at the USB gadget handling, I see a lot of progress in establishing a standard kernel interface and changing Android userspace to work with that instead.
Regards
Marcel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC] cfg80211: Android P2P-Device workaround
2013-04-23 14:50 ` Marcel Holtmann
@ 2013-04-23 16:42 ` Johannes Berg
2013-04-24 8:13 ` Arend van Spriel
0 siblings, 1 reply; 8+ messages in thread
From: Johannes Berg @ 2013-04-23 16:42 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-wireless
On Tue, 2013-04-23 at 07:50 -0700, Marcel Holtmann wrote:
> > +config CFG80211_ANDROID_P2P_HACK
> > + bool "Android P2P netdevice hack"
> > + depends on CFG80211
> > + depends on !CFG80211_WEXT
> > + help
> > + Enable this option for Android P2P w/ P2P Device.
> > +
>
> do you really think this is a good idea? Wouldn't it be better if
> Android just gets its userspace fixed. This way, they never will and
> you carry this workaround forever.
Well, I'm about 50/50 on whether to merge this. On the one hand, it's a
very simple patch to carry out of tree, on the other hand more than one
person will need it.
> Has anybody actually looked into what it would take to just fix
> Android userspace to use nl80211 to bring up P2P. I just see tons of
> #ifdef added to the kernel.
Yes, I did :-)
However, for any system running Jelly Bean that's not really an option,
and I have no idea if/how K-whatever is coming, so it might not be
possible there either. Additionally, fairly large changes are needed in
wpa_supplicant to actually support the P2P-Device with only nl82011
APIs.
This gives us a transition path while making changes to the other parts
of the stack.
> > + if (!dev
> > +#ifdef CONFIG_CFG80211_ANDROID_P2P_HACK
> > + || (wdev->iftype == NL80211_IFTYPE_P2P_DEVICE &&
> > + info->genlhdr->cmd != NL80211_CMD_SET_INTERFACE)
> > +#endif
> > + ) {
> > mutex_unlock(&cfg80211_mutex);
> > if (rtnl)
> > rtnl_unlock();
>
> And doing an #ifdef in the middle of if-clause doesn't ring any alarm
> bells that this might be a really bad idea ;)
Well, I could put an #ifdef into each and every command instead which I
didn't want to, which incidentally is the reason for not allowing this
with WEXT, WEXT ioctls on the P2P-Device netdev just cause crashes :)
Basically this way also reduces the surface of this patch to make it
easier to use out of tree.
> When I am looking at the USB gadget handling, I see a lot of progress
> in establishing a standard kernel interface and changing Android
> userspace to work with that instead.
"progress" doesn't really help, at least in this case it's pretty much
an either-or situation and changing the userspace will take a long time.
johannes
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC] cfg80211: Android P2P-Device workaround
2013-04-23 16:42 ` Johannes Berg
@ 2013-04-24 8:13 ` Arend van Spriel
2013-04-24 8:28 ` Johannes Berg
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Arend van Spriel @ 2013-04-24 8:13 UTC (permalink / raw)
To: Johannes Berg; +Cc: Marcel Holtmann, linux-wireless
On 04/23/2013 06:42 PM, Johannes Berg wrote:
> On Tue, 2013-04-23 at 07:50 -0700, Marcel Holtmann wrote:
>
>>> +config CFG80211_ANDROID_P2P_HACK
>>> + bool "Android P2P netdevice hack"
>>> + depends on CFG80211
>>> + depends on !CFG80211_WEXT
>>> + help
>>> + Enable this option for Android P2P w/ P2P Device.
>>> +
>>
>> do you really think this is a good idea? Wouldn't it be better if
>> Android just gets its userspace fixed. This way, they never will and
>> you carry this workaround forever.
>
> Well, I'm about 50/50 on whether to merge this. On the one hand, it's a
> very simple patch to carry out of tree, on the other hand more than one
> person will need it.
>
Here is one who needs it. I consider this patch as a temporary solution,
but it would be good to have it upstream. We would be using
compat-drivers to backport the upstream brcmfmac to the android kernel,
which also takes care of cfg80211.
>> Has anybody actually looked into what it would take to just fix
>> Android userspace to use nl80211 to bring up P2P. I just see tons of
>> #ifdef added to the kernel.
>
> Yes, I did :-)
>
> However, for any system running Jelly Bean that's not really an option,
> and I have no idea if/how K-whatever is coming, so it might not be
> possible there either. Additionally, fairly large changes are needed in
> wpa_supplicant to actually support the P2P-Device with only nl82011
> APIs.
If android is moving to 3.8 kernel with KLP (key lime pie), you could
say that it requires middleware/wifi-framework to deal with the new
kernel API. However, it mostly involves wpa_supplicant regardless of
using it on android or not. So this is more a wpa_supplicant P2P hack.
> This gives us a transition path while making changes to the other parts
> of the stack.
For 'selfish' reasons I am not opposed to this path ;-)
>>> + if (!dev
>>> +#ifdef CONFIG_CFG80211_ANDROID_P2P_HACK
>>> + || (wdev->iftype == NL80211_IFTYPE_P2P_DEVICE &&
>>> + info->genlhdr->cmd != NL80211_CMD_SET_INTERFACE)
>>> +#endif
>>> + ) {
>>> mutex_unlock(&cfg80211_mutex);
>>> if (rtnl)
>>> rtnl_unlock();
>>
>> And doing an #ifdef in the middle of if-clause doesn't ring any alarm
>> bells that this might be a really bad idea ;)
>
> Well, I could put an #ifdef into each and every command instead which I
> didn't want to, which incidentally is the reason for not allowing this
> with WEXT, WEXT ioctls on the P2P-Device netdev just cause crashes :)
I dislike these kind of constructs as well so I would like this to be
made somewhat cleaner (conditional helper function?).
> Basically this way also reduces the surface of this patch to make it
> easier to use out of tree.
>
>> When I am looking at the USB gadget handling, I see a lot of progress
>> in establishing a standard kernel interface and changing Android
>> userspace to work with that instead.
>
> "progress" doesn't really help, at least in this case it's pretty much
> an either-or situation and changing the userspace will take a long time.
As long as changing the user-space is done eventually, right.
Gr. AvS
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC] cfg80211: Android P2P-Device workaround
2013-04-24 8:13 ` Arend van Spriel
@ 2013-04-24 8:28 ` Johannes Berg
2013-04-24 8:31 ` Johannes Berg
2013-04-24 14:29 ` Marcel Holtmann
2 siblings, 0 replies; 8+ messages in thread
From: Johannes Berg @ 2013-04-24 8:28 UTC (permalink / raw)
To: Arend van Spriel; +Cc: Marcel Holtmann, linux-wireless
On Wed, 2013-04-24 at 10:13 +0200, Arend van Spriel wrote:
> If android is moving to 3.8 kernel with KLP (key lime pie), you could
> say that it requires middleware/wifi-framework to deal with the new
> kernel API. However, it mostly involves wpa_supplicant regardless of
> using it on android or not. So this is more a wpa_supplicant P2P hack.
There's no driver in 3.8 though that even uses P2P-Device. :-)
> >>> +#ifdef CONFIG_CFG80211_ANDROID_P2P_HACK
> >>> + || (wdev->iftype == NL80211_IFTYPE_P2P_DEVICE &&
> >>> + info->genlhdr->cmd != NL80211_CMD_SET_INTERFACE)
> >>> +#endif
> >>> + ) {
> >>> mutex_unlock(&cfg80211_mutex);
> >>> if (rtnl)
> >>> rtnl_unlock();
> >>
> >> And doing an #ifdef in the middle of if-clause doesn't ring any alarm
> >> bells that this might be a really bad idea ;)
> >
> > Well, I could put an #ifdef into each and every command instead which I
> > didn't want to, which incidentally is the reason for not allowing this
> > with WEXT, WEXT ioctls on the P2P-Device netdev just cause crashes :)
>
> I dislike these kind of constructs as well so I would like this to be
> made somewhat cleaner (conditional helper function?).
Actually I had to change it anyway, see the v2 patch, to fix a crash
when removing the p2p-device again.
johannes
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC] cfg80211: Android P2P-Device workaround
2013-04-24 8:13 ` Arend van Spriel
2013-04-24 8:28 ` Johannes Berg
@ 2013-04-24 8:31 ` Johannes Berg
2013-04-24 14:29 ` Marcel Holtmann
2 siblings, 0 replies; 8+ messages in thread
From: Johannes Berg @ 2013-04-24 8:31 UTC (permalink / raw)
To: Arend van Spriel; +Cc: Marcel Holtmann, linux-wireless
On Wed, 2013-04-24 at 10:13 +0200, Arend van Spriel wrote:
> >> When I am looking at the USB gadget handling, I see a lot of progress
> >> in establishing a standard kernel interface and changing Android
> >> userspace to work with that instead.
> >
> > "progress" doesn't really help, at least in this case it's pretty much
> > an either-or situation and changing the userspace will take a long time.
>
> As long as changing the user-space is done eventually, right.
Separate subthread for this ...
What do we even consider to be the "right" changes? Android really only
wants a "p2p0" control/monitor socket in wpa_supplicant, it doesn't
really care about anything else (apart from the stupidity about wanting
a p2p0 netdev to set it UP) whether you use P2P-Device in the kernel or
not.
So I would say that using the "standard kernel interface" is actually
more of a wpa_supplicant thing, I think it should simply allow the
option of
a) use the P2P-Device internally (as David Spinadel's patches do)
b) be able to create a separate control/monitor P2P socket, regardless
of
whether there's a P2P-Device or not
Alternatively, Android could presumably use the regular socket for P2P,
but I'm not sure what the reason is for not doing so?
johannes
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC] cfg80211: Android P2P-Device workaround
2013-04-24 8:13 ` Arend van Spriel
2013-04-24 8:28 ` Johannes Berg
2013-04-24 8:31 ` Johannes Berg
@ 2013-04-24 14:29 ` Marcel Holtmann
2013-04-25 9:03 ` Arend van Spriel
2 siblings, 1 reply; 8+ messages in thread
From: Marcel Holtmann @ 2013-04-24 14:29 UTC (permalink / raw)
To: Arend van Spriel; +Cc: Johannes Berg, linux-wireless
Hi Arend,
>>>> +config CFG80211_ANDROID_P2P_HACK
>>>> + bool "Android P2P netdevice hack"
>>>> + depends on CFG80211
>>>> + depends on !CFG80211_WEXT
>>>> + help
>>>> + Enable this option for Android P2P w/ P2P Device.
>>>> +
>>>
>>> do you really think this is a good idea? Wouldn't it be better if
>>> Android just gets its userspace fixed. This way, they never will and
>>> you carry this workaround forever.
>>
>> Well, I'm about 50/50 on whether to merge this. On the one hand, it's a
>> very simple patch to carry out of tree, on the other hand more than one
>> person will need it.
>>
>
> Here is one who needs it. I consider this patch as a temporary solution, but it would be good to have it upstream. We would be using compat-drivers to backport the upstream brcmfmac to the android kernel, which also takes care of cfg80211.
why do I get the feeling that the root-cause for this stupid p2p0 device is the Broadcom binary only driver ;)
I feel like being back in the world of Wireless Extensions ;)
Regards
Marcel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC] cfg80211: Android P2P-Device workaround
2013-04-24 14:29 ` Marcel Holtmann
@ 2013-04-25 9:03 ` Arend van Spriel
0 siblings, 0 replies; 8+ messages in thread
From: Arend van Spriel @ 2013-04-25 9:03 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: Johannes Berg, linux-wireless
On 04/24/2013 04:29 PM, Marcel Holtmann wrote:
> Hi Arend,
>
>>>>> +config CFG80211_ANDROID_P2P_HACK
>>>>> + bool "Android P2P netdevice hack"
>>>>> + depends on CFG80211
>>>>> + depends on !CFG80211_WEXT
>>>>> + help
>>>>> + Enable this option for Android P2P w/ P2P Device.
>>>>> +
>>>>
>>>> do you really think this is a good idea? Wouldn't it be better if
>>>> Android just gets its userspace fixed. This way, they never will and
>>>> you carry this workaround forever.
>>>
>>> Well, I'm about 50/50 on whether to merge this. On the one hand, it's a
>>> very simple patch to carry out of tree, on the other hand more than one
>>> person will need it.
>>>
>>
>> Here is one who needs it. I consider this patch as a temporary solution, but it would be good to have it upstream. We would be using compat-drivers to backport the upstream brcmfmac to the android kernel, which also takes care of cfg80211.
>
> why do I get the feeling that the root-cause for this stupid p2p0 device is the Broadcom binary only driver ;)
Hi Marcel,
Just like you I can only guess, but you are probably right except that
the broadcom driver introducing this p2p0 device was propbably the
bcmdhd driver which is available in android repositories.
Because of the design of the firmware (which is binary) going for a
net_device was the most straightforward and also because wpa_supplicant
is all about net_device interfaces.
> I feel like being back in the world of Wireless Extensions ;)
I hear you and we are still not fully rid of that.
Gr. AvS
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-04-25 9:03 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-23 12:45 [RFC] cfg80211: Android P2P-Device workaround Johannes Berg
2013-04-23 14:50 ` Marcel Holtmann
2013-04-23 16:42 ` Johannes Berg
2013-04-24 8:13 ` Arend van Spriel
2013-04-24 8:28 ` Johannes Berg
2013-04-24 8:31 ` Johannes Berg
2013-04-24 14:29 ` Marcel Holtmann
2013-04-25 9:03 ` Arend van Spriel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).