Re: [PATCH 10/12] be2iscsi: Fix ExpStatSn in management tasks

2016-02-01 Thread Johannes Thumshirn
On Mon, Feb 01, 2016 at 03:42:49PM +0530, Jitendra Bhivare wrote:
> Connection resets observed from some targets when NOP-Out with wrong
> ExpStatSn is sent.
> 
> FW keeps track of StatSn and fills up ExpStatSn accordingly.
> The header filled up by the stack needs to be modified by driver to clear
> ExpStatSn. If the field is not cleared, FW recalculates ExpStatSn and
> wrong offset'ed ExpStatSn is seen in the wire trace.
> 
> Signed-off-by: Jitendra Bhivare 
> ---
>  drivers/scsi/be2iscsi/be_main.c | 12 
>  1 file changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
> index 3f08a11..03265b6 100644
> --- a/drivers/scsi/be2iscsi/be_main.c
> +++ b/drivers/scsi/be2iscsi/be_main.c
> @@ -4926,7 +4926,6 @@ int beiscsi_iotask_v2(struct iscsi_task *task, struct 
> scatterlist *sg,
>  
>   pwrb = io_task->pwrb_handle->pwrb;
>  
> - io_task->cmd_bhs->iscsi_hdr.exp_statsn = 0;
>   io_task->bhs_len = sizeof(struct be_cmd_bhs);
>  
>   if (writedir) {
> @@ -4987,7 +4986,6 @@ static int beiscsi_iotask(struct iscsi_task *task, 
> struct scatterlist *sg,
>   unsigned int doorbell = 0;
>  
>   pwrb = io_task->pwrb_handle->pwrb;
> - io_task->cmd_bhs->iscsi_hdr.exp_statsn = 0;
>   io_task->bhs_len = sizeof(struct be_cmd_bhs);
>  
>   if (writedir) {
> @@ -5159,23 +5157,21 @@ static int beiscsi_task_xmit(struct iscsi_task *task)
>  {
>   struct beiscsi_io_task *io_task = task->dd_data;
>   struct scsi_cmnd *sc = task->sc;
> - struct beiscsi_hba *phba = NULL;
> + struct beiscsi_hba *phba;
>   struct scatterlist *sg;
>   int num_sg;
>   unsigned int  writedir = 0, xferlen = 0;
>  
> - phba = ((struct beiscsi_conn *)task->conn->dd_data)->phba;
> + if (!io_task->conn->login_in_progress)
> + task->hdr->exp_statsn = 0;
>  
>   if (!sc)
>   return beiscsi_mtask(task);
>  
>   io_task->scsi_cmnd = sc;
>   num_sg = scsi_dma_map(sc);
> + phba = io_task->conn->phba;
>   if (num_sg < 0) {
> - struct iscsi_conn *conn = task->conn;
> - struct beiscsi_hba *phba = NULL;
> -
> - phba = ((struct beiscsi_conn *)conn->dd_data)->phba;
>   beiscsi_log(phba, KERN_ERR,
>   BEISCSI_LOG_IO | BEISCSI_LOG_ISCSI,
>   "BM_%d : scsi_dma_map Failed "
> -- 
> 2.5.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reviewed-by: Johannes Thumshirn 
-- 
Johannes Thumshirn  Storage
jthumsh...@suse.de+49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 10/12] be2iscsi: Fix ExpStatSn in management tasks

2016-02-01 Thread Jitendra Bhivare
Connection resets observed from some targets when NOP-Out with wrong
ExpStatSn is sent.

FW keeps track of StatSn and fills up ExpStatSn accordingly.
The header filled up by the stack needs to be modified by driver to clear
ExpStatSn. If the field is not cleared, FW recalculates ExpStatSn and
wrong offset'ed ExpStatSn is seen in the wire trace.

Signed-off-by: Jitendra Bhivare 
---
 drivers/scsi/be2iscsi/be_main.c | 12 
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 3f08a11..03265b6 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -4926,7 +4926,6 @@ int beiscsi_iotask_v2(struct iscsi_task *task, struct 
scatterlist *sg,
 
pwrb = io_task->pwrb_handle->pwrb;
 
-   io_task->cmd_bhs->iscsi_hdr.exp_statsn = 0;
io_task->bhs_len = sizeof(struct be_cmd_bhs);
 
if (writedir) {
@@ -4987,7 +4986,6 @@ static int beiscsi_iotask(struct iscsi_task *task, struct 
scatterlist *sg,
unsigned int doorbell = 0;
 
pwrb = io_task->pwrb_handle->pwrb;
-   io_task->cmd_bhs->iscsi_hdr.exp_statsn = 0;
io_task->bhs_len = sizeof(struct be_cmd_bhs);
 
if (writedir) {
@@ -5159,23 +5157,21 @@ static int beiscsi_task_xmit(struct iscsi_task *task)
 {
struct beiscsi_io_task *io_task = task->dd_data;
struct scsi_cmnd *sc = task->sc;
-   struct beiscsi_hba *phba = NULL;
+   struct beiscsi_hba *phba;
struct scatterlist *sg;
int num_sg;
unsigned int  writedir = 0, xferlen = 0;
 
-   phba = ((struct beiscsi_conn *)task->conn->dd_data)->phba;
+   if (!io_task->conn->login_in_progress)
+   task->hdr->exp_statsn = 0;
 
if (!sc)
return beiscsi_mtask(task);
 
io_task->scsi_cmnd = sc;
num_sg = scsi_dma_map(sc);
+   phba = io_task->conn->phba;
if (num_sg < 0) {
-   struct iscsi_conn *conn = task->conn;
-   struct beiscsi_hba *phba = NULL;
-
-   phba = ((struct beiscsi_conn *)conn->dd_data)->phba;
beiscsi_log(phba, KERN_ERR,
BEISCSI_LOG_IO | BEISCSI_LOG_ISCSI,
"BM_%d : scsi_dma_map Failed "
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html