[PATCH v2 net-next 0/2] lan9303: Add basic offloading of unicast traffic

2017-10-10 Thread Egil Hjelmeland
This series add basic offloading of unicast traffic to the lan9303 DSA driver. Review welcome! Changes v1 -> v2: - Patch 1: Codestyle linting. - Patch 2: Remember SWE_PORT_STATE while not bridged. Added constant LAN9303_SWE_PORT_MIRROR_DISABLED. Egil Hjelmeland (2): net:

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

2017-10-10 Thread Egil Hjelmeland
Prepare for next patch: Move tag setup from lan9303_separate_ports() to new function lan9303_setup_tagging() Signed-off-by: Egil Hjelmeland --- drivers/net/dsa/lan9303-core.c | 42 +- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/drivers

[PATCH v2 net-next 2/2] net: dsa: lan9303: Add basic offloading of unicast traffic

2017-10-10 Thread Egil Hjelmeland
. Hence the condition that both ports must join same bridge. Add brigde methods port_bridge_join, port_bridge_leave and port_stp_state_set. Signed-off-by: Egil Hjelmeland --- drivers/net/dsa/lan9303-core.c | 82 ++ drivers/net/dsa/lan9303.h | 2 ++ 2

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

2017-10-10 Thread Egil Hjelmeland
On 10. okt. 2017 17:14, woojung@microchip.com wrote: +/* forward special tagged packets from port 0 to port 1 *or* port 2 */ +static int lan9303_setup_tagging(struct lan9303 *chip) +{ + int ret; + u32 val; + /* enable defining the destination port via special VLAN tagging +

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

2017-10-11 Thread Egil Hjelmeland
On 10. okt. 2017 17:51, woojung@microchip.com wrote: Specific reason to use val then using LAN9303_BM_EGRSS_PORT_TYPE_SPECIAL_TAG_PORT0 like previous line? Specific reason was to please a reviewer that did not like my indenting in first version. I did not agree with him, but since nobody

[PATCH net-next 2/2] net: dsa: lan9303: Add fdb/mdb manipulation

2017-10-18 Thread Egil Hjelmeland
-off-by: Egil Hjelmeland --- drivers/net/dsa/lan9303-core.c | 175 + drivers/net/dsa/lan9303.h | 9 +++ 2 files changed, 184 insertions(+) diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c index 8b5202f3c0b0..4177e9d2e8ae

[PATCH net-next 0/2] net: dsa: lan9303: Add fdb/mdb methods

2017-10-18 Thread Egil Hjelmeland
/mdb methods. Note I have have a question in the second patch, in lan9303_alr_del_port. Note that to complete STP support, a special ALR entry with the STP eth address must be added too. This must be addressed later. Comments welcome! Egil Hjelmeland (2): net: dsa: lan9303: Add port_fast_age and

[PATCH net-next 1/2] net: dsa: lan9303: Add port_fast_age and port_fdb_dump methods

2017-10-18 Thread Egil Hjelmeland
Add DSA method port_fast_age as a step to STP support. Add low level functions for accessing the lan9303 ALR (Address Logic Resolution). Added DSA method port_fdb_dump Signed-off-by: Egil Hjelmeland --- drivers/net/dsa/lan9303-core.c | 159 + drivers

Re: [PATCH net-next 2/2] net: dsa: lan9303: Add fdb/mdb manipulation

2017-10-18 Thread Egil Hjelmeland
On 18. okt. 2017 16:38, Vivien Didelot wrote: Hi Egil, Egil Hjelmeland writes: +/* Delete static port from ALR entry, delete entry if last port */ +static int lan9303_alr_del_port(struct lan9303 *chip, const u8 *mac, + int port) +{ + struct

[PATCH net-next 0/2] lan9303: Add basic offloading of unicast traffic

2017-09-21 Thread Egil Hjelmeland
This series add basic offloading of unicast traffic to the lan9303 DSA driver. Comments welcome! Egil Hjelmeland (2): net: dsa: lan9303: Move tag setup to new lan9303_setup_tagging net: dsa: lan9303: Add basic offloading of unicast traffic drivers/net/dsa/lan9303-core.c | 130

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

2017-09-21 Thread Egil Hjelmeland
Prepare for next patch: Move tag setup from lan9303_separate_ports() to new function lan9303_setup_tagging() Signed-off-by: Egil Hjelmeland --- drivers/net/dsa/lan9303-core.c | 42 +- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/drivers

[PATCH net-next 2/2] net: dsa: lan9303: Add basic offloading of unicast traffic

2017-09-21 Thread Egil Hjelmeland
. Hence the condition that both ports must join same bridge. Add brigde methods port_bridge_join, port_bridge_leave and port_stp_state_set. Signed-off-by: Egil Hjelmeland --- drivers/net/dsa/lan9303-core.c | 88 ++ drivers/net/dsa/lan9303.h | 1 + 2

Re: [PATCH net-next 2/2] net: dsa: lan9303: Add basic offloading of unicast traffic

2017-09-22 Thread Egil Hjelmeland
Den 21. sep. 2017 16:21, skrev Andrew Lunn: Hi Egil +static void lan9303_bridge_ports(struct lan9303 *chip) +{ + /* ports bridged: remove mirroring */ + lan9303_write_switch_reg(chip, LAN9303_SWE_PORT_MIRROR, 0); +} Could you replace the 0 with something symbolic which makes this

Re: [PATCH net-next 2/2] net: dsa: lan9303: Add basic offloading of unicast traffic

2017-09-22 Thread Egil Hjelmeland
Den 21. sep. 2017 16:26, skrev Vivien Didelot: Hi Egil, Egil Hjelmeland writes: When both user ports are joined to the same bridge, the normal HW MAC learning is enabled. This means that unicast traffic is forwarded in HW. If one of the user ports leave the bridge, the ports goes back to

Re: [PATCH net-next 2/2] net: dsa: lan9303: Add basic offloading of unicast traffic

2017-09-23 Thread Egil Hjelmeland
Den 22. sep. 2017 22:08, skrev Andrew Lunn: I'm wondering how this is supposed to work. Please add a good comment here, since the hardware is forcing you to do something odd. Maybe it would be a good idea to save the STP state in chip. And then when chip->is_bridged is set true, change the stat

Re: [PATCH net-next 2/2] net: dsa: lan9303: Add basic offloading of unicast traffic

2017-09-24 Thread Egil Hjelmeland
Den 23. sep. 2017 16:31, skrev Andrew Lunn: The point is: Once both external ports are in "forwarding", I see no way to prevent traffic flowing directly between the external ports. Generally, there are port vectors. Port X can send frames only to Port Y. If you don't have that, there are possi

[PATCH v2 net-next] net: dsa: lan9303: lan9303_csr_reg_wait cleanups

2017-12-21 Thread Egil Hjelmeland
Non-functional cleanups in lan9303_csr_reg_wait(): - Change type of param 'mask' from int to u32. - Remove param 'value' (will probably never be used) - Reduced retries from 1000 to 25, consistent with lan9303_read_wait. - Removed comments Signed-off-by: Egil Hjelmelan

[PATCH net-next 1/2] net: dsa: lan9303: phy_addr_sel_strap rename and retype

2017-12-29 Thread Egil Hjelmeland
chip->phy_addr_sel_strap is declared as a bool, but is also used as an integer address base. Rename 'phy_addr_sel_strap' to 'phy_addr_base', and change type to int. Signed-off-by: Egil Hjelmeland --- drivers/net/dsa/lan9303-core.c | 20 ++-- include/linu

[PATCH net-next 2/2] net: dsa: lan9303: Adjust phy_addr_base expressions

2017-12-29 Thread Egil Hjelmeland
Simplify calculation of chip->phy_addr_base in lan9303_detect_phy_setup(). Use GENMASK to calculate phys_mii_mask from LAN9303_NUM_PORTS and phy_addr_base. Signed-off-by: Egil Hjelmeland --- drivers/net/dsa/lan9303-core.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) d

[PATCH net-next 0/2] net: dsa: lan9303: phy_addr_sel_strap rename and retype

2017-12-29 Thread Egil Hjelmeland
Non functional cleanups involving chip->phy_addr_sel_strap. As promised in https://lkml.org/lkml/2017/11/6/273 Egil Hjelmeland (2): net: dsa: lan9303: phy_addr_sel_strap rename and retype net: dsa: lan9303: Adjust phy_addr_base expressions drivers/net/dsa/lan9303-core.c |

Re: net-next lan9303 and CONFIG_NET_DSA_LEGACY

2017-12-29 Thread Egil Hjelmeland
On 15. des. 2017 21:06, Florian Fainelli wrote: On December 15, 2017 6:51:45 AM PST, Egil Hjelmeland wrote: Hi I found that our lan9303 board is unable to receive network data unless CONFIG_NET_DSA_LEGACY is set. Is that a problem with the driver, or our Any advise would be appreciated

Re: [PATCH net-next] net: dsa: lan9303: Fix error return code in lan9303_check_device()

2018-01-04 Thread Egil Hjelmeland
Den 04. jan. 2018 08:30, skrev Wei Yongjun: Fix to return error code -ENODEV from the chip not found error handling case instead of 0(ret have been overwritten to 0 by lan9303_read()), as done elsewhere in this function. Signed-off-by: Wei Yongjun --- Reviewed-by: Egil Hjelmeland Egil

Re: [PATCH 0/2] net: dsa: lan9303: check error value from devm_gpiod_get_optional()

2018-01-06 Thread Egil Hjelmeland
Den 13. nov. 2017 09:07, skrev Phil Reid: Replaces Pan Bian patch "net: dsa: lan9303: correctly check return value of devm_gpiod_get_optional" Errors need to be prograted back from probe. Note: I have only compile tested the code as I don't have the hardware. Phil Reid (2): net: dsa: lan93

Re: [PATCH] net: bridge: add max_fdb_count

2017-11-15 Thread Egil Hjelmeland
Den 15. nov. 2017 20:27, skrev Sarah Newman: Current memory and CPU usage for managing bridge fdb entries is unbounded. Add a parameter max_fdb_count, controlled from sysfs, which places an upper limit on the number of entries. Defaults to 1024. When max_fdb_count is met or exceeded, whether t

Re: question lan9303: DSA concurrency and locking,

2017-11-16 Thread Egil Hjelmeland
On 15. nov. 2017 15:08, Andrew Lunn wrote: On Wed, Nov 15, 2017 at 01:08:22PM +0100, Egil Hjelmeland wrote: Hi experts Hi, thanks for response, both Andrew and Vivien! I am hoping for some guidance. Does DSA offer any protection against concurrent calls of dsa_switch_ops? Hi Egil DSA

[PATCH net-next 1/5] net: dsa: lan9303: Correct register names in comments

2017-11-03 Thread Egil Hjelmeland
Two comments refer to registers, but lack the LAN9303_ prefix. Fix that. Signed-off-by: Egil Hjelmeland --- include/linux/dsa/lan9303.h | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/linux/dsa/lan9303.h b/include/linux/dsa/lan9303.h index 05d8d136baab

[PATCH net-next 3/5] net: dsa: lan9303: Replace msleep(1) with usleep_range()

2017-11-03 Thread Egil Hjelmeland
Remove scripts/checkpatch.pl WARNING by replacing msleep(1) with usleep_range() Signed-off-by: Egil Hjelmeland --- drivers/net/dsa/lan9303-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c index

[PATCH net-next 0/5] net: dsa: lan9303: Linting

2017-11-03 Thread Egil Hjelmeland
This series is non-functional. - Correct some errors in comments and documentation. Remove scripts/checkpatch.pl WARNINGs and most CHECKs: - Replace msleep(1) with usleep_range() - Remove unnecessary parentheses - Adjust indenting Egil Hjelmeland (5): net: dsa: lan9303: Correct register

[PATCH net-next 2/5] net: dsa: lan9303: Fix syntax errors in device tree examples

2017-11-03 Thread Egil Hjelmeland
Signed-off-by: Egil Hjelmeland --- Documentation/devicetree/bindings/net/dsa/lan9303.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/net/dsa/lan9303.txt b/Documentation/devicetree/bindings/net/dsa/lan9303.txt index 4448d063ddf6

[PATCH net-next 5/5] net: dsa: lan9303: Adjust indenting

2017-11-03 Thread Egil Hjelmeland
Remove scripts/checkpatch.pl CHECKs by adjusting indenting. Signed-off-by: Egil Hjelmeland --- drivers/net/dsa/lan9303_i2c.c | 2 +- drivers/net/dsa/lan9303_mdio.c | 2 +- net/dsa/tag_lan9303.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/dsa

[PATCH net-next 4/5] net: dsa: lan9303: Remove unnecessary parentheses

2017-11-03 Thread Egil Hjelmeland
Remove scripts/checkpatch.pl CHECKs by remove unnecessary parentheses Signed-off-by: Egil Hjelmeland --- drivers/net/dsa/lan9303-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c index 70ecd18a5e7d

Re: [PATCH net-next 4/5] net: dsa: lan9303: Remove unnecessary parentheses

2017-11-03 Thread Egil Hjelmeland
On 03. nov. 2017 15:11, Joe Perches wrote: On Fri, 2017-11-03 at 11:55 +0100, Egil Hjelmeland wrote: Remove scripts/checkpatch.pl CHECKs by remove unnecessary parentheses [] diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c [] @@ -483,7 +483,7 @@ static int

Re: [PATCH net-next 4/5] net: dsa: lan9303: Remove unnecessary parentheses

2017-11-06 Thread Egil Hjelmeland
On 03. nov. 2017 15:35, Egil Hjelmeland wrote: On 03. nov. 2017 15:11, Joe Perches wrote: On Fri, 2017-11-03 at 11:55 +0100, Egil Hjelmeland wrote: Remove scripts/checkpatch.pl CHECKs by remove unnecessary parentheses [] diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303

[PATCH v2 net-next 3/4] net: dsa: lan9303: Replace msleep(1) with usleep_range()

2017-11-06 Thread Egil Hjelmeland
Remove scripts/checkpatch.pl WARNING by replacing msleep(1) with usleep_range() Signed-off-by: Egil Hjelmeland Reviewed-by: Vivien Didelot --- drivers/net/dsa/lan9303-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa

[PATCH v2 net-next 0/4] net: dsa: lan9303: Linting

2017-11-06 Thread Egil Hjelmeland
dressed later Egil Hjelmeland (4): net: dsa: lan9303: Correct register names in comments net: dsa: lan9303: Fix syntax errors in device tree examples net: dsa: lan9303: Replace msleep(1) with usleep_range() net: dsa: lan9303: Adjust indenting Documentation/devicetree/bindings/net/dsa/la

[PATCH v2 net-next 2/4] net: dsa: lan9303: Fix syntax errors in device tree examples

2017-11-06 Thread Egil Hjelmeland
Signed-off-by: Egil Hjelmeland Reviewed-by: Vivien Didelot --- Documentation/devicetree/bindings/net/dsa/lan9303.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/net/dsa/lan9303.txt b/Documentation/devicetree/bindings/net/dsa/lan9303

[PATCH v2 net-next 1/4] net: dsa: lan9303: Correct register names in comments

2017-11-06 Thread Egil Hjelmeland
Two comments refer to registers, but lack the LAN9303_ prefix. Fix that. Signed-off-by: Egil Hjelmeland Reviewed-by: Vivien Didelot --- include/linux/dsa/lan9303.h | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/linux/dsa/lan9303.h b/include/linux/dsa

[PATCH v2 net-next 4/4] net: dsa: lan9303: Adjust indenting

2017-11-06 Thread Egil Hjelmeland
Remove scripts/checkpatch.pl CHECKs by adjusting indenting. Signed-off-by: Egil Hjelmeland Reviewed-by: Vivien Didelot --- drivers/net/dsa/lan9303_i2c.c | 2 +- drivers/net/dsa/lan9303_mdio.c | 2 +- net/dsa/tag_lan9303.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff

Re: [PATCH net-next 4/5] net: dsa: lan9303: Remove unnecessary parentheses

2017-11-06 Thread Egil Hjelmeland
On 03. nov. 2017 15:54, Vivien Didelot wrote: Hi Egil, Egil Hjelmeland writes: If you send a v2, you may want to address the other parenthesis alignment issues found when running ./scripts/checkpatch -f on the lan9303* files. There is just one remaining alignment issue. Removing that would

[PATCH net-next] net: dsa: lan9303: Drop port range check

2017-11-06 Thread Egil Hjelmeland
Now that ds->num_ports is 3, there is no need to check range of "port" parameter. Signed-off-by: Egil Hjelmeland --- drivers/net/dsa/lan9303-core.c | 27 --- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/drivers/net/dsa/lan9303-core.c b/dr

Re: [PATCH net-next] net: dsa: lan9303: Drop port range check

2017-11-06 Thread Egil Hjelmeland
On 06. nov. 2017 15:19, Egil Hjelmeland wrote: Now that ds->num_ports is 3, there is no need to check range of "port" parameter. + lan9303_disable_processing_port(chip, port); + lan9303_phy_write(ds, chip->phy_addr_sel_strap + port, + MII_

Re: [PATCH v3 net-next 0/5] IGMP snooping for local traffic

2017-11-07 Thread Egil Hjelmeland
proof-of-concept test, but I suspect a proper test on ip->protocol is more complicated? Acked-by: Egil Hjelmeland Cheers Egil

[PATCH net-next] net: dsa: lan9303: Fix lan9303_alr_del_port()

2017-11-08 Thread Egil Hjelmeland
Fix embarrassing bug in lan9303_alr_del_port(): Instead of zeroing entr->mac_addr, I destroyed the next cache entry. Affected .port_fdb_del and .port_mdb_del. Fixes: 0620427ea0d6 ("net: dsa: lan9303: Add fdb/mdb manipulation") Signed-off-by: Egil Hjelmeland --- drivers/net/dsa/l

[PATCH net-next] net: dsa: lan9303: Documentation: Add missing word "Mbps"

2017-11-08 Thread Egil Hjelmeland
Signed-off-by: Egil Hjelmeland --- Documentation/networking/dsa/lan9303.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/networking/dsa/lan9303.txt b/Documentation/networking/dsa/lan9303.txt index ec28683d107d..144b02b95207 100644 --- a/Documentation

Re: [PATCH v3 net-next 0/5] IGMP snooping for local traffic

2017-11-08 Thread Egil Hjelmeland
On 07. nov. 2017 18:58, Andrew Lunn wrote: Hi Andrew! When local application join multicast; the driver get 2 X .port_mdb_prepare + 4 x .port_mdb_add for the address. Humm, i would expect equal numbers of those. To be precise: it is (1 .port_mdb_prepare + 2 x .port_mdb_add), two times. I s

Re: [PATCH net-next 2/6] net: dsa: return after mdb prepare phase

2017-11-09 Thread Egil Hjelmeland
On 08. nov. 2017 18:19, Vivien Didelot wrote: The current code does not return after successfully preparing the MDB addition on every ports member of a multicast group. Fix this. Fixes: a1a6b7ea7f2d ("net: dsa: add cross-chip multicast support") Reported-by: Egil Hjelmeland Sig

Re: [PATCH net-next 1/6] net: dsa: remove trans argument from mdb ops

2017-11-09 Thread Egil Hjelmeland
On 08. nov. 2017 18:19, Vivien Didelot wrote: The DSA switch MDB ops pass the switchdev_trans structure down to the drivers, but no one is using them and they aren't supposed to anyway. Remove the trans argument from MDB prepare and add operations. - int (*port_mdb_prepare)(struct dsa

[PATCH net-next 0/2] net: dsa: lan9303: IGMP handling

2017-11-10 Thread Egil Hjelmeland
SA has updated skb. Egil Hjelmeland (2): net: dsa: lan9303: Set up trapping of IGMP to CPU port net: dsa: lan9303: Clear offload_fwd_mark for IGMP drivers/net/dsa/lan9303-core.c | 26 ++ net/dsa/tag_lan9303.c | 13 + 2 files changed, 39 inse

[PATCH net-next 1/2] net: dsa: lan9303: Set up trapping of IGMP to CPU port

2017-11-10 Thread Egil Hjelmeland
9303_setup. Signed-off-by: Egil Hjelmeland --- drivers/net/dsa/lan9303-core.c | 26 ++ 1 file changed, 26 insertions(+) diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c index 320651a57c6f..6d7dee67d822 100644 --- a/drivers/net/dsa/lan9303-co

[PATCH net-next 2/2] net: dsa: lan9303: Clear offload_fwd_mark for IGMP

2017-11-10 Thread Egil Hjelmeland
Now that IGMP packets no longer is flooded in HW, we want the SW bridge to forward packets based on bridge configuration. To make that happen, IGMP packets must have skb->offload_fwd_mark = 0. Signed-off-by: Egil Hjelmeland --- net/dsa/tag_lan9303.c | 13 + 1 file changed,

Re: [PATCH 4/4] RFC: net: dsa: realtek-smi: Add Realtek SMI driver

2017-11-10 Thread Egil Hjelmeland
On 09. nov. 2017 14:24, Andrew Lunn wrote: What should also be considered is who is pushing swithdev and DSA forward, and for what market. Pure switchdev drivers is mostly being pushed forward for Top or Rack switches. Big switches, 10G, 40G, 100G ports and lots of them. L3 routing, etc. switch

Re: [PATCH net-next 0/2] net: dsa: lan9303: IGMP handling

2017-11-10 Thread Egil Hjelmeland
Den 10. nov. 2017 15:07, skrev Andrew Lunn: skb->offload_fwd_mark calculation is a candidate for consolidation into the DSA core. The calculation can probably be more polished when done at a point where DSA has updated skb. Hi Egil Yes, at some point we should do this. But at the moment it i

Re: [PATCH net-next 2/2] net: dsa: lan9303: Clear offload_fwd_mark for IGMP

2017-11-13 Thread Egil Hjelmeland
On 10. nov. 2017 12:54, Egil Hjelmeland wrote: Now that IGMP packets no longer is flooded in HW, we want the SW bridge to forward packets based on bridge configuration. To make that happen, IGMP packets must have skb->offload_fwd_mark = 0. Signed-off-by: Egil Hjelmeland --- net/

Re: [PATCH 0/2] net: dsa: lan9303: check error value from devm_gpiod_get_optional()

2017-11-13 Thread Egil Hjelmeland
On 13. nov. 2017 09:07, Phil Reid wrote: Replaces Pan Bian patch "net: dsa: lan9303: correctly check return value of devm_gpiod_get_optional" Errors need to be prograted back from probe. Note: I have only compile tested the code as I don't have the hardware. Phil Reid (2): net: dsa: lan930

Re: [PATCH net-next 2/2] net: dsa: lan9303: Clear offload_fwd_mark for IGMP

2017-11-13 Thread Egil Hjelmeland
On 13. nov. 2017 14:02, Andrew Lunn wrote: RTFM, my bad. The lan9303 has both STP and IGMP bits in the receive tag. It is as simple as: u16 lan9303_tag1 = ntohs(lan9303_tag[1]); skb->offload_fwd_mark = !(lan9303_tag1 & 0x18); Hi Egil That is much nicer. But please add a couple of #defines for

[PATCH net-next] net: dsa: lan9303: calculate offload_fwd_mark from tag

2017-11-13 Thread Egil Hjelmeland
The lan9303 set bits in the host CPU tag indicating if a ingress frame is a trapped IGMP or STP frame. Use these bits to calculate skb->offload_fwd_mark more efficiently. Signed-off-by: Egil Hjelmeland --- net/dsa/tag_lan9303.c | 24 1 file changed, 8 insertions(+),

question lan9303: DSA concurrency and locking,

2017-11-15 Thread Egil Hjelmeland
re already protected by chip->indirect_mutex ALR access uses lan9303_write_switch_reg/lan9303_read_switch_reg. Adding a chip->alr_mutex on top of chip->indirect_mutex does not feel right to me. Would it be better to move the locking up to the relevant dsa_switch_ops functions? Thanks Egil Hjelmeland

[PATCH 00/13] net: dsa: lan9303: unicast offload, fdb,mdb,STP

2017-07-24 Thread Egil Hjelmeland
first patches submitted to the kernel, so I am looking forward to comments. Egil Hjelmeland (13): net: dsa: lan9303: Fixed MDIO interface net: dsa: lan9303: Do not disable/enable switch fabric port 0 at startup net: dsa: lan9303: Refactor lan9303_enable_packet_processing() net: dsa

[PATCH 02/13] net: dsa: lan9303: Do not disable/enable switch fabric port 0 at startup

2017-07-24 Thread Egil Hjelmeland
For some mysterious reason enable switch fabric port 0 TX fails to work, when the TX has previous been disabled. Resolved by not disable/enable switch fabric port 0 at startup. Port 1 and 2 are still disabled in early init. Signed-off-by: Egil Hjelmeland --- drivers/net/dsa/lan9303-core.c | 7

[PATCH 03/13] net: dsa: lan9303: Refactor lan9303_enable_packet_processing()

2017-07-24 Thread Egil Hjelmeland
lan9303_enable_packet_processing, lan9303_disable_packet_processing() Pass port number (0,1,2) as parameter instead of port offset. Simplify accordingly. Signed-off-by: Egil Hjelmeland --- drivers/net/dsa/lan9303-core.c | 66 -- 1 file changed, 32

[PATCH 05/13] net: dsa: added dsa_net_device_to_dsa_port()

2017-07-24 Thread Egil Hjelmeland
Allowing dsa drivers to attach sysfs nodes. Signed-off-by: Egil Hjelmeland --- include/net/dsa.h | 1 + net/dsa/slave.c | 10 ++ 2 files changed, 11 insertions(+) diff --git a/include/net/dsa.h b/include/net/dsa.h index 88da272d20d0..a71c0a2401ee 100644 --- a/include/net/dsa.h +++ b

[PATCH 06/13] net: dsa: lan9303: added sysfs node swe_bcst_throt

2017-07-24 Thread Egil Hjelmeland
Allowing per-port access to Switch Engine Broadcast Throttling Register Also added lan9303_write_switch_reg_mask() Signed-off-by: Egil Hjelmeland --- drivers/net/dsa/lan9303-core.c | 83 ++ 1 file changed, 83 insertions(+) diff --git a/drivers/net/dsa

[PATCH 07/13] net: dsa: lan9303: Added basic offloading of unicast traffic

2017-07-24 Thread Egil Hjelmeland
port_bridge_join, port_bridge_leave and port_stp_state_set. Signed-off-by: Egil Hjelmeland --- drivers/net/dsa/lan9303-core.c | 115 ++--- drivers/net/dsa/lan9303.h | 1 + 2 files changed, 98 insertions(+), 18 deletions(-) diff --git a/drivers/net/dsa

[PATCH 01/13] net: dsa: lan9303: Fixed MDIO interface

2017-07-24 Thread Egil Hjelmeland
. Renamed functions to clarify. - lan9303_detect_phy_setup() : Failed MDIO read return 0x. Handle that. Signed-off-by: Egil Hjelmeland --- drivers/net/dsa/lan9303-core.c | 42 +++--- drivers/net/dsa/lan9303.h | 11 +++ drivers/net/dsa

[PATCH 09/13] net: dsa: lan9303: Added Documentation/networking/dsa/lan9303.txt

2017-07-24 Thread Egil Hjelmeland
Signed-off-by: Egil Hjelmeland --- Documentation/networking/dsa/lan9303.txt | 48 1 file changed, 48 insertions(+) create mode 100644 Documentation/networking/dsa/lan9303.txt diff --git a/Documentation/networking/dsa/lan9303.txt b/Documentation/networking/dsa

[PATCH 10/13] net: dsa: lan9303: Only allocate 3 ports

2017-07-24 Thread Egil Hjelmeland
Saving 2628 bytes. Signed-off-by: Egil Hjelmeland --- drivers/net/dsa/lan9303-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c index dc95973d62ed..ad7a4c72e1fb 100644 --- a/drivers/net/dsa/lan9303

[PATCH 13/13] net: dsa: lan9303: lan9303_port_mdb_del remove port 0

2017-07-24 Thread Egil Hjelmeland
Workaround for dsa_switch_mdb_add adding CPU port to group, but forgetting to remove it: Remove port 0 if only port 0 is only port left. Signed-off-by: Egil Hjelmeland --- drivers/net/dsa/lan9303-core.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/drivers/net/dsa/lan9303

[PATCH 12/13] net: dsa: lan9303: Added "stp_enable" sysfs attribute

2017-07-24 Thread Egil Hjelmeland
Must be set to 1 by user space when STP is used on the lan9303. If bridging without local STP, leave at 0, so external STP BPDUs are forwarded. Hopefully the kernel can be improved so the driver can handle this without user intervention, and this control can be removed. Signed-off-by: Egil

[PATCH 11/13] net: dsa: lan9303: Added "alr_dump" sysfs port attribute

2017-07-24 Thread Egil Hjelmeland
01:95 0 s 10:f3:11:f5:6f:cf 2 l 48:4d:7e:f4:59:a8 2 l 01:00:5e:00:01:0a 0 2 s ec:f4:bb:0f:e2:fd 2 l Signed-off-by: Egil Hjelmeland --- Documentation/networking/dsa/lan9303.txt | 3 ++ drivers/net/dsa/lan9303-core.c | 58 2 files changed, 61 inser

[PATCH 08/13] net: dsa: lan9303: Added ALR/fdb/mdb handling

2017-07-24 Thread Egil Hjelmeland
entry, the driver caches all static entries - in a flat table. Signed-off-by: Egil Hjelmeland --- drivers/net/dsa/lan9303-core.c | 369 + drivers/net/dsa/lan9303.h | 11 ++ 2 files changed, 380 insertions(+) diff --git a/drivers/net/dsa/lan9303

[PATCH 04/13] net: dsa: lan9303: Added adjust_link() method

2017-07-24 Thread Egil Hjelmeland
This makes the driver react to device tree "fixed-link" declaration on CPU port. - turn off autonegotiation - force speed 10 or 100 mb/s - force duplex mode Signed-off-by: Egil Hjelmeland --- drivers/net/dsa/lan9303-core.c | 33 + 1 file changed, 33

Re: [PATCH 00/13] net: dsa: lan9303: unicast offload, fdb,mdb,STP

2017-07-25 Thread Egil Hjelmeland
On 24. juli 2017 18:54, Florian Fainelli wrote: > > First thing would be to get your patch submissions square, because the > patches do not appear to have been sent as a reply to this cover letter, > and worse yet, they are all appearing with their commit date, which is > highly confusing since th

Re: [PATCH 00/13] net: dsa: lan9303: unicast offload, fdb,mdb,STP

2017-07-25 Thread Egil Hjelmeland
On 24. juli 2017 22:32, David Miller wrote: They are all over the place, over a period of 3 days. I will do "git rebase --ignore-date master" from now on. You must also say in your subject line which of my two GIT networking trees ('net' or 'net-next') your changes are targetting. If you don

Re: [PATCH 13/13] net: dsa: lan9303: lan9303_port_mdb_del remove port 0

2017-07-25 Thread Egil Hjelmeland
On 24. juli 2017 18:57, Florian Fainelli wrote: On 07/20/2017 06:57 AM, Egil Hjelmeland wrote: Workaround for dsa_switch_mdb_add adding CPU port to group, but forgetting to remove it: Should not we move this logic one layer above into DSA then such that insertions and removals are strictly

Re: [PATCH 12/13] net: dsa: lan9303: Added "stp_enable" sysfs attribute

2017-07-25 Thread Egil Hjelmeland
On 24. juli 2017 18:55, Florian Fainelli wrote: On 07/20/2017 06:42 AM, Egil Hjelmeland wrote: Must be set to 1 by user space when STP is used on the lan9303. If bridging without local STP, leave at 0, so external STP BPDUs are forwarded. Hopefully the kernel can be improved so the driver can

Re: [PATCH 11/13] net: dsa: lan9303: Added "alr_dump" sysfs port attribute

2017-07-25 Thread Egil Hjelmeland
On 24. juli 2017 18:54, Florian Fainelli wrote: On 07/20/2017 01:49 AM, Egil Hjelmeland wrote: Added read only file /sys/class/net//lan9303/alr_dump, that output 168 first ALR entires. Currently "bridge fdb show" does not include the CPU port, while "alr_dump" list all t

[PATCH net-next v2 01/10] net: dsa: lan9303: Fixed MDIO interface

2017-07-25 Thread Egil Hjelmeland
. Renamed functions to clarify. - lan9303_detect_phy_setup() : Failed MDIO read return 0x. Handle that. Signed-off-by: Egil Hjelmeland --- drivers/net/dsa/lan9303-core.c | 42 +++--- drivers/net/dsa/lan9303.h | 11 +++ drivers/net/dsa

[PATCH net-next v2 04/10] net: dsa: lan9303: Added adjust_link() method

2017-07-25 Thread Egil Hjelmeland
This makes the driver react to device tree "fixed-link" declaration on CPU port. - turn off autonegotiation - force speed 10 or 100 mb/s - force duplex mode Signed-off-by: Egil Hjelmeland --- drivers/net/dsa/lan9303-core.c | 33 + 1 file changed, 33

[PATCH net-next v2 00/10] net: dsa: lan9303: unicast offload, fdb,mdb,STP

2017-07-25 Thread Egil Hjelmeland
rom private account in order to avoid company disclaimer in emails. - Removed the three last "work around" patches. But first moved one doc paragraph to the document patch. Egil Hjelmeland (10): net: dsa: lan9303: Fixed MDIO interface net: dsa: lan9303: Do not disable/enable switch

[PATCH net-next v2 03/10] net: dsa: lan9303: Refactor lan9303_enable_packet_processing()

2017-07-25 Thread Egil Hjelmeland
lan9303_enable_packet_processing, lan9303_disable_packet_processing() Pass port number (0,1,2) as parameter instead of port offset. Simplify accordingly. Signed-off-by: Egil Hjelmeland --- drivers/net/dsa/lan9303-core.c | 66 -- 1 file changed, 32

[PATCH net-next v2 07/10] net: dsa: lan9303: Added basic offloading of unicast traffic

2017-07-25 Thread Egil Hjelmeland
port_bridge_join, port_bridge_leave and port_stp_state_set. Signed-off-by: Egil Hjelmeland --- drivers/net/dsa/lan9303-core.c | 115 ++--- drivers/net/dsa/lan9303.h | 1 + 2 files changed, 98 insertions(+), 18 deletions(-) diff --git a/drivers/net/dsa

[PATCH net-next v2 09/10] net: dsa: lan9303: Added Documentation/networking/dsa/lan9303.txt

2017-07-25 Thread Egil Hjelmeland
Signed-off-by: Egil Hjelmeland --- Documentation/networking/dsa/lan9303.txt | 63 1 file changed, 63 insertions(+) create mode 100644 Documentation/networking/dsa/lan9303.txt diff --git a/Documentation/networking/dsa/lan9303.txt b/Documentation/networking/dsa

[PATCH net-next v2 10/10] net: dsa: lan9303: Only allocate 3 ports

2017-07-25 Thread Egil Hjelmeland
Saving 2628 bytes. Signed-off-by: Egil Hjelmeland Reviewed-by: Florian Fainelli --- drivers/net/dsa/lan9303-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c index dc95973d62ed..ad7a4c72e1fb 100644

[PATCH net-next v2 08/10] net: dsa: lan9303: Added ALR/fdb/mdb handling

2017-07-25 Thread Egil Hjelmeland
entry, the driver caches all static entries - in a flat table. Signed-off-by: Egil Hjelmeland --- drivers/net/dsa/lan9303-core.c | 369 + drivers/net/dsa/lan9303.h | 11 ++ 2 files changed, 380 insertions(+) diff --git a/drivers/net/dsa/lan9303

[PATCH net-next v2 05/10] net: dsa: added dsa_net_device_to_dsa_port()

2017-07-25 Thread Egil Hjelmeland
Allowing dsa drivers to attach sysfs nodes. Signed-off-by: Egil Hjelmeland --- include/net/dsa.h | 1 + net/dsa/slave.c | 10 ++ 2 files changed, 11 insertions(+) diff --git a/include/net/dsa.h b/include/net/dsa.h index 88da272d20d0..a71c0a2401ee 100644 --- a/include/net/dsa.h +++ b

[PATCH net-next v2 02/10] net: dsa: lan9303: Do not disable/enable switch fabric port 0 at startup

2017-07-25 Thread Egil Hjelmeland
For some mysterious reason enable switch fabric port 0 TX fails to work, when the TX has previous been disabled. Resolved by not disable/enable switch fabric port 0 at startup. Port 1 and 2 are still disabled in early init. Signed-off-by: Egil Hjelmeland --- drivers/net/dsa/lan9303-core.c | 7

[PATCH net-next v2 06/10] net: dsa: lan9303: added sysfs node swe_bcst_throt

2017-07-25 Thread Egil Hjelmeland
Allowing per-port access to Switch Engine Broadcast Throttling Register Also added lan9303_write_switch_reg_mask() Signed-off-by: Egil Hjelmeland --- drivers/net/dsa/lan9303-core.c | 83 ++ 1 file changed, 83 insertions(+) diff --git a/drivers/net/dsa

Re: [PATCH net-next v2 01/10] net: dsa: lan9303: Fixed MDIO interface

2017-07-26 Thread Egil Hjelmeland
On 25. juli 2017 21:15, Vivien Didelot wrote: Hi Egil, Egil Hjelmeland writes: Fixes after testing on actual HW: - lan9303_mdio_write()/_read() must multiply register number by 4 to get offset - Indirect access (PMI) to phy register only work in I2C mode. In MDIO mode phy registers

Re: [PATCH net-next v2 01/10] net: dsa: lan9303: Fixed MDIO interface

2017-07-26 Thread Egil Hjelmeland
On 26. juli 2017 16:30, Vivien Didelot wrote: Hi Egil, Egil Hjelmeland writes: I'd suggest you to split up this one commit in several *atomic* and easy to review patches and send them separately as on thread named "net: dsa: lan9303: fix MDIO interface" (also note that imperat

Re: [PATCH net-next v2 01/10] net: dsa: lan9303: Fixed MDIO interface

2017-07-26 Thread Egil Hjelmeland
Den 26. juli 2017 22:07, skrev David Miller: From: Andrew Lunn Date: Wed, 26 Jul 2017 19:52:24 +0200 So I really want to group the patches into only a few series in order to not spend months on the process. I strongly agree with Vivien here. Good patches get accepted in about 3 days. You sho

Re: [PATCH net-next v2 02/10] net: dsa: lan9303: Do not disable/enable switch fabric port 0 at startup

2017-07-27 Thread Egil Hjelmeland
On 26. juli 2017 18:58, Andrew Lunn wrote: On Tue, Jul 25, 2017 at 06:15:45PM +0200, Egil Hjelmeland wrote: For some mysterious reason enable switch fabric port 0 TX fails to work, when the TX has previous been disabled. Resolved by not disable/enable switch fabric port 0 at startup. Port 1 and

Re: [PATCH net-next v2 04/10] net: dsa: lan9303: Added adjust_link() method

2017-07-27 Thread Egil Hjelmeland
On 26. juli 2017 19:09, Andrew Lunn wrote: On Tue, Jul 25, 2017 at 06:15:47PM +0200, Egil Hjelmeland wrote: This makes the driver react to device tree "fixed-link" declaration on CPU port. - turn off autonegotiation - force speed 10 or 100 mb/s - force duplex mode Signed-of

Re: [PATCH net-next v2 06/10] net: dsa: lan9303: added sysfs node swe_bcst_throt

2017-07-27 Thread Egil Hjelmeland
On 26. juli 2017 19:14, Andrew Lunn wrote: On Tue, Jul 25, 2017 at 06:15:49PM +0200, Egil Hjelmeland wrote: Allowing per-port access to Switch Engine Broadcast Throttling Register Hi Egil In general, we are against using sysfs. If there is a generic mechanism, that applies for all sorts of

Re: [PATCH net-next v2 08/10] net: dsa: lan9303: Added ALR/fdb/mdb handling

2017-07-27 Thread Egil Hjelmeland
On 26. juli 2017 19:41, Andrew Lunn wrote: Hi Egil +/* This function will wait a while until mask & reg == value */ +/* Otherwise, return timeout */ +static int lan9303_csr_reg_wait(struct lan9303 *chip, int regno, + int mask, char value) +{ + int i; + +

Re: [PATCH net-next v2 07/10] net: dsa: lan9303: Added basic offloading of unicast traffic

2017-07-27 Thread Egil Hjelmeland
On 26. juli 2017 19:24, Andrew Lunn wrote: Hi Egil +/* forward special tagged packets from port 0 to port 1 *or* port 2 */ +static int lan9303_setup_tagging(struct lan9303 *chip) +{ + int ret; Blank line please. + /* enable defining the destination port via special VLAN tagging

Re: [PATCH net-next v2 07/10] net: dsa: lan9303: Added basic offloading of unicast traffic

2017-07-27 Thread Egil Hjelmeland
On 27. juli 2017 15:31, Andrew Lunn wrote: I think you are over-simplifying here. Say i have a layer 2 VPN and i bridge port 1 and the VPN? The software bridge still wants to do STP on port 1, in order to solve loops. Problem is that the mainline lan9303_separate_ports() does its work by setti

Re: [PATCH net-next v2 01/10] net: dsa: lan9303: Fixed MDIO interface

2017-07-28 Thread Egil Hjelmeland
On 26. juli 2017 18:55, Andrew Lunn wrote: On Tue, Jul 25, 2017 at 06:15:44PM +0200, Egil Hjelmeland wrote: It is better to use mdiobus_read/write or if you are nesting mdio busses, mdiobus_read_nested/mdiobus_write_nested. Please test this code with lockdep enabled. I have

[PATCH net-next 0/4] net: dsa: lan9303: Fix MDIO issues.

2017-07-28 Thread Egil Hjelmeland
lan9303_indirect_phy_ops Unfortunately I do not have access to i2c based system for testing. Egil Hjelmeland (4): net: dsa: lan9303: Fix lan9303_detect_phy_setup() for MDIO net: dsa: lan9303: Multiply by 4 to get MDIO register net: dsa: lan9303: Renamed indirect phy access functions net: dsa: lan9303: MDIO

[PATCH net-next 2/4] net: dsa: lan9303: Multiply by 4 to get MDIO register

2017-07-28 Thread Egil Hjelmeland
lan9303_mdio_write()/_read() must multiply register number by 4 to get offset. Added some commments to the register definitions. Signed-off-by: Egil Hjelmeland --- drivers/net/dsa/lan9303-core.c | 6 ++ drivers/net/dsa/lan9303_mdio.c | 2 ++ 2 files changed, 8 insertions(+) diff --git a

[PATCH net-next 1/4] net: dsa: lan9303: Fix lan9303_detect_phy_setup() for MDIO

2017-07-28 Thread Egil Hjelmeland
Handle that MDIO read with no response return 0x. Signed-off-by: Egil Hjelmeland --- drivers/net/dsa/lan9303-core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c index cd76e61f1fca..9d0ab77edb4a 100644

  1   2   >