Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'gve-link-irqs-queues-and-napi-instances'

Joe Damato says:

====================
gve: Link IRQs, queues, and NAPI instances

This series uses the netdev-genl API to link IRQs and queues to NAPI IDs
so that this information is queryable by user apps. This is particularly
useful for epoll-based busy polling apps which rely on having access to
the NAPI ID.

I've tested these commits on a GCP instance with a GVE NIC configured
and have included test output in the commit messages for each patch
showing how to query the information.

[1]: https://lore.kernel.org/netdev/20240926030025.226221-1-jdamato@fastly.com/
====================

Link: https://patch.msgid.link/20240930210731.1629-1-jdamato@fastly.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+18
+17
drivers/net/ethernet/google/gve/gve_main.c
··· 1875 1875 1876 1876 if (!gve_tx_was_added_to_block(priv, idx)) 1877 1877 continue; 1878 + 1879 + if (idx < priv->tx_cfg.num_queues) 1880 + netif_queue_set_napi(priv->dev, idx, 1881 + NETDEV_QUEUE_TYPE_TX, NULL); 1882 + 1878 1883 napi_disable(&block->napi); 1879 1884 } 1880 1885 for (idx = 0; idx < priv->rx_cfg.num_queues; idx++) { ··· 1888 1883 1889 1884 if (!gve_rx_was_added_to_block(priv, idx)) 1890 1885 continue; 1886 + 1887 + netif_queue_set_napi(priv->dev, idx, NETDEV_QUEUE_TYPE_RX, 1888 + NULL); 1891 1889 napi_disable(&block->napi); 1892 1890 } 1893 1891 ··· 1917 1909 continue; 1918 1910 1919 1911 napi_enable(&block->napi); 1912 + 1913 + if (idx < priv->tx_cfg.num_queues) 1914 + netif_queue_set_napi(priv->dev, idx, 1915 + NETDEV_QUEUE_TYPE_TX, 1916 + &block->napi); 1917 + 1920 1918 if (gve_is_gqi(priv)) { 1921 1919 iowrite32be(0, gve_irq_doorbell(priv, block)); 1922 1920 } else { ··· 1945 1931 continue; 1946 1932 1947 1933 napi_enable(&block->napi); 1934 + netif_queue_set_napi(priv->dev, idx, NETDEV_QUEUE_TYPE_RX, 1935 + &block->napi); 1936 + 1948 1937 if (gve_is_gqi(priv)) { 1949 1938 iowrite32be(0, gve_irq_doorbell(priv, block)); 1950 1939 } else {
+1
drivers/net/ethernet/google/gve/gve_utils.c
··· 111 111 struct gve_notify_block *block = &priv->ntfy_blocks[ntfy_idx]; 112 112 113 113 netif_napi_add(priv->dev, &block->napi, gve_poll); 114 + netif_napi_set_irq(&block->napi, block->irq); 114 115 } 115 116 116 117 void gve_remove_napi(struct gve_priv *priv, int ntfy_idx)