From nobody Fri Nov 29 00:43:08 2024 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (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 7C5D43A1BA for ; Wed, 25 Sep 2024 16:30:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727281859; cv=none; b=T4d8MoTn8GOt7PByMugsrjcp+RLsFORJVLRfk1Btnor1JB06yZoR3yz9G6CB1NRo89Q/QDBf+GlnmyXFRaX6pM3nWXOm3l73dhNmFpOZjUInBtUayXnU1DDdnT0JgH1Q13yUdAZ86BegWPX9O6MM0R4M746K34Z/sRcCqgbet1g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727281859; c=relaxed/simple; bh=uRjf76+ialIXRhrRcRnhdzxrLmruMKeJXsltkA5bYqY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Tv09gzIXzyjPysclEWi0ibCvBo1n0dzXZuOnTN/GIX7KgvfKxGnsjPK+tOrckIUSI0Z/d5SCbqaNVgKSS859hkPqp3m4J/lRb4BUlyw2RnR+mbd/wFKpFDcDGb7lL9qbxLSRL9zYZiDalKZze1xKvSbPH1NoyG8TgdkG/FrzYUM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fastly.com; spf=pass smtp.mailfrom=fastly.com; dkim=pass (1024-bit key) header.d=fastly.com header.i=@fastly.com header.b=I58TttfG; arc=none smtp.client-ip=209.85.214.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fastly.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fastly.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=fastly.com header.i=@fastly.com header.b="I58TttfG" Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-2053a0bd0a6so70874205ad.3 for ; Wed, 25 Sep 2024 09:30:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastly.com; s=google; t=1727281858; x=1727886658; darn=vger.kernel.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=SPn7NyA8EvFtDI+rj2RU3nMqRoNcoHgRdtft+sybg/g=; b=I58TttfGVOvcWuCV6NMNty8vqlocq56VdEEdYqRmO9ngoGPU6fF67cSkL7r2LahVJL Nt4sm7LxltzcxpA1vduFOvsI3WEEGhc88eA2s42jgZxyyWrVOod7QCE0RIIXR7w24MDM YjPklsDQGRyuhrC4w7NO0Xem36fGLBtiibnDE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727281858; x=1727886658; 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=SPn7NyA8EvFtDI+rj2RU3nMqRoNcoHgRdtft+sybg/g=; b=AelKtoT6tWO40QzMuJajowsSWkcODZOa1+gmXKCIZMVjlWKgaf/5NfSThZQ6tQHIO2 u5rlLbrUwV6c//fERntEKhltbGeit+z5NfAKqAApmxpCYSDePALqVqYA+6EQxU/Lh/bk jlsnljgkBEjsPib/2LMJyUi7O3dV4gLFee4lUHIrEO1MfDQR2x627zW3/9HN5Pql3c6f lJNUPJZpot2DvGbLnSsUUKsSrrphO+OzKD+lNhS/jkcynha4afww5Wra1YzvEKEFBn4Q iczDyjqSGmtCe4J0E/VIQ/tnpdP728ePP76IaZwfm1JPnP0UxlSzGFl7u+YEuBoVkZh8 q6FA== X-Forwarded-Encrypted: i=1; AJvYcCUt/bPYOvj78Lf0gqJmfStj087NF0KXe+lK3kDu0xKV9MQjWKT5cwt2/xJalluSQf1v6uY5ukf6w5ZFq64=@vger.kernel.org X-Gm-Message-State: AOJu0YxTZQb7Y1R3RYSFUYxkRlCvyXmXakCKT0bygzLOt/jcpuoROhGl s8qwv27YP5DBVkWFpVx0MINQLk3NYe7raMQ3OdkKdXc8FZKM8QfT61yOsJHj/t4qafkKkqaHsdK p X-Google-Smtp-Source: AGHT+IEM3gPUtOxfd/W3Jnyzn6mZZ8mH6XO7SpWmV1e4jRBezuatggwjJ5DEzXqm0y0ZQlMXfIHvmg== X-Received: by 2002:a17:902:ecc8:b0:206:ac11:f3bb with SMTP id d9443c01a7336-20afc5ee705mr34902965ad.47.1727281857892; Wed, 25 Sep 2024 09:30:57 -0700 (PDT) Received: from localhost.localdomain (c-24-6-151-244.hsd1.ca.comcast.net. [24.6.151.244]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20af16e0702sm26345585ad.28.2024.09.25.09.30.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Sep 2024 09:30:57 -0700 (PDT) From: Joe Damato To: netdev@vger.kernel.org Cc: 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) Subject: [RFC v2 net-next 1/2] e1000e: link NAPI instances to queues and IRQs Date: Wed, 25 Sep 2024 16:29:36 +0000 Message-Id: <20240925162937.2218-2-jdamato@fastly.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240925162937.2218-1-jdamato@fastly.com> References: <20240925162937.2218-1-jdamato@fastly.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 Content-Type: text/plain; charset="utf-8" Make e1000e compatible with the newly added netdev-genl APIs. $ cat /proc/interrupts | grep ens | cut -f1 --delimiter=3D':' 50 51 52 While e1000e allocates 3 IRQs (RX, TX, and other), it looks like e1000e only has a single NAPI, so I've associated the NAPI with the RX IRQ (50 on my system, seen above): $ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml \ --dump napi-get --json=3D'{"ifindex": 2}' [{'id': 145, 'ifindex': 2, 'irq': 50}] $ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml \ --dump queue-get --json=3D'{"ifindex": 2}' [{'id': 0, 'ifindex': 2, 'napi-id': 145, 'type': 'rx'}, {'id': 0, 'ifindex': 2, 'napi-id': 145, 'type': 'tx'}] Signed-off-by: Joe Damato --- drivers/net/ethernet/intel/e1000e/netdev.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ether= net/intel/e1000e/netdev.c index f103249b12fa..b527642c3a82 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c @@ -4613,6 +4613,7 @@ int e1000e_open(struct net_device *netdev) struct e1000_hw *hw =3D &adapter->hw; struct pci_dev *pdev =3D adapter->pdev; int err; + int irq; =20 /* disallow open during test */ if (test_bit(__E1000_TESTING, &adapter->state)) @@ -4676,7 +4677,15 @@ int e1000e_open(struct net_device *netdev) /* From here on the code is the same as e1000e_up() */ clear_bit(__E1000_DOWN, &adapter->state); =20 + if (adapter->int_mode =3D=3D E1000E_INT_MODE_MSIX) + irq =3D adapter->msix_entries[0].vector; + else + irq =3D adapter->pdev->irq; + + netif_napi_set_irq(&adapter->napi, irq); napi_enable(&adapter->napi); + netif_queue_set_napi(netdev, 0, NETDEV_QUEUE_TYPE_RX, &adapter->napi); + netif_queue_set_napi(netdev, 0, NETDEV_QUEUE_TYPE_TX, &adapter->napi); =20 e1000_irq_enable(adapter); =20 @@ -4735,6 +4744,8 @@ int e1000e_close(struct net_device *netdev) netdev_info(netdev, "NIC Link is Down\n"); } =20 + netif_queue_set_napi(netdev, 0, NETDEV_QUEUE_TYPE_RX, NULL); + netif_queue_set_napi(netdev, 0, NETDEV_QUEUE_TYPE_TX, NULL); napi_disable(&adapter->napi); =20 e1000e_free_tx_resources(adapter->tx_ring); --=20 2.34.1 From nobody Fri Nov 29 00:43:08 2024 Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) (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 54E2257880 for ; Wed, 25 Sep 2024 16:31:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727281861; cv=none; b=oIV7gD7pmlTw68UNqsjA0cP1i4dhRNY7XJRUWFvmDERvDTfKlgIlO6z6rfgjSVW+delTxkg+xgWIkuiiE29G21yOOhmzPbx/b3cZAchXte3ITXGoNXxy9Xik05CHFoRTTP7bV7tbPtNUJnL8dBlguQo1ITjRYFicS+cAH34zdto= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727281861; c=relaxed/simple; bh=WLuLHgx2MT3+4N/TaNL5sHAmTNY9YxSr2tDwSWM1Wks=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=XrM2b9FFOfu/ejA6TQ1g8LbzkeIgDzzhmQG2L5xR8uSPuOe5eJ+UhBJdUPjf9jeMrSOiWWf0QNLbQKyqg75xxZxvcIjj/3ESy1COuMQYbJ4eiSgHe9E9/tTVkw7hHG/oMDQidqH4sV+U6Ro/5fWLe/uRcBu2XMrGD6b7kHfSgiM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fastly.com; spf=pass smtp.mailfrom=fastly.com; dkim=pass (1024-bit key) header.d=fastly.com header.i=@fastly.com header.b=ZHo7fk5B; arc=none smtp.client-ip=209.85.215.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fastly.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fastly.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=fastly.com header.i=@fastly.com header.b="ZHo7fk5B" Received: by mail-pg1-f170.google.com with SMTP id 41be03b00d2f7-7d50e7a3652so739a12.3 for ; Wed, 25 Sep 2024 09:31:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastly.com; s=google; t=1727281860; x=1727886660; darn=vger.kernel.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=zqS3WLQRtJuGZ7n5fqIngVYCyukIdr8Yi9XEikosZZs=; b=ZHo7fk5BBCCHxeLIzWbCsbVVRvT9Ogg3YO1U1LNcCts+dFwBxac64Wu3OfDCHoMAfQ 0g0ehad/FU77j6okMhTn0m0jGcU1kLx4mNyAwbQAA7vT9LbWTGz1+0y6ewPQznyNtabj LC/3z8QrqLoHe1IY+HiJQuwkk2olcuLWP1PlY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727281860; x=1727886660; 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=zqS3WLQRtJuGZ7n5fqIngVYCyukIdr8Yi9XEikosZZs=; b=WdMkqrjgRAuwQKG/nLiiIZT9cWtuhiiXfdPR2UcV5K5GTBIuNNKd6H4Jh5eA1tOv6I ws1/KGwo8UJqWqNmOeVEHn+JoEp5n+x1/Yj2dcMSlSmilnrAuH8B014GJMAR000oo3mp Ve6G2XIKo91nIGc+Fh4hWpQ+TwN4vFh2MqpEdV2LF711hROnFrL9S+gV+TLpI7n5O9DC mPKHam5QHrg3MYSKxJcxQCS4z42TLIAb2gi1YCEh3LMUEQO+NnW0GvoDtu2wP5XjS9o1 D+vkq9kluk/Qky7lXU06qalObfQFD7k6HlHy+uzeOqoHyIfgORWK4N8aCoNGWnlik2ej Vexg== X-Forwarded-Encrypted: i=1; AJvYcCV+rN6EGBvlQ6kCnX/z4On6dbTI4jkg/7FOWDYj/st6o1aYIVI6YN1q067Y5rTde/6uw7sgki63HRzB67M=@vger.kernel.org X-Gm-Message-State: AOJu0YysxisIgLkKUnATfGnFzVUWkKYqChWHfP0cVjhJpQyUxuGOKt+z H3lpYNYOOXZRre6QHOTHuCweBsCdSvmoTvpqUmjoJAYYgkdJXvEgDNvOWtN6poA= X-Google-Smtp-Source: AGHT+IHkq6o5Ld2ygnxmPUAmwe4I6gQIsnCBKwiUvvIUWibnJ6eGpMuDVKGGABQBnTR8IJWaW9URVQ== X-Received: by 2002:a05:6a20:d526:b0:1c4:dfa7:d3b9 with SMTP id adf61e73a8af0-1d4d4b08946mr4079299637.28.1727281859597; Wed, 25 Sep 2024 09:30:59 -0700 (PDT) Received: from localhost.localdomain (c-24-6-151-244.hsd1.ca.comcast.net. [24.6.151.244]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20af16e0702sm26345585ad.28.2024.09.25.09.30.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Sep 2024 09:30:59 -0700 (PDT) From: Joe Damato To: netdev@vger.kernel.org Cc: 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) Subject: [RFC v2 net-next 2/2] e1000: Link IRQs and queues to NAPIs Date: Wed, 25 Sep 2024 16:29:37 +0000 Message-Id: <20240925162937.2218-3-jdamato@fastly.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240925162937.2218-1-jdamato@fastly.com> References: <20240925162937.2218-1-jdamato@fastly.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 Content-Type: text/plain; charset="utf-8" Add support for netdev-genl, allowing users to query IRQ, NAPI, and queue information. After this patch is applied, note the IRQ assigned to my NIC: $ cat /proc/interrupts | grep enp0s8 | cut -f1 --delimiter=3D':' 18 Note the output from the cli: $ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml \ --dump napi-get --json=3D'{"ifindex": 2}' [{'id': 513, 'ifindex': 2, 'irq': 18}] This device supports only 1 rx and 1 tx queue, so querying that: $ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml \ --dump queue-get --json=3D'{"ifindex": 2}' [{'id': 0, 'ifindex': 2, 'napi-id': 513, 'type': 'rx'}, {'id': 0, 'ifindex': 2, 'napi-id': 513, 'type': 'tx'}] Signed-off-by: Joe Damato --- drivers/net/ethernet/intel/e1000/e1000_main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/et= hernet/intel/e1000/e1000_main.c index ab7ae418d294..4de9b156b2be 100644 --- a/drivers/net/ethernet/intel/e1000/e1000_main.c +++ b/drivers/net/ethernet/intel/e1000/e1000_main.c @@ -513,6 +513,8 @@ void e1000_down(struct e1000_adapter *adapter) */ netif_carrier_off(netdev); =20 + netif_queue_set_napi(netdev, 0, NETDEV_QUEUE_TYPE_RX, NULL); + netif_queue_set_napi(netdev, 0, NETDEV_QUEUE_TYPE_TX, NULL); napi_disable(&adapter->napi); =20 e1000_irq_disable(adapter); @@ -1392,7 +1394,10 @@ int e1000_open(struct net_device *netdev) /* From here on the code is the same as e1000_up() */ clear_bit(__E1000_DOWN, &adapter->flags); =20 + netif_napi_set_irq(&adapter->napi, adapter->pdev->irq); napi_enable(&adapter->napi); + netif_queue_set_napi(netdev, 0, NETDEV_QUEUE_TYPE_RX, &adapter->napi); + netif_queue_set_napi(netdev, 0, NETDEV_QUEUE_TYPE_TX, &adapter->napi); =20 e1000_irq_enable(adapter); =20 --=20 2.34.1