#define pr_fmt(fmt) …
#include <linux/module.h>
#include <linux/parser.h>
#include <uapi/scsi/fc/fc_fs.h>
#include <uapi/scsi/fc/fc_els.h>
#include <linux/delay.h>
#include <linux/overflow.h>
#include <linux/blk-cgroup.h>
#include "nvme.h"
#include "fabrics.h"
#include <linux/nvme-fc-driver.h>
#include <linux/nvme-fc.h>
#include "fc.h"
#include <scsi/scsi_transport_fc.h>
#include <linux/blk-mq-pci.h>
enum nvme_fc_queue_flags { … };
#define NVME_FC_DEFAULT_DEV_LOSS_TMO …
#define NVME_FC_DEFAULT_RECONNECT_TMO …
struct nvme_fc_queue { … } __aligned(…);
enum nvme_fcop_flags { … };
struct nvmefc_ls_req_op { … };
struct nvmefc_ls_rcv_op { … } __aligned(…);
enum nvme_fcpop_state { … };
struct nvme_fc_fcp_op { … };
struct nvme_fcp_op_w_sgl { … };
struct nvme_fc_lport { … } __aligned(…);
struct nvme_fc_rport { … } __aligned(…);
#define ASSOC_ACTIVE …
#define ASSOC_FAILED …
#define FCCTRL_TERMIO …
struct nvme_fc_ctrl { … };
static inline struct nvme_fc_ctrl *
to_fc_ctrl(struct nvme_ctrl *ctrl)
{ … }
static inline struct nvme_fc_lport *
localport_to_lport(struct nvme_fc_local_port *portptr)
{ … }
static inline struct nvme_fc_rport *
remoteport_to_rport(struct nvme_fc_remote_port *portptr)
{ … }
static inline struct nvmefc_ls_req_op *
ls_req_to_lsop(struct nvmefc_ls_req *lsreq)
{ … }
static inline struct nvme_fc_fcp_op *
fcp_req_to_fcp_op(struct nvmefc_fcp_req *fcpreq)
{ … }
static DEFINE_SPINLOCK(nvme_fc_lock);
static LIST_HEAD(nvme_fc_lport_list);
static DEFINE_IDA(nvme_fc_local_port_cnt);
static DEFINE_IDA(nvme_fc_ctrl_cnt);
static struct device *fc_udev_device;
static void nvme_fc_complete_rq(struct request *rq);
static void __nvme_fc_delete_hw_queue(struct nvme_fc_ctrl *,
struct nvme_fc_queue *, unsigned int);
static void nvme_fc_handle_ls_rqst_work(struct work_struct *work);
static void
nvme_fc_free_lport(struct kref *ref)
{ … }
static void
nvme_fc_lport_put(struct nvme_fc_lport *lport)
{ … }
static int
nvme_fc_lport_get(struct nvme_fc_lport *lport)
{ … }
static struct nvme_fc_lport *
nvme_fc_attach_to_unreg_lport(struct nvme_fc_port_info *pinfo,
struct nvme_fc_port_template *ops,
struct device *dev)
{ … }
int
nvme_fc_register_localport(struct nvme_fc_port_info *pinfo,
struct nvme_fc_port_template *template,
struct device *dev,
struct nvme_fc_local_port **portptr)
{ … }
EXPORT_SYMBOL_GPL(…);
int
nvme_fc_unregister_localport(struct nvme_fc_local_port *portptr)
{ … }
EXPORT_SYMBOL_GPL(…);
#define FCNVME_TRADDR_LENGTH …
static void
nvme_fc_signal_discovery_scan(struct nvme_fc_lport *lport,
struct nvme_fc_rport *rport)
{ … }
static void
nvme_fc_free_rport(struct kref *ref)
{ … }
static void
nvme_fc_rport_put(struct nvme_fc_rport *rport)
{ … }
static int
nvme_fc_rport_get(struct nvme_fc_rport *rport)
{ … }
static void
nvme_fc_resume_controller(struct nvme_fc_ctrl *ctrl)
{ … }
static struct nvme_fc_rport *
nvme_fc_attach_to_suspended_rport(struct nvme_fc_lport *lport,
struct nvme_fc_port_info *pinfo)
{ … }
static inline void
__nvme_fc_set_dev_loss_tmo(struct nvme_fc_rport *rport,
struct nvme_fc_port_info *pinfo)
{ … }
int
nvme_fc_register_remoteport(struct nvme_fc_local_port *localport,
struct nvme_fc_port_info *pinfo,
struct nvme_fc_remote_port **portptr)
{ … }
EXPORT_SYMBOL_GPL(…);
static int
nvme_fc_abort_lsops(struct nvme_fc_rport *rport)
{ … }
static void
nvme_fc_ctrl_connectivity_loss(struct nvme_fc_ctrl *ctrl)
{ … }
int
nvme_fc_unregister_remoteport(struct nvme_fc_remote_port *portptr)
{ … }
EXPORT_SYMBOL_GPL(…);
void
nvme_fc_rescan_remoteport(struct nvme_fc_remote_port *remoteport)
{ … }
EXPORT_SYMBOL_GPL(…);
int
nvme_fc_set_remoteport_devloss(struct nvme_fc_remote_port *portptr,
u32 dev_loss_tmo)
{ … }
EXPORT_SYMBOL_GPL(…);
static inline dma_addr_t
fc_dma_map_single(struct device *dev, void *ptr, size_t size,
enum dma_data_direction dir)
{ … }
static inline int
fc_dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
{ … }
static inline void
fc_dma_unmap_single(struct device *dev, dma_addr_t addr, size_t size,
enum dma_data_direction dir)
{ … }
static inline void
fc_dma_sync_single_for_cpu(struct device *dev, dma_addr_t addr, size_t size,
enum dma_data_direction dir)
{ … }
static inline void
fc_dma_sync_single_for_device(struct device *dev, dma_addr_t addr, size_t size,
enum dma_data_direction dir)
{ … }
static int
fc_map_sg(struct scatterlist *sg, int nents)
{ … }
static inline int
fc_dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
enum dma_data_direction dir)
{ … }
static inline void
fc_dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nents,
enum dma_data_direction dir)
{ … }
static void nvme_fc_ctrl_put(struct nvme_fc_ctrl *);
static int nvme_fc_ctrl_get(struct nvme_fc_ctrl *);
static void nvme_fc_error_recovery(struct nvme_fc_ctrl *ctrl, char *errmsg);
static void
__nvme_fc_finish_ls_req(struct nvmefc_ls_req_op *lsop)
{ … }
static int
__nvme_fc_send_ls_req(struct nvme_fc_rport *rport,
struct nvmefc_ls_req_op *lsop,
void (*done)(struct nvmefc_ls_req *req, int status))
{ … }
static void
nvme_fc_send_ls_req_done(struct nvmefc_ls_req *lsreq, int status)
{ … }
static int
nvme_fc_send_ls_req(struct nvme_fc_rport *rport, struct nvmefc_ls_req_op *lsop)
{ … }
static int
nvme_fc_send_ls_req_async(struct nvme_fc_rport *rport,
struct nvmefc_ls_req_op *lsop,
void (*done)(struct nvmefc_ls_req *req, int status))
{ … }
static int
nvme_fc_connect_admin_queue(struct nvme_fc_ctrl *ctrl,
struct nvme_fc_queue *queue, u16 qsize, u16 ersp_ratio)
{ … }
static int
nvme_fc_connect_queue(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue,
u16 qsize, u16 ersp_ratio)
{ … }
static void
nvme_fc_disconnect_assoc_done(struct nvmefc_ls_req *lsreq, int status)
{ … }
static void
nvme_fc_xmt_disconnect_assoc(struct nvme_fc_ctrl *ctrl)
{ … }
static void
nvme_fc_xmt_ls_rsp_done(struct nvmefc_ls_rsp *lsrsp)
{ … }
static void
nvme_fc_xmt_ls_rsp(struct nvmefc_ls_rcv_op *lsop)
{ … }
static struct nvme_fc_ctrl *
nvme_fc_match_disconn_ls(struct nvme_fc_rport *rport,
struct nvmefc_ls_rcv_op *lsop)
{ … }
static bool
nvme_fc_ls_disconnect_assoc(struct nvmefc_ls_rcv_op *lsop)
{ … }
static bool
nvme_fc_handle_ls_rqst(struct nvmefc_ls_rcv_op *lsop)
{ … }
static void
nvme_fc_handle_ls_rqst_work(struct work_struct *work)
{ … }
static
void nvme_fc_rcv_ls_req_err_msg(struct nvme_fc_lport *lport,
struct fcnvme_ls_rqst_w0 *w0)
{ … }
int
nvme_fc_rcv_ls_req(struct nvme_fc_remote_port *portptr,
struct nvmefc_ls_rsp *lsrsp,
void *lsreqbuf, u32 lsreqbuf_len)
{ … }
EXPORT_SYMBOL_GPL(…);
static void
__nvme_fc_exit_request(struct nvme_fc_ctrl *ctrl,
struct nvme_fc_fcp_op *op)
{ … }
static void
nvme_fc_exit_request(struct blk_mq_tag_set *set, struct request *rq,
unsigned int hctx_idx)
{ … }
static int
__nvme_fc_abort_op(struct nvme_fc_ctrl *ctrl, struct nvme_fc_fcp_op *op)
{ … }
static void
nvme_fc_abort_aen_ops(struct nvme_fc_ctrl *ctrl)
{ … }
static inline void
__nvme_fc_fcpop_chk_teardowns(struct nvme_fc_ctrl *ctrl,
struct nvme_fc_fcp_op *op, int opstate)
{ … }
static void
nvme_fc_ctrl_ioerr_work(struct work_struct *work)
{ … }
char *nvme_fc_io_getuuid(struct nvmefc_fcp_req *req)
{ … }
EXPORT_SYMBOL_GPL(…);
static void
nvme_fc_fcpio_done(struct nvmefc_fcp_req *req)
{ … }
static int
__nvme_fc_init_request(struct nvme_fc_ctrl *ctrl,
struct nvme_fc_queue *queue, struct nvme_fc_fcp_op *op,
struct request *rq, u32 rqno)
{ … }
static int
nvme_fc_init_request(struct blk_mq_tag_set *set, struct request *rq,
unsigned int hctx_idx, unsigned int numa_node)
{ … }
static int
nvme_fc_init_aen_ops(struct nvme_fc_ctrl *ctrl)
{ … }
static void
nvme_fc_term_aen_ops(struct nvme_fc_ctrl *ctrl)
{ … }
static inline int
__nvme_fc_init_hctx(struct blk_mq_hw_ctx *hctx, void *data, unsigned int qidx)
{ … }
static int
nvme_fc_init_hctx(struct blk_mq_hw_ctx *hctx, void *data, unsigned int hctx_idx)
{ … }
static int
nvme_fc_init_admin_hctx(struct blk_mq_hw_ctx *hctx, void *data,
unsigned int hctx_idx)
{ … }
static void
nvme_fc_init_queue(struct nvme_fc_ctrl *ctrl, int idx)
{ … }
static void
nvme_fc_free_queue(struct nvme_fc_queue *queue)
{ … }
static void
__nvme_fc_delete_hw_queue(struct nvme_fc_ctrl *ctrl,
struct nvme_fc_queue *queue, unsigned int qidx)
{ … }
static void
nvme_fc_free_io_queues(struct nvme_fc_ctrl *ctrl)
{ … }
static int
__nvme_fc_create_hw_queue(struct nvme_fc_ctrl *ctrl,
struct nvme_fc_queue *queue, unsigned int qidx, u16 qsize)
{ … }
static void
nvme_fc_delete_hw_io_queues(struct nvme_fc_ctrl *ctrl)
{ … }
static int
nvme_fc_create_hw_io_queues(struct nvme_fc_ctrl *ctrl, u16 qsize)
{ … }
static int
nvme_fc_connect_io_queues(struct nvme_fc_ctrl *ctrl, u16 qsize)
{ … }
static void
nvme_fc_init_io_queues(struct nvme_fc_ctrl *ctrl)
{ … }
static void
nvme_fc_ctrl_free(struct kref *ref)
{ … }
static void
nvme_fc_ctrl_put(struct nvme_fc_ctrl *ctrl)
{ … }
static int
nvme_fc_ctrl_get(struct nvme_fc_ctrl *ctrl)
{ … }
static void
nvme_fc_free_ctrl(struct nvme_ctrl *nctrl)
{ … }
static bool nvme_fc_terminate_exchange(struct request *req, void *data)
{ … }
static void
__nvme_fc_abort_outstanding_ios(struct nvme_fc_ctrl *ctrl, bool start_queues)
{ … }
static void
nvme_fc_error_recovery(struct nvme_fc_ctrl *ctrl, char *errmsg)
{ … }
static enum blk_eh_timer_return nvme_fc_timeout(struct request *rq)
{ … }
static int
nvme_fc_map_data(struct nvme_fc_ctrl *ctrl, struct request *rq,
struct nvme_fc_fcp_op *op)
{ … }
static void
nvme_fc_unmap_data(struct nvme_fc_ctrl *ctrl, struct request *rq,
struct nvme_fc_fcp_op *op)
{ … }
static blk_status_t
nvme_fc_start_fcp_op(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue,
struct nvme_fc_fcp_op *op, u32 data_len,
enum nvmefc_fcp_datadir io_dir)
{ … }
static blk_status_t
nvme_fc_queue_rq(struct blk_mq_hw_ctx *hctx,
const struct blk_mq_queue_data *bd)
{ … }
static void
nvme_fc_submit_async_event(struct nvme_ctrl *arg)
{ … }
static void
nvme_fc_complete_rq(struct request *rq)
{ … }
static void nvme_fc_map_queues(struct blk_mq_tag_set *set)
{ … }
static const struct blk_mq_ops nvme_fc_mq_ops = …;
static int
nvme_fc_create_io_queues(struct nvme_fc_ctrl *ctrl)
{ … }
static int
nvme_fc_recreate_io_queues(struct nvme_fc_ctrl *ctrl)
{ … }
static void
nvme_fc_rport_active_on_lport(struct nvme_fc_rport *rport)
{ … }
static void
nvme_fc_rport_inactive_on_lport(struct nvme_fc_rport *rport)
{ … }
static int
nvme_fc_ctlr_active_on_rport(struct nvme_fc_ctrl *ctrl)
{ … }
static int
nvme_fc_ctlr_inactive_on_rport(struct nvme_fc_ctrl *ctrl)
{ … }
static int
nvme_fc_create_association(struct nvme_fc_ctrl *ctrl)
{ … }
static void
nvme_fc_delete_association(struct nvme_fc_ctrl *ctrl)
{ … }
static void
nvme_fc_delete_ctrl(struct nvme_ctrl *nctrl)
{ … }
static void
nvme_fc_reconnect_or_delete(struct nvme_fc_ctrl *ctrl, int status)
{ … }
static void
nvme_fc_reset_ctrl_work(struct work_struct *work)
{ … }
static const struct nvme_ctrl_ops nvme_fc_ctrl_ops = …;
static void
nvme_fc_connect_ctrl_work(struct work_struct *work)
{ … }
static const struct blk_mq_ops nvme_fc_admin_mq_ops = …;
static bool
nvme_fc_existing_controller(struct nvme_fc_rport *rport,
struct nvmf_ctrl_options *opts)
{ … }
static struct nvme_fc_ctrl *
nvme_fc_alloc_ctrl(struct device *dev, struct nvmf_ctrl_options *opts,
struct nvme_fc_lport *lport, struct nvme_fc_rport *rport)
{ … }
static struct nvme_ctrl *
nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts,
struct nvme_fc_lport *lport, struct nvme_fc_rport *rport)
{ … }
struct nvmet_fc_traddr { … };
static int
__nvme_fc_parse_u64(substring_t *sstr, u64 *val)
{ … }
static int
nvme_fc_parse_traddr(struct nvmet_fc_traddr *traddr, char *buf, size_t blen)
{ … }
static struct nvme_ctrl *
nvme_fc_create_ctrl(struct device *dev, struct nvmf_ctrl_options *opts)
{ … }
static struct nvmf_transport_ops nvme_fc_transport = …;
#define DISCOVERY_MAX_FAIL …
static ssize_t nvme_fc_nvme_discovery_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{ … }
static DEVICE_ATTR(nvme_discovery, 0200, NULL, nvme_fc_nvme_discovery_store);
#ifdef CONFIG_BLK_CGROUP_FC_APPID
static int fc_parse_cgrpid(const char *buf, u64 *id)
{ … }
static ssize_t fc_appid_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{ … }
static DEVICE_ATTR(appid_store, 0200, NULL, fc_appid_store);
#endif
static struct attribute *nvme_fc_attrs[] = …;
static const struct attribute_group nvme_fc_attr_group = …;
static const struct attribute_group *nvme_fc_attr_groups[] = …;
static struct class fc_class = …;
static int __init nvme_fc_init_module(void)
{ … }
static void
nvme_fc_delete_controllers(struct nvme_fc_rport *rport)
{ … }
static void __exit nvme_fc_exit_module(void)
{ … }
module_init(…) …;
module_exit(nvme_fc_exit_module);
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;