On Wed, Oct 26, 2022 at 10:44 AM Junfeng Guo <junfeng....@intel.com> wrote:
>
> Meson build may fail on FreeBSD with gcc and clang, due to missing
> the header file linux/pci_regs.h on non-Linux platform. Thus, in
> this patch, we removed the file include and added the used Macros
> derived from linux/pci_regs.h.
>
> Fixes: 3047a5ac8e66 ("net/gve: add support for device initialization")
> Cc: sta...@dpdk.org

...
No need for Cc: stable.


>
> Signed-off-by: Junfeng Guo <junfeng....@intel.com>
> ---
>  drivers/net/gve/gve_ethdev.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/gve/gve_ethdev.c b/drivers/net/gve/gve_ethdev.c
> index b0f7b98daa..e968317737 100644
> --- a/drivers/net/gve/gve_ethdev.c
> +++ b/drivers/net/gve/gve_ethdev.c
> @@ -1,12 +1,24 @@
>  /* SPDX-License-Identifier: BSD-3-Clause
>   * Copyright(C) 2022 Intel Corporation
>   */
> -#include <linux/pci_regs.h>
>
>  #include "gve_ethdev.h"
>  #include "base/gve_adminq.h"
>  #include "base/gve_register.h"
>
> +/*
> + * Following macros are derived from linux/pci_regs.h, however,
> + * we can't simply include that header here, as there is no such
> + * file for non-Linux platform.
> + */
> +#define PCI_CFG_SPACE_SIZE     256
> +#define PCI_CAPABILITY_LIST    0x34    /* Offset of first capability list 
> entry */
> +#define PCI_STD_HEADER_SIZEOF  64
> +#define PCI_CAP_SIZEOF         4
> +#define PCI_CAP_ID_MSIX                0x11    /* MSI-X */
> +#define PCI_MSIX_FLAGS         2       /* Message Control */
> +#define PCI_MSIX_FLAGS_QSIZE   0x07FF  /* Table size */

No, don't introduce such defines in a driver.
We have a PCI library, that provides some defines.
So fix your driver to use them.


-- 
David Marchand

Reply via email to