[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f17ed43b-7329-5566-a75e-befebd20d032@intel.com>
Date: Tue, 26 Sep 2023 21:57:50 +0200
From: Przemek Kitszel <przemyslaw.kitszel@...el.com>
To: Ivan Vecera <ivecera@...hat.com>, <netdev@...r.kernel.org>
CC: <poros@...hat.com>, <mschmidt@...hat.com>, <jesse.brandeburg@...el.com>,
<anthony.l.nguyen@...el.com>, <davem@...emloft.net>, <kuba@...nel.org>,
<edumazet@...gle.com>, <pabeni@...hat.com>,
<intel-wired-lan@...ts.osuosl.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net-next 7/9] i40e: Move memory allocation structures to
i40e_alloc.h
On 9/26/23 20:27, Ivan Vecera wrote:
> Structures i40e_dma_mem & i40e_virt_mem are defined i40e_osdep.h while
> memory allocation functions that use them are declared in i40e_alloc.h
> Move them to i40e_alloc.h and remove this header file dependency on
> i40e_osdep.h header.
>
> Due to removal of this dependency we have to include i40e_osdep.h in files
> that requires it.
>
> Signed-off-by: Ivan Vecera <ivecera@...hat.com>
> ---
> drivers/net/ethernet/intel/i40e/i40e_adminq.c | 1 +
> drivers/net/ethernet/intel/i40e/i40e_adminq.h | 2 +-
> drivers/net/ethernet/intel/i40e/i40e_alloc.h | 21 ++++++++++++++++++-
> drivers/net/ethernet/intel/i40e/i40e_common.c | 1 +
> drivers/net/ethernet/intel/i40e/i40e_dcb.c | 1 +
> drivers/net/ethernet/intel/i40e/i40e_diag.c | 1 +
> drivers/net/ethernet/intel/i40e/i40e_hmc.c | 1 +
> drivers/net/ethernet/intel/i40e/i40e_hmc.h | 2 +-
> .../net/ethernet/intel/i40e/i40e_lan_hmc.c | 1 +
> drivers/net/ethernet/intel/i40e/i40e_nvm.c | 1 +
> drivers/net/ethernet/intel/i40e/i40e_osdep.h | 19 -----------------
> 11 files changed, 29 insertions(+), 22 deletions(-)
I very much like this series, but extending i40e_osdep.h usage asks for
comment ;) - please try to reorder patches to have less dependency on it
first, and afterwards do split
(IOW first remove&reduce, then split what's left)
(disclaimer: I have not double checked if that's possible)
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq.c b/drivers/net/ethernet/intel/i40e/i40e_adminq.c
> index 088ef4696818..bf4de913435e 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_adminq.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_adminq.c
> @@ -3,6 +3,7 @@
>
> #include <linux/delay.h>
> #include "i40e_alloc.h"
> +#include "i40e_osdep.h"
> #include "i40e_register.h"
> #include "i40e_prototype.h"
>
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq.h b/drivers/net/ethernet/intel/i40e/i40e_adminq.h
> index 95c902700f63..2c0341469122 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_adminq.h
> +++ b/drivers/net/ethernet/intel/i40e/i40e_adminq.h
> @@ -6,7 +6,7 @@
>
> #include <linux/mutex.h>
> #include "i40e_adminq_cmd.h"
> -#include "i40e_osdep.h"
> +#include "i40e_alloc.h"
>
> #define I40E_ADMINQ_DESC(R, i) \
> (&(((struct i40e_aq_desc *)((R).desc_buf.va))[i]))
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_alloc.h b/drivers/net/ethernet/intel/i40e/i40e_alloc.h
> index 5d9a0b56133e..e0186495ef02 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_alloc.h
> +++ b/drivers/net/ethernet/intel/i40e/i40e_alloc.h
> @@ -4,7 +4,7 @@
> #ifndef _I40E_ALLOC_H_
> #define _I40E_ALLOC_H_
>
> -#include "i40e_osdep.h"
> +#include <linux/types.h>
>
> struct i40e_hw;
>
> @@ -21,6 +21,25 @@ enum i40e_memory_type {
> i40e_mem_reserved
> };
>
> +/* memory allocation tracking */
> +struct i40e_dma_mem {
> + void *va;
> + dma_addr_t pa;
> + u32 size;
> +};
> +
> +struct i40e_virt_mem {
> + void *va;
> + u32 size;
> +};
> +
> +#define i40e_allocate_dma_mem(h, m, unused, s, a) \
> + i40e_allocate_dma_mem_d(h, m, s, a)
> +#define i40e_free_dma_mem(h, m) i40e_free_dma_mem_d(h, m)
> +
> +#define i40e_allocate_virt_mem(h, m, s) i40e_allocate_virt_mem_d(h, m, s)
> +#define i40e_free_virt_mem(h, m) i40e_free_virt_mem_d(h, m)
> +
> /* prototype for functions used for dynamic memory allocation */
> int i40e_allocate_dma_mem(struct i40e_hw *hw,
> struct i40e_dma_mem *mem,
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c b/drivers/net/ethernet/intel/i40e/i40e_common.c
> index 6d1042ca0317..8fb8f9e5c5d7 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_common.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_common.c
> @@ -7,6 +7,7 @@
> #include <linux/pci.h>
> #include "i40e_adminq_cmd.h"
> #include "i40e_devids.h"
> +#include "i40e_osdep.h"
> #include "i40e_prototype.h"
> #include "i40e_register.h"
>
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_dcb.c b/drivers/net/ethernet/intel/i40e/i40e_dcb.c
> index 68602fc375f6..7d51e58d94bd 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_dcb.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_dcb.c
> @@ -3,6 +3,7 @@
>
> #include "i40e_alloc.h"
> #include "i40e_dcb.h"
> +#include "i40e_osdep.h"
> #include "i40e_prototype.h"
>
> /**
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_diag.c b/drivers/net/ethernet/intel/i40e/i40e_diag.c
> index b1ad7c4259b9..824f97931f57 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_diag.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_diag.c
> @@ -2,6 +2,7 @@
> /* Copyright(c) 2013 - 2018 Intel Corporation. */
>
> #include "i40e_diag.h"
> +#include "i40e_osdep.h"
> #include "i40e_prototype.h"
>
> /**
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_hmc.c b/drivers/net/ethernet/intel/i40e/i40e_hmc.c
> index 0bc398757283..74b3a5b0bc4a 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_hmc.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_hmc.c
> @@ -3,6 +3,7 @@
>
> #include "i40e_alloc.h"
> #include "i40e_hmc.h"
> +#include "i40e_osdep.h"
> #include "i40e_type.h"
>
> /**
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_hmc.h b/drivers/net/ethernet/intel/i40e/i40e_hmc.h
> index 76610455cb90..78e6e9144331 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_hmc.h
> +++ b/drivers/net/ethernet/intel/i40e/i40e_hmc.h
> @@ -4,7 +4,7 @@
> #ifndef _I40E_HMC_H_
> #define _I40E_HMC_H_
>
> -#include "i40e_osdep.h"
> +#include "i40e_alloc.h"
> #include "i40e_register.h"
>
> #define I40E_HMC_MAX_BP_COUNT 512
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_lan_hmc.c b/drivers/net/ethernet/intel/i40e/i40e_lan_hmc.c
> index 6f40c640e310..08f0c90acd9a 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_lan_hmc.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_lan_hmc.c
> @@ -4,6 +4,7 @@
> #include "i40e_alloc.h"
> #include "i40e_type.h"
> #include "i40e_lan_hmc.h"
> +#include "i40e_osdep.h"
>
> /* lan specific interface functions */
>
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_nvm.c b/drivers/net/ethernet/intel/i40e/i40e_nvm.c
> index 77cdbfc19d47..2e8d2dd4b920 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_nvm.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_nvm.c
> @@ -3,6 +3,7 @@
>
> #include <linux/delay.h>
> #include "i40e_alloc.h"
> +#include "i40e_osdep.h"
> #include "i40e_prototype.h"
>
> /**
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_osdep.h b/drivers/net/ethernet/intel/i40e/i40e_osdep.h
> index 23be11a45761..f4f02dd722ba 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_osdep.h
> +++ b/drivers/net/ethernet/intel/i40e/i40e_osdep.h
> @@ -28,25 +28,6 @@ do { \
> #define rd64(a, reg) readq((a)->hw_addr + (reg))
> #define i40e_flush(a) readl((a)->hw_addr + I40E_GLGEN_STAT)
>
> -/* memory allocation tracking */
> -struct i40e_dma_mem {
> - void *va;
> - dma_addr_t pa;
> - u32 size;
> -};
> -
> -#define i40e_allocate_dma_mem(h, m, unused, s, a) \
> - i40e_allocate_dma_mem_d(h, m, s, a)
> -#define i40e_free_dma_mem(h, m) i40e_free_dma_mem_d(h, m)
> -
> -struct i40e_virt_mem {
> - void *va;
> - u32 size;
> -};
> -
> -#define i40e_allocate_virt_mem(h, m, s) i40e_allocate_virt_mem_d(h, m, s)
> -#define i40e_free_virt_mem(h, m) i40e_free_virt_mem_d(h, m)
> -
> #define i40e_debug(h, m, s, ...) \
> do { \
> if (((m) & (h)->debug_mask)) \
Powered by blists - more mailing lists