Re: [PATCH net-next 5/5] net: dsa: split dsa_port's netdev member

2017-10-12 Thread Vivien Didelot
Hi Florian, Florian Fainelli writes: > On 10/12/2017 03:51 PM, Vivien Didelot wrote: >> The dsa_port structure has a "netdev" member, which can be used for >> either the master device, or the slave device, depending on its type. >> >> It is true

[PATCH net-next 5/5] net: dsa: split dsa_port's netdev member

2017-10-12 Thread Vivien Didelot
t is still slightly confusing, so split it into more explicit "master" and "slave" members. Signed-off-by: Vivien Didelot <vivien.dide...@savoirfairelinux.com> --- drivers/net/dsa/bcm_sf2.c| 6 +++--- drivers/net/dsa/mt7530.c | 2 +- drivers/net/dsa/mv88e6x

[PATCH net-next 5/5] net: dsa: split dsa_port's netdev member

2017-10-12 Thread Vivien Didelot
t is still slightly confusing, so split it into more explicit "master" and "slave" members. Signed-off-by: Vivien Didelot --- drivers/net/dsa/bcm_sf2.c| 6 +++--- drivers/net/dsa/mt7530.c | 2 +- drivers/net/dsa/mv88e6xxx/chip.c | 2 +- include/net/dsa.h

[PATCH net-next 3/5] net: dsa: add slave to port helper

2017-10-12 Thread Vivien Didelot
Many portions of DSA core code require to get the dsa_port structure corresponding to a slave net_device. For this purpose, introduce a dsa_slave_to_port() helper. Signed-off-by: Vivien Didelot <vivien.dide...@savoirfairelinux.com> --- net/dsa/dsa_priv.h| 7 +++ net/dsa/legacy.c

[PATCH net-next 0/5] net: dsa: master and slave helpers

2017-10-12 Thread Vivien Didelot
members to avoid confusion, even though it is not planned to create a slave for DSA or CPU ports for the moment. Vivien Didelot (5): net: dsa: use port's cpu_dp when creating a slave net: dsa: add slave notify helper net: dsa: add slave to port helper net: dsa: add slave get master helper net

[PATCH net-next 3/5] net: dsa: add slave to port helper

2017-10-12 Thread Vivien Didelot
Many portions of DSA core code require to get the dsa_port structure corresponding to a slave net_device. For this purpose, introduce a dsa_slave_to_port() helper. Signed-off-by: Vivien Didelot --- net/dsa/dsa_priv.h| 7 +++ net/dsa/legacy.c | 6 +- net/dsa/slave.c | 167

[PATCH net-next 0/5] net: dsa: master and slave helpers

2017-10-12 Thread Vivien Didelot
members to avoid confusion, even though it is not planned to create a slave for DSA or CPU ports for the moment. Vivien Didelot (5): net: dsa: use port's cpu_dp when creating a slave net: dsa: add slave notify helper net: dsa: add slave to port helper net: dsa: add slave get master helper net

[PATCH net-next 1/5] net: dsa: use port's cpu_dp when creating a slave

2017-10-12 Thread Vivien Didelot
When dsa_slave_create is called, the related port already has a CPU port assigned to it, available in its cpu_dp member. Use it instead of the unique tree cpu_dp. Signed-off-by: Vivien Didelot <vivien.dide...@savoirfairelinux.com> --- net/dsa/slave.c | 7 ++- 1 file changed, 2 inse

[PATCH net-next 1/5] net: dsa: use port's cpu_dp when creating a slave

2017-10-12 Thread Vivien Didelot
When dsa_slave_create is called, the related port already has a CPU port assigned to it, available in its cpu_dp member. Use it instead of the unique tree cpu_dp. Signed-off-by: Vivien Didelot --- net/dsa/slave.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/net/dsa

[PATCH net-next 2/5] net: dsa: add slave notify helper

2017-10-12 Thread Vivien Didelot
Both DSA slave create and destroy functions call call_dsa_notifiers with respectively DSA_PORT_REGISTER and DSA_PORT_UNREGISTER and the same dsa_notifier_register_info structure. Wrap this in a dsa_slave_notify helper so prevent cluttering these functions. Signed-off-by: Vivien Didelot

[PATCH net-next 4/5] net: dsa: add slave get master helper

2017-10-12 Thread Vivien Didelot
Many part of the DSA slave code require to get the master device assigned to a slave device. Remove dsa_master_netdev() in favor of a dsa_slave_get_master() helper which does that. Signed-off-by: Vivien Didelot <vivien.dide...@savoirfairelinux.com> --- net/dsa/dsa_priv.h | 13

[PATCH net-next 2/5] net: dsa: add slave notify helper

2017-10-12 Thread Vivien Didelot
Both DSA slave create and destroy functions call call_dsa_notifiers with respectively DSA_PORT_REGISTER and DSA_PORT_UNREGISTER and the same dsa_notifier_register_info structure. Wrap this in a dsa_slave_notify helper so prevent cluttering these functions. Signed-off-by: Vivien Didelot --- net

[PATCH net-next 4/5] net: dsa: add slave get master helper

2017-10-12 Thread Vivien Didelot
Many part of the DSA slave code require to get the master device assigned to a slave device. Remove dsa_master_netdev() in favor of a dsa_slave_get_master() helper which does that. Signed-off-by: Vivien Didelot --- net/dsa/dsa_priv.h | 13 - net/dsa/slave.c| 26

