From patchwork Tue Oct 8 23:34:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Nguyen X-Patchwork-Id: 13827216 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6EE3F21790A for ; Tue, 8 Oct 2024 23:34:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728430496; cv=none; b=lOyxbqHkL2ZJmGWaQzJUTgp9HgjrHoiQ5sjcWCqQ77UrPyEruWu1JC1jCHhb1OkN2SUl0CDBws5ZIWSNbRWaB+TxmCWHqA4REpN5nRwarcuf5M8eX8SA4mnNhofNkHPOeiRo50X/0PUEnQ1lfMNB7ZB6QyvtvqyicLt+cIqjUzM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728430496; c=relaxed/simple; bh=q+ZTXkZit2HKv+BA5/9U33HKSeEljzZzTBHoVXev0SM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Snt5NliZiHt/ersiRsV2CcfDNlgNZFEBDgR5UmBEVcdhxpNfiE8yoTR4Px4Te41tG/g3cMyMc5S131htwDrJT5ofvpzFn19HPVlOBklBX3nQ8oz2pGTWqmfGPI5U750SYMTrjA8IkdaLwXF7h2JryQXtOsYonEg2zHXMsZyizLs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=aki4XtBj; arc=none smtp.client-ip=198.175.65.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="aki4XtBj" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1728430495; x=1759966495; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=q+ZTXkZit2HKv+BA5/9U33HKSeEljzZzTBHoVXev0SM=; b=aki4XtBj1OyGVvlZhsfPnzSroJfiZ0RSGQBTMkwLwfPdX4hkDGiWET1M BJfvIm0Ca/HHmN5WQJ5EPedyULumhxB8h/zstvCqEsA5101G3u+wSoSpE RXcqlWLGIOwTki9dzkDbs31spqWMey0tSIDU3y7dkO0zVPBPp6ekMGO33 a3iZoqz7wOmQ2r6zcPJGEgx0aJHkGRm9jqVXgLNiY9uo9VcSRuG/nDRRS quH9RKMmD27TagPPwve101ZP7TnqvXQCszLVoUwuAk1WvOPUQbDWut5X1 ulZRmK64tMlqiLVk4KaRFqOOWe/uV3yDwwKjGal8cBTOT/Xy5f2fhrOB0 Q==; X-CSE-ConnectionGUID: zj17/vw0SxGeQDCAG7P99g== X-CSE-MsgGUID: p+aKkgOnSq+lp0gxF2T2LQ== X-IronPort-AV: E=McAfee;i="6700,10204,11219"; a="27779927" X-IronPort-AV: E=Sophos;i="6.11,188,1725346800"; d="scan'208";a="27779927" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Oct 2024 16:34:51 -0700 X-CSE-ConnectionGUID: KwEtyj/mSoOubinNi2eOWA== X-CSE-MsgGUID: s3fdc/usQ6mUVFe7CiVsIg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,188,1725346800"; d="scan'208";a="106794211" Received: from anguy11-upstream.jf.intel.com ([10.166.9.133]) by fmviesa001.fm.intel.com with ESMTP; 08 Oct 2024 16:34:51 -0700 From: Tony Nguyen To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, netdev@vger.kernel.org Cc: Joe Damato , anthony.l.nguyen@intel.com, vitaly.lifshits@intel.com, dima.ruinskiy@intel.com, Simon Horman , Avigail Dahan Subject: [PATCH net-next 11/12] e1000e: Link NAPI instances to queues and IRQs Date: Tue, 8 Oct 2024 16:34:37 -0700 Message-ID: <20241008233441.928802-12-anthony.l.nguyen@intel.com> X-Mailer: git-send-email 2.46.0.522.gc50d79eeffbf In-Reply-To: <20241008233441.928802-1-anthony.l.nguyen@intel.com> References: <20241008233441.928802-1-anthony.l.nguyen@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Joe Damato Add support for netdev-genl, allowing users to query IRQ, NAPI, and queue information. After this patch is applied, note the IRQs assigned to my NIC: $ cat /proc/interrupts | grep ens | cut -f1 --delimiter=':' 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). Note the output from the cli: $ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml \ --dump napi-get --json='{"ifindex": 2}' [{'id': 145, 'ifindex': 2, 'irq': 50}] 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='{"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 Reviewed-by: Simon Horman Acked-by: Vitaly Lifshits Tested-by: Avigail Dahan Signed-off-by: Tony Nguyen --- 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/ethernet/intel/e1000e/netdev.c index 9c9d4cb7c735..3be78c872a1c 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c @@ -4607,6 +4607,7 @@ int e1000e_open(struct net_device *netdev) struct e1000_hw *hw = &adapter->hw; struct pci_dev *pdev = adapter->pdev; int err; + int irq; /* disallow open during test */ if (test_bit(__E1000_TESTING, &adapter->state)) @@ -4670,7 +4671,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); + if (adapter->int_mode == E1000E_INT_MODE_MSIX) + irq = adapter->msix_entries[0].vector; + else + irq = 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); e1000_irq_enable(adapter); @@ -4729,6 +4738,8 @@ int e1000e_close(struct net_device *netdev) netdev_info(netdev, "NIC Link is Down\n"); } + 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); e1000e_free_tx_resources(adapter->tx_ring);