Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4041305pxf; Mon, 29 Mar 2021 19:47:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwkf//HPQZJ3/TkpsTWMmPBtEFF6V4g+UzczFhlQ3z18V3a04mAlIlv7QZZb6Yw9Lj7tU3/ X-Received: by 2002:a05:6402:1d33:: with SMTP id dh19mr31142663edb.362.1617072453331; Mon, 29 Mar 2021 19:47:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617072453; cv=none; d=google.com; s=arc-20160816; b=pK8sc+55lhoFZa32wxJnzE3PK/VfkhXf1K4eAwLbFLLk243qk+Q8+gJqcB2RhPZidf EWTShO0BXJyUHHrVDQtfb97v6DEqpmaw7fC3uMw8Q2dA+gtoJcm4H0QVXgrTrujYX5Ej CvMStAI6ppHQkKxYPpmQOrkGknnOZNzPaVXl72jYQ/UEfkKNyqfyjOOnUYysrnebuWF3 83428pOkjnXm7Avl0Fu9+Au3alc609hsfT8cWGearMy8IqmscCsjCaXoCf+GkcRdstu0 0u0Pf4XidAr4sgzbCKRGn8tWo3+MS9dgdgXAkzEF1tlkI+CVTRW9WVLPI9roy2Ji9QPd nZ4Q== 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 :ironport-sdr:ironport-sdr; bh=f1SlO8SECuNh7LWl20cRhEpQuEDriBKKU6HuDfYKLQ8=; b=g/8pgs48rQmudOo+vq501YIFoHxyagCqmukzL+1+L4UZlz25O6N+k7FgcpAkG99Abh 7t1rtNTWiGPAqeacYc+zQbfBjmovluZcn6kCoaKng4ebixJrnet0HtbVPM5UAPSWX/8U uqe8BeiVnQcoehXeXuBTxm0Efb52uE3ZXP27L9Pp4Idkxh807qYyDf5OndYDaLN7Uy6H iRmF+4/19Q1m/qt54KgOKq2Z4VvtOAjgOZXsljtanIg3+biXIq3T0joap4NoF+8uC3EG 4/HNL+OgFwBghL+aW8ETKEGi460Q3ytojKSBGQxz0T9ntrwvcnqs/7t/vTLF4lNPq015 bLzQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s23si13978453eja.266.2021.03.29.19.47.11; Mon, 29 Mar 2021 19:47:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231250AbhC3CqN (ORCPT + 99 others); Mon, 29 Mar 2021 22:46:13 -0400 Received: from mga18.intel.com ([134.134.136.126]:37058 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231144AbhC3Cpv (ORCPT ); Mon, 29 Mar 2021 22:45:51 -0400 IronPort-SDR: jjX9tyj0WzMRNlpPbn9BRWYFBcN/0SIo+Lst8Qmnwb7qO31S3CfqZBT3i9YIgtBVqkKgvFcR5w +WJTB+PmAoCQ== X-IronPort-AV: E=McAfee;i="6000,8403,9938"; a="179213530" X-IronPort-AV: E=Sophos;i="5.81,289,1610438400"; d="scan'208";a="179213530" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Mar 2021 19:45:50 -0700 IronPort-SDR: WwtgGCGjHhhxsLy+blmwUzPGTu8DQcCYTgJ6SoIxHddvSmAqBG3G0z/NyLOEIRDgcjgDWMlpCP wZ2UsbzG534g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,289,1610438400"; d="scan'208";a="606598458" Received: from glass.png.intel.com ([10.158.65.59]) by fmsmga006.fm.intel.com with ESMTP; 29 Mar 2021 19:45:46 -0700 From: Ong Boon Leong To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S . Miller" , Jakub Kicinski , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend Cc: Maxime Coquelin , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , KP Singh , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Ong Boon Leong Subject: [PATCH net-next v2 1/6] net: stmmac: set IRQ affinity hint for multi MSI vectors Date: Tue, 30 Mar 2021 10:49:44 +0800 Message-Id: <20210330024949.14010-2-boon.leong.ong@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210330024949.14010-1-boon.leong.ong@intel.com> References: <20210330024949.14010-1-boon.leong.ong@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Certain platform likes Intel mGBE has independent hardware IRQ resources for TX and RX DMA operation. In preparation to support XDP TX, we add IRQ affinity hint to group both RX and TX queue of the same queue ID to the same CPU. Changes in v2: - IRQ affinity hint need to set to null before IRQ is released. Thanks to issue reported by Song, Yoong Siang. Reported-by: Song, Yoong Siang Signed-off-by: Ong Boon Leong --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index d34388b1ffcc..9d63e8c365ae 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3005,15 +3005,19 @@ static void stmmac_free_irq(struct net_device *dev, fallthrough; case REQ_IRQ_ERR_TX: for (j = irq_idx - 1; j >= 0; j--) { - if (priv->tx_irq[j] > 0) + if (priv->tx_irq[j] > 0) { + irq_set_affinity_hint(priv->tx_irq[j], NULL); free_irq(priv->tx_irq[j], &priv->tx_queue[j]); + } } irq_idx = priv->plat->rx_queues_to_use; fallthrough; case REQ_IRQ_ERR_RX: for (j = irq_idx - 1; j >= 0; j--) { - if (priv->rx_irq[j] > 0) + if (priv->rx_irq[j] > 0) { + irq_set_affinity_hint(priv->rx_irq[j], NULL); free_irq(priv->rx_irq[j], &priv->rx_queue[j]); + } } if (priv->sfty_ue_irq > 0 && priv->sfty_ue_irq != dev->irq) @@ -3045,6 +3049,7 @@ static int stmmac_request_irq_multi_msi(struct net_device *dev) { enum request_irq_err irq_err = REQ_IRQ_ERR_NO; struct stmmac_priv *priv = netdev_priv(dev); + cpumask_t cpu_mask; int irq_idx = 0; char *int_name; int ret; @@ -3153,6 +3158,9 @@ static int stmmac_request_irq_multi_msi(struct net_device *dev) irq_idx = i; goto irq_error; } + cpumask_clear(&cpu_mask); + cpumask_set_cpu(i % num_online_cpus(), &cpu_mask); + irq_set_affinity_hint(priv->rx_irq[i], &cpu_mask); } /* Request Tx MSI irq */ @@ -3173,6 +3181,9 @@ static int stmmac_request_irq_multi_msi(struct net_device *dev) irq_idx = i; goto irq_error; } + cpumask_clear(&cpu_mask); + cpumask_set_cpu(i % num_online_cpus(), &cpu_mask); + irq_set_affinity_hint(priv->tx_irq[i], &cpu_mask); } return 0; -- 2.25.1