Commit 336ba0d0 authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

build: replace USE_PCIACCESS with config.h define



Drop the special-case preprocessor definition for PCI access library now
that config.h is available with an equivalent SPDK_CONFIG_PCIACCESS
define.

Change-Id: I4891d0f2fd7d3eea51b767df9e594555b36265ea
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent cd258ce0
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@

#include "ioat_pci.h"

#ifdef USE_PCIACCESS
#ifdef SPDK_CONFIG_PCIACCESS
#include <pciaccess.h>
#else
#include <rte_pci.h>
@@ -81,7 +81,7 @@ struct ioat_pci_enum_ctx {
	void *user_enum_ctx;
};

#ifdef USE_PCIACCESS
#ifdef SPDK_CONFIG_PCIACCESS

static inline bool
ioat_pci_device_match_id(uint16_t vendor_id, uint16_t device_id)
@@ -182,7 +182,7 @@ ioat_pcicfg_unmap_bar(void *devhandle, uint32_t bar, void *addr)
	return pci_device_unmap_range(dev, addr, dev->regions[bar].size);
}

#else /* !USE_PCIACCESS */
#else /* !SPDK_CONFIG_PCIACCESS */

static inline int
ioat_pcicfg_map_bar(void *devhandle, uint32_t bar, uint32_t read_only, void **mapped_addr)
@@ -294,7 +294,7 @@ ioat_pci_enumerate(int (*enum_cb)(void *enum_ctx, struct spdk_pci_device *pci_de
	return rc;
}

#endif /* !USE_PCIACCESS */
#endif /* !SPDK_CONFIG_PCIACCESS */

typedef pthread_mutex_t ioat_mutex_t;

+4 −4
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@
#include <rte_malloc.h>
#include <rte_mempool.h>

#ifdef USE_PCIACCESS
#ifdef SPDK_CONFIG_PCIACCESS
#include <pciaccess.h>
#else
#include <rte_pci.h>
@@ -146,7 +146,7 @@ struct nvme_pci_enum_ctx {
	void *user_enum_ctx;
};

#ifdef USE_PCIACCESS
#ifdef SPDK_CONFIG_PCIACCESS

static int
nvme_pci_enum_cb(void *enum_ctx, struct spdk_pci_device *pci_dev)
@@ -208,7 +208,7 @@ nvme_pcicfg_get_bar_addr_len(void *devhandle, uint32_t bar, uint64_t *addr, uint
	*size = (uint64_t)dev->regions[bar].size;
}

#else /* !USE_PCIACCESS */
#else /* !SPDK_CONFIG_PCIACCESS */

static inline int
nvme_pcicfg_map_bar(void *devhandle, uint32_t bar, uint32_t read_only, void **mapped_addr)
@@ -297,7 +297,7 @@ nvme_pci_enumerate(int (*enum_cb)(void *enum_ctx, struct spdk_pci_device *pci_de
	return rc;
}

#endif /* !USE_PCIACCESS */
#endif /* !SPDK_CONFIG_PCIACCESS */

typedef pthread_mutex_t nvme_mutex_t;

+5 −5
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@
#include <pthread.h>
#include <stdbool.h>

#ifdef USE_PCIACCESS
#ifdef SPDK_CONFIG_PCIACCESS
#include <pciaccess.h>
/* When using libpciaccess, struct spdk_pci_device * is actually struct pci_device * internally. */
#define spdk_pci_device pci_device
@@ -62,7 +62,7 @@
#define SYSFS_PCI_DEVICES	"/sys/bus/pci/devices"
#define SYSFS_PCI_DRIVERS	"/sys/bus/pci/drivers"

#ifndef PCI_PRI_FMT /* This is defined by rte_pci.h when USE_PCIACCESS is not set */
#ifndef PCI_PRI_FMT /* This is defined by rte_pci.h when SPDK_CONFIG_PCIACCESS is not set */
#define PCI_PRI_FMT		"%04x:%02x:%02x.%1u"
#endif

@@ -71,7 +71,7 @@
#define PCI_EXT_CAP_ID_SN	0x03
#define PCI_UIO_DRIVER		"uio_pci_generic"

#ifdef USE_PCIACCESS
#ifdef SPDK_CONFIG_PCIACCESS

/*
 * libpciaccess wrapper functions
@@ -231,7 +231,7 @@ spdk_pci_enumerate(int (*enum_cb)(void *enum_ctx, struct spdk_pci_device *pci_de
	return rc;
}

#else /* !USE_PCIACCESS */
#else /* !SPDK_CONFIG_PCIACCESS */

/*
 * DPDK PCI wrapper functions
@@ -374,7 +374,7 @@ spdk_pci_device_cfg_write32(struct spdk_pci_device *dev, uint32_t value, uint32_
	return rte_eal_pci_write_config(dev, &value, 4, offset) == 4 ? 0 : -1;
}

#endif /* !USE_PCIACCESS */
#endif /* !SPDK_CONFIG_PCIACCESS */


int
+0 −2
Original line number Diff line number Diff line
@@ -92,8 +92,6 @@ endif

ifeq ($(CONFIG_PCIACCESS), y)
PCIACCESS_LIB=-lpciaccess
SPDK_PCIACCESS_CFLAGS=-DUSE_PCIACCESS
COMMON_CFLAGS += $(SPDK_PCIACCESS_CFLAGS)
endif

CFLAGS   += $(COMMON_CFLAGS) -Wno-pointer-sign -Wstrict-prototypes -std=gnu99