From: Simon Horman <horms@kernel.org>
To: Basharath Hussain Khaja <basharath@couthit.com>
Cc: nm@ti.com, vigneshr@ti.com, tony@atomide.com,
edumazet@google.com, krishna@couthit.com, pmohan@couthit.com,
diogo.ivo@siemens.com, robh@kernel.org,
javier.carrasco.cruz@gmail.com, praneeth@ti.com,
m-karicheri2@ti.com, jacob.e.keller@intel.com, kuba@kernel.org,
pabeni@redhat.com, devicetree@vger.kernel.org,
conor+dt@kernel.org, schnelle@linux.ibm.com, mohan@couthit.com,
richardcochran@gmail.com, prajith@ti.com, rogerq@kernel.org,
ssantosh@kernel.org, linux-omap@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, rogerq@ti.com, srk@ti.com,
pratheesh@ti.com, m-malladi@ti.com, netdev@vger.kernel.org,
rdunlap@infradead.org, linux-kernel@vger.kernel.org,
danishanwar@ti.com, afd@ti.com, andrew+netdev@lunn.ch,
parvathi@couthit.com, krzk+dt@kernel.org, davem@davemloft.net
Subject: Re: [RFC v2 PATCH 06/10] net: ti: prueth: Adds HW timestamping support for PTP using PRU-ICSS IEP module
Date: Fri, 31 Jan 2025 10:33:52 +0000 [thread overview]
Message-ID: <20250131103352.GH24105@kernel.org> (raw)
In-Reply-To: <20250124134056.1459060-7-basharath@couthit.com>
On Fri, Jan 24, 2025 at 07:10:52PM +0530, Basharath Hussain Khaja wrote:
> From: Roger Quadros <rogerq@ti.com>
>
> PRU-ICSS IEP module, which is capable of timestamping RX and
> TX packets at HW level, is used for time synchronization by PTP4L.
>
> This change includes interaction between firmware and user space
> application (ptp4l) with required packet timestamps. The driver
> initializes the PRU firmware with appropriate mode and configuration
> flags. Firmware updates local registers with the flags set by driver
> and uses for further operation. RX SOF timestamp comes along with
> packet and firmware will rise interrupt with TX SOF timestamp after
> pushing the packet on to the wire.
>
> IEP driver is available in upstream and we are reusing for hardware
> configuration for ICSSM as well. On top of that we have extended it
> with the changes for AM57xx SoC.
>
> Extended ethtool for reading HW timestamping capability of the PRU
> interfaces.
>
> Currently ordinary clock (OC) configuration has been validated with
> Linux ptp4l.
>
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> Signed-off-by: Andrew F. Davis <afd@ti.com>
> Signed-off-by: Parvathi Pudi <parvathi@couthit.com>
> Signed-off-by: Basharath Hussain Khaja <basharath@couthit.com>
...
> diff --git a/drivers/net/ethernet/ti/icssm/icssm_prueth.c b/drivers/net/ethernet/ti/icssm/icssm_prueth.c
...
> @@ -682,9 +899,22 @@ int icssm_emac_rx_packet(struct prueth_emac *emac, u16 *bd_rd_ptr,
> src_addr += actual_pkt_len;
> }
>
> + if (pkt_info->timestamp) {
> + src_addr = (void *)roundup((uintptr_t)src_addr,
> + ICSS_BLOCK_SIZE);
Can PTR_ALIGN() be used here?
> + dst_addr = &ts;
> + memcpy(dst_addr, src_addr, sizeof(ts));
> + }
> +
> if (!pkt_info->sv_frame) {
> skb_put(skb, actual_pkt_len);
>
> + if (icssm_prueth_ptp_rx_ts_is_enabled(emac) &&
> + pkt_info->timestamp) {
> + ssh = skb_hwtstamps(skb);
> + memset(ssh, 0, sizeof(*ssh));
> + ssh->hwtstamp = ns_to_ktime(ts);
> + }
> /* send packet up the stack */
> skb->protocol = eth_type_trans(skb, ndev);
> local_bh_disable();
The code preceding the hunk below is:
static int icssm_emac_request_irqs(struct prueth_emac *emac)
{
struct net_device *ndev = emac->ndev;
int ret;
ret = request_threaded_irq(emac->rx_irq, NULL, icssm_emac_rx_thread,
IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
ndev->name, ndev);
if (ret) {
netdev_err(ndev, "unable to request RX IRQ\n");
return ret;
}
> @@ -855,9 +1085,64 @@ static int icssm_emac_request_irqs(struct prueth_emac *emac)
> return ret;
> }
>
> + if (emac->emac_ptp_tx_irq) {
> + ret = request_threaded_irq(emac->emac_ptp_tx_irq,
> + icssm_prueth_ptp_tx_irq_handle,
> + icssm_prueth_ptp_tx_irq_work,
> + IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
> + ndev->name, ndev);
> + if (ret) {
> + netdev_err(ndev, "unable to request PTP TX IRQ\n");
> + free_irq(emac->rx_irq, ndev);
> + free_irq(emac->tx_irq, ndev);
This seems somewhat asymmetric. This function does request emac->rx_irq
but not emac->tx_irq. So I don't think it is appropriate to free emac->tx_irq
here.
Also, I would suggest using a goto label for unwind here.
> + }
> + }
> +
> return ret;
> }
>
...
WARNING: multiple messages have this Message-ID (diff)
From: Simon Horman <horms@kernel.org>
To: Basharath Hussain Khaja <basharath@couthit.com>
Cc: 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, parvathi@couthit.com,
schnelle@linux.ibm.com, rdunlap@infradead.org,
diogo.ivo@siemens.com, m-karicheri2@ti.com,
jacob.e.keller@intel.com, m-malladi@ti.com,
javier.carrasco.cruz@gmail.com, afd@ti.com, s-anna@ti.com,
linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-omap@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: [RFC v2 PATCH 06/10] net: ti: prueth: Adds HW timestamping support for PTP using PRU-ICSS IEP module
Date: Fri, 31 Jan 2025 10:33:52 +0000 [thread overview]
Message-ID: <20250131103352.GH24105@kernel.org> (raw)
In-Reply-To: <20250124134056.1459060-7-basharath@couthit.com>
On Fri, Jan 24, 2025 at 07:10:52PM +0530, Basharath Hussain Khaja wrote:
> From: Roger Quadros <rogerq@ti.com>
>
> PRU-ICSS IEP module, which is capable of timestamping RX and
> TX packets at HW level, is used for time synchronization by PTP4L.
>
> This change includes interaction between firmware and user space
> application (ptp4l) with required packet timestamps. The driver
> initializes the PRU firmware with appropriate mode and configuration
> flags. Firmware updates local registers with the flags set by driver
> and uses for further operation. RX SOF timestamp comes along with
> packet and firmware will rise interrupt with TX SOF timestamp after
> pushing the packet on to the wire.
>
> IEP driver is available in upstream and we are reusing for hardware
> configuration for ICSSM as well. On top of that we have extended it
> with the changes for AM57xx SoC.
>
> Extended ethtool for reading HW timestamping capability of the PRU
> interfaces.
>
> Currently ordinary clock (OC) configuration has been validated with
> Linux ptp4l.
>
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> Signed-off-by: Andrew F. Davis <afd@ti.com>
> Signed-off-by: Parvathi Pudi <parvathi@couthit.com>
> Signed-off-by: Basharath Hussain Khaja <basharath@couthit.com>
...
> diff --git a/drivers/net/ethernet/ti/icssm/icssm_prueth.c b/drivers/net/ethernet/ti/icssm/icssm_prueth.c
...
> @@ -682,9 +899,22 @@ int icssm_emac_rx_packet(struct prueth_emac *emac, u16 *bd_rd_ptr,
> src_addr += actual_pkt_len;
> }
>
> + if (pkt_info->timestamp) {
> + src_addr = (void *)roundup((uintptr_t)src_addr,
> + ICSS_BLOCK_SIZE);
Can PTR_ALIGN() be used here?
> + dst_addr = &ts;
> + memcpy(dst_addr, src_addr, sizeof(ts));
> + }
> +
> if (!pkt_info->sv_frame) {
> skb_put(skb, actual_pkt_len);
>
> + if (icssm_prueth_ptp_rx_ts_is_enabled(emac) &&
> + pkt_info->timestamp) {
> + ssh = skb_hwtstamps(skb);
> + memset(ssh, 0, sizeof(*ssh));
> + ssh->hwtstamp = ns_to_ktime(ts);
> + }
> /* send packet up the stack */
> skb->protocol = eth_type_trans(skb, ndev);
> local_bh_disable();
The code preceding the hunk below is:
static int icssm_emac_request_irqs(struct prueth_emac *emac)
{
struct net_device *ndev = emac->ndev;
int ret;
ret = request_threaded_irq(emac->rx_irq, NULL, icssm_emac_rx_thread,
IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
ndev->name, ndev);
if (ret) {
netdev_err(ndev, "unable to request RX IRQ\n");
return ret;
}
> @@ -855,9 +1085,64 @@ static int icssm_emac_request_irqs(struct prueth_emac *emac)
> return ret;
> }
>
> + if (emac->emac_ptp_tx_irq) {
> + ret = request_threaded_irq(emac->emac_ptp_tx_irq,
> + icssm_prueth_ptp_tx_irq_handle,
> + icssm_prueth_ptp_tx_irq_work,
> + IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
> + ndev->name, ndev);
> + if (ret) {
> + netdev_err(ndev, "unable to request PTP TX IRQ\n");
> + free_irq(emac->rx_irq, ndev);
> + free_irq(emac->tx_irq, ndev);
This seems somewhat asymmetric. This function does request emac->rx_irq
but not emac->tx_irq. So I don't think it is appropriate to free emac->tx_irq
here.
Also, I would suggest using a goto label for unwind here.
> + }
> + }
> +
> return ret;
> }
>
...
next prev parent reply other threads:[~2025-01-31 10:35 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-24 12:23 [RFC v2 PATCH 00/10] PRU-ICSSM Ethernet Driver Basharath Hussain Khaja
2025-01-24 12:23 ` [RFC v2 PATCH 01/10] dt-bindings: net: ti: Adds DUAL-EMAC mode support on PRU-ICSS2 for AM57xx SOCs Basharath Hussain Khaja
2025-01-24 16:39 ` Conor Dooley
2025-01-24 16:39 ` Conor Dooley
2025-01-29 5:16 ` Basharath Hussain Khaja
2025-01-29 5:16 ` Basharath Hussain Khaja
2025-01-29 17:48 ` Conor Dooley
2025-01-29 17:48 ` Conor Dooley
2025-02-03 12:29 ` Basharath Hussain Khaja
2025-02-03 12:29 ` Basharath Hussain Khaja
2025-02-04 18:16 ` Conor Dooley
2025-02-04 18:16 ` Conor Dooley
2025-01-24 12:23 ` [RFC v2 PATCH 02/10] net: ti: prueth: Adds ICSSM Ethernet driver Basharath Hussain Khaja
2025-01-30 11:41 ` Simon Horman
2025-01-30 11:41 ` Simon Horman
2025-02-01 13:25 ` Basharath Hussain Khaja
2025-02-01 13:25 ` Basharath Hussain Khaja
2025-01-24 12:23 ` [RFC v2 PATCH 03/10] net: ti: prueth: Adds PRUETH HW and SW configuration Basharath Hussain Khaja
2025-01-30 15:47 ` Simon Horman
2025-01-30 15:47 ` Simon Horman
2025-02-01 13:34 ` Basharath Hussain Khaja
2025-02-01 13:34 ` Basharath Hussain Khaja
2025-01-24 12:37 ` [RFC v2 PATCH 04/10] net: ti: prueth: Adds link detection, RX and TX support Basharath Hussain Khaja
2025-01-24 23:13 ` Joe Damato
2025-01-24 23:13 ` Joe Damato
2025-01-29 5:41 ` Basharath Hussain Khaja
2025-01-29 5:41 ` Basharath Hussain Khaja
2025-01-30 16:45 ` Simon Horman
2025-01-30 16:45 ` Simon Horman
2025-02-01 13:37 ` Basharath Hussain Khaja
2025-02-01 13:37 ` Basharath Hussain Khaja
2025-01-24 13:40 ` Basharath Hussain Khaja
2025-01-24 23:20 ` Joe Damato
2025-01-24 23:20 ` Joe Damato
2025-01-29 5:43 ` Basharath Hussain Khaja
2025-01-29 5:43 ` Basharath Hussain Khaja
2025-01-24 13:40 ` [RFC v2 PATCH 05/10] net: ti: prueth: Adds ethtool support for ICSSM PRUETH Driver Basharath Hussain Khaja
2025-01-30 17:23 ` Simon Horman
2025-01-30 17:23 ` Simon Horman
2025-02-01 13:48 ` Basharath Hussain Khaja
2025-02-01 13:48 ` Basharath Hussain Khaja
2025-01-24 13:40 ` [RFC v2 PATCH 06/10] net: ti: prueth: Adds HW timestamping support for PTP using PRU-ICSS IEP module Basharath Hussain Khaja
2025-01-31 10:33 ` Simon Horman [this message]
2025-01-31 10:33 ` Simon Horman
2025-02-05 12:24 ` Basharath Hussain Khaja
2025-02-05 12:24 ` Basharath Hussain Khaja
2025-01-24 13:40 ` [RFC v2 PATCH 07/10] net: ti: prueth: Adds support for network filters for traffic control supported by PRU-ICSS Basharath Hussain Khaja
2025-01-24 14:45 ` [RFC v2 PATCH 08/10] net: ti: prueth: Adds support for RX interrupt coalescing/pacing Basharath Hussain Khaja
2025-01-24 14:45 ` [RFC v2 PATCH 09/10] net: ti: prueth: Adds power management support for PRU-ICSS Basharath Hussain Khaja
2025-01-24 14:45 ` [RFC v2 PATCH 10/10] arm: dts: ti: Adds device tree nodes for PRU Cores, IEP and eCAP modules of PRU-ICSS2 Instance Basharath Hussain Khaja
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=20250131103352.GH24105@kernel.org \
--to=horms@kernel.org \
--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=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=linux-omap@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=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.