#define pr_fmt(fmt) …
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/blk-mq.h>
#include <linux/parser.h>
#include <linux/random.h>
#include <uapi/scsi/fc/fc_fs.h>
#include <uapi/scsi/fc/fc_els.h>
#include "nvmet.h"
#include <linux/nvme-fc-driver.h>
#include <linux/nvme-fc.h>
#include "../host/fc.h"
#define NVMET_LS_CTX_COUNT …
struct nvmet_fc_tgtport;
struct nvmet_fc_tgt_assoc;
struct nvmet_fc_ls_iod { … } __aligned(…);
struct nvmet_fc_ls_req_op { … };
#define NVMET_FC_MAX_SEQ_LENGTH …
enum nvmet_fcp_datadir { … };
struct nvmet_fc_fcp_iod { … };
struct nvmet_fc_tgtport { … };
struct nvmet_fc_port_entry { … };
struct nvmet_fc_defer_fcp_req { … };
struct nvmet_fc_tgt_queue { … } __aligned(…);
struct nvmet_fc_hostport { … };
struct nvmet_fc_tgt_assoc { … };
static inline int
nvmet_fc_iodnum(struct nvmet_fc_ls_iod *iodptr)
{ … }
static inline int
nvmet_fc_fodnum(struct nvmet_fc_fcp_iod *fodptr)
{ … }
#define BYTES_FOR_QID …
#define BYTES_FOR_QID_SHIFT …
#define NVMET_FC_QUEUEID_MASK …
static inline u64
nvmet_fc_makeconnid(struct nvmet_fc_tgt_assoc *assoc, u16 qid)
{ … }
static inline u64
nvmet_fc_getassociationid(u64 connectionid)
{ … }
static inline u16
nvmet_fc_getqueueid(u64 connectionid)
{ … }
static inline struct nvmet_fc_tgtport *
targetport_to_tgtport(struct nvmet_fc_target_port *targetport)
{ … }
static inline struct nvmet_fc_fcp_iod *
nvmet_req_to_fod(struct nvmet_req *nvme_req)
{ … }
static DEFINE_SPINLOCK(nvmet_fc_tgtlock);
static LIST_HEAD(nvmet_fc_target_list);
static DEFINE_IDA(nvmet_fc_tgtport_cnt);
static LIST_HEAD(nvmet_fc_portentry_list);
static void nvmet_fc_handle_ls_rqst_work(struct work_struct *work);
static void nvmet_fc_fcp_rqst_op_defer_work(struct work_struct *work);
static void nvmet_fc_tgt_a_put(struct nvmet_fc_tgt_assoc *assoc);
static int nvmet_fc_tgt_a_get(struct nvmet_fc_tgt_assoc *assoc);
static void nvmet_fc_tgt_q_put(struct nvmet_fc_tgt_queue *queue);
static int nvmet_fc_tgt_q_get(struct nvmet_fc_tgt_queue *queue);
static void nvmet_fc_tgtport_put(struct nvmet_fc_tgtport *tgtport);
static void nvmet_fc_put_tgtport_work(struct work_struct *work)
{ … }
static int nvmet_fc_tgtport_get(struct nvmet_fc_tgtport *tgtport);
static void nvmet_fc_handle_fcp_rqst(struct nvmet_fc_tgtport *tgtport,
struct nvmet_fc_fcp_iod *fod);
static void nvmet_fc_delete_target_assoc(struct nvmet_fc_tgt_assoc *assoc);
static void nvmet_fc_xmt_ls_rsp(struct nvmet_fc_tgtport *tgtport,
struct nvmet_fc_ls_iod *iod);
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
__nvmet_fc_finish_ls_req(struct nvmet_fc_ls_req_op *lsop)
{ … }
static int
__nvmet_fc_send_ls_req(struct nvmet_fc_tgtport *tgtport,
struct nvmet_fc_ls_req_op *lsop,
void (*done)(struct nvmefc_ls_req *req, int status))
{ … }
static int
nvmet_fc_send_ls_req_async(struct nvmet_fc_tgtport *tgtport,
struct nvmet_fc_ls_req_op *lsop,
void (*done)(struct nvmefc_ls_req *req, int status))
{ … }
static void
nvmet_fc_disconnect_assoc_done(struct nvmefc_ls_req *lsreq, int status)
{ … }
static void
nvmet_fc_xmt_disconnect_assoc(struct nvmet_fc_tgt_assoc *assoc)
{ … }
static int
nvmet_fc_alloc_ls_iodlist(struct nvmet_fc_tgtport *tgtport)
{ … }
static void
nvmet_fc_free_ls_iodlist(struct nvmet_fc_tgtport *tgtport)
{ … }
static struct nvmet_fc_ls_iod *
nvmet_fc_alloc_ls_iod(struct nvmet_fc_tgtport *tgtport)
{ … }
static void
nvmet_fc_free_ls_iod(struct nvmet_fc_tgtport *tgtport,
struct nvmet_fc_ls_iod *iod)
{ … }
static void
nvmet_fc_prep_fcp_iodlist(struct nvmet_fc_tgtport *tgtport,
struct nvmet_fc_tgt_queue *queue)
{ … }
static void
nvmet_fc_destroy_fcp_iodlist(struct nvmet_fc_tgtport *tgtport,
struct nvmet_fc_tgt_queue *queue)
{ … }
static struct nvmet_fc_fcp_iod *
nvmet_fc_alloc_fcp_iod(struct nvmet_fc_tgt_queue *queue)
{ … }
static void
nvmet_fc_queue_fcp_req(struct nvmet_fc_tgtport *tgtport,
struct nvmet_fc_tgt_queue *queue,
struct nvmefc_tgt_fcp_req *fcpreq)
{ … }
static void
nvmet_fc_fcp_rqst_op_defer_work(struct work_struct *work)
{ … }
static void
nvmet_fc_free_fcp_iod(struct nvmet_fc_tgt_queue *queue,
struct nvmet_fc_fcp_iod *fod)
{ … }
static struct nvmet_fc_tgt_queue *
nvmet_fc_alloc_target_queue(struct nvmet_fc_tgt_assoc *assoc,
u16 qid, u16 sqsize)
{ … }
static void
nvmet_fc_tgt_queue_free(struct kref *ref)
{ … }
static void
nvmet_fc_tgt_q_put(struct nvmet_fc_tgt_queue *queue)
{ … }
static int
nvmet_fc_tgt_q_get(struct nvmet_fc_tgt_queue *queue)
{ … }
static void
nvmet_fc_delete_target_queue(struct nvmet_fc_tgt_queue *queue)
{ … }
static struct nvmet_fc_tgt_queue *
nvmet_fc_find_target_queue(struct nvmet_fc_tgtport *tgtport,
u64 connection_id)
{ … }
static void
nvmet_fc_hostport_free(struct kref *ref)
{ … }
static void
nvmet_fc_hostport_put(struct nvmet_fc_hostport *hostport)
{ … }
static int
nvmet_fc_hostport_get(struct nvmet_fc_hostport *hostport)
{ … }
static void
nvmet_fc_free_hostport(struct nvmet_fc_hostport *hostport)
{ … }
static struct nvmet_fc_hostport *
nvmet_fc_match_hostport(struct nvmet_fc_tgtport *tgtport, void *hosthandle)
{ … }
static struct nvmet_fc_hostport *
nvmet_fc_alloc_hostport(struct nvmet_fc_tgtport *tgtport, void *hosthandle)
{ … }
static void
nvmet_fc_delete_assoc(struct nvmet_fc_tgt_assoc *assoc)
{ … }
static void
nvmet_fc_delete_assoc_work(struct work_struct *work)
{ … }
static void
nvmet_fc_schedule_delete_assoc(struct nvmet_fc_tgt_assoc *assoc)
{ … }
static bool
nvmet_fc_assoc_exists(struct nvmet_fc_tgtport *tgtport, u64 association_id)
{ … }
static struct nvmet_fc_tgt_assoc *
nvmet_fc_alloc_target_assoc(struct nvmet_fc_tgtport *tgtport, void *hosthandle)
{ … }
static void
nvmet_fc_target_assoc_free(struct kref *ref)
{ … }
static void
nvmet_fc_tgt_a_put(struct nvmet_fc_tgt_assoc *assoc)
{ … }
static int
nvmet_fc_tgt_a_get(struct nvmet_fc_tgt_assoc *assoc)
{ … }
static void
nvmet_fc_delete_target_assoc(struct nvmet_fc_tgt_assoc *assoc)
{ … }
static struct nvmet_fc_tgt_assoc *
nvmet_fc_find_target_assoc(struct nvmet_fc_tgtport *tgtport,
u64 association_id)
{ … }
static void
nvmet_fc_portentry_bind(struct nvmet_fc_tgtport *tgtport,
struct nvmet_fc_port_entry *pe,
struct nvmet_port *port)
{ … }
static void
nvmet_fc_portentry_unbind(struct nvmet_fc_port_entry *pe)
{ … }
static void
nvmet_fc_portentry_unbind_tgt(struct nvmet_fc_tgtport *tgtport)
{ … }
static void
nvmet_fc_portentry_rebind_tgt(struct nvmet_fc_tgtport *tgtport)
{ … }
int
nvmet_fc_register_targetport(struct nvmet_fc_port_info *pinfo,
struct nvmet_fc_target_template *template,
struct device *dev,
struct nvmet_fc_target_port **portptr)
{ … }
EXPORT_SYMBOL_GPL(…);
static void
nvmet_fc_free_tgtport(struct kref *ref)
{ … }
static void
nvmet_fc_tgtport_put(struct nvmet_fc_tgtport *tgtport)
{ … }
static int
nvmet_fc_tgtport_get(struct nvmet_fc_tgtport *tgtport)
{ … }
static void
__nvmet_fc_free_assocs(struct nvmet_fc_tgtport *tgtport)
{ … }
void
nvmet_fc_invalidate_host(struct nvmet_fc_target_port *target_port,
void *hosthandle)
{ … }
EXPORT_SYMBOL_GPL(…);
static void
nvmet_fc_delete_ctrl(struct nvmet_ctrl *ctrl)
{ … }
int
nvmet_fc_unregister_targetport(struct nvmet_fc_target_port *target_port)
{ … }
EXPORT_SYMBOL_GPL(…);
static void
nvmet_fc_ls_create_association(struct nvmet_fc_tgtport *tgtport,
struct nvmet_fc_ls_iod *iod)
{ … }
static void
nvmet_fc_ls_create_connection(struct nvmet_fc_tgtport *tgtport,
struct nvmet_fc_ls_iod *iod)
{ … }
static int
nvmet_fc_ls_disconnect(struct nvmet_fc_tgtport *tgtport,
struct nvmet_fc_ls_iod *iod)
{ … }
static void nvmet_fc_fcp_nvme_cmd_done(struct nvmet_req *nvme_req);
static const struct nvmet_fabrics_ops nvmet_fc_tgt_fcp_ops;
static void
nvmet_fc_xmt_ls_rsp_done(struct nvmefc_ls_rsp *lsrsp)
{ … }
static void
nvmet_fc_xmt_ls_rsp(struct nvmet_fc_tgtport *tgtport,
struct nvmet_fc_ls_iod *iod)
{ … }
static void
nvmet_fc_handle_ls_rqst(struct nvmet_fc_tgtport *tgtport,
struct nvmet_fc_ls_iod *iod)
{ … }
static void
nvmet_fc_handle_ls_rqst_work(struct work_struct *work)
{ … }
int
nvmet_fc_rcv_ls_req(struct nvmet_fc_target_port *target_port,
void *hosthandle,
struct nvmefc_ls_rsp *lsrsp,
void *lsreqbuf, u32 lsreqbuf_len)
{ … }
EXPORT_SYMBOL_GPL(…);
static int
nvmet_fc_alloc_tgt_pgs(struct nvmet_fc_fcp_iod *fod)
{ … }
static void
nvmet_fc_free_tgt_pgs(struct nvmet_fc_fcp_iod *fod)
{ … }
static bool
queue_90percent_full(struct nvmet_fc_tgt_queue *q, u32 sqhd)
{ … }
static void
nvmet_fc_prep_fcp_rsp(struct nvmet_fc_tgtport *tgtport,
struct nvmet_fc_fcp_iod *fod)
{ … }
static void nvmet_fc_xmt_fcp_op_done(struct nvmefc_tgt_fcp_req *fcpreq);
static void
nvmet_fc_abort_op(struct nvmet_fc_tgtport *tgtport,
struct nvmet_fc_fcp_iod *fod)
{ … }
static void
nvmet_fc_xmt_fcp_rsp(struct nvmet_fc_tgtport *tgtport,
struct nvmet_fc_fcp_iod *fod)
{ … }
static void
nvmet_fc_transfer_fcp_data(struct nvmet_fc_tgtport *tgtport,
struct nvmet_fc_fcp_iod *fod, u8 op)
{ … }
static inline bool
__nvmet_fc_fod_op_abort(struct nvmet_fc_fcp_iod *fod, bool abort)
{ … }
static void
nvmet_fc_fod_op_done(struct nvmet_fc_fcp_iod *fod)
{ … }
static void
nvmet_fc_xmt_fcp_op_done(struct nvmefc_tgt_fcp_req *fcpreq)
{ … }
static void
__nvmet_fc_fcp_nvme_cmd_done(struct nvmet_fc_tgtport *tgtport,
struct nvmet_fc_fcp_iod *fod, int status)
{ … }
static void
nvmet_fc_fcp_nvme_cmd_done(struct nvmet_req *nvme_req)
{ … }
static void
nvmet_fc_handle_fcp_rqst(struct nvmet_fc_tgtport *tgtport,
struct nvmet_fc_fcp_iod *fod)
{ … }
int
nvmet_fc_rcv_fcp_req(struct nvmet_fc_target_port *target_port,
struct nvmefc_tgt_fcp_req *fcpreq,
void *cmdiubuf, u32 cmdiubuf_len)
{ … }
EXPORT_SYMBOL_GPL(…);
void
nvmet_fc_rcv_fcp_abort(struct nvmet_fc_target_port *target_port,
struct nvmefc_tgt_fcp_req *fcpreq)
{ … }
EXPORT_SYMBOL_GPL(…);
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 int
nvmet_fc_add_port(struct nvmet_port *port)
{ … }
static void
nvmet_fc_remove_port(struct nvmet_port *port)
{ … }
static void
nvmet_fc_discovery_chg(struct nvmet_port *port)
{ … }
static ssize_t
nvmet_fc_host_traddr(struct nvmet_ctrl *ctrl,
char *traddr, size_t traddr_size)
{ … }
static const struct nvmet_fabrics_ops nvmet_fc_tgt_fcp_ops = …;
static int __init nvmet_fc_init_module(void)
{ … }
static void __exit nvmet_fc_exit_module(void)
{ … }
module_init(…) …;
module_exit(nvmet_fc_exit_module);
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;