Re: [PATCH net-next] net: dsa: set random switch address

2017-10-12 Thread Vivien Didelot
Hi Florian, Florian Fainelli <f.faine...@gmail.com> writes: > On 10/12/2017 03:10 PM, Vivien Didelot wrote: >> An Ethernet switch may support having a MAC address, which can be used >> as the switch's source address in transmitted full-duplex Pause frames. >>

Re: [PATCH net-next] net: dsa: set random switch address

2017-10-12 Thread Vivien Didelot
Hi Florian, Florian Fainelli writes: > On 10/12/2017 03:10 PM, Vivien Didelot wrote: >> An Ethernet switch may support having a MAC address, which can be used >> as the switch's source address in transmitted full-duplex Pause frames. >> >> If a DSA switch sup

[PATCH net-next] net: dsa: set random switch address

2017-10-12 Thread Vivien Didelot
in a multi-CPU ports system, because there won't be a unique master device assigned to a switch tree. To fix this, assign a random MAC address to the switch chip instead. Signed-off-by: Vivien Didelot <vivien.dide...@savoirfairelinux.com> --- net/dsa/dsa2.c | 8 +++- net/dsa/dsa_priv.

[PATCH net-next] net: dsa: set random switch address

2017-10-12 Thread Vivien Didelot
in a multi-CPU ports system, because there won't be a unique master device assigned to a switch tree. To fix this, assign a random MAC address to the switch chip instead. Signed-off-by: Vivien Didelot --- net/dsa/dsa2.c | 8 +++- net/dsa/dsa_priv.h | 1 + net/dsa/legacy.c | 8 +++- net

Re: [PATCH v2 net-next 1/2] net: dsa: lan9303: Move tag setup to new lan9303_setup_tagging

2017-10-10 Thread Vivien Didelot
Hi Egil, Egil Hjelmeland writes: >>> + val = LAN9303_BM_EGRSS_PORT_TYPE_SPECIAL_TAG_PORT0; >>> + return lan9303_write_switch_reg(chip, >>> LAN9303_BM_EGRSS_PORT_TYPE, val); >> Specific reason to use val then using >> LAN9303_BM_EGRSS_PORT_TYPE_SPECIAL_TAG_PORT0

Re: [PATCH v2 net-next 1/2] net: dsa: lan9303: Move tag setup to new lan9303_setup_tagging

2017-10-10 Thread Vivien Didelot
Hi Egil, Egil Hjelmeland writes: >>> + val = LAN9303_BM_EGRSS_PORT_TYPE_SPECIAL_TAG_PORT0; >>> + return lan9303_write_switch_reg(chip, >>> LAN9303_BM_EGRSS_PORT_TYPE, val); >> Specific reason to use val then using >> LAN9303_BM_EGRSS_PORT_TYPE_SPECIAL_TAG_PORT0 >> like previous line? >> >

[PATCH net-next v2 1/7] net: dsa: add master helper to look up slaves

2017-09-29 Thread Vivien Didelot
, provide an inline dsa_master_get_slave helper which validates the device and port indexes and look up the slave device. This makes the tagging rcv functions more concise and robust, and also makes dsa_get_cpu_port obsolete. Signed-off-by: Vivien Didelot <vivien.dide...@savoirfairelinux.com> --

[PATCH net-next v2 1/7] net: dsa: add master helper to look up slaves

2017-09-29 Thread Vivien Didelot
, provide an inline dsa_master_get_slave helper which validates the device and port indexes and look up the slave device. This makes the tagging rcv functions more concise and robust, and also makes dsa_get_cpu_port obsolete. Signed-off-by: Vivien Didelot --- net/dsa/dsa_priv.h| 24

[PATCH net-next v2 6/7] net: dsa: change dsa_ptr for a dsa_port

2017-09-29 Thread Vivien Didelot
switch fabric. Change the master interface's dsa_ptr for the CPU dsa_port pointer. This is a step towards supporting multiple CPU ports. Signed-off-by: Vivien Didelot <vivien.dide...@savoirfairelinux.com> --- include/linux/netdevice.h | 4 ++-- net/dsa/dsa.c | 6 +++--- n

[PATCH net-next v2 6/7] net: dsa: change dsa_ptr for a dsa_port

2017-09-29 Thread Vivien Didelot
switch fabric. Change the master interface's dsa_ptr for the CPU dsa_port pointer. This is a step towards supporting multiple CPU ports. Signed-off-by: Vivien Didelot --- include/linux/netdevice.h | 4 ++-- net/dsa/dsa.c | 6 +++--- net/dsa/dsa2.c| 2 +- net/dsa

[PATCH net-next v2 7/7] net: dsa: remove tag ops from the switch tree

2017-09-29 Thread Vivien Didelot
Now that the dsa_ptr is a dsa_port instance, there is no need to keep the tag operations in the dsa_switch_tree structure. Remove it. Signed-off-by: Vivien Didelot <vivien.dide...@savoirfairelinux.com> Reviewed-by: Florian Fainelli <f.faine...@gmail.com> --- include/ne

[PATCH net-next v2 0/7] net: dsa: change dsa_ptr for a dsa_port

2017-09-29 Thread Vivien Didelot
patches prepare the xmit and receive hot paths and finally change dsa_ptr. Changes in v2: - introduce dsa_master_get_slave helper to simplify patch 6 - keep hot path data at beginning of dsa_port for cacheline 1 Vivien Didelot (7): net: dsa: add master helper to look up slaves net: dsa: use

[PATCH net-next v2 7/7] net: dsa: remove tag ops from the switch tree

2017-09-29 Thread Vivien Didelot
Now that the dsa_ptr is a dsa_port instance, there is no need to keep the tag operations in the dsa_switch_tree structure. Remove it. Signed-off-by: Vivien Didelot Reviewed-by: Florian Fainelli --- include/net/dsa.h | 11 --- net/dsa/dsa2.c| 2 -- net/dsa/legacy.c | 2 -- 3

[PATCH net-next v2 0/7] net: dsa: change dsa_ptr for a dsa_port

2017-09-29 Thread Vivien Didelot
patches prepare the xmit and receive hot paths and finally change dsa_ptr. Changes in v2: - introduce dsa_master_get_slave helper to simplify patch 6 - keep hot path data at beginning of dsa_port for cacheline 1 Vivien Didelot (7): net: dsa: add master helper to look up slaves net: dsa: use

[PATCH net-next v2 5/7] net: dsa: prepare master receive hot path

2017-09-29 Thread Vivien Didelot
they are available in cacheline 1. Signed-off-by: Vivien Didelot <vivien.dide...@savoirfairelinux.com> --- include/net/dsa.h | 5 + net/dsa/dsa2.c| 4 net/dsa/legacy.c | 4 3 files changed, 13 insertions(+) diff --git a/include/net/dsa.h b/include/net/dsa.h index 4d1df2

[PATCH net-next v2 5/7] net: dsa: prepare master receive hot path

2017-09-29 Thread Vivien Didelot
they are available in cacheline 1. Signed-off-by: Vivien Didelot --- include/net/dsa.h | 5 + net/dsa/dsa2.c| 4 net/dsa/legacy.c | 4 3 files changed, 13 insertions(+) diff --git a/include/net/dsa.h b/include/net/dsa.h index 4d1df2f086e8..6bda01fa5747 100644 --- a/include/net

[PATCH net-next v2 3/7] net: dsa: use temporary dsa_device_ops variable

2017-09-29 Thread Vivien Didelot
When resolving the DSA tagging protocol used by a CPU switch, use a temporary "tag_ops" variable to store the dsa_device_ops instead of using directly dst->tag_ops. This will make the future patches moving this pointer around easier to read. There is no functional changes. Signed-o

[PATCH net-next v2 3/7] net: dsa: use temporary dsa_device_ops variable

2017-09-29 Thread Vivien Didelot
When resolving the DSA tagging protocol used by a CPU switch, use a temporary "tag_ops" variable to store the dsa_device_ops instead of using directly dst->tag_ops. This will make the future patches moving this pointer around easier to read. There is no functional changes. Signed-o

[PATCH net-next v2 4/7] net: dsa: add tagging ops to port

2017-09-29 Thread Vivien Didelot
ops at the beginning of the dsa_port structure so that we ensure copies for hot path are in cacheline 1. Signed-off-by: Vivien Didelot <vivien.dide...@savoirfairelinux.com> --- include/net/dsa.h | 3 +++ net/dsa/dsa2.c | 1 + net/dsa/dsa_priv.h | 2 +- net/dsa/legacy.c | 1 + net/dsa/slave

[PATCH net-next v2 2/7] net: dsa: use cpu_dp in master code

2017-09-29 Thread Vivien Didelot
re patch touching dsa_ptr more readable. There is no functional changes. Signed-off-by: Vivien Didelot <vivien.dide...@savoirfairelinux.com> Reviewed-by: Florian Fainelli <f.faine...@gmail.com> --- net/dsa/master.c | 42 ++ 1 file changed, 22 insertions

[PATCH net-next v2 4/7] net: dsa: add tagging ops to port

2017-09-29 Thread Vivien Didelot
ops at the beginning of the dsa_port structure so that we ensure copies for hot path are in cacheline 1. Signed-off-by: Vivien Didelot --- include/net/dsa.h | 3 +++ net/dsa/dsa2.c | 1 + net/dsa/dsa_priv.h | 2 +- net/dsa/legacy.c | 1 + net/dsa/slave.c| 3 +-- 5 files changed, 7 inserti

[PATCH net-next v2 2/7] net: dsa: use cpu_dp in master code

2017-09-29 Thread Vivien Didelot
re patch touching dsa_ptr more readable. There is no functional changes. Signed-off-by: Vivien Didelot Reviewed-by: Florian Fainelli --- net/dsa/master.c | 42 ++ 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/net/dsa/master.c b/net/d

Re: [PATCH net-next 0/8] net: dsa: change dsa_ptr for a dsa_port

2017-09-29 Thread Vivien Didelot
Hi Florian, Florian Fainelli <f.faine...@gmail.com> writes: > On 09/29/2017 11:36 AM, Vivien Didelot wrote: >> With DSA, a master net_device is physically wired to a dedicated CPU >> switch port. For interaction with the DSA layer, the struct net_device >> contains

Re: [PATCH net-next 0/8] net: dsa: change dsa_ptr for a dsa_port

2017-09-29 Thread Vivien Didelot
Hi Florian, Florian Fainelli writes: > On 09/29/2017 11:36 AM, Vivien Didelot wrote: >> With DSA, a master net_device is physically wired to a dedicated CPU >> switch port. For interaction with the DSA layer, the struct net_device >> contains a dsa_ptr, w

