From: Kurt Kanzenbach <hidden> Date: 2021-03-13 09:41:28
Hi,
add support for dumping the VLAN and FDB table via devlink. As the driver uses
internal VLANs and static FDB entries, this is a useful debugging feature.
Changes since v1:
* Drop memory reporting as there are better APIs to expose this
* Move comment to VLAN patch
Previous versions:
* https://lkml.kernel.org/netdev/20210311175344.3084-1-kurt@kmk-computers.de/
Thanks,
Kurt
Kurt Kanzenbach (4):
net: dsa: hellcreek: Add devlink VLAN region
net: dsa: hellcreek: Use boolean value
net: dsa: hellcreek: Move common code to helper
net: dsa: hellcreek: Add devlink FDB region
drivers/net/dsa/hirschmann/hellcreek.c | 223 ++++++++++++++++++++-----
drivers/net/dsa/hirschmann/hellcreek.h | 7 +
2 files changed, 187 insertions(+), 43 deletions(-)
--
2.30.2
From: Kurt Kanzenbach <hidden> Date: 2021-03-13 09:41:27
hellcreek_select_vlan() takes a boolean instead of an integer.
So, use false accordingly.
Signed-off-by: Kurt Kanzenbach <redacted>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
---
drivers/net/dsa/hirschmann/hellcreek.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Kurt Kanzenbach <hidden> Date: 2021-03-13 09:41:27
Allow to dump the FDB table via devlink. This is a useful debugging feature.
Signed-off-by: Kurt Kanzenbach <redacted>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
---
drivers/net/dsa/hirschmann/hellcreek.c | 62 ++++++++++++++++++++++++++
drivers/net/dsa/hirschmann/hellcreek.h | 1 +
2 files changed, 63 insertions(+)
From: Kurt Kanzenbach <hidden> Date: 2021-03-13 09:41:27
Allow to dump the VLAN table via devlink. This especially useful, because the
driver internally leverages VLANs for the port separation. These are not visible
via the bridge utility.
Signed-off-by: Kurt Kanzenbach <redacted>
---
drivers/net/dsa/hirschmann/hellcreek.c | 74 ++++++++++++++++++++++++++
drivers/net/dsa/hirschmann/hellcreek.h | 6 +++
2 files changed, 80 insertions(+)
From: Kurt Kanzenbach <hidden> Date: 2021-03-13 09:41:27
There are two functions which need to populate fdb entries. Move that to a
helper function.
Signed-off-by: Kurt Kanzenbach <redacted>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
---
drivers/net/dsa/hirschmann/hellcreek.c | 85 +++++++++++++-------------
1 file changed, 43 insertions(+), 42 deletions(-)
@@ -670,6 +670,40 @@ static int __hellcreek_fdb_del(struct hellcreek *hellcreek,returnhellcreek_wait_fdb_ready(hellcreek);}+staticvoidhellcreek_populate_fdb_entry(structhellcreek*hellcreek,+structhellcreek_fdb_entry*entry,+size_tidx)+{+unsignedcharaddr[ETH_ALEN];+u16meta,mac;++/* Read values */+meta=hellcreek_read(hellcreek,HR_FDBMDRD);+mac=hellcreek_read(hellcreek,HR_FDBRDL);+addr[5]=mac&0xff;+addr[4]=(mac&0xff00)>>8;+mac=hellcreek_read(hellcreek,HR_FDBRDM);+addr[3]=mac&0xff;+addr[2]=(mac&0xff00)>>8;+mac=hellcreek_read(hellcreek,HR_FDBRDH);+addr[1]=mac&0xff;+addr[0]=(mac&0xff00)>>8;++/* Populate @entry */+memcpy(entry->mac,addr,sizeof(addr));+entry->idx=idx;+entry->portmask=(meta&HR_FDBMDRD_PORTMASK_MASK)>>+HR_FDBMDRD_PORTMASK_SHIFT;+entry->age=(meta&HR_FDBMDRD_AGE_MASK)>>+HR_FDBMDRD_AGE_SHIFT;+entry->is_obt=!!(meta&HR_FDBMDRD_OBT);+entry->pass_blocked=!!(meta&HR_FDBMDRD_PASS_BLOCKED);+entry->is_static=!!(meta&HR_FDBMDRD_STATIC);+entry->reprio_tc=(meta&HR_FDBMDRD_REPRIO_TC_MASK)>>+HR_FDBMDRD_REPRIO_TC_SHIFT;+entry->reprio_en=!!(meta&HR_FDBMDRD_REPRIO_EN);+}+/* Retrieve the index of a FDB entry by mac address. Currently we search through*thecompletetableinhardware.Ifthat'stooslow,wemighthavetocache*thecompleteFDBtableinsoftware.
@@ -691,39 +725,19 @@ static int hellcreek_fdb_get(struct hellcreek *hellcreek,*enternewentriesanywhere.*/for(i=0;i<hellcreek->fdb_entries;++i){-unsignedcharaddr[ETH_ALEN];-u16meta,mac;--meta=hellcreek_read(hellcreek,HR_FDBMDRD);-mac=hellcreek_read(hellcreek,HR_FDBRDL);-addr[5]=mac&0xff;-addr[4]=(mac&0xff00)>>8;-mac=hellcreek_read(hellcreek,HR_FDBRDM);-addr[3]=mac&0xff;-addr[2]=(mac&0xff00)>>8;-mac=hellcreek_read(hellcreek,HR_FDBRDH);-addr[1]=mac&0xff;-addr[0]=(mac&0xff00)>>8;+structhellcreek_fdb_entrytmp={0};++/* Read entry */+hellcreek_populate_fdb_entry(hellcreek,&tmp,i);/* Force next entry */hellcreek_write(hellcreek,0x00,HR_FDBRDH);-if(memcmp(addr,dest,ETH_ALEN))+if(memcmp(tmp.mac,dest,ETH_ALEN))continue;/* Match found */-entry->idx=i;-entry->portmask=(meta&HR_FDBMDRD_PORTMASK_MASK)>>-HR_FDBMDRD_PORTMASK_SHIFT;-entry->age=(meta&HR_FDBMDRD_AGE_MASK)>>-HR_FDBMDRD_AGE_SHIFT;-entry->is_obt=!!(meta&HR_FDBMDRD_OBT);-entry->pass_blocked=!!(meta&HR_FDBMDRD_PASS_BLOCKED);-entry->is_static=!!(meta&HR_FDBMDRD_STATIC);-entry->reprio_tc=(meta&HR_FDBMDRD_REPRIO_TC_MASK)>>-HR_FDBMDRD_REPRIO_TC_SHIFT;-entry->reprio_en=!!(meta&HR_FDBMDRD_REPRIO_EN);-memcpy(entry->mac,addr,sizeof(addr));+memcpy(entry,&tmp,sizeof(*entry));return0;}
@@ -838,18 +852,9 @@ static int hellcreek_fdb_dump(struct dsa_switch *ds, int port,for(i=0;i<hellcreek->fdb_entries;++i){unsignedcharnull_addr[ETH_ALEN]={0};structhellcreek_fdb_entryentry={0};-u16meta,mac;--meta=hellcreek_read(hellcreek,HR_FDBMDRD);-mac=hellcreek_read(hellcreek,HR_FDBRDL);-entry.mac[5]=mac&0xff;-entry.mac[4]=(mac&0xff00)>>8;-mac=hellcreek_read(hellcreek,HR_FDBRDM);-entry.mac[3]=mac&0xff;-entry.mac[2]=(mac&0xff00)>>8;-mac=hellcreek_read(hellcreek,HR_FDBRDH);-entry.mac[1]=mac&0xff;-entry.mac[0]=(mac&0xff00)>>8;++/* Read entry */+hellcreek_populate_fdb_entry(hellcreek,&entry,i);/* Force next entry */hellcreek_write(hellcreek,0x00,HR_FDBRDH);
@@ -858,10 +863,6 @@ static int hellcreek_fdb_dump(struct dsa_switch *ds, int port,if(!memcmp(entry.mac,null_addr,ETH_ALEN))continue;-entry.portmask=(meta&HR_FDBMDRD_PORTMASK_MASK)>>-HR_FDBMDRD_PORTMASK_SHIFT;-entry.is_static=!!(meta&HR_FDBMDRD_STATIC);-/* Check port mask */if(!(entry.portmask&BIT(port)))continue;
From: Vladimir Oltean <olteanv@gmail.com> Date: 2021-03-13 11:39:49
On Sat, Mar 13, 2021 at 10:39:36AM +0100, Kurt Kanzenbach wrote:
Allow to dump the VLAN table via devlink. This especially useful, because the
driver internally leverages VLANs for the port separation. These are not visible
via the bridge utility.
Signed-off-by: Kurt Kanzenbach <redacted>
---
From: Vladimir Oltean <olteanv@gmail.com> Date: 2021-03-13 11:40:39
On Sat, Mar 13, 2021 at 10:39:37AM +0100, Kurt Kanzenbach wrote:
hellcreek_select_vlan() takes a boolean instead of an integer.
So, use false accordingly.
Signed-off-by: Kurt Kanzenbach <redacted>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
---
From: Vladimir Oltean <olteanv@gmail.com> Date: 2021-03-13 11:45:41
On Sat, Mar 13, 2021 at 10:39:38AM +0100, Kurt Kanzenbach wrote:
quoted hunk
There are two functions which need to populate fdb entries. Move that to a
helper function.
Signed-off-by: Kurt Kanzenbach <redacted>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
---
drivers/net/dsa/hirschmann/hellcreek.c | 85 +++++++++++++-------------
1 file changed, 43 insertions(+), 42 deletions(-)
From: Vladimir Oltean <olteanv@gmail.com> Date: 2021-03-13 11:47:50
On Sat, Mar 13, 2021 at 10:39:39AM +0100, Kurt Kanzenbach wrote:
Allow to dump the FDB table via devlink. This is a useful debugging feature.
Signed-off-by: Kurt Kanzenbach <redacted>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
---
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
By the way, what user space program do you use to dump these? Did you
derive something from Andrew's mv88e6xxx_dump too? Maybe we should work
on something common?
Hello:
This series was applied to netdev/net-next.git (refs/heads/master):
On Sat, 13 Mar 2021 10:39:35 +0100 you wrote:
Hi,
add support for dumping the VLAN and FDB table via devlink. As the driver uses
internal VLANs and static FDB entries, this is a useful debugging feature.
Changes since v1:
[...]
hellcreek_select_vlan() takes a boolean instead of an integer.
So, use false accordingly.
Signed-off-by: Kurt Kanzenbach <redacted>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Allow to dump the VLAN table via devlink. This especially useful, because the
driver internally leverages VLANs for the port separation. These are not visible
via the bridge utility.
Signed-off-by: Kurt Kanzenbach <redacted>
There are two functions which need to populate fdb entries. Move that to a
helper function.
Signed-off-by: Kurt Kanzenbach <redacted>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Allow to dump the FDB table via devlink. This is a useful debugging feature.
Signed-off-by: Kurt Kanzenbach <redacted>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
From: Kurt Kanzenbach <hidden> Date: 2021-03-14 13:03:58
On Sat Mar 13 2021, Vladimir Oltean wrote:
On Sat, Mar 13, 2021 at 10:39:39AM +0100, Kurt Kanzenbach wrote:
quoted
Allow to dump the FDB table via devlink. This is a useful debugging feature.
Signed-off-by: Kurt Kanzenbach <redacted>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
---
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
By the way, what user space program do you use to dump these? Did you
derive something from Andrew's mv88e6xxx_dump too? Maybe we should work
on something common?
Actually there is no user space tooling, yet. My original approach to
debugging was different using debugfs and tracing. I played a bit with
mv88e6xxx_dump today. Having a common tool would be quite nice.
Thanks,
Kurt
From: Kurt Kanzenbach <hidden> Date: 2021-03-20 11:31:57
On Sun Mar 14 2021, Kurt Kanzenbach wrote:
On Sat Mar 13 2021, Vladimir Oltean wrote:
quoted
On Sat, Mar 13, 2021 at 10:39:39AM +0100, Kurt Kanzenbach wrote:
quoted
Allow to dump the FDB table via devlink. This is a useful debugging feature.
Signed-off-by: Kurt Kanzenbach <redacted>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
---
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
By the way, what user space program do you use to dump these? Did you
derive something from Andrew's mv88e6xxx_dump too? Maybe we should work
on something common?
Actually there is no user space tooling, yet. My original approach to
debugging was different using debugfs and tracing. I played a bit with
mv88e6xxx_dump today. Having a common tool would be quite nice.
Thanks for the pointer to mv88e6xxx_dump. Just needed to implement
.devlink_info_get() callback, so that the tool can distinguish between
the Marvell and Hellcreek devices (and implement some hellcreek
specifics).
Thanks,
Kurt