From nobody Mon Feb 9 05:22:26 2026 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (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 582C8176237 for ; Sun, 8 Sep 2024 16:08:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725811720; cv=none; b=bnBIWwq2G5DDYShBef0hC7ZdRkQa5giJ4iCBY8AAkBG/P7CQL8YeDnOG4Jb00LlzbxJ68GTq72m8V6pfmRi30nldNeez29+Tirp1MqJfw6YFOBLjBiuGTmz2JZrghPXYR/qmL7BEZV5rdC5iIVvSWMXt3sj2YrDVZ1dgYQokrvk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725811720; c=relaxed/simple; bh=BNKvxVYTuL++N+ZYm9W5qpapoauvjei5NqpfkRAMLoI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eqhE+AbelCwvoSgn/8B2rdzR1gGRxGu2EbK8IF/P7MMNw6EpWaVzPv/jRDB63ImR6FZGmeiUXQGJuERNSGTEjs/D0sgftAzYYDA1Z1UiWGwD21guUSI+0yUPM4WzCA1S0lSYBLlaPKeuKKiOGQtXBcBgQ90X7AFF4+A22PnAQpY= 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=HPjlKk2Z; arc=none smtp.client-ip=209.85.214.175 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="HPjlKk2Z" Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-2068bee21d8so34946685ad.2 for ; Sun, 08 Sep 2024 09:08:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastly.com; s=google; t=1725811719; x=1726416519; 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=XALJ7SdzaDOWVbMSTdcXBR+9NoF8QqBzXwj7wqN3oPE=; b=HPjlKk2ZuTa/atl77mD7Im12rUTZ0Z0HtN55HX4fx7qAQVRzjx7R4pwu/D9ReNtMx1 7434M3+Lg/FGOJT4qbEe0XODccNBfUZWbBzcBd4wuQP77g/DdDy+bMg14PaZhn2Gnakg GYw9vn0O6CZC3n+RDSqQYGOU+zlMKvYAAlXNQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725811719; x=1726416519; 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=XALJ7SdzaDOWVbMSTdcXBR+9NoF8QqBzXwj7wqN3oPE=; b=fGOVUcbwl0qLaq/SvuPmczWjtUcQz87F85pqLVQrGoeYoJjcorEN0hNaiio9Idq23N PkKCbw083fXiW5nDkbaD+3b+KXGndDJCF6U0uB3RPYNoaxtwJTpBQTrAgK0Z6wSur9gx IkCK884v8/2qf9UkF2L43ocPwMVW4E6tvViQK/A2gAQ3CpZTLLsb+U4HM/cXtPRzdUEy b4Ju2H2nlAYtDViie8LfdH7w14odYqmaQ7Abp8mxRPsp1jWaiOR1U6eOzTwOYClQGrLZ TTTrFjkoRnCjfDtpvgxYLQc0YGjGNx+2CE7AhKAG6xPGiVX3Q3YIw4LH0qK5OAKcuh5X QtEw== X-Forwarded-Encrypted: i=1; AJvYcCWisjEOLdQWyrLJ93Et81htXLQiVxYbESf9M2KhBmnA1BWvrYJ3r3fml4d8yeTcPNrDHFeA39PsYQlIZbA=@vger.kernel.org X-Gm-Message-State: AOJu0YzbIhU7VI/qz0GU30tnDwdMMzQdcTz3KMJktmUJ5KvITX+9GvMW xm8ORwdNc7Q7NWJ7LRO2eyVZ+beKGq/KoFyvEOETW+PiJeMCg/dJ5Tf1E7mPR38= X-Google-Smtp-Source: AGHT+IFSF82ScYVZRAI2likR2SsKzoBk6rQOgSbeMrGcT+1n67/wRDaY703WCe1MsbvqtuQbVhJ/Ww== X-Received: by 2002:a17:902:f68e:b0:202:9b7:1dc with SMTP id d9443c01a7336-2070c1c74c7mr74584625ad.54.1725811718448; Sun, 08 Sep 2024 09:08:38 -0700 (PDT) Received: from localhost.localdomain ([2620:11a:c019:0:65e:3115:2f58:c5fd]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20710f3179fsm21412535ad.258.2024.09.08.09.08.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Sep 2024 09:08:38 -0700 (PDT) From: Joe Damato To: netdev@vger.kernel.org Cc: mkarsten@uwaterloo.ca, kuba@kernel.org, skhawaja@google.com, sdf@fomichev.me, bjorn@rivosinc.com, amritha.nambiar@intel.com, sridhar.samudrala@intel.com, Joe Damato , "David S. Miller" , Eric Dumazet , Paolo Abeni , Donald Hunter , Jesper Dangaard Brouer , Xuan Zhuo , Daniel Jurgens , linux-kernel@vger.kernel.org (open list) Subject: [RFC net-next v2 2/9] netdev-genl: Export NAPI index Date: Sun, 8 Sep 2024 16:06:36 +0000 Message-Id: <20240908160702.56618-3-jdamato@fastly.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240908160702.56618-1-jdamato@fastly.com> References: <20240908160702.56618-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" Export the NAPI index on napi-get operations. This index will be used in future commits to set per-NAPI parameters. Signed-off-by: Joe Damato --- Documentation/netlink/specs/netdev.yaml | 9 +++++++++ include/uapi/linux/netdev.h | 1 + net/core/netdev-genl.c | 3 +++ 3 files changed, 13 insertions(+) diff --git a/Documentation/netlink/specs/netdev.yaml b/Documentation/netlin= k/specs/netdev.yaml index 959755be4d7f..cf3e77c6fd5e 100644 --- a/Documentation/netlink/specs/netdev.yaml +++ b/Documentation/netlink/specs/netdev.yaml @@ -244,6 +244,14 @@ attribute-sets: threaded mode. If NAPI is not in threaded mode (i.e. uses nor= mal softirq context), the attribute will be absent. type: u32 + - + name: index + doc: The index of the NAPI instance. Refers to persistent storage = for + any NAPI with the same index. + type: u32 + checks: + min: 0 + max: s32-max - name: queue attributes: @@ -593,6 +601,7 @@ operations: - ifindex - irq - pid + - index dump: request: attributes: diff --git a/include/uapi/linux/netdev.h b/include/uapi/linux/netdev.h index 43742ac5b00d..e06e33acb6fd 100644 --- a/include/uapi/linux/netdev.h +++ b/include/uapi/linux/netdev.h @@ -121,6 +121,7 @@ enum { NETDEV_A_NAPI_ID, NETDEV_A_NAPI_IRQ, NETDEV_A_NAPI_PID, + NETDEV_A_NAPI_INDEX, =20 __NETDEV_A_NAPI_MAX, NETDEV_A_NAPI_MAX =3D (__NETDEV_A_NAPI_MAX - 1) diff --git a/net/core/netdev-genl.c b/net/core/netdev-genl.c index a17d7eaeb001..9561841b9d2d 100644 --- a/net/core/netdev-genl.c +++ b/net/core/netdev-genl.c @@ -182,6 +182,9 @@ netdev_nl_napi_fill_one(struct sk_buff *rsp, struct nap= i_struct *napi, if (napi->irq >=3D 0 && nla_put_u32(rsp, NETDEV_A_NAPI_IRQ, napi->irq)) goto nla_put_failure; =20 + if (napi->index >=3D 0 && nla_put_u32(rsp, NETDEV_A_NAPI_INDEX, napi->ind= ex)) + goto nla_put_failure; + if (napi->thread) { pid =3D task_pid_nr(napi->thread); if (nla_put_u32(rsp, NETDEV_A_NAPI_PID, pid)) --=20 2.25.1