All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: dsa: Set a "dsa" device_type
@ 2015-09-24  1:19 Florian Fainelli
  2015-09-24 22:37 ` Vivien Didelot
  2015-09-25 19:25 ` David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Florian Fainelli @ 2015-09-24  1:19 UTC (permalink / raw)
  To: netdev; +Cc: Florian Fainelli, vivien.didelot, linux, andrew

Provide a device_type information for slave network devices created by
DSA, this is useful for user-space application to easily locate/search
for devices of a specific kind.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 net/dsa/slave.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index cce97385f743..40f9e369dc8e 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -962,6 +962,10 @@ static const struct switchdev_ops dsa_slave_switchdev_ops = {
 	.switchdev_port_obj_dump	= dsa_slave_port_obj_dump,
 };
 
+static struct device_type dsa_type = {
+	.name	= "dsa",
+};
+
 static void dsa_slave_adjust_link(struct net_device *dev)
 {
 	struct dsa_slave_priv *p = netdev_priv(dev);
@@ -1150,6 +1154,7 @@ int dsa_slave_create(struct dsa_switch *ds, struct device *parent,
 	slave_dev->priv_flags |= IFF_NO_QUEUE;
 	slave_dev->netdev_ops = &dsa_slave_netdev_ops;
 	slave_dev->switchdev_ops = &dsa_slave_switchdev_ops;
+	SET_NETDEV_DEVTYPE(slave_dev, &dsa_type);
 
 	netdev_for_each_tx_queue(slave_dev, dsa_slave_set_lockdep_class_one,
 				 NULL);
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] net: dsa: Set a "dsa" device_type
  2015-09-24  1:19 [PATCH net-next] net: dsa: Set a "dsa" device_type Florian Fainelli
@ 2015-09-24 22:37 ` Vivien Didelot
  2015-09-25  0:28   ` Florian Fainelli
  2015-09-25 19:25 ` David Miller
  1 sibling, 1 reply; 5+ messages in thread
From: Vivien Didelot @ 2015-09-24 22:37 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: netdev, linux, andrew

Hi Florian,

On Sep. Wednesday 23 (39) 06:19 PM, Florian Fainelli wrote:
> Provide a device_type information for slave network devices created by
> DSA, this is useful for user-space application to easily locate/search
> for devices of a specific kind.
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Noob question, how is that used from user-space?

Also, don't you think that this "dsa" device type might be conflicting
with eventually exposed DSA ports? Or will they all get the same type?

Thanks,
-v

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] net: dsa: Set a "dsa" device_type
  2015-09-24 22:37 ` Vivien Didelot
@ 2015-09-25  0:28   ` Florian Fainelli
  2015-09-25  3:37     ` Vivien Didelot
  0 siblings, 1 reply; 5+ messages in thread
From: Florian Fainelli @ 2015-09-25  0:28 UTC (permalink / raw)
  To: Vivien Didelot; +Cc: netdev, linux, andrew

On 24/09/15 15:37, Vivien Didelot wrote:
> Hi Florian,
> 
> On Sep. Wednesday 23 (39) 06:19 PM, Florian Fainelli wrote:
>> Provide a device_type information for slave network devices created by
>> DSA, this is useful for user-space application to easily locate/search
>> for devices of a specific kind.
>>
>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> 
> Noob question, how is that used from user-space?

This changes the 'uevent' attribute, before, it would look like this:

cat /sys/class/net/gphy/uevent
OF_NAME=port
OF_FULLNAME=/rdb/switch_top@f0b00000/ethernet_switch@0/switch@0/port@0
OF_COMPATIBLE_N=0
OF_ALIAS_0=switch_port0
INTERFACE=gphy
IFINDEX=3
#

With that change it looks like this:

# cat /sys/class/net/gphy/uevent
DEVTYPE=dsa
OF_NAME=port
OF_FULLNAME=/rdb/switch_top@f0b00000/ethernet_switch@0/switch@0/port@0
OF_COMPATIBLE_N=0
OF_ALIAS_0=switch_port0
INTERFACE=gphy
IFINDEX=3

VLAN does a similar thing:

DEVTYPE=vlan
INTERFACE=eth0.2
IFINDEX=14

> 
> Also, don't you think that this "dsa" device type might be conflicting
> with eventually exposed DSA ports? Or will they all get the same type?

Well, as of today these ports are not exposed, it is unclear to me
whether they would be real network devices (with an actual struct device
backing them), and we may want to dedicate a specific DEVTYPE like
"dsa-pseudo-port" or something like that, specifically for these devices.

Hope this clarifies the intent and usefulness of the patch.
-- 
Florian

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] net: dsa: Set a "dsa" device_type
  2015-09-25  0:28   ` Florian Fainelli
@ 2015-09-25  3:37     ` Vivien Didelot
  0 siblings, 0 replies; 5+ messages in thread
