* [PATCH 0/4] drivers/net/ethernet: replace __get_free_pages() with kmalloc()
@ 2026-07-01 13:57 Mike Rapoport (Microsoft)
2026-07-01 13:57 ` [PATCH 1/4] bnx2x: use kzalloc() to allocate mac filtering list Mike Rapoport (Microsoft)
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Mike Rapoport (Microsoft) @ 2026-07-01 13:57 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Manish Chopra, Paolo Abeni
Cc: Edward Cree, Przemek Kitszel, Sudarsana Kalluru, Tony Nguyen,
Mike Rapoport, intel-wired-lan, linux-kernel, linux-mm,
linux-net-drivers, netdev
This is a (small) part of larger work of replacing page allocator calls
with kmalloc.
My initial intention a few month ago was to remove ugly casts [1], but then
willy pointed out that Linus objected to something like this [2] and it
looks like more than a decade old technical debt.
Largely, anything that doesn't need struct page (or a memdesc in the
future) should just use kmalloc() or kvmalloc() to allocate memory.
kmalloc() guarantees alignment, physical contiguity and working
virt_to_phys() and beside nicer API that returns void * on alloc and
doesn't require to know the allocation size on free, kmalloc() provides
better debugging capabilities than page allocator.
Another thing is that touching these allocation sites gives the reviewers
opportunity to see if a PAGE_SIZE buffer is actually needed or maybe
another size is appropriate.
For larger allocations that don't need physically contiguous memory
kvmalloc() can be a better option that __get_free_pages() because under
memory pressure it's is easier to allocate several order-0 pages than a
physically contiguous chunk with the same number of pages.
And last, but not least, removing needless calls to page allocator should
help with memdesc (aka project folio) conversion. There will be way less
places to audit to see if the user was actually using struct page.
Also in git:
https://git.kernel.org/pub/scm/linux/kernel/git/rppt/linux.git gfp-to-kmalloc/drivers-net-ethernet
[1] https://lore.kernel.org/all/20251018093002.3660549-1-rppt@kernel.org/
[2] https://lore.kernel.org/all/CA+55aFwp4iy4rtX2gE2WjBGFL=NxMVnoFeHqYa2j1dYOMMGqxg@mail.gmail.com/
---
v2 changes:
- split out ethernet drivers from a larger set
v1: https://patch.msgid.link/20260630-b4-drivers-net-v1-0-672162a91f37@kernel.org
---
Mike Rapoport (Microsoft) (4):
bnx2x: use kzalloc() to allocate mac filtering list
ice: use kzalloc() to allocate staging buffer for reading from GNSS
sfc/siena: use kmalloc() to allocate logging buffer
sfc: use kmalloc() to allocate logging buffer
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c | 6 +++---
drivers/net/ethernet/intel/ice/ice_gnss.c | 5 +++--
drivers/net/ethernet/sfc/mcdi.c | 7 ++++---
drivers/net/ethernet/sfc/siena/mcdi.c | 7 ++++---
4 files changed, 14 insertions(+), 11 deletions(-)
---
base-commit: dc59e4fea9d83f03bad6bddf3fa2e52491777482
change-id: 20260630-b4-drivers-ethernet-b5e085b98ab1
Best regards,
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/4] bnx2x: use kzalloc() to allocate mac filtering list
2026-07-01 13:57 [PATCH 0/4] drivers/net/ethernet: replace __get_free_pages() with kmalloc() Mike Rapoport (Microsoft)
@ 2026-07-01 13:57 ` Mike Rapoport (Microsoft)
2026-07-01 13:57 ` [PATCH 2/4] ice: use kzalloc() to allocate staging buffer for reading from GNSS Mike Rapoport (Microsoft)
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Mike Rapoport (Microsoft) @ 2026-07-01 13:57 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Manish Chopra, Paolo Abeni
Cc: Edward Cree, Przemek Kitszel, Sudarsana Kalluru, Tony Nguyen,
Mike Rapoport, intel-wired-lan, linux-kernel, linux-mm,
linux-net-drivers, netdev
bnx2x_mcast_enqueue_cmd() allocates memory for mac filtering list using
__get_free_pages().
This memory can be allocated with kzalloc() as there's nothing special
about it to go directly to the page allocator.
kmalloc() provides a better API that does not require ugly casts and
kfree() does not need to know the size of the freed object.
Performance difference between kmalloc() and __get_free_pages() is not
measurable as both allocators take an object/page from a per-CPU list for
fast path allocations.
For the slow path the performance is anyway determined by the amount of
reclaim involved rather than by what allocator is used.
Replace use of __get_free_page() with kzalloc() and free_page() with
kfree().
Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
index 07a908a2c72f..d560524d317d 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
@@ -26,6 +26,7 @@
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/crc32c.h>
+#include <linux/slab.h>
#include "bnx2x.h"
#include "bnx2x_cmn.h"
#include "bnx2x_sp.h"
@@ -2664,7 +2665,7 @@ static void bnx2x_free_groups(struct list_head *mcast_group_list)
struct bnx2x_mcast_elem_group,
mcast_group_link);
list_del(¤t_mcast_group->mcast_group_link);
- free_page((unsigned long)current_mcast_group);
+ kfree(current_mcast_group);
}
}
@@ -2713,8 +2714,7 @@ static int bnx2x_mcast_enqueue_cmd(struct bnx2x *bp,
total_elems = BNX2X_MCAST_BINS_NUM;
}
while (total_elems > 0) {
- elem_group = (struct bnx2x_mcast_elem_group *)
- __get_free_page(GFP_ATOMIC | __GFP_ZERO);
+ elem_group = kzalloc(PAGE_SIZE, GFP_ATOMIC);
if (!elem_group) {
bnx2x_free_groups(&new_cmd->group_head);
kfree(new_cmd);
--
2.53.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/4] ice: use kzalloc() to allocate staging buffer for reading from GNSS
2026-07-01 13:57 [PATCH 0/4] drivers/net/ethernet: replace __get_free_pages() with kmalloc() Mike Rapoport (Microsoft)
2026-07-01 13:57 ` [PATCH 1/4] bnx2x: use kzalloc() to allocate mac filtering list Mike Rapoport (Microsoft)
@ 2026-07-01 13:57 ` Mike Rapoport (Microsoft)
2026-07-01 13:57 ` [PATCH 3/4] sfc/siena: use kmalloc() to allocate logging buffer Mike Rapoport (Microsoft)
2026-07-01 13:57 ` [PATCH 4/4] sfc: " Mike Rapoport (Microsoft)
3 siblings, 0 replies; 7+ messages in thread
From: Mike Rapoport (Microsoft) @ 2026-07-01 13:57 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Manish Chopra, Paolo Abeni
Cc: Edward Cree, Przemek Kitszel, Sudarsana Kalluru, Tony Nguyen,
Mike Rapoport, intel-wired-lan, linux-kernel, linux-mm,
linux-net-drivers, netdev
ice_gnss_read() uses get_zeroed_page() to allocate a staging buffer for
reading GNSS module data via I2C bus.
This buffer can be allocated with kmalloc() as there's nothing special
about it to go directly to the page allocator.
kmalloc() provides a better API that does not require ugly casts and
kfree() does not need to know the size of the freed object.
Performance difference between kmalloc() and __get_free_pages() is not
measurable as both allocators take an object/page from a per-CPU list for
fast path allocations.
For the slow path the performance is anyway determined by the amount of
reclaim involved rather than by what allocator is used.
Replace use of get_zeroed_page() with kzalloc() and free_page() with
kfree().
Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
drivers/net/ethernet/intel/ice/ice_gnss.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_gnss.c b/drivers/net/ethernet/intel/ice/ice_gnss.c
index 8fd954f1ebd6..7d21c3417b0b 100644
--- a/drivers/net/ethernet/intel/ice/ice_gnss.c
+++ b/drivers/net/ethernet/intel/ice/ice_gnss.c
@@ -2,6 +2,7 @@
/* Copyright (C) 2021-2022, Intel Corporation. */
#include "ice.h"
+#include <linux/slab.h>
#include "ice_lib.h"
/**
@@ -124,7 +125,7 @@ static void ice_gnss_read(struct kthread_work *work)
data_len = min_t(typeof(data_len), data_len, PAGE_SIZE);
- buf = (char *)get_zeroed_page(GFP_KERNEL);
+ buf = kzalloc(PAGE_SIZE, GFP_KERNEL);
if (!buf) {
err = -ENOMEM;
goto requeue;
@@ -151,7 +152,7 @@ static void ice_gnss_read(struct kthread_work *work)
count, i);
delay = ICE_GNSS_TIMER_DELAY_TIME;
free_buf:
- free_page((unsigned long)buf);
+ kfree(buf);
requeue:
kthread_queue_delayed_work(gnss->kworker, &gnss->read_work, delay);
if (err)
--
2.53.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/4] sfc/siena: use kmalloc() to allocate logging buffer
2026-07-01 13:57 [PATCH 0/4] drivers/net/ethernet: replace __get_free_pages() with kmalloc() Mike Rapoport (Microsoft)
2026-07-01 13:57 ` [PATCH 1/4] bnx2x: use kzalloc() to allocate mac filtering list Mike Rapoport (Microsoft)
2026-07-01 13:57 ` [PATCH 2/4] ice: use kzalloc() to allocate staging buffer for reading from GNSS Mike Rapoport (Microsoft)
@ 2026-07-01 13:57 ` Mike Rapoport (Microsoft)
2026-07-01 17:01 ` Edward Cree
2026-07-01 13:57 ` [PATCH 4/4] sfc: " Mike Rapoport (Microsoft)
3 siblings, 1 reply; 7+ messages in thread
From: Mike Rapoport (Microsoft) @ 2026-07-01 13:57 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Manish Chopra, Paolo Abeni
Cc: Edward Cree, Przemek Kitszel, Sudarsana Kalluru, Tony Nguyen,
Mike Rapoport, intel-wired-lan, linux-kernel, linux-mm,
linux-net-drivers, netdev
efx_siena_mcdi_init() allocates a logging buffer for MCDI firmware
communication diagnostics.
This buffer can be allocated with kmalloc() as there's nothing special
about it to go directly to the page allocator.
kmalloc() provides a better API that does not require ugly casts and
kfree() does not need to know the size of the freed object.
Performance difference between kmalloc() and __get_free_pages() is not
measurable as both allocators take an object/page from a per-CPU list for
fast path allocations.
For the slow path the performance is anyway determined by the amount of
reclaim involved rather than by what allocator is used.
Replace use of __get_free_page() with kmalloc() and free_page() with
kfree().
Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
drivers/net/ethernet/sfc/siena/mcdi.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/sfc/siena/mcdi.c b/drivers/net/ethernet/sfc/siena/mcdi.c
index 4d0d6bd5d3d1..048c1e6017c0 100644
--- a/drivers/net/ethernet/sfc/siena/mcdi.c
+++ b/drivers/net/ethernet/sfc/siena/mcdi.c
@@ -7,6 +7,7 @@
#include <linux/delay.h>
#include <linux/moduleparam.h>
#include <linux/atomic.h>
+#include <linux/slab.h>
#include "net_driver.h"
#include "nic.h"
#include "io.h"
@@ -73,7 +74,7 @@ int efx_siena_mcdi_init(struct efx_nic *efx)
mcdi->efx = efx;
#ifdef CONFIG_SFC_SIENA_MCDI_LOGGING
/* consuming code assumes buffer is page-sized */
- mcdi->logging_buffer = (char *)__get_free_page(GFP_KERNEL);
+ mcdi->logging_buffer = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (!mcdi->logging_buffer)
goto fail1;
mcdi->logging_enabled = efx_siena_mcdi_logging_default;
@@ -116,7 +117,7 @@ int efx_siena_mcdi_init(struct efx_nic *efx)
return 0;
fail2:
#ifdef CONFIG_SFC_SIENA_MCDI_LOGGING
- free_page((unsigned long)mcdi->logging_buffer);
+ kfree(mcdi->logging_buffer);
fail1:
#endif
kfree(efx->mcdi);
@@ -142,7 +143,7 @@ void efx_siena_mcdi_fini(struct efx_nic *efx)
return;
#ifdef CONFIG_SFC_SIENA_MCDI_LOGGING
- free_page((unsigned long)efx->mcdi->iface.logging_buffer);
+ kfree(efx->mcdi->iface.logging_buffer);
#endif
kfree(efx->mcdi);
--
2.53.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/4] sfc: use kmalloc() to allocate logging buffer
2026-07-01 13:57 [PATCH 0/4] drivers/net/ethernet: replace __get_free_pages() with kmalloc() Mike Rapoport (Microsoft)
` (2 preceding siblings ...)
2026-07-01 13:57 ` [PATCH 3/4] sfc/siena: use kmalloc() to allocate logging buffer Mike Rapoport (Microsoft)
@ 2026-07-01 13:57 ` Mike Rapoport (Microsoft)
2026-07-01 16:59 ` Edward Cree
3 siblings, 1 reply; 7+ messages in thread
From: Mike Rapoport (Microsoft) @ 2026-07-01 13:57 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Manish Chopra, Paolo Abeni
Cc: Edward Cree, Przemek Kitszel, Sudarsana Kalluru, Tony Nguyen,
Mike Rapoport, intel-wired-lan, linux-kernel, linux-mm,
linux-net-drivers, netdev
efx_mcdi_init() allocates a logging buffer for MCDI firmware
communication diagnostics.
This buffer can be allocated with kmalloc() as there's nothing special
about it to go directly to the page allocator.
kmalloc() provides a better API that does not require ugly casts and
kfree() does not need to know the size of the freed object.
Performance difference between kmalloc() and __get_free_pages() is not
measurable as both allocators take an object/page from a per-CPU list for
fast path allocations.
For the slow path the performance is anyway determined by the amount of
reclaim involved rather than by what allocator is used.
Replace use of __get_free_page() with kmalloc() and free_page() with
kfree().
Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
drivers/net/ethernet/sfc/mcdi.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/sfc/mcdi.c b/drivers/net/ethernet/sfc/mcdi.c
index e65db9b70724..b806d3d90c42 100644
--- a/drivers/net/ethernet/sfc/mcdi.c
+++ b/drivers/net/ethernet/sfc/mcdi.c
@@ -7,6 +7,7 @@
#include <linux/delay.h>
#include <linux/moduleparam.h>
#include <linux/atomic.h>
+#include <linux/slab.h>
#include "net_driver.h"
#include "nic.h"
#include "io.h"
@@ -71,7 +72,7 @@ int efx_mcdi_init(struct efx_nic *efx)
mcdi->efx = efx;
#ifdef CONFIG_SFC_MCDI_LOGGING
/* consuming code assumes buffer is page-sized */
- mcdi->logging_buffer = (char *)__get_free_page(GFP_KERNEL);
+ mcdi->logging_buffer = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (!mcdi->logging_buffer)
goto fail1;
mcdi->logging_enabled = mcdi_logging_default;
@@ -112,7 +113,7 @@ int efx_mcdi_init(struct efx_nic *efx)
return 0;
fail2:
#ifdef CONFIG_SFC_MCDI_LOGGING
- free_page((unsigned long)mcdi->logging_buffer);
+ kfree(mcdi->logging_buffer);
fail1:
#endif
kfree(efx->mcdi);
@@ -138,7 +139,7 @@ void efx_mcdi_fini(struct efx_nic *efx)
return;
#ifdef CONFIG_SFC_MCDI_LOGGING
- free_page((unsigned long)efx->mcdi->iface.logging_buffer);
+ kfree(efx->mcdi->iface.logging_buffer);
#endif
kfree(efx->mcdi);
--
2.53.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 4/4] sfc: use kmalloc() to allocate logging buffer
2026-07-01 13:57 ` [PATCH 4/4] sfc: " Mike Rapoport (Microsoft)
@ 2026-07-01 16:59 ` Edward Cree
0 siblings, 0 replies; 7+ messages in thread
From: Edward Cree @ 2026-07-01 16:59 UTC (permalink / raw)
To: Mike Rapoport (Microsoft), Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Manish Chopra, Paolo Abeni
Cc: Przemek Kitszel, Sudarsana Kalluru, Tony Nguyen, intel-wired-lan,
linux-kernel, linux-mm, linux-net-drivers, netdev
On 01/07/2026 14:57, Mike Rapoport (Microsoft) wrote:
> efx_mcdi_init() allocates a logging buffer for MCDI firmware
> communication diagnostics.
>
> This buffer can be allocated with kmalloc() as there's nothing special
> about it to go directly to the page allocator.
>
> kmalloc() provides a better API that does not require ugly casts and
> kfree() does not need to know the size of the freed object.
>
> Performance difference between kmalloc() and __get_free_pages() is not
> measurable as both allocators take an object/page from a per-CPU list for
> fast path allocations.
>
> For the slow path the performance is anyway determined by the amount of
> reclaim involved rather than by what allocator is used.
>
> Replace use of __get_free_page() with kmalloc() and free_page() with
> kfree().
>
> Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
> Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Reviewed-by: Edward Cree <ecree.xilinx@gmail.com>
> ---
> drivers/net/ethernet/sfc/mcdi.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/sfc/mcdi.c b/drivers/net/ethernet/sfc/mcdi.c
> index e65db9b70724..b806d3d90c42 100644
> --- a/drivers/net/ethernet/sfc/mcdi.c
> +++ b/drivers/net/ethernet/sfc/mcdi.c
> @@ -7,6 +7,7 @@
> #include <linux/delay.h>
> #include <linux/moduleparam.h>
> #include <linux/atomic.h>
> +#include <linux/slab.h>
> #include "net_driver.h"
> #include "nic.h"
> #include "io.h"
> @@ -71,7 +72,7 @@ int efx_mcdi_init(struct efx_nic *efx)
> mcdi->efx = efx;
> #ifdef CONFIG_SFC_MCDI_LOGGING
> /* consuming code assumes buffer is page-sized */
> - mcdi->logging_buffer = (char *)__get_free_page(GFP_KERNEL);
> + mcdi->logging_buffer = kmalloc(PAGE_SIZE, GFP_KERNEL);
> if (!mcdi->logging_buffer)
> goto fail1;
> mcdi->logging_enabled = mcdi_logging_default;
> @@ -112,7 +113,7 @@ int efx_mcdi_init(struct efx_nic *efx)
> return 0;
> fail2:
> #ifdef CONFIG_SFC_MCDI_LOGGING
> - free_page((unsigned long)mcdi->logging_buffer);
> + kfree(mcdi->logging_buffer);
> fail1:
> #endif
> kfree(efx->mcdi);
> @@ -138,7 +139,7 @@ void efx_mcdi_fini(struct efx_nic *efx)
> return;
>
> #ifdef CONFIG_SFC_MCDI_LOGGING
> - free_page((unsigned long)efx->mcdi->iface.logging_buffer);
> + kfree(efx->mcdi->iface.logging_buffer);
> #endif
>
> kfree(efx->mcdi);
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/4] sfc/siena: use kmalloc() to allocate logging buffer
2026-07-01 13:57 ` [PATCH 3/4] sfc/siena: use kmalloc() to allocate logging buffer Mike Rapoport (Microsoft)
@ 2026-07-01 17:01 ` Edward Cree
0 siblings, 0 replies; 7+ messages in thread
From: Edward Cree @ 2026-07-01 17:01 UTC (permalink / raw)
To: Mike Rapoport (Microsoft), Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Manish Chopra, Paolo Abeni
Cc: Przemek Kitszel, Sudarsana Kalluru, Tony Nguyen, intel-wired-lan,
linux-kernel, linux-mm, linux-net-drivers, netdev
On 01/07/2026 14:57, Mike Rapoport (Microsoft) wrote:
> efx_siena_mcdi_init() allocates a logging buffer for MCDI firmware
> communication diagnostics.
>
> This buffer can be allocated with kmalloc() as there's nothing special
> about it to go directly to the page allocator.
>
> kmalloc() provides a better API that does not require ugly casts and
> kfree() does not need to know the size of the freed object.
>
> Performance difference between kmalloc() and __get_free_pages() is not
> measurable as both allocators take an object/page from a per-CPU list for
> fast path allocations.
>
> For the slow path the performance is anyway determined by the amount of
> reclaim involved rather than by what allocator is used.
>
> Replace use of __get_free_page() with kmalloc() and free_page() with
> kfree().
>
> Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
> Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Reviewed-by: Edward Cree <ecree.xilinx@gmail.com>
(resending since I hit 'reply' instead of 'reply all' the first time)
> ---
> drivers/net/ethernet/sfc/siena/mcdi.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/sfc/siena/mcdi.c b/drivers/net/ethernet/sfc/siena/mcdi.c
> index 4d0d6bd5d3d1..048c1e6017c0 100644
> --- a/drivers/net/ethernet/sfc/siena/mcdi.c
> +++ b/drivers/net/ethernet/sfc/siena/mcdi.c
> @@ -7,6 +7,7 @@
> #include <linux/delay.h>
> #include <linux/moduleparam.h>
> #include <linux/atomic.h>
> +#include <linux/slab.h>
> #include "net_driver.h"
> #include "nic.h"
> #include "io.h"
> @@ -73,7 +74,7 @@ int efx_siena_mcdi_init(struct efx_nic *efx)
> mcdi->efx = efx;
> #ifdef CONFIG_SFC_SIENA_MCDI_LOGGING
> /* consuming code assumes buffer is page-sized */
> - mcdi->logging_buffer = (char *)__get_free_page(GFP_KERNEL);
> + mcdi->logging_buffer = kmalloc(PAGE_SIZE, GFP_KERNEL);
> if (!mcdi->logging_buffer)
> goto fail1;
> mcdi->logging_enabled = efx_siena_mcdi_logging_default;
> @@ -116,7 +117,7 @@ int efx_siena_mcdi_init(struct efx_nic *efx)
> return 0;
> fail2:
> #ifdef CONFIG_SFC_SIENA_MCDI_LOGGING
> - free_page((unsigned long)mcdi->logging_buffer);
> + kfree(mcdi->logging_buffer);
> fail1:
> #endif
> kfree(efx->mcdi);
> @@ -142,7 +143,7 @@ void efx_siena_mcdi_fini(struct efx_nic *efx)
> return;
>
> #ifdef CONFIG_SFC_SIENA_MCDI_LOGGING
> - free_page((unsigned long)efx->mcdi->iface.logging_buffer);
> + kfree(efx->mcdi->iface.logging_buffer);
> #endif
>
> kfree(efx->mcdi);
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-07-01 17:01 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-01 13:57 [PATCH 0/4] drivers/net/ethernet: replace __get_free_pages() with kmalloc() Mike Rapoport (Microsoft)
2026-07-01 13:57 ` [PATCH 1/4] bnx2x: use kzalloc() to allocate mac filtering list Mike Rapoport (Microsoft)
2026-07-01 13:57 ` [PATCH 2/4] ice: use kzalloc() to allocate staging buffer for reading from GNSS Mike Rapoport (Microsoft)
2026-07-01 13:57 ` [PATCH 3/4] sfc/siena: use kmalloc() to allocate logging buffer Mike Rapoport (Microsoft)
2026-07-01 17:01 ` Edward Cree
2026-07-01 13:57 ` [PATCH 4/4] sfc: " Mike Rapoport (Microsoft)
2026-07-01 16:59 ` Edward Cree
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox