diff mbox series

[v5,2/9] net: stmmac: Allow platforms to set irq_flags

Message ID e18edf4ab0a83de235fa3475eee4ba8ac88ee651.1699533745.git.siyanteng@loongson.cn (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series stmmac: Add Loongson platform support | expand

Checks

Context Check Description
netdev/series_format warning Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1161 this patch: 1161
netdev/cc_maintainers warning 9 maintainers not CCed: ahalaney@redhat.com kuba@kernel.org bartosz.golaszewski@linaro.org edumazet@google.com linux-stm32@st-md-mailman.stormreply.com mcoquelin.stm32@gmail.com linux-arm-kernel@lists.infradead.org pabeni@redhat.com horms@kernel.org
netdev/build_clang success Errors and warnings before: 1161 this patch: 1161
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1189 this patch: 1189
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 64 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Yanteng Si Nov. 10, 2023, 9:25 a.m. UTC
Some platforms need extra irq flags when request multi msi, add
irq_flags variable for them.

Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
Signed-off-by: Feiyang Chen <chenfeiyang@loongson.cn>
Signed-off-by: Yinggang Gu <guyinggang@loongson.cn>
---
 .../net/ethernet/stmicro/stmmac/stmmac_main.c    | 16 +++++++++-------
 include/linux/stmmac.h                           |  1 +
 2 files changed, 10 insertions(+), 7 deletions(-)

Comments

Andrew Lunn Nov. 11, 2023, 7:51 p.m. UTC | #1
On Fri, Nov 10, 2023 at 05:25:41PM +0800, Yanteng Si wrote:
> Some platforms need extra irq flags when request multi msi, add
> irq_flags variable for them.

It would be nice to document what flags are needed.

You also seem to be pass the same flags to all instances of
request_irq. However, the flags should be specific to one irq.  So you
need irq_irq_flags, wol_irq_flags, lpi_irq_flags, etc.


    Andrew

---
pw-bot: cr
Yanteng Si Nov. 21, 2023, 12:01 p.m. UTC | #2
在 2023/11/12 03:51, Andrew Lunn 写道:
> On Fri, Nov 10, 2023 at 05:25:41PM +0800, Yanteng Si wrote:
>> Some platforms need extra irq flags when request multi msi, add
>> irq_flags variable for them.
> It would be nice to document what flags are needed.
>
> You also seem to be pass the same flags to all instances of
> request_irq. However, the flags should be specific to one irq.  So you
> need irq_irq_flags, wol_irq_flags, lpi_irq_flags, etc.

It is a trigger type.


Thanks,

Yanteng

>
>
>      Andrew
>
> ---
> pw-bot: cr
Andrew Lunn Nov. 21, 2023, 1:59 p.m. UTC | #3
On Tue, Nov 21, 2023 at 08:01:53PM +0800, Yanteng Si wrote:
> 
> 在 2023/11/12 03:51, Andrew Lunn 写道:
> > On Fri, Nov 10, 2023 at 05:25:41PM +0800, Yanteng Si wrote:
> > > Some platforms need extra irq flags when request multi msi, add
> > > irq_flags variable for them.
> > It would be nice to document what flags are needed.
> > 
> > You also seem to be pass the same flags to all instances of
> > request_irq. However, the flags should be specific to one irq.  So you
> > need irq_irq_flags, wol_irq_flags, lpi_irq_flags, etc.
> 
> It is a trigger type.

Yes, i figure that out eventually. But it would be good to state it
here.

And trigger type, edge verses level, rising vs falling, is a per
interrupt property. So you do need the flag per interrupt.

	  Andrew
Yanteng Si Nov. 24, 2023, 12:49 p.m. UTC | #4
在 2023/11/21 21:59, Andrew Lunn 写道:
> Yes, i figure that out eventually. But it would be good to state it
> here.
>
> And trigger type, edge verses level, rising vs falling, is a per
> interrupt property. So you do need the flag per interrupt.

I see.


We decided to remove it in the next patch version, and to be honest, the 
flag

is not being used at the moment,  I have test it on the machine in the 
last two

days. Thanks to this, I was able to make the first patch a bit smaller 
as well.


Thanks for your review!


Thanks,

Yanteng
diff mbox series

Patch

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 132d4f679b95..7371713c116d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -3552,7 +3552,7 @@  static int stmmac_request_irq_multi_msi(struct net_device *dev)
 	int_name = priv->int_name_mac;
 	sprintf(int_name, "%s:%s", dev->name, "mac");
 	ret = request_irq(dev->irq, stmmac_mac_interrupt,
-			  0, int_name, dev);
+			  priv->plat->irq_flags, int_name, dev);
 	if (unlikely(ret < 0)) {
 		netdev_err(priv->dev,
 			   "%s: alloc mac MSI %d (error: %d)\n",
@@ -3569,7 +3569,7 @@  static int stmmac_request_irq_multi_msi(struct net_device *dev)
 		sprintf(int_name, "%s:%s", dev->name, "wol");
 		ret = request_irq(priv->wol_irq,
 				  stmmac_mac_interrupt,
-				  0, int_name, dev);
+				  priv->plat->irq_flags, int_name, dev);
 		if (unlikely(ret < 0)) {
 			netdev_err(priv->dev,
 				   "%s: alloc wol MSI %d (error: %d)\n",
@@ -3587,7 +3587,7 @@  static int stmmac_request_irq_multi_msi(struct net_device *dev)
 		sprintf(int_name, "%s:%s", dev->name, "lpi");
 		ret = request_irq(priv->lpi_irq,
 				  stmmac_mac_interrupt,
-				  0, int_name, dev);
+				  priv->plat->irq_flags, int_name, dev);
 		if (unlikely(ret < 0)) {
 			netdev_err(priv->dev,
 				   "%s: alloc lpi MSI %d (error: %d)\n",
@@ -3605,7 +3605,7 @@  static int stmmac_request_irq_multi_msi(struct net_device *dev)
 		sprintf(int_name, "%s:%s", dev->name, "safety-ce");
 		ret = request_irq(priv->sfty_ce_irq,
 				  stmmac_safety_interrupt,
-				  0, int_name, dev);
+				  priv->plat->irq_flags, int_name, dev);
 		if (unlikely(ret < 0)) {
 			netdev_err(priv->dev,
 				   "%s: alloc sfty ce MSI %d (error: %d)\n",
@@ -3623,7 +3623,7 @@  static int stmmac_request_irq_multi_msi(struct net_device *dev)
 		sprintf(int_name, "%s:%s", dev->name, "safety-ue");
 		ret = request_irq(priv->sfty_ue_irq,
 				  stmmac_safety_interrupt,
-				  0, int_name, dev);
+				  priv->plat->irq_flags, int_name, dev);
 		if (unlikely(ret < 0)) {
 			netdev_err(priv->dev,
 				   "%s: alloc sfty ue MSI %d (error: %d)\n",
@@ -3644,7 +3644,8 @@  static int stmmac_request_irq_multi_msi(struct net_device *dev)
 		sprintf(int_name, "%s:%s-%d", dev->name, "rx", i);
 		ret = request_irq(priv->rx_irq[i],
 				  stmmac_msi_intr_rx,
-				  0, int_name, &priv->dma_conf.rx_queue[i]);
+				  priv->plat->irq_flags, int_name,
+				  &priv->dma_conf.rx_queue[i]);
 		if (unlikely(ret < 0)) {
 			netdev_err(priv->dev,
 				   "%s: alloc rx-%d  MSI %d (error: %d)\n",
@@ -3669,7 +3670,8 @@  static int stmmac_request_irq_multi_msi(struct net_device *dev)
 		sprintf(int_name, "%s:%s-%d", dev->name, "tx", i);
 		ret = request_irq(priv->tx_irq[i],
 				  stmmac_msi_intr_tx,
-				  0, int_name, &priv->dma_conf.tx_queue[i]);
+				  priv->plat->irq_flags, int_name,
+				  &priv->dma_conf.tx_queue[i]);
 		if (unlikely(ret < 0)) {
 			netdev_err(priv->dev,
 				   "%s: alloc tx-%d  MSI %d (error: %d)\n",
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index 0b4658a7eceb..664a0e1cefc2 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -312,5 +312,6 @@  struct plat_stmmacenet_data {
 	int msi_tx_base_vec;
 	const struct dwmac4_addrs *dwmac4_addrs;
 	unsigned int flags;
+	unsigned int irq_flags;
 };
 #endif