* [PATCH 2/6] be2iscsi: relinquishing control after processing 512 CQE
2014-03-27 16:39 [PATCH 1/6] be2iscsi: Fix retrieving MCCQ_WRB in non-embedded Mbox path Jayamohan Kallickal
@ 2014-03-27 16:39 ` Jayamohan Kallickal
2014-03-31 5:25 ` Mike Christie
2014-03-27 16:39 ` [PATCH 3/6] be2iscsi: Fix MCCQ posting for Mbx-Cmd after driver initialization is complete Jayamohan Kallickal
` (4 subsequent siblings)
5 siblings, 1 reply; 15+ messages in thread
From: Jayamohan Kallickal @ 2014-03-27 16:39 UTC (permalink / raw)
To: jbottomley, linux-scsi, michaelc
Cc: Jayamohan Kallickal, Minh Tran, John Soni Jose
stuck in IO poll for a long time. In such cases driver
did not rearm which could lead to unprocessed eq.Change
sched iopoll once then check for valid bit of eqe from
eq in be_iopoll.
Signed-off-by: Minh Tran <minhduc.tran@emulex.com>
Signed-off-by: John Soni Jose <sony.john-n@emulex.com>
Signed-off-by: Jayamohan Kallickal <Jayamohan.Kallickal@emulex.com>
---
drivers/scsi/be2iscsi/be_main.c | 73 +++++++++++++++++++++++++----------------
drivers/scsi/be2iscsi/be_main.h | 1 +
2 files changed, 45 insertions(+), 29 deletions(-)
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 9be818f..0c9e270 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -895,45 +895,37 @@ static irqreturn_t be_isr_msix(int irq, void *dev_id)
struct beiscsi_hba *phba;
struct be_eq_entry *eqe = NULL;
struct be_queue_info *eq;
- struct be_queue_info *cq;
unsigned int num_eq_processed;
struct be_eq_obj *pbe_eq;
unsigned long flags;
pbe_eq = dev_id;
eq = &pbe_eq->q;
- cq = pbe_eq->cq;
- eqe = queue_tail_node(eq);
phba = pbe_eq->phba;
- num_eq_processed = 0;
if (blk_iopoll_enabled) {
- while (eqe->dw[offsetof(struct amap_eq_entry, valid) / 32]
- & EQE_VALID_MASK) {
- if (!blk_iopoll_sched_prep(&pbe_eq->iopoll))
- blk_iopoll_sched(&pbe_eq->iopoll);
-
- AMAP_SET_BITS(struct amap_eq_entry, valid, eqe, 0);
- queue_tail_inc(eq);
- eqe = queue_tail_node(eq);
- num_eq_processed++;
- }
- } else {
- while (eqe->dw[offsetof(struct amap_eq_entry, valid) / 32]
- & EQE_VALID_MASK) {
- spin_lock_irqsave(&phba->isr_lock, flags);
- pbe_eq->todo_cq = true;
- spin_unlock_irqrestore(&phba->isr_lock, flags);
- AMAP_SET_BITS(struct amap_eq_entry, valid, eqe, 0);
- queue_tail_inc(eq);
- eqe = queue_tail_node(eq);
- num_eq_processed++;
- }
+ hwi_ring_eq_db(phba, eq->id, 1, 0, 1, 1);
+ if (!blk_iopoll_sched_prep(&pbe_eq->iopoll))
+ blk_iopoll_sched(&pbe_eq->iopoll);
+ return IRQ_HANDLED;
+ }
- if (pbe_eq->todo_cq)
- queue_work(phba->wq, &pbe_eq->work_cqs);
+ num_eq_processed = 0;
+ eqe = queue_tail_node(eq);
+ while (eqe->dw[offsetof(struct amap_eq_entry, valid) / 32]
+ & EQE_VALID_MASK) {
+ spin_lock_irqsave(&phba->isr_lock, flags);
+ pbe_eq->todo_cq = true;
+ spin_unlock_irqrestore(&phba->isr_lock, flags);
+ AMAP_SET_BITS(struct amap_eq_entry, valid, eqe, 0);
+ queue_tail_inc(eq);
+ eqe = queue_tail_node(eq);
+ num_eq_processed++;
}
+ if (pbe_eq->todo_cq)
+ queue_work(phba->wq, &pbe_eq->work_cqs);
+
if (num_eq_processed)
hwi_ring_eq_db(phba, eq->id, 1, num_eq_processed, 0, 1);
@@ -2281,6 +2273,10 @@ static unsigned int beiscsi_process_cq(struct be_eq_obj *pbe_eq)
queue_tail_inc(cq);
sol = queue_tail_node(cq);
num_processed++;
+
+ /* we want to relinquish control to other tasks */
+ if (tot_nump >= BE2_MAX_NUM_CQ_PROC)
+ break;
}
if (num_processed > 0) {
@@ -2323,14 +2319,33 @@ void beiscsi_process_all_cqs(struct work_struct *work)
static int be_iopoll(struct blk_iopoll *iop, int budget)
{
- unsigned int ret;
+ unsigned int ret, num_eq_processed;
struct beiscsi_hba *phba;
struct be_eq_obj *pbe_eq;
+ struct be_eq_entry *eqe = NULL;
+ struct be_queue_info *eq;
+ num_eq_processed = 0;
pbe_eq = container_of(iop, struct be_eq_obj, iopoll);
+ phba = pbe_eq->phba;
+ eq = &pbe_eq->q;
+ eqe = queue_tail_node(eq);
+
+ hwi_ring_eq_db(phba, eq->id, 1, num_eq_processed, 0, 1);
+
+ while (eqe->dw[offsetof(struct amap_eq_entry, valid) / 32]
+ & EQE_VALID_MASK) {
+
+ AMAP_SET_BITS(struct amap_eq_entry, valid, eqe, 0);
+ queue_tail_inc(eq);
+ eqe = queue_tail_node(eq);
+ num_eq_processed++;
+ }
+
+ hwi_ring_eq_db(phba, eq->id, 1, num_eq_processed, 0, 1);
+
ret = beiscsi_process_cq(pbe_eq);
if (ret < budget) {
- phba = pbe_eq->phba;
blk_iopoll_complete(iop);
beiscsi_log(phba, KERN_INFO,
BEISCSI_LOG_CONFIG | BEISCSI_LOG_IO,
diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h
index 9380b55..d5901a7 100644
--- a/drivers/scsi/be2iscsi/be_main.h
+++ b/drivers/scsi/be2iscsi/be_main.h
@@ -63,6 +63,7 @@
#define BE2_SGE 32
#define BE2_DEFPDU_HDR_SZ 64
#define BE2_DEFPDU_DATA_SZ 8192
+#define BE2_MAX_NUM_CQ_PROC 512
#define MAX_CPUS 64
#define BEISCSI_MAX_NUM_CPUS 7
--
1.8.5.3
^ permalink raw reply related [flat|nested] 15+ messages in thread* Re: [PATCH 2/6] be2iscsi: relinquishing control after processing 512 CQE
2014-03-27 16:39 ` [PATCH 2/6] be2iscsi: relinquishing control after processing 512 CQE Jayamohan Kallickal
@ 2014-03-31 5:25 ` Mike Christie
2014-04-03 5:02 ` Jayamohan Kallickal
0 siblings, 1 reply; 15+ messages in thread
From: Mike Christie @ 2014-03-31 5:25 UTC (permalink / raw)
To: Jayamohan Kallickal
Cc: jbottomley, linux-scsi, Jayamohan Kallickal, Minh Tran,
John Soni Jose
On 03/27/2014 11:39 AM, Jayamohan Kallickal wrote:
> @@ -2323,14 +2319,33 @@ void beiscsi_process_all_cqs(struct work_struct *work)
>
> static int be_iopoll(struct blk_iopoll *iop, int budget)
> {
> - unsigned int ret;
> + unsigned int ret, num_eq_processed;
> struct beiscsi_hba *phba;
> struct be_eq_obj *pbe_eq;
> + struct be_eq_entry *eqe = NULL;
> + struct be_queue_info *eq;
>
> + num_eq_processed = 0;
> pbe_eq = container_of(iop, struct be_eq_obj, iopoll);
> + phba = pbe_eq->phba;
> + eq = &pbe_eq->q;
> + eqe = queue_tail_node(eq);
> +
> + hwi_ring_eq_db(phba, eq->id, 1, num_eq_processed, 0, 1);
Is this right? num_eq_processed will be 0 above. Should this be moved
down below to after num_eq_processed has been incremented?
> +
> + while (eqe->dw[offsetof(struct amap_eq_entry, valid) / 32]
> + & EQE_VALID_MASK) {
> +
> + AMAP_SET_BITS(struct amap_eq_entry, valid, eqe, 0);
> + queue_tail_inc(eq);
> + eqe = queue_tail_node(eq);
> + num_eq_processed++;
> + }
^ permalink raw reply [flat|nested] 15+ messages in thread* RE: [PATCH 2/6] be2iscsi: relinquishing control after processing 512 CQE
2014-03-31 5:25 ` Mike Christie
@ 2014-04-03 5:02 ` Jayamohan Kallickal
0 siblings, 0 replies; 15+ messages in thread
From: Jayamohan Kallickal @ 2014-04-03 5:02 UTC (permalink / raw)
To: Mike Christie, Jayamohan Kallickal
Cc: jbottomley@parallels.com, linux-scsi@vger.kernel.org,
Minh Duc Tran, Sony John-N
-----Original Message-----
From: Mike Christie [mailto:michaelc@cs.wisc.edu]
Sent: Sunday, March 30, 2014 10:25 PM
To: Jayamohan Kallickal
Cc: jbottomley@parallels.com; linux-scsi@vger.kernel.org; Jayamohan Kallickal; Minh Duc Tran; Sony John-N
Subject: Re: [PATCH 2/6] be2iscsi: relinquishing control after processing 512 CQE
On 03/27/2014 11:39 AM, Jayamohan Kallickal wrote:
> @@ -2323,14 +2319,33 @@ void beiscsi_process_all_cqs(struct
> work_struct *work)
>
> static int be_iopoll(struct blk_iopoll *iop, int budget) {
> - unsigned int ret;
> + unsigned int ret, num_eq_processed;
> struct beiscsi_hba *phba;
> struct be_eq_obj *pbe_eq;
> + struct be_eq_entry *eqe = NULL;
> + struct be_queue_info *eq;
>
> + num_eq_processed = 0;
> pbe_eq = container_of(iop, struct be_eq_obj, iopoll);
> + phba = pbe_eq->phba;
> + eq = &pbe_eq->q;
> + eqe = queue_tail_node(eq);
> +
> + hwi_ring_eq_db(phba, eq->id, 1, num_eq_processed, 0, 1);
>Is this right? num_eq_processed will be 0 above. Should this be moved down below to after num_eq_processed has been incremented?
I am unarming the interrupts so that we are not interrupted while in be_iopoll. So , this is fine
> +
> + while (eqe->dw[offsetof(struct amap_eq_entry, valid) / 32]
> + & EQE_VALID_MASK) {
> +
> + AMAP_SET_BITS(struct amap_eq_entry, valid, eqe, 0);
> + queue_tail_inc(eq);
> + eqe = queue_tail_node(eq);
> + num_eq_processed++;
> + }
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 3/6] be2iscsi: Fix MCCQ posting for Mbx-Cmd after driver initialization is complete
2014-03-27 16:39 [PATCH 1/6] be2iscsi: Fix retrieving MCCQ_WRB in non-embedded Mbox path Jayamohan Kallickal
2014-03-27 16:39 ` [PATCH 2/6] be2iscsi: relinquishing control after processing 512 CQE Jayamohan Kallickal
@ 2014-03-27 16:39 ` Jayamohan Kallickal
2014-03-28 0:45 ` Mike Christie
2014-03-27 16:39 ` [PATCH 4/6] be2iscsi: Fix interrupt Coalescing mechanism Jayamohan Kallickal
` (3 subsequent siblings)
5 siblings, 1 reply; 15+ messages in thread
From: Jayamohan Kallickal @ 2014-03-27 16:39 UTC (permalink / raw)
To: jbottomley, linux-scsi, michaelc; +Cc: Jayamohan Kallickal, John Soni Jose
Even before probe for function was completed, iSCSI Daemon had initiated login
to target while OS was coming up. The targets which had node.startup=automatic,
login process was initiated.Since function specific initialization was still in
progress this lead to kernel panic.
The reson was MCCQ was not yet created and login Mbx_Cmd was sent on MCCQ.
wrb_from_mccq() failed with kernel-panic access.
In the fix checking in alloc_mcc_tag() if driver initialization is complete or not.
Based on the result driver continues or return with an Error.
Signed-off-by: John Soni Jose <sony.john-n@emulex.com>
Signed-off-by: Jayamohan Kallickal <Jayamohan.Kallickal@emulex.com>
---
drivers/scsi/be2iscsi/be_cmds.c | 8 ++++++++
drivers/scsi/be2iscsi/be_main.c | 2 ++
drivers/scsi/be2iscsi/be_main.h | 1 +
3 files changed, 11 insertions(+)
diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
index 1432ed5..4cabf5f 100644
--- a/drivers/scsi/be2iscsi/be_cmds.c
+++ b/drivers/scsi/be2iscsi/be_cmds.c
@@ -118,6 +118,14 @@ unsigned int alloc_mcc_tag(struct beiscsi_hba *phba)
{
unsigned int tag = 0;
+
+ if (phba->state & BE_ADAPTER_INIT_PHASE) {
+ beiscsi_log(phba, KERN_ERR,
+ BEISCSI_LOG_INIT | BEISCSI_LOG_CONFIG,
+ "BC_%d : Driver Initialization still in progress\n");
+ return tag;
+ }
+
if (phba->ctrl.mcc_tag_available) {
tag = phba->ctrl.mcc_tag[phba->ctrl.mcc_alloc_index];
phba->ctrl.mcc_tag[phba->ctrl.mcc_alloc_index] = 0;
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 0c9e270..317deee 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -598,6 +598,7 @@ static struct beiscsi_hba *beiscsi_hba_alloc(struct pci_dev *pcidev)
phba->pcidev = pci_dev_get(pcidev);
pci_set_drvdata(pcidev, phba);
phba->interface_handle = 0xFFFFFFFF;
+ phba->state = BE_ADAPTER_INIT_PHASE;
if (iscsi_host_add(shost, &phba->pcidev->dev))
goto free_devices;
@@ -5714,6 +5715,7 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev,
goto free_blkenbld;
}
hwi_enable_intr(phba);
+ phba->state &= ~BE_ADAPTER_INIT_PHASE;
if (beiscsi_setup_boot_info(phba))
/*
diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h
index d5901a7..581ebdb 100644
--- a/drivers/scsi/be2iscsi/be_main.h
+++ b/drivers/scsi/be2iscsi/be_main.h
@@ -105,6 +105,7 @@
#define BE_ADAPTER_LINK_DOWN 0x002
#define BE_ADAPTER_PCI_ERR 0x004
#define BE_ADAPTER_STATE_SHUTDOWN 0x008
+#define BE_ADAPTER_INIT_PHASE 0x8000
#define BEISCSI_CLEAN_UNLOAD 0x01
--
1.8.5.3
^ permalink raw reply related [flat|nested] 15+ messages in thread* Re: [PATCH 3/6] be2iscsi: Fix MCCQ posting for Mbx-Cmd after driver initialization is complete
2014-03-27 16:39 ` [PATCH 3/6] be2iscsi: Fix MCCQ posting for Mbx-Cmd after driver initialization is complete Jayamohan Kallickal
@ 2014-03-28 0:45 ` Mike Christie
2014-04-03 5:02 ` Jayamohan Kallickal
0 siblings, 1 reply; 15+ messages in thread
From: Mike Christie @ 2014-03-28 0:45 UTC (permalink / raw)
To: Jayamohan Kallickal, jbottomley, linux-scsi
Cc: Jayamohan Kallickal, John Soni Jose
On 03/27/2014 09:39 AM, Jayamohan Kallickal wrote:
> Even before probe for function was completed, iSCSI Daemon had initiated login
> to target while OS was coming up. The targets which had node.startup=automatic,
> login process was initiated.Since function specific initialization was still in
> progress this lead to kernel panic.
> The reson was MCCQ was not yet created and login Mbx_Cmd was sent on MCCQ.
> wrb_from_mccq() failed with kernel-panic access.
>
> In the fix checking in alloc_mcc_tag() if driver initialization is complete or not.
> Based on the result driver continues or return with an Error.
>
> Signed-off-by: John Soni Jose <sony.john-n@emulex.com>
> Signed-off-by: Jayamohan Kallickal <Jayamohan.Kallickal@emulex.com>
> ---
> drivers/scsi/be2iscsi/be_cmds.c | 8 ++++++++
> drivers/scsi/be2iscsi/be_main.c | 2 ++
> drivers/scsi/be2iscsi/be_main.h | 1 +
> 3 files changed, 11 insertions(+)
>
> diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
> index 1432ed5..4cabf5f 100644
> --- a/drivers/scsi/be2iscsi/be_cmds.c
> +++ b/drivers/scsi/be2iscsi/be_cmds.c
> @@ -118,6 +118,14 @@ unsigned int alloc_mcc_tag(struct beiscsi_hba *phba)
> {
> unsigned int tag = 0;
>
> +
> + if (phba->state & BE_ADAPTER_INIT_PHASE) {
> + beiscsi_log(phba, KERN_ERR,
> + BEISCSI_LOG_INIT | BEISCSI_LOG_CONFIG,
> + "BC_%d : Driver Initialization still in progress\n");
> + return tag;
> + }
> +
I think normally we do not call scsi_host_add and expose the host until
the driver can handle requests from entry points like sysfs and
queuecommand.
Can you just move iscsi_host_add from beiscsi_hba_alloc to
beiscsi_dev_probe after beiscsi_setup_boot_info is called?
^ permalink raw reply [flat|nested] 15+ messages in thread* RE: [PATCH 3/6] be2iscsi: Fix MCCQ posting for Mbx-Cmd after driver initialization is complete
2014-03-28 0:45 ` Mike Christie
@ 2014-04-03 5:02 ` Jayamohan Kallickal
2014-04-03 18:30 ` Mike Christie
0 siblings, 1 reply; 15+ messages in thread
From: Jayamohan Kallickal @ 2014-04-03 5:02 UTC (permalink / raw)
To: Mike Christie, Jayamohan Kallickal, jbottomley@parallels.com,
linux-scsi@vger.kernel.org
Cc: Sony John-N, cleech@redhat.com
-----Original Message-----
From: Mike Christie [mailto:michaelc@cs.wisc.edu]
Sent: Thursday, March 27, 2014 5:46 PM
To: Jayamohan Kallickal; jbottomley@parallels.com; linux-scsi@vger.kernel.org
Cc: Jayamohan Kallickal; Sony John-N
Subject: Re: [PATCH 3/6] be2iscsi: Fix MCCQ posting for Mbx-Cmd after driver initialization is complete
On 03/27/2014 09:39 AM, Jayamohan Kallickal wrote:
> Even before probe for function was completed, iSCSI Daemon had
> initiated login to target while OS was coming up. The targets which
> had node.startup=automatic, login process was initiated.Since
> function specific initialization was still in progress this lead to kernel panic.
> The reson was MCCQ was not yet created and login Mbx_Cmd was sent on MCCQ.
> wrb_from_mccq() failed with kernel-panic access.
>
> In the fix checking in alloc_mcc_tag() if driver initialization is complete or not.
> Based on the result driver continues or return with an Error.
>
> Signed-off-by: John Soni Jose <sony.john-n@emulex.com>
> Signed-off-by: Jayamohan Kallickal <Jayamohan.Kallickal@emulex.com>
> ---
> drivers/scsi/be2iscsi/be_cmds.c | 8 ++++++++
> drivers/scsi/be2iscsi/be_main.c | 2 ++
> drivers/scsi/be2iscsi/be_main.h | 1 +
> 3 files changed, 11 insertions(+)
>
> diff --git a/drivers/scsi/be2iscsi/be_cmds.c
> b/drivers/scsi/be2iscsi/be_cmds.c index 1432ed5..4cabf5f 100644
> --- a/drivers/scsi/be2iscsi/be_cmds.c
> +++ b/drivers/scsi/be2iscsi/be_cmds.c
> @@ -118,6 +118,14 @@ unsigned int alloc_mcc_tag(struct beiscsi_hba
> *phba) {
> unsigned int tag = 0;
>
> +
> + if (phba->state & BE_ADAPTER_INIT_PHASE) {
> + beiscsi_log(phba, KERN_ERR,
> + BEISCSI_LOG_INIT | BEISCSI_LOG_CONFIG,
> + "BC_%d : Driver Initialization still in progress\n");
> + return tag;
> + }
> +
>I think normally we do not call scsi_host_add and expose the host until the driver can handle requests from entry points like sysfs and queuecommand.
>Can you just move iscsi_host_add from beiscsi_hba_alloc to beiscsi_dev_probe after beiscsi_setup_boot_info is called?
Tried moving iscsi_add_host and it did not help the issue where the ep_connect was being called before the probe is completed.
Chris Leech has a solution for this and when applied along with this patch works for us.
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [PATCH 3/6] be2iscsi: Fix MCCQ posting for Mbx-Cmd after driver initialization is complete
2014-04-03 5:02 ` Jayamohan Kallickal
@ 2014-04-03 18:30 ` Mike Christie
2014-04-03 18:39 ` Mike Christie
0 siblings, 1 reply; 15+ messages in thread
From: Mike Christie @ 2014-04-03 18:30 UTC (permalink / raw)
To: Jayamohan Kallickal
Cc: Jayamohan Kallickal, jbottomley@parallels.com,
linux-scsi@vger.kernel.org, Sony John-N, cleech@redhat.com
On 04/03/2014 12:02 AM, Jayamohan Kallickal wrote:
>
>
> -----Original Message-----
> From: Mike Christie [mailto:michaelc@cs.wisc.edu]
> Sent: Thursday, March 27, 2014 5:46 PM
> To: Jayamohan Kallickal; jbottomley@parallels.com; linux-scsi@vger.kernel.org
> Cc: Jayamohan Kallickal; Sony John-N
> Subject: Re: [PATCH 3/6] be2iscsi: Fix MCCQ posting for Mbx-Cmd after driver initialization is complete
>
> On 03/27/2014 09:39 AM, Jayamohan Kallickal wrote:
>> Even before probe for function was completed, iSCSI Daemon had
>> initiated login to target while OS was coming up. The targets which
>> had node.startup=automatic, login process was initiated.Since
>> function specific initialization was still in progress this lead to kernel panic.
>> The reson was MCCQ was not yet created and login Mbx_Cmd was sent on MCCQ.
>> wrb_from_mccq() failed with kernel-panic access.
>>
>> In the fix checking in alloc_mcc_tag() if driver initialization is complete or not.
>> Based on the result driver continues or return with an Error.
>>
>> Signed-off-by: John Soni Jose <sony.john-n@emulex.com>
>> Signed-off-by: Jayamohan Kallickal <Jayamohan.Kallickal@emulex.com>
>> ---
>> drivers/scsi/be2iscsi/be_cmds.c | 8 ++++++++
>> drivers/scsi/be2iscsi/be_main.c | 2 ++
>> drivers/scsi/be2iscsi/be_main.h | 1 +
>> 3 files changed, 11 insertions(+)
>>
>> diff --git a/drivers/scsi/be2iscsi/be_cmds.c
>> b/drivers/scsi/be2iscsi/be_cmds.c index 1432ed5..4cabf5f 100644
>> --- a/drivers/scsi/be2iscsi/be_cmds.c
>> +++ b/drivers/scsi/be2iscsi/be_cmds.c
>> @@ -118,6 +118,14 @@ unsigned int alloc_mcc_tag(struct beiscsi_hba
>> *phba) {
>> unsigned int tag = 0;
>>
>> +
>> + if (phba->state & BE_ADAPTER_INIT_PHASE) {
>> + beiscsi_log(phba, KERN_ERR,
>> + BEISCSI_LOG_INIT | BEISCSI_LOG_CONFIG,
>> + "BC_%d : Driver Initialization still in progress\n");
>> + return tag;
>> + }
>> +
>
>> I think normally we do not call scsi_host_add and expose the host until the driver can handle requests from entry points like sysfs and queuecommand.
>
>> Can you just move iscsi_host_add from beiscsi_hba_alloc to beiscsi_dev_probe after beiscsi_setup_boot_info is called?
>
> Tried moving iscsi_add_host and it did not help the issue where the ep_connect was being called before the probe is completed.
>
> Chris Leech has a solution for this and when applied along with this patch works for us.
>
Did you test the host add solution with Chris's fix? With your patch and
Chris's patch __session_create will return error. iscsiadm would then
retry and eventually the host would be added. With your patch,
__session_create -> iscsi_sysfs_get_host_no_from_hwinfo would probably
fail, because iscsid tries to read a host attr and gets a error because
the host is not yet setup.
If you move the host add and uses Chris's patch then something similar
should happen. The host will not even be in sysfs yet, so
iscsi_sysfs_get_host_no_from_hwinfo will fail. __session_create will
return error and iscsiadm will retry.
For what I am suggesting you do not need "if full_init" tests in every
driver. The host is not added until it is actually setup.
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [PATCH 3/6] be2iscsi: Fix MCCQ posting for Mbx-Cmd after driver initialization is complete
2014-04-03 18:30 ` Mike Christie
@ 2014-04-03 18:39 ` Mike Christie
0 siblings, 0 replies; 15+ messages in thread
From: Mike Christie @ 2014-04-03 18:39 UTC (permalink / raw)
To: Jayamohan Kallickal
Cc: Jayamohan Kallickal, jbottomley@parallels.com,
linux-scsi@vger.kernel.org, Sony John-N, cleech@redhat.com
On 04/03/2014 01:30 PM, Mike Christie wrote:
> On 04/03/2014 12:02 AM, Jayamohan Kallickal wrote:
>>
>>
>> -----Original Message-----
>> From: Mike Christie [mailto:michaelc@cs.wisc.edu]
>> Sent: Thursday, March 27, 2014 5:46 PM
>> To: Jayamohan Kallickal; jbottomley@parallels.com; linux-scsi@vger.kernel.org
>> Cc: Jayamohan Kallickal; Sony John-N
>> Subject: Re: [PATCH 3/6] be2iscsi: Fix MCCQ posting for Mbx-Cmd after driver initialization is complete
>>
>> On 03/27/2014 09:39 AM, Jayamohan Kallickal wrote:
>>> Even before probe for function was completed, iSCSI Daemon had
>>> initiated login to target while OS was coming up. The targets which
>>> had node.startup=automatic, login process was initiated.Since
>>> function specific initialization was still in progress this lead to kernel panic.
>>> The reson was MCCQ was not yet created and login Mbx_Cmd was sent on MCCQ.
>>> wrb_from_mccq() failed with kernel-panic access.
>>>
>>> In the fix checking in alloc_mcc_tag() if driver initialization is complete or not.
>>> Based on the result driver continues or return with an Error.
>>>
>>> Signed-off-by: John Soni Jose <sony.john-n@emulex.com>
>>> Signed-off-by: Jayamohan Kallickal <Jayamohan.Kallickal@emulex.com>
>>> ---
>>> drivers/scsi/be2iscsi/be_cmds.c | 8 ++++++++
>>> drivers/scsi/be2iscsi/be_main.c | 2 ++
>>> drivers/scsi/be2iscsi/be_main.h | 1 +
>>> 3 files changed, 11 insertions(+)
>>>
>>> diff --git a/drivers/scsi/be2iscsi/be_cmds.c
>>> b/drivers/scsi/be2iscsi/be_cmds.c index 1432ed5..4cabf5f 100644
>>> --- a/drivers/scsi/be2iscsi/be_cmds.c
>>> +++ b/drivers/scsi/be2iscsi/be_cmds.c
>>> @@ -118,6 +118,14 @@ unsigned int alloc_mcc_tag(struct beiscsi_hba
>>> *phba) {
>>> unsigned int tag = 0;
>>>
>>> +
>>> + if (phba->state & BE_ADAPTER_INIT_PHASE) {
>>> + beiscsi_log(phba, KERN_ERR,
>>> + BEISCSI_LOG_INIT | BEISCSI_LOG_CONFIG,
>>> + "BC_%d : Driver Initialization still in progress\n");
>>> + return tag;
>>> + }
>>> +
>>
>>> I think normally we do not call scsi_host_add and expose the host until the driver can handle requests from entry points like sysfs and queuecommand.
>>
>>> Can you just move iscsi_host_add from beiscsi_hba_alloc to beiscsi_dev_probe after beiscsi_setup_boot_info is called?
>>
>> Tried moving iscsi_add_host and it did not help the issue where the ep_connect was being called before the probe is completed.
>>
>> Chris Leech has a solution for this and when applied along with this patch works for us.
>>
>
> Did you test the host add solution with Chris's fix? With your patch and
> Chris's patch __session_create will return error. iscsiadm would then
> retry and eventually the host would be added. With your patch,
> __session_create -> iscsi_sysfs_get_host_no_from_hwinfo would probably
> fail, because iscsid tries to read a host attr and gets a error because
> the host is not yet setup.
>
> If you move the host add and uses Chris's patch then something similar
> should happen. The host will not even be in sysfs yet, so
> iscsi_sysfs_get_host_no_from_hwinfo will fail. __session_create will
> return error and iscsiadm will retry.
>
> For what I am suggesting you do not need "if full_init" tests in every
> driver. The host is not added until it is actually setup.
>
Hey, also the thing about some of the traces in the rh bz is that you
are getting a oops when iscsid reads a sysfs attr
https://bugzilla.redhat.com/show_bug.cgi?id=1081798#c5
That is not a problem with ep_connect being called too soon. That is a
issue with exposing the host before the driver has setup the host. For
that case you should move the host add and that should fix that problem.
For the other problem Chris is fixing where the wrong ep connect cmd is
called and a null host is passed down it seems be2iscsi already catches
that. Chris's patch is still needed so iscsid does the right thing. Just
saying we are mixing different issues.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 4/6] be2iscsi: Fix interrupt Coalescing mechanism.
2014-03-27 16:39 [PATCH 1/6] be2iscsi: Fix retrieving MCCQ_WRB in non-embedded Mbox path Jayamohan Kallickal
2014-03-27 16:39 ` [PATCH 2/6] be2iscsi: relinquishing control after processing 512 CQE Jayamohan Kallickal
2014-03-27 16:39 ` [PATCH 3/6] be2iscsi: Fix MCCQ posting for Mbx-Cmd after driver initialization is complete Jayamohan Kallickal
@ 2014-03-27 16:39 ` Jayamohan Kallickal
2014-03-27 16:39 ` [PATCH 5/6] be2iscsi: Fix TCP parameters while connection offloading Jayamohan Kallickal
` (2 subsequent siblings)
5 siblings, 0 replies; 15+ messages in thread
From: Jayamohan Kallickal @ 2014-03-27 16:39 UTC (permalink / raw)
To: jbottomley, linux-scsi, michaelc
Cc: Jayamohan Kallickal, Minh Tran, John Soni Jose
This patch fixes lack of support for interrupt moderation.
This moderates the coalescing based on the rate of IO Completion
Signed-off-by: Minh Tran <minhduc.tran@emulex.com>
Signed-off-by: John Soni Jose <sony.john-n@emulex.com>
Signed-off-by: Jayamohan Kallickal <Jayamohan.Kallickal@emulex.com>
---
drivers/scsi/be2iscsi/be.h | 11 ++++++++
drivers/scsi/be2iscsi/be_cmds.h | 10 ++++++-
drivers/scsi/be2iscsi/be_main.c | 58 +++++++++++++++++++++++++++++++++++++++--
drivers/scsi/be2iscsi/be_main.h | 5 ++--
drivers/scsi/be2iscsi/be_mgmt.c | 37 ++++++++++++++++++++++++++
drivers/scsi/be2iscsi/be_mgmt.h | 2 ++
6 files changed, 118 insertions(+), 5 deletions(-)
diff --git a/drivers/scsi/be2iscsi/be.h b/drivers/scsi/be2iscsi/be.h
index 1bfb0bd..25c2164 100644
--- a/drivers/scsi/be2iscsi/be.h
+++ b/drivers/scsi/be2iscsi/be.h
@@ -83,9 +83,20 @@ static inline void queue_tail_inc(struct be_queue_info *q)
/*ISCSI */
+struct be_aic_obj { /* Adaptive interrupt coalescing (AIC) info */
+ bool enable;
+ u32 min_eqd; /* in usecs */
+ u32 max_eqd; /* in usecs */
+ u32 prev_eqd; /* in usecs */
+ u32 et_eqd; /* configured val when aic is off */
+ ulong time_val;
+ u64 eq_prev; /* Used to calculate eqe */
+};
+
struct be_eq_obj {
bool todo_mcc_cq;
bool todo_cq;
+ u32 cq_count;
struct be_queue_info q;
struct beiscsi_hba *phba;
struct be_queue_info *cq;
diff --git a/drivers/scsi/be2iscsi/be_cmds.h b/drivers/scsi/be2iscsi/be_cmds.h
index 7cf7f99..cd4410f 100644
--- a/drivers/scsi/be2iscsi/be_cmds.h
+++ b/drivers/scsi/be2iscsi/be_cmds.h
@@ -271,6 +271,12 @@ struct be_cmd_resp_eq_create {
u16 rsvd0; /* sword */
} __packed;
+struct be_set_eqd {
+ u32 eq_id;
+ u32 phase;
+ u32 delay_multiplier;
+} __packed;
+
struct mgmt_chap_format {
u32 flags;
u8 intr_chap_name[256];
@@ -622,7 +628,7 @@ struct be_cmd_req_modify_eq_delay {
u32 eq_id;
u32 phase;
u32 delay_multiplier;
- } delay[8];
+ } delay[MAX_CPUS];
} __packed;
/******************** Get MAC ADDR *******************/
@@ -708,6 +714,8 @@ unsigned int be_cmd_get_port_speed(struct beiscsi_hba *phba);
void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag);
+int be_cmd_modify_eq_delay(struct beiscsi_hba *phba, struct be_set_eqd *,
+ int num);
int beiscsi_mccq_compl(struct beiscsi_hba *phba,
uint32_t tag, struct be_mcc_wrb **wrb,
struct be_dma_mem *mbx_cmd_mem);
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 317deee..4e7eded 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -2346,6 +2346,7 @@ static int be_iopoll(struct blk_iopoll *iop, int budget)
hwi_ring_eq_db(phba, eq->id, 1, num_eq_processed, 0, 1);
ret = beiscsi_process_cq(pbe_eq);
+ pbe_eq->cq_count += ret;
if (ret < budget) {
blk_iopoll_complete(iop);
beiscsi_log(phba, KERN_INFO,
@@ -3899,9 +3900,9 @@ static int hwi_init_port(struct beiscsi_hba *phba)
phwi_ctrlr = phba->phwi_ctrlr;
phwi_context = phwi_ctrlr->phwi_ctxt;
- phwi_context->max_eqd = 0;
+ phwi_context->max_eqd = 128;
phwi_context->min_eqd = 0;
- phwi_context->cur_eqd = 64;
+ phwi_context->cur_eqd = 0;
be_cmd_fw_initialize(&phba->ctrl);
status = beiscsi_create_eqs(phba, phwi_context);
@@ -5357,6 +5358,57 @@ static void beiscsi_msix_enable(struct beiscsi_hba *phba)
return;
}
+static void be_eqd_update(struct beiscsi_hba *phba)
+{
+ struct be_set_eqd set_eqd[MAX_CPUS];
+ struct be_aic_obj *aic;
+ struct be_eq_obj *pbe_eq;
+ struct hwi_controller *phwi_ctrlr;
+ struct hwi_context_memory *phwi_context;
+ int eqd, i, num = 0;
+ ulong now;
+ u32 pps, delta;
+ unsigned int tag;
+
+ phwi_ctrlr = phba->phwi_ctrlr;
+ phwi_context = phwi_ctrlr->phwi_ctxt;
+
+ for (i = 0; i <= phba->num_cpus; i++) {
+ aic = &phba->aic_obj[i];
+ pbe_eq = &phwi_context->be_eq[i];
+ now = jiffies;
+ if (!aic->time_val || time_before(now, aic->time_val) ||
+ pbe_eq->cq_count < aic->eq_prev) {
+ aic->time_val = now;
+ aic->eq_prev = pbe_eq->cq_count;
+ continue;
+ }
+ delta = jiffies_to_msecs(now - aic->time_val);
+ pps = (((u32)(pbe_eq->cq_count - aic->eq_prev) * 1000) / delta);
+ eqd = (pps / 1500) << 2;
+
+ if (eqd < 8)
+ eqd = 0;
+ eqd = min_t(u32, eqd, phwi_context->max_eqd);
+ eqd = max_t(u32, eqd, phwi_context->min_eqd);
+
+ aic->time_val = now;
+ aic->eq_prev = pbe_eq->cq_count;
+
+ if (eqd != aic->prev_eqd) {
+ set_eqd[num].delay_multiplier = (eqd * 65)/100;
+ set_eqd[num].eq_id = pbe_eq->q.id;
+ aic->prev_eqd = eqd;
+ num++;
+ }
+ }
+ if (num) {
+ tag = be_cmd_modify_eq_delay(phba, set_eqd, num);
+ if (tag)
+ beiscsi_mccq_compl(phba, tag, NULL, NULL);
+ }
+}
+
/*
* beiscsi_hw_health_check()- Check adapter health
* @work: work item to check HW health
@@ -5370,6 +5422,8 @@ beiscsi_hw_health_check(struct work_struct *work)
container_of(work, struct beiscsi_hba,
beiscsi_hw_check_task.work);
+ be_eqd_update(phba);
+
beiscsi_ue_detect(phba);
schedule_delayed_work(&phba->beiscsi_hw_check_task,
diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h
index 581ebdb..b3716e3 100644
--- a/drivers/scsi/be2iscsi/be_main.h
+++ b/drivers/scsi/be2iscsi/be_main.h
@@ -72,8 +72,8 @@
#define BEISCSI_SGLIST_ELEMENTS 30
-#define BEISCSI_CMD_PER_LUN 128 /* scsi_host->cmd_per_lun */
-#define BEISCSI_MAX_SECTORS 2048 /* scsi_host->max_sectors */
+#define BEISCSI_CMD_PER_LUN 128 /* scsi_host->cmd_per_lun */
+#define BEISCSI_MAX_SECTORS 1024 /* scsi_host->max_sectors */
#define BEISCSI_TEMPLATE_HDR_PER_CXN_SIZE 128 /* Template size per cxn */
#define BEISCSI_MAX_CMD_LEN 16 /* scsi_host->max_cmd_len */
@@ -429,6 +429,7 @@ struct beiscsi_hba {
struct mgmt_session_info boot_sess;
struct invalidate_command_table inv_tbl[128];
+ struct be_aic_obj aic_obj[MAX_CPUS];
unsigned int attr_log_enable;
int (*iotask_fn)(struct iscsi_task *,
struct scatterlist *sg,
diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c
index 712911f..52a36fb 100644
--- a/drivers/scsi/be2iscsi/be_mgmt.c
+++ b/drivers/scsi/be2iscsi/be_mgmt.c
@@ -155,6 +155,43 @@ void beiscsi_ue_detect(struct beiscsi_hba *phba)
}
}
+int be_cmd_modify_eq_delay(struct beiscsi_hba *phba,
+ struct be_set_eqd *set_eqd, int num)
+{
+ struct be_ctrl_info *ctrl = &phba->ctrl;
+ struct be_mcc_wrb *wrb;
+ struct be_cmd_req_modify_eq_delay *req;
+ unsigned int tag = 0;
+ int i;
+
+ spin_lock(&ctrl->mbox_lock);
+ tag = alloc_mcc_tag(phba);
+ if (!tag) {
+ spin_unlock(&ctrl->mbox_lock);
+ return tag;
+ }
+
+ wrb = wrb_from_mccq(phba);
+ req = embedded_payload(wrb);
+
+ wrb->tag0 |= tag;
+ be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
+ be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
+ OPCODE_COMMON_MODIFY_EQ_DELAY, sizeof(*req));
+
+ req->num_eq = cpu_to_le32(num);
+ for (i = 0; i < num; i++) {
+ req->delay[i].eq_id = cpu_to_le32(set_eqd[i].eq_id);
+ req->delay[i].phase = 0;
+ req->delay[i].delay_multiplier =
+ cpu_to_le32(set_eqd[i].delay_multiplier);
+ }
+
+ be_mcc_notify(phba);
+ spin_unlock(&ctrl->mbox_lock);
+ return tag;
+}
+
/**
* mgmt_reopen_session()- Reopen a session based on reopen_type
* @phba: Device priv structure instance
diff --git a/drivers/scsi/be2iscsi/be_mgmt.h b/drivers/scsi/be2iscsi/be_mgmt.h
index 01b8c97..24a8fc5 100644
--- a/drivers/scsi/be2iscsi/be_mgmt.h
+++ b/drivers/scsi/be2iscsi/be_mgmt.h
@@ -335,5 +335,7 @@ void beiscsi_offload_cxn_v0(struct beiscsi_offload_params *params,
void beiscsi_offload_cxn_v2(struct beiscsi_offload_params *params,
struct wrb_handle *pwrb_handle);
void beiscsi_ue_detect(struct beiscsi_hba *phba);
+int be_cmd_modify_eq_delay(struct beiscsi_hba *phba,
+ struct be_set_eqd *, int num);
#endif
--
1.8.5.3
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH 5/6] be2iscsi: Fix TCP parameters while connection offloading.
2014-03-27 16:39 [PATCH 1/6] be2iscsi: Fix retrieving MCCQ_WRB in non-embedded Mbox path Jayamohan Kallickal
` (2 preceding siblings ...)
2014-03-27 16:39 ` [PATCH 4/6] be2iscsi: Fix interrupt Coalescing mechanism Jayamohan Kallickal
@ 2014-03-27 16:39 ` Jayamohan Kallickal
2014-03-31 4:53 ` Mike Christie
2014-03-27 16:39 ` [PATCH 6/6] be2iscsi: Bump the driver version Jayamohan Kallickal
2014-03-27 16:39 ` [PATCH 0/6] be2iscsi: Update to 10.2.218.0 Jayamohan Kallickal
5 siblings, 1 reply; 15+ messages in thread
From: Jayamohan Kallickal @ 2014-03-27 16:39 UTC (permalink / raw)
To: jbottomley, linux-scsi, michaelc
Cc: Jayamohan Kallickal, Minh Tran, John Soni Jose
SKH-R adapter, TCP Window Size/Scale parameters are passed
in TCP Connection Offload Mbx Command.
Signed-off-by: Minh Tran <minhduc.tran@emulex.com>
Signed-off-by: John Soni Jose <sony.john-n@emulex.com>
Signed-off-by: Jayamohan Kallickal <Jayamohan.Kallickal@emulex.com>
---
drivers/scsi/be2iscsi/be_cmds.h | 20 ++++++++
drivers/scsi/be2iscsi/be_iscsi.c | 19 +++++--
drivers/scsi/be2iscsi/be_mgmt.c | 104 +++++++++++++++++++++++++++++++++++++++
drivers/scsi/be2iscsi/be_mgmt.h | 5 ++
4 files changed, 144 insertions(+), 4 deletions(-)
diff --git a/drivers/scsi/be2iscsi/be_cmds.h b/drivers/scsi/be2iscsi/be_cmds.h
index cd4410f..1cef380 100644
--- a/drivers/scsi/be2iscsi/be_cmds.h
+++ b/drivers/scsi/be2iscsi/be_cmds.h
@@ -1013,6 +1013,26 @@ struct tcp_connect_and_offload_in {
u8 rsvd0[3];
} __packed;
+struct tcp_connect_and_offload_in_v1 {
+ struct be_cmd_req_hdr hdr;
+ struct ip_addr_format ip_address;
+ u16 tcp_port;
+ u16 cid;
+ u16 cq_id;
+ u16 defq_id;
+ struct phys_addr dataout_template_pa;
+ u16 hdr_ring_id;
+ u16 data_ring_id;
+ u8 do_offload;
+ u8 rsvd0[3];
+ u16 tcp_window_size;
+ u8 tcp_window_scale_count;
+ u8 rsvd1;
+#define BEISCSI_TCP_MSS_MASK 0x1FFFFFF /* bits 0 - 24 */
+ u32 tcp_mss;
+ u8 rsvd2;
+} __packed;
+
struct tcp_connect_and_offload_out {
struct be_cmd_resp_hdr hdr;
u32 connection_handle;
diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c
index a3df433..9fe7804 100644
--- a/drivers/scsi/be2iscsi/be_iscsi.c
+++ b/drivers/scsi/be2iscsi/be_iscsi.c
@@ -1106,7 +1106,7 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
struct beiscsi_hba *phba = beiscsi_ep->phba;
struct tcp_connect_and_offload_out *ptcpcnct_out;
struct be_dma_mem nonemb_cmd;
- unsigned int tag;
+ unsigned int tag, req_memsize;
int ret = -ENOMEM;
beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
@@ -1127,8 +1127,14 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
(beiscsi_ep->ep_cid)] = ep;
beiscsi_ep->cid_vld = 0;
+
+ if (is_chip_be2_be3r(phba))
+ req_memsize = sizeof(struct tcp_connect_and_offload_in);
+ else
+ req_memsize = sizeof(struct tcp_connect_and_offload_in_v1);
+
nonemb_cmd.va = pci_alloc_consistent(phba->ctrl.pdev,
- sizeof(struct tcp_connect_and_offload_in),
+ req_memsize,
&nonemb_cmd.dma);
if (nonemb_cmd.va == NULL) {
@@ -1139,9 +1145,14 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
beiscsi_free_ep(beiscsi_ep);
return -ENOMEM;
}
- nonemb_cmd.size = sizeof(struct tcp_connect_and_offload_in);
+ nonemb_cmd.size = req_memsize;
memset(nonemb_cmd.va, 0, nonemb_cmd.size);
- tag = mgmt_open_connection(phba, dst_addr, beiscsi_ep, &nonemb_cmd);
+ if (is_chip_be2_be3r(phba))
+ tag = mgmt_open_connection(phba, dst_addr,
+ beiscsi_ep, &nonemb_cmd);
+ else
+ tag = mgmt_open_connection_v1(phba, dst_addr,
+ beiscsi_ep, &nonemb_cmd);
if (tag <= 0) {
beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
"BS_%d : mgmt_open_connection Failed for cid=%d\n",
diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c
index 52a36fb..6756def 100644
--- a/drivers/scsi/be2iscsi/be_mgmt.c
+++ b/drivers/scsi/be2iscsi/be_mgmt.c
@@ -794,6 +794,110 @@ int mgmt_open_connection(struct beiscsi_hba *phba,
sge->pa_hi = cpu_to_le32(upper_32_bits(nonemb_cmd->dma));
sge->pa_lo = cpu_to_le32(nonemb_cmd->dma & 0xFFFFFFFF);
sge->len = cpu_to_le32(nonemb_cmd->size);
+
+ be_mcc_notify(phba);
+ spin_unlock(&ctrl->mbox_lock);
+ return tag;
+}
+
+int mgmt_open_connection_v1(struct beiscsi_hba *phba,
+ struct sockaddr *dst_addr,
+ struct beiscsi_endpoint *beiscsi_ep,
+ struct be_dma_mem *nonemb_cmd)
+{
+ struct hwi_controller *phwi_ctrlr;
+ struct hwi_context_memory *phwi_context;
+ struct sockaddr_in *daddr_in = (struct sockaddr_in *)dst_addr;
+ struct sockaddr_in6 *daddr_in6 = (struct sockaddr_in6 *)dst_addr;
+ struct be_ctrl_info *ctrl = &phba->ctrl;
+ struct be_mcc_wrb *wrb;
+ struct tcp_connect_and_offload_in_v1 *req;
+ unsigned short def_hdr_id;
+ unsigned short def_data_id;
+ struct phys_addr template_address = { 0, 0 };
+ struct phys_addr *ptemplate_address;
+ unsigned int tag = 0;
+ unsigned int i, ulp_num;
+ unsigned short cid = beiscsi_ep->ep_cid;
+ struct be_sge *sge;
+
+ phwi_ctrlr = phba->phwi_ctrlr;
+ phwi_context = phwi_ctrlr->phwi_ctxt;
+
+ ulp_num = phwi_ctrlr->wrb_context[BE_GET_CRI_FROM_CID(cid)].ulp_num;
+
+ def_hdr_id = (unsigned short)HWI_GET_DEF_HDRQ_ID(phba, ulp_num);
+ def_data_id = (unsigned short)HWI_GET_DEF_BUFQ_ID(phba, ulp_num);
+
+ ptemplate_address = &template_address;
+ ISCSI_GET_PDU_TEMPLATE_ADDRESS(phba, ptemplate_address);
+ spin_lock(&ctrl->mbox_lock);
+ tag = alloc_mcc_tag(phba);
+ if (!tag) {
+ spin_unlock(&ctrl->mbox_lock);
+ return tag;
+ }
+ wrb = wrb_from_mccq(phba);
+ sge = nonembedded_sgl(wrb);
+
+ req = nonemb_cmd->va;
+ memset(req, 0, sizeof(*req));
+ wrb->tag0 |= tag;
+
+ be_wrb_hdr_prepare(wrb, sizeof(*req), false, 1);
+ be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI,
+ OPCODE_COMMON_ISCSI_TCP_CONNECT_AND_OFFLOAD,
+ sizeof(*req));
+ if (dst_addr->sa_family == PF_INET) {
+ __be32 s_addr = daddr_in->sin_addr.s_addr;
+ req->ip_address.ip_type = BE2_IPV4;
+ req->ip_address.addr[0] = s_addr & 0x000000ff;
+ req->ip_address.addr[1] = (s_addr & 0x0000ff00) >> 8;
+ req->ip_address.addr[2] = (s_addr & 0x00ff0000) >> 16;
+ req->ip_address.addr[3] = (s_addr & 0xff000000) >> 24;
+ req->tcp_port = ntohs(daddr_in->sin_port);
+ beiscsi_ep->dst_addr = daddr_in->sin_addr.s_addr;
+ beiscsi_ep->dst_tcpport = ntohs(daddr_in->sin_port);
+ beiscsi_ep->ip_type = BE2_IPV4;
+ } else if (dst_addr->sa_family == PF_INET6) {
+ req->ip_address.ip_type = BE2_IPV6;
+ memcpy(&req->ip_address.addr,
+ &daddr_in6->sin6_addr.in6_u.u6_addr8, 16);
+ req->tcp_port = ntohs(daddr_in6->sin6_port);
+ beiscsi_ep->dst_tcpport = ntohs(daddr_in6->sin6_port);
+ memcpy(&beiscsi_ep->dst6_addr,
+ &daddr_in6->sin6_addr.in6_u.u6_addr8, 16);
+ beiscsi_ep->ip_type = BE2_IPV6;
+ } else{
+ beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
+ "BG_%d : unknown addr family %d\n",
+ dst_addr->sa_family);
+ spin_unlock(&ctrl->mbox_lock);
+ free_mcc_tag(&phba->ctrl, tag);
+ return -EINVAL;
+
+ }
+ req->cid = cid;
+ i = phba->nxt_cqid++;
+ if (phba->nxt_cqid == phba->num_cpus)
+ phba->nxt_cqid = 0;
+ req->cq_id = phwi_context->be_cq[i].id;
+ beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
+ "BG_%d : i=%d cq_id=%d\n", i, req->cq_id);
+ req->defq_id = def_hdr_id;
+ req->hdr_ring_id = def_hdr_id;
+ req->data_ring_id = def_data_id;
+ req->do_offload = 1;
+ req->dataout_template_pa.lo = ptemplate_address->lo;
+ req->dataout_template_pa.hi = ptemplate_address->hi;
+ sge->pa_hi = cpu_to_le32(upper_32_bits(nonemb_cmd->dma));
+ sge->pa_lo = cpu_to_le32(nonemb_cmd->dma & 0xFFFFFFFF);
+ sge->len = cpu_to_le32(nonemb_cmd->size);
+
+ req->hdr.version = 1;
+ req->tcp_window_size = 0;
+ req->tcp_window_scale_count = 2;
+
be_mcc_notify(phba);
spin_unlock(&ctrl->mbox_lock);
return tag;
diff --git a/drivers/scsi/be2iscsi/be_mgmt.h b/drivers/scsi/be2iscsi/be_mgmt.h
index 24a8fc5..02f2fdd 100644
--- a/drivers/scsi/be2iscsi/be_mgmt.h
+++ b/drivers/scsi/be2iscsi/be_mgmt.h
@@ -102,6 +102,11 @@ int mgmt_open_connection(struct beiscsi_hba *phba,
struct beiscsi_endpoint *beiscsi_ep,
struct be_dma_mem *nonemb_cmd);
+int mgmt_open_connection_v1(struct beiscsi_hba *phba,
+ struct sockaddr *dst_addr,
+ struct beiscsi_endpoint *beiscsi_ep,
+ struct be_dma_mem *nonemb_cmd);
+
unsigned int mgmt_upload_connection(struct beiscsi_hba *phba,
unsigned short cid,
unsigned int upload_flag);
--
1.8.5.3
^ permalink raw reply related [flat|nested] 15+ messages in thread* Re: [PATCH 5/6] be2iscsi: Fix TCP parameters while connection offloading.
2014-03-27 16:39 ` [PATCH 5/6] be2iscsi: Fix TCP parameters while connection offloading Jayamohan Kallickal
@ 2014-03-31 4:53 ` Mike Christie
2014-04-03 5:02 ` Jayamohan Kallickal
0 siblings, 1 reply; 15+ messages in thread
From: Mike Christie @ 2014-03-31 4:53 UTC (permalink / raw)
To: Jayamohan Kallickal
Cc: jbottomley, linux-scsi, Jayamohan Kallickal, Minh Tran,
John Soni Jose
On 03/27/2014 11:39 AM, Jayamohan Kallickal wrote:
> +int mgmt_open_connection_v1(struct beiscsi_hba *phba,
> + struct sockaddr *dst_addr,
> + struct beiscsi_endpoint *beiscsi_ep,
> + struct be_dma_mem *nonemb_cmd)
> +{
> + struct hwi_controller *phwi_ctrlr;
> + struct hwi_context_memory *phwi_context;
> + struct sockaddr_in *daddr_in = (struct sockaddr_in *)dst_addr;
> + struct sockaddr_in6 *daddr_in6 = (struct sockaddr_in6 *)dst_addr;
> + struct be_ctrl_info *ctrl = &phba->ctrl;
> + struct be_mcc_wrb *wrb;
> + struct tcp_connect_and_offload_in_v1 *req;
> + unsigned short def_hdr_id;
> + unsigned short def_data_id;
> + struct phys_addr template_address = { 0, 0 };
> + struct phys_addr *ptemplate_address;
> + unsigned int tag = 0;
> + unsigned int i, ulp_num;
> + unsigned short cid = beiscsi_ep->ep_cid;
> + struct be_sge *sge;
> +
> + phwi_ctrlr = phba->phwi_ctrlr;
> + phwi_context = phwi_ctrlr->phwi_ctxt;
> +
> + ulp_num = phwi_ctrlr->wrb_context[BE_GET_CRI_FROM_CID(cid)].ulp_num;
> +
> + def_hdr_id = (unsigned short)HWI_GET_DEF_HDRQ_ID(phba, ulp_num);
> + def_data_id = (unsigned short)HWI_GET_DEF_BUFQ_ID(phba, ulp_num);
> +
> + ptemplate_address = &template_address;
> + ISCSI_GET_PDU_TEMPLATE_ADDRESS(phba, ptemplate_address);
> + spin_lock(&ctrl->mbox_lock);
> + tag = alloc_mcc_tag(phba);
> + if (!tag) {
> + spin_unlock(&ctrl->mbox_lock);
> + return tag;
> + }
> + wrb = wrb_from_mccq(phba);
> + sge = nonembedded_sgl(wrb);
> +
> + req = nonemb_cmd->va;
> + memset(req, 0, sizeof(*req));
> + wrb->tag0 |= tag;
> +
> + be_wrb_hdr_prepare(wrb, sizeof(*req), false, 1);
> + be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI,
> + OPCODE_COMMON_ISCSI_TCP_CONNECT_AND_OFFLOAD,
> + sizeof(*req));
> + if (dst_addr->sa_family == PF_INET) {
> + __be32 s_addr = daddr_in->sin_addr.s_addr;
> + req->ip_address.ip_type = BE2_IPV4;
> + req->ip_address.addr[0] = s_addr & 0x000000ff;
> + req->ip_address.addr[1] = (s_addr & 0x0000ff00) >> 8;
> + req->ip_address.addr[2] = (s_addr & 0x00ff0000) >> 16;
> + req->ip_address.addr[3] = (s_addr & 0xff000000) >> 24;
> + req->tcp_port = ntohs(daddr_in->sin_port);
> + beiscsi_ep->dst_addr = daddr_in->sin_addr.s_addr;
> + beiscsi_ep->dst_tcpport = ntohs(daddr_in->sin_port);
> + beiscsi_ep->ip_type = BE2_IPV4;
> + } else if (dst_addr->sa_family == PF_INET6) {
> + req->ip_address.ip_type = BE2_IPV6;
> + memcpy(&req->ip_address.addr,
> + &daddr_in6->sin6_addr.in6_u.u6_addr8, 16);
> + req->tcp_port = ntohs(daddr_in6->sin6_port);
> + beiscsi_ep->dst_tcpport = ntohs(daddr_in6->sin6_port);
> + memcpy(&beiscsi_ep->dst6_addr,
> + &daddr_in6->sin6_addr.in6_u.u6_addr8, 16);
> + beiscsi_ep->ip_type = BE2_IPV6;
> + } else{
> + beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
> + "BG_%d : unknown addr family %d\n",
> + dst_addr->sa_family);
> + spin_unlock(&ctrl->mbox_lock);
> + free_mcc_tag(&phba->ctrl, tag);
> + return -EINVAL;
> +
> + }
> + req->cid = cid;
> + i = phba->nxt_cqid++;
> + if (phba->nxt_cqid == phba->num_cpus)
> + phba->nxt_cqid = 0;
> + req->cq_id = phwi_context->be_cq[i].id;
> + beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
> + "BG_%d : i=%d cq_id=%d\n", i, req->cq_id);
> + req->defq_id = def_hdr_id;
> + req->hdr_ring_id = def_hdr_id;
> + req->data_ring_id = def_data_id;
> + req->do_offload = 1;
> + req->dataout_template_pa.lo = ptemplate_address->lo;
> + req->dataout_template_pa.hi = ptemplate_address->hi;
> + sge->pa_hi = cpu_to_le32(upper_32_bits(nonemb_cmd->dma));
> + sge->pa_lo = cpu_to_le32(nonemb_cmd->dma & 0xFFFFFFFF);
> + sge->len = cpu_to_le32(nonemb_cmd->size);
> +
> + req->hdr.version = 1;
> + req->tcp_window_size = 0;
> + req->tcp_window_scale_count = 2;
Is this approx 100 lines exactly the same as mgmt_open_connection except
these 3 lines? Maybe a lib/helper function that does the common 100
lines then some v1 function over that which does the extra 3 lines.
^ permalink raw reply [flat|nested] 15+ messages in thread* RE: [PATCH 5/6] be2iscsi: Fix TCP parameters while connection offloading.
2014-03-31 4:53 ` Mike Christie
@ 2014-04-03 5:02 ` Jayamohan Kallickal
0 siblings, 0 replies; 15+ messages in thread
From: Jayamohan Kallickal @ 2014-04-03 5:02 UTC (permalink / raw)
To: Mike Christie, Jayamohan Kallickal
Cc: jbottomley@parallels.com, linux-scsi@vger.kernel.org,
Minh Duc Tran, Sony John-N
-----Original Message-----
From: Mike Christie [mailto:michaelc@cs.wisc.edu]
Sent: Sunday, March 30, 2014 9:54 PM
To: Jayamohan Kallickal
Cc: jbottomley@parallels.com; linux-scsi@vger.kernel.org; Jayamohan Kallickal; Minh Duc Tran; Sony John-N
Subject: Re: [PATCH 5/6] be2iscsi: Fix TCP parameters while connection offloading.
On 03/27/2014 11:39 AM, Jayamohan Kallickal wrote:
> +int mgmt_open_connection_v1(struct beiscsi_hba *phba,
> + struct sockaddr *dst_addr,
> + struct beiscsi_endpoint *beiscsi_ep,
> + struct be_dma_mem *nonemb_cmd) {
> + struct hwi_controller *phwi_ctrlr;
> + struct hwi_context_memory *phwi_context;
> + struct sockaddr_in *daddr_in = (struct sockaddr_in *)dst_addr;
> + struct sockaddr_in6 *daddr_in6 = (struct sockaddr_in6 *)dst_addr;
> + struct be_ctrl_info *ctrl = &phba->ctrl;
> + struct be_mcc_wrb *wrb;
> + struct tcp_connect_and_offload_in_v1 *req;
> + unsigned short def_hdr_id;
> + unsigned short def_data_id;
> + struct phys_addr template_address = { 0, 0 };
> + struct phys_addr *ptemplate_address;
> + unsigned int tag = 0;
> + unsigned int i, ulp_num;
> + unsigned short cid = beiscsi_ep->ep_cid;
> + struct be_sge *sge;
> +
> + phwi_ctrlr = phba->phwi_ctrlr;
> + phwi_context = phwi_ctrlr->phwi_ctxt;
> +
> + ulp_num = phwi_ctrlr->wrb_context[BE_GET_CRI_FROM_CID(cid)].ulp_num;
> +
> + def_hdr_id = (unsigned short)HWI_GET_DEF_HDRQ_ID(phba, ulp_num);
> + def_data_id = (unsigned short)HWI_GET_DEF_BUFQ_ID(phba, ulp_num);
> +
> + ptemplate_address = &template_address;
> + ISCSI_GET_PDU_TEMPLATE_ADDRESS(phba, ptemplate_address);
> + spin_lock(&ctrl->mbox_lock);
> + tag = alloc_mcc_tag(phba);
> + if (!tag) {
> + spin_unlock(&ctrl->mbox_lock);
> + return tag;
> + }
> + wrb = wrb_from_mccq(phba);
> + sge = nonembedded_sgl(wrb);
> +
> + req = nonemb_cmd->va;
> + memset(req, 0, sizeof(*req));
> + wrb->tag0 |= tag;
> +
> + be_wrb_hdr_prepare(wrb, sizeof(*req), false, 1);
> + be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI,
> + OPCODE_COMMON_ISCSI_TCP_CONNECT_AND_OFFLOAD,
> + sizeof(*req));
> + if (dst_addr->sa_family == PF_INET) {
> + __be32 s_addr = daddr_in->sin_addr.s_addr;
> + req->ip_address.ip_type = BE2_IPV4;
> + req->ip_address.addr[0] = s_addr & 0x000000ff;
> + req->ip_address.addr[1] = (s_addr & 0x0000ff00) >> 8;
> + req->ip_address.addr[2] = (s_addr & 0x00ff0000) >> 16;
> + req->ip_address.addr[3] = (s_addr & 0xff000000) >> 24;
> + req->tcp_port = ntohs(daddr_in->sin_port);
> + beiscsi_ep->dst_addr = daddr_in->sin_addr.s_addr;
> + beiscsi_ep->dst_tcpport = ntohs(daddr_in->sin_port);
> + beiscsi_ep->ip_type = BE2_IPV4;
> + } else if (dst_addr->sa_family == PF_INET6) {
> + req->ip_address.ip_type = BE2_IPV6;
> + memcpy(&req->ip_address.addr,
> + &daddr_in6->sin6_addr.in6_u.u6_addr8, 16);
> + req->tcp_port = ntohs(daddr_in6->sin6_port);
> + beiscsi_ep->dst_tcpport = ntohs(daddr_in6->sin6_port);
> + memcpy(&beiscsi_ep->dst6_addr,
> + &daddr_in6->sin6_addr.in6_u.u6_addr8, 16);
> + beiscsi_ep->ip_type = BE2_IPV6;
> + } else{
> + beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
> + "BG_%d : unknown addr family %d\n",
> + dst_addr->sa_family);
> + spin_unlock(&ctrl->mbox_lock);
> + free_mcc_tag(&phba->ctrl, tag);
> + return -EINVAL;
> +
> + }
> + req->cid = cid;
> + i = phba->nxt_cqid++;
> + if (phba->nxt_cqid == phba->num_cpus)
> + phba->nxt_cqid = 0;
> + req->cq_id = phwi_context->be_cq[i].id;
> + beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
> + "BG_%d : i=%d cq_id=%d\n", i, req->cq_id);
> + req->defq_id = def_hdr_id;
> + req->hdr_ring_id = def_hdr_id;
> + req->data_ring_id = def_data_id;
> + req->do_offload = 1;
> + req->dataout_template_pa.lo = ptemplate_address->lo;
> + req->dataout_template_pa.hi = ptemplate_address->hi;
> + sge->pa_hi = cpu_to_le32(upper_32_bits(nonemb_cmd->dma));
> + sge->pa_lo = cpu_to_le32(nonemb_cmd->dma & 0xFFFFFFFF);
> + sge->len = cpu_to_le32(nonemb_cmd->size);
> +
> + req->hdr.version = 1;
> + req->tcp_window_size = 0;
> + req->tcp_window_scale_count = 2;
>Is this approx 100 lines exactly the same as mgmt_open_connection except these 3 lines? Maybe a lib/helper function that does the common 100 lines then >some v1 function over that which does the extra 3 lines.
Agreed. Will redo this
Thanks
Jay
--
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 6/6] be2iscsi: Bump the driver version.
2014-03-27 16:39 [PATCH 1/6] be2iscsi: Fix retrieving MCCQ_WRB in non-embedded Mbox path Jayamohan Kallickal
` (3 preceding siblings ...)
2014-03-27 16:39 ` [PATCH 5/6] be2iscsi: Fix TCP parameters while connection offloading Jayamohan Kallickal
@ 2014-03-27 16:39 ` Jayamohan Kallickal
2014-03-27 16:39 ` [PATCH 0/6] be2iscsi: Update to 10.2.218.0 Jayamohan Kallickal
5 siblings, 0 replies; 15+ messages in thread
From: Jayamohan Kallickal @ 2014-03-27 16:39 UTC (permalink / raw)
To: jbottomley, linux-scsi, michaelc; +Cc: Jayamohan Kallickal, John Soni Jose
Bump driver version
Signed-off-by: John Soni Jose <sony.john-n@emulex.com>
Signed-off-by: Jayamohan Kallickal <Jayamohan.Kallickal@emulex.com>
---
drivers/scsi/be2iscsi/be_main.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h
index b3716e3..43f0b38 100644
--- a/drivers/scsi/be2iscsi/be_main.h
+++ b/drivers/scsi/be2iscsi/be_main.h
@@ -36,7 +36,7 @@
#include <scsi/scsi_transport_iscsi.h>
#define DRV_NAME "be2iscsi"
-#define BUILD_STR "10.2.125.0"
+#define BUILD_STR "10.2.218.0"
#define BE_NAME "Emulex OneConnect" \
"Open-iSCSI Driver version" BUILD_STR
#define DRV_DESC BE_NAME " " "Driver"
--
1.8.5.3
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH 0/6] be2iscsi: Update to 10.2.218.0
2014-03-27 16:39 [PATCH 1/6] be2iscsi: Fix retrieving MCCQ_WRB in non-embedded Mbox path Jayamohan Kallickal
` (4 preceding siblings ...)
2014-03-27 16:39 ` [PATCH 6/6] be2iscsi: Bump the driver version Jayamohan Kallickal
@ 2014-03-27 16:39 ` Jayamohan Kallickal
5 siblings, 0 replies; 15+ messages in thread
From: Jayamohan Kallickal @ 2014-03-27 16:39 UTC (permalink / raw)
To: jbottomley, linux-scsi, michaelc; +Cc: Jayamohan Kallickal
This patchset updates be2iscsi driver to 10.2.218.0
These patches are based on pending branch of scsi.git.
I had earlier sent patches 1, 2, and 3 which I would like to
withdraw.
0001 - Fix retreving MCCQ_WRB in non-embedded Mbox
0002 - Relinquishing control after 512 CQE
0003 - Fix MCCQ posting for Mbx Cmd after driver init
0004 - Fix Interrupt coalescing mechanism
0005 - Fix TCP parameters while creating connection
0006 - Bump the driver version
Thanks
Jay
Signed-off-by: Jayamohan Kallickal <Jayamohan.Kallickal@emulex.com>
---
^ permalink raw reply [flat|nested] 15+ messages in thread