* [Question] Generic way to retrieve IRQ number of Tx/Rx queue
@ 2025-01-10 9:07 Daniel Sedlak
2025-01-10 17:38 ` Stephen Hemminger
2025-01-13 21:15 ` Jakub Kicinski
0 siblings, 2 replies; 5+ messages in thread
From: Daniel Sedlak @ 2025-01-10 9:07 UTC (permalink / raw)
To: linux-kernel, netdev
Hello,
I am writing an affinity scheduler in the userspace for network cards's
Tx/Rx queues. Is there a generic way to retrieve all IRQ numbers for
those queues for each interface?
My goal is to get all Tx/Rx queues for a given interface, get the IRQ
number of the individual queues, and set an affinity hint for each
queue. I have tried to loop over /proc/interrupts to retrieve all queues
for an interface in a hope that the last column would contain the
interface name however this does not work since the naming is not
unified across drivers. My second attempt was to retrieve all registered
interrupts by network interface from
/sys/class/net/{interface_name}/device/msi_irqs/, but this attempt was
also without luck because some drivers request more IRQs than the number
of queues (for example i40e driver).
Thank you for any help or advice
Daniel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Question] Generic way to retrieve IRQ number of Tx/Rx queue
2025-01-10 9:07 [Question] Generic way to retrieve IRQ number of Tx/Rx queue Daniel Sedlak
@ 2025-01-10 17:38 ` Stephen Hemminger
2025-01-13 21:15 ` Jakub Kicinski
1 sibling, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2025-01-10 17:38 UTC (permalink / raw)
To: Daniel Sedlak; +Cc: linux-kernel, netdev
On Fri, 10 Jan 2025 10:07:18 +0100
Daniel Sedlak <daniel@sedlak.dev> wrote:
> Hello,
> I am writing an affinity scheduler in the userspace for network cards's
> Tx/Rx queues. Is there a generic way to retrieve all IRQ numbers for
> those queues for each interface?
>
> My goal is to get all Tx/Rx queues for a given interface, get the IRQ
> number of the individual queues, and set an affinity hint for each
> queue. I have tried to loop over /proc/interrupts to retrieve all queues
> for an interface in a hope that the last column would contain the
> interface name however this does not work since the naming is not
> unified across drivers. My second attempt was to retrieve all registered
> interrupts by network interface from
> /sys/class/net/{interface_name}/device/msi_irqs/, but this attempt was
> also without luck because some drivers request more IRQs than the number
> of queues (for example i40e driver).
>
> Thank you for any help or advice
>
> Daniel
>
Good luck reinventing irqbalance.
There can be multiple interrupts per queue, or one interrupt can serve multiple queues.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Question] Generic way to retrieve IRQ number of Tx/Rx queue
2025-01-10 9:07 [Question] Generic way to retrieve IRQ number of Tx/Rx queue Daniel Sedlak
2025-01-10 17:38 ` Stephen Hemminger
@ 2025-01-13 21:15 ` Jakub Kicinski
2025-01-14 8:32 ` Daniel Sedlak
1 sibling, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2025-01-13 21:15 UTC (permalink / raw)
To: Daniel Sedlak; +Cc: linux-kernel, netdev, intel-wired-lan
On Fri, 10 Jan 2025 10:07:18 +0100 Daniel Sedlak wrote:
> Hello,
> I am writing an affinity scheduler in the userspace for network cards's
> Tx/Rx queues. Is there a generic way to retrieve all IRQ numbers for
> those queues for each interface?
>
> My goal is to get all Tx/Rx queues for a given interface, get the IRQ
> number of the individual queues, and set an affinity hint for each
> queue. I have tried to loop over /proc/interrupts to retrieve all queues
> for an interface in a hope that the last column would contain the
> interface name however this does not work since the naming is not
> unified across drivers. My second attempt was to retrieve all registered
> interrupts by network interface from
> /sys/class/net/{interface_name}/device/msi_irqs/, but this attempt was
> also without luck because some drivers request more IRQs than the number
> of queues (for example i40e driver).
We do have an API for that
https://docs.kernel.org/next/networking/netlink_spec/netdev.html#napi
but unfortunately the driver needs to support it, and i40e currently
doesn't:
$ git grep --files-with-matches netif_napi_set_irq
drivers/net/ethernet/amazon/ena/ena_netdev.c
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/tg3.c
drivers/net/ethernet/google/gve/gve_utils.c
drivers/net/ethernet/intel/e1000/e1000_main.c
drivers/net/ethernet/intel/e1000e/netdev.c
drivers/net/ethernet/intel/ice/ice_lib.c
drivers/net/ethernet/intel/igc/igc_main.c
drivers/net/ethernet/mellanox/mlx4/en_cq.c
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
Should be easy to add. Let me CC the Intel list in case they already
have a relevant change queued for i40e..
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Question] Generic way to retrieve IRQ number of Tx/Rx queue
2025-01-13 21:15 ` Jakub Kicinski
@ 2025-01-14 8:32 ` Daniel Sedlak
2025-01-14 23:26 ` Joe Damato
0 siblings, 1 reply; 5+ messages in thread
From: Daniel Sedlak @ 2025-01-14 8:32 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: linux-kernel, netdev, intel-wired-lan
On 1/13/25 10:15 PM, Jakub Kicinski wrote:
> On Fri, 10 Jan 2025 10:07:18 +0100 Daniel Sedlak wrote:
>> Hello,
>> I am writing an affinity scheduler in the userspace for network cards's
>> Tx/Rx queues. Is there a generic way to retrieve all IRQ numbers for
>> those queues for each interface?
>>
>> My goal is to get all Tx/Rx queues for a given interface, get the IRQ
>> number of the individual queues, and set an affinity hint for each
>> queue. I have tried to loop over /proc/interrupts to retrieve all queues
>> for an interface in a hope that the last column would contain the
>> interface name however this does not work since the naming is not
>> unified across drivers. My second attempt was to retrieve all registered
>> interrupts by network interface from
>> /sys/class/net/{interface_name}/device/msi_irqs/, but this attempt was
>> also without luck because some drivers request more IRQs than the number
>> of queues (for example i40e driver).
>
> We do have an API for that
> https://docs.kernel.org/next/networking/netlink_spec/netdev.html#napi
> but unfortunately the driver needs to support it, and i40e currently
> doesn't:
Thank you for the link, I somehow missed that part of netlink…
> $ git grep --files-with-matches netif_napi_set_irq
> drivers/net/ethernet/amazon/ena/ena_netdev.c
> drivers/net/ethernet/broadcom/bnxt/bnxt.c
> drivers/net/ethernet/broadcom/tg3.c
> drivers/net/ethernet/google/gve/gve_utils.c
> drivers/net/ethernet/intel/e1000/e1000_main.c
> drivers/net/ethernet/intel/e1000e/netdev.c
> drivers/net/ethernet/intel/ice/ice_lib.c
> drivers/net/ethernet/intel/igc/igc_main.c
> drivers/net/ethernet/mellanox/mlx4/en_cq.c
> drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
>
> Should be easy to add. Let me CC the Intel list in case they already
> have a relevant change queued for i40e..
Thank you for directions, will check Intel's mailing list and poke
around with implementing that.
Daniel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Question] Generic way to retrieve IRQ number of Tx/Rx queue
2025-01-14 8:32 ` Daniel Sedlak
@ 2025-01-14 23:26 ` Joe Damato
0 siblings, 0 replies; 5+ messages in thread
From: Joe Damato @ 2025-01-14 23:26 UTC (permalink / raw)
To: Daniel Sedlak; +Cc: Jakub Kicinski, linux-kernel, netdev, intel-wired-lan
On Tue, Jan 14, 2025 at 09:32:26AM +0100, Daniel Sedlak wrote:
>
>
> On 1/13/25 10:15 PM, Jakub Kicinski wrote:
> >
> > We do have an API for that
> > https://docs.kernel.org/next/networking/netlink_spec/netdev.html#napi
> > but unfortunately the driver needs to support it, and i40e currently
> > doesn't:
>
> Thank you for the link, I somehow missed that part of netlink...
>
> > $ git grep --files-with-matches netif_napi_set_irq
> > drivers/net/ethernet/amazon/ena/ena_netdev.c
> > drivers/net/ethernet/broadcom/bnxt/bnxt.c
> > drivers/net/ethernet/broadcom/tg3.c
> > drivers/net/ethernet/google/gve/gve_utils.c
> > drivers/net/ethernet/intel/e1000/e1000_main.c
> > drivers/net/ethernet/intel/e1000e/netdev.c
> > drivers/net/ethernet/intel/ice/ice_lib.c
> > drivers/net/ethernet/intel/igc/igc_main.c
> > drivers/net/ethernet/mellanox/mlx4/en_cq.c
> > drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> > drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
> >
> > Should be easy to add. Let me CC the Intel list in case they already
> > have a relevant change queued for i40e..
>
> Thank you for directions, will check Intel's mailing list and poke around
> with implementing that.
I previously tried to add support for this API to i40e [1], but got
pulled into other stuff and never picked it back up. Wanted to
mention it in case it is useful for you.
[1]: https://lore.kernel.org/lkml/20240410043936.206169-1-jdamato@fastly.com/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-01-14 23:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-10 9:07 [Question] Generic way to retrieve IRQ number of Tx/Rx queue Daniel Sedlak
2025-01-10 17:38 ` Stephen Hemminger
2025-01-13 21:15 ` Jakub Kicinski
2025-01-14 8:32 ` Daniel Sedlak
2025-01-14 23:26 ` Joe Damato
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).