Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753652AbdHORfz (ORCPT ); Tue, 15 Aug 2017 13:35:55 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:35440 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752293AbdHORfx (ORCPT ); Tue, 15 Aug 2017 13:35:53 -0400 Subject: Re: [PATCH net-next 07/11] net: dsa: debugfs: add port fdb To: Vivien Didelot , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com, "David S. Miller" , Andrew Lunn , Egil Hjelmeland , John Crispin , Woojung Huh , Sean Wang , Volodymyr Bendiuga , Nikita Yushchenko , Maxime Hadjinlian , Chris Healy , Maxim Uvarov , Stefan Eichenberger , Jason Cobham , Juergen Borleis , Tobias Waldekranz References: <20170814222242.10643-1-vivien.didelot@savoirfairelinux.com> <20170814222242.10643-8-vivien.didelot@savoirfairelinux.com> From: Florian Fainelli Message-ID: <1a72a0f3-c461-1099-1309-9604a990057c@gmail.com> Date: Tue, 15 Aug 2017 10:35:51 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170814222242.10643-8-vivien.didelot@savoirfairelinux.com> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1436 Lines: 53 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 > --- > 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 > +#include > #include > > #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 -- Florian