Received: by 2002:ac8:5491:0:b0:40f:fb00:664b with SMTP id h17csp614258qtq; Thu, 10 Aug 2023 10:32:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHhOdhNLv5H6FBYyDTyfqjSsPdbGwBB/k5ykeAANTwenX3vfNcDA41uUYoAhrUBkkYiMEng X-Received: by 2002:a17:903:124e:b0:1bc:1e03:3cbe with SMTP id u14-20020a170903124e00b001bc1e033cbemr3514066plh.18.1691688778275; Thu, 10 Aug 2023 10:32:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691688778; cv=none; d=google.com; s=arc-20160816; b=ikboIVOkJKKK9EYGEZbXKbXgwAWUBQX/nXBgLmCCLCmMInRsydFzsX1gz5K6aVgWCj hkuccsG9yBG1Bk/2bT06mswBzmDAetIPbahQH7u2pcXudB+2Y4SzuAXFozKJR06feA1x dJcwddsKQDPADTidibvDwnDLSW4Tul89CNJLAsFLDWWAP4opIidLZ8n6q/IodPbS+yZX UahpPiY4t88H6MqXrBDGranjY2HoceSpIQl6qYgSkDkNCtkfwGTf9zY2Rmta0BcFdbp6 Or7KHZ0qylYQZphX5WkCi4jMmkAL5UGF3RxypVq+v91cyrVAe3nfs1ueo/bBfPRY0SA6 rmDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ouFUWqwxr+Jkwp0rF1jlyYlJRkqqWcNRPjsW+QRJTSg=; fh=KzKUF4ZXXukyPEC6/VGf4Tsm20U00EXiYjlPQbkmji4=; b=NPPVj5UNJ/tTVEqsb97rKNnUZqJhnPPSyj+/LiC++9gm6Ud5r6Lqby2memFz8ETIAW CIAdF0veaWgohuIT6B7PxjCtwuWw9/BOhzdnt6fY+o4gJkRskvfjjdmjlG38hlrFqQjX gD28wc3olUOitOjHYmsyg0bbC34niHPlOjWAWySAtt5vfC1C8/qlsHRTjKzLXy+cYF6G aqSMx1gyIVWnofQoldqFi7hTqqoMttO5AvIVVBKB7uuParKGbgCBx+3Eb4zUxRu4KWjY 4JH49Vc+0McfHoA9OxQkOBvA0pUP8vr4u49E0YtSkbDcAUu7kpFEm248ra1bfTYDKMjA S89w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ko5x3E5S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b7-20020a170902650700b001b87ecb0e5csi1756976plk.126.2023.08.10.10.32.44; Thu, 10 Aug 2023 10:32:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ko5x3E5S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234182AbjHJQdi (ORCPT + 99 others); Thu, 10 Aug 2023 12:33:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234118AbjHJQdh (ORCPT ); Thu, 10 Aug 2023 12:33:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4A1FE0; Thu, 10 Aug 2023 09:33:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3B66E615C2; Thu, 10 Aug 2023 16:33:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA3B3C433C9; Thu, 10 Aug 2023 16:33:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691685215; bh=SH23v5JCuQahsD9iCM2bgfQbBzq4iPZ3OI2hpiXwSkM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ko5x3E5Spop/wVulrKYKAGXwhX0h3VhOTiUA3kUDvnG/Z0xPIngdAvBHU5NVGjgMu myqzNbAoB7lPj+6uEaP0tBIo6zKdulmQeuL5jcRTwN5ZEHytB9yyrGUxCBDVvdAOEW g00Fmc3K3xgmcldj0PYi/k/aUY0PX4fCPhJrH6dlGhmZVQFmMA2Nd+HZKJhm6z17k6 s4t3nEaoQldEXUCxK3VvIWsFk4n1nVcgsnOT3421iob5/+iYHe6gzEAqAVvKPPr9Qf gJoPRzMTlyaKMmDt3FHjfcT3bnJrGwWo3eoIwRq1OjP+H9T4AJioZwx37m6hNqHULN +jj/pKu/cxjYQ== Date: Fri, 11 Aug 2023 00:21:51 +0800 From: Jisheng Zhang To: Alexandre TORGUE Cc: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Giuseppe Cavallaro , Jose Abreu , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH net-next v3 10/10] net: stmmac: platform: support parsing per channel irq from DT Message-ID: References: <20230809165007.1439-1-jszhang@kernel.org> <20230809165007.1439-11-jszhang@kernel.org> <43ea0060-ed69-4efe-4a39-224aa67ae9b8@foss.st.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 11, 2023 at 12:09:38AM +0800, Jisheng Zhang wrote: > On Thu, Aug 10, 2023 at 04:57:00PM +0200, Alexandre TORGUE wrote: > > On 8/9/23 18:50, Jisheng Zhang wrote: > > > The snps dwmac IP may support per channel interrupt. Add support to > > > parse the per channel irq from DT. > > > > > > Signed-off-by: Jisheng Zhang > > > --- > > > .../net/ethernet/stmicro/stmmac/stmmac_main.c | 10 ++++---- > > > .../ethernet/stmicro/stmmac/stmmac_platform.c | 23 +++++++++++++++++++ > > > 2 files changed, 29 insertions(+), 4 deletions(-) > > > > > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > > > index 4ed5c976c7a3..245eeb7d3e83 100644 > > > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > > > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > > > @@ -3612,7 +3612,7 @@ static int stmmac_request_irq_multi(struct net_device *dev) > > > for (i = 0; i < priv->plat->rx_queues_to_use; i++) { > > > if (i >= MTL_MAX_RX_QUEUES) > > > break; > > > - if (priv->rx_irq[i] == 0) > > > + if (priv->rx_irq[i] <= 0) > > > > What do you fix here ? > > No bug to fix, but adjust for parsing optional channel irqs from DT: > rx_irq[i] and tx_irq[i] may come from platform_get_irq_byname_optional() > so for !STMMAC_FLAG_PERCH_IRQ_EN platforms, they can be < 0. Before > oops, I sent this email too quick before I complete it. After this patch(parse optional channel irqs from DT), rx_irq[i] and tx_irq[i] may come from platform_get_irq_byname_optional(), so for STMMAC_FLAG_PERCH_IRQ_EN platforms which support less than MTL_MAX_TX_QUEUES channels, for example 8 tx and 8 rx, the last tx_irq[i] or rx_irq[i] can be < 0. Thanks > > > continue; > > > int_name = priv->int_name_rx_irq[i]; > > > @@ -3637,7 +3637,7 @@ static int stmmac_request_irq_multi(struct net_device *dev) > > > for (i = 0; i < priv->plat->tx_queues_to_use; i++) { > > > if (i >= MTL_MAX_TX_QUEUES) > > > break; > > > - if (priv->tx_irq[i] == 0) > > > + if (priv->tx_irq[i] <= 0) > > > > same here > > > continue; > > > int_name = priv->int_name_tx_irq[i]; > > > @@ -7278,8 +7278,10 @@ int stmmac_dvr_probe(struct device *device, > > > priv->plat = plat_dat; > > > priv->ioaddr = res->addr; > > > priv->dev->base_addr = (unsigned long)res->addr; > > > - priv->plat->dma_cfg->perch_irq_en = > > > - (priv->plat->flags & STMMAC_FLAG_PERCH_IRQ_EN); > > > + if (res->rx_irq[0] > 0 && res->tx_irq[0] > 0) { > > > + priv->plat->flags |= STMMAC_FLAG_PERCH_IRQ_EN; > > > + priv->plat->dma_cfg->perch_irq_en = true; > > > + } > > > priv->dev->irq = res->irq; > > > priv->wol_irq = res->wol_irq; > > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c > > > index 29145682b57b..9b46775b41ab 100644 > > > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c > > > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c > > > @@ -705,6 +705,9 @@ EXPORT_SYMBOL_GPL(stmmac_remove_config_dt); > > > int stmmac_get_platform_resources(struct platform_device *pdev, > > > struct stmmac_resources *stmmac_res) > > > { > > > + char irq_name[8]; > > > + int i; > > > + > > > memset(stmmac_res, 0, sizeof(*stmmac_res)); > > > /* Get IRQ information early to have an ability to ask for deferred > > > @@ -738,6 +741,26 @@ int stmmac_get_platform_resources(struct platform_device *pdev, > > > dev_info(&pdev->dev, "IRQ eth_lpi not found\n"); > > > } > > > + for (i = 0; i < MTL_MAX_RX_QUEUES; i++) { > > > + snprintf(irq_name, sizeof(irq_name), "rx%i", i); > > > + stmmac_res->rx_irq[i] = platform_get_irq_byname_optional(pdev, irq_name); > > > + if (stmmac_res->rx_irq[i] < 0) { > > > + if (stmmac_res->rx_irq[i] == -EPROBE_DEFER) > > > + return -EPROBE_DEFER; > > > + break; > > > + } > > > + } > > > + > > > + for (i = 0; i < MTL_MAX_TX_QUEUES; i++) { > > > + snprintf(irq_name, sizeof(irq_name), "tx%i", i); > > > + stmmac_res->tx_irq[i] = platform_get_irq_byname_optional(pdev, irq_name); > > > + if (stmmac_res->tx_irq[i] < 0) { > > > + if (stmmac_res->tx_irq[i] == -EPROBE_DEFER) > > > + return -EPROBE_DEFER; > > > + break; > > > + } > > > + } > > > + > > > stmmac_res->sfty_ce_irq = platform_get_irq_byname_optional(pdev, "sfty_ce"); > > > if (stmmac_res->sfty_ce_irq < 0) { > > > if (stmmac_res->sfty_ce_irq == -EPROBE_DEFER) > >