Commit accf2298 authored by Ziye Yang's avatar Ziye Yang Committed by Daniel Verkamp
Browse files

SPDK: remove the duplicated code in ioat/nvme_impl.h



This patch is used to remove the duplicated code.
As we found the structure in "ifdef and else" are same.

Change-Id: I1717ce3dcc14134ac59c165d801e5e811b987be5
Signed-off-by: default avatarZiye Yang <ziye.yang@intel.com>
parent 3d7bcab4
Loading
Loading
Loading
Loading
+5 −10
Original line number Diff line number Diff line
@@ -76,6 +76,11 @@ ioat_zmalloc(const char *tag, size_t size, unsigned align, uint64_t *phys_addr)
#define ioat_pcicfg_read32(handle, var, offset)  spdk_pci_device_cfg_read32(handle, var, offset)
#define ioat_pcicfg_write32(handle, var, offset) spdk_pci_device_cfg_write32(handle, var, offset)

struct ioat_pci_enum_ctx {
	int (*user_enum_cb)(void *enum_ctx, struct spdk_pci_device *pci_dev);
	void *user_enum_ctx;
};

#ifdef USE_PCIACCESS

static inline bool
@@ -134,11 +139,6 @@ ioat_pci_device_match_id(uint16_t vendor_id, uint16_t device_id)
	return false;
}

struct ioat_pci_enum_ctx {
	int (*user_enum_cb)(void *enum_ctx, struct spdk_pci_device *pci_dev);
	void *user_enum_ctx;
};

static int
ioat_pci_enum_cb(void *enum_ctx, struct spdk_pci_device *pci_dev)
{
@@ -244,11 +244,6 @@ static struct rte_pci_id ioat_driver_id[] = {
	{ .vendor_id = 0, /* sentinel */ },
};

struct ioat_pci_enum_ctx {
	int (*user_enum_cb)(void *enum_ctx, struct spdk_pci_device *pci_dev);
	void *user_enum_ctx;
};

/*
 * TODO: eliminate this global if possible (does rte_pci_driver have a context field for this?)
 *
+2 −6
Original line number Diff line number Diff line
@@ -131,12 +131,13 @@ extern struct rte_mempool *request_mempool;
#define nvme_pcicfg_read32(handle, var, offset)  spdk_pci_device_cfg_read32(handle, var, offset)
#define nvme_pcicfg_write32(handle, var, offset) spdk_pci_device_cfg_write32(handle, var, offset)

#ifdef USE_PCIACCESS
struct nvme_pci_enum_ctx {
	int (*user_enum_cb)(void *enum_ctx, struct spdk_pci_device *pci_dev);
	void *user_enum_ctx;
};

#ifdef USE_PCIACCESS

static int
nvme_pci_enum_cb(void *enum_ctx, struct spdk_pci_device *pci_dev)
{
@@ -203,11 +204,6 @@ static struct rte_pci_id nvme_pci_driver_id[] = {
	{ .vendor_id = 0, /* sentinel */ },
};

struct nvme_pci_enum_ctx {
	int (*user_enum_cb)(void *enum_ctx, struct spdk_pci_device *pci_dev);
	void *user_enum_ctx;
};

/*
 * TODO: eliminate this global if possible (does rte_pci_driver have a context field for this?)
 *