Commit 5a6f133e authored by James Smart's avatar James Smart Committed by James Bottomley

[SCSI] lpfc 8.3.22: Add new mailbox command and new BSG fix

- Add new Queue Create Mailbox version support
- Make lpfc_bsg_wake_mbox_wait routine check the mailboxes job reference before
  using it.
Signed-off-by: default avatarAlex Iannicelli <alex.iannicelli@emulex.com>
Signed-off-by: default avatarJames Smart <james.smart@emulex.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent d1e12de8
...@@ -2479,16 +2479,18 @@ lpfc_bsg_wake_mbox_wait(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq) ...@@ -2479,16 +2479,18 @@ lpfc_bsg_wake_mbox_wait(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq)
from = (uint8_t *)dd_data->context_un.mbox.mb; from = (uint8_t *)dd_data->context_un.mbox.mb;
job = dd_data->context_un.mbox.set_job; job = dd_data->context_un.mbox.set_job;
size = job->reply_payload.payload_len; if (job) {
job->reply->reply_payload_rcv_len = size = job->reply_payload.payload_len;
sg_copy_from_buffer(job->reply_payload.sg_list, job->reply->reply_payload_rcv_len =
job->reply_payload.sg_cnt, sg_copy_from_buffer(job->reply_payload.sg_list,
from, size); job->reply_payload.sg_cnt,
job->reply->result = 0; from, size);
job->reply->result = 0;
job->dd_data = NULL;
job->job_done(job);
}
dd_data->context_un.mbox.set_job = NULL; dd_data->context_un.mbox.set_job = NULL;
job->dd_data = NULL;
job->job_done(job);
/* need to hold the lock until we call job done to hold off /* need to hold the lock until we call job done to hold off
* the timeout handler returning to the midlayer while * the timeout handler returning to the midlayer while
* we are stillprocessing the job * we are stillprocessing the job
......
...@@ -711,21 +711,27 @@ struct lpfc_sli4_cfg_mhdr { ...@@ -711,21 +711,27 @@ struct lpfc_sli4_cfg_mhdr {
union lpfc_sli4_cfg_shdr { union lpfc_sli4_cfg_shdr {
struct { struct {
uint32_t word6; uint32_t word6;
#define lpfc_mbox_hdr_opcode_SHIFT 0 #define lpfc_mbox_hdr_opcode_SHIFT 0
#define lpfc_mbox_hdr_opcode_MASK 0x000000FF #define lpfc_mbox_hdr_opcode_MASK 0x000000FF
#define lpfc_mbox_hdr_opcode_WORD word6 #define lpfc_mbox_hdr_opcode_WORD word6
#define lpfc_mbox_hdr_subsystem_SHIFT 8 #define lpfc_mbox_hdr_subsystem_SHIFT 8
#define lpfc_mbox_hdr_subsystem_MASK 0x000000FF #define lpfc_mbox_hdr_subsystem_MASK 0x000000FF
#define lpfc_mbox_hdr_subsystem_WORD word6 #define lpfc_mbox_hdr_subsystem_WORD word6
#define lpfc_mbox_hdr_port_number_SHIFT 16 #define lpfc_mbox_hdr_port_number_SHIFT 16
#define lpfc_mbox_hdr_port_number_MASK 0x000000FF #define lpfc_mbox_hdr_port_number_MASK 0x000000FF
#define lpfc_mbox_hdr_port_number_WORD word6 #define lpfc_mbox_hdr_port_number_WORD word6
#define lpfc_mbox_hdr_domain_SHIFT 24 #define lpfc_mbox_hdr_domain_SHIFT 24
#define lpfc_mbox_hdr_domain_MASK 0x000000FF #define lpfc_mbox_hdr_domain_MASK 0x000000FF
#define lpfc_mbox_hdr_domain_WORD word6 #define lpfc_mbox_hdr_domain_WORD word6
uint32_t timeout; uint32_t timeout;
uint32_t request_length; uint32_t request_length;
uint32_t reserved9; uint32_t word9;
#define lpfc_mbox_hdr_version_SHIFT 0
#define lpfc_mbox_hdr_version_MASK 0x000000FF
#define lpfc_mbox_hdr_version_WORD word9
#define LPFC_Q_CREATE_VERSION_2 2
#define LPFC_Q_CREATE_VERSION_1 1
#define LPFC_Q_CREATE_VERSION_0 0
} request; } request;
struct { struct {
uint32_t word6; uint32_t word6;
...@@ -917,9 +923,12 @@ struct cq_context { ...@@ -917,9 +923,12 @@ struct cq_context {
#define LPFC_CQ_CNT_512 0x1 #define LPFC_CQ_CNT_512 0x1
#define LPFC_CQ_CNT_1024 0x2 #define LPFC_CQ_CNT_1024 0x2
uint32_t word1; uint32_t word1;
#define lpfc_cq_eq_id_SHIFT 22 #define lpfc_cq_eq_id_SHIFT 22 /* Version 0 Only */
#define lpfc_cq_eq_id_MASK 0x000000FF #define lpfc_cq_eq_id_MASK 0x000000FF
#define lpfc_cq_eq_id_WORD word1 #define lpfc_cq_eq_id_WORD word1
#define lpfc_cq_eq_id_2_SHIFT 0 /* Version 2 Only */
#define lpfc_cq_eq_id_2_MASK 0x0000FFFF
#define lpfc_cq_eq_id_2_WORD word1
uint32_t reserved0; uint32_t reserved0;
uint32_t reserved1; uint32_t reserved1;
}; };
...@@ -929,6 +938,9 @@ struct lpfc_mbx_cq_create { ...@@ -929,6 +938,9 @@ struct lpfc_mbx_cq_create {
union { union {
struct { struct {
uint32_t word0; uint32_t word0;
#define lpfc_mbx_cq_create_page_size_SHIFT 16 /* Version 2 Only */
#define lpfc_mbx_cq_create_page_size_MASK 0x000000FF
#define lpfc_mbx_cq_create_page_size_WORD word0
#define lpfc_mbx_cq_create_num_pages_SHIFT 0 #define lpfc_mbx_cq_create_num_pages_SHIFT 0
#define lpfc_mbx_cq_create_num_pages_MASK 0x0000FFFF #define lpfc_mbx_cq_create_num_pages_MASK 0x0000FFFF
#define lpfc_mbx_cq_create_num_pages_WORD word0 #define lpfc_mbx_cq_create_num_pages_WORD word0
...@@ -969,7 +981,7 @@ struct wq_context { ...@@ -969,7 +981,7 @@ struct wq_context {
struct lpfc_mbx_wq_create { struct lpfc_mbx_wq_create {
struct mbox_header header; struct mbox_header header;
union { union {
struct { struct { /* Version 0 Request */
uint32_t word0; uint32_t word0;
#define lpfc_mbx_wq_create_num_pages_SHIFT 0 #define lpfc_mbx_wq_create_num_pages_SHIFT 0
#define lpfc_mbx_wq_create_num_pages_MASK 0x0000FFFF #define lpfc_mbx_wq_create_num_pages_MASK 0x0000FFFF
...@@ -979,6 +991,23 @@ struct lpfc_mbx_wq_create { ...@@ -979,6 +991,23 @@ struct lpfc_mbx_wq_create {
#define lpfc_mbx_wq_create_cq_id_WORD word0 #define lpfc_mbx_wq_create_cq_id_WORD word0
struct dma_address page[LPFC_MAX_WQ_PAGE]; struct dma_address page[LPFC_MAX_WQ_PAGE];
} request; } request;
struct { /* Version 1 Request */
uint32_t word0; /* Word 0 is the same as in v0 */
uint32_t word1;
#define lpfc_mbx_wq_create_page_size_SHIFT 0
#define lpfc_mbx_wq_create_page_size_MASK 0x000000FF
#define lpfc_mbx_wq_create_page_size_WORD word1
#define lpfc_mbx_wq_create_wqe_size_SHIFT 8
#define lpfc_mbx_wq_create_wqe_size_MASK 0x0000000F
#define lpfc_mbx_wq_create_wqe_size_WORD word1
#define LPFC_WQ_WQE_SIZE_64 0x5
#define LPFC_WQ_WQE_SIZE_128 0x6
#define lpfc_mbx_wq_create_wqe_count_SHIFT 16
#define lpfc_mbx_wq_create_wqe_count_MASK 0x0000FFFF
#define lpfc_mbx_wq_create_wqe_count_WORD word1
uint32_t word2;
struct dma_address page[LPFC_MAX_WQ_PAGE-1];
} request_1;
struct { struct {
uint32_t word0; uint32_t word0;
#define lpfc_mbx_wq_create_q_id_SHIFT 0 #define lpfc_mbx_wq_create_q_id_SHIFT 0
...@@ -1007,13 +1036,22 @@ struct lpfc_mbx_wq_destroy { ...@@ -1007,13 +1036,22 @@ struct lpfc_mbx_wq_destroy {
#define LPFC_DATA_BUF_SIZE 2048 #define LPFC_DATA_BUF_SIZE 2048
struct rq_context { struct rq_context {
uint32_t word0; uint32_t word0;
#define lpfc_rq_context_rq_size_SHIFT 16 #define lpfc_rq_context_rqe_count_SHIFT 16 /* Version 0 Only */
#define lpfc_rq_context_rq_size_MASK 0x0000000F #define lpfc_rq_context_rqe_count_MASK 0x0000000F
#define lpfc_rq_context_rq_size_WORD word0 #define lpfc_rq_context_rqe_count_WORD word0
#define LPFC_RQ_RING_SIZE_512 9 /* 512 entries */ #define LPFC_RQ_RING_SIZE_512 9 /* 512 entries */
#define LPFC_RQ_RING_SIZE_1024 10 /* 1024 entries */ #define LPFC_RQ_RING_SIZE_1024 10 /* 1024 entries */
#define LPFC_RQ_RING_SIZE_2048 11 /* 2048 entries */ #define LPFC_RQ_RING_SIZE_2048 11 /* 2048 entries */
#define LPFC_RQ_RING_SIZE_4096 12 /* 4096 entries */ #define LPFC_RQ_RING_SIZE_4096 12 /* 4096 entries */
#define lpfc_rq_context_rqe_count_1_SHIFT 16 /* Version 1 Only */
#define lpfc_rq_context_rqe_count_1_MASK 0x0000FFFF
#define lpfc_rq_context_rqe_count_1_WORD word0
#define lpfc_rq_context_rqe_size_SHIFT 8 /* Version 1 Only */
#define lpfc_rq_context_rqe_size_MASK 0x0000000F
#define lpfc_rq_context_rqe_size_WORD word0
#define lpfc_rq_context_page_size_SHIFT 0 /* Version 1 Only */
#define lpfc_rq_context_page_size_MASK 0x000000FF
#define lpfc_rq_context_page_size_WORD word0
uint32_t reserved1; uint32_t reserved1;
uint32_t word2; uint32_t word2;
#define lpfc_rq_context_cq_id_SHIFT 16 #define lpfc_rq_context_cq_id_SHIFT 16
...@@ -1022,7 +1060,7 @@ struct rq_context { ...@@ -1022,7 +1060,7 @@ struct rq_context {
#define lpfc_rq_context_buf_size_SHIFT 0 #define lpfc_rq_context_buf_size_SHIFT 0
#define lpfc_rq_context_buf_size_MASK 0x0000FFFF #define lpfc_rq_context_buf_size_MASK 0x0000FFFF
#define lpfc_rq_context_buf_size_WORD word2 #define lpfc_rq_context_buf_size_WORD word2
uint32_t reserved3; uint32_t buffer_size; /* Version 1 Only */
}; };
struct lpfc_mbx_rq_create { struct lpfc_mbx_rq_create {
...@@ -1062,16 +1100,16 @@ struct lpfc_mbx_rq_destroy { ...@@ -1062,16 +1100,16 @@ struct lpfc_mbx_rq_destroy {
struct mq_context { struct mq_context {
uint32_t word0; uint32_t word0;
#define lpfc_mq_context_cq_id_SHIFT 22 #define lpfc_mq_context_cq_id_SHIFT 22 /* Version 0 Only */
#define lpfc_mq_context_cq_id_MASK 0x000003FF #define lpfc_mq_context_cq_id_MASK 0x000003FF
#define lpfc_mq_context_cq_id_WORD word0 #define lpfc_mq_context_cq_id_WORD word0
#define lpfc_mq_context_count_SHIFT 16 #define lpfc_mq_context_ring_size_SHIFT 16
#define lpfc_mq_context_count_MASK 0x0000000F #define lpfc_mq_context_ring_size_MASK 0x0000000F
#define lpfc_mq_context_count_WORD word0 #define lpfc_mq_context_ring_size_WORD word0
#define LPFC_MQ_CNT_16 0x5 #define LPFC_MQ_RING_SIZE_16 0x5
#define LPFC_MQ_CNT_32 0x6 #define LPFC_MQ_RING_SIZE_32 0x6
#define LPFC_MQ_CNT_64 0x7 #define LPFC_MQ_RING_SIZE_64 0x7
#define LPFC_MQ_CNT_128 0x8 #define LPFC_MQ_RING_SIZE_128 0x8
uint32_t word1; uint32_t word1;
#define lpfc_mq_context_valid_SHIFT 31 #define lpfc_mq_context_valid_SHIFT 31
#define lpfc_mq_context_valid_MASK 0x00000001 #define lpfc_mq_context_valid_MASK 0x00000001
...@@ -1105,9 +1143,12 @@ struct lpfc_mbx_mq_create_ext { ...@@ -1105,9 +1143,12 @@ struct lpfc_mbx_mq_create_ext {
union { union {
struct { struct {
uint32_t word0; uint32_t word0;
#define lpfc_mbx_mq_create_ext_num_pages_SHIFT 0 #define lpfc_mbx_mq_create_ext_num_pages_SHIFT 0
#define lpfc_mbx_mq_create_ext_num_pages_MASK 0x0000FFFF #define lpfc_mbx_mq_create_ext_num_pages_MASK 0x0000FFFF
#define lpfc_mbx_mq_create_ext_num_pages_WORD word0 #define lpfc_mbx_mq_create_ext_num_pages_WORD word0
#define lpfc_mbx_mq_create_ext_cq_id_SHIFT 16 /* Version 1 Only */
#define lpfc_mbx_mq_create_ext_cq_id_MASK 0x0000FFFF
#define lpfc_mbx_mq_create_ext_cq_id_WORD word0
uint32_t async_evt_bmap; uint32_t async_evt_bmap;
#define lpfc_mbx_mq_create_ext_async_evt_link_SHIFT LPFC_TRAILER_CODE_LINK #define lpfc_mbx_mq_create_ext_async_evt_link_SHIFT LPFC_TRAILER_CODE_LINK
#define lpfc_mbx_mq_create_ext_async_evt_link_MASK 0x00000001 #define lpfc_mbx_mq_create_ext_async_evt_link_MASK 0x00000001
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment