From: ALOK TIWARI <alok.a.tiwari@oracle.com>
To: Parvathi Pudi <parvathi@couthit.com>,
danishanwar@ti.com, rogerq@kernel.org, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, nm@ti.com, ssantosh@kernel.org,
tony@atomide.com, richardcochran@gmail.com,
glaroque@baylibre.com, schnelle@linux.ibm.com,
m-karicheri2@ti.com, s.hauer@pengutronix.de,
rdunlap@infradead.org, diogo.ivo@siemens.com,
basharath@couthit.com, horms@kernel.org,
jacob.e.keller@intel.com, m-malladi@ti.com,
javier.carrasco.cruz@gmail.com, afd@ti.com, s-anna@ti.com
Cc: linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
pratheesh@ti.com, prajith@ti.com, vigneshr@ti.com,
praneeth@ti.com, srk@ti.com, rogerq@ti.com, krishna@couthit.com,
pmohan@couthit.com, mohan@couthit.com
Subject: Re: [PATCH net-next v6 05/11] net: ti: prueth: Adds ethtool support for ICSSM PRUETH Driver
Date: Sat, 3 May 2025 14:59:31 +0530 [thread overview]
Message-ID: <868c8163-d776-4ff4-b516-3046c5db0fc0@oracle.com> (raw)
In-Reply-To: <20250423072356.146726-6-parvathi@couthit.com>
On 23-04-2025 12:53, Parvathi Pudi wrote:
> From: Roger Quadros <rogerq@ti.com>
>
> Changes for enabling ethtool support for the newly added PRU Ethernet
> interfaces. Extends the support for statistics collection from PRU internal
> memory and displays it in the user space. Along with statistics,
> enable/disable of features, configuring link speed etc.are now supported.
etc.are -> etc. are
>
> The firmware running on PRU maintains statistics in internal data memory.
> When requested ethtool collects all the statistics for the specified
> interface and displays it in the user space.
>
> --- a/drivers/net/ethernet/ti/Makefile
> +++ b/drivers/net/ethernet/ti/Makefile
> @@ -4,7 +4,7 @@
> #
>
[clip]
> +}
> +
> +static void icssm_emac_get_regs(struct net_device *ndev,
> + struct ethtool_regs *regs, void *p)
> +{
> + struct prueth_emac *emac = netdev_priv(ndev);
> + struct prueth *prueth = emac->prueth;
> +
> + regs->version = PRUETH_REG_DUMP_GET_VER(prueth);
> +}
> +
> +static const struct ethtool_rmon_hist_range icssm_emac_rmon_ranges[] = {
> + { 0, 64},
> + { 65, 127},
> + { 128, 255},
> + { 256, 511},
> + { 512, 1023},
> + { 1024, EMAC_MAX_PKTLEN},
> + {}
> +};
> +
> +static void
> +icssm_emac_get_rmon_stats(struct net_device *ndev,
> + struct ethtool_rmon_stats *rmon_stats,
> + const struct ethtool_rmon_hist_range **ranges)
> +{
> + struct prueth_emac *emac = netdev_priv(ndev);
> + struct port_statistics pstats;
> +
> + *ranges = icssm_emac_rmon_ranges;
> + icssm_emac_get_stats(emac, &pstats);
> +
> + rmon_stats->undersize_pkts = pstats.rx_undersized_frames;
> + rmon_stats->oversize_pkts = pstats.rx_oversized_frames;
remove extra ' ' before =
> +
> + rmon_stats->hist[0] = pstats.tx64byte;
> + rmon_stats->hist[1] = pstats.tx65_127byte;
> + rmon_stats->hist[2] = pstats.tx128_255byte;
> + rmon_stats->hist[3] = pstats.tx256_511byte;
> + rmon_stats->hist[4] = pstats.tx512_1023byte;
> +
> + rmon_stats->hist_tx[0] = pstats.rx64byte;
> + rmon_stats->hist_tx[1] = pstats.rx65_127byte;
> + rmon_stats->hist_tx[2] = pstats.rx128_255byte;
> + rmon_stats->hist_tx[3] = pstats.rx256_511byte;
> + rmon_stats->hist_tx[4] = pstats.rx1024byte;
> +}
> +
> +static void
> +icssm_emac_get_eth_mac_stats(struct net_device *ndev,
> + struct ethtool_eth_mac_stats *mac_stats)
> +{
> + struct prueth_emac *emac = netdev_priv(ndev);
> + struct port_statistics pstats;
> +
> + icssm_emac_get_stats(emac, &pstats);
> +
> + mac_stats->LateCollisions = pstats.late_coll;
> + mac_stats->SingleCollisionFrames = pstats.single_coll;
> + mac_stats->MultipleCollisionFrames = pstats.multi_coll;
> +}
> +
> +/* Ethtool support for EMAC adapter */
> +const struct ethtool_ops emac_ethtool_ops = {
> + .get_drvinfo = icssm_emac_get_drvinfo,
> + .get_link_ksettings = phy_ethtool_get_link_ksettings,
> + .set_link_ksettings = phy_ethtool_set_link_ksettings,
> + .get_link = ethtool_op_get_link,
> + .get_sset_count = icssm_emac_get_sset_count,
> + .get_strings = icssm_emac_get_strings,
> + .get_ethtool_stats = icssm_emac_get_ethtool_stats,
> + .get_regs = icssm_emac_get_regs,
> + .get_rmon_stats = icssm_emac_get_rmon_stats,
> + .get_eth_mac_stats = icssm_emac_get_eth_mac_stats,
> +};
> +EXPORT_SYMBOL_GPL(emac_ethtool_ops);
> diff --git a/drivers/net/ethernet/ti/icssm/icssm_prueth.c b/drivers/net/ethernet/ti/icssm/icssm_prueth.c
> index 7aae12383ad3..b37991b04dd1 100644
> --- a/drivers/net/ethernet/ti/icssm/icssm_prueth.c
> +++ b/drivers/net/ethernet/ti/icssm/icssm_prueth.c
> @@ -901,6 +901,8 @@ static int icssm_emac_ndo_open(struct net_device *ndev)
>
> icssm_prueth_emac_config(emac);
>
> + icssm_emac_set_stats(emac, &emac->stats);
> +
> ret = icssm_emac_set_boot_pru(emac, ndev);
> if (ret)
> return ret;
> @@ -952,6 +954,8 @@ static int icssm_emac_ndo_stop(struct net_device *ndev)
> /* stop the PRU */
> rproc_shutdown(emac->pru);
>
> + icssm_emac_get_stats(emac, &emac->stats);
> +
> /* free rx interrupts */
> free_irq(emac->rx_irq, ndev);
>
> @@ -1045,10 +1049,39 @@ static enum netdev_tx icssm_emac_ndo_start_xmit(struct sk_buff *skb,
> return ret;
> }
>
> +/**
> + * icssm_emac_ndo_get_stats64 - EMAC get statistics function
> + * @ndev: The EMAC network adapter
> + * @stats: rtnl_link_stats structure
> + *
> + * Called when system wants to get statistics from the device.
> + *
> + */
> +static void icssm_emac_ndo_get_stats64(struct net_device *ndev,
> + struct rtnl_link_stats64 *stats)
> +{
> + struct prueth_emac *emac = netdev_priv(ndev);
> + struct port_statistics pstats;
> +
> + icssm_emac_get_stats(emac, &pstats);
> +
> + stats->rx_packets = ndev->stats.rx_packets;
> + stats->rx_bytes = ndev->stats.rx_bytes;
> + stats->tx_packets = ndev->stats.tx_packets;
> + stats->tx_bytes = ndev->stats.tx_bytes;
> + stats->tx_errors = ndev->stats.tx_errors;
> + stats->tx_dropped = ndev->stats.tx_dropped;
> + stats->multicast = pstats.rx_mcast;
> +
> + stats->rx_over_errors = ndev->stats.rx_over_errors;
> + stats->rx_length_errors = ndev->stats.rx_length_errors;
remove extra ' ' before =
> +}
> +
> static const struct net_device_ops emac_netdev_ops = {
> .ndo_open = icssm_emac_ndo_open,
> .ndo_stop = icssm_emac_ndo_stop,
> .ndo_start_xmit = icssm_emac_ndo_start_xmit,
> + .ndo_get_stats64 = icssm_emac_ndo_get_stats64,
> };
>
> /* get emac_port corresponding to eth_node name */
> @@ -1177,6 +1210,7 @@ static int icssm_prueth_netdev_init(struct prueth *prueth,
> phy_remove_link_mode(emac->phydev, ETHTOOL_LINK_MODE_Asym_Pause_BIT);
>
> ndev->netdev_ops = &emac_netdev_ops;
> + ndev->ethtool_ops = &emac_ethtool_ops;
>
> return 0;
> free:
> diff --git a/drivers/net/ethernet/ti/icssm/icssm_prueth.h b/drivers/net/ethernet/ti/icssm/icssm_prueth.h
> index 3c70dc9c4be0..39ceed0e2d15 100644
> --- a/drivers/net/ethernet/ti/icssm/icssm_prueth.h
> +++ b/drivers/net/ethernet/ti/icssm/icssm_prueth.h
> @@ -27,6 +27,12 @@
> #define EMAC_MAX_FRM_SUPPORT (ETH_HLEN + VLAN_HLEN + ETH_DATA_LEN + \
> ICSSM_LRE_TAG_SIZE)
>
> +#define PRUETH_REG_DUMP_VER 1
> +
> +/* Encoding: 32-16: Reserved, 16-8: Reg dump version, 8-0: Ethertype */
remove extra ' ' after Ethertype
> +#define PRUETH_REG_DUMP_GET_VER(x) ((PRUETH_REG_DUMP_VER << 8) | \
> + ((x)->eth_type))
> +
> /* PRU Ethernet Type - Ethernet functionality (protocol
> * implemented) provided by the PRU firmware being loaded.
> */
> @@ -108,6 +114,119 @@ struct prueth_packet_info {
> bool timestamp;
> };
Thanks,
Alok
next prev parent reply other threads:[~2025-05-03 9:34 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-23 6:06 [PATCH net-next v6 00/11] PRU-ICSSM Ethernet Driver Parvathi Pudi
2025-04-23 6:06 ` [PATCH net-next v6 01/11] dt-bindings: net: ti: Adds DUAL-EMAC mode support on PRU-ICSS2 for AM57xx, AM43xx and AM33xx SOCs Parvathi Pudi
2025-04-25 21:19 ` Rob Herring
2025-04-25 21:19 ` Rob Herring
2025-04-29 10:11 ` Parvathi Pudi
2025-04-29 10:11 ` Parvathi Pudi
2025-05-02 20:08 ` ALOK TIWARI
2025-04-23 6:06 ` [PATCH net-next v6 02/11] net: ti: prueth: Adds ICSSM Ethernet driver Parvathi Pudi
2025-04-23 6:06 ` [PATCH net-next v6 03/11] net: ti: prueth: Adds PRUETH HW and SW configuration Parvathi Pudi
2025-04-23 7:23 ` [PATCH net-next v6 04/11] net: ti: prueth: Adds link detection, RX and TX support Parvathi Pudi
2025-04-25 2:13 ` Jakub Kicinski
2025-04-25 2:13 ` Jakub Kicinski
2025-04-29 10:03 ` Parvathi Pudi
2025-04-29 10:03 ` Parvathi Pudi
2025-05-03 9:01 ` ALOK TIWARI
2025-04-23 7:23 ` [PATCH net-next v6 05/11] net: ti: prueth: Adds ethtool support for ICSSM PRUETH Driver Parvathi Pudi
2025-04-25 2:17 ` Jakub Kicinski
2025-04-25 2:17 ` Jakub Kicinski
2025-04-29 10:06 ` Parvathi Pudi
2025-04-29 10:06 ` Parvathi Pudi
2025-05-03 9:29 ` ALOK TIWARI [this message]
2025-04-23 7:23 ` [PATCH net-next v6 06/11] net: ti: prueth: Adds HW timestamping support for PTP using PRU-ICSS IEP module Parvathi Pudi
2025-04-25 2:16 ` Jakub Kicinski
2025-04-25 2:16 ` Jakub Kicinski
2025-04-29 10:04 ` Parvathi Pudi
2025-04-29 10:04 ` Parvathi Pudi
2025-04-23 7:23 ` [PATCH net-next v6 07/11] net: ti: prueth: Adds support for network filters for traffic control supported by PRU-ICSS Parvathi Pudi
2025-05-03 9:26 ` ALOK TIWARI
2025-05-05 13:34 ` Parvathi Pudi
2025-05-05 13:34 ` Parvathi Pudi
2025-04-23 9:06 ` [PATCH net-next v6 08/11] net: ti: prueth: Adds support for RX interrupt coalescing/pacing Parvathi Pudi
2025-04-23 9:06 ` [PATCH net-next v6 09/11] net: ti: prueth: Adds power management support for PRU-ICSS Parvathi Pudi
2025-04-23 9:06 ` [PATCH net-next v6 10/11] net: ti: prueth: Adds support for PRUETH on AM33x and AM43x SOCs Parvathi Pudi
2025-04-23 9:06 ` [PATCH net-next v6 11/11] net: ti: prueth: Adds PTP OC Support for AM335x and AM437x Parvathi Pudi
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=868c8163-d776-4ff4-b516-3046c5db0fc0@oracle.com \
--to=alok.a.tiwari@oracle.com \
--cc=afd@ti.com \
--cc=andrew+netdev@lunn.ch \
--cc=basharath@couthit.com \
--cc=conor+dt@kernel.org \
--cc=danishanwar@ti.com \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=diogo.ivo@siemens.com \
--cc=edumazet@google.com \
--cc=glaroque@baylibre.com \
--cc=horms@kernel.org \
--cc=jacob.e.keller@intel.com \
--cc=javier.carrasco.cruz@gmail.com \
--cc=krishna@couthit.com \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=m-karicheri2@ti.com \
--cc=m-malladi@ti.com \
--cc=mohan@couthit.com \
--cc=netdev@vger.kernel.org \
--cc=nm@ti.com \
--cc=pabeni@redhat.com \
--cc=parvathi@couthit.com \
--cc=pmohan@couthit.com \
--cc=prajith@ti.com \
--cc=praneeth@ti.com \
--cc=pratheesh@ti.com \
--cc=rdunlap@infradead.org \
--cc=richardcochran@gmail.com \
--cc=robh@kernel.org \
--cc=rogerq@kernel.org \
--cc=rogerq@ti.com \
--cc=s-anna@ti.com \
--cc=s.hauer@pengutronix.de \
--cc=schnelle@linux.ibm.com \
--cc=srk@ti.com \
--cc=ssantosh@kernel.org \
--cc=tony@atomide.com \
--cc=vigneshr@ti.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.