From: Vladimir Oltean <olteanv@gmail.com>
To: Faizal Rahim <faizal.abdul.rahim@linux.intel.com>
Cc: Tony Nguyen <anthony.l.nguyen@intel.com>,
Przemek Kitszel <przemyslaw.kitszel@intel.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Jesper Dangaard Brouer <hawk@kernel.org>,
John Fastabend <john.fastabend@gmail.com>,
Vinicius Costa Gomes <vinicius.gomes@intel.com>,
intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH iwl-next 9/9] igc: Add support to get frame preemption statistics via ethtool
Date: Mon, 16 Dec 2024 18:05:13 +0200 [thread overview]
Message-ID: <20241216160513.24i4ehroff47iwzi@skbuf> (raw)
In-Reply-To: <20241216064720.931522-10-faizal.abdul.rahim@linux.intel.com>
On Mon, Dec 16, 2024 at 01:47:20AM -0500, Faizal Rahim wrote:
> Implemented "ethtool --include-statistics --show-mm" callback for IGC.
>
> Tested preemption scenario to check preemption statistics:
> 1) Trigger verification handshake on both boards:
> $ sudo ethtool --set-mm enp1s0 pmac-enabled on
> $ sudo ethtool --set-mm enp1s0 tx-enabled on
> $ sudo ethtool --set-mm enp1s0 verify-enabled on
> 2) Set preemptible or express queue in taprio for tx board:
> $ sudo tc qdisc replace dev enp1s0 parent root handle 100 taprio \
> num_tc 4 map 0 1 2 3 0 0 0 0 0 0 0 0 0 0 0 0 \
> queues 1@0 1@1 1@2 1@3 base-time 0 sched-entry S F 100000 \
> fp E E P P
Hmm, the prio_tc_map pattern changed since the last time I looked at igc
examples? It was in decreasing order before? How do you handle backwards
compatibility with the Tx ring strict priority default configuration?
I haven't downloaded the entire set locally, will do so later.
> 3) Send large size packets on preemptible queue
> 4) Send small size packets on express queue to preempt packets in
> preemptible queue
> 5) Show preemption statistics on the receiving board:
> $ ethtool --include-statistics --show-mm enp1s0
> MAC Merge layer state for enp1s0:
> pMAC enabled: on
> TX enabled: on
> TX active: on
> TX minimum fragment size: 252
> RX minimum fragment size: 252
> Verify enabled: on
> Verify time: 128
> Max verify time: 128
> Verification status: SUCCEEDED
> Statistics:
> MACMergeFrameAssErrorCount: 0
> MACMergeFrameSmdErrorCount: 0
> MACMergeFrameAssOkCount: 511
> MACMergeFragCountRx: 764
> MACMergeFragCountTx: 0
> MACMergeHoldCount: 0
>
> Co-developed-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
> Signed-off-by: Faizal Rahim <faizal.abdul.rahim@linux.intel.com>
> ---
> drivers/net/ethernet/intel/igc/igc_ethtool.c | 40 ++++++++++++++++++++
> drivers/net/ethernet/intel/igc/igc_regs.h | 19 ++++++++++
> 2 files changed, 59 insertions(+)
>
> diff --git a/drivers/net/ethernet/intel/igc/igc_ethtool.c b/drivers/net/ethernet/intel/igc/igc_ethtool.c
> index 16aa6e4e1727..90a9dbb0d901 100644
> --- a/drivers/net/ethernet/intel/igc/igc_ethtool.c
> +++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c
> @@ -1835,6 +1835,45 @@ static int igc_ethtool_set_mm(struct net_device *netdev,
> return igc_tsn_offload_apply(adapter);
> }
>
> +/**
> + * igc_ethtool_get_frame_ass_error - Get the frame assembly error count.
> + * @dev: Pointer to the net_device structure.
> + * @return: The count of frame assembly errors.
I may be wrong, but I think the syntax for kernel-doc is "Returns: "
> + */
> +static u64 igc_ethtool_get_frame_ass_error(struct net_device *dev)
> +{
> + struct igc_adapter *adapter = netdev_priv(dev);
> + u32 ooo_smdc, ooo_frame_cnt, ooo_frag_cnt; /* Out of order statistics */
> + struct igc_hw *hw = &adapter->hw;
> + u32 miss_frame_frag_cnt;
> + u32 reg_value;
> +
> + reg_value = rd32(IGC_PRMEXPRCNT);
> + ooo_smdc = reg_value & IGC_PRMEXPRCNT_OOO_SMDC;
> + ooo_frame_cnt = (reg_value & IGC_PRMEXPRCNT_OOO_FRAME_CNT)
> + >> IGC_PRMEXPRCNT_OOO_FRAME_CNT_SHIFT;
> + ooo_frag_cnt = (reg_value & IGC_PRMEXPRCNT_OOO_FRAG_CNT)
> + >> IGC_PRMEXPRCNT_OOO_FRAG_CNT_SHIFT;
> + miss_frame_frag_cnt = (reg_value & IGC_PRMEXPRCNT_MISS_FRAME_FRAG_CNT)
> + >> IGC_PRMEXPRCNT_MISS_FRAME_FRAG_CNT_SHIFT;
Candidates for FIELD_GET()?
> +
> + return ooo_smdc + ooo_frame_cnt + ooo_frag_cnt + miss_frame_frag_cnt;
> +}
> +
> +static void igc_ethtool_get_mm_stats(struct net_device *dev,
> + struct ethtool_mm_stats *stats)
> +{
> + struct igc_adapter *adapter = netdev_priv(dev);
> + struct igc_hw *hw = &adapter->hw;
> +
> + stats->MACMergeFrameAssErrorCount = igc_ethtool_get_frame_ass_error(dev);
> + stats->MACMergeFrameSmdErrorCount = 0; /* Not available in IGC */
> + stats->MACMergeFrameAssOkCount = rd32(IGC_PRMPTDRCNT);
> + stats->MACMergeFragCountRx = rd32(IGC_PRMEVNTRCNT);
> + stats->MACMergeFragCountTx = rd32(IGC_PRMEVNTTCNT);
> + stats->MACMergeHoldCount = 0; /* Not available in IGC */
Don't report counters as zero when in reality you don't know.
Just don't assign values to these. mm_prepare_data() -> ethtool_stats_init()
presets them to 0xffffffffffffffff (ETHTOOL_STAT_NOT_SET), and
mm_put_stats() -> mm_put_stat() detects whether they are still equal to
this value, and if they are, does not report netlink attributes for them.
> +}
> +
> static int igc_ethtool_get_link_ksettings(struct net_device *netdev,
> struct ethtool_link_ksettings *cmd)
> {
> @@ -2124,6 +2163,7 @@ static const struct ethtool_ops igc_ethtool_ops = {
> .get_channels = igc_ethtool_get_channels,
> .get_mm = igc_ethtool_get_mm,
> .set_mm = igc_ethtool_set_mm,
> + .get_mm_stats = igc_ethtool_get_mm_stats,
> .set_channels = igc_ethtool_set_channels,
> .get_priv_flags = igc_ethtool_get_priv_flags,
> .set_priv_flags = igc_ethtool_set_priv_flags,
> diff --git a/drivers/net/ethernet/intel/igc/igc_regs.h b/drivers/net/ethernet/intel/igc/igc_regs.h
> index 12ddc5793651..f40946cce35a 100644
> --- a/drivers/net/ethernet/intel/igc/igc_regs.h
> +++ b/drivers/net/ethernet/intel/igc/igc_regs.h
> @@ -222,6 +222,25 @@
>
> #define IGC_FTQF(_n) (0x059E0 + (4 * (_n))) /* 5-tuple Queue Fltr */
>
> +/* Time sync registers - preemption statistics */
> +#define IGC_PRMEVNTTCNT 0x04298 /* TX Preemption event counter */
> +#define IGC_PRMEVNTRCNT 0x0429C /* RX Preemption event counter */
> +#define IGC_PRMPTDRCNT 0x04284 /* Good RX Preempted Packets */
> +
> + /* Preemption Exception Counter */
> +#define IGC_PRMEXPRCNT 0x042A0
> +/* Received out of order packets with SMD-C and NOT ReumeRx */
> +#define IGC_PRMEXPRCNT_OOO_SMDC 0x000000FF
> +/* Received out of order packets with SMD-C and wrong Frame CNT */
> +#define IGC_PRMEXPRCNT_OOO_FRAME_CNT 0x0000FF00
> +#define IGC_PRMEXPRCNT_OOO_FRAME_CNT_SHIFT 8
> +/* Received out of order packets with SMD-C and wrong Frag CNT */
> +#define IGC_PRMEXPRCNT_OOO_FRAG_CNT 0x00FF0000
> +#define IGC_PRMEXPRCNT_OOO_FRAG_CNT_SHIFT 16
> +/* Received packets with SMD-S and ReumeRx */
What is ReumeRx?
> +#define IGC_PRMEXPRCNT_MISS_FRAME_FRAG_CNT 0xFF000000
> +#define IGC_PRMEXPRCNT_MISS_FRAME_FRAG_CNT_SHIFT 24
> +
> /* Transmit Scheduling Registers */
> #define IGC_TQAVCTRL 0x3570
> #define IGC_TXQCTL(_n) (0x3344 + 0x4 * (_n))
> --
> 2.25.1
>
>
next prev parent reply other threads:[~2024-12-16 16:05 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-16 6:47 [PATCH iwl-next 0/9] igc: Add support for Frame Preemption feature in IGC Faizal Rahim
2024-12-16 6:47 ` [PATCH iwl-next 1/9] igc: Rename xdp_get_tx_ring() for non-xdp usage Faizal Rahim
2024-12-16 6:47 ` [PATCH iwl-next 2/9] igc: Optimize the TX packet buffer utilization Faizal Rahim
2024-12-16 6:47 ` [PATCH iwl-next 3/9] igc: Set the RX packet buffer size for TSN mode Faizal Rahim
2024-12-16 6:47 ` [PATCH iwl-next 4/9] igc: Add support for receiving frames with all zeroes address Faizal Rahim
2024-12-16 17:26 ` Vladimir Oltean
2024-12-16 6:47 ` [PATCH iwl-next 5/9] igc: Add support to set MAC Merge data via ethtool Faizal Rahim
2024-12-16 18:13 ` Vladimir Oltean
2024-12-17 0:39 ` Vladimir Oltean
2024-12-23 9:23 ` Abdul Rahim, Faizal
2024-12-23 21:43 ` Vladimir Oltean
2024-12-16 6:47 ` [PATCH iwl-next 6/9] igc: Add support for frame preemption verification Faizal Rahim
2024-12-17 0:22 ` Vladimir Oltean
2024-12-17 8:46 ` Vladimir Oltean
2024-12-17 9:47 ` Abdul Rahim, Faizal
2024-12-17 12:09 ` Furong Xu
2024-12-19 7:24 ` Choong Yong Liang
2024-12-23 9:32 ` Abdul Rahim, Faizal
2024-12-16 6:47 ` [PATCH iwl-next 7/9] igc: Add support for preemptible traffic class in taprio Faizal Rahim
2024-12-16 6:47 ` [PATCH iwl-next 8/9] igc: Add support to get MAC Merge data via ethtool Faizal Rahim
2024-12-17 0:35 ` Vladimir Oltean
2024-12-23 9:39 ` Abdul Rahim, Faizal
2024-12-16 6:47 ` [PATCH iwl-next 9/9] igc: Add support to get frame preemption statistics " Faizal Rahim
2024-12-16 16:05 ` Vladimir Oltean [this message]
2024-12-23 9:52 ` Abdul Rahim, Faizal
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=20241216160513.24i4ehroff47iwzi@skbuf \
--to=olteanv@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=faizal.abdul.rahim@linux.intel.com \
--cc=hawk@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=vinicius.gomes@intel.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