be2iscsi: code reorganizing and minor changes
PATCH 4/4 be2iscsi: code reorganizing and minor changes
This patch does a couple of very small, mostly
single line changes which I feel will be an overkill to put in individual patches
1) moved pci_set_drvdata to inside beiscsi_hba_alloc
2) Enabled handling of TEXT Response
3) Added opcode for ISCSI_OP_LOGOUT_RSP, ISCSI_OP_SCSI_TMFUNC_RSP,
4) Ask for ack based completion for NOOPOUT and TTT != RESERVERD
--- drivers/scsi/be2iscsi/be_main.c | 23 +++++++++++++++++------ drivers/scsi/be2iscsi/be_main.h | 4 ++-- 2 files changed, 19 insertions(+), 8 deletions(-)
drivers/scsi/be2iscsi/be_main.c +17 -6
@@ -112,6 +112,7 @@ static struct beiscsi_hba *beiscsi_hba_alloc(struct pci_dev *pcidev)memset (phba,0 ,sizeof (*phba)); phba->shost = shost; phba->pcidev =pci_dev_get (pcidev); +pci_set_drvdata (pcidev, phba);if (iscsi_host_add (shost, &phba->pcidev->dev)) goto free_devices;
@@ -564,6 +565,8 @@ beiscsi_process_async_pdu(struct beiscsi_conn *beiscsi_conn, login_hdr = (struct iscsi_hdr *)ppdu; login_hdr->itt = io_task->libiscsi_itt;break ; +case ISCSI_OP_TEXT_RSP : +break ;default : shost_printk(KERN_WARNING, phba->shost, "Unrecognized opcode 0x%x in async msg \n",
@@ -789,6 +792,7 @@ be_complete_io(struct beiscsi_conn *beiscsi_conn,memcpy (task->sc->sense_buffer, sense,min_t (u16, sense_len,SCSI_SENSE_BUFFERSIZE )); } +if (io_task->cmd_bhs->iscsi_hdr.flags &ISCSI_FLAG_CMD_READ ) {if (psol->dw[offsetof(struct amap_sol_cqe , i_res_cnt) /32 ] &SOL_RES_CNT_MASK )
@@ -810,6 +814,7 @@ be_complete_logout(struct beiscsi_conn *beiscsi_conn,struct iscsi_conn *conn = beiscsi_conn->conn; hdr = (struct iscsi_logout_rsp *)task->hdr; + hdr->opcode =ISCSI_OP_LOGOUT_RSP ; hdr->t2wait =5 ; hdr->t2retain =0 ; hdr->flags = ((psol->dw[offsetof(struct amap_sol_cqe, i_flags) / 32]
@@ -824,6 +829,9 @@ be_complete_logout(struct beiscsi_conn *beiscsi_conn, & SOL_EXP_CMD_SN_MASK) + ((psol->dw[offsetof(struct amap_sol_cqe , i_cmd_wnd) / 32] & SOL_CMD_WND_MASK) >> 24) - 1); + hdr->dlength[0 ] =0 ; + hdr->dlength[1 ] =0 ; + hdr->dlength[2 ] =0 ; hdr->hlength =0 ; hdr->itt = io_task->libiscsi_itt;__iscsi_complete_pdu (conn, (struct iscsi_hdr *)hdr,NULL ,0 );
@@ -838,6 +846,7 @@ be_complete_tmf(struct beiscsi_conn *beiscsi_conn,struct beiscsi_io_task *io_task = task->dd_data; hdr = (struct iscsi_tm_rsp *)task->hdr; + hdr->opcode =ISCSI_OP_SCSI_TMFUNC_RSP ; hdr->flags = ((psol->dw[offsetof(struct amap_sol_cqe , i_flags) /32 ] &SOL_FLAGS_MASK ) >>24 ) |0x80 ; hdr->response = (psol->dw[offsetof(struct amap_sol_cqe, i_resp) /
@@ -1461,6 +1470,7 @@ static unsigned int beiscsi_process_cq(struct be_eq_obj *pbe_eq) } beiscsi_ep = ep->dd_data; beiscsi_conn = beiscsi_ep->conn; +if (num_processed >=32 ) {hwi_ring_cq_db (phba, cq->id, num_processed,0 ,0 );
@@ -3332,7 +3342,7 @@ static int beiscsi_alloc_pdu(struct iscsi_task *task, uint8_t opcode) goto free_hndls; }else { io_task->scsi_cmnd =NULL ; -if ((task->hdr->opcode &ISCSI_OPCODE_MASK ) ==ISCSI_OP_LOGIN ) { +if ((opcode &ISCSI_OPCODE_MASK ) ==ISCSI_OP_LOGIN ) {if (!beiscsi_conn->login_in_progress) {spin_lock (&phba->mgmt_sgl_lock); io_task->psgl_handle = (struct sgl_handle *)
@@ -3539,6 +3549,10 @@ static int beiscsi_mtask(struct iscsi_task *task) elseAMAP_SET_BITS (struct amap_iscsi_wrb ,type ,pwrb ,INI_RD_CMD ); +if (task->hdr->ttt ==ISCSI_RESERVED_TAG ) + AMAP_SET_BITS(struct amap_iscsi_wrb, dmsg, pwrb, 0); +else + AMAP_SET_BITS(struct amap_iscsi_wrb, dmsg, pwrb, 1);hwi_write_buffer (pwrb, task);break ;case ISCSI_OP_TEXT :
@@ -3547,6 +3561,7 @@ static int beiscsi_mtask(struct iscsi_task *task) elseAMAP_SET_BITS (struct amap_iscsi_wrb ,type ,pwrb ,INI_WR_CMD ); + AMAP_SET_BITS(struct amap_iscsi_wrb, dmsg, pwrb, 0); AMAP_SET_BITS(struct amap_iscsi_wrb, dsp, pwrb, 1);hwi_write_buffer (pwrb, task);break ;
@@ -3594,7 +3609,7 @@ static int beiscsi_mtask(struct iscsi_task *task) } AMAP_SET_BITS(struct amap_iscsi_wrb, r2t_exp_dtl, pwrb, - be32_to_cpu(task->data_count)); + task->data_count); AMAP_SET_BITS(struct amap_iscsi_wrb, ptr2nextwrb, pwrb, io_task->pwrb_handle->nxt_wrb_index);be_dws_le_to_cpu (pwrb,sizeof (struct iscsi_wrb ));
@@ -3630,8 +3645,6 @@ static int beiscsi_task_xmit(struct iscsi_task *task) SE_DEBUG(DBG_LVL_1, " scsi_dma_map Failed\n")return num_sg; } -SE_DEBUG (DBG_LVL_4 ,"xferlen=0x%08x scmd=%p num_sg=%d sernum=%lu\n" , - (scsi_bufflen (sc)), sc, num_sg, sc->serial_number); xferlen =scsi_bufflen (sc); sg =scsi_sglist (sc);if (sc->sc_data_direction ==DMA_TO_DEVICE ) {
@@ -3726,9 +3739,7 @@ static int __devinit beiscsi_dev_probe(struct pci_dev *pcidev, " Failed in beiscsi_hba_alloc \n"); goto disable_pci; } -SE_DEBUG (DBG_LVL_8 ," phba = %p \n" , phba); -pci_set_drvdata (pcidev, phba);if (enable_msix) num_cpus =find_num_cpus ();else
drivers/scsi/be2iscsi/be_main.h +2 -2
@@ -651,8 +651,8 @@ struct amap_iscsi_wrb { } __packed; -struct wrb_handle *alloc_wrb_handle (struct beiscsi_hba *phba,unsigned int cid, -int index); +struct wrb_handle *alloc_wrb_handle (struct beiscsi_hba *phba,unsigned int cid); +void free_mgmt_sgl_handle (struct beiscsi_hba *phba,struct sgl_handle *psgl_handle);
Signature · 1 line
1.6.4
PATCH 4/5 pm8001: misc fixes and minor code cleanup
This patch does a couple of very small, mostly
single line changes which I feel will be an overkill to put in individual patches.
1) delete unnecessary cast.
2) fix potential NULL pointer dereference.
3) bit set pm8001_ha->flags
4) cleanup
5) local sata do not reset as it will not be found if reset.
Quoted 1 line
From
8e9a4cefb5b9b4e91e0fb9323fc750601243e5a4Mon Sep 17 00:00:00 2001
From: Jack Wang <[email protected]>
Date: Wed, 18 Nov 2009 15:49:20 +0800
Subject: [PATCH 4/4] misc fixes and minor cleanup
--- drivers/scsi/pm8001/pm8001_hwi.c | 2 +- drivers/scsi/pm8001/pm8001_sas.c | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-)
drivers/scsi/pm8001/pm8001_hwi.c +1 -1
@@ -4081,7 +4081,7 @@ static int pm8001_chip_phy_ctl_req(struct pm8001_hba_info *pm8001_ha,struct inbound_queue_table *circularQ;int ret;u32 opc =OPC_INB_LOCAL_PHY_CONTROL ; -memset ((u8 *)&payload,0 ,sizeof (payload)); +memset (&payload,0 ,sizeof (payload)); circularQ = &pm8001_ha->inbnd_q_tbl[0 ]; payload.tag =1 ; payload.phyop_phyid =
drivers/scsi/pm8001/pm8001_sas.c +5 -3
@@ -603,11 +603,11 @@ static int pm8001_dev_found_notify(struct domain_device *dev)spin_lock_irqsave (&pm8001_ha->lock, flags); pm8001_device =pm8001_alloc_dev (pm8001_ha); - pm8001_device->sas_device = dev;if (!pm8001_device) { res =-1 ; goto found_out; } + pm8001_device->sas_device = dev; dev->lldd_dev = pm8001_device; pm8001_device->dev_type = dev->dev_type; pm8001_device->dcompletion = &completion;
@@ -643,7 +643,7 @@ static int pm8001_dev_found_notify(struct domain_device *dev)wait_for_completion (&completion);if (dev->dev_type ==SAS_END_DEV )msleep (50 ); - pm8001_ha->flags =PM8001F_RUN_TIME ; + pm8001_ha->flags |=PM8001F_RUN_TIME ;return 0 ; found_out:spin_unlock_irqrestore (&pm8001_ha->lock, flags);
@@ -806,7 +806,7 @@ pm8001_exec_internal_task_abort(struct pm8001_hba_info *pm8001_ha, task->task_done = pm8001_task_done; task->timer.data = (unsigned long )task; task->timer.function = pm8001_tmf_timedout; - task->timer.expires = jiffies +PM8001_TASK_TIMEOUT *HZ ; + task->timer.expires = jiffies +PM8001_TASK_TIMEOUT *HZ ;add_timer (&task->timer); res =pm8001_tag_alloc (pm8001_ha, &ccb_tag);
@@ -931,6 +931,8 @@ int pm8001_I_T_nexus_reset(struct domain_device *dev)if (dev_is_sata (dev)) {DECLARE_COMPLETION_ONSTACK (completion_setstate); +if (scsi_is_sas_phy_local (phy)) +return 0 ; rc =sas_phy_reset (phy,1 );msleep (2000 ); rc = pm8001_exec_internal_task_abort(pm8001_ha, pm8001_dev ,
Signature · 1 line
1.6.5.1.1367.gcd48
PATCH 5/5 pm8001: set SSC down-spreading only to get less errors on some 6G device.
In reply to Jayamohan KallickalSet SSC down-spreading only to get less error on some 6G device.
Quoted 1 line
From
083d1c5f98a36ffec6400084e727bac1c6bd864cMon Sep 17 00:00:00 2001
From: Jack Wang <[email protected]>
Date: Wed, 18 Nov 2009 16:36:39 +0800
Subject: [PATCH 5/5] set ssc to down-spreading only
--- drivers/scsi/pm8001/pm8001_hwi.c | 65 ++++++++++++------------------------- 1 files changed, 21 insertions(+), 44 deletions(-)
drivers/scsi/pm8001/pm8001_hwi.c +21 -44
@@ -373,10 +373,7 @@ static int bar4_shift(struct pm8001_hba_info *pm8001_ha, u32 shiftValue)static void __devinit mpi_set_phys_g3_with_ssc (struct pm8001_hba_info *pm8001_ha,u32 SSCbit) { -u32 offset; -u32 value; -u32 i, j; -u32 bit_cnt; +u32 value, offset, i;#define SAS2_SETTINGS_LOCAL_PHY_0_3_SHIFT_ADDR 0x00030000#define SAS2_SETTINGS_LOCAL_PHY_4_7_SHIFT_ADDR 0x00040000
@@ -392,55 +389,35 @@ mpi_set_phys_g3_with_ssc(struct pm8001_hba_info *pm8001_ha, u32 SSCbit)*/ if (-1 ==bar4_shift (pm8001_ha,SAS2_SETTINGS_LOCAL_PHY_0_3_SHIFT_ADDR ))return ; -/* set SSC bit of PHY 0 - 3 */ +for (i =0 ; i <4 ; i++) { offset =SAS2_SETTINGS_LOCAL_PHY_0_3_OFFSET +0x4000 * i; - value =pm8001_cr32 (pm8001_ha,2 , offset); -if (SSCbit) { - value |=0x00000001 <<PHY_G3_WITH_SSC_BIT_SHIFT ; - value &= ~(0x00000001 <<PHY_G3_WITHOUT_SSC_BIT_SHIFT ); - }else { - value |=0x00000001 <<PHY_G3_WITHOUT_SSC_BIT_SHIFT ; - value &= ~(0x00000001 <<PHY_G3_WITH_SSC_BIT_SHIFT ); - } - bit_cnt =0 ; -for (j =0 ; j <31 ; j++) -if ((value >> j) &0x00000001 ) - bit_cnt++; -if (bit_cnt %2 ) - value &= ~(0x00000001 <<SNW3_PHY_CAPABILITIES_PARITY ); -else - value |=0x00000001 <<SNW3_PHY_CAPABILITIES_PARITY ; - -pm8001_cw32 (pm8001_ha,2 , offset, value); +pm8001_cw32 (pm8001_ha,2 , offset,0x80001501 ); } -/* shift membase 3 for SAS2_SETTINGS_LOCAL_PHY 4 - 7 */ if (-1 ==bar4_shift (pm8001_ha,SAS2_SETTINGS_LOCAL_PHY_4_7_SHIFT_ADDR ))return ; - -/* set SSC bit of PHY 4 - 7 */ for (i =4 ; i <8 ; i++) { offset =SAS2_SETTINGS_LOCAL_PHY_4_7_OFFSET +0x4000 * (i-4 ); - value =pm8001_cr32 (pm8001_ha,2 , offset); -if (SSCbit) { - value |=0x00000001 <<PHY_G3_WITH_SSC_BIT_SHIFT ; - value &= ~(0x00000001 <<PHY_G3_WITHOUT_SSC_BIT_SHIFT ); - }else { - value |=0x00000001 <<PHY_G3_WITHOUT_SSC_BIT_SHIFT ; - value &= ~(0x00000001 <<PHY_G3_WITH_SSC_BIT_SHIFT ); - } - bit_cnt =0 ; -for (j =0 ; j <31 ; j++) -if ((value >> j) &0x00000001 ) - bit_cnt++; -if (bit_cnt %2 ) - value &= ~(0x00000001 <<SNW3_PHY_CAPABILITIES_PARITY ); -else - value |=0x00000001 <<SNW3_PHY_CAPABILITIES_PARITY ; - -pm8001_cw32 (pm8001_ha,2 , offset, value); +pm8001_cw32 (pm8001_ha,2 , offset,0x80001501 ); } +/************************************************************* +Change the SSC upspreading value to 0x0 so that upspreading is disabled. +Device MABC SMOD0 Controls +Address: (via MEMBASE-III): +Using shifted destination address 0x0_0000: with Offset 0xD8 + +31:28 R/W Reserved Do not change +27:24 R/W SAS_SMOD_SPRDUP 0000 +23:20 R/W SAS_SMOD_SPRDDN 0000 +19:0 R/W Reserved Do not change +Upon power-up this register will read as 0x8990c016, +and I would like you to change the SAS_SMOD_SPRDUP bits to 0b0000 +so that the written value will be 0x8090c016. +This will ensure only down-spreading SSC is enabled on the SPC. +*************************************************************/ + value =pm8001_cr32 (pm8001_ha,2 ,0xd8 ); +pm8001_cw32 (pm8001_ha,2 ,0xd8 ,0x8000C016 );/*set the shifted destination address to 0x0 to avoid error operation */ bar4_shift (pm8001_ha,0x0 );
Signature · 1 line
1.6.5.1.1367.gcd48
Quoted 9 lines · Jayamohan Kallickal
This patch does a couple of very small, mostly
single line changes which I feel will be an overkill to put in individual patches1) moved
pci_set_drvdatato insidebeiscsi_hba_alloc
2) Enabled handling of TEXT Response
3) Added opcode forISCSI_OP_LOGOUT_RSP,ISCSI_OP_SCSI_TMFUNC_RSP,
4) Ask for ack based completion for NOOPOUT and TTT != RESERVERD
I think in the future you still might want to separate these.
drivers/scsi/be2iscsi/be_main.c beiscsi_process_async_pdu(struct beiscsi_conn *beiscsi_conn, · line 569
Quoted 12 lines
drivers/scsi/be2iscsi/be_main.c +2
-0@@ -564,6 +565,8 @@ beiscsi_process_async_pdu(struct beiscsi_conn *beiscsi_conn, login_hdr = (struct iscsi_hdr *)ppdu; login_hdr->itt = io_task->libiscsi_itt;break ; +case ISCSI_OP_TEXT_RSP : +break ;
Is this the only thing needed for TEXT pdu handling? Did you test with my userspace changes and the libiscsi fixups?
No, I haven't tested it with libiscsi fixups.
The whole packet including header is passed upwards ,so, I don't see a reason it won't work.
Will I get your changes in the latest git tree?
-Jay
_____
From: Mike Christie [mailto:[email protected]]
To: Jayamohan Kalickal [mailto:[email protected]]
Cc: [email protected], [email protected]
Sent: Thu, 19 Nov 2009 13:55:13 -0800
Subject: Re: [PATCH 4/4] be2iscsi: code reorganizing and minor changes
Quoted 9 lines · Jayamohan Kallickal
This patch does a couple of very small, mostly
single line changes which I feel will be an overkill to put in individual patches1) moved
pci_set_drvdatato insidebeiscsi_hba_alloc
2) Enabled handling of TEXT Response
3) Added opcode forISCSI_OP_LOGOUT_RSP,ISCSI_OP_SCSI_TMFUNC_RSP,
4) Ask for ack based completion for NOOPOUT and TTT != RESERVERD
I think in the future you still might want to separate these.
drivers/scsi/be2iscsi/be_main.c beiscsi_process_async_pdu(struct beiscsi_conn *beiscsi_conn, · line 569
Quoted 12 lines
drivers/scsi/be2iscsi/be_main.c +2
-0@@ -564,6 +565,8 @@ beiscsi_process_async_pdu(struct beiscsi_conn *beiscsi_conn, login_hdr = (struct iscsi_hdr *)ppdu; login_hdr->itt = io_task->libiscsi_itt;break ; +case ISCSI_OP_TEXT_RSP : +break ;
Is this the only thing needed for TEXT pdu handling? Did you test with my userspace changes and the libiscsi fixups?
___________________________________________________________________________________
This message, together with any attachment(s), contains confidential and proprietary information of ServerEngines Corporation and is intended only for the designated recipient(s) named above. Any unauthorized review, printing, retention, copying, disclosure or distribution is strictly prohibited. If you are not the intended recipient of this message, please immediately advise the sender by reply email message and delete all copies of this message and any attachment(s). Thank you.
Quoted 5 lines · Jayamohan Kalickal
No, I haven't tested it with libiscsi fixups.
The whole packet including header is passed upwards ,so, I don't see a reason it won't work.
Will I get your changes in the latest git tree?
The kernel code is in scsi-misc (it is also in linux-2.6-iscsi but that might not have your newer be2iscsi changes). For the kernel stuff you will need the attached patch for be2iscsi.
For userspace support get the offload branch of the open-iscsi.git tree.
Quoted 40 lines
-Jay
_____
From: Mike Christie [mailto:[email protected]]
To: Jayamohan Kalickal [mailto:[email protected]]
Cc: [email protected], [email protected]
Sent: Thu, 19 Nov 2009 13:55:13 -0800
Subject: Re: [PATCH 4/4] be2iscsi: code reorganizing and minor changesQuoted 9 lines · Jayamohan Kallickal
This patch does a couple of very small, mostly
single line changes which I feel will be an overkill to put in individual patches1) moved
pci_set_drvdatato insidebeiscsi_hba_alloc
2) Enabled handling of TEXT Response
3) Added opcode forISCSI_OP_LOGOUT_RSP,ISCSI_OP_SCSI_TMFUNC_RSP,
4) Ask for ack based completion for NOOPOUT and TTT != RESERVERDI think in the future you still might want to separate these.
drivers/scsi/be2iscsi/be_main.c beiscsi_process_async_pdu(struct beiscsi_conn *beiscsi_conn, · line 569
Quoted 12 lines
drivers/scsi/be2iscsi/be_main.c +2
-0@@ -564,6 +565,8 @@ beiscsi_process_async_pdu(struct beiscsi_conn *beiscsi_conn, login_hdr = (struct iscsi_hdr *)ppdu; login_hdr->itt = io_task->libiscsi_itt;break ; +case ISCSI_OP_TEXT_RSP : +break ;Is this the only thing needed for TEXT pdu handling? Did you test with my userspace changes and the libiscsi fixups?
Quoted 7 lines
___________________________________________________________________________________
This message, together with any attachment(s), contains confidential and proprietary information of ServerEngines Corporation and is intended only for the designated recipient(s) named above. Any unauthorized review, printing, retention, copying, disclosure or distribution is strictly prohibited. If you are not the intended recipient of this message, please immediately advise the sender by reply email message and delete all copies of this message and any attachment(s). Thank you.
drivers/scsi/be2iscsi/be_main.c +1 -1
@@ -3293,7 +3293,7 @@ disable_pci:struct iscsi_transport beiscsi_iscsi_transport = { .owner =THIS_MODULE , .name =DRV_NAME , - .caps =CAP_RECOVERY_L0 |CAP_HDRDGST | + .caps =CAP_RECOVERY_L0 |CAP_HDRDGST |CAP_TEXT_NEGO |CAP_MULTI_R2T |CAP_DATADGST |CAP_DATA_PATH_OFFLOAD , .param_mask =ISCSI_MAX_RECV_DLENGTH | ISCSI_MAX_XMIT_DLENGTH |