[v2] net/gve: fix meson build failure on non-Linux platforms
Checks
Commit Message
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")
Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
---
drivers/net/gve/gve_ethdev.c | 1 -
drivers/net/gve/gve_ethdev.h | 13 +++++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
Comments
On 10/26/2022 11:23 AM, Junfeng Guo 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")
>
> Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
Squashed into relevant commit in next-net, thanks.
> From: Junfeng Guo <junfeng.guo@intel.com>
> Sent: 2022年10月26日 18:23
> To: Zhang, Qi Z <qi.z.zhang@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>;
> ferruh.yigit@xilinx.com; Xing, Beilei <beilei.xing@intel.com>
> Cc: dev@dpdk.org; Li, Xiaoyun <xiaoyun.li@intel.com>;
> awogbemila@google.com; Richardson, Bruce <bruce.richardson@intel.com>;
> hemant.agrawal@nxp.com; stephen@networkplumber.org; Xia, Chenbo
> <chenbo.xia@intel.com>; Zhang, Helin <helin.zhang@intel.com>; Guo, Junfeng
> <junfeng.guo@intel.com>
> Subject: [PATCH v2] net/gve: fix meson build failure on non-Linux platforms
>
> 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")
>
> Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
Tested-by: Daxue Gao <daxuex.gao@intel.com>
@@ -1,7 +1,6 @@
/* 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"
@@ -11,6 +11,19 @@
#include "base/gve.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 */
+
#define GVE_DEFAULT_RX_FREE_THRESH 512
#define GVE_DEFAULT_TX_FREE_THRESH 256
#define GVE_TX_MAX_FREE_SZ 512