mbox series

[RFC,net-next,0/3] net: dsa: mv88e6xxx: Add RMU support

Message ID 20220818102924.287719-1-mattias.forsblad@gmail.com (mailing list archive)
Headers show
Series net: dsa: mv88e6xxx: Add RMU support | expand

Message

Mattias Forsblad Aug. 18, 2022, 10:29 a.m. UTC
The Marvell SOHO switches have the ability to receive and transmit                                                                                                    
Remote Management Frames (Frame2Reg) to the CPU through the                                                                                                           
switch attached network interface.                                                                                                                                    
These frames is handled by the Remote Management Unit (RMU) in                                                                                                        
the switch.                                                                                                                                                           
These frames can contain different payloads:                                                                                                                          
single switch register read and writes, daisy chained switch                                                                                                          
register read and writes, RMON/MIB dump/dump clear and ATU dump.                                                                                                      
The dump functions are very costly over MDIO but it's                                                                                                                 
only a couple of network packets via the RMU. Handling these                                                                                                          
operations via RMU instead of MDIO also relieves access                                                                                                               
contention on the MDIO bus.                                                                                                                                           
                                                                                                                                                                      
This request for comment series implements RMU layer 2 and                                                                                                            
layer 3 handling and also collecting RMON counters                                                                                                                    
through the RMU.                                                                                                                                                      
                                                                                                                                                                      
Next step could be to implement single read and writes but we've                                                                                                      
found that the gain to transfer this to RMU is neglible.                                                                                                              
                                                                                                                                                                      
Regards,                                                                                                                                                              
Mattias Forsblad                                                                                                                                                      

Mattias Forsblad (3):
  dsa: Add ability to handle RMU frames.
  mv88e6xxx: Implement remote management support (RMU)
  mv88e6xxx: rmon: Use RMU to collect rmon data.

 drivers/net/dsa/mv88e6xxx/Makefile  |   1 +
 drivers/net/dsa/mv88e6xxx/chip.c    |  60 +++++--
 drivers/net/dsa/mv88e6xxx/chip.h    |  20 +++
 drivers/net/dsa/mv88e6xxx/global1.c |  84 +++++++++
 drivers/net/dsa/mv88e6xxx/global1.h |   3 +
 drivers/net/dsa/mv88e6xxx/rmu.c     | 256 ++++++++++++++++++++++++++++
 drivers/net/dsa/mv88e6xxx/rmu.h     |  18 ++
 include/net/dsa.h                   |   7 +
 include/uapi/linux/if_ether.h       |   1 +
 net/dsa/tag_dsa.c                   | 102 ++++++++++-
 10 files changed, 536 insertions(+), 16 deletions(-)
 create mode 100644 drivers/net/dsa/mv88e6xxx/rmu.c
 create mode 100644 drivers/net/dsa/mv88e6xxx/rmu.h

Comments

Vladimir Oltean Aug. 18, 2022, 11:58 a.m. UTC | #1
On Thu, Aug 18, 2022 at 12:29:21PM +0200, Mattias Forsblad wrote:
> The Marvell SOHO switches have the ability to receive and transmit
> Remote Management Frames (Frame2Reg) to the CPU through the
> switch attached network interface.
> These frames is handled by the Remote Management Unit (RMU) in
> the switch.
> These frames can contain different payloads:
> single switch register read and writes, daisy chained switch
> register read and writes, RMON/MIB dump/dump clear and ATU dump.
> The dump functions are very costly over MDIO but it's
> only a couple of network packets via the RMU. Handling these
> operations via RMU instead of MDIO also relieves access
> contention on the MDIO bus.
>
> This request for comment series implements RMU layer 2 and
> layer 3 handling and also collecting RMON counters
> through the RMU.
>
> Next step could be to implement single read and writes but we've
> found that the gain to transfer this to RMU is neglible.
>
> Regards,
> Mattias Forsblad

