Message ID | 20231212115841.3800241-4-quic_jsuraj@quicinc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp7669591vqy; Tue, 12 Dec 2023 04:00:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IHqthCdWCa6EU9GuwuYiMadNFl7CIb5ffPvGca/sra4A3hkdGGr6hVJvQBv+HwascixXtC2 X-Received: by 2002:a05:6870:70a4:b0:1fb:75c:4016 with SMTP id v36-20020a05687070a400b001fb075c4016mr7781509oae.118.1702382435141; Tue, 12 Dec 2023 04:00:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702382435; cv=none; d=google.com; s=arc-20160816; b=eiVIGPJMWT0TwpCxSHZWCzMjr4BnTY0XK4cRM/op4zgso04T9TYkQNB7AqBjGBUNiv 1A0qTPPeFyQaY7wjpXdKbJmj9sqboh1/WDiwNyacS9DmI5lGjpWRHpE6+Uu1igWXyHxE oLVjZ6A046kU+hvsS9j31EtD5ghpyiSEHS7y0igOXlP1gSiD/ui/h7id/sIyL4PBT4Nn R0E8Vfe/8/fIlJY5f2U9f0pkoHMH/avCn5ZmtQkZBN+zjObiS9FVh02y5P/UlVyqJGcN rJ3EKeeih+PbEJo7vp9+/v8900/j5HRCjnHdGVqCpRnwLIyUi7K3O48Awt6PZAtbPos8 Kpiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=g6HqMetjFG/uo5SDnsvOVJKxQYze5a/R9LJ9E8Klzso=; fh=AO1athPla3jqhCn4k6adBHi7gs3A5EcpzQmM6u71SYU=; b=0C4gyltI3QlCObWaSuoAafq8QeSzQpvFY1bc0d6JBRDbQgMg5jjfFWmcIZoL+zH1Fn 2Othrv7KXlztF40py+55+M6mhVk3f6wA9RtNxLq27f5/xV9wVnc6I49Eb3Wfol71y+CI e1SoX4xxrQcInLgE7X9I1Kn7ElEq7W9ifeOT+MG2Z1fqz49rpp2SIxgePbZknl2Se8HO zmeOwliI5FGjXCCCkpN6BZl++cePt/g/pQSJPGXPsBYX/3+wbOpPOsz5jh/WpdkOTur/ t/nZx0XlNYmVLYm0kuYsgJ78fba2/V1PFHCjj6P/4aEU7pqK2Ma48pXcyhWuTF7vIx8p ZQmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=olslnvGn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id u2-20020a63df02000000b005be03f0da7csi7648112pgg.61.2023.12.12.04.00.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 04:00:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=olslnvGn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 0E746807C554; Tue, 12 Dec 2023 04:00:11 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346413AbjLLL7p (ORCPT <rfc822;dexuan.linux@gmail.com> + 99 others); Tue, 12 Dec 2023 06:59:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346408AbjLLL7l (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 12 Dec 2023 06:59:41 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F393F3; Tue, 12 Dec 2023 03:59:47 -0800 (PST) Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BCBhcpk030173; Tue, 12 Dec 2023 11:59:35 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= qcppdkim1; bh=g6HqMetjFG/uo5SDnsvOVJKxQYze5a/R9LJ9E8Klzso=; b=ol slnvGnb060VMJW0ZLhGajsbCt0aUwC/Qy9ctV0BcqOuspLYnNPJtvGM2EqDljKOr rnvNZMei9V6DEcIWwMFZn8NdmEeENrmalsStYVSI5005zITMMz7pBj3dIfy6xk6O 3SfxaY+B8CWfMQGh0op2YwqhDNxWVnX6pHs+5qAloK26ge+ZgzJBUKeKb1soeSJi xnEw/m+hTLfsjfyBtRA0gKnxrbwKBW9mHogdj55jZDDJAGrZP4hagESP7ZFLX2vt OELJ2MjiHQoFU0gtkxC+Xv+rmMGJCvlSyi8TZoUWl04hfCkBqesOL7yRmy5O8vaI 4ex6/XlPjYQcGdNHkvPw== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3uxa901n4k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Dec 2023 11:59:34 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3BCBxXNU020070 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Dec 2023 11:59:33 GMT Received: from hu-jsuraj-hyd.qualcomm.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Tue, 12 Dec 2023 03:59:23 -0800 From: Suraj Jaiswal <quic_jsuraj@quicinc.com> To: <quic_jsuraj@quicinc.com>, Vinod Koul <vkoul@kernel.org>, Bhupesh Sharma <bhupesh.sharma@linaro.org>, Andy Gross <agross@kernel.org>, Bjorn Andersson <andersson@kernel.org>, Konrad Dybcio <konrad.dybcio@linaro.org>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, "Jakub Kicinski" <kuba@kernel.org>, Rob Herring <robh+dt@kernel.org>, "Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>, Conor Dooley <conor+dt@kernel.org>, Alexandre Torgue <alexandre.torgue@foss.st.com>, "Jose Abreu" <joabreu@synopsys.com>, Maxime Coquelin <mcoquelin.stm32@gmail.com>, <netdev@vger.kernel.org>, <linux-arm-msm@vger.kernel.org>, <devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <linux-stm32@st-md-mailman.stormreply.com>, Prasad Sodagudi <psodagud@quicinc.com>, Andrew Halaney <ahalaney@redhat.com>, Rob Herring <robh@kernel.org> CC: <kernel@quicinc.com> Subject: [PATCH net-next v6 3/3] net: stmmac: Add driver support for DWMAC5 common safety IRQ Date: Tue, 12 Dec 2023 17:28:41 +0530 Message-ID: <20231212115841.3800241-4-quic_jsuraj@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231212115841.3800241-1-quic_jsuraj@quicinc.com> References: <20231212115841.3800241-1-quic_jsuraj@quicinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: nF5iIgNy9QigahSqW3PLAJDn9BhcnrV7 X-Proofpoint-ORIG-GUID: nF5iIgNy9QigahSqW3PLAJDn9BhcnrV7 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-09_02,2023-12-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 phishscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 impostorscore=0 mlxscore=0 clxscore=1015 priorityscore=1501 suspectscore=0 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2312120096 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 12 Dec 2023 04:00:11 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785077364332871295 X-GMAIL-MSGID: 1785077364332871295 |
Series |
Ethernet DWMAC5 fault IRQ support
|
|
Commit Message
Suraj Jaiswal
Dec. 12, 2023, 11:58 a.m. UTC
Add support to listen HW safety IRQ like ECC(error
correction code), DPP(data path parity), FSM(finite state
machine) fault in common IRQ line.
Signed-off-by: Suraj Jaiswal <quic_jsuraj@quicinc.com>
---
drivers/net/ethernet/stmicro/stmmac/common.h | 1 +
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 3 +++
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 21 +++++++++++++++++++
.../ethernet/stmicro/stmmac/stmmac_platform.c | 9 ++++++++
4 files changed, 34 insertions(+)
Comments
On Tue, 2023-12-12 at 17:28 +0530, Suraj Jaiswal wrote: > @@ -3759,6 +3763,7 @@ static int stmmac_request_irq_single(struct net_device *dev) > struct stmmac_priv *priv = netdev_priv(dev); > enum request_irq_err irq_err; > int ret; > + char *int_name; I'm sorry to nit-pick, but please respect the reverse x-mas tree above, Otherwise LGTM! Cheers, Paolo
Hi Suraj On Tue, Dec 12, 2023 at 05:28:41PM +0530, Suraj Jaiswal wrote: > Add support to listen HW safety IRQ like ECC(error > correction code), DPP(data path parity), FSM(finite state > machine) fault in common IRQ line. > > Signed-off-by: Suraj Jaiswal <quic_jsuraj@quicinc.com> > --- > drivers/net/ethernet/stmicro/stmmac/common.h | 1 + > drivers/net/ethernet/stmicro/stmmac/stmmac.h | 3 +++ > .../net/ethernet/stmicro/stmmac/stmmac_main.c | 21 +++++++++++++++++++ > .../ethernet/stmicro/stmmac/stmmac_platform.c | 9 ++++++++ > 4 files changed, 34 insertions(+) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h > index 721c1f8e892f..b9233b09b80f 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/common.h > +++ b/drivers/net/ethernet/stmicro/stmmac/common.h > @@ -344,6 +344,7 @@ enum request_irq_err { > REQ_IRQ_ERR_ALL, > REQ_IRQ_ERR_TX, > REQ_IRQ_ERR_RX, > + REQ_IRQ_ERR_SFTY, > REQ_IRQ_ERR_SFTY_UE, > REQ_IRQ_ERR_SFTY_CE, > REQ_IRQ_ERR_LPI, > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h > index 9f89acf31050..ca3d93851bed 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h > @@ -31,6 +31,7 @@ struct stmmac_resources { > int wol_irq; > int lpi_irq; > int irq; > + int sfty_irq; > int sfty_ce_irq; > int sfty_ue_irq; > int rx_irq[MTL_MAX_RX_QUEUES]; > @@ -297,6 +298,7 @@ struct stmmac_priv { > void __iomem *ptpaddr; > void __iomem *estaddr; > unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; > + int sfty_irq; > int sfty_ce_irq; > int sfty_ue_irq; > int rx_irq[MTL_MAX_RX_QUEUES]; > @@ -305,6 +307,7 @@ struct stmmac_priv { > char int_name_mac[IFNAMSIZ + 9]; > char int_name_wol[IFNAMSIZ + 9]; > char int_name_lpi[IFNAMSIZ + 9]; > + char int_name_sfty[IFNAMSIZ + 10]; > char int_name_sfty_ce[IFNAMSIZ + 10]; > char int_name_sfty_ue[IFNAMSIZ + 10]; > char int_name_rx_irq[MTL_MAX_TX_QUEUES][IFNAMSIZ + 14]; > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > index 47de466e432c..6cf289f192a7 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > @@ -3592,6 +3592,10 @@ static void stmmac_free_irq(struct net_device *dev, > if (priv->wol_irq > 0 && priv->wol_irq != dev->irq) > free_irq(priv->wol_irq, dev); > fallthrough; > + case REQ_IRQ_ERR_SFTY: > + if (priv->sfty_irq > 0 && priv->sfty_irq != dev->irq) > + free_irq(priv->sfty_irq, dev); > + fallthrough; > case REQ_IRQ_ERR_WOL: > free_irq(dev->irq, dev); > fallthrough; > @@ -3759,6 +3763,7 @@ static int stmmac_request_irq_single(struct net_device *dev) > struct stmmac_priv *priv = netdev_priv(dev); > enum request_irq_err irq_err; > int ret; > + char *int_name; See my comment below. > > ret = request_irq(dev->irq, stmmac_interrupt, > IRQF_SHARED, dev->name, dev); > @@ -3798,6 +3803,20 @@ static int stmmac_request_irq_single(struct net_device *dev) > } > } > > + if (priv->sfty_irq > 0 && priv->sfty_irq != dev->irq) { > + int_name = priv->int_name_sfty; > + sprintf(int_name, "%s:%s", dev->name, "safety"); > + ret = request_irq(priv->sfty_irq, stmmac_safety_interrupt, > + 0, int_name, dev); > + if (unlikely(ret < 0)) { > + netdev_err(priv->dev, > + "%s: alloc safety failed %d (error: %d)\n", > + __func__, priv->sfty_irq, ret); > + irq_err = REQ_IRQ_ERR_SFTY; > + goto irq_error; > + } > + } > + Omg, I thought this change belonged to stmmac_request_irq_multi_msi(). My bad, sorry. Please move the code above to stmmac_request_irq_multi_msi() and get back the part in stmmac_request_irq_single() as it was in v5, but instead of specifying "safety" IRQ name use "dev->name" as the rest of similar code snippets in here have: + if (priv->sfty_irq > 0 && priv->sfty_irq != dev->irq) { + ret = request_irq(priv->sfty_irq, stmmac_safety_interrupt, + 0, dev->name, dev); + if (unlikely(ret < 0)) { + netdev_err(priv->dev, + "%s: alloc safety failed %d (error: %d)\n", + __func__, priv->sfty_irq, ret); + irq_err = REQ_IRQ_ERR_SFTY; + goto irq_error; + } + } I guess at some point afterwards we'll need to refactor the IRQs request part of this driver: replace stmmac_request_irq_single() body with the upper part of the stmmac_request_irq_multi_msi() method and then just make the former method being called from the later one... > return 0; > > irq_error: > @@ -7462,8 +7481,10 @@ int stmmac_dvr_probe(struct device *device, > priv->dev->irq = res->irq; > priv->wol_irq = res->wol_irq; > priv->lpi_irq = res->lpi_irq; > + priv->sfty_irq = res->sfty_irq; > priv->sfty_ce_irq = res->sfty_ce_irq; > priv->sfty_ue_irq = res->sfty_ue_irq; > + Please drop this change. The code below is attached to the code above because it basically does the same but in the loop. > for (i = 0; i < MTL_MAX_RX_QUEUES; i++) > priv->rx_irq[i] = res->rx_irq[i]; > for (i = 0; i < MTL_MAX_TX_QUEUES; i++) > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c > index 1ffde555da47..3808a3225a7d 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c > @@ -726,6 +726,15 @@ int stmmac_get_platform_resources(struct platform_device *pdev, > dev_info(&pdev->dev, "IRQ eth_lpi not found\n"); > } > > + stmmac_res->sfty_irq = > + platform_get_irq_byname_optional(pdev, "sfty"); > + Please drop this change too. It's normal to have a method call attached to the error check statement especially seeing the rest of the similar code snippets are designed that way in this function. -Serge(y) > + if (stmmac_res->sfty_irq < 0) { > + if (stmmac_res->sfty_irq == -EPROBE_DEFER) > + return -EPROBE_DEFER; > + dev_info(&pdev->dev, "IRQ safety IRQ not found\n"); > + } > + > stmmac_res->addr = devm_platform_ioremap_resource(pdev, 0); > > return PTR_ERR_OR_ZERO(stmmac_res->addr); > -- > 2.25.1 > >
Hi Serge, Please find commnet inline & let me know if any further action needed Thanks Suraj On 12/14/2023 8:42 PM, Serge Semin wrote: > Hi Suraj > > On Tue, Dec 12, 2023 at 05:28:41PM +0530, Suraj Jaiswal wrote: >> Add support to listen HW safety IRQ like ECC(error >> correction code), DPP(data path parity), FSM(finite state >> machine) fault in common IRQ line. >> >> Signed-off-by: Suraj Jaiswal <quic_jsuraj@quicinc.com> >> --- >> drivers/net/ethernet/stmicro/stmmac/common.h | 1 + >> drivers/net/ethernet/stmicro/stmmac/stmmac.h | 3 +++ >> .../net/ethernet/stmicro/stmmac/stmmac_main.c | 21 +++++++++++++++++++ >> .../ethernet/stmicro/stmmac/stmmac_platform.c | 9 ++++++++ >> 4 files changed, 34 insertions(+) >> >> diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h >> index 721c1f8e892f..b9233b09b80f 100644 >> --- a/drivers/net/ethernet/stmicro/stmmac/common.h >> +++ b/drivers/net/ethernet/stmicro/stmmac/common.h >> @@ -344,6 +344,7 @@ enum request_irq_err { >> REQ_IRQ_ERR_ALL, >> REQ_IRQ_ERR_TX, >> REQ_IRQ_ERR_RX, >> + REQ_IRQ_ERR_SFTY, >> REQ_IRQ_ERR_SFTY_UE, >> REQ_IRQ_ERR_SFTY_CE, >> REQ_IRQ_ERR_LPI, >> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h >> index 9f89acf31050..ca3d93851bed 100644 >> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h >> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h >> @@ -31,6 +31,7 @@ struct stmmac_resources { >> int wol_irq; >> int lpi_irq; >> int irq; >> + int sfty_irq; >> int sfty_ce_irq; >> int sfty_ue_irq; >> int rx_irq[MTL_MAX_RX_QUEUES]; >> @@ -297,6 +298,7 @@ struct stmmac_priv { >> void __iomem *ptpaddr; >> void __iomem *estaddr; >> unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; >> + int sfty_irq; >> int sfty_ce_irq; >> int sfty_ue_irq; >> int rx_irq[MTL_MAX_RX_QUEUES]; >> @@ -305,6 +307,7 @@ struct stmmac_priv { >> char int_name_mac[IFNAMSIZ + 9]; >> char int_name_wol[IFNAMSIZ + 9]; >> char int_name_lpi[IFNAMSIZ + 9]; >> + char int_name_sfty[IFNAMSIZ + 10]; >> char int_name_sfty_ce[IFNAMSIZ + 10]; >> char int_name_sfty_ue[IFNAMSIZ + 10]; >> char int_name_rx_irq[MTL_MAX_TX_QUEUES][IFNAMSIZ + 14]; >> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c >> index 47de466e432c..6cf289f192a7 100644 >> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c >> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c >> @@ -3592,6 +3592,10 @@ static void stmmac_free_irq(struct net_device *dev, >> if (priv->wol_irq > 0 && priv->wol_irq != dev->irq) >> free_irq(priv->wol_irq, dev); >> fallthrough; >> + case REQ_IRQ_ERR_SFTY: >> + if (priv->sfty_irq > 0 && priv->sfty_irq != dev->irq) >> + free_irq(priv->sfty_irq, dev); >> + fallthrough; >> case REQ_IRQ_ERR_WOL: >> free_irq(dev->irq, dev); >> fallthrough; >> @@ -3759,6 +3763,7 @@ static int stmmac_request_irq_single(struct net_device *dev) >> struct stmmac_priv *priv = netdev_priv(dev); >> enum request_irq_err irq_err; >> int ret; > >> + char *int_name; > > See my comment below. > >> >> ret = request_irq(dev->irq, stmmac_interrupt, >> IRQF_SHARED, dev->name, dev); >> @@ -3798,6 +3803,20 @@ static int stmmac_request_irq_single(struct net_device *dev) >> } >> } >> > >> + if (priv->sfty_irq > 0 && priv->sfty_irq != dev->irq) { >> + int_name = priv->int_name_sfty; >> + sprintf(int_name, "%s:%s", dev->name, "safety"); >> + ret = request_irq(priv->sfty_irq, stmmac_safety_interrupt, >> + 0, int_name, dev); >> + if (unlikely(ret < 0)) { >> + netdev_err(priv->dev, >> + "%s: alloc safety failed %d (error: %d)\n", >> + __func__, priv->sfty_irq, ret); >> + irq_err = REQ_IRQ_ERR_SFTY; >> + goto irq_error; >> + } >> + } >> + > > Omg, I thought this change belonged to stmmac_request_irq_multi_msi(). > My bad, sorry. Please move the code above to > stmmac_request_irq_multi_msi() and get back the part in > stmmac_request_irq_single() as it was in v5, but instead of specifying > "safety" IRQ name use "dev->name" as the rest of similar code snippets > in here have: > > + if (priv->sfty_irq > 0 && priv->sfty_irq != dev->irq) { > + ret = request_irq(priv->sfty_irq, stmmac_safety_interrupt, > + 0, dev->name, dev); > + if (unlikely(ret < 0)) { > + netdev_err(priv->dev, > + "%s: alloc safety failed %d (error: %d)\n", > + __func__, priv->sfty_irq, ret); > + irq_err = REQ_IRQ_ERR_SFTY; > + goto irq_error; > + } > + } <Suraj> We can not use "dev->name" as this is name already used by "stmmac_interrupt" @ https://elixir.bootlin.com/linux/v6.1.68/source/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c#L3655. < ret = request_irq(dev->irq, stmmac_interrupt, IRQF_SHARED, dev->name, dev); > if we are using same "dev->name" while requesting safety IRQ as well then "/proc/interrupt" will show same name eth0/eth1 for both "stmmac_interrupt" & "safety interrupt" and by looking at "/proc/interrupt" output we can not say which IRQ is for safety and which is for stmmac_interrupt. > > I guess at some point afterwards we'll need to refactor the IRQs > request part of this driver: replace stmmac_request_irq_single() body > with the upper part of the stmmac_request_irq_multi_msi() method and > then just make the former method being called from the later one... > >> return 0; >> >> irq_error: >> @@ -7462,8 +7481,10 @@ int stmmac_dvr_probe(struct device *device, >> priv->dev->irq = res->irq; >> priv->wol_irq = res->wol_irq; >> priv->lpi_irq = res->lpi_irq; >> + priv->sfty_irq = res->sfty_irq; >> priv->sfty_ce_irq = res->sfty_ce_irq; >> priv->sfty_ue_irq = res->sfty_ue_irq; > >> + > > Please drop this change. The code below is attached to the code above > because it basically does the same but in the loop. <Suraj> below loop code "for (i = 0; i < MTL_MAX_RX_QUEUES; i++) priv->rx_irq[i] = res->rx_irq[i];" is not for rx_irq array and will not help for safety irq. Let me know if I got your commnet properly . > >> for (i = 0; i < MTL_MAX_RX_QUEUES; i++) >> priv->rx_irq[i] = res->rx_irq[i]; >> for (i = 0; i < MTL_MAX_TX_QUEUES; i++) >> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c >> index 1ffde555da47..3808a3225a7d 100644 >> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c >> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c >> @@ -726,6 +726,15 @@ int stmmac_get_platform_resources(struct platform_device *pdev, >> dev_info(&pdev->dev, "IRQ eth_lpi not found\n"); >> } >> >> + stmmac_res->sfty_irq = >> + platform_get_irq_byname_optional(pdev, "sfty"); > >> + > > Please drop this change too. It's normal to have a method call > attached to the error check statement especially seeing the rest of > the similar code snippets are designed that way in this function. <Suraj> Do you means to remove all below code where we are printing the dev_info() message ? We added this code similar to LPM code. > > -Serge(y) > >> + if (stmmac_res->sfty_irq < 0) { >> + if (stmmac_res->sfty_irq == -EPROBE_DEFER) >> + return -EPROBE_DEFER; >> + dev_info(&pdev->dev, "IRQ safety IRQ not found\n"); >> + } >> + >> stmmac_res->addr = devm_platform_ioremap_resource(pdev, 0); >> >> return PTR_ERR_OR_ZERO(stmmac_res->addr); >> -- >> 2.25.1 >> >>
On Mon, Dec 18, 2023 at 03:27:54PM +0530, Suraj Jaiswal wrote: > > Hi Serge, > Please find commnet inline & let me know if any further action needed > > Thanks > Suraj > > On 12/14/2023 8:42 PM, Serge Semin wrote: > > Hi Suraj > > > > On Tue, Dec 12, 2023 at 05:28:41PM +0530, Suraj Jaiswal wrote: > >> Add support to listen HW safety IRQ like ECC(error > >> correction code), DPP(data path parity), FSM(finite state > >> machine) fault in common IRQ line. > >> > >> Signed-off-by: Suraj Jaiswal <quic_jsuraj@quicinc.com> > >> --- > >> drivers/net/ethernet/stmicro/stmmac/common.h | 1 + > >> drivers/net/ethernet/stmicro/stmmac/stmmac.h | 3 +++ > >> .../net/ethernet/stmicro/stmmac/stmmac_main.c | 21 +++++++++++++++++++ > >> .../ethernet/stmicro/stmmac/stmmac_platform.c | 9 ++++++++ > >> 4 files changed, 34 insertions(+) > >> > >> diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h > >> index 721c1f8e892f..b9233b09b80f 100644 > >> --- a/drivers/net/ethernet/stmicro/stmmac/common.h > >> +++ b/drivers/net/ethernet/stmicro/stmmac/common.h > >> @@ -344,6 +344,7 @@ enum request_irq_err { > >> REQ_IRQ_ERR_ALL, > >> REQ_IRQ_ERR_TX, > >> REQ_IRQ_ERR_RX, > >> + REQ_IRQ_ERR_SFTY, > >> REQ_IRQ_ERR_SFTY_UE, > >> REQ_IRQ_ERR_SFTY_CE, > >> REQ_IRQ_ERR_LPI, > >> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h > >> index 9f89acf31050..ca3d93851bed 100644 > >> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h > >> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h > >> @@ -31,6 +31,7 @@ struct stmmac_resources { > >> int wol_irq; > >> int lpi_irq; > >> int irq; > >> + int sfty_irq; > >> int sfty_ce_irq; > >> int sfty_ue_irq; > >> int rx_irq[MTL_MAX_RX_QUEUES]; > >> @@ -297,6 +298,7 @@ struct stmmac_priv { > >> void __iomem *ptpaddr; > >> void __iomem *estaddr; > >> unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; > >> + int sfty_irq; > >> int sfty_ce_irq; > >> int sfty_ue_irq; > >> int rx_irq[MTL_MAX_RX_QUEUES]; > >> @@ -305,6 +307,7 @@ struct stmmac_priv { > >> char int_name_mac[IFNAMSIZ + 9]; > >> char int_name_wol[IFNAMSIZ + 9]; > >> char int_name_lpi[IFNAMSIZ + 9]; > >> + char int_name_sfty[IFNAMSIZ + 10]; > >> char int_name_sfty_ce[IFNAMSIZ + 10]; > >> char int_name_sfty_ue[IFNAMSIZ + 10]; > >> char int_name_rx_irq[MTL_MAX_TX_QUEUES][IFNAMSIZ + 14]; > >> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > >> index 47de466e432c..6cf289f192a7 100644 > >> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > >> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > >> @@ -3592,6 +3592,10 @@ static void stmmac_free_irq(struct net_device *dev, > >> if (priv->wol_irq > 0 && priv->wol_irq != dev->irq) > >> free_irq(priv->wol_irq, dev); > >> fallthrough; > >> + case REQ_IRQ_ERR_SFTY: > >> + if (priv->sfty_irq > 0 && priv->sfty_irq != dev->irq) > >> + free_irq(priv->sfty_irq, dev); > >> + fallthrough; > >> case REQ_IRQ_ERR_WOL: > >> free_irq(dev->irq, dev); > >> fallthrough; > >> @@ -3759,6 +3763,7 @@ static int stmmac_request_irq_single(struct net_device *dev) > >> struct stmmac_priv *priv = netdev_priv(dev); > >> enum request_irq_err irq_err; > >> int ret; > > > >> + char *int_name; > > > > See my comment below. > > > >> > >> ret = request_irq(dev->irq, stmmac_interrupt, > >> IRQF_SHARED, dev->name, dev); > >> @@ -3798,6 +3803,20 @@ static int stmmac_request_irq_single(struct net_device *dev) > >> } > >> } > >> > > > >> + if (priv->sfty_irq > 0 && priv->sfty_irq != dev->irq) { > >> + int_name = priv->int_name_sfty; > >> + sprintf(int_name, "%s:%s", dev->name, "safety"); > >> + ret = request_irq(priv->sfty_irq, stmmac_safety_interrupt, > >> + 0, int_name, dev); > >> + if (unlikely(ret < 0)) { > >> + netdev_err(priv->dev, > >> + "%s: alloc safety failed %d (error: %d)\n", > >> + __func__, priv->sfty_irq, ret); > >> + irq_err = REQ_IRQ_ERR_SFTY; > >> + goto irq_error; > >> + } > >> + } > >> + > > > > Omg, I thought this change belonged to stmmac_request_irq_multi_msi(). > > My bad, sorry. Please move the code above to > > stmmac_request_irq_multi_msi() and get back the part in > > stmmac_request_irq_single() as it was in v5, Please note my comment regarding the common safety IRQ being supported in both stmmac_request_irq_single() and stmmac_request_irq_multi_msi() methods. > but instead of specifying > > "safety" IRQ name use "dev->name" as the rest of similar code snippets > > in here have: > > > > + if (priv->sfty_irq > 0 && priv->sfty_irq != dev->irq) { > > + ret = request_irq(priv->sfty_irq, stmmac_safety_interrupt, > > + 0, dev->name, dev); > > + if (unlikely(ret < 0)) { > > + netdev_err(priv->dev, > > + "%s: alloc safety failed %d (error: %d)\n", > > + __func__, priv->sfty_irq, ret); > > + irq_err = REQ_IRQ_ERR_SFTY; > > + goto irq_error; > > + } > > + } > > <Suraj> We can not use "dev->name" as this is name already used by "stmmac_interrupt" @ https://elixir.bootlin.com/linux/v6.1.68/source/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c#L3655. It's not that much of the problem. The main idea is to convert your solution to following the _local_ coding convention. See, the rest of the IRQs in stmmac_request_irq_single() are requested with "dev->name" being specified as the IRQ name (irrespective to having such solution being not that correct). That's what I was talking about. If you want the safety IRQ to have an unique name, then please submit this patch as I suggested above and _then_, on top of it, add a new patch which would convert the entire stmmac_request_irq_single() method to creating all IRQ names as it's, for instance, done in stmmac_request_irq_multi_msi(). > < > ret = request_irq(dev->irq, stmmac_interrupt, > IRQF_SHARED, dev->name, dev); > > > if we are using same "dev->name" while requesting safety IRQ as well then "/proc/interrupt" will show same name eth0/eth1 for both "stmmac_interrupt" & "safety interrupt" and by looking at "/proc/interrupt" output we can not say which IRQ is for safety and which is for stmmac_interrupt. Thanks. I am perfectly aware of that. Please see my comment above. > > > > I guess at some point afterwards we'll need to refactor the IRQs > > request part of this driver: replace stmmac_request_irq_single() body > > with the upper part of the stmmac_request_irq_multi_msi() method and > > then just make the former method being called from the later one... > > > >> return 0; > >> > >> irq_error: > >> @@ -7462,8 +7481,10 @@ int stmmac_dvr_probe(struct device *device, > >> priv->dev->irq = res->irq; > >> priv->wol_irq = res->wol_irq; > >> priv->lpi_irq = res->lpi_irq; > >> + priv->sfty_irq = res->sfty_irq; > >> priv->sfty_ce_irq = res->sfty_ce_irq; > >> priv->sfty_ue_irq = res->sfty_ue_irq; > > > >> + > > > > Please drop this change. The code below is attached to the code above > > because it basically does the same but in the loop. > <Suraj> below loop code "for (i = 0; i < MTL_MAX_RX_QUEUES; i++) priv->rx_irq[i] = res->rx_irq[i];" is not for rx_irq array and will not help for safety irq. > Let me know if I got your commnet properly . Sorry, you didn't. My comment concerned the _empty_ line you placed between the code above and below. You shouldn't have done that. > > > >> for (i = 0; i < MTL_MAX_RX_QUEUES; i++) > >> priv->rx_irq[i] = res->rx_irq[i]; > >> for (i = 0; i < MTL_MAX_TX_QUEUES; i++) > >> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c > >> index 1ffde555da47..3808a3225a7d 100644 > >> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c > >> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c > >> @@ -726,6 +726,15 @@ int stmmac_get_platform_resources(struct platform_device *pdev, > >> dev_info(&pdev->dev, "IRQ eth_lpi not found\n"); > >> } > >> > >> + stmmac_res->sfty_irq = > >> + platform_get_irq_byname_optional(pdev, "sfty"); > > > >> + > > > > Please drop this change too. It's normal to have a method call > > attached to the error check statement especially seeing the rest of > > the similar code snippets are designed that way in this function. > <Suraj> Do you means to remove all below code where we are printing the dev_info() message ? No. I was referring to the _empty_ line between the method above and the error check code below. It's pointless and at the very least breaks the local coding convention. -Serge(y) > We added this code similar to LPM code. > > > > -Serge(y) > > > >> + if (stmmac_res->sfty_irq < 0) { > >> + if (stmmac_res->sfty_irq == -EPROBE_DEFER) > >> + return -EPROBE_DEFER; > >> + dev_info(&pdev->dev, "IRQ safety IRQ not found\n"); > >> + } > >> + > >> stmmac_res->addr = devm_platform_ioremap_resource(pdev, 0); > >> > >> return PTR_ERR_OR_ZERO(stmmac_res->addr); > >> -- > >> 2.25.1 > >> > >>
Hi Serge, takan care of all commnets in V7 . Please review Thanks Suraj On 12/18/2023 4:18 PM, Serge Semin wrote: > On Mon, Dec 18, 2023 at 03:27:54PM +0530, Suraj Jaiswal wrote: >> >> Hi Serge, >> Please find commnet inline & let me know if any further action needed >> >> Thanks >> Suraj >> >> On 12/14/2023 8:42 PM, Serge Semin wrote: >>> Hi Suraj >>> >>> On Tue, Dec 12, 2023 at 05:28:41PM +0530, Suraj Jaiswal wrote: >>>> Add support to listen HW safety IRQ like ECC(error >>>> correction code), DPP(data path parity), FSM(finite state >>>> machine) fault in common IRQ line. >>>> >>>> Signed-off-by: Suraj Jaiswal <quic_jsuraj@quicinc.com> >>>> --- >>>> drivers/net/ethernet/stmicro/stmmac/common.h | 1 + >>>> drivers/net/ethernet/stmicro/stmmac/stmmac.h | 3 +++ >>>> .../net/ethernet/stmicro/stmmac/stmmac_main.c | 21 +++++++++++++++++++ >>>> .../ethernet/stmicro/stmmac/stmmac_platform.c | 9 ++++++++ >>>> 4 files changed, 34 insertions(+) >>>> >>>> diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h >>>> index 721c1f8e892f..b9233b09b80f 100644 >>>> --- a/drivers/net/ethernet/stmicro/stmmac/common.h >>>> +++ b/drivers/net/ethernet/stmicro/stmmac/common.h >>>> @@ -344,6 +344,7 @@ enum request_irq_err { >>>> REQ_IRQ_ERR_ALL, >>>> REQ_IRQ_ERR_TX, >>>> REQ_IRQ_ERR_RX, >>>> + REQ_IRQ_ERR_SFTY, >>>> REQ_IRQ_ERR_SFTY_UE, >>>> REQ_IRQ_ERR_SFTY_CE, >>>> REQ_IRQ_ERR_LPI, >>>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h >>>> index 9f89acf31050..ca3d93851bed 100644 >>>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h >>>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h >>>> @@ -31,6 +31,7 @@ struct stmmac_resources { >>>> int wol_irq; >>>> int lpi_irq; >>>> int irq; >>>> + int sfty_irq; >>>> int sfty_ce_irq; >>>> int sfty_ue_irq; >>>> int rx_irq[MTL_MAX_RX_QUEUES]; >>>> @@ -297,6 +298,7 @@ struct stmmac_priv { >>>> void __iomem *ptpaddr; >>>> void __iomem *estaddr; >>>> unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; >>>> + int sfty_irq; >>>> int sfty_ce_irq; >>>> int sfty_ue_irq; >>>> int rx_irq[MTL_MAX_RX_QUEUES]; >>>> @@ -305,6 +307,7 @@ struct stmmac_priv { >>>> char int_name_mac[IFNAMSIZ + 9]; >>>> char int_name_wol[IFNAMSIZ + 9]; >>>> char int_name_lpi[IFNAMSIZ + 9]; >>>> + char int_name_sfty[IFNAMSIZ + 10]; >>>> char int_name_sfty_ce[IFNAMSIZ + 10]; >>>> char int_name_sfty_ue[IFNAMSIZ + 10]; >>>> char int_name_rx_irq[MTL_MAX_TX_QUEUES][IFNAMSIZ + 14]; >>>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c >>>> index 47de466e432c..6cf289f192a7 100644 >>>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c >>>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c >>>> @@ -3592,6 +3592,10 @@ static void stmmac_free_irq(struct net_device *dev, >>>> if (priv->wol_irq > 0 && priv->wol_irq != dev->irq) >>>> free_irq(priv->wol_irq, dev); >>>> fallthrough; >>>> + case REQ_IRQ_ERR_SFTY: >>>> + if (priv->sfty_irq > 0 && priv->sfty_irq != dev->irq) >>>> + free_irq(priv->sfty_irq, dev); >>>> + fallthrough; >>>> case REQ_IRQ_ERR_WOL: >>>> free_irq(dev->irq, dev); >>>> fallthrough; >>>> @@ -3759,6 +3763,7 @@ static int stmmac_request_irq_single(struct net_device *dev) >>>> struct stmmac_priv *priv = netdev_priv(dev); >>>> enum request_irq_err irq_err; >>>> int ret; >>> >>>> + char *int_name; >>> >>> See my comment below. >>> >>>> >>>> ret = request_irq(dev->irq, stmmac_interrupt, >>>> IRQF_SHARED, dev->name, dev); >>>> @@ -3798,6 +3803,20 @@ static int stmmac_request_irq_single(struct net_device *dev) >>>> } >>>> } >>>> >>> >>>> + if (priv->sfty_irq > 0 && priv->sfty_irq != dev->irq) { >>>> + int_name = priv->int_name_sfty; >>>> + sprintf(int_name, "%s:%s", dev->name, "safety"); >>>> + ret = request_irq(priv->sfty_irq, stmmac_safety_interrupt, >>>> + 0, int_name, dev); >>>> + if (unlikely(ret < 0)) { >>>> + netdev_err(priv->dev, >>>> + "%s: alloc safety failed %d (error: %d)\n", >>>> + __func__, priv->sfty_irq, ret); >>>> + irq_err = REQ_IRQ_ERR_SFTY; >>>> + goto irq_error; >>>> + } >>>> + } >>>> + >>> > >>> Omg, I thought this change belonged to stmmac_request_irq_multi_msi(). >>> My bad, sorry. Please move the code above to >>> stmmac_request_irq_multi_msi() and get back the part in >>> stmmac_request_irq_single() as it was in v5, > > Please note my comment regarding the common safety IRQ being supported > in both stmmac_request_irq_single() and stmmac_request_irq_multi_msi() > methods. > >> but instead of specifying >>> "safety" IRQ name use "dev->name" as the rest of similar code snippets >>> in here have: >>> >>> + if (priv->sfty_irq > 0 && priv->sfty_irq != dev->irq) { >>> + ret = request_irq(priv->sfty_irq, stmmac_safety_interrupt, >>> + 0, dev->name, dev); >>> + if (unlikely(ret < 0)) { >>> + netdev_err(priv->dev, >>> + "%s: alloc safety failed %d (error: %d)\n", >>> + __func__, priv->sfty_irq, ret); >>> + irq_err = REQ_IRQ_ERR_SFTY; >>> + goto irq_error; >>> + } >>> + } >> > >> <Suraj> We can not use "dev->name" as this is name already used by "stmmac_interrupt" @ https://elixir.bootlin.com/linux/v6.1.68/source/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c#L3655. > > It's not that much of the problem. The main idea is to convert your > solution to following the _local_ coding convention. See, the rest of > the IRQs in stmmac_request_irq_single() are requested with "dev->name" > being specified as the IRQ name (irrespective to having such solution > being not that correct). That's what I was talking about. If you want > the safety IRQ to have an unique name, then please submit this patch > as I suggested above and _then_, on top of it, add a new patch which > would convert the entire stmmac_request_irq_single() method to > creating all IRQ names as it's, for instance, done in > stmmac_request_irq_multi_msi(). > >> < >> ret = request_irq(dev->irq, stmmac_interrupt, >> IRQF_SHARED, dev->name, dev); >>> > >> if we are using same "dev->name" while requesting safety IRQ as well then "/proc/interrupt" will show same name eth0/eth1 for both "stmmac_interrupt" & "safety interrupt" and by looking at "/proc/interrupt" output we can not say which IRQ is for safety and which is for stmmac_interrupt. > > Thanks. I am perfectly aware of that. Please see my comment above. > >>> >>> I guess at some point afterwards we'll need to refactor the IRQs >>> request part of this driver: replace stmmac_request_irq_single() body >>> with the upper part of the stmmac_request_irq_multi_msi() method and >>> then just make the former method being called from the later one... >>> >>>> return 0; >>>> >>>> irq_error: >>>> @@ -7462,8 +7481,10 @@ int stmmac_dvr_probe(struct device *device, >>>> priv->dev->irq = res->irq; >>>> priv->wol_irq = res->wol_irq; >>>> priv->lpi_irq = res->lpi_irq; >>>> + priv->sfty_irq = res->sfty_irq; >>>> priv->sfty_ce_irq = res->sfty_ce_irq; >>>> priv->sfty_ue_irq = res->sfty_ue_irq; >>> >>>> + >>> >>> Please drop this change. The code below is attached to the code above >>> because it basically does the same but in the loop. > >> <Suraj> below loop code "for (i = 0; i < MTL_MAX_RX_QUEUES; i++) priv->rx_irq[i] = res->rx_irq[i];" is not for rx_irq array and will not help for safety irq. >> Let me know if I got your commnet properly . > > Sorry, you didn't. My comment concerned the _empty_ line you placed > between the code above and below. You shouldn't have done that. > >>> >>>> for (i = 0; i < MTL_MAX_RX_QUEUES; i++) >>>> priv->rx_irq[i] = res->rx_irq[i]; >>>> for (i = 0; i < MTL_MAX_TX_QUEUES; i++) >>>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c >>>> index 1ffde555da47..3808a3225a7d 100644 >>>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c >>>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c >>>> @@ -726,6 +726,15 @@ int stmmac_get_platform_resources(struct platform_device *pdev, >>>> dev_info(&pdev->dev, "IRQ eth_lpi not found\n"); >>>> } >>>> >>>> + stmmac_res->sfty_irq = >>>> + platform_get_irq_byname_optional(pdev, "sfty"); >>> >>>> + >>> >>> Please drop this change too. It's normal to have a method call >>> attached to the error check statement especially seeing the rest of >>> the similar code snippets are designed that way in this function. > >> <Suraj> Do you means to remove all below code where we are printing the dev_info() message ? > > No. I was referring to the _empty_ line between the method above and > the error check code below. It's pointless and at the very least > breaks the local coding convention. > > -Serge(y) > >> We added this code similar to LPM code. >>> >>> -Serge(y) >>> >>>> + if (stmmac_res->sfty_irq < 0) { >>>> + if (stmmac_res->sfty_irq == -EPROBE_DEFER) >>>> + return -EPROBE_DEFER; >>>> + dev_info(&pdev->dev, "IRQ safety IRQ not found\n"); >>>> + } >>>> + >>>> stmmac_res->addr = devm_platform_ioremap_resource(pdev, 0); >>>> >>>> return PTR_ERR_OR_ZERO(stmmac_res->addr); >>>> -- >>>> 2.25.1 >>>> >>>>
diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h index 721c1f8e892f..b9233b09b80f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/common.h +++ b/drivers/net/ethernet/stmicro/stmmac/common.h @@ -344,6 +344,7 @@ enum request_irq_err { REQ_IRQ_ERR_ALL, REQ_IRQ_ERR_TX, REQ_IRQ_ERR_RX, + REQ_IRQ_ERR_SFTY, REQ_IRQ_ERR_SFTY_UE, REQ_IRQ_ERR_SFTY_CE, REQ_IRQ_ERR_LPI, diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index 9f89acf31050..ca3d93851bed 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -31,6 +31,7 @@ struct stmmac_resources { int wol_irq; int lpi_irq; int irq; + int sfty_irq; int sfty_ce_irq; int sfty_ue_irq; int rx_irq[MTL_MAX_RX_QUEUES]; @@ -297,6 +298,7 @@ struct stmmac_priv { void __iomem *ptpaddr; void __iomem *estaddr; unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; + int sfty_irq; int sfty_ce_irq; int sfty_ue_irq; int rx_irq[MTL_MAX_RX_QUEUES]; @@ -305,6 +307,7 @@ struct stmmac_priv { char int_name_mac[IFNAMSIZ + 9]; char int_name_wol[IFNAMSIZ + 9]; char int_name_lpi[IFNAMSIZ + 9]; + char int_name_sfty[IFNAMSIZ + 10]; char int_name_sfty_ce[IFNAMSIZ + 10]; char int_name_sfty_ue[IFNAMSIZ + 10]; char int_name_rx_irq[MTL_MAX_TX_QUEUES][IFNAMSIZ + 14]; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 47de466e432c..6cf289f192a7 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3592,6 +3592,10 @@ static void stmmac_free_irq(struct net_device *dev, if (priv->wol_irq > 0 && priv->wol_irq != dev->irq) free_irq(priv->wol_irq, dev); fallthrough; + case REQ_IRQ_ERR_SFTY: + if (priv->sfty_irq > 0 && priv->sfty_irq != dev->irq) + free_irq(priv->sfty_irq, dev); + fallthrough; case REQ_IRQ_ERR_WOL: free_irq(dev->irq, dev); fallthrough; @@ -3759,6 +3763,7 @@ static int stmmac_request_irq_single(struct net_device *dev) struct stmmac_priv *priv = netdev_priv(dev); enum request_irq_err irq_err; int ret; + char *int_name; ret = request_irq(dev->irq, stmmac_interrupt, IRQF_SHARED, dev->name, dev); @@ -3798,6 +3803,20 @@ static int stmmac_request_irq_single(struct net_device *dev) } } + if (priv->sfty_irq > 0 && priv->sfty_irq != dev->irq) { + int_name = priv->int_name_sfty; + sprintf(int_name, "%s:%s", dev->name, "safety"); + ret = request_irq(priv->sfty_irq, stmmac_safety_interrupt, + 0, int_name, dev); + if (unlikely(ret < 0)) { + netdev_err(priv->dev, + "%s: alloc safety failed %d (error: %d)\n", + __func__, priv->sfty_irq, ret); + irq_err = REQ_IRQ_ERR_SFTY; + goto irq_error; + } + } + return 0; irq_error: @@ -7462,8 +7481,10 @@ int stmmac_dvr_probe(struct device *device, priv->dev->irq = res->irq; priv->wol_irq = res->wol_irq; priv->lpi_irq = res->lpi_irq; + priv->sfty_irq = res->sfty_irq; priv->sfty_ce_irq = res->sfty_ce_irq; priv->sfty_ue_irq = res->sfty_ue_irq; + for (i = 0; i < MTL_MAX_RX_QUEUES; i++) priv->rx_irq[i] = res->rx_irq[i]; for (i = 0; i < MTL_MAX_TX_QUEUES; i++) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 1ffde555da47..3808a3225a7d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -726,6 +726,15 @@ int stmmac_get_platform_resources(struct platform_device *pdev, dev_info(&pdev->dev, "IRQ eth_lpi not found\n"); } + stmmac_res->sfty_irq = + platform_get_irq_byname_optional(pdev, "sfty"); + + if (stmmac_res->sfty_irq < 0) { + if (stmmac_res->sfty_irq == -EPROBE_DEFER) + return -EPROBE_DEFER; + dev_info(&pdev->dev, "IRQ safety IRQ not found\n"); + } + stmmac_res->addr = devm_platform_ioremap_resource(pdev, 0); return PTR_ERR_OR_ZERO(stmmac_res->addr);