From nobody Thu Dec 18 09:43:01 2025 Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (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 AF0941E32DB for ; Tue, 11 Feb 2025 20:06:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739304367; cv=none; b=eb07eMyNNhNCV/fvc/o2c6pa0obVSZCFCrM6ruJfOhMGj20dJwBlZyBceYqMbb18UgIluTRKEYPpcpYDCKf9KBoT6rQ+sqvZx6YYLPb2NJCXbqL/RJLKEHRL8Cw2r6pI9oAX5HiMjbC5HisBk8UkDAzvVVni9ole6hFzB6tZzk0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739304367; c=relaxed/simple; bh=ft0iTXOlvHUjc3hz8JBZEHUjPHt9IGzMRpYUZVq8nDk=; h=From:MIME-Version:Date:Message-ID:Subject:To:Cc:Content-Type; b=hjCK0UvcrSrenxM9BHhXdJ5rImDtzg1eR9XSbzX3lY1iZp/C27JeXgHBPpRj1fTp4i9ILEgXI1Lyj3A5YRfFIqUuoPXU/YOtMdIwKsg+TnvrFuspmgVFSKMw8mZReCD8GYNEt6Z6FPdpucxBulaU5h40eWqzOPsRPbe2aPlQsPg= 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=twsj5kPc; arc=none smtp.client-ip=209.85.208.45 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="twsj5kPc" Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-5de7531434fso5101611a12.0 for ; Tue, 11 Feb 2025 12:06:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastly.com; s=google; t=1739304364; x=1739909164; darn=vger.kernel.org; h=cc:to:subject:message-id:date:mime-version:from:from:to:cc:subject :date:message-id:reply-to; bh=Nxkie6yLM0q2pX+0WAYEdeQeZkDttdl+fqsW8wL2k/g=; b=twsj5kPcxUDuVWjBv9vg518yUWxM4dXIEiKPGZm0+MKODqD8lGnR1yluoDEsaV/3vF ogdYolUyq6Tou1SUyRnYa9bIpNA+eXIQT2oCuhYfJ5GUpkvAemGwXuMGjNCkj3/sFpGI 0FvoD4SEOUh9RuzTr04S4Q194TuiPUGp0bGeI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739304364; x=1739909164; h=cc:to:subject:message-id:date:mime-version:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Nxkie6yLM0q2pX+0WAYEdeQeZkDttdl+fqsW8wL2k/g=; b=aRopKU3SMqECjSNakhauPvXNH7LBacQQxY0FfJxsZlb3K1tLMFllv5d7ST+6rgKHK3 b9Mwd4sVfs+E7dHHcCCuozCphdTGcUDiC1guW2afMrJ5IN3evzUFk9XHo3KlbOEExf/x 9/gtjaC2a6ex18tzoT2I6dT7ghmKui0Gf73Kcf0yAzRNe1fy1bI7900xxDZDrzUh9NRu GpH0fLQNzg/lkNQgdKkRfqlj/ri/DBeBk8VQdA9CGNojSpBVg+XJa38qEWSp+oRRMryE OyM317OJOghqplQBt5rnxYMzL1nGZXKivSUNG5WYjj+uZgv5BGSlHSsLMfqOm4UfZssQ 3eAQ== X-Forwarded-Encrypted: i=1; AJvYcCUKO0kMDOr9q6R21uKO7yBWsRU8ruSM6TpvF+dYCTLm1rpmwbTTqo1/ur4O6XDQT8bYimHMgbxrWCWD7NI=@vger.kernel.org X-Gm-Message-State: AOJu0YwnND5OmlItaj1Vzpa9G6tPJt5DVkjZHQKMtWdC3U2zTI2JroTV 3wrnVeRSeFM9zYg6YqwinSzYjv9UDI1XBrjmNGmXQxPdCz0vd1PiZi79bKghfr5Bzo3mWm2vbV1 FNW7HI4Anyl2+rcC22QQFpE1Tg/s/J+oXeAnl+g== X-Gm-Gg: ASbGncsnu/SgnkWtcR/twmBsP35X2v1DFQ1PKC3DvQKv9oJ4twbOIncQTp0jX9RGx+f 1yt5cCpFPobp2Ybfswykp/fY7sk1Mk4KKY7vx7Dr1ogVsS6gP+J6c+lZLWgRVvqqSpeL4z9HdPB 5AjtOTmQFDeCF9UywB66V6ZLzJ X-Google-Smtp-Source: AGHT+IHoKfgQCKWZr7QsjqOlhYz8Ox3tvPFbg93XOMkmh6ra72F9JlcLUDZxrph5gh4NGZsFZXFolvtA6RlQNHopUqo= X-Received: by 2002:a17:907:6d05:b0:aab:8ca7:43df with SMTP id a640c23a62f3a-ab7f347db66mr24967366b.39.1739304363872; Tue, 11 Feb 2025 12:06:03 -0800 (PST) Received: from 155257052529 named unknown by gmailapi.google.com with HTTPREST; Tue, 11 Feb 2025 20:06:03 +0000 From: Joe Damato X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Date: Tue, 11 Feb 2025 20:06:03 +0000 X-Gm-Features: AWEUYZm9IYCWBJGOUEwrC9uMXesN9YSdVvlwLoAEoxsHN8IrvsvNvDyqzWHbUjM Message-ID: Subject: [PATCH net-next v2] documentation: networking: Add NAPI config To: netdev@vger.kernel.org Cc: kuba@kernel.org, rdunlap@infradead.org, bagasdotme@gmail.com, ahmed.zaki@intel.com, Joe Damato , "David S. Miller" , Eric Dumazet , Paolo Abeni , Simon Horman , Jonathan Corbet , "open list:DOCUMENTATION" , open list Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Document the existence of persistent per-NAPI configuration space and the API that drivers can opt into. Update stale documentation which suggested that NAPI IDs cannot be queried from userspace. Signed-off-by: Joe Damato Acked-by: Jakub Kicinski Reviewed-by: Bagas Sanjaya --- v2: - Reword the Persistent Napi config section using some suggestions from Jakub. Documentation/networking/napi.rst | 33 ++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/Documentation/networking/napi.rst b/Documentation/networking/napi.rst index f970a2be271a..d0e3953cae6a 100644 --- a/Documentation/networking/napi.rst +++ b/Documentation/networking/napi.rst @@ -171,12 +171,43 @@ a channel as an IRQ/NAPI which services queues of a given type. For example, a configuration of 1 ``rx``, 1 ``tx`` and 1 ``combined`` channel is expect= ed to utilize 3 interrupts, 2 Rx and 2 Tx queues. +Persistent NAPI config +---------------------- + +Drivers often allocate and free NAPI instances dynamically. This leads to = loss +of NAPI-related user configuration each time NAPI instances are reallocate= d. +The netif_napi_add_config() API prevents this loss of configuration by +associating each NAPI instance with a persistent NAPI configuration based = on +a driver defined index value, like a queue number. + +Using this API allows for persistent NAPI IDs (among other settings), whic= h can +be beneficial to userspace programs using ``SO_INCOMING_NAPI_ID``. See the +sections below for other NAPI configuration settings. + +Drivers should try to use netif_napi_add_config() whenever possible. + User API =3D=3D=3D=3D=3D=3D=3D=3D User interactions with NAPI depend on NAPI instance ID. The instance IDs are only visible to the user thru the ``SO_INCOMING_NAPI_ID`` socket optio= n. -It's not currently possible to query IDs used by a given device. + +Users can query NAPI IDs for a device or device queue using netlink. This = can +be done programmatically in a user application or by using a script includ= ed in +the kernel source tree: ``tools/net/ynl/pyynl/cli.py``. + +For example, using the script to dump all of the queues for a device (which +will reveal each queue's NAPI ID): + +.. code-block:: bash + + $ kernel-source/tools/net/ynl/pyynl/cli.py \ + --spec Documentation/netlink/specs/netdev.yaml \ + --dump queue-get \ + --json=3D'{"ifindex": 2}' + +See ``Documentation/netlink/specs/netdev.yaml`` for more details on +available operations and attributes. Software IRQ coalescing ----------------------- base-commit: ae9b3c0e79bcc154f80f6e862d3085de31bcb3ce --=20 2.43.0