Received: by 2002:a05:6358:51dd:b0:131:369:b2a3 with SMTP id 29csp1238565rwl; Thu, 10 Aug 2023 08:19:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEYWQIeMdDsinGnmjOZx/qr4WT87Q43r4QRTqFzNjRD/f5ZwtPc16DmSToFowkR9B65OvIq X-Received: by 2002:a05:6a20:12c2:b0:140:f6c4:aa71 with SMTP id v2-20020a056a2012c200b00140f6c4aa71mr3737020pzg.8.1691680763558; Thu, 10 Aug 2023 08:19:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691680763; cv=none; d=google.com; s=arc-20160816; b=A+0MNeMO3xqc9QXDqYtRuqb4lfSYsnT56ShYUwq5NcyyNX+pbGRGBCr865Id1ZwEh1 mrX8s68PM1y6dpH5CP0MaQkE/l9zc3oveHtzsue+Vg+ZoJDRUIKj3Q2SkehN1JNkfEUq PMMeNpOTgP5zpqZWjjiAH2ipVuQZRmBw9nJDReDSu7rNkdegyAtBHAqrkvVItlPRaeC8 phJyomt3n/wTVHlDpdHVr+gOp8m9aAr2cOSOmYuRW1mdodalkPmFi8kFqcbSc6gWhGlh pfGEHY3C3qdEAwn/bt/llWDi7tb6r0LeBM4ivHhFNJMmnWozTr+RYuiwHhVhD2JdihJw W3AA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=uxD1byUTfrhwfQBYzxSaLD/QBU94QFTUviGR6L3yWtk=; fh=uY1T7aoRwrgzhKLMykgttq5s/p+N87zA2GATJX0cskU=; b=VzNvJ5sa3GS3fZpWTGPh9ILHr2ACv61Cy85gJSzyV3husEKTJM3hF7QqF31VZr7eMb eF1eVDSGs9yGuWUPkn1vFZnMrN8ceBeBc1u+SzWxy1O/0UF4sn8lkSJWK6z+u9Cq0FQE MLlNz2k5/s/TGb9G25XIyNA6l3lpgiisH8JPMSyf/z18BESWQ7eWhYfC5tFadmFAn1QG M3zxjPt2ibzNkm4VZl5xrgus/aZS3zDannapKNJDSQxilMNW8i9dboWkeb/YOUXQVw7G wezEqa/GV0jkC87Ij6g6omfha0CGJfETyndnzR+00w34pj0YwK4SYA8xbZBRUINND/IJ 5ncA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b="OM94/Fm4"; 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=foss.st.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x18-20020a056a00189200b0065dfb27ee3fsi1729570pfh.246.2023.08.10.08.19.07; Thu, 10 Aug 2023 08:19:23 -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=@foss.st.com header.s=selector1 header.b="OM94/Fm4"; 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=foss.st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235576AbjHJOwh (ORCPT + 99 others); Thu, 10 Aug 2023 10:52:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231807AbjHJOwg (ORCPT ); Thu, 10 Aug 2023 10:52:36 -0400 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C99C12106; Thu, 10 Aug 2023 07:52:35 -0700 (PDT) Received: from pps.filterd (m0288072.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 37ACHBbv008415; Thu, 10 Aug 2023 16:52:13 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= message-id:date:mime-version:subject:to:cc:references:from :in-reply-to:content-type:content-transfer-encoding; s= selector1; bh=uxD1byUTfrhwfQBYzxSaLD/QBU94QFTUviGR6L3yWtk=; b=OM 94/Fm4Z3mD/XrR7SpHIi8b4+CRVQTx4On2KNdshYzJ/c+SzNoM3Qn08cGc3CIrMg /RlRRbo0BO4/d0vx9msdrFYVc0cG1kX4AdL+kT2bSCt+JH35kLaU1FDO+vGdoHnh +94ZlKg9U/MRTrKZCZMycBOElY+9dR731ie/Od5RX7/pb/ankpiJ0atgh8DE8AB5 qNVRx8JooAT8JdZNgXbTsYBxWn45VpashSwx87JKW9P739e4ndKqoKaQEm2bcSru ndaIq/eNkmesbWYDGkHevAa0WQ4r465ZhdRSt5NCfpoURtZsZGn8Kt7xyVxmZEkl 8uiY65WweVbMdT3zP9lw== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3scdv7pw6k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 10 Aug 2023 16:52:13 +0200 (MEST) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 72F1A100053; Thu, 10 Aug 2023 16:52:03 +0200 (CEST) Received: from Webmail-eu.st.com (eqndag1node4.st.com [10.75.129.133]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 68C8C222CB3; Thu, 10 Aug 2023 16:52:03 +0200 (CEST) Received: from [10.201.21.122] (10.201.21.122) by EQNDAG1NODE4.st.com (10.75.129.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Thu, 10 Aug 2023 16:52:02 +0200 Message-ID: Date: Thu, 10 Aug 2023 16:52:01 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH net-next v3 06/10] net: stmmac: xgmac: support per-channel irq Content-Language: en-US To: Jisheng Zhang , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Giuseppe Cavallaro , Jose Abreu CC: , , , , References: <20230809165007.1439-1-jszhang@kernel.org> <20230809165007.1439-7-jszhang@kernel.org> From: Alexandre TORGUE In-Reply-To: <20230809165007.1439-7-jszhang@kernel.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.201.21.122] X-ClientProxiedBy: EQNCAS1NODE3.st.com (10.75.129.80) To EQNDAG1NODE4.st.com (10.75.129.133) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-10_12,2023-08-10_01,2023-05-22_02 X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,NICE_REPLY_A,RCVD_IN_DNSWL_LOW,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 8/9/23 18:50, Jisheng Zhang wrote: > The IP supports per channel interrupt, add support for this usage case. > > Signed-off-by: Jisheng Zhang > --- > .../net/ethernet/stmicro/stmmac/dwxgmac2.h | 2 ++ > .../ethernet/stmicro/stmmac/dwxgmac2_dma.c | 33 +++++++++++-------- > 2 files changed, 22 insertions(+), 13 deletions(-) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h > index 81cbb13a101d..12e1228ccf2a 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h > +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h > @@ -327,6 +327,8 @@ > > /* DMA Registers */ > #define XGMAC_DMA_MODE 0x00003000 > +#define XGMAC_INTM GENMASK(13, 12) > +#define XGMAC_INTM_MODE1 0x1 > #define XGMAC_SWR BIT(0) > #define XGMAC_DMA_SYSBUS_MODE 0x00003004 > #define XGMAC_WR_OSR_LMT GENMASK(29, 24) > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c > index b5ba4e0cca55..ef25af92d6cc 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c > +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c > @@ -31,6 +31,13 @@ static void dwxgmac2_dma_init(void __iomem *ioaddr, > value |= XGMAC_EAME; > > writel(value, ioaddr + XGMAC_DMA_SYSBUS_MODE); > + > + if (dma_cfg->perch_irq_en) { > + value = readl(ioaddr + XGMAC_DMA_MODE); > + value &= ~XGMAC_INTM; > + value |= FIELD_PREP(XGMAC_INTM, XGMAC_INTM_MODE1); > + writel(value, ioaddr + XGMAC_DMA_MODE); > + } > } > > static void dwxgmac2_dma_init_chan(struct stmmac_priv *priv, > @@ -365,20 +372,20 @@ static int dwxgmac2_dma_interrupt(struct stmmac_priv *priv, > } > > /* TX/RX NORMAL interrupts */ > - if (likely(intr_status & XGMAC_NIS)) { No longer need to check NIS bit ? > - if (likely(intr_status & XGMAC_RI)) { > - u64_stats_update_begin(&rx_q->rxq_stats.syncp); > - rx_q->rxq_stats.rx_normal_irq_n++; > - u64_stats_update_end(&rx_q->rxq_stats.syncp); > - ret |= handle_rx; > - } > - if (likely(intr_status & (XGMAC_TI | XGMAC_TBU))) { > - u64_stats_update_begin(&tx_q->txq_stats.syncp); > - tx_q->txq_stats.tx_normal_irq_n++; > - u64_stats_update_end(&tx_q->txq_stats.syncp); > - ret |= handle_tx; > - } > + if (likely(intr_status & XGMAC_RI)) { > + u64_stats_update_begin(&rx_q->rxq_stats.syncp); > + rx_q->rxq_stats.rx_normal_irq_n++; > + u64_stats_update_end(&rx_q->rxq_stats.syncp); > + ret |= handle_rx; > + } > + if (likely(intr_status & XGMAC_TI)) { > + u64_stats_update_begin(&tx_q->txq_stats.syncp); > + tx_q->txq_stats.tx_normal_irq_n++; > + u64_stats_update_end(&tx_q->txq_stats.syncp); > + ret |= handle_tx; > } > + if (unlikely(intr_status & XGMAC_TBU)) > + ret |= handle_tx; > > /* Clear interrupts */ > writel(intr_en & intr_status, ioaddr + XGMAC_DMA_CH_STATUS(chan));