* [PATCH iwl-next v1 1/5] net: docs: add missing features that can have stats
2024-06-04 22:13 [PATCH iwl-next v1 0/5] ice: add standard stats Jesse Brandeburg
@ 2024-06-04 22:13 ` Jesse Brandeburg
2024-06-04 22:19 ` Rahul Rameshbabu
2024-06-06 0:48 ` Jakub Kicinski
2024-06-04 22:13 ` [PATCH iwl-next v1 2/5] ice: implement ethtool standard stats Jesse Brandeburg
` (4 subsequent siblings)
5 siblings, 2 replies; 13+ messages in thread
From: Jesse Brandeburg @ 2024-06-04 22:13 UTC (permalink / raw)
To: netdev, intel-wired-lan
Cc: Jesse Brandeburg, corbet, linux-doc, Rahul Rameshbabu,
Jacob Keller
While trying to figure out ethtool -I | --include-statistics, I noticed
some docs got missed when implementing commit 0e9c127729be ("ethtool:
add interface to read Tx hardware timestamping statistics").
Fix up the docs to match the kernel code, and while there, sort them in
alphabetical order.
Cc: Rahul Rameshbabu <rrameshbabu@nvidia.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
---
I didn't add a Fixes: tag because this is not an urgent kind of fix that
should require backports.
---
Documentation/networking/statistics.rst | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/Documentation/networking/statistics.rst b/Documentation/networking/statistics.rst
index 75e017dfa825..22503a90e369 100644
--- a/Documentation/networking/statistics.rst
+++ b/Documentation/networking/statistics.rst
@@ -184,9 +184,11 @@ Protocol-related statistics can be requested in get commands by setting
the `ETHTOOL_FLAG_STATS` flag in `ETHTOOL_A_HEADER_FLAGS`. Currently
statistics are supported in the following commands:
- - `ETHTOOL_MSG_PAUSE_GET`
- `ETHTOOL_MSG_FEC_GET`
+ - 'ETHTOOL_MSG_LINKSTATE_GET'
- `ETHTOOL_MSG_MM_GET`
+ - `ETHTOOL_MSG_PAUSE_GET`
+ - 'ETHTOOL_MSG_TSINFO_GET'
debugfs
-------
--
2.43.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH iwl-next v1 1/5] net: docs: add missing features that can have stats
2024-06-04 22:13 ` [PATCH iwl-next v1 1/5] net: docs: add missing features that can have stats Jesse Brandeburg
@ 2024-06-04 22:19 ` Rahul Rameshbabu
2024-06-06 0:48 ` Jakub Kicinski
1 sibling, 0 replies; 13+ messages in thread
From: Rahul Rameshbabu @ 2024-06-04 22:19 UTC (permalink / raw)
To: Jesse Brandeburg; +Cc: netdev, intel-wired-lan, corbet, linux-doc, Jacob Keller
On Tue, 04 Jun, 2024 15:13:21 -0700 Jesse Brandeburg <jesse.brandeburg@intel.com> wrote:
> While trying to figure out ethtool -I | --include-statistics, I noticed
> some docs got missed when implementing commit 0e9c127729be ("ethtool:
> add interface to read Tx hardware timestamping statistics").
>
> Fix up the docs to match the kernel code, and while there, sort them in
> alphabetical order.
>
> Cc: Rahul Rameshbabu <rrameshbabu@nvidia.com>
> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
> Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
> ---
> I didn't add a Fixes: tag because this is not an urgent kind of fix that
> should require backports.
> ---
> Documentation/networking/statistics.rst | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/networking/statistics.rst b/Documentation/networking/statistics.rst
> index 75e017dfa825..22503a90e369 100644
> --- a/Documentation/networking/statistics.rst
> +++ b/Documentation/networking/statistics.rst
> @@ -184,9 +184,11 @@ Protocol-related statistics can be requested in get commands by setting
> the `ETHTOOL_FLAG_STATS` flag in `ETHTOOL_A_HEADER_FLAGS`. Currently
> statistics are supported in the following commands:
>
> - - `ETHTOOL_MSG_PAUSE_GET`
> - `ETHTOOL_MSG_FEC_GET`
> + - 'ETHTOOL_MSG_LINKSTATE_GET'
> - `ETHTOOL_MSG_MM_GET`
> + - `ETHTOOL_MSG_PAUSE_GET`
> + - 'ETHTOOL_MSG_TSINFO_GET'
>
> debugfs
> -------
Thanks for catching this.
Reviewed-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH iwl-next v1 1/5] net: docs: add missing features that can have stats
2024-06-04 22:13 ` [PATCH iwl-next v1 1/5] net: docs: add missing features that can have stats Jesse Brandeburg
2024-06-04 22:19 ` Rahul Rameshbabu
@ 2024-06-06 0:48 ` Jakub Kicinski
2024-06-06 16:28 ` Jesse Brandeburg
2024-06-06 16:56 ` Jacob Keller
1 sibling, 2 replies; 13+ messages in thread
From: Jakub Kicinski @ 2024-06-06 0:48 UTC (permalink / raw)
To: Jesse Brandeburg
Cc: netdev, intel-wired-lan, corbet, linux-doc, Rahul Rameshbabu,
Jacob Keller
On Tue, 4 Jun 2024 15:13:21 -0700 Jesse Brandeburg wrote:
> - - `ETHTOOL_MSG_PAUSE_GET`
> - `ETHTOOL_MSG_FEC_GET`
> + - 'ETHTOOL_MSG_LINKSTATE_GET'
> - `ETHTOOL_MSG_MM_GET`
> + - `ETHTOOL_MSG_PAUSE_GET`
> + - 'ETHTOOL_MSG_TSINFO_GET'
I was going to steal this directly but:
` vs '
so I'll let it go via the Intel tree :)
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH iwl-next v1 1/5] net: docs: add missing features that can have stats
2024-06-06 0:48 ` Jakub Kicinski
@ 2024-06-06 16:28 ` Jesse Brandeburg
2024-06-06 16:56 ` Jacob Keller
1 sibling, 0 replies; 13+ messages in thread
From: Jesse Brandeburg @ 2024-06-06 16:28 UTC (permalink / raw)
To: Jakub Kicinski
Cc: netdev, intel-wired-lan, corbet, linux-doc, Rahul Rameshbabu,
Jacob Keller
On 6/5/2024 5:48 PM, Jakub Kicinski wrote:
> On Tue, 4 Jun 2024 15:13:21 -0700 Jesse Brandeburg wrote:
>> - - `ETHTOOL_MSG_PAUSE_GET`
>> - `ETHTOOL_MSG_FEC_GET`
>> + - 'ETHTOOL_MSG_LINKSTATE_GET'
>> - `ETHTOOL_MSG_MM_GET`
>> + - `ETHTOOL_MSG_PAUSE_GET`
>> + - 'ETHTOOL_MSG_TSINFO_GET'
>
> I was going to steal this directly but:
> ` vs '
> so I'll let it go via the Intel tree :)
>
Thank you Jakub, I had to stare really deeply at that comment to
understand "backtick vs single-quote" as for the longest time I couldn't
understand why you were quoting the word "vs" - sheesh :-)
I didn't even know/remember the docs required backticks vs some other
quote looking thing, it never even occurred to me, so thanks for calling
that out.
I'll send a v2 with the fix so Jake can pick it up while Tony is out.
-Jesse
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH iwl-next v1 1/5] net: docs: add missing features that can have stats
2024-06-06 0:48 ` Jakub Kicinski
2024-06-06 16:28 ` Jesse Brandeburg
@ 2024-06-06 16:56 ` Jacob Keller
1 sibling, 0 replies; 13+ messages in thread
From: Jacob Keller @ 2024-06-06 16:56 UTC (permalink / raw)
To: Jakub Kicinski, Jesse Brandeburg
Cc: netdev, intel-wired-lan, corbet, linux-doc, Rahul Rameshbabu
On 6/5/2024 5:48 PM, Jakub Kicinski wrote:
> On Tue, 4 Jun 2024 15:13:21 -0700 Jesse Brandeburg wrote:
>> - - `ETHTOOL_MSG_PAUSE_GET`
>> - `ETHTOOL_MSG_FEC_GET`
>> + - 'ETHTOOL_MSG_LINKSTATE_GET'
>> - `ETHTOOL_MSG_MM_GET`
>> + - `ETHTOOL_MSG_PAUSE_GET`
>> + - 'ETHTOOL_MSG_TSINFO_GET'
>
> I was going to steal this directly but:
> ` vs '
> so I'll let it go via the Intel tree :)
Yea, this needs to be consistently ` here for rST formatting to match.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH iwl-next v1 2/5] ice: implement ethtool standard stats
2024-06-04 22:13 [PATCH iwl-next v1 0/5] ice: add standard stats Jesse Brandeburg
2024-06-04 22:13 ` [PATCH iwl-next v1 1/5] net: docs: add missing features that can have stats Jesse Brandeburg
@ 2024-06-04 22:13 ` Jesse Brandeburg
2024-06-04 22:13 ` [PATCH iwl-next v1 3/5] ice: add tracking of good transmit timestamps Jesse Brandeburg
` (3 subsequent siblings)
5 siblings, 0 replies; 13+ messages in thread
From: Jesse Brandeburg @ 2024-06-04 22:13 UTC (permalink / raw)
To: netdev, intel-wired-lan; +Cc: Jesse Brandeburg, corbet, linux-doc, Jacob Keller
Add support for MAC/pause/RMON stats. This enables reporting hardware
statistics in a common way via:
ethtool -S eth0 --all-groups
and
ethtool --include-statistics --show-pause eth0
While doing so, add support for one new stat, receive length error
(RLEC), which is extremely unlikely to happen since most L2 frames have
a type/length field specifying a "type", and raw ethernet frames aren't
used much any longer.
NOTE: I didn't implement Ctrl aka control frame stats because the
hardware doesn't seem to implement support.
Reviewed-by: Marcin Szycik <marcin.szycik@linux.intel.co
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
---
Example output:
Standard stats for ens785f1np1:
eth-mac-FramesTransmittedOK: 296
eth-mac-FramesReceivedOK: 339
eth-mac-FrameCheckSequenceErrors: 0
eth-mac-OctetsTransmittedOK: 70410
eth-mac-OctetsReceivedOK: 51414
eth-mac-MulticastFramesXmittedOK: 124
eth-mac-BroadcastFramesXmittedOK: 1
eth-mac-MulticastFramesReceivedOK: 164
eth-mac-BroadcastFramesReceivedOK: 3
eth-mac-InRangeLengthErrors: 0
eth-mac-FrameTooLongErrors: 0
rmon-etherStatsUndersizePkts: 0
rmon-etherStatsOversizePkts: 0
rmon-etherStatsFragments: 0
rmon-etherStatsJabbers: 0
rx-rmon-etherStatsPkts64Octets: 31
rx-rmon-etherStatsPkts65to127Octets: 265
rx-rmon-etherStatsPkts128to255Octets: 26
rx-rmon-etherStatsPkts256to511Octets: 7
rx-rmon-etherStatsPkts512to1023Octets: 1
rx-rmon-etherStatsPkts1024to1522Octets: 6
rx-rmon-etherStatsPkts1523to9522Octets: 3
tx-rmon-etherStatsPkts64Octets: 25
tx-rmon-etherStatsPkts65to127Octets: 255
tx-rmon-etherStatsPkts128to255Octets: 1
tx-rmon-etherStatsPkts256to511Octets: 2
tx-rmon-etherStatsPkts512to1023Octets: 1
tx-rmon-etherStatsPkts1024to1522Octets: 1
tx-rmon-etherStatsPkts1523to9522Octets: 11
and
Pause parameters for ens785f0np0:
Autonegotiate: on
RX: off
TX: off
RX negotiated: off
TX negotiated: off
Statistics:
tx_pause_frames: 0
rx_pause_frames: 0
---
drivers/net/ethernet/intel/ice/ice_ethtool.c | 78 ++++++++++++++++++++
drivers/net/ethernet/intel/ice/ice_main.c | 3 +
drivers/net/ethernet/intel/ice/ice_type.h | 1 +
3 files changed, 82 insertions(+)
diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c
index 62c8205fceba..6f0a857f55c9 100644
--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
@@ -4282,6 +4282,81 @@ ice_get_module_eeprom(struct net_device *netdev,
return 0;
}
+static void ice_get_eth_mac_stats(struct net_device *netdev,
+ struct ethtool_eth_mac_stats *mac_stats)
+{
+ struct ice_pf *pf = ice_netdev_to_pf(netdev);
+ struct ice_hw_port_stats *ps = &pf->stats;
+
+ mac_stats->FramesTransmittedOK = ps->eth.tx_unicast +
+ ps->eth.tx_multicast +
+ ps->eth.tx_broadcast;
+ mac_stats->FramesReceivedOK = ps->eth.rx_unicast +
+ ps->eth.rx_multicast +
+ ps->eth.rx_broadcast;
+ mac_stats->FrameCheckSequenceErrors = ps->crc_errors;
+ mac_stats->OctetsTransmittedOK = ps->eth.tx_bytes;
+ mac_stats->OctetsReceivedOK = ps->eth.rx_bytes;
+ mac_stats->MulticastFramesXmittedOK = ps->eth.tx_multicast;
+ mac_stats->BroadcastFramesXmittedOK = ps->eth.tx_broadcast;
+ mac_stats->MulticastFramesReceivedOK = ps->eth.rx_multicast;
+ mac_stats->BroadcastFramesReceivedOK = ps->eth.rx_broadcast;
+ mac_stats->InRangeLengthErrors = ps->rx_len_errors;
+ mac_stats->FrameTooLongErrors = ps->rx_oversize;
+}
+
+static void ice_get_pause_stats(struct net_device *netdev,
+ struct ethtool_pause_stats *pause_stats)
+{
+ struct ice_pf *pf = ice_netdev_to_pf(netdev);
+ struct ice_hw_port_stats *ps = &pf->stats;
+
+ pause_stats->tx_pause_frames = ps->link_xon_tx + ps->link_xoff_tx;
+ pause_stats->rx_pause_frames = ps->link_xon_rx + ps->link_xoff_rx;
+}
+
+static const struct ethtool_rmon_hist_range ice_rmon_ranges[] = {
+ { 0, 64 },
+ { 65, 127 },
+ { 128, 255 },
+ { 256, 511 },
+ { 512, 1023 },
+ { 1024, 1522 },
+ { 1523, 9522 },
+ {}
+};
+
+static void ice_get_rmon_stats(struct net_device *netdev,
+ struct ethtool_rmon_stats *rmon,
+ const struct ethtool_rmon_hist_range **ranges)
+{
+ struct ice_pf *pf = ice_netdev_to_pf(netdev);
+ struct ice_hw_port_stats *ps = &pf->stats;
+
+ rmon->undersize_pkts = ps->rx_undersize;
+ rmon->oversize_pkts = ps->rx_oversize;
+ rmon->fragments = ps->rx_fragments;
+ rmon->jabbers = ps->rx_jabber;
+
+ rmon->hist[0] = ps->rx_size_64;
+ rmon->hist[1] = ps->rx_size_127;
+ rmon->hist[2] = ps->rx_size_255;
+ rmon->hist[3] = ps->rx_size_511;
+ rmon->hist[4] = ps->rx_size_1023;
+ rmon->hist[5] = ps->rx_size_1522;
+ rmon->hist[6] = ps->rx_size_big;
+
+ rmon->hist_tx[0] = ps->tx_size_64;
+ rmon->hist_tx[1] = ps->tx_size_127;
+ rmon->hist_tx[2] = ps->tx_size_255;
+ rmon->hist_tx[3] = ps->tx_size_511;
+ rmon->hist_tx[4] = ps->tx_size_1023;
+ rmon->hist_tx[5] = ps->tx_size_1522;
+ rmon->hist_tx[6] = ps->tx_size_big;
+
+ *ranges = ice_rmon_ranges;
+}
+
static const struct ethtool_ops ice_ethtool_ops = {
.cap_rss_ctx_supported = true,
.supported_coalesce_params = ETHTOOL_COALESCE_USECS |
@@ -4329,6 +4404,9 @@ static const struct ethtool_ops ice_ethtool_ops = {
.set_fecparam = ice_set_fecparam,
.get_module_info = ice_get_module_info,
.get_module_eeprom = ice_get_module_eeprom,
+ .get_eth_mac_stats = ice_get_eth_mac_stats,
+ .get_pause_stats = ice_get_pause_stats,
+ .get_rmon_stats = ice_get_rmon_stats,
};
static const struct ethtool_ops ice_ethtool_safe_mode_ops = {
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index f60c022f7960..4db3a6056f41 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -7034,6 +7034,9 @@ void ice_update_pf_stats(struct ice_pf *pf)
&prev_ps->mac_remote_faults,
&cur_ps->mac_remote_faults);
+ ice_stat_update32(hw, GLPRT_RLEC(port), pf->stat_prev_loaded,
+ &prev_ps->rx_len_errors, &cur_ps->rx_len_errors);
+
ice_stat_update32(hw, GLPRT_RUC(port), pf->stat_prev_loaded,
&prev_ps->rx_undersize, &cur_ps->rx_undersize);
diff --git a/drivers/net/ethernet/intel/ice/ice_type.h b/drivers/net/ethernet/intel/ice/ice_type.h
index f0796a93f428..b156d01196e2 100644
--- a/drivers/net/ethernet/intel/ice/ice_type.h
+++ b/drivers/net/ethernet/intel/ice/ice_type.h
@@ -1007,6 +1007,7 @@ struct ice_hw_port_stats {
u64 error_bytes; /* errbc */
u64 mac_local_faults; /* mlfc */
u64 mac_remote_faults; /* mrfc */
+ u64 rx_len_errors; /* rlec */
u64 link_xon_rx; /* lxonrxc */
u64 link_xoff_rx; /* lxoffrxc */
u64 link_xon_tx; /* lxontxc */
--
2.43.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH iwl-next v1 3/5] ice: add tracking of good transmit timestamps
2024-06-04 22:13 [PATCH iwl-next v1 0/5] ice: add standard stats Jesse Brandeburg
2024-06-04 22:13 ` [PATCH iwl-next v1 1/5] net: docs: add missing features that can have stats Jesse Brandeburg
2024-06-04 22:13 ` [PATCH iwl-next v1 2/5] ice: implement ethtool standard stats Jesse Brandeburg
@ 2024-06-04 22:13 ` Jesse Brandeburg
2024-06-04 22:13 ` [PATCH iwl-next v1 4/5] ice: implement transmit hardware timestamp statistics Jesse Brandeburg
` (2 subsequent siblings)
5 siblings, 0 replies; 13+ messages in thread
From: Jesse Brandeburg @ 2024-06-04 22:13 UTC (permalink / raw)
To: netdev, intel-wired-lan; +Cc: Jesse Brandeburg, corbet, linux-doc, Jacob Keller
As a pre-requisite to implementing timestamp statistics, start tracking
successful PTP timestamps. There already existed a trace event, but
add a counter as well so it can be displayed by the next patch.
Good count is a u64 as it is much more likely to be incremented. The
existing error stats are all u32 as before, and are less likely so will
wrap less.
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
---
drivers/net/ethernet/intel/ice/ice_ptp.c | 9 +++++++++
drivers/net/ethernet/intel/ice/ice_ptp.h | 1 +
2 files changed, 10 insertions(+)
diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c
index 0f17fc1181d2..ff0ba81d0694 100644
--- a/drivers/net/ethernet/intel/ice/ice_ptp.c
+++ b/drivers/net/ethernet/intel/ice/ice_ptp.c
@@ -628,6 +628,9 @@ void ice_ptp_complete_tx_single_tstamp(struct ice_ptp_tx *tx)
if (tstamp) {
shhwtstamps.hwtstamp = ns_to_ktime(tstamp);
ice_trace(tx_tstamp_complete, skb, idx);
+
+ /* Count the number of Tx timestamps that succeeded */
+ pf->ptp.tx_hwtstamp_good++;
}
skb_tstamp_tx(skb, &shhwtstamps);
@@ -686,6 +689,7 @@ static void ice_ptp_process_tx_tstamp(struct ice_ptp_tx *tx)
{
struct ice_ptp_port *ptp_port;
unsigned long flags;
+ u32 tstamp_good = 0;
struct ice_pf *pf;
struct ice_hw *hw;
u64 tstamp_ready;
@@ -786,11 +790,16 @@ static void ice_ptp_process_tx_tstamp(struct ice_ptp_tx *tx)
if (tstamp) {
shhwtstamps.hwtstamp = ns_to_ktime(tstamp);
ice_trace(tx_tstamp_complete, skb, idx);
+
+ /* Count the number of Tx timestamps that succeeded */
+ tstamp_good++;
}
skb_tstamp_tx(skb, &shhwtstamps);
dev_kfree_skb_any(skb);
}
+
+ pf->ptp.tx_hwtstamp_good += tstamp_good;
}
/**
diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.h b/drivers/net/ethernet/intel/ice/ice_ptp.h
index 3af20025043a..2b15f2b58789 100644
--- a/drivers/net/ethernet/intel/ice/ice_ptp.h
+++ b/drivers/net/ethernet/intel/ice/ice_ptp.h
@@ -253,6 +253,7 @@ struct ice_ptp {
struct ptp_clock *clock;
struct hwtstamp_config tstamp_config;
u64 reset_time;
+ u64 tx_hwtstamp_good;
u32 tx_hwtstamp_skipped;
u32 tx_hwtstamp_timeouts;
u32 tx_hwtstamp_flushed;
--
2.43.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH iwl-next v1 4/5] ice: implement transmit hardware timestamp statistics
2024-06-04 22:13 [PATCH iwl-next v1 0/5] ice: add standard stats Jesse Brandeburg
` (2 preceding siblings ...)
2024-06-04 22:13 ` [PATCH iwl-next v1 3/5] ice: add tracking of good transmit timestamps Jesse Brandeburg
@ 2024-06-04 22:13 ` Jesse Brandeburg
2024-06-06 9:42 ` Hariprasad Kelam
2024-06-04 22:13 ` [PATCH iwl-next v1 5/5] ice: refactor to use helpers Jesse Brandeburg
2024-06-06 0:50 ` [PATCH iwl-next v1 0/5] ice: add standard stats Jakub Kicinski
5 siblings, 1 reply; 13+ messages in thread
From: Jesse Brandeburg @ 2024-06-04 22:13 UTC (permalink / raw)
To: netdev, intel-wired-lan; +Cc: Jesse Brandeburg, corbet, linux-doc, Jacob Keller
The kernel now has common statistics for transmit timestamps, so
implement them in the ice driver.
use via
ethtool -I -T eth0
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
---
$ sudo ethtool -I -T eth0
Time stamping parameters for eth0:
Capabilities:
hardware-transmit
software-transmit
hardware-receive
software-receive
software-system-clock
hardware-raw-clock
PTP Hardware Clock: 0
Hardware Transmit Timestamp Modes:
off
on
Hardware Receive Filter Modes:
none
all
Statistics:
tx_pkts: 17
tx_lost: 0
tx_err: 0
---
drivers/net/ethernet/intel/ice/ice_ethtool.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c
index 6f0a857f55c9..97a7a0632a1d 100644
--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
@@ -4357,6 +4357,23 @@ static void ice_get_rmon_stats(struct net_device *netdev,
*ranges = ice_rmon_ranges;
}
+/* ice_get_ts_stats - provide timestamping stats
+ * @netdev: the netdevice pointer from ethtool
+ * @ts_stats: the ethtool data structure to fill in
+ */
+static void ice_get_ts_stats(struct net_device *netdev,
+ struct ethtool_ts_stats *ts_stats)
+{
+ struct ice_pf *pf = ice_netdev_to_pf(netdev);
+ struct ice_ptp *ptp = &pf->ptp;
+
+ ts_stats->pkts = ptp->tx_hwtstamp_good;
+ ts_stats->err = ptp->tx_hwtstamp_skipped +
+ ptp->tx_hwtstamp_flushed +
+ ptp->tx_hwtstamp_discarded;
+ ts_stats->lost = ptp->tx_hwtstamp_timeouts;
+}
+
static const struct ethtool_ops ice_ethtool_ops = {
.cap_rss_ctx_supported = true,
.supported_coalesce_params = ETHTOOL_COALESCE_USECS |
@@ -4407,6 +4424,7 @@ static const struct ethtool_ops ice_ethtool_ops = {
.get_eth_mac_stats = ice_get_eth_mac_stats,
.get_pause_stats = ice_get_pause_stats,
.get_rmon_stats = ice_get_rmon_stats,
+ .get_ts_stats = ice_get_ts_stats,
};
static const struct ethtool_ops ice_ethtool_safe_mode_ops = {
--
2.43.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH iwl-next v1 4/5] ice: implement transmit hardware timestamp statistics
2024-06-04 22:13 ` [PATCH iwl-next v1 4/5] ice: implement transmit hardware timestamp statistics Jesse Brandeburg
@ 2024-06-06 9:42 ` Hariprasad Kelam
0 siblings, 0 replies; 13+ messages in thread
From: Hariprasad Kelam @ 2024-06-06 9:42 UTC (permalink / raw)
To: Jesse Brandeburg, netdev@vger.kernel.org,
intel-wired-lan@lists.osuosl.org
Cc: corbet@lwn.net, linux-doc@vger.kernel.org, Jacob Keller
> The kernel now has common statistics for transmit timestamps, so implement
> them in the ice driver.
>
> use via
> ethtool -I -T eth0
>
> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
> Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
> ---
>
> $ sudo ethtool -I -T eth0
> Time stamping parameters for eth0:
> Capabilities:
> hardware-transmit
> software-transmit
> hardware-receive
> software-receive
> software-system-clock
> hardware-raw-clock
> PTP Hardware Clock: 0
> Hardware Transmit Timestamp Modes:
> off
> on
> Hardware Receive Filter Modes:
> none
> all
> Statistics:
> tx_pkts: 17
> tx_lost: 0
> tx_err: 0
> ---
> drivers/net/ethernet/intel/ice/ice_ethtool.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c
> b/drivers/net/ethernet/intel/ice/ice_ethtool.c
> index 6f0a857f55c9..97a7a0632a1d 100644
> --- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
> +++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
> @@ -4357,6 +4357,23 @@ static void ice_get_rmon_stats(struct net_device
> *netdev,
> *ranges = ice_rmon_ranges;
> }
>
> +/* ice_get_ts_stats - provide timestamping stats
> + * @netdev: the netdevice pointer from ethtool
> + * @ts_stats: the ethtool data structure to fill in */ static void
> +ice_get_ts_stats(struct net_device *netdev,
> + struct ethtool_ts_stats *ts_stats) {
> + struct ice_pf *pf = ice_netdev_to_pf(netdev);
> + struct ice_ptp *ptp = &pf->ptp;
> +
> + ts_stats->pkts = ptp->tx_hwtstamp_good;
> + ts_stats->err = ptp->tx_hwtstamp_skipped +
> + ptp->tx_hwtstamp_flushed +
> + ptp->tx_hwtstamp_discarded;
> + ts_stats->lost = ptp->tx_hwtstamp_timeouts; }
> +
> static const struct ethtool_ops ice_ethtool_ops = {
> .cap_rss_ctx_supported = true,
> .supported_coalesce_params = ETHTOOL_COALESCE_USECS | @@ -
> 4407,6 +4424,7 @@ static const struct ethtool_ops ice_ethtool_ops = {
> .get_eth_mac_stats = ice_get_eth_mac_stats,
> .get_pause_stats = ice_get_pause_stats,
> .get_rmon_stats = ice_get_rmon_stats,
> + .get_ts_stats = ice_get_ts_stats,
> };
>
> static const struct ethtool_ops ice_ethtool_safe_mode_ops = {
> --
> 2.43.0
>
Reviewed-by: Hariprasad Kelam <hkelam@marvell.com>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH iwl-next v1 5/5] ice: refactor to use helpers
2024-06-04 22:13 [PATCH iwl-next v1 0/5] ice: add standard stats Jesse Brandeburg
` (3 preceding siblings ...)
2024-06-04 22:13 ` [PATCH iwl-next v1 4/5] ice: implement transmit hardware timestamp statistics Jesse Brandeburg
@ 2024-06-04 22:13 ` Jesse Brandeburg
2024-06-05 4:01 ` [Intel-wired-lan] " Przemek Kitszel
2024-06-06 0:50 ` [PATCH iwl-next v1 0/5] ice: add standard stats Jakub Kicinski
5 siblings, 1 reply; 13+ messages in thread
From: Jesse Brandeburg @ 2024-06-04 22:13 UTC (permalink / raw)
To: netdev, intel-wired-lan; +Cc: Jesse Brandeburg, corbet, linux-doc, Jacob Keller
Use the ice_netdev_to_pf() helper in more places and remove a bunch of
boilerplate code. Not every instance could be replaced due to use of the
netdev_priv() output or the vsi variable within a bunch of functions.
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
---
drivers/net/ethernet/intel/ice/ice_ethtool.c | 42 ++++++-------------
.../net/ethernet/intel/ice/ice_flex_pipe.c | 8 +---
drivers/net/ethernet/intel/ice/ice_lag.c | 5 +--
drivers/net/ethernet/intel/ice/ice_main.c | 7 +---
drivers/net/ethernet/intel/ice/ice_sriov.c | 3 +-
5 files changed, 19 insertions(+), 46 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c
index 97a7a0632a1d..2d307e7d9863 100644
--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
@@ -469,8 +469,7 @@ static int ice_get_regs_len(struct net_device __always_unused *netdev)
static void
ice_get_regs(struct net_device *netdev, struct ethtool_regs *regs, void *p)
{
- struct ice_netdev_priv *np = netdev_priv(netdev);
- struct ice_pf *pf = np->vsi->back;
+ struct ice_pf *pf = ice_netdev_to_pf(netdev);
struct ice_hw *hw = &pf->hw;
u32 *regs_buf = (u32 *)p;
unsigned int i;
@@ -483,8 +482,7 @@ ice_get_regs(struct net_device *netdev, struct ethtool_regs *regs, void *p)
static u32 ice_get_msglevel(struct net_device *netdev)
{
- struct ice_netdev_priv *np = netdev_priv(netdev);
- struct ice_pf *pf = np->vsi->back;
+ struct ice_pf *pf = ice_netdev_to_pf(netdev);
#ifndef CONFIG_DYNAMIC_DEBUG
if (pf->hw.debug_mask)
@@ -497,8 +495,7 @@ static u32 ice_get_msglevel(struct net_device *netdev)
static void ice_set_msglevel(struct net_device *netdev, u32 data)
{
- struct ice_netdev_priv *np = netdev_priv(netdev);
- struct ice_pf *pf = np->vsi->back;
+ struct ice_pf *pf = ice_netdev_to_pf(netdev);
#ifndef CONFIG_DYNAMIC_DEBUG
if (ICE_DBG_USER & data)
@@ -512,8 +509,7 @@ static void ice_set_msglevel(struct net_device *netdev, u32 data)
static int ice_get_eeprom_len(struct net_device *netdev)
{
- struct ice_netdev_priv *np = netdev_priv(netdev);
- struct ice_pf *pf = np->vsi->back;
+ struct ice_pf *pf = ice_netdev_to_pf(netdev);
return (int)pf->hw.flash.flash_size;
}
@@ -522,9 +518,7 @@ static int
ice_get_eeprom(struct net_device *netdev, struct ethtool_eeprom *eeprom,
u8 *bytes)
{
- struct ice_netdev_priv *np = netdev_priv(netdev);
- struct ice_vsi *vsi = np->vsi;
- struct ice_pf *pf = vsi->back;
+ struct ice_pf *pf = ice_netdev_to_pf(netdev);
struct ice_hw *hw = &pf->hw;
struct device *dev;
int ret;
@@ -623,8 +617,7 @@ static u64 ice_link_test(struct net_device *netdev)
*/
static u64 ice_eeprom_test(struct net_device *netdev)
{
- struct ice_netdev_priv *np = netdev_priv(netdev);
- struct ice_pf *pf = np->vsi->back;
+ struct ice_pf *pf = ice_netdev_to_pf(netdev);
netdev_info(netdev, "EEPROM test\n");
return !!(ice_nvm_validate_checksum(&pf->hw));
@@ -938,9 +931,8 @@ static int ice_lbtest_receive_frames(struct ice_rx_ring *rx_ring)
*/
static u64 ice_loopback_test(struct net_device *netdev)
{
- struct ice_netdev_priv *np = netdev_priv(netdev);
- struct ice_vsi *orig_vsi = np->vsi, *test_vsi;
- struct ice_pf *pf = orig_vsi->back;
+ struct ice_pf *pf = ice_netdev_to_pf(netdev);
+ struct ice_vsi *test_vsi;
u8 *tx_frame __free(kfree) = NULL;
u8 broadcast[ETH_ALEN], ret = 0;
int num_frames, valid_frames;
@@ -1029,8 +1021,7 @@ static u64 ice_loopback_test(struct net_device *netdev)
*/
static u64 ice_intr_test(struct net_device *netdev)
{
- struct ice_netdev_priv *np = netdev_priv(netdev);
- struct ice_pf *pf = np->vsi->back;
+ struct ice_pf *pf = ice_netdev_to_pf(netdev);
u16 swic_old = pf->sw_int_count;
netdev_info(netdev, "interrupt test\n");
@@ -1058,9 +1049,8 @@ static void
ice_self_test(struct net_device *netdev, struct ethtool_test *eth_test,
u64 *data)
{
- struct ice_netdev_priv *np = netdev_priv(netdev);
+ struct ice_pf *pf = ice_netdev_to_pf(netdev);
bool if_running = netif_running(netdev);
- struct ice_pf *pf = np->vsi->back;
struct device *dev;
dev = ice_pf_to_dev(pf);
@@ -1384,9 +1374,7 @@ static int ice_nway_reset(struct net_device *netdev)
*/
static u32 ice_get_priv_flags(struct net_device *netdev)
{
- struct ice_netdev_priv *np = netdev_priv(netdev);
- struct ice_vsi *vsi = np->vsi;
- struct ice_pf *pf = vsi->back;
+ struct ice_pf *pf = ice_netdev_to_pf(netdev);
u32 i, ret_flags = 0;
for (i = 0; i < ICE_PRIV_FLAG_ARRAY_SIZE; i++) {
@@ -4128,9 +4116,7 @@ static int
ice_get_module_info(struct net_device *netdev,
struct ethtool_modinfo *modinfo)
{
- struct ice_netdev_priv *np = netdev_priv(netdev);
- struct ice_vsi *vsi = np->vsi;
- struct ice_pf *pf = vsi->back;
+ struct ice_pf *pf = ice_netdev_to_pf(netdev);
struct ice_hw *hw = &pf->hw;
u8 sff8472_comp = 0;
u8 sff8472_swap = 0;
@@ -4202,12 +4188,10 @@ static int
ice_get_module_eeprom(struct net_device *netdev,
struct ethtool_eeprom *ee, u8 *data)
{
- struct ice_netdev_priv *np = netdev_priv(netdev);
+ struct ice_pf *pf = ice_netdev_to_pf(netdev);
#define SFF_READ_BLOCK_SIZE 8
u8 value[SFF_READ_BLOCK_SIZE] = { 0 };
u8 addr = ICE_I2C_EEPROM_DEV_ADDR;
- struct ice_vsi *vsi = np->vsi;
- struct ice_pf *pf = vsi->back;
struct ice_hw *hw = &pf->hw;
bool is_sfp = false;
unsigned int i, j;
diff --git a/drivers/net/ethernet/intel/ice/ice_flex_pipe.c b/drivers/net/ethernet/intel/ice/ice_flex_pipe.c
index 20d5db88c99f..4c322bed716c 100644
--- a/drivers/net/ethernet/intel/ice/ice_flex_pipe.c
+++ b/drivers/net/ethernet/intel/ice/ice_flex_pipe.c
@@ -574,9 +574,7 @@ ice_destroy_tunnel(struct ice_hw *hw, u16 index, enum ice_tunnel_type type,
int ice_udp_tunnel_set_port(struct net_device *netdev, unsigned int table,
unsigned int idx, struct udp_tunnel_info *ti)
{
- struct ice_netdev_priv *np = netdev_priv(netdev);
- struct ice_vsi *vsi = np->vsi;
- struct ice_pf *pf = vsi->back;
+ struct ice_pf *pf = ice_netdev_to_pf(netdev);
enum ice_tunnel_type tnl_type;
int status;
u16 index;
@@ -598,9 +596,7 @@ int ice_udp_tunnel_set_port(struct net_device *netdev, unsigned int table,
int ice_udp_tunnel_unset_port(struct net_device *netdev, unsigned int table,
unsigned int idx, struct udp_tunnel_info *ti)
{
- struct ice_netdev_priv *np = netdev_priv(netdev);
- struct ice_vsi *vsi = np->vsi;
- struct ice_pf *pf = vsi->back;
+ struct ice_pf *pf = ice_netdev_to_pf(netdev);
enum ice_tunnel_type tnl_type;
int status;
diff --git a/drivers/net/ethernet/intel/ice/ice_lag.c b/drivers/net/ethernet/intel/ice/ice_lag.c
index 1ccb572ce285..cdb0e59aeb26 100644
--- a/drivers/net/ethernet/intel/ice/ice_lag.c
+++ b/drivers/net/ethernet/intel/ice/ice_lag.c
@@ -1640,11 +1640,8 @@ static void ice_lag_chk_disabled_bond(struct ice_lag *lag, void *ptr)
*/
static void ice_lag_disable_sriov_bond(struct ice_lag *lag)
{
- struct ice_netdev_priv *np;
- struct ice_pf *pf;
+ struct ice_pf *pf = ice_netdev_to_pf(lag->netdev);
- np = netdev_priv(lag->netdev);
- pf = np->vsi->back;
ice_clear_feature_support(pf, ICE_F_SRIOV_LAG);
}
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index 4db3a6056f41..9d852b169ead 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -7798,8 +7798,7 @@ static int ice_change_mtu(struct net_device *netdev, int new_mtu)
*/
static int ice_eth_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
{
- struct ice_netdev_priv *np = netdev_priv(netdev);
- struct ice_pf *pf = np->vsi->back;
+ struct ice_pf *pf = ice_netdev_to_pf(netdev);
switch (cmd) {
case SIOCGHWTSTAMP:
@@ -8027,9 +8026,7 @@ static int
ice_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
struct net_device *dev, u32 filter_mask, int nlflags)
{
- struct ice_netdev_priv *np = netdev_priv(dev);
- struct ice_vsi *vsi = np->vsi;
- struct ice_pf *pf = vsi->back;
+ struct ice_pf *pf = ice_netdev_to_pf(dev);
u16 bmode;
bmode = pf->first_sw->bridge_mode;
diff --git a/drivers/net/ethernet/intel/ice/ice_sriov.c b/drivers/net/ethernet/intel/ice/ice_sriov.c
index 067712f4923f..adcc2f967bab 100644
--- a/drivers/net/ethernet/intel/ice/ice_sriov.c
+++ b/drivers/net/ethernet/intel/ice/ice_sriov.c
@@ -1317,8 +1317,7 @@ ice_vf_lan_overflow_event(struct ice_pf *pf, struct ice_rq_event_info *event)
*/
int ice_set_vf_spoofchk(struct net_device *netdev, int vf_id, bool ena)
{
- struct ice_netdev_priv *np = netdev_priv(netdev);
- struct ice_pf *pf = np->vsi->back;
+ struct ice_pf *pf = ice_netdev_to_pf(netdev);
struct ice_vsi *vf_vsi;
struct device *dev;
struct ice_vf *vf;
--
2.43.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [Intel-wired-lan] [PATCH iwl-next v1 5/5] ice: refactor to use helpers
2024-06-04 22:13 ` [PATCH iwl-next v1 5/5] ice: refactor to use helpers Jesse Brandeburg
@ 2024-06-05 4:01 ` Przemek Kitszel
0 siblings, 0 replies; 13+ messages in thread
From: Przemek Kitszel @ 2024-06-05 4:01 UTC (permalink / raw)
To: Jesse Brandeburg, netdev, intel-wired-lan; +Cc: Jacob Keller, linux-doc, corbet
On 6/5/24 00:13, Jesse Brandeburg wrote:
> Use the ice_netdev_to_pf() helper in more places and remove a bunch of
> boilerplate code. Not every instance could be replaced due to use of the
> netdev_priv() output or the vsi variable within a bunch of functions.
>
> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
> Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
> ---
> drivers/net/ethernet/intel/ice/ice_ethtool.c | 42 ++++++-------------
> .../net/ethernet/intel/ice/ice_flex_pipe.c | 8 +---
> drivers/net/ethernet/intel/ice/ice_lag.c | 5 +--
> drivers/net/ethernet/intel/ice/ice_main.c | 7 +---
> drivers/net/ethernet/intel/ice/ice_sriov.c | 3 +-
> 5 files changed, 19 insertions(+), 46 deletions(-)
>
very nice, thanks
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH iwl-next v1 0/5] ice: add standard stats
2024-06-04 22:13 [PATCH iwl-next v1 0/5] ice: add standard stats Jesse Brandeburg
` (4 preceding siblings ...)
2024-06-04 22:13 ` [PATCH iwl-next v1 5/5] ice: refactor to use helpers Jesse Brandeburg
@ 2024-06-06 0:50 ` Jakub Kicinski
5 siblings, 0 replies; 13+ messages in thread
From: Jakub Kicinski @ 2024-06-06 0:50 UTC (permalink / raw)
To: Jesse Brandeburg; +Cc: netdev, intel-wired-lan, corbet, linux-doc
On Tue, 4 Jun 2024 15:13:20 -0700 Jesse Brandeburg wrote:
> The main point of this series is to implement the standard stats for the
> ice driver, but also add a related documentation fix and finish the
> series off with a cleanup that removes a bunch of code.
With the nit on patch 1 fixed:
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
queue stats next? :]
^ permalink raw reply [flat|nested] 13+ messages in thread