Have you seen how things work with qca8k_connect_tag_protocol()/
qca8k_master_change()/qca8k_read_eth()/qca8k_write_eth()/
qca8k_phy_eth_command()?
Andrew Lunn Aug. 18, 2022, 12:31 p.m. UTC | #2
On Thu, Aug 18, 2022 at 12:29:21PM +0200, Mattias Forsblad wrote:
> The Marvell SOHO switches have the ability to receive and transmit                                                                                                    
> Remote Management Frames (Frame2Reg) to the CPU through the                                                                                                           
> switch attached network interface.                                                                                                                                    
> These frames is handled by the Remote Management Unit (RMU) in                                                                                                        
> the switch.

Please try to avoid all the additional whitespace your editor/mailer
has added.

> Next step could be to implement single read and writes but we've
> found that the gain to transfer this to RMU is neglible.

I agree that RMON is a good first step. Dumping the ATU and VTU would
also make a lot of sense.

For general register access, did you try combining multiple writes and
one read into an RMU packet? At least during initial setup, i suspect
there are some code flows which follow that pattern with lots of
writes. And a collection of read/modify/write might benefit.

    Andrew
Mattias Forsblad Aug. 19, 2022, 5:07 a.m. UTC | #3
On 2022-08-18 13:58, Vladimir Oltean wrote:
> On Thu, Aug 18, 2022 at 12:29:21PM +0200, Mattias Forsblad wrote:
>> The Marvell SOHO switches have the ability to receive and transmit
>> Remote Management Frames (Frame2Reg) to the CPU through the
>> switch attached network interface.
>> These frames is handled by the Remote Management Unit (RMU) in
>> the switch.
>> These frames can contain different payloads:
>> single switch register read and writes, daisy chained switch
>> register read and writes, RMON/MIB dump/dump clear and ATU dump.
>> The dump functions are very costly over MDIO but it's
>> only a couple of network packets via the RMU. Handling these
>> operations via RMU instead of MDIO also relieves access
>> contention on the MDIO bus.
>>
>> This request for comment series implements RMU layer 2 and
>> layer 3 handling and also collecting RMON counters
>> through the RMU.
>>
>> Next step could be to implement single read and writes but we've
>> found that the gain to transfer this to RMU is neglible.
>>
>> Regards,
>> Mattias Forsblad
> 
> Have you seen how things work with qca8k_connect_tag_protocol()/
> qca8k_master_change()/qca8k_read_eth()/qca8k_write_eth()/
> qca8k_phy_eth_command()?

No, I have not. I'll take a look at those. Thanks.
Mattias Forsblad Aug. 19, 2022, 5:14 a.m. UTC | #4
On 2022-08-18 14:31, Andrew Lunn wrote:
> On Thu, Aug 18, 2022 at 12:29:21PM +0200, Mattias Forsblad wrote:
>> The Marvell SOHO switches have the ability to receive and transmit                                                                                                    
>> Remote Management Frames (Frame2Reg) to the CPU through the                                                                                                           
>> switch attached network interface.                                                                                                                                    
>> These frames is handled by the Remote Management Unit (RMU) in                                                                                                        
>> the switch.
> 
> Please try to avoid all the additional whitespace your editor/mailer
> has added.
> 
>> Next step could be to implement single read and writes but we've
>> found that the gain to transfer this to RMU is neglible.
> 
> I agree that RMON is a good first step. Dumping the ATU and VTU would
> also make a lot of sense.
> 
> For general register access, did you try combining multiple writes and
> one read into an RMU packet? At least during initial setup, i suspect
> there are some code flows which follow that pattern with lots of
> writes. And a collection of read/modify/write might benefit.
> 
>     Andrew

In another stack I've used aggregated writes with great improvements so
it that is something that could be investigated. One large oversight when
implementing RMU in HW there is no operation for masked writes which makes
it a bit trickier. It would be great if there was a transaction-based
API which would easier map for aggregated accesses.
Oltean mentioned something about qck8k that I'll have a look into.