From: Vivien Didelot @ 2015-09-25  3:37 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: netdev, linux, andrew

On Sep. Thursday 24 (39) 05:28 PM, Florian Fainelli wrote:
> On 24/09/15 15:37, Vivien Didelot wrote:
> > Hi Florian,
> > 
> > On Sep. Wednesday 23 (39) 06:19 PM, Florian Fainelli wrote:
> >> Provide a device_type information for slave network devices created by
> >> DSA, this is useful for user-space application to easily locate/search
> >> for devices of a specific kind.
> >>
> >> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>

> > 
> > Noob question, how is that used from user-space?
> 
> This changes the 'uevent' attribute, before, it would look like this:
> 
> cat /sys/class/net/gphy/uevent
> OF_NAME=port
> OF_FULLNAME=/rdb/switch_top@f0b00000/ethernet_switch@0/switch@0/port@0
> OF_COMPATIBLE_N=0
> OF_ALIAS_0=switch_port0
> INTERFACE=gphy
> IFINDEX=3
> #
> 
> With that change it looks like this:
> 
> # cat /sys/class/net/gphy/uevent
> DEVTYPE=dsa
> OF_NAME=port
> OF_FULLNAME=/rdb/switch_top@f0b00000/ethernet_switch@0/switch@0/port@0
> OF_COMPATIBLE_N=0
> OF_ALIAS_0=switch_port0
> INTERFACE=gphy
> IFINDEX=3
> 
> VLAN does a similar thing:
> 
> DEVTYPE=vlan
> INTERFACE=eth0.2
> IFINDEX=14
> 
> > 
> > Also, don't you think that this "dsa" device type might be conflicting
> > with eventually exposed DSA ports? Or will they all get the same type?
> 
> Well, as of today these ports are not exposed, it is unclear to me
> whether they would be real network devices (with an actual struct device
> backing them), and we may want to dedicate a specific DEVTYPE like
> "dsa-pseudo-port" or something like that, specifically for these devices.
> 
> Hope this clarifies the intent and usefulness of the patch.

Yes it does, thanks! I don't have the usage for this (yet?) but it looks
good anyway.

I hope it's ok to put the Reviewed-by: tag here, otherwise I'll reply to
the first message.

-v

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] net: dsa: Set a "dsa" device_type
  2015-09-24  1:19 [PATCH net-next] net: dsa: Set a "dsa" device_type Florian Fainelli
  2015-09-24 22:37 ` Vivien Didelot
@ 2015-09-25 19:25 ` David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2015-09-25 19:25 UTC (permalink / raw)
  To: f.fainelli; +Cc: netdev, vivien.didelot, linux, andrew

From: Florian Fainelli <f.fainelli@gmail.com>
Date: Wed, 23 Sep 2015 18:19:58 -0700

> Provide a device_type information for slave network devices created by
> DSA, this is useful for user-space application to easily locate/search
> for devices of a specific kind.
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Applied, thanks Florian.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-09-25 19:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-24  1:19 [PATCH net-next] net: dsa: Set a "dsa" device_type Florian Fainelli
2015-09-24 22:37 ` Vivien Didelot
2015-09-25  0:28   ` Florian Fainelli
2015-09-25  3:37     ` Vivien Didelot
2015-09-25 19:25 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.