lkml.org 
[lkml]   [2017]   [Aug]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH net-next 07/11] net: dsa: debugfs: add port fdb
From
Date


On 08/14/2017 03:22 PM, Vivien Didelot wrote:
> Add a debug filesystem "fdb" entry to query a port's hardware FDB
> entries through the .port_fdb_dump switch operation.
>
> This is really convenient to query directly the hardware or inspect DSA
> or CPU links, since these ports are not exposed to userspace.
>
> # cat port1/fdb
> vid 0 12:34:56:78:90:ab static unicast
>
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
> ---
> net/dsa/debugfs.c | 36 ++++++++++++++++++++++++++++++++++++
> 1 file changed, 36 insertions(+)
>
> diff --git a/net/dsa/debugfs.c b/net/dsa/debugfs.c
> index 012fcf466cc1..8204c62dc9c1 100644
> --- a/net/dsa/debugfs.c
> +++ b/net/dsa/debugfs.c
> @@ -10,6 +10,7 @@
> */
>
> #include <linux/debugfs.h>
> +#include <linux/etherdevice.h>
> #include <linux/seq_file.h>
>
> #include "dsa_priv.h"
> @@ -109,6 +110,36 @@ static int dsa_debugfs_create_file(struct dsa_switch *ds, struct dentry *dir,
> return 0;
> }
>
> +static int dsa_debugfs_fdb_dump_cb(const unsigned char *addr, u16 vid,
> + bool is_static, void *data)
> +{
> + struct seq_file *seq = data;
> + int i;

unsigned int i?

> +
> + seq_printf(seq, "vid %d", vid);
> + for (i = 0; i < ETH_ALEN; i++)
> + seq_printf(seq, "%s%02x", i ? ":" : " ", addr[i]);

Too bad we can use %pM here, or can we?

Other than that:

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian

\
 
 \ /
  Last update: 2017-08-15 19:36    [W:0.171 / U:3.264 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site