From patchwork Fri Oct 18 17:13:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Damato X-Patchwork-Id: 1999295 X-Patchwork-Delegate: anthony.l.nguyen@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=xexDo4Bz; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XVWX76Rrmz1xw2 for ; Sat, 19 Oct 2024 04:14:15 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 951B360B5A; Fri, 18 Oct 2024 17:14:11 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 0-WpL5UupjdU; Fri, 18 Oct 2024 17:14:11 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org CD7A960765 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1729271650; bh=4bB7GKiKjrs56WpSf5KFX3Q1SGNDmUOvqqDaUgWFtQs=; h=From:To:Cc:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=xexDo4BzdSzcHSfS7/INpLKxvtEiUHHrEub6VPOuDrQpURerOYQJyZd5FxPgnqOTy jRFgjIjD+8Ih38ve6OJabz/AQxWd890Yf3DUxcueswC4IXXAWHTakGxrkbZk+kQCjY bETmjX4D2PAQTyGbmN/ilq1UDkUUzmRbrF+uFzGrQqMWuebp9FTbe/vHBoB0bzt+pK oVej8QX4KdJHt8+vW5CcWJA4gBaHt71Ds/RcU0fGx24b1mfMs2Rdf2h/PEL0blx+dm rXsrCac95F5NpdeJS4izh8w/qdc4BqOwQnXhWTTJh3Ip8xTppPiBT2N+BZbProc85+ tmr4C1qtaD9Qw== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp3.osuosl.org (Postfix) with ESMTP id CD7A960765; Fri, 18 Oct 2024 17:14:10 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists1.osuosl.org (Postfix) with ESMTP id 95CED2073 for ; Fri, 18 Oct 2024 17:14:08 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 770F86066B for ; Fri, 18 Oct 2024 17:14:08 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id Fd7kAQsleZZA for ; Fri, 18 Oct 2024 17:14:07 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2607:f8b0:4864:20::62b; helo=mail-pl1-x62b.google.com; envelope-from=jdamato@fastly.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp3.osuosl.org B7D5E6060B DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org B7D5E6060B Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by smtp3.osuosl.org (Postfix) with ESMTPS id B7D5E6060B for ; Fri, 18 Oct 2024 17:14:07 +0000 (UTC) Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-20c8b557f91so25481155ad.2 for ; Fri, 18 Oct 2024 10:14:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729271647; x=1729876447; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4bB7GKiKjrs56WpSf5KFX3Q1SGNDmUOvqqDaUgWFtQs=; b=fr8SsY69EIt9OwbfXQK7ZBgPKL5zwtgM5zdocZm9+lkZYylEgDzisjv4E1gVPKnvmn i9rqgmBcAkN/wjLO9SB0WV0iY2oW471xuSTJ2ks3Dju77I9bNH9/adzpsScljmkbFa7e IL4H/2Z1C/ru1AH7/SdzMSPcjpFSZl3GYC1QSr3Pm18dajKe5cgcr98cchimlkb7Ug85 bK9K6gUB7gPwG3EVBFhCfBreMwtACXAnELoPiiozuFmzkGlhMlyuFBtvtar0+mYVM24i M7xJI5Yy+GeHSi3Igi1CcO8GgOY/GTDCk6C1rDr0WWmXx0ooXUIIx0+zbCmnO1AxycKI 6pgg== X-Forwarded-Encrypted: i=1; AJvYcCVXZBpjx7O0ZVcGc6QrUAFXSX6EVF92o5ocJyzcD8cBX/hl5w2kKIU/dxYGdUnJdhJZDc402ZXyJ/6eZurCLcM=@lists.osuosl.org X-Gm-Message-State: AOJu0YxqCTsUeSUqZKXnHfNQc5R+cqmr6No7CWkpZCDgxLczLXNS7t6C V+4pebGfVyquBiTs7d/ui3xAy1upd3ZOuG05VrQeHPFlftk5wEPFk4713IoNcUk= X-Google-Smtp-Source: AGHT+IFCWKoisVtc7X03EHzO+83itiW9WT1uyE+v7mtQuTkGZD4rTpCGFn7kmp6n/+EACxPFBSN+Og== X-Received: by 2002:a17:903:234b:b0:20c:fa0b:5297 with SMTP id d9443c01a7336-20e5a78e147mr39948375ad.26.1729271646935; Fri, 18 Oct 2024 10:14:06 -0700 (PDT) Received: from localhost.localdomain ([2620:11a:c019:0:65e:3115:2f58:c5fd]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20e5a71ecd2sm15000255ad.29.2024.10.18.10.14.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2024 10:14:06 -0700 (PDT) From: Joe Damato To: netdev@vger.kernel.org Cc: kurt@linutronix.de, vinicius.gomes@intel.com, Joe Damato , Tony Nguyen , Przemek Kitszel , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , intel-wired-lan@lists.osuosl.org (moderated list:INTEL ETHERNET DRIVERS), linux-kernel@vger.kernel.org (open list) Date: Fri, 18 Oct 2024 17:13:42 +0000 Message-Id: <20241018171343.314835-2-jdamato@fastly.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241018171343.314835-1-jdamato@fastly.com> References: <20241018171343.314835-1-jdamato@fastly.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastly.com; s=google; t=1729271647; x=1729876447; darn=lists.osuosl.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4bB7GKiKjrs56WpSf5KFX3Q1SGNDmUOvqqDaUgWFtQs=; b=iHg6rtvCNacKSv3MJDfwLWKk4JAnlClwvGhdg4UALcum9m+TwMvXfCe+Q1nVzKNrlu u/ssmBbWB0oYqpvqVk8+94Y5YqKqXPdIJxa4E/C+DbFIF6Jp0y1GRYtqsk1BjpKNlPP/ wH8lFP0I+lp1PuA1jt+XYTMKa2/6FoaH4tyhg= X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=reject dis=none) header.from=fastly.com X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dkim=pass (1024-bit key, unprotected) header.d=fastly.com header.i=@fastly.com header.a=rsa-sha256 header.s=google header.b=iHg6rtvC Subject: [Intel-wired-lan] [net-next v3 1/2] igc: Link IRQs to NAPI instances X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" Link IRQs to NAPI instances via netdev-genl API so that users can query this information with netlink. Compare the output of /proc/interrupts (noting that IRQ 144 is the "other" IRQ which does not appear to have a NAPI instance): $ cat /proc/interrupts | grep enp86s0 | cut --delimiter=":" -f1 128 129 130 131 132 The output from netlink shows the mapping of NAPI IDs to IRQs (again noting that 144 is absent as it is the "other" IRQ): $ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml \ --dump napi-get --json='{"ifindex": 2}' [{'defer-hard-irqs': 0, 'gro-flush-timeout': 0, 'id': 8196, 'ifindex': 2, 'irq': 132}, {'defer-hard-irqs': 0, 'gro-flush-timeout': 0, 'id': 8195, 'ifindex': 2, 'irq': 131}, {'defer-hard-irqs': 0, 'gro-flush-timeout': 0, 'id': 8194, 'ifindex': 2, 'irq': 130}, {'defer-hard-irqs': 0, 'gro-flush-timeout': 0, 'id': 8193, 'ifindex': 2, 'irq': 129}] Signed-off-by: Joe Damato Acked-by: Vinicius Costa Gomes Reviewed-by: Vitaly Lifshits --- v2: - Line wrap at 80 characters drivers/net/ethernet/intel/igc/igc_main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c index 6e70bca15db1..7964bbedb16c 100644 --- a/drivers/net/ethernet/intel/igc/igc_main.c +++ b/drivers/net/ethernet/intel/igc/igc_main.c @@ -5576,6 +5576,9 @@ static int igc_request_msix(struct igc_adapter *adapter) q_vector); if (err) goto err_free; + + netif_napi_set_irq(&q_vector->napi, + adapter->msix_entries[vector].vector); } igc_configure_msix(adapter); From patchwork Fri Oct 18 17:13:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Damato X-Patchwork-Id: 1999296 X-Patchwork-Delegate: anthony.l.nguyen@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=1TFqBpLa; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XVWXB4gt1z1xw2 for ; Sat, 19 Oct 2024 04:14:18 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 3AD9260B7C; Fri, 18 Oct 2024 17:14:13 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id TqZMjpgzY21e; Fri, 18 Oct 2024 17:14:12 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 357C460B6E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1729271652; bh=UoQ9bUJkSmK6/RGq4OX+PcLT68fp0+DWsECoKle6AwQ=; h=From:To:Cc:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=1TFqBpLaoyXKwtODVTa3BNszK1wY6P8iD2jDJIeJl6+bbLNcumZMFwzXi2Wju5zB3 fVbn0rv1uz6jrMMM/Iw9e6VBKZFyF748hWXTdeuuNSVhCd0bYkhjMUVKMibvkjN9iM 6JBf5XSYjW6CTkniFh4aK0J+I1kxMiBAbntjiaERHFa6ZJnD6vkgVJo0QMc2Ry7O3C VDegaliA+lTFlkfukVUmROjqo2eD+ewsFPl8rIfcN8FKZmuIQ6tu9vVWKezT6tRIUy rGGkGaeAifjzqsInJCpfNI6y+b2AxU33lBOaZZ30WJ8bzb8zYwcyRJ5ubZf16uxGNZ 0v0OkVfsH5NtQ== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp3.osuosl.org (Postfix) with ESMTP id 357C460B6E; Fri, 18 Oct 2024 17:14:12 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists1.osuosl.org (Postfix) with ESMTP id CC33427E1 for ; Fri, 18 Oct 2024 17:14:10 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id BB48880AA9 for ; Fri, 18 Oct 2024 17:14:10 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id mSS1iFiq5NUk for ; Fri, 18 Oct 2024 17:14:09 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2607:f8b0:4864:20::629; helo=mail-pl1-x629.google.com; envelope-from=jdamato@fastly.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org B5ADB80A95 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org B5ADB80A95 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by smtp1.osuosl.org (Postfix) with ESMTPS id B5ADB80A95 for ; Fri, 18 Oct 2024 17:14:09 +0000 (UTC) Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-20c7ee8fe6bso22902955ad.2 for ; Fri, 18 Oct 2024 10:14:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729271649; x=1729876449; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UoQ9bUJkSmK6/RGq4OX+PcLT68fp0+DWsECoKle6AwQ=; b=HwrLojustyyogs1mmlzqAC2ZCxWMfQIYnq3zDwVYvWTlCSjiJUaKuc46JmgEnqahU8 dWhQnQZrPqDNI+uAXJIEiF6fssihpVFfIUzjXHf12n5ntRub1JRY9iSRPZUoSWr7XpVF xS1PbA8XygBjFou5iyqt9B7+DBzx1MXhozW8ddG+PY5IOvcwuAi6ZC3ml4qiavgaBkmJ U+u2j3MXjE6E5ek5JGL5pNJUiNTNd9Sc5ktLx4JXy+RbC2xnYBZR89/KO9Csf/YegIzS 8rlmeAz6VBB948KWIGJwYJlr6qJM59gylvFouDKisVsivli+hiLKebQiHMIbNj/mqfWX MihQ== X-Forwarded-Encrypted: i=1; AJvYcCUFNSfO11vg6Um936CE+GvzndgaAlZ7lIxwUuzhoYd3mP3MuxeyAPf8I8L/KKzy83l2k/Tq8dAbHrO33f+ksAo=@lists.osuosl.org X-Gm-Message-State: AOJu0YwW/YDva5zN/EvBqV7aWpowoOMFiDsbpV2hjKwBui/ZzpnRk7lz KVpKED3ILun7JI1EJeVkNgE81uRgJEy1h4rcLstxR9d2wFfdsn9jy0F++EKFNfc= X-Google-Smtp-Source: AGHT+IHEwb5+PY/1lW1EQSVV9TJ91giJ8W22+L0YQoZqb5lwDEqb12kb07vrXGOHn6hNiJ09tEZFcg== X-Received: by 2002:a17:902:da90:b0:20b:951f:6dff with SMTP id d9443c01a7336-20e59aa0261mr46928475ad.0.1729271649042; Fri, 18 Oct 2024 10:14:09 -0700 (PDT) Received: from localhost.localdomain ([2620:11a:c019:0:65e:3115:2f58:c5fd]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20e5a71ecd2sm15000255ad.29.2024.10.18.10.14.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2024 10:14:08 -0700 (PDT) From: Joe Damato To: netdev@vger.kernel.org Cc: kurt@linutronix.de, vinicius.gomes@intel.com, Joe Damato , Tony Nguyen , Przemek Kitszel , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , intel-wired-lan@lists.osuosl.org (moderated list:INTEL ETHERNET DRIVERS), linux-kernel@vger.kernel.org (open list), bpf@vger.kernel.org (open list:XDP (eXpress Data Path)) Date: Fri, 18 Oct 2024 17:13:43 +0000 Message-Id: <20241018171343.314835-3-jdamato@fastly.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241018171343.314835-1-jdamato@fastly.com> References: <20241018171343.314835-1-jdamato@fastly.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastly.com; s=google; t=1729271649; x=1729876449; darn=lists.osuosl.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UoQ9bUJkSmK6/RGq4OX+PcLT68fp0+DWsECoKle6AwQ=; b=m/LInaZGa/0mRgUI9CKlHtjA5W8lvaHOLCxOYsNrgJd0lHtlXkjCC+DSieL2VhSrtW XyKgZQqUDnvjlhj8LY5ZJd4He6vWYtQ0u+Nb2GdQyxpwddn8xM3qy3VXM5UEf2FeDWow qsLNaV3PB/PcP1wqyACPu7n9I4XXcsV3Pc+E0= X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=reject dis=none) header.from=fastly.com X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (1024-bit key) header.d=fastly.com header.i=@fastly.com header.a=rsa-sha256 header.s=google header.b=m/LInaZG Subject: [Intel-wired-lan] [net-next v3 2/2] igc: Link queues to NAPI instances X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" Link queues to NAPI instances via netdev-genl API so that users can query this information with netlink. Handle a few cases in the driver: 1. Link/unlink the NAPIs when XDP is enabled/disabled 2. Handle IGC_FLAG_QUEUE_PAIRS enabled and disabled Example output when IGC_FLAG_QUEUE_PAIRS is enabled: $ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml \ --dump queue-get --json='{"ifindex": 2}' [{'id': 0, 'ifindex': 2, 'napi-id': 8193, 'type': 'rx'}, {'id': 1, 'ifindex': 2, 'napi-id': 8194, 'type': 'rx'}, {'id': 2, 'ifindex': 2, 'napi-id': 8195, 'type': 'rx'}, {'id': 3, 'ifindex': 2, 'napi-id': 8196, 'type': 'rx'}, {'id': 0, 'ifindex': 2, 'napi-id': 8193, 'type': 'tx'}, {'id': 1, 'ifindex': 2, 'napi-id': 8194, 'type': 'tx'}, {'id': 2, 'ifindex': 2, 'napi-id': 8195, 'type': 'tx'}, {'id': 3, 'ifindex': 2, 'napi-id': 8196, 'type': 'tx'}] Since IGC_FLAG_QUEUE_PAIRS is enabled, you'll note that the same NAPI ID is present for both rx and tx queues at the same index, for example index 0: {'id': 0, 'ifindex': 2, 'napi-id': 8193, 'type': 'rx'}, {'id': 0, 'ifindex': 2, 'napi-id': 8193, 'type': 'tx'}, To test IGC_FLAG_QUEUE_PAIRS disabled, a test system was booted using the grub command line option "maxcpus=2" to force igc_set_interrupt_capability to disable IGC_FLAG_QUEUE_PAIRS. Example output when IGC_FLAG_QUEUE_PAIRS is disabled: $ lscpu | grep "On-line CPU" On-line CPU(s) list: 0,2 $ ethtool -l enp86s0 | tail -5 Current hardware settings: RX: n/a TX: n/a Other: 1 Combined: 2 $ cat /proc/interrupts | grep enp 144: [...] enp86s0 145: [...] enp86s0-rx-0 146: [...] enp86s0-rx-1 147: [...] enp86s0-tx-0 148: [...] enp86s0-tx-1 1 "other" IRQ, and 2 IRQs for each of RX and Tx, so we expect netlink to report 4 IRQs with unique NAPI IDs: $ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml \ --dump napi-get --json='{"ifindex": 2}' [{'id': 8196, 'ifindex': 2, 'irq': 148}, {'id': 8195, 'ifindex': 2, 'irq': 147}, {'id': 8194, 'ifindex': 2, 'irq': 146}, {'id': 8193, 'ifindex': 2, 'irq': 145}] Now we examine which queues these NAPIs are associated with, expecting that since IGC_FLAG_QUEUE_PAIRS is disabled each RX and TX queue will have its own NAPI instance: $ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml \ --dump queue-get --json='{"ifindex": 2}' [{'id': 0, 'ifindex': 2, 'napi-id': 8193, 'type': 'rx'}, {'id': 1, 'ifindex': 2, 'napi-id': 8194, 'type': 'rx'}, {'id': 0, 'ifindex': 2, 'napi-id': 8195, 'type': 'tx'}, {'id': 1, 'ifindex': 2, 'napi-id': 8196, 'type': 'tx'}] Signed-off-by: Joe Damato Acked-by: Vinicius Costa Gomes Reviewed-by: Vitaly Lifshits --- v3: - Replace igc_unset_queue_napi with igc_set_queue_napi(adapater, i, NULL), as suggested by Vinicius Costa Gomes - Simplify implemention of igc_set_queue_napi as suggested by Kurt Kanzenbach, with a tweak to use ring->queue_index v2: - Update commit message to include tests for IGC_FLAG_QUEUE_PAIRS disabled - Refactored code to move napi queue mapping and unmapping to helper functions igc_set_queue_napi and igc_unset_queue_napi - Adjust the code to handle IGC_FLAG_QUEUE_PAIRS disabled - Call helpers to map/unmap queues to NAPIs in igc_up, __igc_open, igc_xdp_enable_pool, and igc_xdp_disable_pool drivers/net/ethernet/intel/igc/igc.h | 2 ++ drivers/net/ethernet/intel/igc/igc_main.c | 33 ++++++++++++++++++++--- drivers/net/ethernet/intel/igc/igc_xdp.c | 2 ++ 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/intel/igc/igc.h b/drivers/net/ethernet/intel/igc/igc.h index eac0f966e0e4..b8111ad9a9a8 100644 --- a/drivers/net/ethernet/intel/igc/igc.h +++ b/drivers/net/ethernet/intel/igc/igc.h @@ -337,6 +337,8 @@ struct igc_adapter { struct igc_led_classdev *leds; }; +void igc_set_queue_napi(struct igc_adapter *adapter, int q_idx, + struct napi_struct *napi); void igc_up(struct igc_adapter *adapter); void igc_down(struct igc_adapter *adapter); int igc_open(struct net_device *netdev); diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c index 7964bbedb16c..783fc8e12ba1 100644 --- a/drivers/net/ethernet/intel/igc/igc_main.c +++ b/drivers/net/ethernet/intel/igc/igc_main.c @@ -4948,6 +4948,22 @@ static int igc_sw_init(struct igc_adapter *adapter) return 0; } +void igc_set_queue_napi(struct igc_adapter *adapter, int vector, + struct napi_struct *napi) +{ + struct igc_q_vector *q_vector = adapter->q_vector[vector]; + + if (q_vector->rx.ring) + netif_queue_set_napi(adapter->netdev, + q_vector->rx.ring->queue_index, + NETDEV_QUEUE_TYPE_RX, napi); + + if (q_vector->tx.ring) + netif_queue_set_napi(adapter->netdev, + q_vector->tx.ring->queue_index, + NETDEV_QUEUE_TYPE_TX, napi); +} + /** * igc_up - Open the interface and prepare it to handle traffic * @adapter: board private structure @@ -4955,6 +4971,7 @@ static int igc_sw_init(struct igc_adapter *adapter) void igc_up(struct igc_adapter *adapter) { struct igc_hw *hw = &adapter->hw; + struct napi_struct *napi; int i = 0; /* hardware has been reset, we need to reload some things */ @@ -4962,8 +4979,11 @@ void igc_up(struct igc_adapter *adapter) clear_bit(__IGC_DOWN, &adapter->state); - for (i = 0; i < adapter->num_q_vectors; i++) - napi_enable(&adapter->q_vector[i]->napi); + for (i = 0; i < adapter->num_q_vectors; i++) { + napi = &adapter->q_vector[i]->napi; + napi_enable(napi); + igc_set_queue_napi(adapter, i, napi); + } if (adapter->msix_entries) igc_configure_msix(adapter); @@ -5192,6 +5212,7 @@ void igc_down(struct igc_adapter *adapter) for (i = 0; i < adapter->num_q_vectors; i++) { if (adapter->q_vector[i]) { napi_synchronize(&adapter->q_vector[i]->napi); + igc_set_queue_napi(adapter, i, NULL); napi_disable(&adapter->q_vector[i]->napi); } } @@ -6021,6 +6042,7 @@ static int __igc_open(struct net_device *netdev, bool resuming) struct igc_adapter *adapter = netdev_priv(netdev); struct pci_dev *pdev = adapter->pdev; struct igc_hw *hw = &adapter->hw; + struct napi_struct *napi; int err = 0; int i = 0; @@ -6056,8 +6078,11 @@ static int __igc_open(struct net_device *netdev, bool resuming) clear_bit(__IGC_DOWN, &adapter->state); - for (i = 0; i < adapter->num_q_vectors; i++) - napi_enable(&adapter->q_vector[i]->napi); + for (i = 0; i < adapter->num_q_vectors; i++) { + napi = &adapter->q_vector[i]->napi; + napi_enable(napi); + igc_set_queue_napi(adapter, i, napi); + } /* Clear any pending interrupts. */ rd32(IGC_ICR); diff --git a/drivers/net/ethernet/intel/igc/igc_xdp.c b/drivers/net/ethernet/intel/igc/igc_xdp.c index e27af72aada8..4da633430b80 100644 --- a/drivers/net/ethernet/intel/igc/igc_xdp.c +++ b/drivers/net/ethernet/intel/igc/igc_xdp.c @@ -84,6 +84,7 @@ static int igc_xdp_enable_pool(struct igc_adapter *adapter, napi_disable(napi); } + igc_set_queue_napi(adapter, queue_id, NULL); set_bit(IGC_RING_FLAG_AF_XDP_ZC, &rx_ring->flags); set_bit(IGC_RING_FLAG_AF_XDP_ZC, &tx_ring->flags); @@ -133,6 +134,7 @@ static int igc_xdp_disable_pool(struct igc_adapter *adapter, u16 queue_id) xsk_pool_dma_unmap(pool, IGC_RX_DMA_ATTR); clear_bit(IGC_RING_FLAG_AF_XDP_ZC, &rx_ring->flags); clear_bit(IGC_RING_FLAG_AF_XDP_ZC, &tx_ring->flags); + igc_set_queue_napi(adapter, queue_id, napi); if (needs_reset) { napi_enable(napi);