[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250317144843.wp432pgodn4vjejf@skbuf>
Date: Mon, 17 Mar 2025 16:48:43 +0200
From: Vladimir Oltean <vladimir.oltean@....com>
To: Wei Fang <wei.fang@....com>
Cc: claudiu.manoil@....com, xiaoning.wang@....com, andrew+netdev@...n.ch,
davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, christophe.leroy@...roup.eu,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
imx@...ts.linux.dev, linuxppc-dev@...ts.ozlabs.org,
linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH v4 net-next 05/14] net: enetc: add debugfs interface to
dump MAC filter
On Tue, Mar 11, 2025 at 01:38:21PM +0800, Wei Fang wrote:
> diff --git a/drivers/net/ethernet/freescale/enetc/enetc4_debugfs.c b/drivers/net/ethernet/freescale/enetc/enetc4_debugfs.c
> new file mode 100644
> index 000000000000..3a660c80344a
> --- /dev/null
> +++ b/drivers/net/ethernet/freescale/enetc/enetc4_debugfs.c
> @@ -0,0 +1,93 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/* Copyright 2025 NXP */
> +
> +#include <linux/device.h>
> +#include <linux/debugfs.h>
> +#include <linux/seq_file.h>
> +
> +#include "enetc_pf.h"
> +#include "enetc4_debugfs.h"
> +
> +#define is_en(x) (x) ? "Enabled" : "Disabled"
str_enabled_disabled()
> +
> +static void enetc_show_si_mac_hash_filter(struct seq_file *s, int i)
> +{
> + struct enetc_si *si = s->private;
> + struct enetc_hw *hw = &si->hw;
> + u32 hash_h, hash_l;
> +
> + hash_l = enetc_port_rd(hw, ENETC4_PSIUMHFR0(i));
> + hash_h = enetc_port_rd(hw, ENETC4_PSIUMHFR1(i));
> + seq_printf(s, "SI %d unicast MAC hash filter: 0x%08x%08x\n",
> + i, hash_h, hash_l);
Maybe the ":" separator between the high and low 32 bits is clearer than "x".
> +
> + hash_l = enetc_port_rd(hw, ENETC4_PSIMMHFR0(i));
> + hash_h = enetc_port_rd(hw, ENETC4_PSIMMHFR1(i));
> + seq_printf(s, "SI %d multicast MAC hash filter: 0x%08x%08x\n",
> + i, hash_h, hash_l);
> +}
> +
> +static int enetc_mac_filter_show(struct seq_file *s, void *data)
> +{
> + struct maft_entry_data maft_data;
> + struct enetc_si *si = s->private;
> + struct enetc_hw *hw = &si->hw;
> + struct maft_keye_data *keye;
> + struct enetc_pf *pf;
> + int i, err, num_si;
> + u32 val;
> +
> + pf = enetc_si_priv(si);
> + num_si = pf->caps.num_vsi + 1;
> +
> + val = enetc_port_rd(hw, ENETC4_PSIPMMR);
> + for (i = 0; i < num_si; i++) {
> + seq_printf(s, "SI %d Unicast Promiscuous mode: %s\n",
> + i, is_en(PSIPMMR_SI_MAC_UP(i) & val));
> + seq_printf(s, "SI %d Multicast Promiscuous mode: %s\n",
> + i, is_en(PSIPMMR_SI_MAC_MP(i) & val));
> + }
> +
> + /* MAC hash filter table */
> + for (i = 0; i < num_si; i++)
> + enetc_show_si_mac_hash_filter(s, i);
> +
> + if (!pf->num_mfe)
> + return 0;
> +
> + /* MAC address filter table */
> + seq_puts(s, "Show MAC address filter table\n");
The word "show" seems superfluous.
> + for (i = 0; i < pf->num_mfe; i++) {
> + memset(&maft_data, 0, sizeof(maft_data));
> + err = ntmp_maft_query_entry(&si->ntmp.cbdrs, i, &maft_data);
> + if (err)
> + return err;
> +
> + keye = &maft_data.keye;
> + seq_printf(s, "Entry %d, MAC: %pM, SI bitmap: 0x%04x\n", i,
> + keye->mac_addr, le16_to_cpu(maft_data.cfge.si_bitmap));
> + }
> +
> + return 0;
> +}
> +DEFINE_SHOW_ATTRIBUTE(enetc_mac_filter);
Powered by blists - more mailing lists