From patchwork Thu Sep 26 03:00:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Damato X-Patchwork-Id: 13812755 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (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 69AAF17838D for ; Thu, 26 Sep 2024 03:00:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727319646; cv=none; b=dQnhIydjKXS5V895DJ8G71yGpUIQFsD6sLcJPu9/SKynTMJpOTUPut/J0sYvdLW03BKbTzGGGYd2uexn01EmMiiPLiWrMBkeiaxaF80TNrk5aoxXgfkA1HBWqiiBoZl6TasJOKao6Z4KL2znkoK0HOzyU52ZMy0mA2G/Y9Nl/Eg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727319646; c=relaxed/simple; bh=ke7VjoLC8SeGZeHWg/3wGeF+yuAtJBY3g55jc8f75O8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Nf5btwvbxonek+b7kXKQfhhGyAkeKJhfs4993AM1HcIVeelBFp7Hfc/McJY74zNMET4V8dP/MJcsqqQ1uLLkRRR6QB380jxEsty7w7n4jrO1rQV0sUJtL1jqR57LDpRM1yEvq/F1Mle77N6j3DHnHU7hkecgnZdPp8bBqKvoOIw= 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=aXpwI+Pe; arc=none smtp.client-ip=209.85.210.181 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="aXpwI+Pe" Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-718f4fd89e5so487104b3a.0 for ; Wed, 25 Sep 2024 20:00:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastly.com; s=google; t=1727319644; x=1727924444; 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=mFH9E5BI155gM3Rr+uFGb1WMCMDmhX6ED0N/YxAEGrI=; b=aXpwI+PeHK6HwQNrXsPrSi6WwskDe5cv6wIz1KcTTSF9EguQGpEL8TDJEHCsNHwWGL QycdSoy52w8rIemIFIxzVPcichyF1DY8Cw2QCsZfmSCjJw8gXHBeIVc7XE8YNUpcDqXa 3V3Gq9FgKBjiq0cyAMFykFpIboeLT80GUJIJ8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727319644; x=1727924444; 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=mFH9E5BI155gM3Rr+uFGb1WMCMDmhX6ED0N/YxAEGrI=; b=pyflrf7/ZZfs5pOErEGDdsKr/DIdkH4+cFySS3AGCPk1LxCeoAWjzf2OhHZ7ymNHIO tSPQo8vee5AYmvd6PjfO2VpflT0uIIRX46CicnKV7EQMS4D4AWBSKMXIUWogDWj/7scq Q8Bqod3OmtZY2rd5rwZcf96WELXCreMw7kO1Em+dAhOL40wMP+VPY/oUHu8KHeW/XlbF ndsILXTUWL3tqjTPneeLz0QXy+xdtKCl4Zy15xmnl9JMoqzQkWr53yoco00LfIbdGERR Crn0oRcf6MmXX6ebNkz7vPxP/hWC/Oit9JYdqk4mbbFiAyTVO/ZZz6+pdu24GNfPYr5j NP1w== X-Gm-Message-State: AOJu0YzcjtYv7KIgg8NNYH5uoKk5rOaK0P2iof5mf27x28PDXqRgdPYK 4yEiDx27FkxEinLuDHipJ3jb44aDtiXCX8+t60gOhc26JYvazkBDI2rdyLC8qilEeS23yitg7AE k+aIDtZs/jFgXsOy96HCaAwUKUyykWEIXNFqBX2tMCcfZluybReL3jiE0oVvHnHkNUzmsxiCSrZ gdTAX2k52+9PMKPj4MifSfKE4g9OfK0UWzRLU= X-Google-Smtp-Source: AGHT+IFwXhiKp92OtV3zKXtfySxHUFQ6ffBh3po82IyoEmF7fZbfZbFLz2IsWR+8MIdi2e/0d9XDBw== X-Received: by 2002:a05:6a20:e18a:b0:1cf:55e:f893 with SMTP id adf61e73a8af0-1d4d4b8609cmr6114351637.36.1727319644364; Wed, 25 Sep 2024 20:00:44 -0700 (PDT) Received: from localhost.localdomain ([2620:11a:c019:0:65e:3115:2f58:c5fd]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71afc97c2a8sm3354111b3a.163.2024.09.25.20.00.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Sep 2024 20:00:44 -0700 (PDT) From: Joe Damato To: netdev@vger.kernel.org Cc: Joe Damato , Jeroen de Borst , Praveen Kaligineedi , Shailend Chand , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Willem de Bruijn , Simon Horman , linux-kernel@vger.kernel.org (open list) Subject: [RFC net-next 1/2] gve: Map IRQs to NAPI instances Date: Thu, 26 Sep 2024 03:00:21 +0000 Message-Id: <20240926030025.226221-2-jdamato@fastly.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240926030025.226221-1-jdamato@fastly.com> References: <20240926030025.226221-1-jdamato@fastly.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 X-Patchwork-State: RFC Use netdev-genl interface to map IRQs to NAPI instances so that this information is accesible by user apps via netlink. $ cat /proc/interrupts | grep gve | grep -v mgmnt | cut -f1 --delimiter=':' 34 35 36 37 38 39 40 [...] 65 $ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml \ --dump napi-get --json='{"ifindex": 2}' [{'id': 8288, 'ifindex': 2, 'irq': 65}, [...] {'id': 8263, 'ifindex': 2, 'irq': 40}, {'id': 8262, 'ifindex': 2, 'irq': 39}, {'id': 8261, 'ifindex': 2, 'irq': 38}, {'id': 8260, 'ifindex': 2, 'irq': 37}, {'id': 8259, 'ifindex': 2, 'irq': 36}, {'id': 8258, 'ifindex': 2, 'irq': 35}, {'id': 8257, 'ifindex': 2, 'irq': 34}] Signed-off-by: Joe Damato --- drivers/net/ethernet/google/gve/gve_utils.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/google/gve/gve_utils.c b/drivers/net/ethernet/google/gve/gve_utils.c index 2349750075a5..30fef100257e 100644 --- a/drivers/net/ethernet/google/gve/gve_utils.c +++ b/drivers/net/ethernet/google/gve/gve_utils.c @@ -111,6 +111,7 @@ void gve_add_napi(struct gve_priv *priv, int ntfy_idx, struct gve_notify_block *block = &priv->ntfy_blocks[ntfy_idx]; netif_napi_add(priv->dev, &block->napi, gve_poll); + netif_napi_set_irq(&block->napi, block->irq); } void gve_remove_napi(struct gve_priv *priv, int ntfy_idx) From patchwork Thu Sep 26 03:00:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Damato X-Patchwork-Id: 13812756 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) (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 58317185E6E for ; Thu, 26 Sep 2024 03:00:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727319649; cv=none; b=NM3gb7Z7jIrd3cNy45bboINcyuRe3MsNVd2qnyrZAZfxmXhp3KCG1xxvnSsFqRTTPsv9NDUfWO/J04OjRgK3XtSHe2Uq/BZO1z0ONyHi1ObKqqtB2mJNj32euEDxRQtzM1gSX/pusOtW/ksumVvLTmaci2kuFQZ/GydlDRtwlOQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727319649; c=relaxed/simple; bh=fOP1RW8xaYXgo6UAKNyyCaNdqYpSFEzAXlb1gulSoCs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=h2Z5ISrnzIOBZ+J+iTjc2A3KGYr/tCsSs57UZHlrSgBDW4Pun1mWIeCq9feSFC5YPPJIfO6utQ0nFvPKNfcUNeV9tJmq86qV+groV8YiKq2NaFI6j+AZsLHXVCz1LfqHi7zIymoE7oksv8oMQIV4pOYXOtjKAqtoOv2+GquwFO8= 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=U9OP4OLN; arc=none smtp.client-ip=209.85.210.178 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="U9OP4OLN" Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-71b0d9535c0so391448b3a.2 for ; Wed, 25 Sep 2024 20:00:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastly.com; s=google; t=1727319647; x=1727924447; 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=Go4TL5YXIlZZjrMduyK+IYQM3hDPDoYu1c/gM7Xg4NM=; b=U9OP4OLNmdPKBCZkhRLl1Y8pWLWiIM3gNP6ukhz+HMKlPan5/Pw9RFUN8T1mrqbUxP m4R5jJ9sy2BH3PTGb0JKnyB1hOr9hOtBnhhQzBL3kNfD/AoRwvxG7nCfn8qS3Tn7X/5H RTi+8i2BsqLVicmXWiHl3jXjMJbfN0AxoPEz4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727319647; x=1727924447; 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=Go4TL5YXIlZZjrMduyK+IYQM3hDPDoYu1c/gM7Xg4NM=; b=O3uNNIdQGOAAgPXeDIhVAwGpwCi92BQViwC1jsw7GzVwExTVAHKuX/YCDj6C+2gU6k e62O0UdkU0NbG3FY9AJY4BpDvSBl/RjoxPQPJWneR/Z8nlLtRolz6GoLcWWrfMWN4uR9 kkAl2jGQ7aasMN/ce+nSM9bnWktdQPqiq5P48litTMLIp4+dpuXsxiAVleC+7ihnsBf3 2Zi6XMHToY84Q/5awTvU77kd5N78ZpMIN6/2Gacd0kMzx1R3Xo8uTz5lSBuZOj2P4ZXt uP8SDGn24LvMhdEERkQ/PksggG3oQwUvIn28WYsl2tI+32GGP55HcW8hHcwOp5ir8Rdj wHvA== X-Gm-Message-State: AOJu0YyClmYFSTe+C1ywQPWgDtBCJGMF4E9yUXtFDMK7csh8k7Ykuawn XXMFjd68JMYsj2zJrDdxAy8LL7YcN4hPmTJhriVWnaTjpSHTQEU6r1FS/fmEZ9+/HgGKJ9c2mx8 2XzvWcFeaKIle8aBQJEXCjq+5D3c2cstBRWkFnGEyzSjpzJs6/75uYhmsyHX3onvHb0oQusFh/L w42jUtMtbUJoAWSo4YQjucjQ/9YiTcLDLnoUY= X-Google-Smtp-Source: AGHT+IHo/QvXYlAQpeWJb8WEqJxzH+RaMo6+alDlGBaUSCq3IFim3Y3CWxECI4I1FBHAIyJCrPXsJw== X-Received: by 2002:a05:6a00:174c:b0:718:d94b:4b with SMTP id d2e1a72fcca58-71b0aaa22ddmr6704494b3a.6.1727319647069; Wed, 25 Sep 2024 20:00:47 -0700 (PDT) Received: from localhost.localdomain ([2620:11a:c019:0:65e:3115:2f58:c5fd]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71afc97c2a8sm3354111b3a.163.2024.09.25.20.00.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Sep 2024 20:00:46 -0700 (PDT) From: Joe Damato To: netdev@vger.kernel.org Cc: Joe Damato , Jeroen de Borst , Praveen Kaligineedi , Shailend Chand , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Willem de Bruijn , Harshitha Ramamurthy , Ziwei Xiao , linux-kernel@vger.kernel.org (open list) Subject: [RFC net-next 2/2] gve: Map NAPI instances to queues Date: Thu, 26 Sep 2024 03:00:22 +0000 Message-Id: <20240926030025.226221-3-jdamato@fastly.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240926030025.226221-1-jdamato@fastly.com> References: <20240926030025.226221-1-jdamato@fastly.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 X-Patchwork-State: RFC Use the netdev-genl interface to map NAPI instances to queues so that this information is accessible to user programs via netlink. $ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml \ --dump queue-get --json='{"ifindex": 2}' [{'id': 0, 'ifindex': 2, 'napi-id': 8313, 'type': 'rx'}, {'id': 1, 'ifindex': 2, 'napi-id': 8314, 'type': 'rx'}, {'id': 2, 'ifindex': 2, 'napi-id': 8315, 'type': 'rx'}, {'id': 3, 'ifindex': 2, 'napi-id': 8316, 'type': 'rx'}, {'id': 4, 'ifindex': 2, 'napi-id': 8317, 'type': 'rx'}, [...] {'id': 0, 'ifindex': 2, 'napi-id': 8297, 'type': 'tx'}, {'id': 1, 'ifindex': 2, 'napi-id': 8298, 'type': 'tx'}, {'id': 2, 'ifindex': 2, 'napi-id': 8299, 'type': 'tx'}, {'id': 3, 'ifindex': 2, 'napi-id': 8300, 'type': 'tx'}, {'id': 4, 'ifindex': 2, 'napi-id': 8301, 'type': 'tx'}, [...] Signed-off-by: Joe Damato --- drivers/net/ethernet/google/gve/gve_main.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c index 661566db68c8..da811e90bdfa 100644 --- a/drivers/net/ethernet/google/gve/gve_main.c +++ b/drivers/net/ethernet/google/gve/gve_main.c @@ -1875,6 +1875,9 @@ static void gve_turndown(struct gve_priv *priv) if (!gve_tx_was_added_to_block(priv, idx)) continue; + + netif_queue_set_napi(priv->dev, idx, NETDEV_QUEUE_TYPE_TX, + NULL); napi_disable(&block->napi); } for (idx = 0; idx < priv->rx_cfg.num_queues; idx++) { @@ -1883,6 +1886,9 @@ static void gve_turndown(struct gve_priv *priv) if (!gve_rx_was_added_to_block(priv, idx)) continue; + + netif_queue_set_napi(priv->dev, idx, NETDEV_QUEUE_TYPE_RX, + NULL); napi_disable(&block->napi); } @@ -1909,6 +1915,9 @@ static void gve_turnup(struct gve_priv *priv) continue; napi_enable(&block->napi); + netif_queue_set_napi(priv->dev, idx, NETDEV_QUEUE_TYPE_TX, + &block->napi); + if (gve_is_gqi(priv)) { iowrite32be(0, gve_irq_doorbell(priv, block)); } else { @@ -1931,6 +1940,9 @@ static void gve_turnup(struct gve_priv *priv) continue; napi_enable(&block->napi); + netif_queue_set_napi(priv->dev, idx, NETDEV_QUEUE_TYPE_RX, + &block->napi); + if (gve_is_gqi(priv)) { iowrite32be(0, gve_irq_doorbell(priv, block)); } else {