* [PATCH net-next 0/2] net: dsa: Implement ndo_get_phys_port_name()
@ 2017-01-10 20:32 Florian Fainelli
2017-01-10 20:32 ` [PATCH net-next 1/2] " Florian Fainelli
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Florian Fainelli @ 2017-01-10 20:32 UTC (permalink / raw)
To: netdev; +Cc: davem, vivien.didelot, andrew, jiri, Florian Fainelli
Hi all,
This patch series implements ndo_get_phys_port_name() so we can revert
ndo_get_phys_id() which was (ab)used in the DSA layer.
Thanks
Florian Fainelli (2):
net: dsa: Implement ndo_get_phys_port_name()
Revert "net: dsa: Implement ndo_get_phys_port_id"
net/dsa/slave.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
--
2.9.3
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH net-next 1/2] net: dsa: Implement ndo_get_phys_port_name()
2017-01-10 20:32 [PATCH net-next 0/2] net: dsa: Implement ndo_get_phys_port_name() Florian Fainelli
@ 2017-01-10 20:32 ` Florian Fainelli
2017-01-10 20:44 ` Vivien Didelot
` (2 more replies)
2017-01-10 20:32 ` [PATCH net-next 2/2] Revert "net: dsa: Implement ndo_get_phys_port_id" Florian Fainelli
2017-01-11 14:59 ` [PATCH net-next 0/2] net: dsa: Implement ndo_get_phys_port_name() David Miller
2 siblings, 3 replies; 12+ messages in thread
From: Florian Fainelli @ 2017-01-10 20:32 UTC (permalink / raw)
To: netdev; +Cc: davem, vivien.didelot, andrew, jiri, Florian Fainelli
Return the physical port number of a DSA created network device using
ndo_get_phys_port_name().
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
net/dsa/slave.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 5cd5b8137c08..fed3fbd403cb 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -990,6 +990,15 @@ static int dsa_slave_get_phys_port_id(struct net_device *dev,
ppid->id_len = sizeof(p->port);
memcpy(ppid->id, &p->port, ppid->id_len);
+}
+
+static int dsa_slave_get_phys_port_name(struct net_device *dev,
+ char *name, size_t len)
+{
+ struct dsa_slave_priv *p = netdev_priv(dev);
+
+ if (snprintf(name, len, "p%d", p->port) >= len)
+ return -EINVAL;
return 0;
}
@@ -1042,6 +1051,7 @@ static const struct net_device_ops dsa_slave_netdev_ops = {
.ndo_bridge_setlink = switchdev_port_bridge_setlink,
.ndo_bridge_dellink = switchdev_port_bridge_dellink,
.ndo_get_phys_port_id = dsa_slave_get_phys_port_id,
+ .ndo_get_phys_port_name = dsa_slave_get_phys_port_name,
};
static const struct switchdev_ops dsa_slave_switchdev_ops = {
--
2.9.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH net-next 2/2] Revert "net: dsa: Implement ndo_get_phys_port_id"
2017-01-10 20:32 [PATCH net-next 0/2] net: dsa: Implement ndo_get_phys_port_name() Florian Fainelli
2017-01-10 20:32 ` [PATCH net-next 1/2] " Florian Fainelli
@ 2017-01-10 20:32 ` Florian Fainelli
2017-01-10 20:44 ` Vivien Didelot
2017-01-11 7:29 ` Jiri Pirko
2017-01-11 14:59 ` [PATCH net-next 0/2] net: dsa: Implement ndo_get_phys_port_name() David Miller
2 siblings, 2 replies; 12+ messages in thread
From: Florian Fainelli @ 2017-01-10 20:32 UTC (permalink / raw)
To: netdev; +Cc: davem, vivien.didelot, andrew, jiri, Florian Fainelli
This reverts commit 3a543ef479868e36c95935de320608a7e41466ca ("net: dsa:
Implement ndo_get_phys_port_id") since it misuses the purpose of
ndo_get_phys_port_id(). We have ndo_get_phys_port_name() to do the
correct thing for us now.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
net/dsa/slave.c | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index fed3fbd403cb..0cdcaf526987 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -983,15 +983,6 @@ static void dsa_slave_poll_controller(struct net_device *dev)
}
#endif
-static int dsa_slave_get_phys_port_id(struct net_device *dev,
- struct netdev_phys_item_id *ppid)
-{
- struct dsa_slave_priv *p = netdev_priv(dev);
-
- ppid->id_len = sizeof(p->port);
- memcpy(ppid->id, &p->port, ppid->id_len);
-}
-
static int dsa_slave_get_phys_port_name(struct net_device *dev,
char *name, size_t len)
{
@@ -1050,7 +1041,6 @@ static const struct net_device_ops dsa_slave_netdev_ops = {
.ndo_bridge_getlink = switchdev_port_bridge_getlink,
.ndo_bridge_setlink = switchdev_port_bridge_setlink,
.ndo_bridge_dellink = switchdev_port_bridge_dellink,
- .ndo_get_phys_port_id = dsa_slave_get_phys_port_id,
.ndo_get_phys_port_name = dsa_slave_get_phys_port_name,
};
--
2.9.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH net-next 1/2] net: dsa: Implement ndo_get_phys_port_name()
2017-01-10 20:32 ` [PATCH net-next 1/2] " Florian Fainelli
@ 2017-01-10 20:44 ` Vivien Didelot
2017-01-10 20:50 ` Andrew Lunn
2017-01-11 7:29 ` Jiri Pirko
2 siblings, 0 replies; 12+ messages in thread
From: Vivien Didelot @ 2017-01-10 20:44 UTC (permalink / raw)
To: Florian Fainelli, netdev; +Cc: davem, andrew, jiri, Florian Fainelli
Hi Florian,
Florian Fainelli <f.fainelli@gmail.com> writes:
> Return the physical port number of a DSA created network device using
> ndo_get_phys_port_name().
>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Tested-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Thanks,
Vivien
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net-next 2/2] Revert "net: dsa: Implement ndo_get_phys_port_id"
2017-01-10 20:32 ` [PATCH net-next 2/2] Revert "net: dsa: Implement ndo_get_phys_port_id" Florian Fainelli
@ 2017-01-10 20:44 ` Vivien Didelot
2017-01-11 7:29 ` Jiri Pirko
1 sibling, 0 replies; 12+ messages in thread
From: Vivien Didelot @ 2017-01-10 20:44 UTC (permalink / raw)
To: Florian Fainelli, netdev; +Cc: davem, andrew, jiri, Florian Fainelli
Hi Florian,
Florian Fainelli <f.fainelli@gmail.com> writes:
> This reverts commit 3a543ef479868e36c95935de320608a7e41466ca ("net: dsa:
> Implement ndo_get_phys_port_id") since it misuses the purpose of
> ndo_get_phys_port_id(). We have ndo_get_phys_port_name() to do the
> correct thing for us now.
>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Thanks,
Vivien
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net-next 1/2] net: dsa: Implement ndo_get_phys_port_name()
2017-01-10 20:32 ` [PATCH net-next 1/2] " Florian Fainelli
2017-01-10 20:44 ` Vivien Didelot
@ 2017-01-10 20:50 ` Andrew Lunn
2017-01-10 20:58 ` Vivien Didelot
2017-01-10 20:58 ` Florian Fainelli
2017-01-11 7:29 ` Jiri Pirko
2 siblings, 2 replies; 12+ messages in thread
From: Andrew Lunn @ 2017-01-10 20:50 UTC (permalink / raw)
To: Florian Fainelli; +Cc: netdev, davem, vivien.didelot, jiri
On Tue, Jan 10, 2017 at 12:32:36PM -0800, Florian Fainelli wrote:
> Return the physical port number of a DSA created network device using
> ndo_get_phys_port_name().
At what level does this need to be unique?
We can have multiple switches within one switch cluster. p->port will
be unique within one switch, but can be repeated in a cluster.
We can also have multiple clusters, and again p->port will be re-used.
Andrew
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net-next 1/2] net: dsa: Implement ndo_get_phys_port_name()
2017-01-10 20:50 ` Andrew Lunn
@ 2017-01-10 20:58 ` Vivien Didelot
2017-01-10 20:58 ` Florian Fainelli
1 sibling, 0 replies; 12+ messages in thread
From: Vivien Didelot @ 2017-01-10 20:58 UTC (permalink / raw)
To: Andrew Lunn, Florian Fainelli; +Cc: netdev, davem, jiri
Hi Andrew,
Andrew Lunn <andrew@lunn.ch> writes:
> On Tue, Jan 10, 2017 at 12:32:36PM -0800, Florian Fainelli wrote:
>> Return the physical port number of a DSA created network device using
>> ndo_get_phys_port_name().
>
> At what level does this need to be unique?
The port name must be unique at the switch Linux device level.
Thanks,
Vivien
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net-next 1/2] net: dsa: Implement ndo_get_phys_port_name()
2017-01-10 20:50 ` Andrew Lunn
2017-01-10 20:58 ` Vivien Didelot
@ 2017-01-10 20:58 ` Florian Fainelli
2017-01-11 7:28 ` Jiri Pirko
1 sibling, 1 reply; 12+ messages in thread
From: Florian Fainelli @ 2017-01-10 20:58 UTC (permalink / raw)
To: Andrew Lunn; +Cc: netdev, davem, vivien.didelot, jiri
On 01/10/2017 12:50 PM, Andrew Lunn wrote:
> On Tue, Jan 10, 2017 at 12:32:36PM -0800, Florian Fainelli wrote:
>> Return the physical port number of a DSA created network device using
>> ndo_get_phys_port_name().
>
> At what level does this need to be unique?
This needs to be unique to the switch I would say,
ndo_get_phys_switch_id would return the physical number of the switch
device in the tree/cluster, so that number plus the port name should be
an unique differentiator that is good enough for e.g: a persistent
naming rule?
>
> We can have multiple switches within one switch cluster. p->port will
> be unique within one switch, but can be repeated in a cluster.
>
> We can also have multiple clusters, and again p->port will be re-used.
--
Florian
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net-next 1/2] net: dsa: Implement ndo_get_phys_port_name()
2017-01-10 20:58 ` Florian Fainelli
@ 2017-01-11 7:28 ` Jiri Pirko
0 siblings, 0 replies; 12+ messages in thread
From: Jiri Pirko @ 2017-01-11 7:28 UTC (permalink / raw)
To: Florian Fainelli; +Cc: Andrew Lunn, netdev, davem, vivien.didelot
Tue, Jan 10, 2017 at 09:58:53PM CET, f.fainelli@gmail.com wrote:
>On 01/10/2017 12:50 PM, Andrew Lunn wrote:
>> On Tue, Jan 10, 2017 at 12:32:36PM -0800, Florian Fainelli wrote:
>>> Return the physical port number of a DSA created network device using
>>> ndo_get_phys_port_name().
>>
>> At what level does this need to be unique?
>
>This needs to be unique to the switch I would say,
Yes.
>ndo_get_phys_switch_id would return the physical number of the switch
>device in the tree/cluster, so that number plus the port name should be
>an unique differentiator that is good enough for e.g: a persistent
>naming rule?
Yes.
>
>>
>> We can have multiple switches within one switch cluster. p->port will
>> be unique within one switch, but can be repeated in a cluster.
>>
>> We can also have multiple clusters, and again p->port will be re-used.
>
>
>--
>Florian
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net-next 1/2] net: dsa: Implement ndo_get_phys_port_name()
2017-01-10 20:32 ` [PATCH net-next 1/2] " Florian Fainelli
2017-01-10 20:44 ` Vivien Didelot
2017-01-10 20:50 ` Andrew Lunn
@ 2017-01-11 7:29 ` Jiri Pirko
2 siblings, 0 replies; 12+ messages in thread
From: Jiri Pirko @ 2017-01-11 7:29 UTC (permalink / raw)
To: Florian Fainelli; +Cc: netdev, davem, vivien.didelot, andrew
Tue, Jan 10, 2017 at 09:32:36PM CET, f.fainelli@gmail.com wrote:
>Return the physical port number of a DSA created network device using
>ndo_get_phys_port_name().
>
>Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
>---
> net/dsa/slave.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
>diff --git a/net/dsa/slave.c b/net/dsa/slave.c
>index 5cd5b8137c08..fed3fbd403cb 100644
>--- a/net/dsa/slave.c
>+++ b/net/dsa/slave.c
>@@ -990,6 +990,15 @@ static int dsa_slave_get_phys_port_id(struct net_device *dev,
>
> ppid->id_len = sizeof(p->port);
> memcpy(ppid->id, &p->port, ppid->id_len);
>+}
>+
>+static int dsa_slave_get_phys_port_name(struct net_device *dev,
>+ char *name, size_t len)
>+{
>+ struct dsa_slave_priv *p = netdev_priv(dev);
>+
>+ if (snprintf(name, len, "p%d", p->port) >= len)
>+ return -EINVAL;
>
> return 0;
> }
>@@ -1042,6 +1051,7 @@ static const struct net_device_ops dsa_slave_netdev_ops = {
> .ndo_bridge_setlink = switchdev_port_bridge_setlink,
> .ndo_bridge_dellink = switchdev_port_bridge_dellink,
> .ndo_get_phys_port_id = dsa_slave_get_phys_port_id,
>+ .ndo_get_phys_port_name = dsa_slave_get_phys_port_name,
> };
>
> static const struct switchdev_ops dsa_slave_switchdev_ops = {
>--
>2.9.3
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net-next 2/2] Revert "net: dsa: Implement ndo_get_phys_port_id"
2017-01-10 20:32 ` [PATCH net-next 2/2] Revert "net: dsa: Implement ndo_get_phys_port_id" Florian Fainelli
2017-01-10 20:44 ` Vivien Didelot
@ 2017-01-11 7:29 ` Jiri Pirko
1 sibling, 0 replies; 12+ messages in thread
From: Jiri Pirko @ 2017-01-11 7:29 UTC (permalink / raw)
To: Florian Fainelli; +Cc: netdev, davem, vivien.didelot, andrew
Tue, Jan 10, 2017 at 09:32:37PM CET, f.fainelli@gmail.com wrote:
>This reverts commit 3a543ef479868e36c95935de320608a7e41466ca ("net: dsa:
>Implement ndo_get_phys_port_id") since it misuses the purpose of
>ndo_get_phys_port_id(). We have ndo_get_phys_port_name() to do the
>correct thing for us now.
>
>Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
>---
> net/dsa/slave.c | 10 ----------
> 1 file changed, 10 deletions(-)
>
>diff --git a/net/dsa/slave.c b/net/dsa/slave.c
>index fed3fbd403cb..0cdcaf526987 100644
>--- a/net/dsa/slave.c
>+++ b/net/dsa/slave.c
>@@ -983,15 +983,6 @@ static void dsa_slave_poll_controller(struct net_device *dev)
> }
> #endif
>
>-static int dsa_slave_get_phys_port_id(struct net_device *dev,
>- struct netdev_phys_item_id *ppid)
>-{
>- struct dsa_slave_priv *p = netdev_priv(dev);
>-
>- ppid->id_len = sizeof(p->port);
>- memcpy(ppid->id, &p->port, ppid->id_len);
>-}
>-
> static int dsa_slave_get_phys_port_name(struct net_device *dev,
> char *name, size_t len)
> {
>@@ -1050,7 +1041,6 @@ static const struct net_device_ops dsa_slave_netdev_ops = {
> .ndo_bridge_getlink = switchdev_port_bridge_getlink,
> .ndo_bridge_setlink = switchdev_port_bridge_setlink,
> .ndo_bridge_dellink = switchdev_port_bridge_dellink,
>- .ndo_get_phys_port_id = dsa_slave_get_phys_port_id,
> .ndo_get_phys_port_name = dsa_slave_get_phys_port_name,
> };
>
>--
>2.9.3
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net-next 0/2] net: dsa: Implement ndo_get_phys_port_name()
2017-01-10 20:32 [PATCH net-next 0/2] net: dsa: Implement ndo_get_phys_port_name() Florian Fainelli
2017-01-10 20:32 ` [PATCH net-next 1/2] " Florian Fainelli
2017-01-10 20:32 ` [PATCH net-next 2/2] Revert "net: dsa: Implement ndo_get_phys_port_id" Florian Fainelli
@ 2017-01-11 14:59 ` David Miller
2 siblings, 0 replies; 12+ messages in thread
From: David Miller @ 2017-01-11 14:59 UTC (permalink / raw)
To: f.fainelli; +Cc: netdev, vivien.didelot, andrew, jiri
From: Florian Fainelli <f.fainelli@gmail.com>
Date: Tue, 10 Jan 2017 12:32:35 -0800
> This patch series implements ndo_get_phys_port_name() so we can revert
> ndo_get_phys_id() which was (ab)used in the DSA layer.
Series applied, thanks Florian.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2017-01-11 14:59 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-10 20:32 [PATCH net-next 0/2] net: dsa: Implement ndo_get_phys_port_name() Florian Fainelli
2017-01-10 20:32 ` [PATCH net-next 1/2] " Florian Fainelli
2017-01-10 20:44 ` Vivien Didelot
2017-01-10 20:50 ` Andrew Lunn
2017-01-10 20:58 ` Vivien Didelot
2017-01-10 20:58 ` Florian Fainelli
2017-01-11 7:28 ` Jiri Pirko
2017-01-11 7:29 ` Jiri Pirko
2017-01-10 20:32 ` [PATCH net-next 2/2] Revert "net: dsa: Implement ndo_get_phys_port_id" Florian Fainelli
2017-01-10 20:44 ` Vivien Didelot
2017-01-11 7:29 ` Jiri Pirko
2017-01-11 14:59 ` [PATCH net-next 0/2] net: dsa: Implement ndo_get_phys_port_name() David Miller
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).