Re: [PATCH net-next 2/8] net: dsa: directly fetch switch in lan9303_rcv

2017-09-29 Thread Vivien Didelot
Hi Florian, Florian Fainelli writes: >> @@ -72,11 +72,10 @@ static struct sk_buff *lan9303_rcv(struct sk_buff *skb, >> struct net_device *dev, >> { >> u16 *lan9303_tag; >> struct dsa_switch_tree *dst = dev->dsa_ptr; >> -struct dsa_switch *ds; >> +struct

Re: [PATCH net-next 2/8] net: dsa: directly fetch switch in lan9303_rcv

2017-09-29 Thread Vivien Didelot
Hi Florian, Florian Fainelli writes: >> @@ -72,11 +72,10 @@ static struct sk_buff *lan9303_rcv(struct sk_buff *skb, >> struct net_device *dev, >> { >> u16 *lan9303_tag; >> struct dsa_switch_tree *dst = dev->dsa_ptr; >> -struct dsa_switch *ds; >> +struct dsa_port *cpu_dp =

[PATCH net-next 5/8] net: dsa: add tagging ops to port

2017-09-29 Thread Vivien Didelot
The DSA tagging protocol operations are specific to each CPU port, thus the dsa_device_ops pointer belongs to the dsa_port structure. >From now on assign a slave's xmit copy from its CPU port tagging operations. This will ease the future support for multiple CPU ports. Signed-off-by: Viv

[PATCH net-next 0/8] net: dsa: change dsa_ptr for a dsa_port

2017-09-29 Thread Vivien Didelot
paths and finally change dsa_ptr. Vivien Didelot (8): net: dsa: directly fetch switch in mtk_tag_rcv net: dsa: directly fetch switch in lan9303_rcv net: dsa: use cpu_dp in master code net: dsa: use temporary dsa_device_ops variable net: dsa: add tagging ops to port net: dsa: prepare

[PATCH net-next 8/8] net: dsa: remove tag ops from the switch tree

2017-09-29 Thread Vivien Didelot
Now that the dsa_ptr is a dsa_port instance, there is no need to keep the tag operations in the dsa_switch_tree structure. Remove it. Signed-off-by: Vivien Didelot <vivien.dide...@savoirfairelinux.com> --- include/net/dsa.h | 11 --- net/dsa/dsa2.c| 2 -- net/dsa/legacy.c

[PATCH net-next 0/8] net: dsa: change dsa_ptr for a dsa_port

2017-09-29 Thread Vivien Didelot
paths and finally change dsa_ptr. Vivien Didelot (8): net: dsa: directly fetch switch in mtk_tag_rcv net: dsa: directly fetch switch in lan9303_rcv net: dsa: use cpu_dp in master code net: dsa: use temporary dsa_device_ops variable net: dsa: add tagging ops to port net: dsa: prepare

[PATCH net-next 8/8] net: dsa: remove tag ops from the switch tree

2017-09-29 Thread Vivien Didelot
Now that the dsa_ptr is a dsa_port instance, there is no need to keep the tag operations in the dsa_switch_tree structure. Remove it. Signed-off-by: Vivien Didelot --- include/net/dsa.h | 11 --- net/dsa/dsa2.c| 2 -- net/dsa/legacy.c | 2 -- 3 files changed, 15 deletions

[PATCH net-next 5/8] net: dsa: add tagging ops to port

2017-09-29 Thread Vivien Didelot
The DSA tagging protocol operations are specific to each CPU port, thus the dsa_device_ops pointer belongs to the dsa_port structure. >From now on assign a slave's xmit copy from its CPU port tagging operations. This will ease the future support for multiple CPU ports. Signed-off-by: Viv

[PATCH net-next 6/8] net: dsa: prepare master receive hot path

2017-09-29 Thread Vivien Didelot
In preparation to make DSA master devices point to their corresponding CPU port instead of the whole tree, add copies of dst and rcv in the dsa_port structure so that we keep fast access in the receive hot path. Signed-off-by: Vivien Didelot <vivien.dide...@savoirfairelinux.com> --- inclu

[PATCH net-next 7/8] net: dsa: change dsa_ptr for a dsa_port

2017-09-29 Thread Vivien Didelot
switch fabric. Change the master interface's dsa_ptr for the CPU dsa_port pointer. This is a step towards supporting multiple CPU ports. Also remove dsa_get_cpu_port which is now unneeded. Signed-off-by: Vivien Didelot <vivien.dide...@savoirfairelinux.com> --- include/linux/netdevice.

[PATCH net-next 6/8] net: dsa: prepare master receive hot path

2017-09-29 Thread Vivien Didelot
In preparation to make DSA master devices point to their corresponding CPU port instead of the whole tree, add copies of dst and rcv in the dsa_port structure so that we keep fast access in the receive hot path. Signed-off-by: Vivien Didelot --- include/net/dsa.h | 5 + net/dsa/dsa2.c

[PATCH net-next 7/8] net: dsa: change dsa_ptr for a dsa_port

2017-09-29 Thread Vivien Didelot
switch fabric. Change the master interface's dsa_ptr for the CPU dsa_port pointer. This is a step towards supporting multiple CPU ports. Also remove dsa_get_cpu_port which is now unneeded. Signed-off-by: Vivien Didelot --- include/linux/netdevice.h | 4 ++-- net/dsa/dsa.c | 6

[PATCH net-next 2/8] net: dsa: directly fetch switch in lan9303_rcv

2017-09-29 Thread Vivien Didelot
In a single-chip switch fabric, there is no need to fetch the dsa_switch structure from the tree, directly use the CPU port's "ds" member. Signed-off-by: Vivien Didelot <vivien.dide...@savoirfairelinux.com> --- net/dsa/tag_lan9303.c | 5 ++--- 1 file changed, 2 insertions

[PATCH net-next 2/8] net: dsa: directly fetch switch in lan9303_rcv

2017-09-29 Thread Vivien Didelot
In a single-chip switch fabric, there is no need to fetch the dsa_switch structure from the tree, directly use the CPU port's "ds" member. Signed-off-by: Vivien Didelot --- net/dsa/tag_lan9303.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/net/dsa/tag_lan93

[PATCH net-next 4/8] net: dsa: use temporary dsa_device_ops variable

2017-09-29 Thread Vivien Didelot
When resolving the DSA tagging protocol used by a CPU switch, use a temporary "tag_ops" variable to store the dsa_device_ops instead of using directly dst->tag_ops. This will make the future patches moving this pointer around easier to read. There is no functional changes. Signed-o

[PATCH net-next 3/8] net: dsa: use cpu_dp in master code

2017-09-29 Thread Vivien Didelot
re patch touching dsa_ptr more readable. There is no functional changes. Signed-off-by: Vivien Didelot <vivien.dide...@savoirfairelinux.com> --- net/dsa/master.c | 42 ++ 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/net/dsa/master.c b

[PATCH net-next 4/8] net: dsa: use temporary dsa_device_ops variable

2017-09-29 Thread Vivien Didelot
When resolving the DSA tagging protocol used by a CPU switch, use a temporary "tag_ops" variable to store the dsa_device_ops instead of using directly dst->tag_ops. This will make the future patches moving this pointer around easier to read. There is no functional changes. Signed-o

[PATCH net-next 3/8] net: dsa: use cpu_dp in master code

2017-09-29 Thread Vivien Didelot
re patch touching dsa_ptr more readable. There is no functional changes. Signed-off-by: Vivien Didelot --- net/dsa/master.c | 42 ++ 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/net/dsa/master.c b/net/dsa/master.c index 5e5147ec5a44..ef15d35f1574

[PATCH net-next 1/8] net: dsa: directly fetch switch in mtk_tag_rcv

2017-09-29 Thread Vivien Didelot
In a single-chip switch fabric, there is no need to fetch the dsa_switch structure from the tree, directly use the CPU port's "ds" member. Signed-off-by: Vivien Didelot <vivien.dide...@savoirfairelinux.com> --- net/dsa/tag_mtk.c | 11 ++- 1 file changed, 2 insertions

[PATCH net-next 1/8] net: dsa: directly fetch switch in mtk_tag_rcv

2017-09-29 Thread Vivien Didelot
In a single-chip switch fabric, there is no need to fetch the dsa_switch structure from the tree, directly use the CPU port's "ds" member. Signed-off-by: Vivien Didelot --- net/dsa/tag_mtk.c | 11 ++- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/net/dsa/tag_m

Re: [PATCH net-next RFC 3/9] net: dsa: mv88e6xxx: add support for GPIO configuration

2017-09-28 Thread Vivien Didelot
Hi Brandon, >> Would there be any value in implementing a proper gpiochip structure >> here such that other pieces of SW can see this GPIO controller as a >> provider and you can reference it from e.g: Device Tree using GPIO >> descriptors? > > That would be my preference as well, or maybe a

Re: [PATCH net-next RFC 3/9] net: dsa: mv88e6xxx: add support for GPIO configuration

2017-09-28 Thread Vivien Didelot
Hi Brandon, >> Would there be any value in implementing a proper gpiochip structure >> here such that other pieces of SW can see this GPIO controller as a >> provider and you can reference it from e.g: Device Tree using GPIO >> descriptors? > > That would be my preference as well, or maybe a

Re: [PATCH net-next RFC 5/9] net: dsa: forward hardware timestamping ioctls to switch driver

2017-09-28 Thread Vivien Didelot
Hi Brandon, Brandon Streiff writes: > static int dsa_slave_ioctl(struct net_device *dev, struct ifreq *ifr, int > cmd) > { > + struct dsa_slave_priv *p = netdev_priv(dev); > + struct dsa_switch *ds = p->dp->ds; > + int port = p->dp->index; > + > if

Re: [PATCH net-next RFC 5/9] net: dsa: forward hardware timestamping ioctls to switch driver

2017-09-28 Thread Vivien Didelot
Hi Brandon, Brandon Streiff writes: > static int dsa_slave_ioctl(struct net_device *dev, struct ifreq *ifr, int > cmd) > { > + struct dsa_slave_priv *p = netdev_priv(dev); > + struct dsa_switch *ds = p->dp->ds; > + int port = p->dp->index; > + > if (!dev->phydev) >

Re: [PATCH net-next RFC 1/9] net: dsa: mv88e6xxx: add accessors for PTP/TAI registers

2017-09-28 Thread Vivien Didelot
organization, very clear patch: Reviewed-by: Vivien Didelot <vivien.dide...@savoirfairelinux.com> Vivien

Re: [PATCH net-next RFC 1/9] net: dsa: mv88e6xxx: add accessors for PTP/TAI registers

2017-09-28 Thread Vivien Didelot
tp_read, > + .ptp_write = mv88e6390_ptp_write, > + .tai_read = mv88e6390_tai_read, > + .tai_write = mv88e6390_tai_write, Only nitpick: please keep the mv88e63{52,90}_g2_avb_ prefix here. Otherwise thanks for respecting the code organization, very clear

[PATCH net-next 1/5] net: dsa: return -ENODEV is there is no slave PHY

2017-09-26 Thread Vivien Didelot
Instead of returning -EOPNOTSUPP when a slave device has no PHY, directly return -ENODEV as ethtool and phylib do. Signed-off-by: Vivien Didelot <vivien.dide...@savoirfairelinux.com> --- net/dsa/slave.c | 30 +++--- 1 file changed, 15 insertions(+), 15 deletions(-)

[PATCH net-next 1/5] net: dsa: return -ENODEV is there is no slave PHY

2017-09-26 Thread Vivien Didelot
Instead of returning -EOPNOTSUPP when a slave device has no PHY, directly return -ENODEV as ethtool and phylib do. Signed-off-by: Vivien Didelot --- net/dsa/slave.c | 30 +++--- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/net/dsa/slave.c b/net/dsa

[PATCH net-next 4/5] net: dsa: use phy_ethtool_set_link_ksettings

2017-09-26 Thread Vivien Didelot
Use phy_ethtool_set_link_ksettings now that dsa_slave_set_link_ksettings does exactly the same. Signed-off-by: Vivien Didelot <vivien.dide...@savoirfairelinux.com> --- net/dsa/slave.c | 12 +--- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/net/dsa/slave.c b/n

[PATCH net-next 5/5] net: dsa: use phy_ethtool_nway_reset

2017-09-26 Thread Vivien Didelot
Use phy_ethtool_nway_reset now that dsa_slave_nway_reset does exactly the same. Signed-off-by: Vivien Didelot <vivien.dide...@savoirfairelinux.com> --- net/dsa/slave.c | 10 +- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/net/dsa/slave.c b/net/dsa/slave.c

[PATCH net-next 4/5] net: dsa: use phy_ethtool_set_link_ksettings

2017-09-26 Thread Vivien Didelot
Use phy_ethtool_set_link_ksettings now that dsa_slave_set_link_ksettings does exactly the same. Signed-off-by: Vivien Didelot --- net/dsa/slave.c | 12 +--- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/net/dsa/slave.c b/net/dsa/slave.c index bb0f64f47ae7..d2b632cae468

[PATCH net-next 5/5] net: dsa: use phy_ethtool_nway_reset

2017-09-26 Thread Vivien Didelot
Use phy_ethtool_nway_reset now that dsa_slave_nway_reset does exactly the same. Signed-off-by: Vivien Didelot --- net/dsa/slave.c | 10 +- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/net/dsa/slave.c b/net/dsa/slave.c index d2b632cae468..bf8800de13c1 100644 --- a/net/dsa

[PATCH net-next 3/5] net: dsa: use phy_ethtool_get_link_ksettings

2017-09-26 Thread Vivien Didelot
Use phy_ethtool_get_link_ksettings now that dsa_slave_get_link_ksettings does exactly the same. Signed-off-by: Vivien Didelot <vivien.dide...@savoirfairelinux.com> --- net/dsa/slave.c | 13 + 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/net/dsa/slave.c b/n

[PATCH net-next 3/5] net: dsa: use phy_ethtool_get_link_ksettings

2017-09-26 Thread Vivien Didelot
Use phy_ethtool_get_link_ksettings now that dsa_slave_get_link_ksettings does exactly the same. Signed-off-by: Vivien Didelot --- net/dsa/slave.c | 13 + 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 4ea1c6eb0da8..bb0f64f47ae7

[PATCH net-next 0/5] net: dsa: use generic slave phydev

2017-09-26 Thread Vivien Didelot
phy_ethtool_* functions. Vivien Didelot (5): net: dsa: return -ENODEV is there is no slave PHY net: dsa: use slave device phydev net: dsa: use phy_ethtool_get_link_ksettings net: dsa: use phy_ethtool_set_link_ksettings net: dsa: use phy_ethtool_nway_reset net/dsa/dsa_priv.h | 1 - net/dsa

[PATCH net-next 0/5] net: dsa: use generic slave phydev

2017-09-26 Thread Vivien Didelot
phy_ethtool_* functions. Vivien Didelot (5): net: dsa: return -ENODEV is there is no slave PHY net: dsa: use slave device phydev net: dsa: use phy_ethtool_get_link_ksettings net: dsa: use phy_ethtool_set_link_ksettings net: dsa: use phy_ethtool_nway_reset net/dsa/dsa_priv.h | 1 - net/dsa

[PATCH net-next 2/5] net: dsa: use slave device phydev

2017-09-26 Thread Vivien Didelot
There is no need to store a phy_device in dsa_slave_priv since net_device already provides one. Simply s/p->phy/dev->phydev/. Signed-off-by: Vivien Didelot <vivien.dide...@savoirfairelinux.com> --- net/dsa/dsa_priv.h | 1 - net/dsa/slav

[PATCH net-next 2/5] net: dsa: use slave device phydev

2017-09-26 Thread Vivien Didelot
There is no need to store a phy_device in dsa_slave_priv since net_device already provides one. Simply s/p->phy/dev->phydev/. Signed-off-by: Vivien Didelot --- net/dsa/dsa_priv.h | 1 - net/dsa/slave.c| 116 - 2 files chang

[PATCH net v2] net: dsa: mv88e6xxx: lock mutex when freeing IRQs

2017-09-26 Thread Vivien Didelot
mv88e6xxx_g2_irq_free locks the registers mutex, but not mv88e6xxx_g1_irq_free, which results in a stack trace from assert_reg_lock when unloading the mv88e6xxx module. Fix this. Fixes: 3460a5770ce9 ("net: dsa: mv88e6xxx: Mask g1 interrupts and free interrupt") Signed-off-by: Vivi

[PATCH net v2] net: dsa: mv88e6xxx: lock mutex when freeing IRQs

2017-09-26 Thread Vivien Didelot
mv88e6xxx_g2_irq_free locks the registers mutex, but not mv88e6xxx_g1_irq_free, which results in a stack trace from assert_reg_lock when unloading the mv88e6xxx module. Fix this. Fixes: 3460a5770ce9 ("net: dsa: mv88e6xxx: Mask g1 interrupts and free interrupt") Signed-off-by: Vivi

Re: [PATCH net] net: dsa: mv88e6xxx: lock mutex when freeing IRQs

2017-09-26 Thread Vivien Didelot
Hi Andrew, Andrew Lunn writes: > In general, i tried to keep the mutex out of the interrupt code. That > is not totally possible, the IRQ thread handler needs it. But > otherwise, the IRQ code assumes it is called with the mutex taken. > > So i think it is better to hold the

Re: [PATCH net] net: dsa: mv88e6xxx: lock mutex when freeing IRQs

2017-09-26 Thread Vivien Didelot
Hi Andrew, Andrew Lunn writes: > In general, i tried to keep the mutex out of the interrupt code. That > is not totally possible, the IRQ thread handler needs it. But > otherwise, the IRQ code assumes it is called with the mutex taken. > > So i think it is better to hold the mutex in

[PATCH net] net: dsa: mv88e6xxx: lock mutex when freeing IRQs

2017-09-26 Thread Vivien Didelot
mv88e6xxx_g2_irq_free locks the registers mutex, but not mv88e6xxx_g1_irq_free, which results in a stack trace from assert_reg_lock when unloading the mv88e6xxx module. Fix this. Fixes: 3460a5770ce9 ("net: dsa: mv88e6xxx: Mask g1 interrupts and free interrupt") Signed-off-by: Vivi

[PATCH net] net: dsa: mv88e6xxx: lock mutex when freeing IRQs

2017-09-26 Thread Vivien Didelot
mv88e6xxx_g2_irq_free locks the registers mutex, but not mv88e6xxx_g1_irq_free, which results in a stack trace from assert_reg_lock when unloading the mv88e6xxx module. Fix this. Fixes: 3460a5770ce9 ("net: dsa: mv88e6xxx: Mask g1 interrupts and free interrupt") Signed-off-by: Vivi

[PATCH net-next v3 1/2] net: dsa: make slave close symmetrical to open

2017-09-22 Thread Vivien Didelot
the master device. Signed-off-by: Vivien Didelot <vivien.dide...@savoirfairelinux.com> Reviewed-by: Florian Fainelli <f.faine...@gmail.com> Reviewed-by: Andrew Lunn <and...@lunn.ch> --- net/dsa/slave.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a

[PATCH net-next v3 1/2] net: dsa: make slave close symmetrical to open

2017-09-22 Thread Vivien Didelot
the master device. Signed-off-by: Vivien Didelot Reviewed-by: Florian Fainelli Reviewed-by: Andrew Lunn --- net/dsa/slave.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 02ace7d462c4..c2bb48579032 100644 --- a/net/dsa

[PATCH net-next v3 2/2] net: dsa: add port enable and disable helpers

2017-09-22 Thread Vivien Didelot
Provide dsa_port_enable and dsa_port_disable helpers to respectively enable and disable a switch port. This makes the dsa_port_set_state_now helper static. Signed-off-by: Vivien Didelot <vivien.dide...@savoirfairelinux.com> Reviewed-by: Florian Fainelli <f.faine...@gmail.com> Reviewe

[PATCH net-next v3 2/2] net: dsa: add port enable and disable helpers

2017-09-22 Thread Vivien Didelot
Provide dsa_port_enable and dsa_port_disable helpers to respectively enable and disable a switch port. This makes the dsa_port_set_state_now helper static. Signed-off-by: Vivien Didelot Reviewed-by: Florian Fainelli Reviewed-by: Andrew Lunn --- net/dsa/dsa_priv.h | 3 ++- net/dsa/port.c

[PATCH net-next v3 0/2] net: dsa: port enabling

2017-09-22 Thread Vivien Didelot
This patchset makes slave open and close symmetrical and provides helpers for enabling or disabling a given DSA port. Changes in v3: - save the phy_device change for a future patchset Changes in v2: - do not remove the phy argument from port enable/disable Vivien Didelot (2): net: dsa

[PATCH net-next v3 0/2] net: dsa: port enabling

2017-09-22 Thread Vivien Didelot
This patchset makes slave open and close symmetrical and provides helpers for enabling or disabling a given DSA port. Changes in v3: - save the phy_device change for a future patchset Changes in v2: - do not remove the phy argument from port enable/disable Vivien Didelot (2): net: dsa

Re: [PATCH net-next v2 1/3] net: dsa: use slave device phydev

2017-09-22 Thread Vivien Didelot
Hi Florian, Florian Fainelli <f.faine...@gmail.com> writes: > On 09/22/2017 12:40 PM, Vivien Didelot wrote: >> There is no need to store a phy_device in dsa_slave_priv since >> net_device already provides one. Simply s/p->phy/dev->phydev/. > > You can the

Re: [PATCH net-next v2 1/3] net: dsa: use slave device phydev

2017-09-22 Thread Vivien Didelot
Hi Florian, Florian Fainelli writes: > On 09/22/2017 12:40 PM, Vivien Didelot wrote: >> There is no need to store a phy_device in dsa_slave_priv since >> net_device already provides one. Simply s/p->phy/dev->phydev/. > > You can therefore remove the phy_device fro

[PATCH net-next v2 2/3] net: dsa: make slave close symmetrical to open

2017-09-22 Thread Vivien Didelot
the master device. Signed-off-by: Vivien Didelot <vivien.dide...@savoirfairelinux.com> Reviewed-by: Florian Fainelli <f.faine...@gmail.com> Reviewed-by: Andrew Lunn <and...@lunn.ch> --- net/dsa/slave.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a

[PATCH net-next v2 2/3] net: dsa: make slave close symmetrical to open

2017-09-22 Thread Vivien Didelot
the master device. Signed-off-by: Vivien Didelot Reviewed-by: Florian Fainelli Reviewed-by: Andrew Lunn --- net/dsa/slave.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 3760472bf41d..0aab29928152 100644 --- a/net/dsa

[PATCH net-next v2 3/3] net: dsa: add port enable and disable helpers

2017-09-22 Thread Vivien Didelot
Provide dsa_port_enable and dsa_port_disable helpers to respectively enable and disable a switch port. This makes the dsa_port_set_state_now helper static. Signed-off-by: Vivien Didelot <vivien.dide...@savoirfairelinux.com> Reviewed-by: Florian Fainelli <f.faine...@gmail.com> Reviewe

[PATCH net-next v2 3/3] net: dsa: add port enable and disable helpers

2017-09-22 Thread Vivien Didelot
Provide dsa_port_enable and dsa_port_disable helpers to respectively enable and disable a switch port. This makes the dsa_port_set_state_now helper static. Signed-off-by: Vivien Didelot Reviewed-by: Florian Fainelli Reviewed-by: Andrew Lunn --- net/dsa/dsa_priv.h | 3 ++- net/dsa/port.c

[PATCH net-next v2 0/3] net: dsa: use slave device phydev

2017-09-22 Thread Vivien Didelot
This patchset removes the private phy_device in favor of the one provided by the slave net_device, makes slave open and close symmetrical and finally provides helpers for enabling or disabling a DSA port. Changes in v2: - do not remove the phy argument from port enable/disable Vivien Didelot

[PATCH net-next v2 0/3] net: dsa: use slave device phydev

2017-09-22 Thread Vivien Didelot
This patchset removes the private phy_device in favor of the one provided by the slave net_device, makes slave open and close symmetrical and finally provides helpers for enabling or disabling a DSA port. Changes in v2: - do not remove the phy argument from port enable/disable Vivien Didelot

[PATCH net-next v2 1/3] net: dsa: use slave device phydev

2017-09-22 Thread Vivien Didelot
There is no need to store a phy_device in dsa_slave_priv since net_device already provides one. Simply s/p->phy/dev->phydev/. While at it, return -ENODEV when it is NULL instead of -EOPNOTSUPP. Signed-off-by: Vivien Didelot <vivien.dide...@savoirfairelinux.com> --- net/dsa/s

[PATCH net-next v2 1/3] net: dsa: use slave device phydev

2017-09-22 Thread Vivien Didelot
There is no need to store a phy_device in dsa_slave_priv since net_device already provides one. Simply s/p->phy/dev->phydev/. While at it, return -ENODEV when it is NULL instead of -EOPNOTSUPP. Signed-off-by: Vivien Didelot --- net/dsa/slave.c

Re: [PATCH net-next 2/4] net: dsa: remove phy arg from port enable/disable

2017-09-22 Thread Vivien Didelot
Hi Florian, Florian Fainelli <f.faine...@gmail.com> writes: > On 09/22/2017 09:17 AM, Vivien Didelot wrote: >> The .port_enable and .port_disable functions are meant to deal with the >> switch ports only, and no driver is using the phy argument anyway. >> Remove it. &

Re: [PATCH net-next 2/4] net: dsa: remove phy arg from port enable/disable

2017-09-22 Thread Vivien Didelot
Hi Florian, Florian Fainelli writes: > On 09/22/2017 09:17 AM, Vivien Didelot wrote: >> The .port_enable and .port_disable functions are meant to deal with the >> switch ports only, and no driver is using the phy argument anyway. >> Remove it. > > I d

[PATCH net-next 1/4] net: dsa: move up phy enabling in core

2017-09-22 Thread Vivien Didelot
bcm_sf2 is currently the only driver using the phy argument passed to .port_enable. It resets the state machine if the phy has been hard reset. This check is generic and can be moved to DSA core. Signed-off-by: Vivien Didelot <vivien.dide...@savoirfairelinux.com> --- drivers/net/dsa/bcm

<    1   2   3   4   5   6   7   8   9   10   >