From nobody Fri Oct 10 02:41:50 2025 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A0FEF1FE444; Mon, 16 Jun 2025 03:23:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.75.126.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750044215; cv=none; b=TytH3/EdUkNxAjkMgpWKxsmTUQ/O1OwE2gcnQj1JFmjq4qIMPEKuLPcqG5CUHkQ4TDLEjjviUIE59wUh2CwhuvPlTRebAp6j+gV+Xa1cF7/IxJEeH66h4FvYf0LTcpDNm0G7pntszDF96iW26QZWNcCy5LhLFYlXxMr8C0kNp/s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750044215; c=relaxed/simple; bh=zuRubDgdhyaVBelPbTWu7FxxjsOP/AlwqUEazFgTPOk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gKpHuds5kT3FH9lXW5lg4153M6DVSu/T7MBkNXg7M7Drz2aZmBCT9Svv/vmy0mxC/Oe/At67d649MBhwNEde4Uxw7ddJdaQC7Ti4MtVwmW/cgZfcorIAofT6R5SlL6B0FGtHsCb85WcW13CIPVCcYql2PAph4RPy/XAeem5ua1U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=realtek.com; spf=pass smtp.mailfrom=realtek.com; dkim=pass (2048-bit key) header.d=realtek.com header.i=@realtek.com header.b=Vd3NfXTE; arc=none smtp.client-ip=211.75.126.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=realtek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=realtek.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=realtek.com header.i=@realtek.com header.b="Vd3NfXTE" X-SpamFilter-By: ArmorX SpamTrap 5.80 with qID 55G3NA1e83976478, This message is accepted by code: ctloc85258 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=realtek.com; s=dkim; t=1750044190; bh=WFooEOKAUiQJqcx+ihqU0ZIMimYXeAicAjCdvwMxz5I=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type; b=Vd3NfXTEi+X8xQl6RjE7+U/2RzGAgymVzksB/9LD42ZggOYH2zs1pDlWkD79Lrozk MSLV2VIWV2xHuSGNk0TJ1sSzgwBEQLpycs65ZONvsqcOFadJwkPTA1JYtx4mMf6uca vXSk/J1x+i6qvf7OoKBtdzXo+ZCLEeHb5I/vr+5jVQu7837w/gSBIMa7OPf9iqo823 gPp6ClpoAi9AQN/PFIHU71/VP6BpLkZ4/RKl7rs9MuJw3pT6NULkZFD+5YMh5b/Lf5 sKMImWq6t/kqVuJux0yTlCbJ3AwTK53vvrTkiwe4qJ5RWh85S5PBYpSSZR+HdutdLz 5vWDML8A/tXTQ== Received: from mail.realtek.com (rtexh36505.realtek.com.tw[172.21.6.25]) by rtits2.realtek.com.tw (8.15.2/3.13/5.93) with ESMTPS id 55G3NA1e83976478 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 16 Jun 2025 11:23:10 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXH36505.realtek.com.tw (172.21.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 16 Jun 2025 11:23:02 +0800 Received: from RTDOMAIN (172.21.210.109) by RTEXMBS04.realtek.com.tw (172.21.6.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 16 Jun 2025 11:23:01 +0800 From: Justin Lai To: CC: , , , , , , , , , , Justin Lai Subject: [PATCH net-next v2 1/2] rtase: Link IRQs to NAPI instances Date: Mon, 16 Jun 2025 11:22:25 +0800 Message-ID: <20250616032226.7318-2-justinlai0215@realtek.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250616032226.7318-1-justinlai0215@realtek.com> References: <20250616032226.7318-1-justinlai0215@realtek.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: RTEXH36505.realtek.com.tw (172.21.6.25) To RTEXMBS04.realtek.com.tw (172.21.6.97) Content-Type: text/plain; charset="utf-8" Link IRQs to NAPI instances with netif_napi_set_irq. This information can be queried with the netdev-genl API. Also add support for persistent NAPI configuration using netif_napi_add_config(). Signed-off-by: Justin Lai Reviewed-by: Joe Damato --- .../net/ethernet/realtek/rtase/rtase_main.c | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/realtek/rtase/rtase_main.c b/drivers/net/= ethernet/realtek/rtase/rtase_main.c index 4d37217e9a14..d13877f051e7 100644 --- a/drivers/net/ethernet/realtek/rtase/rtase_main.c +++ b/drivers/net/ethernet/realtek/rtase/rtase_main.c @@ -1871,6 +1871,18 @@ static void rtase_init_netdev_ops(struct net_device = *dev) dev->ethtool_ops =3D &rtase_ethtool_ops; } =20 +static void rtase_init_napi(struct rtase_private *tp) +{ + u16 i; + + for (i =3D 0; i < tp->int_nums; i++) { + netif_napi_add_config(tp->dev, &tp->int_vector[i].napi, + tp->int_vector[i].poll, i); + netif_napi_set_irq(&tp->int_vector[i].napi, + tp->int_vector[i].irq); + } +} + static void rtase_reset_interrupt(struct pci_dev *pdev, const struct rtase_private *tp) { @@ -1956,9 +1968,6 @@ static void rtase_init_int_vector(struct rtase_privat= e *tp) memset(tp->int_vector[0].name, 0x0, sizeof(tp->int_vector[0].name)); INIT_LIST_HEAD(&tp->int_vector[0].ring_list); =20 - netif_napi_add(tp->dev, &tp->int_vector[0].napi, - tp->int_vector[0].poll); - /* interrupt vector 1 ~ 3 */ for (i =3D 1; i < tp->int_nums; i++) { tp->int_vector[i].tp =3D tp; @@ -1972,9 +1981,6 @@ static void rtase_init_int_vector(struct rtase_privat= e *tp) memset(tp->int_vector[i].name, 0x0, sizeof(tp->int_vector[0].name)); INIT_LIST_HEAD(&tp->int_vector[i].ring_list); - - netif_napi_add(tp->dev, &tp->int_vector[i].napi, - tp->int_vector[i].poll); } } =20 @@ -2206,6 +2212,8 @@ static int rtase_init_one(struct pci_dev *pdev, goto err_out_del_napi; } =20 + rtase_init_napi(tp); + rtase_init_netdev_ops(dev); =20 dev->pcpu_stat_type =3D NETDEV_PCPU_STAT_TSTATS; --=20 2.34.1 From nobody Fri Oct 10 02:41:50 2025 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C7E3B2AD00; Mon, 16 Jun 2025 03:24:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.75.126.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750044294; cv=none; b=mpE2kRyiwpDlcavebhUGpTlJrRjDFEsh/MnSBIpV3Q5giScBIiXkr3xdPzBcag46efF9U1AJtISI7jldzGpCCSEJ6u/p6cf+pgLZifdXyzc3FGSYsFe2Jb/cSU+d5sclh4WQdAN1xhfv/xT09IA2grooLIs4yrDj8JwGkwwm364= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750044294; c=relaxed/simple; bh=dnYFmI7WTXdyv0vzTq8oPzXkUrdsIkxAJgEyN6UIXFs=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=bnJ5LT+3y/nyrQF/efzH551KXuD88yryjHGUIrb6KLi6Z97dJG9YU8322Z87PczIbnA5uhJQO/Dl2GsYALJZSRdcJj3ODP2eKtrEWjaPCHavZK8t7HwrlODjRayi4EvaBmt6ynLxhaC3otmG+9DiE2V64Jmpz4hLHO/91hYRdhE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=realtek.com; spf=pass smtp.mailfrom=realtek.com; dkim=pass (2048-bit key) header.d=realtek.com header.i=@realtek.com header.b=VxGQiHqF; arc=none smtp.client-ip=211.75.126.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=realtek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=realtek.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=realtek.com header.i=@realtek.com header.b="VxGQiHqF" X-SpamFilter-By: ArmorX SpamTrap 5.80 with qID 55G3OYtbC3977912, This message is accepted by code: ctloc85258 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=realtek.com; s=dkim; t=1750044274; bh=uk6gJLTYuvpCQSI3aSNFWvJyoZx57tCzDddG6aAgmGs=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type; b=VxGQiHqFJ3tbA3GADPXL0py/Ol2USSUoxcksu2mlLrjf673cYAv1UiyK7VZEXWC2Y mhwLGqcmWfL/qYuJxGBCbNMRG/vZi7NHVmMHpmdfc6hi5sJ+HyPC4ObYQ7LWiXm8U9 KseqkuwwY1RggI/Mi3yv/cUU3ch7OmIizwGfrGlYd5v5Wd0NxmBmnyC+gUs+eigIOB 5OK7Y7NBNXfco7FfMEqUzzkpv0qhFuY7DxMY60kcYyjPw55cYF5DAnh6Pop7tBtQmQ hgGZ+K2+Jyrvw0PNzNxkLs/d6xSBVkfazZwbaqd/X/XqnwdctzzRmfn6RxLyFT0u6b sz7SA4oNvnltw== Received: from mail.realtek.com (rtexh36506.realtek.com.tw[172.21.6.27]) by rtits2.realtek.com.tw (8.15.2/3.13/5.93) with ESMTPS id 55G3OYtbC3977912 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 16 Jun 2025 11:24:34 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXH36506.realtek.com.tw (172.21.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 16 Jun 2025 11:23:30 +0800 Received: from RTDOMAIN (172.21.210.109) by RTEXMBS04.realtek.com.tw (172.21.6.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 16 Jun 2025 11:23:29 +0800 From: Justin Lai To: CC: , , , , , , , , , , Justin Lai Subject: [PATCH net-next v2 2/2] rtase: Link queues to NAPI instances Date: Mon, 16 Jun 2025 11:22:26 +0800 Message-ID: <20250616032226.7318-3-justinlai0215@realtek.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250616032226.7318-1-justinlai0215@realtek.com> References: <20250616032226.7318-1-justinlai0215@realtek.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: RTEXH36506.realtek.com.tw (172.21.6.27) To RTEXMBS04.realtek.com.tw (172.21.6.97) Content-Type: text/plain; charset="utf-8" Link queues to NAPI instances with netif_queue_set_napi. This information can be queried with the netdev-genl API. Signed-off-by: Justin Lai Reviewed-by: Joe Damato --- drivers/net/ethernet/realtek/rtase/rtase.h | 1 + .../net/ethernet/realtek/rtase/rtase_main.c | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/realtek/rtase/rtase.h b/drivers/net/ether= net/realtek/rtase/rtase.h index 498cfe4d0cac..20decdeb9fdb 100644 --- a/drivers/net/ethernet/realtek/rtase/rtase.h +++ b/drivers/net/ethernet/realtek/rtase/rtase.h @@ -288,6 +288,7 @@ struct rtase_ring { u32 cur_idx; u32 dirty_idx; u16 index; + u8 type; =20 struct sk_buff *skbuff[RTASE_NUM_DESC]; void *data_buf[RTASE_NUM_DESC]; diff --git a/drivers/net/ethernet/realtek/rtase/rtase_main.c b/drivers/net/= ethernet/realtek/rtase/rtase_main.c index d13877f051e7..ef13109c49cf 100644 --- a/drivers/net/ethernet/realtek/rtase/rtase_main.c +++ b/drivers/net/ethernet/realtek/rtase/rtase_main.c @@ -326,6 +326,7 @@ static void rtase_tx_desc_init(struct rtase_private *tp= , u16 idx) ring->cur_idx =3D 0; ring->dirty_idx =3D 0; ring->index =3D idx; + ring->type =3D NETDEV_QUEUE_TYPE_TX; ring->alloc_fail =3D 0; =20 for (i =3D 0; i < RTASE_NUM_DESC; i++) { @@ -345,6 +346,9 @@ static void rtase_tx_desc_init(struct rtase_private *tp= , u16 idx) ring->ivec =3D &tp->int_vector[0]; list_add_tail(&ring->ring_entry, &tp->int_vector[0].ring_list); } + + netif_queue_set_napi(tp->dev, ring->index, + ring->type, &ring->ivec->napi); } =20 static void rtase_map_to_asic(union rtase_rx_desc *desc, dma_addr_t mappin= g, @@ -590,6 +594,7 @@ static void rtase_rx_desc_init(struct rtase_private *tp= , u16 idx) ring->cur_idx =3D 0; ring->dirty_idx =3D 0; ring->index =3D idx; + ring->type =3D NETDEV_QUEUE_TYPE_RX; ring->alloc_fail =3D 0; =20 for (i =3D 0; i < RTASE_NUM_DESC; i++) @@ -597,6 +602,8 @@ static void rtase_rx_desc_init(struct rtase_private *tp= , u16 idx) =20 ring->ring_handler =3D rx_handler; ring->ivec =3D &tp->int_vector[idx]; + netif_queue_set_napi(tp->dev, ring->index, + ring->type, &ring->ivec->napi); list_add_tail(&ring->ring_entry, &tp->int_vector[idx].ring_list); } =20 @@ -1161,8 +1168,12 @@ static void rtase_down(struct net_device *dev) ivec =3D &tp->int_vector[i]; napi_disable(&ivec->napi); list_for_each_entry_safe(ring, tmp, &ivec->ring_list, - ring_entry) + ring_entry) { + netif_queue_set_napi(tp->dev, ring->index, + ring->type, NULL); + list_del(&ring->ring_entry); + } } =20 netif_tx_disable(dev); @@ -1518,8 +1529,12 @@ static void rtase_sw_reset(struct net_device *dev) for (i =3D 0; i < tp->int_nums; i++) { ivec =3D &tp->int_vector[i]; list_for_each_entry_safe(ring, tmp, &ivec->ring_list, - ring_entry) + ring_entry) { + netif_queue_set_napi(tp->dev, ring->index, + ring->type, NULL); + list_del(&ring->ring_entry); + } } =20 ret =3D rtase_init_ring(dev); --=20 2.34.1