Re: [PATCH] [SCSI] bnx2i: add a prefix to a printk

2013-11-21 Thread Paul Bolle
(Eddie was added as maintainer a few months ago, so Eddie receives this
message too.)

On Wed, 2012-06-27 at 21:26 +0200, Paul Bolle wrote:
> During each suspend and resume cycle a mysterious message is added to
> the logs:
> CPU 1 offline: Remove Rx thread
> 
> Some grepping of the tree revealed this message is printed by bnx2i.
> Add a prefix to this message to make it clear that it is printed by
> bnx2i. That should also make it obvious it is the mirror of the
> bnx2i: CPU 1 online: Create Rx thread
> 
> message.
> 
> Signed-off-by: Paul Bolle 

This issue is still present. Could someone please have a look at this
patch?

> 0) Untested!

It's tested now (on top of v3.12.1).

> 1) I only noticed this because I've been looking at the log messages
> generated by suspend and resume (for some iwlegacy and i915 issues) and
> because Fedora 16 enables bnx2i by default.

Fedora 18 still enables bnx2i by default.

> 2) This triggers a checkpatch warning:
> WARNING: Prefer pr_info(... to printk(KERN_INFO, ...
> 
> So I added Joe to the Cc's to suggest a way to make all printks in this
> file end up with a "bnx2i:" prefix (or whatever prefix is preferred).
> 
>  drivers/scsi/bnx2i/bnx2i_init.c |3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/scsi/bnx2i/bnx2i_init.c b/drivers/scsi/bnx2i/bnx2i_init.c
> index 8b68167..b75864b 100644
> --- a/drivers/scsi/bnx2i/bnx2i_init.c
> +++ b/drivers/scsi/bnx2i/bnx2i_init.c
> @@ -456,7 +456,8 @@ static int bnx2i_cpu_callback(struct notifier_block *nfb,
>   break;
>   case CPU_DEAD:
>   case CPU_DEAD_FROZEN:
> - printk(KERN_INFO "CPU %x offline: Remove Rx thread\n", cpu);
> + printk(KERN_INFO "bnx2i: CPU %x offline: Remove Rx thread\n",
> + cpu);
>   bnx2i_percpu_thread_destroy(cpu);
>   break;
>   default:


Paul Bolle

--
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


Re: [PATCH] [SCSI] bnx2i: add a prefix to a printk

2013-11-21 Thread Richard Weinberger
On Thu, Nov 21, 2013 at 9:34 AM, Paul Bolle  wrote:
> (Eddie was added as maintainer a few months ago, so Eddie receives this
> message too.)
>
> On Wed, 2012-06-27 at 21:26 +0200, Paul Bolle wrote:
>> During each suspend and resume cycle a mysterious message is added to
>> the logs:
>> CPU 1 offline: Remove Rx thread
>>
>> Some grepping of the tree revealed this message is printed by bnx2i.
>> Add a prefix to this message to make it clear that it is printed by
>> bnx2i. That should also make it obvious it is the mirror of the
>> bnx2i: CPU 1 online: Create Rx thread
>>
>> message.
>>
>> Signed-off-by: Paul Bolle 
>
> This issue is still present. Could someone please have a look at this
> patch?

What issue? There is no issue...

If you really want to help, remove the hotcpu notifier at all and
convert the driver to smpboot.
This would be a) a useful commit and b) helps tglx with his cpu hotplug work.

>> 0) Untested!
>
> It's tested now (on top of v3.12.1).
>
>> 1) I only noticed this because I've been looking at the log messages
>> generated by suspend and resume (for some iwlegacy and i915 issues) and
>> because Fedora 16 enables bnx2i by default.
>
> Fedora 18 still enables bnx2i by default.
>
>> 2) This triggers a checkpatch warning:
>> WARNING: Prefer pr_info(... to printk(KERN_INFO, ...
>>
>> So I added Joe to the Cc's to suggest a way to make all printks in this
>> file end up with a "bnx2i:" prefix (or whatever prefix is preferred).
>>
>>  drivers/scsi/bnx2i/bnx2i_init.c |3 ++-
>>  1 files changed, 2 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/scsi/bnx2i/bnx2i_init.c 
>> b/drivers/scsi/bnx2i/bnx2i_init.c
>> index 8b68167..b75864b 100644
>> --- a/drivers/scsi/bnx2i/bnx2i_init.c
>> +++ b/drivers/scsi/bnx2i/bnx2i_init.c
>> @@ -456,7 +456,8 @@ static int bnx2i_cpu_callback(struct notifier_block *nfb,
>>   break;
>>   case CPU_DEAD:
>>   case CPU_DEAD_FROZEN:
>> - printk(KERN_INFO "CPU %x offline: Remove Rx thread\n", cpu);
>> + printk(KERN_INFO "bnx2i: CPU %x offline: Remove Rx thread\n",
>> + cpu);
>>   bnx2i_percpu_thread_destroy(cpu);
>>   break;
>>   default:
>
>
> Paul Bolle
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/



-- 
Thanks,
//richard
--
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


Re: [PATCH] [SCSI] bnx2i: add a prefix to a printk

2013-11-21 Thread Joe Perches
On Thu, 2013-11-21 at 09:34 +0100, Paul Bolle wrote:
> (Eddie was added as maintainer a few months ago, so Eddie receives this
> message too.)
> 
> On Wed, 2012-06-27 at 21:26 +0200, Paul Bolle wrote:
> > During each suspend and resume cycle a mysterious message is added to
> > the logs:
> > CPU 1 offline: Remove Rx thread
> > 
> > Some grepping of the tree revealed this message is printed by bnx2i.
> > Add a prefix to this message to make it clear that it is printed by
> > bnx2i. That should also make it obvious it is the mirror of the
> > bnx2i: CPU 1 online: Create Rx thread

I would have done it by converting all the printks to use pr_
and adding pr_fmt.  This standardizes all log output from bnx2i to be
prefixed with "bnx2i: " instead of a mix of unprefixed, "bnx2i: " and
"bnx2i - "

Coalesce all format fragments.
Fix typo in format.
Use %s: and __func__ instead of embedding formats
Add missing "\n" at end of format
Fix enable/enabled grammar

---
 drivers/scsi/bnx2i/bnx2i.h   |   6 ++
 drivers/scsi/bnx2i/bnx2i_hwi.c   | 129 ++-
 drivers/scsi/bnx2i/bnx2i_init.c  |  42 ++---
 drivers/scsi/bnx2i/bnx2i_iscsi.c |  67 ++--
 drivers/scsi/bnx2i/bnx2i_sysfs.c |   4 +-
 5 files changed, 116 insertions(+), 132 deletions(-)

diff --git a/drivers/scsi/bnx2i/bnx2i.h b/drivers/scsi/bnx2i/bnx2i.h
index c73bbcb..1845352 100644
--- a/drivers/scsi/bnx2i/bnx2i.h
+++ b/drivers/scsi/bnx2i/bnx2i.h
@@ -15,6 +15,12 @@
 #ifndef _BNX2I_H_
 #define _BNX2I_H_
 
+#ifdef pr_fmt
+#undef pr_fmt
+#endif
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include 
 #include 
 
diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c
index e4cf23d..c4f4252 100644
--- a/drivers/scsi/bnx2i/bnx2i_hwi.c
+++ b/drivers/scsi/bnx2i/bnx2i_hwi.c
@@ -113,13 +113,11 @@ static void bnx2i_iscsi_license_error(struct bnx2i_hba 
*hba, u32 error_code)
 {
if (error_code == ISCSI_KCQE_COMPLETION_STATUS_ISCSI_NOT_SUPPORTED)
/* iSCSI offload not supported on this device */
-   printk(KERN_ERR "bnx2i: iSCSI not supported, dev=%s\n",
-   hba->netdev->name);
+   pr_err("iSCSI not supported, dev=%s\n", hba->netdev->name);
if (error_code == ISCSI_KCQE_COMPLETION_STATUS_LOM_ISCSI_NOT_ENABLED)
/* iSCSI offload not supported on this LOM device */
-   printk(KERN_ERR "bnx2i: LOM is not enable to "
-   "offload iSCSI connections, dev=%s\n",
-   hba->netdev->name);
+   pr_err("LOM is not enabled to offload iSCSI connections, 
dev=%s\n",
+  hba->netdev->name);
set_bit(ADAPTER_STATE_INIT_FAILED, &hba->adapter_state);
 }
 
@@ -574,7 +572,7 @@ int bnx2i_send_iscsi_nopout(struct bnx2i_conn *bnx2i_conn,
nopout_wqe->data_length = data_len;
if (data_len) {
/* handle payload data, not required in first release */
-   printk(KERN_ALERT "NOPOUT: WARNING!! payload len != 0\n");
+   pr_alert("NOPOUT: WARNING!! payload len != 0\n");
} else {
nopout_wqe->bd_list_addr_lo = (u32)
bnx2i_conn->hba->mp_bd_dma;
@@ -701,13 +699,13 @@ void bnx2i_ep_ofld_timer(unsigned long data)
struct bnx2i_endpoint *ep = (struct bnx2i_endpoint *) data;
 
if (ep->state == EP_STATE_OFLD_START) {
-   printk(KERN_ALERT "ofld_timer: CONN_OFLD timeout\n");
+   pr_alert("ofld_timer: CONN_OFLD timeout\n");
ep->state = EP_STATE_OFLD_FAILED;
} else if (ep->state == EP_STATE_DISCONN_START) {
-   printk(KERN_ALERT "ofld_timer: CONN_DISCON timeout\n");
+   pr_alert("ofld_timer: CONN_DISCON timeout\n");
ep->state = EP_STATE_DISCONN_TIMEDOUT;
} else if (ep->state == EP_STATE_CLEANUP_START) {
-   printk(KERN_ALERT "ofld_timer: CONN_CLEANUP timeout\n");
+   pr_alert("ofld_timer: CONN_CLEANUP timeout\n");
ep->state = EP_STATE_CLEANUP_FAILED;
}
 
@@ -1074,8 +1072,8 @@ int bnx2i_alloc_qp_resc(struct bnx2i_hba *hba, struct 
bnx2i_endpoint *ep)
dma_alloc_coherent(&hba->pcidev->dev, ep->qp.sq_pgtbl_size,
   &ep->qp.sq_pgtbl_phys, GFP_KERNEL);
if (!ep->qp.sq_pgtbl_virt) {
-   printk(KERN_ALERT "bnx2i: unable to alloc SQ PT mem (%d)\n",
- ep->qp.sq_pgtbl_size);
+   pr_alert("unable to alloc SQ PT mem (%d)\n",
+ep->qp.sq_pgtbl_size);
goto mem_alloc_err;
}
 
@@ -1084,8 +1082,8 @@ int bnx2i_alloc_qp_resc(struct bnx2i_hba *hba, struct 
bnx2i_endpoint *ep)
dma_alloc_coherent(&hba->pcidev->dev, ep->qp.sq_mem_size,
   &ep->qp.sq_phys, GFP_KERNEL);
if (!ep->

[PATCH] iscsi: quiesce connection error event during logout

2013-11-21 Thread Vaughan Cao
'connectionX:X: detected conn error(1020)' message appear during normal
logout phase because of connection close on target peer.
Quiesce it to avoid confusion.

Signed-off-by: Vaughan Cao 
---
 drivers/scsi/libiscsi.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index e399561..0e127d1 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -1356,6 +1356,12 @@ void iscsi_conn_failure(struct iscsi_conn *conn, enum 
iscsi_err err)
spin_unlock_bh(&session->lock);
return;
}
+   /* Target closed the connection in response to logout */
+   if (session->state == ISCSI_STATE_LOGGING_OUT &&
+   err == ISCSI_ERR_TCP_CONN_CLOSE) {
+   spin_unlock_bh(&session->lock);
+   return;
+   }
 
if (conn->stop_stage == 0)
session->state = ISCSI_STATE_FAILED;
-- 
1.8.3.1

--
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 RESEND 2/8] bfa: Register port with SCSI even on port init failure

2013-11-21 Thread vmohan
From: Vijaya Mohan Guvva 

This patch addresses the issue of port not being registered with SCSI
layer on bfa or firmware initialization failure and subsequently failure
in collecting driver traces for debugging port init failures. Also it
has minor changes related to bfad state machine clean up.

Signed-off-by: Vijaya Mohan Guvva 
---
 drivers/scsi/bfa/bfad.c | 85 ++---
 drivers/scsi/bfa/bfad_drv.h |  4 +--
 2 files changed, 43 insertions(+), 46 deletions(-)

diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c
index f8ca7be..bd17757 100644
--- a/drivers/scsi/bfa/bfad.c
+++ b/drivers/scsi/bfa/bfad.c
@@ -204,6 +204,7 @@ static void
 bfad_sm_created(struct bfad_s *bfad, enum bfad_sm_event event)
 {
unsigned long flags;
+   bfa_status_t ret;
 
bfa_trc(bfad, event);
 
@@ -217,7 +218,7 @@ bfad_sm_created(struct bfad_s *bfad, enum bfad_sm_event 
event)
if (bfad_setup_intr(bfad)) {
printk(KERN_WARNING "bfad%d: bfad_setup_intr failed\n",
bfad->inst_no);
-   bfa_sm_send_event(bfad, BFAD_E_INTR_INIT_FAILED);
+   bfa_sm_send_event(bfad, BFAD_E_INIT_FAILED);
break;
}
 
@@ -242,8 +243,26 @@ bfad_sm_created(struct bfad_s *bfad, enum bfad_sm_event 
event)
printk(KERN_WARNING
"bfa %s: bfa init failed\n",
bfad->pci_name);
+   spin_lock_irqsave(&bfad->bfad_lock, flags);
+   bfa_fcs_init(&bfad->bfa_fcs);
+   spin_unlock_irqrestore(&bfad->bfad_lock, flags);
+
+   ret = bfad_cfg_pport(bfad, BFA_LPORT_ROLE_FCP_IM);
+   if (ret != BFA_STATUS_OK) {
+   init_completion(&bfad->comp);
+
+   spin_lock_irqsave(&bfad->bfad_lock, flags);
+   bfad->pport.flags |= BFAD_PORT_DELETE;
+   bfa_fcs_exit(&bfad->bfa_fcs);
+   spin_unlock_irqrestore(&bfad->bfad_lock, flags);
+
+   wait_for_completion(&bfad->comp);
+
+   bfa_sm_send_event(bfad, BFAD_E_INIT_FAILED);
+   break;
+   }
bfad->bfad_flags |= BFAD_HAL_INIT_FAIL;
-   bfa_sm_send_event(bfad, BFAD_E_INIT_FAILED);
+   bfa_sm_send_event(bfad, BFAD_E_HAL_INIT_FAILED);
}
 
break;
@@ -273,12 +292,14 @@ bfad_sm_initializing(struct bfad_s *bfad, enum 
bfad_sm_event event)
spin_unlock_irqrestore(&bfad->bfad_lock, flags);
 
retval = bfad_start_ops(bfad);
-   if (retval != BFA_STATUS_OK)
+   if (retval != BFA_STATUS_OK) {
+   bfa_sm_set_state(bfad, bfad_sm_failed);
break;
+   }
bfa_sm_set_state(bfad, bfad_sm_operational);
break;
 
-   case BFAD_E_INTR_INIT_FAILED:
+   case BFAD_E_INIT_FAILED:
bfa_sm_set_state(bfad, bfad_sm_uninit);
kthread_stop(bfad->bfad_tsk);
spin_lock_irqsave(&bfad->bfad_lock, flags);
@@ -286,7 +307,7 @@ bfad_sm_initializing(struct bfad_s *bfad, enum 
bfad_sm_event event)
spin_unlock_irqrestore(&bfad->bfad_lock, flags);
break;
 
-   case BFAD_E_INIT_FAILED:
+   case BFAD_E_HAL_INIT_FAILED:
bfa_sm_set_state(bfad, bfad_sm_failed);
break;
default:
@@ -310,13 +331,8 @@ bfad_sm_failed(struct bfad_s *bfad, enum bfad_sm_event 
event)
break;
 
case BFAD_E_STOP:
-   if (bfad->bfad_flags & BFAD_CFG_PPORT_DONE)
-   bfad_uncfg_pport(bfad);
-   if (bfad->bfad_flags & BFAD_FC4_PROBE_DONE) {
-   bfad_im_probe_undo(bfad);
-   bfad->bfad_flags &= ~BFAD_FC4_PROBE_DONE;
-   }
-   bfad_stop(bfad);
+   bfa_sm_set_state(bfad, bfad_sm_fcs_exit);
+   bfa_sm_send_event(bfad, BFAD_E_FCS_EXIT_COMP);
break;
 
case BFAD_E_EXIT_COMP:
@@ -854,7 +870,7 @@ bfad_drv_init(struct bfad_s *bfad)
printk(KERN_WARNING
"Not enough memory to attach all Brocade HBA ports, %s",
"System may need more memory.\n");
-   goto out_hal_mem_alloc_failure;
+   return BFA_STATUS_FAILED;
}
 
bfad->bfa.trcmod = bfad->trcmod;
@@ -871,31 +887,11 @@ bfad_drv_init(struct bfad_s *bfad)
bfad->bfa_fcs.trcmod = bfad->trcmod;
bfa_fcs_attach(&bfad->bfa_fcs, &bfad->bfa, bfad, BFA_FALSE);
bfad->bfa_fcs.fdmi_enabled = fdmi_en

[PATCH RESEND 1/8] bfa: Firmware patch simplification

2013-11-21 Thread vmohan
From: Vijaya Mohan Guvva 

This patch includes change to enable firmware patch simplication
feature. This feature is targeted to address the requirement to have
independent patch release for firmware. Prior to 3.2.3, releasing a
patch fix for firmware requires changes to bfa, to use new firmware
images. But with these changes, if the new firmware is flashed on to the
HBA with brocade adapter management utilites, driver uses the new
firmware after checking the patch release byte in the firmware version.

Signed-off-by: Vijaya Mohan Guvva 
---
 drivers/scsi/bfa/bfa_defs.h   |   1 +
 drivers/scsi/bfa/bfa_ioc.c| 727 +++---
 drivers/scsi/bfa/bfa_ioc.h|   7 +-
 drivers/scsi/bfa/bfa_ioc_cb.c |  23 ++
 drivers/scsi/bfa/bfad_bsg.c   |  15 +
 drivers/scsi/bfa/bfad_bsg.h   |   1 +
 drivers/scsi/bfa/bfi.h|  39 ++-
 7 files changed, 767 insertions(+), 46 deletions(-)

diff --git a/drivers/scsi/bfa/bfa_defs.h b/drivers/scsi/bfa/bfa_defs.h
index d40a79f..877b86d 100644
--- a/drivers/scsi/bfa/bfa_defs.h
+++ b/drivers/scsi/bfa/bfa_defs.h
@@ -132,6 +132,7 @@ enum bfa_status {
BFA_STATUS_ETIMER   = 5,/*  Timer expired - Retry, if persists,
 *  contact support */
BFA_STATUS_EPROTOCOL= 6,/*  Protocol error */
+   BFA_STATUS_BADFLASH = 9,/*  Flash is bad */
BFA_STATUS_SFP_UNSUPP   = 10,   /*  Unsupported SFP - Replace SFP */
BFA_STATUS_UNKNOWN_VFID = 11,   /*  VF_ID not found */
BFA_STATUS_DATACORRUPTED = 12,  /*  Diag returned data corrupted */
diff --git a/drivers/scsi/bfa/bfa_ioc.c b/drivers/scsi/bfa/bfa_ioc.c
index f78bcb6..8241e61 100644
--- a/drivers/scsi/bfa/bfa_ioc.c
+++ b/drivers/scsi/bfa/bfa_ioc.c
@@ -21,6 +21,7 @@
 #include "bfi_reg.h"
 #include "bfa_defs.h"
 #include "bfa_defs_svc.h"
+#include "bfi.h"
 
 BFA_TRC_FILE(CNA, IOC);
 
@@ -45,6 +46,14 @@ BFA_TRC_FILE(CNA, IOC);
 
 #define BFA_DBG_FWTRC_OFF(_fn) (BFI_IOC_TRC_OFF + BFA_DBG_FWTRC_LEN * (_fn))
 
+#define bfa_ioc_state_disabled(__sm)   \
+   (((__sm) == BFI_IOC_UNINIT) ||  \
+   ((__sm) == BFI_IOC_INITING) ||  \
+   ((__sm) == BFI_IOC_HWINIT) ||   \
+   ((__sm) == BFI_IOC_DISABLED) || \
+   ((__sm) == BFI_IOC_FAIL) || \
+   ((__sm) == BFI_IOC_CFG_DISABLED))
+
 /*
  * Asic specific macros : see bfa_hw_cb.c and bfa_hw_ct.c for details.
  */
@@ -102,6 +111,12 @@ static void bfa_ioc_disable_comp(struct bfa_ioc_s *ioc);
 static void bfa_ioc_lpu_stop(struct bfa_ioc_s *ioc);
 static void bfa_ioc_fail_notify(struct bfa_ioc_s *ioc);
 static void bfa_ioc_pf_fwmismatch(struct bfa_ioc_s *ioc);
+static enum bfi_ioc_img_ver_cmp_e bfa_ioc_fw_ver_patch_cmp(
+   struct bfi_ioc_image_hdr_s *base_fwhdr,
+   struct bfi_ioc_image_hdr_s *fwhdr_to_cmp);
+static enum bfi_ioc_img_ver_cmp_e bfa_ioc_flash_fwver_cmp(
+   struct bfa_ioc_s *ioc,
+   struct bfi_ioc_image_hdr_s *base_fwhdr);
 
 /*
  * IOC state machine definitions/declarations
@@ -1454,28 +1469,42 @@ bfa_ioc_fwver_get(struct bfa_ioc_s *ioc, struct 
bfi_ioc_image_hdr_s *fwhdr)
 }
 
 /*
- * Returns TRUE if same.
+ * Returns TRUE if driver is willing to work with current smem f/w version.
  */
 bfa_boolean_t
-bfa_ioc_fwver_cmp(struct bfa_ioc_s *ioc, struct bfi_ioc_image_hdr_s *fwhdr)
+bfa_ioc_fwver_cmp(struct bfa_ioc_s *ioc,
+   struct bfi_ioc_image_hdr_s *smem_fwhdr)
 {
struct bfi_ioc_image_hdr_s *drv_fwhdr;
-   int i;
+   enum bfi_ioc_img_ver_cmp_e smem_flash_cmp, drv_smem_cmp;
 
drv_fwhdr = (struct bfi_ioc_image_hdr_s *)
bfa_cb_image_get_chunk(bfa_ioc_asic_gen(ioc), 0);
 
-   for (i = 0; i < BFI_IOC_MD5SUM_SZ; i++) {
-   if (fwhdr->md5sum[i] != cpu_to_le32(drv_fwhdr->md5sum[i])) {
-   bfa_trc(ioc, i);
-   bfa_trc(ioc, fwhdr->md5sum[i]);
-   bfa_trc(ioc, drv_fwhdr->md5sum[i]);
-   return BFA_FALSE;
-   }
+   /*
+* If smem is incompatible or old, driver should not work with it.
+*/
+   drv_smem_cmp = bfa_ioc_fw_ver_patch_cmp(drv_fwhdr, smem_fwhdr);
+   if (drv_smem_cmp == BFI_IOC_IMG_VER_INCOMP ||
+   drv_smem_cmp == BFI_IOC_IMG_VER_OLD) {
+   return BFA_FALSE;
}
 
-   bfa_trc(ioc, fwhdr->md5sum[0]);
-   return BFA_TRUE;
+   /*
+* IF Flash has a better F/W than smem do not work with smem.
+* If smem f/w == flash f/w, as smem f/w not old | incmp, work with it.
+* If Flash is old or incomp work with smem iff smem f/w == drv f/w.
+*/
+   smem_flash_cmp = bfa_ioc_flash_fwver_cmp(ioc, smem_fwhdr);
+
+   if (smem_flash_cmp == BFI_IOC_IMG_VER_BETTER) {
+   return BFA_FALSE;
+   } else if (smem_flash_cmp == BFI

[PATCH RESEND 0/8] bfa driver update to v3.2.23.0

2013-11-21 Thread vmohan
From: Vijaya Mohan Guvva 

Hi James,
Repleaced __BIGENDIAN macro with __BIG_ENDIAN in
"Firmware patch simplification" patch and resending patch set.

The following patch-set includes, firmware patch simplification feature,
bug fixes, changes to use new firmware images v3.2.3.0 and changes to
update the driver version to 3.2.23.0.

I have compiled and tested the patches against 3.12 kernel.
Please review and provide your comments.

Thanks,
Vijaya Mohan Guvva

Vijaya Mohan Guvva (8):
  bfa: Firmware patch simplification
  bfa: Register port with SCSI even on port init failure
  bfa: LUN discovery issue in direct attach mode
  bfa: Fix for bcu or hcm faa query hang
  bfa: Observed auto D-port mode instead of manual
  bfa: change FC_ELS_TOV to 20sec
  bfa: Fix crash when symb name set for offline vport
  bfa: Driver version upgrade to 3.2.23.0

 drivers/scsi/bfa/bfa_core.c  |   8 +-
 drivers/scsi/bfa/bfa_defs.h  |   1 +
 drivers/scsi/bfa/bfa_fc.h|   2 +-
 drivers/scsi/bfa/bfa_fcs.h   |   1 +
 drivers/scsi/bfa/bfa_fcs_lport.c |  29 +-
 drivers/scsi/bfa/bfa_ioc.c   | 727 ---
 drivers/scsi/bfa/bfa_ioc.h   |   7 +-
 drivers/scsi/bfa/bfa_ioc_cb.c|  23 ++
 drivers/scsi/bfa/bfa_svc.c   |   2 +-
 drivers/scsi/bfa/bfad.c  |  91 +++--
 drivers/scsi/bfa/bfad_attr.c |   7 +-
 drivers/scsi/bfa/bfad_bsg.c  |  15 +
 drivers/scsi/bfa/bfad_bsg.h  |   1 +
 drivers/scsi/bfa/bfad_drv.h  |   6 +-
 drivers/scsi/bfa/bfi.h   |  42 ++-
 15 files changed, 850 insertions(+), 112 deletions(-)

-- 
1.8.2.1

--
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 RESEND 6/8] bfa: change FC_ELS_TOV to 20sec

2013-11-21 Thread vmohan
From: Vijaya Mohan Guvva 

As per the FCP specs, the timeout for issuing ABTS is 20 sec; not 21
sec. Hence setting the TOV to 20 sec.

Signed-off-by: Vijaya Mohan Guvva 
---
 drivers/scsi/bfa/bfa_fc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/bfa/bfa_fc.h b/drivers/scsi/bfa/bfa_fc.h
index 562ef73..64069a0 100644
--- a/drivers/scsi/bfa/bfa_fc.h
+++ b/drivers/scsi/bfa/bfa_fc.h
@@ -1026,7 +1026,7 @@ struct fc_alpabm_s {
 #define FC_ED_TOV  2
 #define FC_REC_TOV (FC_ED_TOV + 1)
 #define FC_RA_TOV  10
-#define FC_ELS_TOV ((2 * FC_RA_TOV) + 1)
+#define FC_ELS_TOV (2 * FC_RA_TOV)
 #define FC_FCCT_TOV(3 * FC_RA_TOV)
 
 /*
-- 
1.8.2.1

--
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 RESEND 7/8] bfa: Fix crash when symb name set for offline vport

2013-11-21 Thread vmohan
From: Vijaya Mohan Guvva 

This patch fixes a crash when tried setting symbolic name for an offline
vport through sysfs. Crash is due to uninitialized pointer lport->ns,
which gets initialized only on linkup (port online).

Signed-off-by: Vijaya Mohan Guvva 
---
 drivers/scsi/bfa/bfa_fcs.h   |  1 +
 drivers/scsi/bfa/bfa_fcs_lport.c | 14 +++---
 drivers/scsi/bfa/bfad_attr.c |  7 ++-
 3 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/bfa/bfa_fcs.h b/drivers/scsi/bfa/bfa_fcs.h
index 94d5d01..42bcb97 100644
--- a/drivers/scsi/bfa/bfa_fcs.h
+++ b/drivers/scsi/bfa/bfa_fcs.h
@@ -296,6 +296,7 @@ wwn_t bfa_fcs_lport_get_rport(struct bfa_fcs_lport_s *port, 
wwn_t wwn,
 struct bfa_fcs_lport_s *bfa_fcs_lookup_port(struct bfa_fcs_s *fcs,
u16 vf_id, wwn_t lpwwn);
 
+void bfa_fcs_lport_set_symname(struct bfa_fcs_lport_s *port, char *symname);
 void bfa_fcs_lport_get_info(struct bfa_fcs_lport_s *port,
struct bfa_lport_info_s *port_info);
 void bfa_fcs_lport_get_attr(struct bfa_fcs_lport_s *port,
diff --git a/drivers/scsi/bfa/bfa_fcs_lport.c b/drivers/scsi/bfa/bfa_fcs_lport.c
index 06bae2b..ff75ef8 100644
--- a/drivers/scsi/bfa/bfa_fcs_lport.c
+++ b/drivers/scsi/bfa/bfa_fcs_lport.c
@@ -1110,6 +1110,17 @@ bfa_fcs_lport_init(struct bfa_fcs_lport_s *lport,
bfa_sm_send_event(lport, BFA_FCS_PORT_SM_CREATE);
 }
 
+void
+bfa_fcs_lport_set_symname(struct bfa_fcs_lport_s *port,
+   char *symname)
+{
+   strcpy(port->port_cfg.sym_name.symname, symname);
+
+   if (bfa_sm_cmp_state(port, bfa_fcs_lport_sm_online))
+   bfa_fcs_lport_ns_util_send_rspn_id(
+   BFA_FCS_GET_NS_FROM_PORT(port), NULL);
+}
+
 /*
  *  fcs_lport_api
  */
@@ -5153,9 +5164,6 @@ bfa_fcs_lport_ns_util_send_rspn_id(void *cbarg, struct 
bfa_fcxp_s *fcxp_alloced)
u8 *psymbl = &symbl[0];
int len;
 
-   if (!bfa_sm_cmp_state(port, bfa_fcs_lport_sm_online))
-   return;
-
/* Avoid sending RSPN in the following states. */
if (bfa_sm_cmp_state(ns, bfa_fcs_lport_ns_sm_offline) ||
bfa_sm_cmp_state(ns, bfa_fcs_lport_ns_sm_plogi_sending) ||
diff --git a/drivers/scsi/bfa/bfad_attr.c b/drivers/scsi/bfa/bfad_attr.c
index e9a681d..40be670 100644
--- a/drivers/scsi/bfa/bfad_attr.c
+++ b/drivers/scsi/bfa/bfad_attr.c
@@ -593,11 +593,8 @@ bfad_im_vport_set_symbolic_name(struct fc_vport *fc_vport)
return;
 
spin_lock_irqsave(&bfad->bfad_lock, flags);
-   if (strlen(sym_name) > 0) {
-   strcpy(fcs_vport->lport.port_cfg.sym_name.symname, sym_name);
-   bfa_fcs_lport_ns_util_send_rspn_id(
-   BFA_FCS_GET_NS_FROM_PORT((&fcs_vport->lport)), NULL);
-   }
+   if (strlen(sym_name) > 0)
+   bfa_fcs_lport_set_symname(&fcs_vport->lport, sym_name);
spin_unlock_irqrestore(&bfad->bfad_lock, flags);
 }
 
-- 
1.8.2.1

--
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 RESEND 8/8] bfa: Driver version upgrade to 3.2.23.0

2013-11-21 Thread vmohan
From: Vijaya Mohan Guvva 

Patch includes changes to upgrade bfa driver version to 3.2.23.0 and use
firmware version 3.2.3.0

Signed-off-by: Vijaya Mohan Guvva 
---
 drivers/scsi/bfa/bfad.c | 6 +++---
 drivers/scsi/bfa/bfad_drv.h | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c
index bd17757..e85926c 100644
--- a/drivers/scsi/bfa/bfad.c
+++ b/drivers/scsi/bfa/bfad.c
@@ -63,9 +63,9 @@ int   max_rport_logins = BFA_FCS_MAX_RPORT_LOGINS;
 u32bfi_image_cb_size, bfi_image_ct_size, bfi_image_ct2_size;
 u32*bfi_image_cb, *bfi_image_ct, *bfi_image_ct2;
 
-#define BFAD_FW_FILE_CB"cbfw-3.2.1.1.bin"
-#define BFAD_FW_FILE_CT"ctfw-3.2.1.1.bin"
-#define BFAD_FW_FILE_CT2   "ct2fw-3.2.1.1.bin"
+#define BFAD_FW_FILE_CB"cbfw-3.2.3.0.bin"
+#define BFAD_FW_FILE_CT"ctfw-3.2.3.0.bin"
+#define BFAD_FW_FILE_CT2   "ct2fw-3.2.3.0.bin"
 
 static u32 *bfad_load_fwimg(struct pci_dev *pdev);
 static void bfad_free_fwimg(void);
diff --git a/drivers/scsi/bfa/bfad_drv.h b/drivers/scsi/bfa/bfad_drv.h
index cf56d3d..8b97877 100644
--- a/drivers/scsi/bfa/bfad_drv.h
+++ b/drivers/scsi/bfa/bfad_drv.h
@@ -57,7 +57,7 @@
 #ifdef BFA_DRIVER_VERSION
 #define BFAD_DRIVER_VERSIONBFA_DRIVER_VERSION
 #else
-#define BFAD_DRIVER_VERSION"3.2.21.1"
+#define BFAD_DRIVER_VERSION"3.2.23.0"
 #endif
 
 #define BFAD_PROTO_NAME FCPI_NAME
-- 
1.8.2.1

--
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 RESEND 3/8] bfa: LUN discovery issue in direct attach mode

2013-11-21 Thread vmohan
From: Vijaya Mohan Guvva 

In direct attach mode, if port features like QoS/Trunk/FEC/CR are
enabled, driver can receive PLOGI from the target before firmware
notifies lport online to the driver. In case the lport is not yet online
and a PLOGI is received, send a reject to the peer port, instead of
dropping it on the floor.

Signed-off-by: Vijaya Mohan Guvva 
---
 drivers/scsi/bfa/bfa_fcs_lport.c | 15 ++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/bfa/bfa_fcs_lport.c b/drivers/scsi/bfa/bfa_fcs_lport.c
index 2f61a5a..06bae2b 100644
--- a/drivers/scsi/bfa/bfa_fcs_lport.c
+++ b/drivers/scsi/bfa/bfa_fcs_lport.c
@@ -773,7 +773,20 @@ bfa_fcs_lport_uf_recv(struct bfa_fcs_lport_s *lport,
bfa_trc(lport->fcs, fchs->type);
 
if (!bfa_fcs_lport_is_online(lport)) {
-   bfa_stats(lport, uf_recv_drops);
+   /*
+* In direct attach topology, it is possible to get a PLOGI
+* before the lport is online due to port feature
+* (QoS/Trunk/FEC/CR), so send a rjt
+*/
+   if ((fchs->type == FC_TYPE_ELS) &&
+   (els_cmd->els_code == FC_ELS_PLOGI)) {
+   bfa_fcs_lport_send_ls_rjt(lport, fchs,
+   FC_LS_RJT_RSN_UNABLE_TO_PERF_CMD,
+   FC_LS_RJT_EXP_NO_ADDL_INFO);
+   bfa_stats(lport, plogi_rcvd);
+   } else
+   bfa_stats(lport, uf_recv_drops);
+
return;
}
 
-- 
1.8.2.1

--
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 RESEND 5/8] bfa: Observed auto D-port mode instead of manual

2013-11-21 Thread vmohan
From: Vijaya Mohan Guvva 

Observed Auto mode in the HBA side while doing manual D-Port test on the
switch side. Mode is not passed to BFA from firmware when the test is
triggered by switch side. BFA just blindly using Auto mode.

Signed-off-by: Vijaya Mohan Guvva 
---
 drivers/scsi/bfa/bfa_svc.c | 2 +-
 drivers/scsi/bfa/bfi.h | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/bfa/bfa_svc.c b/drivers/scsi/bfa/bfa_svc.c
index 6c41e57..625225f 100644
--- a/drivers/scsi/bfa/bfa_svc.c
+++ b/drivers/scsi/bfa/bfa_svc.c
@@ -6758,7 +6758,7 @@ bfa_dport_scn(struct bfa_dport_s *dport, struct 
bfi_diag_dport_scn_s *msg)
dport->rp_pwwn = msg->info.teststart.pwwn;
dport->rp_nwwn = msg->info.teststart.nwwn;
dport->lpcnt = cpu_to_be32(msg->info.teststart.numfrm);
-   bfa_dport_result_start(dport, BFA_DPORT_OPMODE_AUTO);
+   bfa_dport_result_start(dport, msg->info.teststart.mode);
break;
 
case BFI_DPORT_SCN_SUBTESTSTART:
diff --git a/drivers/scsi/bfa/bfi.h b/drivers/scsi/bfa/bfi.h
index 7192e99..1d97a22 100644
--- a/drivers/scsi/bfa/bfi.h
+++ b/drivers/scsi/bfa/bfi.h
@@ -1144,7 +1144,8 @@ struct bfi_diag_dport_scn_teststart_s {
wwn_t   pwwn;   /* switch port wwn. 8 bytes */
wwn_t   nwwn;   /* switch node wwn. 8 bytes */
u8  type;   /* bfa_diag_dport_test_type_e */
-   u8  rsvd[3];
+   u8  mode;   /* bfa_diag_dport_test_opmode */
+   u8  rsvd[2];
u32 numfrm; /* from switch uint in 1M */
 };
 
-- 
1.8.2.1

--
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 RESEND 4/8] bfa: Fix for bcu or hcm faa query hang

2013-11-21 Thread vmohan
From: Vijaya Mohan Guvva 

This patch set fixes the issue of brocade management utility hang
(bcu/HCM) when faa attributes are queried from multiple application
threads. Hang was due to race between the threads and completion handler
corruption.

Signed-off-by: Vijaya Mohan Guvva 
---
 drivers/scsi/bfa/bfa_core.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/bfa/bfa_core.c b/drivers/scsi/bfa/bfa_core.c
index 520540a..e3f67b0 100644
--- a/drivers/scsi/bfa/bfa_core.c
+++ b/drivers/scsi/bfa/bfa_core.c
@@ -1367,10 +1367,6 @@ bfa_faa_query(struct bfa_s *bfa, struct bfa_faa_attr_s 
*attr,
struct bfa_iocfc_s  *iocfc = &bfa->iocfc;
bfa_status_tstatus;
 
-   iocfc->faa_args.faa_attr = attr;
-   iocfc->faa_args.faa_cb.faa_cbfn = cbfn;
-   iocfc->faa_args.faa_cb.faa_cbarg = cbarg;
-
status = bfa_faa_validate_request(bfa);
if (status != BFA_STATUS_OK)
return status;
@@ -1378,6 +1374,10 @@ bfa_faa_query(struct bfa_s *bfa, struct bfa_faa_attr_s 
*attr,
if (iocfc->faa_args.busy == BFA_TRUE)
return BFA_STATUS_DEVBUSY;
 
+   iocfc->faa_args.faa_attr = attr;
+   iocfc->faa_args.faa_cb.faa_cbfn = cbfn;
+   iocfc->faa_args.faa_cb.faa_cbarg = cbarg;
+
iocfc->faa_args.busy = BFA_TRUE;
memset(&faa_attr_req, 0, sizeof(struct bfi_faa_query_s));
bfi_h2i_set(faa_attr_req.mh, BFI_MC_IOCFC,
-- 
1.8.2.1

--
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


Re: [PATCH v4 2/4] Documentation:: Add documentation for APM X-Gene SoC SATA host controller DTS binding

2013-11-21 Thread Arnd Bergmann
On Thursday 21 November 2013, Loc Ho wrote:
> +SATA host controller nodes are defined to describe on-chip Serial ATA
> +controllers. Each SATA controller (pair of ports) have its own node.
> +
> +Required properties:
> +- compatible : Shall be "apm,xgene-ahci"
> +- reg: First memory resource shall be the AHCI memory
> +   resource.
> +   Second memory resource shall be the host controller
> +   memory resource.
> +- interrupt-parent   : Interrupt controller
> +- interrupts : Interrupt mapping for SATA host controller IRQ
> +- clocks : Reference to the clock entry
> +- phys   : PHY reference
> +- phy-names  : Name of the PHY reference. The name should be
> +   formed by "sataphy" plus lower case hex for the
> +   lower 32-bit PHY CSR address (2nd memory resource)

I've tried to explain this before, but apparently you missed the point:

Any "*-names" property is supposed to be the identifier inside the device you
are describing, *not* an identifier for what it points to, as that already
has a name. The idea is that the driver can ask for phy (or clock, irq,
memory, etc) "foo" here, with foo identifying the functionality in the
device. If you only have one phy, you probably don't want to name it at
all. If you imagine a device that was connected to two different phys
depending on the mode it's used in (e.g. SATA-II vs SATA-6G), you would
list this as

 - phy-names: one name per references in the "phys" property.
  valid names are "sata-ii" and "sata-6g".

If the generic phy subsystem requires you to name this, I'd suggest either
changing the phy subsystem to make the name optional, or to just call it
"serdes", as that is the kind of phy you are connected to.

Does this make more sense to you now?

Arnd
--
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