* [PATCH v3] wireless: Supporting of IFLA_INFO_KIND rtnl attribute
@ 2014-12-09 22:21 Vadim Kochan
2014-12-09 23:23 ` Marcel Holtmann
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Vadim Kochan @ 2014-12-09 22:21 UTC (permalink / raw)
To: johannes, linux-wireless; +Cc: linville, Vadim Kochan
It allows to identify the wlan kind of device for the user application,
e.g.:
# ip -d link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 promiscuity 0
2: enp0s25: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000
link/ether XX:XX:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff promiscuity 0
3: wlp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether XX:XX:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff promiscuity 0
wlan
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
---
net/wireless/core.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/wireless/core.c b/net/wireless/core.c
index f52a4cd..eb7c088 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -21,6 +21,7 @@
#include <linux/sched.h>
#include <net/genetlink.h>
#include <net/cfg80211.h>
+#include <net/rtnetlink.h>
#include "nl80211.h"
#include "core.h"
#include "sysfs.h"
@@ -866,6 +867,10 @@ void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev,
}
EXPORT_SYMBOL(cfg80211_stop_iface);
+static struct rtnl_link_ops wireless_link_ops __read_mostly = {
+ .kind = "wlan",
+};
+
static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
unsigned long state, void *ptr)
{
@@ -883,6 +888,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
switch (state) {
case NETDEV_POST_INIT:
SET_NETDEV_DEVTYPE(dev, &wiphy_type);
+ dev->rtnl_link_ops = &wireless_link_ops;
break;
case NETDEV_REGISTER:
/*
--
2.1.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v3] wireless: Supporting of IFLA_INFO_KIND rtnl attribute
2014-12-09 23:23 ` Marcel Holtmann
@ 2014-12-09 23:23 ` vadim4j
2014-12-10 8:04 ` Bastian Bittorf
2014-12-10 8:12 ` Johannes Berg
1 sibling, 1 reply; 8+ messages in thread
From: vadim4j @ 2014-12-09 23:23 UTC (permalink / raw)
To: Marcel Holtmann
Cc: Vadim Kochan, Johannes Berg, linux-wireless, John W. Linville
On Wed, Dec 10, 2014 at 12:23:14AM +0100, Marcel Holtmann wrote:
> Hi Johannes,
>
> > On Dec 9, 2014, at 23:21, Vadim Kochan <vadim4j@gmail.com> wrote:
> >
> > It allows to identify the wlan kind of device for the user application,
> > e.g.:
> >
> > # ip -d link
> >
> > 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
> > link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 promiscuity 0
> > 2: enp0s25: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000
> > link/ether XX:XX:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff promiscuity 0
> > 3: wlp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
> > link/ether XX:XX:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff promiscuity 0
> > wlan
>
> have we considered also exposing the mode of this netdev. So for example sta,ap,p2p-go,p2p-client etc. If we can send dynamic updates via RTNL, we could easily tell the networking management system what type of wireless device we have here. I am thinking about it like "wlan/p2p-go" etc. Or should this be better kept strictly to "wlan".
>
> And I am not sure RTNL would be capable of changing this kind strings at runtime anyway.
>
> Regards
>
> Marcel
>
May be better do not mix 2 things in one attribute?
Regards,
Vadim
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3] wireless: Supporting of IFLA_INFO_KIND rtnl attribute
2014-12-09 22:21 [PATCH v3] wireless: Supporting of IFLA_INFO_KIND rtnl attribute Vadim Kochan
@ 2014-12-09 23:23 ` Marcel Holtmann
2014-12-09 23:23 ` vadim4j
2014-12-10 8:12 ` Johannes Berg
2014-12-10 20:36 ` Marcel Holtmann
2014-12-12 12:43 ` Johannes Berg
2 siblings, 2 replies; 8+ messages in thread
From: Marcel Holtmann @ 2014-12-09 23:23 UTC (permalink / raw)
To: Vadim Kochan; +Cc: Johannes Berg, linux-wireless, John W. Linville
Hi Johannes,
> On Dec 9, 2014, at 23:21, Vadim Kochan <vadim4j@gmail.com> wrote:
>
> It allows to identify the wlan kind of device for the user application,
> e.g.:
>
> # ip -d link
>
> 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
> link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 promiscuity 0
> 2: enp0s25: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000
> link/ether XX:XX:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff promiscuity 0
> 3: wlp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
> link/ether XX:XX:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff promiscuity 0
> wlan
have we considered also exposing the mode of this netdev. So for example sta,ap,p2p-go,p2p-client etc. If we can send dynamic updates via RTNL, we could easily tell the networking management system what type of wireless device we have here. I am thinking about it like "wlan/p2p-go" etc. Or should this be better kept strictly to "wlan".
And I am not sure RTNL would be capable of changing this kind strings at runtime anyway.
Regards
Marcel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3] wireless: Supporting of IFLA_INFO_KIND rtnl attribute
2014-12-09 23:23 ` vadim4j
@ 2014-12-10 8:04 ` Bastian Bittorf
0 siblings, 0 replies; 8+ messages in thread
From: Bastian Bittorf @ 2014-12-10 8:04 UTC (permalink / raw)
To: vadim4j; +Cc: Marcel Holtmann, Johannes Berg, linux-wireless, John W. Linville
* vadim4j@gmail.com <vadim4j@gmail.com> [10.12.2014 08:55]:
> > have we considered also exposing the mode of this netdev. So for example sta,ap,p2p-go,p2p-client etc. If we can send dynamic updates via RTNL, we could easily tell the networking management system what type of wireless device we have here. I am thinking about it like "wlan/p2p-go" etc. Or should this be better kept strictly to "wlan".
> >
> > And I am not sure RTNL would be capable of changing this kind strings at runtime anyway.
>
> May be better do not mix 2 things in one attribute?
i like the idea. who is the potential audience of the attribute beside the user?
meaning: whoever want to scan for the keyword 'wlan' can do so, even with 'wlan/xy'
bye, bastian
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3] wireless: Supporting of IFLA_INFO_KIND rtnl attribute
2014-12-09 23:23 ` Marcel Holtmann
2014-12-09 23:23 ` vadim4j
@ 2014-12-10 8:12 ` Johannes Berg
2014-12-10 20:35 ` Marcel Holtmann
1 sibling, 1 reply; 8+ messages in thread
From: Johannes Berg @ 2014-12-10 8:12 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: Vadim Kochan, linux-wireless, John W. Linville
On Wed, 2014-12-10 at 00:23 +0100, Marcel Holtmann wrote:
> have we considered also exposing the mode of this netdev. So for
> example sta,ap,p2p-go,p2p-client etc. If we can send dynamic updates
> via RTNL, we could easily tell the networking management system what
> type of wireless device we have here. I am thinking about it like
> "wlan/p2p-go" etc. Or should this be better kept strictly to "wlan".
I certainly haven't considered this API at all :)
That said, I'm not sure where it would be used, so I don't really know.
> And I am not sure RTNL would be capable of changing this kind strings
> at runtime anyway.
Given the API (fixed constant string in a const struct that the netdev
points to) it seems that it doesn't really support that, unless we
change the internals to have a function to return the string or keep
lots of copies of the struct and reassign them - neither seems very
appealing.
johannes
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3] wireless: Supporting of IFLA_INFO_KIND rtnl attribute
2014-12-10 8:12 ` Johannes Berg
@ 2014-12-10 20:35 ` Marcel Holtmann
0 siblings, 0 replies; 8+ messages in thread
From: Marcel Holtmann @ 2014-12-10 20:35 UTC (permalink / raw)
To: Johannes Berg; +Cc: Vadim Kochan, linux-wireless, John W. Linville
Hi Johannes,
>> have we considered also exposing the mode of this netdev. So for
>> example sta,ap,p2p-go,p2p-client etc. If we can send dynamic updates
>> via RTNL, we could easily tell the networking management system what
>> type of wireless device we have here. I am thinking about it like
>> "wlan/p2p-go" etc. Or should this be better kept strictly to "wlan".
>
> I certainly haven't considered this API at all :)
> That said, I'm not sure where it would be used, so I don't really know.
>
>> And I am not sure RTNL would be capable of changing this kind strings
>> at runtime anyway.
>
> Given the API (fixed constant string in a const struct that the netdev
> points to) it seems that it doesn't really support that, unless we
> change the internals to have a function to return the string or keep
> lots of copies of the struct and reassign them - neither seems very
> appealing.
if this is a constant string similar to DEVTYPE, the it should be just "wlan" and nothing else. If internal APIs require changing, then that could be done in addition to this patch.
Regards
Marcel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3] wireless: Supporting of IFLA_INFO_KIND rtnl attribute
2014-12-09 22:21 [PATCH v3] wireless: Supporting of IFLA_INFO_KIND rtnl attribute Vadim Kochan
2014-12-09 23:23 ` Marcel Holtmann
@ 2014-12-10 20:36 ` Marcel Holtmann
2014-12-12 12:43 ` Johannes Berg
2 siblings, 0 replies; 8+ messages in thread
From: Marcel Holtmann @ 2014-12-10 20:36 UTC (permalink / raw)
To: Vadim Kochan; +Cc: Johannes Berg, linux-wireless, John W. Linville
Hi Vadim,
> It allows to identify the wlan kind of device for the user application,
> e.g.:
>
> # ip -d link
>
> 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
> link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 promiscuity 0
> 2: enp0s25: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000
> link/ether XX:XX:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff promiscuity 0
> 3: wlp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
> link/ether XX:XX:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff promiscuity 0
> wlan
>
> Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
> ---
> net/wireless/core.c | 6 ++++++
> 1 file changed, 6 insertions(+)
for what its worth.
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Regards
Marcel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3] wireless: Supporting of IFLA_INFO_KIND rtnl attribute
2014-12-09 22:21 [PATCH v3] wireless: Supporting of IFLA_INFO_KIND rtnl attribute Vadim Kochan
2014-12-09 23:23 ` Marcel Holtmann
2014-12-10 20:36 ` Marcel Holtmann
@ 2014-12-12 12:43 ` Johannes Berg
2 siblings, 0 replies; 8+ messages in thread
From: Johannes Berg @ 2014-12-12 12:43 UTC (permalink / raw)
To: Vadim Kochan; +Cc: linux-wireless, linville
On Wed, 2014-12-10 at 00:21 +0200, Vadim Kochan wrote:
> It allows to identify the wlan kind of device for the user application,
Applied,
> +static struct rtnl_link_ops wireless_link_ops __read_mostly = {
> + .kind = "wlan",
> +};
but I've made this const. It only needs to be non-const (__read_mostly)
when used with rtnl_link_register() and friends.
johannes
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-12-12 12:43 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-09 22:21 [PATCH v3] wireless: Supporting of IFLA_INFO_KIND rtnl attribute Vadim Kochan
2014-12-09 23:23 ` Marcel Holtmann
2014-12-09 23:23 ` vadim4j
2014-12-10 8:04 ` Bastian Bittorf
2014-12-10 8:12 ` Johannes Berg
2014-12-10 20:35 ` Marcel Holtmann
2014-12-10 20:36 ` Marcel Holtmann
2014-12-12 12:43 ` Johannes Berg
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).