Skip to content

Commit

Permalink
Add headers for support Kernel 4.11.x
Browse files Browse the repository at this point in the history
  • Loading branch information
hyeongjunkim committed Apr 24, 2017
1 parent 2135ee5 commit aa85f73
Show file tree
Hide file tree
Showing 2 changed files with 137 additions and 0 deletions.
133 changes: 133 additions & 0 deletions modules/nvme.h
Original file line number Diff line number Diff line change
Expand Up @@ -722,4 +722,137 @@ struct nvme_dev {
};

#endif // KERN_4100

#ifdef KERN_4110
enum nvme_ctrl_state {
NVME_CTRL_NEW,
NVME_CTRL_LIVE,
NVME_CTRL_RESETTING,
NVME_CTRL_RECONNECTING,
NVME_CTRL_DELETING,
NVME_CTRL_DEAD,
};

struct nvme_ctrl {
enum nvme_ctrl_state state;
bool identified;
spinlock_t lock;
const struct nvme_ctrl_ops *ops;
struct request_queue *admin_q;
struct request_queue *connect_q;
struct device *dev;
struct kref kref;
int instance;
struct blk_mq_tag_set *tagset;
struct list_head namespaces;
struct mutex namespaces_mutex;
struct device *device; /* char device */
struct list_head node;
struct ida ns_ida;

struct opal_dev *opal_dev;

char name[12];
char serial[20];
char model[40];
char firmware_rev[8];
u16 cntlid;

u32 ctrl_config;

u32 page_size;
u32 max_hw_sectors;
u16 oncs;
u16 vid;
u16 oacs;
atomic_t abort_limit;
u8 event_limit;
u8 vwc;
u32 vs;
u32 sgls;
u16 kas;
u8 npss;
u8 apsta;
unsigned int kato;
bool subsystem;
unsigned long quirks;
//struct nvme_id_power_state psd[32];
struct work_struct scan_work;
struct work_struct async_event_work;
struct delayed_work ka_work;

/* Power saving configuration */
u64 ps_max_latency_us;

/* Fabrics only */
u16 sqsize;
u32 ioccsz;
u32 iorcsz;
u16 icdoff;
u16 maxcmd;
struct nvmf_ctrl_options *opts;
};

/*
* An NVM Express namespace is equivalent to a SCSI LUN
*/
struct nvme_ns {
struct list_head list;

struct nvme_ctrl *ctrl;
struct request_queue *queue;
struct gendisk *disk;
struct nvm_dev *ndev;
struct kref kref;
int instance;

u8 eui[8];
u8 uuid[16];

unsigned ns_id;
int lba_shift;
u16 ms;
bool ext;
u8 pi_type;
unsigned long flags;

#define NVME_NS_REMOVING 0
#define NVME_NS_DEAD 1

u64 mode_select_num_blocks;
u32 mode_select_block_len;
};

/*
* Represents an NVM Express device. Each nvme_dev is a PCI function.
*/
struct nvme_dev {
struct nvme_queue **queues;
struct blk_mq_tag_set tagset;
struct blk_mq_tag_set admin_tagset;
u32 __iomem *dbs;
struct device *dev;
struct dma_pool *prp_page_pool;
struct dma_pool *prp_small_pool;
unsigned queue_count;
unsigned online_queues;
unsigned max_qid;
int q_depth;
u32 db_stride;
void __iomem *bar;
struct work_struct reset_work;
struct work_struct remove_work;
struct timer_list watchdog_timer;
struct mutex shutdown_lock;
bool subsystem;
void __iomem *cmb;
dma_addr_t cmb_dma_addr;
u64 cmb_size;
u32 cmbsz;
u32 cmbloc;
struct nvme_ctrl ctrl;
struct completion ioq_wait;
};
#endif // KERNL_4110

#endif //_NVMED_NVME_HEADER_H
4 changes: 4 additions & 0 deletions modules/nvmed.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@
#define KERN_4100
#include "nvme.h"
#endif
#if KERNEL_VERSION_CODE == KERNEL_VERSION(4,11,0)
#define KERN_4110
#include "nvme.h"
#endif

#if KERNEL_VERSION_CODE >= KERNEL_VERSION(4,5,0)
#undef DEV_TO_ADMINQ
Expand Down

0 comments on commit aa85f73

Please sign in to comment.