Commit 1a4320fa authored by James Bottomley's avatar James Bottomley

qla2xxx - perform proper SNS scans with ISP2200 HBAs. [1/3]

From: 	Andrew Vasquez <andrew.vasquez@qlogic.com>

The 2200 firmware doesn't support the MS IOCB interface the driver 
uses to issue CT commands to the SNS.  Basically, I had to 
forward-port some code from the 6.x driver to get the SNS calls 
to go through.  I've had several machines (mixture of 2200s/
2300s/others with loop and fabric connections) running with this
patch for the past week.
parent 36ce46ce
...@@ -1895,6 +1895,60 @@ struct ct_sns_pkt { ...@@ -1895,6 +1895,60 @@ struct ct_sns_pkt {
} p; } p;
}; };
/*
* SNS command structures -- for 2200 compatability.
*/
#define RFT_ID_SNS_SCMD_LEN 22
#define RFT_ID_SNS_CMD_SIZE 60
#define RFT_ID_SNS_DATA_SIZE 16
#define RFF_ID_SNS_SCMD_LEN 8
#define RFF_ID_SNS_CMD_SIZE 32
#define RFF_ID_SNS_DATA_SIZE 16
#define RNN_ID_SNS_SCMD_LEN 10
#define RNN_ID_SNS_CMD_SIZE 36
#define RNN_ID_SNS_DATA_SIZE 16
#define GA_NXT_SNS_SCMD_LEN 6
#define GA_NXT_SNS_CMD_SIZE 28
#define GA_NXT_SNS_DATA_SIZE (620 + 16)
#define GID_PT_SNS_SCMD_LEN 6
#define GID_PT_SNS_CMD_SIZE 28
#define GID_PT_SNS_DATA_SIZE (MAX_FIBRE_DEVICES * 4 + 16)
#define GPN_ID_SNS_SCMD_LEN 6
#define GPN_ID_SNS_CMD_SIZE 28
#define GPN_ID_SNS_DATA_SIZE (8 + 16)
#define GNN_ID_SNS_SCMD_LEN 6
#define GNN_ID_SNS_CMD_SIZE 28
#define GNN_ID_SNS_DATA_SIZE (8 + 16)
struct sns_cmd_pkt {
union {
struct {
uint16_t buffer_length;
uint16_t reserved_1;
uint32_t buffer_address[2];
uint16_t subcommand_length;
uint16_t reserved_2;
uint16_t subcommand;
uint16_t size;
uint32_t reserved_3;
uint8_t param[36];
} cmd;
uint8_t rft_data[RFT_ID_SNS_DATA_SIZE];
uint8_t rff_data[RFF_ID_SNS_DATA_SIZE];
uint8_t rnn_data[RNN_ID_SNS_DATA_SIZE];
uint8_t gan_data[GA_NXT_SNS_DATA_SIZE];
uint8_t gid_data[GID_PT_SNS_DATA_SIZE];
uint8_t gpn_data[GPN_ID_SNS_DATA_SIZE];
uint8_t gnn_data[GNN_ID_SNS_DATA_SIZE];
} p;
};
/* IO descriptors */ /* IO descriptors */
#define MAX_IO_DESCRIPTORS 32 #define MAX_IO_DESCRIPTORS 32
...@@ -2162,10 +2216,14 @@ typedef struct scsi_qla_host { ...@@ -2162,10 +2216,14 @@ typedef struct scsi_qla_host {
uint8_t rscn_in_ptr; uint8_t rscn_in_ptr;
uint8_t rscn_out_ptr; uint8_t rscn_out_ptr;
/* SNS command interfaces. */
ms_iocb_entry_t *ms_iocb; ms_iocb_entry_t *ms_iocb;
dma_addr_t ms_iocb_dma; dma_addr_t ms_iocb_dma;
struct ct_sns_pkt *ct_sns; struct ct_sns_pkt *ct_sns;
dma_addr_t ct_sns_dma; dma_addr_t ct_sns_dma;
/* SNS command interfaces for 2200. */
struct sns_cmd_pkt *sns_cmd;
dma_addr_t sns_cmd_dma;
pid_t dpc_pid; pid_t dpc_pid;
int dpc_should_die; int dpc_should_die;
......
This diff is collapsed.
...@@ -2921,37 +2921,59 @@ qla2x00_mem_alloc(scsi_qla_host_t *ha) ...@@ -2921,37 +2921,59 @@ qla2x00_mem_alloc(scsi_qla_host_t *ha)
continue; continue;
} }
/* Get consistent memory allocated for MS IOCB */ /* Allocate memory for SNS commands */
ha->ms_iocb = pci_alloc_consistent(ha->pdev, if (IS_QLA2200(ha)) {
sizeof(ms_iocb_entry_t), &ha->ms_iocb_dma); /* Get consistent memory allocated for SNS commands */
if (ha->ms_iocb == NULL) { ha->sns_cmd = pci_alloc_consistent(ha->pdev,
/* error */ sizeof(struct sns_cmd_pkt), &ha->sns_cmd_dma);
qla_printk(KERN_WARNING, ha, if (ha->sns_cmd == NULL) {
"Memory Allocation failed - ms_iocb\n"); /* error */
qla_printk(KERN_WARNING, ha,
"Memory Allocation failed - sns_cmd\n");
qla2x00_mem_free(ha); qla2x00_mem_free(ha);
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(HZ/10); schedule_timeout(HZ/10);
continue; continue;
} }
memset(ha->ms_iocb, 0, sizeof(ms_iocb_entry_t)); memset(ha->sns_cmd, 0, sizeof(struct sns_cmd_pkt));
} else if (!IS_QLA2100(ha)) {
/* Get consistent memory allocated for MS IOCB */
ha->ms_iocb = pci_alloc_consistent(ha->pdev,
sizeof(ms_iocb_entry_t), &ha->ms_iocb_dma);
if (ha->ms_iocb == NULL) {
/* error */
qla_printk(KERN_WARNING, ha,
"Memory Allocation failed - ms_iocb\n");
/* Get consistent memory allocated for CT SNS commands */ qla2x00_mem_free(ha);
ha->ct_sns = pci_alloc_consistent(ha->pdev, set_current_state(TASK_INTERRUPTIBLE);
sizeof(struct ct_sns_pkt), &ha->ct_sns_dma); schedule_timeout(HZ/10);
if (ha->ct_sns == NULL) {
/* error */
qla_printk(KERN_WARNING, ha,
"Memory Allocation failed - ct_sns\n");
qla2x00_mem_free(ha); continue;
set_current_state(TASK_INTERRUPTIBLE); }
schedule_timeout(HZ/10); memset(ha->ms_iocb, 0, sizeof(ms_iocb_entry_t));
continue; /*
* Get consistent memory allocated for CT SNS
* commands
*/
ha->ct_sns = pci_alloc_consistent(ha->pdev,
sizeof(struct ct_sns_pkt), &ha->ct_sns_dma);
if (ha->ct_sns == NULL) {
/* error */
qla_printk(KERN_WARNING, ha,
"Memory Allocation failed - ct_sns\n");
qla2x00_mem_free(ha);
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(HZ/10);
continue;
}
memset(ha->ct_sns, 0, sizeof(struct ct_sns_pkt));
} }
memset(ha->ct_sns, 0, sizeof(struct ct_sns_pkt));
/* Get consistent memory allocated for Get Port Database cmd */ /* Get consistent memory allocated for Get Port Database cmd */
ha->iodesc_pd = pci_alloc_consistent(ha->pdev, ha->iodesc_pd = pci_alloc_consistent(ha->pdev,
...@@ -3027,6 +3049,12 @@ qla2x00_mem_free(scsi_qla_host_t *ha) ...@@ -3027,6 +3049,12 @@ qla2x00_mem_free(scsi_qla_host_t *ha)
pci_free_consistent(ha->pdev, PORT_DATABASE_SIZE, pci_free_consistent(ha->pdev, PORT_DATABASE_SIZE,
ha->iodesc_pd, ha->iodesc_pd_dma); ha->iodesc_pd, ha->iodesc_pd_dma);
} }
if (ha->sns_cmd) {
pci_free_consistent(ha->pdev,
sizeof(struct sns_cmd_pkt), ha->sns_cmd, ha->sns_cmd_dma);
}
if (ha->ct_sns) { if (ha->ct_sns) {
pci_free_consistent(ha->pdev, pci_free_consistent(ha->pdev,
sizeof(struct ct_sns_pkt), ha->ct_sns, ha->ct_sns_dma); sizeof(struct ct_sns_pkt), ha->ct_sns, ha->ct_sns_dma);
......
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