lpfc 8.3.4: Add bsg (SGIOv4) support for ELS/CT support
Subsystems (2)
PATCH 6/8 lpfc 8.3.4: Add bsg (SGIOv4) support for ELS/CT support
Add bsg (SGIOv4) support for sending and receiving ELS, CT commands
This patch adds a new file, lpfc_bsg.c.
Signed-off-by James Smart <[email protected]>
---
drivers/scsi/lpfc/Makefile | 2 drivers/scsi/lpfc/lpfc.h | 11 drivers/scsi/lpfc/lpfc_attr.c | 3 drivers/scsi/lpfc/lpfc_bsg.c | 904 +++++++++++++++++++++++++++++++++++++++++ drivers/scsi/lpfc/lpfc_crtn.h | 8 drivers/scsi/lpfc/lpfc_ct.c | 2 drivers/scsi/lpfc/lpfc_els.c | 2 drivers/scsi/lpfc/lpfc_init.c | 3 drivers/scsi/lpfc/lpfc_nl.h | 20 + drivers/scsi/lpfc/lpfc_scsi.c | 1 10 files changed, 954 insertions(+), 2 deletions(-) create mode 100644 drivers/scsi/lpfc/lpfc_bsg.c
drivers/scsi/lpfc/Makefile +1 -1
@@ -28,4 +28,4 @@ obj-$(CONFIG_SCSI_LPFC) := lpfc.o lpfc-objs := lpfc_mem.o lpfc_sli.o lpfc_ct.o lpfc_els.o lpfc_hbadisc.o \ lpfc_init.o lpfc_mbox.o lpfc_nportdisc.o lpfc_scsi.o lpfc_attr.o \ - lpfc_vport.o lpfc_debugfs.o + lpfc_vport.o lpfc_debugfs.o lpfc_bsg.o
drivers/scsi/lpfc/lpfc.h +11 -0
@@ -441,6 +441,12 @@ enum intr_type_t { MSIX, }; +struct unsol_rcv_ct_ctx { +uint32_t ctxt_id; +uint32_t SID; +uint32_t oxid; +}; +struct lpfc_hba {/* SCSI interface function jump table entries */ int (*lpfc_new_scsi_buf)
@@ -776,6 +782,11 @@ struct lpfc_hba {uint8_t valid_vlan;uint16_t vlan_id;struct list_head fcf_conn_rec_list; + +struct mutex ct_event_mutex;/* synchronize access to ct_ev_waiters */ +struct list_head ct_ev_waiters; +struct unsol_rcv_ct_ctx ct_ctx[64 ]; +uint32_t ctx_idx; }; static inline struct Scsi_Host *
drivers/scsi/lpfc/lpfc_attr.c +3 -0
@@ -4132,6 +4132,9 @@ struct fc_function_template lpfc_transport_functions = { .vport_disable = lpfc_vport_disable, .set_vport_symbolic_name = lpfc_set_vport_symbolic_name, + + .bsg_request = lpfc_bsg_request, + .bsg_timeout = lpfc_bsg_timeout, };struct fc_function_template lpfc_vport_transport_functions = {
new file mode 100644
drivers/scsi/lpfc/lpfc_bsg.c new file +904 -0
904 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_crtn.h +8 -0
@@ -137,6 +137,9 @@ int lpfc_els_disc_adisc(struct lpfc_vport *);int lpfc_els_disc_plogi (struct lpfc_vport *);void lpfc_els_timeout (unsigned long );void lpfc_els_timeout_handler (struct lpfc_vport *); +struct lpfc_iocbq *lpfc_prep_els_iocb (struct lpfc_vport *,uint8_t ,uint16_t , +uint8_t ,struct lpfc_nodelist *, +uint32_t ,uint32_t );void lpfc_hb_timeout_handler (struct lpfc_hba *); void lpfc_ct_unsol_event(struct lpfc_hba *, struct lpfc_sli_ring *,
@@ -364,3 +367,8 @@ void lpfc_start_fdiscs(struct lpfc_hba *phba);#define HBA_EVENT_LINK_UP 2#define HBA_EVENT_LINK_DOWN 3 +/* functions to support SGIOv4/bsg interface */ +int lpfc_bsg_request (struct fc_bsg_job *); +int lpfc_bsg_timeout (struct fc_bsg_job *); +void lpfc_bsg_ct_unsol_event (struct lpfc_hba *,struct lpfc_sli_ring *, +struct lpfc_iocbq *);
drivers/scsi/lpfc/lpfc_ct.c +2 -0
@@ -97,6 +97,8 @@ lpfc_ct_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,struct list_head head;struct lpfc_dmabuf *bdeBuf; +lpfc_bsg_ct_unsol_event (phba, pring, piocbq); +if (unlikely (icmd->ulpStatus ==IOSTAT_NEED_BUFFER )) {lpfc_sli_hbqbuf_add_hbqs (phba,LPFC_ELS_HBQ ); } else if ((icmd->ulpStatus == IOSTAT_LOCAL_REJECT) &&
drivers/scsi/lpfc/lpfc_els.c +1 -1
@@ -146,7 +146,7 @@ lpfc_els_chk_latt(struct lpfc_vport *vport)* Pointer to the newly allocated/prepared els iocb data structure * NULL - when els iocb data structure allocation/preparation failed **/ -static struct lpfc_iocbq * +struct lpfc_iocbq * lpfc_prep_els_iocb(struct lpfc_vport *vport, uint8_t expectRsp, uint16_t cmdSize, uint8_t retry, struct lpfc_nodelist *ndlp, uint32_t did,
drivers/scsi/lpfc/lpfc_init.c +3 -0
@@ -4172,6 +4172,9 @@ lpfc_hba_alloc(struct pci_dev *pdev)return NULL ; } +mutex_init (&phba->ct_event_mutex); +INIT_LIST_HEAD (&phba->ct_ev_waiters); +return phba; }
drivers/scsi/lpfc/lpfc_nl.h +20 -0
@@ -177,3 +177,23 @@ struct temp_event {uint32_t data; }; +/* bsg definitions */ +#define LPFC_BSG_VENDOR_SET_CT_EVENT 1 +#define LPFC_BSG_VENDOR_GET_CT_EVENT 2 + +struct set_ct_event { +uint32_t command; +uint32_t ev_req_id; +uint32_t ev_reg_id; +}; + +struct get_ct_event { +uint32_t command; +uint32_t ev_reg_id; +uint32_t ev_req_id; +}; + +struct get_ct_event_reply { +uint32_t immed_data; +uint32_t type; +};
drivers/scsi/lpfc/lpfc_scsi.c +1 -0
@@ -3584,6 +3584,7 @@ struct scsi_host_template lpfc_template = { .use_clustering = ENABLE_CLUSTERING, .shost_attrs = lpfc_hba_attrs, .max_sectors = 0xFFFF, + .vendor_id = LPFC_NL_VENDOR_ID, };struct scsi_host_template lpfc_vport_template = {