[PATCH net-next] memory-provider: fix compilation issue without SYSFS
From: Matthieu Baerts (NGI0)
Date: Thu Sep 12 2024 - 06:25:55 EST
When CONFIG_SYSFS is not set, the kernel fails to compile:
net/core/page_pool_user.c:368:45: error: implicit declaration of function 'get_netdev_rx_queue_index' [-Werror=implicit-function-declaration]
368 | if (pool->slow.queue_idx == get_netdev_rx_queue_index(rxq)) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~
When CONFIG_SYSFS is not set, get_netdev_rx_queue_index() is not defined
as well. In this case, page_pool_check_memory_provider() cannot check
the memory provider, and a success answer can be returned instead.
Fixes: 0f9214046893 ("memory-provider: dmabuf devmem memory provider")
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@xxxxxxxxxx>
---
net/core/page_pool_user.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/core/page_pool_user.c b/net/core/page_pool_user.c
index 48335766c1bf..a98c0a76b33f 100644
--- a/net/core/page_pool_user.c
+++ b/net/core/page_pool_user.c
@@ -353,6 +353,7 @@ void page_pool_unlist(struct page_pool *pool)
int page_pool_check_memory_provider(struct net_device *dev,
struct netdev_rx_queue *rxq)
{
+#ifdef CONFIG_SYSFS
struct net_devmem_dmabuf_binding *binding = rxq->mp_params.mp_priv;
struct page_pool *pool;
struct hlist_node *n;
@@ -372,6 +373,9 @@ int page_pool_check_memory_provider(struct net_device *dev,
}
mutex_unlock(&page_pools_lock);
return -ENODATA;
+#else
+ return 0;
+#endif
}
static void page_pool_unreg_netdev_wipe(struct net_device *netdev)
---
base-commit: 3cfb5aa10cb78571e214e48a3a6e42c11d5288a1
change-id: 20240912-net-next-fix-get_netdev_rx_queue_index-a1034d1b962a
Best regards,
--
Matthieu Baerts (NGI0) <matttbe@xxxxxxxxxx>