netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: Wei Fang <wei.fang@nxp.com>
Cc: claudiu.manoil@nxp.com, xiaoning.wang@nxp.com,
	andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, christophe.leroy@csgroup.eu,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	imx@lists.linux.dev, linuxppc-dev@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v4 net-next 05/14] net: enetc: add debugfs interface to dump MAC filter
Date: Mon, 17 Mar 2025 16:48:43 +0200	[thread overview]
Message-ID: <20250317144843.wp432pgodn4vjejf@skbuf> (raw)
In-Reply-To: <20250311053830.1516523-6-wei.fang@nxp.com> <20250311053830.1516523-6-wei.fang@nxp.com>

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);

  reply	other threads:[~2025-03-17 14:48 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-11  5:38 [PATCH v4 net-next 00/14] Add more feautues for ENETC v4 - round 2 Wei Fang
2025-03-11  5:38 ` [PATCH v4 net-next 01/14] net: enetc: add initial netc-lib driver to support NTMP Wei Fang
2025-03-11 12:17   ` Michal Kubiak
2025-03-13 16:35   ` Vladimir Oltean
2025-03-14  3:38     ` Wei Fang
2025-03-14 12:37       ` Vladimir Oltean
2025-03-14 13:48         ` Wei Fang
2025-03-17  9:28           ` Vladimir Oltean
2025-03-17  9:55             ` Wei Fang
2025-03-17 10:00               ` Vladimir Oltean
2025-03-17 11:39                 ` Wei Fang
2025-03-11  5:38 ` [PATCH v4 net-next 02/14] net: enetc: add command BD ring support for i.MX95 ENETC Wei Fang
2025-03-11 12:22   ` Michal Kubiak
2025-03-13 16:49   ` Vladimir Oltean
2025-03-14  4:51     ` Wei Fang
2025-03-14 11:18       ` Vladimir Oltean
2025-03-14 13:56         ` Wei Fang
2025-03-11  5:38 ` [PATCH v4 net-next 03/14] net: enetc: move generic MAC filterng interfaces to enetc-core Wei Fang
2025-03-17  9:42   ` Vladimir Oltean
2025-03-17 10:00     ` Wei Fang
2025-03-11  5:38 ` [PATCH v4 net-next 04/14] net: enetc: add MAC filter for i.MX95 ENETC PF Wei Fang
2025-03-17 14:18   ` Vladimir Oltean
2025-03-18  3:19     ` Wei Fang
2025-03-18  9:29       ` Vladimir Oltean
2025-03-18  9:48         ` Wei Fang
2025-03-18  8:08     ` Claudiu Manoil
2025-03-18  8:47       ` Vladimir Oltean
2025-03-11  5:38 ` [PATCH v4 net-next 05/14] net: enetc: add debugfs interface to dump MAC filter Wei Fang
2025-03-17 14:48   ` Vladimir Oltean [this message]
2025-03-18  3:28     ` Wei Fang
2025-03-18 14:54       ` Vladimir Oltean
2025-03-11  5:38 ` [PATCH v4 net-next 06/14] net: enetc: add set/get_rss_table() to enetc_si_ops Wei Fang
2025-03-17 16:42   ` Vladimir Oltean
2025-03-18  5:06     ` Wei Fang
2025-03-11  5:38 ` [PATCH v4 net-next 07/14] net: enetc: make enetc_set_rss_key() reusable Wei Fang
2025-03-17 16:26   ` Vladimir Oltean
2025-03-18  4:54     ` Wei Fang
2025-03-11  5:38 ` [PATCH v4 net-next 08/14] net: enetc: add RSS support for i.MX95 ENETC PF Wei Fang
2025-03-17 15:55   ` Vladimir Oltean
2025-03-18  4:47     ` Wei Fang
2025-03-18 11:43       ` Vladimir Oltean
2025-03-18 14:00         ` Wei Fang
2025-03-11  5:38 ` [PATCH v4 net-next 09/14] net: enetc: enable RSS feature by default Wei Fang
2025-03-17 16:33   ` Vladimir Oltean
2025-03-18  5:00     ` Wei Fang
2025-03-11  5:38 ` [PATCH v4 net-next 10/14] net: enetc: move generic VLAN filter interfaces to enetc-core Wei Fang
2025-03-17 17:05   ` Vladimir Oltean
2025-03-18  5:12     ` Wei Fang
2025-03-11  5:38 ` [PATCH v4 net-next 11/14] net: enetc: move generic VLAN hash filter functions to enetc_pf_common.c Wei Fang
2025-03-18 10:21   ` Vladimir Oltean
2025-03-18 13:57     ` Wei Fang
2025-03-11  5:38 ` [PATCH v4 net-next 12/14] net: enetc: add VLAN filtering support for i.MX95 ENETC PF Wei Fang
2025-03-11  5:38 ` [PATCH v4 net-next 13/14] net: enetc: add loopback " Wei Fang
2025-03-11  5:38 ` [PATCH v4 net-next 14/14] MAINTAINERS: add new file ntmp.h to ENETC driver Wei Fang
2025-03-17 17:06   ` Vladimir Oltean
2025-03-18  5:13     ` Wei Fang
2025-03-13 13:50 ` [PATCH v4 net-next 00/14] Add more feautues for ENETC v4 - round 2 Vladimir Oltean
2025-03-14  1:28   ` Wei Fang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250317144843.wp432pgodn4vjejf@skbuf \
    --to=vladimir.oltean@nxp.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=christophe.leroy@csgroup.eu \
    --cc=claudiu.manoil@nxp.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=imx@lists.linux.dev \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=wei.fang@nxp.com \
    --cc=xiaoning.wang@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).