@@ -171,12 +171,43 @@ a channel as an IRQ/NAPI which services queues of a given type. For example,
171171a configuration of 1 ``rx ``, 1 ``tx `` and 1 ``combined `` channel is expected
172172to utilize 3 interrupts, 2 Rx and 2 Tx queues.
173173
174+ Persistent NAPI config
175+ ----------------------
176+
177+ Drivers often allocate and free NAPI instances dynamically. This leads to loss
178+ of NAPI-related user configuration each time NAPI instances are reallocated.
179+ The netif_napi_add_config() API prevents this loss of configuration by
180+ associating each NAPI instance with a persistent NAPI configuration based on
181+ a driver defined index value, like a queue number.
182+
183+ Using this API allows for persistent NAPI IDs (among other settings), which can
184+ be beneficial to userspace programs using ``SO_INCOMING_NAPI_ID ``. See the
185+ sections below for other NAPI configuration settings.
186+
187+ Drivers should try to use netif_napi_add_config() whenever possible.
188+
174189User API
175190========
176191
177192User interactions with NAPI depend on NAPI instance ID. The instance IDs
178193are only visible to the user thru the ``SO_INCOMING_NAPI_ID `` socket option.
179- It's not currently possible to query IDs used by a given device.
194+
195+ Users can query NAPI IDs for a device or device queue using netlink. This can
196+ be done programmatically in a user application or by using a script included in
197+ the kernel source tree: ``tools/net/ynl/pyynl/cli.py ``.
198+
199+ For example, using the script to dump all of the queues for a device (which
200+ will reveal each queue's NAPI ID):
201+
202+ .. code-block :: bash
203+
204+ $ kernel-source/tools/net/ynl/pyynl/cli.py \
205+ --spec Documentation/netlink/specs/netdev.yaml \
206+ --dump queue-get \
207+ --json=' {"ifindex": 2}'
208+
209+ See ``Documentation/netlink/specs/netdev.yaml `` for more details on
210+ available operations and attributes.
180211
181212Software IRQ coalescing
182213-----------------------
0 commit comments