From: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
To: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.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>,
Geert Uytterhoeven <geert+renesas@glider.be>,
netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
linux-kernel@vger.kernel.org,
Michael Dege <michael.dege@renesas.com>,
Christian Mardmoeller <christian.mardmoeller@renesas.com>,
Dennis Ostermann <dennis.ostermann@renesas.com>
Subject: Re: [PATCH net-next 2/2] net: renesas: rswitch: request ts interrupt at port open
Date: Fri, 20 Dec 2024 09:38:32 +0100 [thread overview]
Message-ID: <Z2UtCBwofyoHlZi0@mev-dev.igk.intel.com> (raw)
In-Reply-To: <20241220041659.2985492-3-nikita.yoush@cogentembedded.com>
On Fri, Dec 20, 2024 at 09:16:59AM +0500, Nikita Yushchenko wrote:
> Data interrupts are now requested at port open and freed at port close.
>
> For symmetry, do the same for ts interrupt.
>
> Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
> ---
> drivers/net/ethernet/renesas/rswitch.c | 35 +++++++++++++-------------
> drivers/net/ethernet/renesas/rswitch.h | 2 +-
> 2 files changed, 18 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/net/ethernet/renesas/rswitch.c b/drivers/net/ethernet/renesas/rswitch.c
> index eb9dea8b16f3..cc8f2a4e3d70 100644
> --- a/drivers/net/ethernet/renesas/rswitch.c
> +++ b/drivers/net/ethernet/renesas/rswitch.c
> @@ -989,18 +989,6 @@ static irqreturn_t rswitch_gwca_ts_irq(int irq, void *dev_id)
> return IRQ_NONE;
> }
>
> -static int rswitch_gwca_ts_request_irqs(struct rswitch_private *priv)
> -{
> - int irq;
> -
> - irq = platform_get_irq_byname(priv->pdev, GWCA_TS_IRQ_RESOURCE_NAME);
> - if (irq < 0)
> - return irq;
> -
> - return devm_request_irq(&priv->pdev->dev, irq, rswitch_gwca_ts_irq,
> - 0, GWCA_TS_IRQ_NAME, priv);
> -}
> -
> /* Ethernet TSN Agent block (ETHA) and Ethernet MAC IP block (RMAC) */
> static int rswitch_etha_change_mode(struct rswitch_etha *etha,
> enum rswitch_etha_mode mode)
> @@ -1510,8 +1498,14 @@ static int rswitch_open(struct net_device *ndev)
> unsigned long flags;
> int ret;
>
> - if (bitmap_empty(rdev->priv->opened_ports, RSWITCH_NUM_PORTS))
> + if (bitmap_empty(rdev->priv->opened_ports, RSWITCH_NUM_PORTS)) {
> + ret = request_irq(rdev->priv->gwca.ts_irq, rswitch_gwca_ts_irq,
> + 0, "rswitch_ts", rdev->priv);
> + if (ret < 0)
> + return ret;
> +
> iowrite32(GWCA_TS_IRQ_BIT, rdev->priv->addr + GWTSDIE);
> + }
>
> napi_enable(&rdev->napi);
>
> @@ -1535,8 +1529,10 @@ static int rswitch_open(struct net_device *ndev)
> err_request_irq:
> napi_disable(&rdev->napi);
>
> - if (bitmap_empty(rdev->priv->opened_ports, RSWITCH_NUM_PORTS))
> + if (bitmap_empty(rdev->priv->opened_ports, RSWITCH_NUM_PORTS)) {
> iowrite32(GWCA_TS_IRQ_BIT, rdev->priv->addr + GWTSDID);
> + free_irq(rdev->priv->gwca.ts_irq, rdev->priv);
> + }
>
> return ret;
> };
> @@ -1562,8 +1558,10 @@ static int rswitch_stop(struct net_device *ndev)
>
> napi_disable(&rdev->napi);
>
> - if (bitmap_empty(rdev->priv->opened_ports, RSWITCH_NUM_PORTS))
> + if (bitmap_empty(rdev->priv->opened_ports, RSWITCH_NUM_PORTS)) {
> iowrite32(GWCA_TS_IRQ_BIT, rdev->priv->addr + GWTSDID);
> + free_irq(rdev->priv->gwca.ts_irq, rdev->priv);
> + }
>
> for (tag = find_first_bit(rdev->ts_skb_used, TS_TAGS_PER_PORT);
> tag < TS_TAGS_PER_PORT;
> @@ -2001,9 +1999,10 @@ static int rswitch_init(struct rswitch_private *priv)
> if (err < 0)
> goto err_ptp_register;
>
> - err = rswitch_gwca_ts_request_irqs(priv);
> + err = platform_get_irq_byname(priv->pdev, GWCA_TS_IRQ_RESOURCE_NAME);
> if (err < 0)
> - goto err_gwca_ts_request_irq;
> + goto err_gwca_ts_irq;
> + priv->gwca.ts_irq = err;
>
> err = rswitch_gwca_hw_init(priv);
> if (err < 0)
> @@ -2035,7 +2034,7 @@ static int rswitch_init(struct rswitch_private *priv)
> rswitch_gwca_hw_deinit(priv);
>
> err_gwca_hw_init:
> -err_gwca_ts_request_irq:
> +err_gwca_ts_irq:
> rcar_gen4_ptp_unregister(priv->ptp_priv);
>
> err_ptp_register:
> diff --git a/drivers/net/ethernet/renesas/rswitch.h b/drivers/net/ethernet/renesas/rswitch.h
> index a1e62a6b3844..54b9f059707a 100644
> --- a/drivers/net/ethernet/renesas/rswitch.h
> +++ b/drivers/net/ethernet/renesas/rswitch.h
> @@ -58,7 +58,6 @@
> #define GWRO RSWITCH_GWCA0_OFFSET
>
> #define GWCA_TS_IRQ_RESOURCE_NAME "gwca0_rxts0"
> -#define GWCA_TS_IRQ_NAME "rswitch: gwca0_rxts0"
> #define GWCA_TS_IRQ_BIT BIT(0)
>
> #define FWRO 0
> @@ -978,6 +977,7 @@ struct rswitch_gwca {
> struct rswitch_gwca_queue *queues;
> int num_queues;
> struct rswitch_gwca_queue ts_queue;
> + int ts_irq;
> DECLARE_BITMAP(used, RSWITCH_MAX_NUM_QUEUES);
> };
Wasn't previous implementation more obvious? This ts irq you have one
per device, no per port, so it better fit to one time initialization
instead of checking if it is first and last port.
Anyway, it is your descision, patch looks correct:
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
>
> --
> 2.39.5
next prev parent reply other threads:[~2024-12-20 8:41 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-20 4:16 [PATCH net-next 0/2] net: renesas: rswitch: update irq handling Nikita Yushchenko
2024-12-20 4:16 ` [PATCH net-next 1/2] net: renesas: rswitch: use per-port irq handlers Nikita Yushchenko
2024-12-20 7:59 ` Geert Uytterhoeven
2024-12-20 8:09 ` Nikita Yushchenko
2024-12-20 9:11 ` Yoshihiro Shimoda
2024-12-20 9:23 ` Nikita Yushchenko
2024-12-20 9:31 ` Andrew Lunn
2024-12-20 8:25 ` Michal Swiatkowski
2024-12-20 9:11 ` Nikita Yushchenko
2024-12-23 5:19 ` Michal Swiatkowski
2024-12-30 10:58 ` Michal Swiatkowski
2024-12-20 9:19 ` Andrew Lunn
2024-12-20 9:33 ` Nikita Yushchenko
2024-12-20 12:16 ` Andrew Lunn
2024-12-20 12:46 ` Nikita Yushchenko
2024-12-20 4:16 ` [PATCH net-next 2/2] net: renesas: rswitch: request ts interrupt at port open Nikita Yushchenko
2024-12-20 8:38 ` Michal Swiatkowski [this message]
2024-12-20 8:51 ` Nikita Yushchenko
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=Z2UtCBwofyoHlZi0@mev-dev.igk.intel.com \
--to=michal.swiatkowski@linux.intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=christian.mardmoeller@renesas.com \
--cc=davem@davemloft.net \
--cc=dennis.ostermann@renesas.com \
--cc=edumazet@google.com \
--cc=geert+renesas@glider.be \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=michael.dege@renesas.com \
--cc=netdev@vger.kernel.org \
--cc=nikita.yoush@cogentembedded.com \
--cc=pabeni@redhat.com \
--cc=yoshihiro.shimoda.uh@renesas.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).