Re: [PATCH 2/5] bnx2fc: Include chip number in the symbolic name

2013-05-01 Thread Bhanu Prakash Gollapudi

On 05/01/2013 05:39 PM, James Bottomley wrote:

On Fri, 2013-03-08 at 13:28 -0800, Bhanu Prakash Gollapudi wrote:

+#ifndef PCI_DEVICE_ID_NX2_57710
+#define PCI_DEVICE_ID_NX2_577100x164e
+#endif
+#ifndef PCI_DEVICE_ID_NX2_57711
+#define PCI_DEVICE_ID_NX2_577110x164f
+#endif
+#ifndef PCI_DEVICE_ID_NX2_57712
+#define PCI_DEVICE_ID_NX2_577120x1662
+#endif
+#ifndef PCI_DEVICE_ID_NX2_57712_MF
+#define PCI_DEVICE_ID_NX2_57712_MF 0x1663
+#endif
+#ifndef PCI_DEVICE_ID_NX2_57712_VF
+#define PCI_DEVICE_ID_NX2_57712_VF 0x166f
+#endif
+#ifndef PCI_DEVICE_ID_NX2_57800
+#define PCI_DEVICE_ID_NX2_578000x168a
+#endif
+#ifndef PCI_DEVICE_ID_NX2_57800_MF
+#define PCI_DEVICE_ID_NX2_57800_MF 0x16a5
+#endif
+#ifndef PCI_DEVICE_ID_NX2_57800_VF
+#define PCI_DEVICE_ID_NX2_57800_VF 0x16a9
+#endif
+#ifndef PCI_DEVICE_ID_NX2_57810
+#define PCI_DEVICE_ID_NX2_578100x168e
+#endif
+#ifndef PCI_DEVICE_ID_NX2_57810_MF
+#define PCI_DEVICE_ID_NX2_57810_MF 0x16ae
+#endif
+#ifndef PCI_DEVICE_ID_NX2_57810_VF
+#define PCI_DEVICE_ID_NX2_57810_VF 0x16af
+#endif
+#ifndef PCI_DEVICE_ID_NX2_57840
+#define PCI_DEVICE_ID_NX2_578400x168d
+#endif
+#ifndef PCI_DEVICE_ID_NX2_57840_MF
+#define PCI_DEVICE_ID_NX2_57840_MF 0x16a4
+#endif
+#ifndef PCI_DEVICE_ID_NX2_57840_VF
+#define PCI_DEVICE_ID_NX2_57840_VF 0x16ad
+#endif
+#ifndef PCI_DEVICE_ID_NX2_57840_2_20
+#define PCI_DEVICE_ID_NX2_57840_2_20   0x16a2
+#endif
+#ifndef PCI_DEVICE_ID_NX2_57840_4_10
+#define PCI_DEVICE_ID_NX2_57840_4_10   0x16a1
+#endif

This doesn't belong in your header file.  Most of the IDs are already in
pci_ids.h; I added the few which weren't.


I had to add these since some of them were not there in pci_ids.h yet.  
If you have retained a few that are not in pci_ids.h file, it fine with me.


Thanks,
Bhanu


James







--
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 5/5] bnx2fc: Bumped version to 1.0.14

2013-05-01 Thread Bhanu Prakash Gollapudi

On 05/01/2013 06:05 PM, James Bottomley wrote:

On Fri, 2013-03-08 at 15:53 -0800, Bhanu Prakash Gollapudi wrote:

On 03/08/2013 01:28 PM, Bhanu Prakash Gollapudi wrote:

Signed-off-by: Bhanu Prakash Gollapudi bprak...@broadcom.com
---
   drivers/scsi/bnx2fc/bnx2fc.h  |2 +-
   drivers/scsi/bnx2fc/bnx2fc_fcoe.c |2 +-
   2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc.h b/drivers/scsi/bnx2fc/bnx2fc.h
index 676dba3..1ece6e9 100644
--- a/drivers/scsi/bnx2fc/bnx2fc.h
+++ b/drivers/scsi/bnx2fc/bnx2fc.h
@@ -64,7 +64,7 @@
   #include bnx2fc_constants.h
   
   #define BNX2FC_NAME		bnx2fc

-#define BNX2FC_VERSION 1.0.13
+#define BNX2FC_VERSION 1.0.14
   
   #define PFX			bnx2fc: 
   
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c

index 1e852d6..9ab62da 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -22,7 +22,7 @@ DEFINE_PER_CPU(struct bnx2fc_percpu_s, bnx2fc_percpu);
   
   #define DRV_MODULE_NAME		bnx2fc

   #define DRV_MODULE_VERSION   BNX2FC_VERSION
-#define DRV_MODULE_RELDATE Dec 21, 2012
+#define DRV_MODULE_RELDATE Mar 08, 2012

James, I realized there was a typo in the date - 2012 instead of 2013.

Please apply this patch instead. Sorry for the inconvenience.


Signed-off-by: Bhanu Prakash Gollapudi bprak...@broadcom.com
---
   drivers/scsi/bnx2fc/bnx2fc.h  |2 +-
   drivers/scsi/bnx2fc/bnx2fc_fcoe.c |2 +-
   2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc.h b/drivers/scsi/bnx2fc/bnx2fc.h
index 676dba3..1ece6e9 100644
--- a/drivers/scsi/bnx2fc/bnx2fc.h
+++ b/drivers/scsi/bnx2fc/bnx2fc.h
@@ -64,7 +64,7 @@
   #include bnx2fc_constants.h

   #define BNX2FC_NAMEbnx2fc
-#define BNX2FC_VERSION1.0.13
+#define BNX2FC_VERSION1.0.14

   #define PFXbnx2fc: 

diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index 1e852d6..9ab62da 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -22,7 +22,7 @@ DEFINE_PER_CPU(struct bnx2fc_percpu_s, bnx2fc_percpu);

   #define DRV_MODULE_NAMEbnx2fc
   #define DRV_MODULE_VERSIONBNX2FC_VERSION
-#define DRV_MODULE_RELDATEDec 21, 2012
+#define DRV_MODULE_RELDATEMar 08, 2013

This doesn't actually apply ... your mailer has converted tabs to
spaces.  Since it's only a couple of lines, I fixed it up by hand this
time ...

James




Thanks for taking care of this, James.

Bhanu


--
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 0/5] bnx2fc version 1.0.14

2013-04-18 Thread Bhanu Prakash Gollapudi

On 03/08/2013 01:28 PM, Bhanu Prakash Gollapudi wrote:

Hi James,

Please consider including the following patches for 3.9+ merge window.

Thanks,
Bhanu

Bhanu Prakash Gollapudi (5):
   bnx2fc: Enable cached tasks to improve performance
   bnx2fc: Include chip number in the symbolic name
   bnx2fc: Fix race condition between IO completion and abort
   bnx2fc: Update copyright information
   bnx2fc: Bumped version to 1.0.14

  drivers/scsi/bnx2fc/bnx2fc.h  |   57 +++-
  drivers/scsi/bnx2fc/bnx2fc_els.c  |2 +-
  drivers/scsi/bnx2fc/bnx2fc_fcoe.c |   55 ++-
  drivers/scsi/bnx2fc/bnx2fc_hwi.c  |8 -
  drivers/scsi/bnx2fc/bnx2fc_io.c   |9 --
  drivers/scsi/bnx2fc/bnx2fc_tgt.c  |2 +-
  6 files changed, 116 insertions(+), 17 deletions(-)



Hi James,

I see that these patches were not picked up by you yet.  Please let me 
know if you're waiting for any information.


thanks,
Bhanu


--
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: error handler scheduling

2013-04-02 Thread Bhanu Prakash Gollapudi

On 03/27/2013 07:35 AM, Hannes Reinecke wrote:

On 03/27/2013 03:11 AM, James Smart wrote:

In looking through the error handler, if a command times out and is
added to the eh_cmd_q for the shost, the error handler is only
awakened once shost-host_busy (total number of i/os posted to the
shost) is equal to shost-host_failed (number of i/o that have been
failed and put on the eh_cmd_q).  Which means, any other i/o that
was outstanding must either complete or have their timeout fire.
Additionally, as all further i/o is held off at the block layer as
the shost is in recovery, new i/o cannot be submitted until the
error handler runs and resolves the errored i/os.

Is this true ?


Yes.


I take it is also true that the midlayer thus expects every i/o to
have an i/o timeout.  True ?


Yes. But this is guaranteed by the block-layer:

void blk_add_timer(struct request *req)
{
struct request_queue *q = req-q;
unsigned long expiry;

if (!q-rq_timed_out_fn)
return;

BUG_ON(!list_empty(req-timeout_list));
BUG_ON(test_bit(REQ_ATOM_COMPLETE, req-atomic_flags));

/*
 * Some LLDs, like scsi, peek at the timeout to prevent a
 * command from being retried forever.
 */
if (!req-timeout)
req-timeout = q-rq_timeout;


So every request will have a timeout, either the default request_queue 
timeout or an individual one.



The crux of this point is that when the recovery thread runs to
aborts the timed out i/os, is at the mercy of the last command to
complete or timeout. Additionally, as all further i/o is held off at
the block layer as the shost is in recovery, new i/o cannot be
submitted until the error handler runs and resolves the errored
i/os. So all I/O on the host is stopped until that last i/o
completes/times out.   The timeouts may be eons later.  Consider
SCSI format commands or verify commands that can take hours to
complete.


Yes, that's true. Unfortunately.


Specifically, I'm in a situation currently, where an application is
using sg to send a command to a target. The app selected no-timeout
- by setting timeout to MAX_INT. Effectively it's so large its
infinite. This I/O was one of those lost on the storage fabric.
There was another command that long ago timed out and is sitting on
the error handlers queue. But nothing is happening - new i/o, or
error handler to resolve the failed i/o, until that inifinite i/o
completes.


Hehe. no timeout != MAX_INT.

It's easy to apply a timeout if none is set. But how do we determine 
what constitutes a valid timeout?


As mentioned, some command can literally take forever, _and_ being 
fully legit. So who are we to decide?



I'm hoping I hear that I just misunderstand things.  If not,  is
there a suggestion for how to resolve this predicament ? IMHO,
I'm surprised we stop all i/o for error handling, and that it can be
so long later... I would assume there's a minimum bound we would
wait in the error handler (30s?) before we unconditionally run it
and abort anything that was outstanding.


Ah, the joys of error recovery.

Incidentally, that'll be one of the topics I'll be discussing at LSF; 
I've been bitten by this on various other occasions.


AFAIK the reasoning behind the current error recovery strategy is that 
it's modelled after SCSI parallel behaviour, where you basically have 
to stop the entire bus, figure out which state it's in, and then take 
corrective action.

And you typically don't have any LUNs to deal with.
_And_ SPI is essentially single-threaded when it comes to target 
access, so in effect you cannot send commands over the bus when 
resetting a target.

So there it makes sense.

Less so for modern fabrics, where target access is governed by an I_T 
nexus, any of which is largely independent on others.


Actually there is another issue with the error handler:
The commands will only be release after eh is done.

If you look at the eh sequence
- eh_abort
  - eh_lun_reset
- eh_target_reset
  - eh_bus_reset
- eh_host_reset
the command itself is only meaningful until lun_reset() has completed; 
after lun_reset() the command is invalided.

Every other stage still uses the scsi command as an argument,
but only as a place holder to figure out which device it should act upon.

So we _could_ speed up things by quite a lot when we were able to call 
-done() on the command after lun reset; then the command would be 
returned to the upper layers.

And things like multipath could kick in an move I/O to other
devices.

However, this is a daunting task.
I've tried, and it's far from easy.
_Especially_ do to some FC HBAs insisting on using scmds for sending 
TARGET RESET TMFs.
If we just could do a LOGO for target reset things would become so 
much easier ...

For FC HBAs, as per FCP-4:
12.5.1 ABTS error recovery
If a response to an ABTS is not received within 2 times R_A_TOVELS, the 
initiator FCP_Port may transmit the ABTS again, attempt other retry 
operations allowed by FC-FS-3, or explicitly 

[PATCH 3/5] bnx2fc: Fix race condition between IO completion and abort

2013-03-08 Thread Bhanu Prakash Gollapudi
When IO is successfully completed while an abort is pending, eh_abort
incorrectly assumes that abort failed and performes recovery by issuing
cleanup. Howerver, cleanup timesout as the firmware has no clue about
this IO. Fix this by checking if the IO has already completed.

Signed-off-by: Bhanu Prakash Gollapudi bprak...@broadcom.com
---
 drivers/scsi/bnx2fc/bnx2fc_io.c |7 +--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c
index 60798e8..539b95b 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_io.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_io.c
@@ -1269,8 +1269,11 @@ int bnx2fc_eh_abort(struct scsi_cmnd *sc_cmd)
 
spin_lock_bh(tgt-tgt_lock);
io_req-wait_for_comp = 0;
-   if (!(test_and_set_bit(BNX2FC_FLAG_ABTS_DONE,
-   io_req-req_flags))) {
+   if (test_bit(BNX2FC_FLAG_IO_COMPL, io_req-req_flags)) {
+   BNX2FC_IO_DBG(io_req, IO completed in a different context\n);
+   rc = SUCCESS;
+   } else if (!(test_and_set_bit(BNX2FC_FLAG_ABTS_DONE,
+ io_req-req_flags))) {
/* Let the scsi-ml try to recover this command */
printk(KERN_ERR PFX abort failed, xid = 0x%x\n,
   io_req-xid);
-- 
1.7.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 5/5] bnx2fc: Bumped version to 1.0.14

2013-03-08 Thread Bhanu Prakash Gollapudi
Signed-off-by: Bhanu Prakash Gollapudi bprak...@broadcom.com
---
 drivers/scsi/bnx2fc/bnx2fc.h  |2 +-
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc.h b/drivers/scsi/bnx2fc/bnx2fc.h
index 676dba3..1ece6e9 100644
--- a/drivers/scsi/bnx2fc/bnx2fc.h
+++ b/drivers/scsi/bnx2fc/bnx2fc.h
@@ -64,7 +64,7 @@
 #include bnx2fc_constants.h
 
 #define BNX2FC_NAMEbnx2fc
-#define BNX2FC_VERSION 1.0.13
+#define BNX2FC_VERSION 1.0.14
 
 #define PFXbnx2fc: 
 
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c 
b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index 1e852d6..9ab62da 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -22,7 +22,7 @@ DEFINE_PER_CPU(struct bnx2fc_percpu_s, bnx2fc_percpu);
 
 #define DRV_MODULE_NAMEbnx2fc
 #define DRV_MODULE_VERSION BNX2FC_VERSION
-#define DRV_MODULE_RELDATE Dec 21, 2012
+#define DRV_MODULE_RELDATE Mar 08, 2012
 
 
 static char version[] =
-- 
1.7.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 2/5] bnx2fc: Include chip number in the symbolic name

2013-03-08 Thread Bhanu Prakash Gollapudi
Signed-off-by: Bhanu Prakash Gollapudi bprak...@broadcom.com
---
 drivers/scsi/bnx2fc/bnx2fc.h  |   53 +
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |   51 +++
 2 files changed, 98 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc.h b/drivers/scsi/bnx2fc/bnx2fc.h
index 50fcd01..2f118e3 100644
--- a/drivers/scsi/bnx2fc/bnx2fc.h
+++ b/drivers/scsi/bnx2fc/bnx2fc.h
@@ -68,6 +68,57 @@
 
 #define PFXbnx2fc: 
 
+#define BCM_CHIP_LEN   16
+
+#ifndef PCI_DEVICE_ID_NX2_57710
+#define PCI_DEVICE_ID_NX2_577100x164e
+#endif
+#ifndef PCI_DEVICE_ID_NX2_57711
+#define PCI_DEVICE_ID_NX2_577110x164f
+#endif
+#ifndef PCI_DEVICE_ID_NX2_57712
+#define PCI_DEVICE_ID_NX2_577120x1662
+#endif
+#ifndef PCI_DEVICE_ID_NX2_57712_MF
+#define PCI_DEVICE_ID_NX2_57712_MF 0x1663
+#endif
+#ifndef PCI_DEVICE_ID_NX2_57712_VF
+#define PCI_DEVICE_ID_NX2_57712_VF 0x166f
+#endif
+#ifndef PCI_DEVICE_ID_NX2_57800
+#define PCI_DEVICE_ID_NX2_578000x168a
+#endif
+#ifndef PCI_DEVICE_ID_NX2_57800_MF
+#define PCI_DEVICE_ID_NX2_57800_MF 0x16a5
+#endif
+#ifndef PCI_DEVICE_ID_NX2_57800_VF
+#define PCI_DEVICE_ID_NX2_57800_VF 0x16a9
+#endif
+#ifndef PCI_DEVICE_ID_NX2_57810
+#define PCI_DEVICE_ID_NX2_578100x168e
+#endif
+#ifndef PCI_DEVICE_ID_NX2_57810_MF
+#define PCI_DEVICE_ID_NX2_57810_MF 0x16ae
+#endif
+#ifndef PCI_DEVICE_ID_NX2_57810_VF
+#define PCI_DEVICE_ID_NX2_57810_VF 0x16af
+#endif
+#ifndef PCI_DEVICE_ID_NX2_57840
+#define PCI_DEVICE_ID_NX2_578400x168d
+#endif
+#ifndef PCI_DEVICE_ID_NX2_57840_MF
+#define PCI_DEVICE_ID_NX2_57840_MF 0x16a4
+#endif
+#ifndef PCI_DEVICE_ID_NX2_57840_VF
+#define PCI_DEVICE_ID_NX2_57840_VF 0x16ad
+#endif
+#ifndef PCI_DEVICE_ID_NX2_57840_2_20
+#define PCI_DEVICE_ID_NX2_57840_2_20   0x16a2
+#endif
+#ifndef PCI_DEVICE_ID_NX2_57840_4_10
+#define PCI_DEVICE_ID_NX2_57840_4_10   0x16a1
+#endif
+
 #define BNX2X_DOORBELL_PCI_BAR 2
 
 #define BNX2FC_MAX_BD_LEN  0x
@@ -243,6 +294,8 @@ struct bnx2fc_hba {
int wait_for_link_down;
int num_ofld_sess;
struct list_head vports;
+
+   char chip_num[BCM_CHIP_LEN];
 };
 
 struct bnx2fc_interface {
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c 
b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index 2daf4b0..dd2c5c9 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -679,6 +679,7 @@ static int bnx2fc_shost_config(struct fc_lport *lport, 
struct device *dev)
 {
struct fcoe_port *port = lport_priv(lport);
struct bnx2fc_interface *interface = port-priv;
+   struct bnx2fc_hba *hba = interface-hba;
struct Scsi_Host *shost = lport-host;
int rc = 0;
 
@@ -699,8 +700,9 @@ static int bnx2fc_shost_config(struct fc_lport *lport, 
struct device *dev)
}
if (!lport-vport)
fc_host_max_npiv_vports(lport-host) = USHRT_MAX;
-   sprintf(fc_host_symbolic_name(lport-host), %s v%s over %s,
-   BNX2FC_NAME, BNX2FC_VERSION,
+   snprintf(fc_host_symbolic_name(lport-host), 256,
+%s (Broadcom %s) v%s over %s,
+   BNX2FC_NAME, hba-chip_num, BNX2FC_VERSION,
interface-netdev-name);
 
return 0;
@@ -1649,23 +1651,60 @@ mem_err:
 static int bnx2fc_bind_pcidev(struct bnx2fc_hba *hba)
 {
struct cnic_dev *cnic;
+   struct pci_dev *pdev;
 
if (!hba-cnic) {
printk(KERN_ERR PFX cnic is NULL\n);
return -ENODEV;
}
cnic = hba-cnic;
-   hba-pcidev = cnic-pcidev;
-   if (hba-pcidev)
-   pci_dev_get(hba-pcidev);
+   pdev = hba-pcidev = cnic-pcidev;
+   if (!hba-pcidev)
+   return -ENODEV;
 
+   switch (pdev-device) {
+   case PCI_DEVICE_ID_NX2_57710:
+   strncpy(hba-chip_num, BCM57710, BCM_CHIP_LEN);
+   break;
+   case PCI_DEVICE_ID_NX2_57711:
+   strncpy(hba-chip_num, BCM57711, BCM_CHIP_LEN);
+   break;
+   case PCI_DEVICE_ID_NX2_57712:
+   case PCI_DEVICE_ID_NX2_57712_MF:
+   case PCI_DEVICE_ID_NX2_57712_VF:
+   strncpy(hba-chip_num, BCM57712, BCM_CHIP_LEN);
+   break;
+   case PCI_DEVICE_ID_NX2_57800:
+   case PCI_DEVICE_ID_NX2_57800_MF:
+   case PCI_DEVICE_ID_NX2_57800_VF:
+   strncpy(hba-chip_num, BCM57800, BCM_CHIP_LEN);
+   break;
+   case PCI_DEVICE_ID_NX2_57810:
+   case PCI_DEVICE_ID_NX2_57810_MF:
+   case PCI_DEVICE_ID_NX2_57810_VF:
+   strncpy(hba-chip_num, BCM57810, BCM_CHIP_LEN);
+   break;
+   case PCI_DEVICE_ID_NX2_57840:
+   case PCI_DEVICE_ID_NX2_57840_MF:
+   case PCI_DEVICE_ID_NX2_57840_VF:
+   case PCI_DEVICE_ID_NX2_57840_2_20:
+   case PCI_DEVICE_ID_NX2_57840_4_10

[PATCH 1/5] bnx2fc: Enable cached tasks to improve performance

2013-03-08 Thread Bhanu Prakash Gollapudi
Set perf_config to 3 during firmware initialization to enable both
cached connections as well as cached tasks.

Signed-off-by: Bhanu Prakash Gollapudi bprak...@broadcom.com
---
 drivers/scsi/bnx2fc/bnx2fc_hwi.c |6 +-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc_hwi.c b/drivers/scsi/bnx2fc/bnx2fc_hwi.c
index 85ea98a..c1fa69e 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_hwi.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_hwi.c
@@ -126,7 +126,11 @@ int bnx2fc_send_fw_fcoe_init_msg(struct bnx2fc_hba *hba)
fcoe_init3.error_bit_map_lo = 0x;
fcoe_init3.error_bit_map_hi = 0x;
 
-   fcoe_init3.perf_config = 1;
+   /*
+* enable both cached connection and cached tasks
+* 0 = none, 1 = cached connection, 2 = cached tasks, 3 = both
+*/
+   fcoe_init3.perf_config = 3;
 
kwqe_arr[0] = (struct kwqe *) fcoe_init1;
kwqe_arr[1] = (struct kwqe *) fcoe_init2;
-- 
1.7.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 0/5] bnx2fc version 1.0.14

2013-03-08 Thread Bhanu Prakash Gollapudi
Hi James,

Please consider including the following patches for 3.9+ merge window.

Thanks,
Bhanu

Bhanu Prakash Gollapudi (5):
  bnx2fc: Enable cached tasks to improve performance
  bnx2fc: Include chip number in the symbolic name
  bnx2fc: Fix race condition between IO completion and abort
  bnx2fc: Update copyright information
  bnx2fc: Bumped version to 1.0.14

 drivers/scsi/bnx2fc/bnx2fc.h  |   57 +++-
 drivers/scsi/bnx2fc/bnx2fc_els.c  |2 +-
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |   55 ++-
 drivers/scsi/bnx2fc/bnx2fc_hwi.c  |8 -
 drivers/scsi/bnx2fc/bnx2fc_io.c   |9 --
 drivers/scsi/bnx2fc/bnx2fc_tgt.c  |2 +-
 6 files changed, 116 insertions(+), 17 deletions(-)


--
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 5/5] bnx2fc: Bumped version to 1.0.14

2013-03-08 Thread Bhanu Prakash Gollapudi

On 03/08/2013 01:28 PM, Bhanu Prakash Gollapudi wrote:

Signed-off-by: Bhanu Prakash Gollapudi bprak...@broadcom.com
---
  drivers/scsi/bnx2fc/bnx2fc.h  |2 +-
  drivers/scsi/bnx2fc/bnx2fc_fcoe.c |2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc.h b/drivers/scsi/bnx2fc/bnx2fc.h
index 676dba3..1ece6e9 100644
--- a/drivers/scsi/bnx2fc/bnx2fc.h
+++ b/drivers/scsi/bnx2fc/bnx2fc.h
@@ -64,7 +64,7 @@
  #include bnx2fc_constants.h
  
  #define BNX2FC_NAME		bnx2fc

-#define BNX2FC_VERSION 1.0.13
+#define BNX2FC_VERSION 1.0.14
  
  #define PFX			bnx2fc: 
  
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c

index 1e852d6..9ab62da 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -22,7 +22,7 @@ DEFINE_PER_CPU(struct bnx2fc_percpu_s, bnx2fc_percpu);
  
  #define DRV_MODULE_NAME		bnx2fc

  #define DRV_MODULE_VERSIONBNX2FC_VERSION
-#define DRV_MODULE_RELDATE Dec 21, 2012
+#define DRV_MODULE_RELDATE Mar 08, 2012

James, I realized there was a typo in the date - 2012 instead of 2013.

Please apply this patch instead. Sorry for the inconvenience.


Signed-off-by: Bhanu Prakash Gollapudi bprak...@broadcom.com
---
 drivers/scsi/bnx2fc/bnx2fc.h  |2 +-
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc.h b/drivers/scsi/bnx2fc/bnx2fc.h
index 676dba3..1ece6e9 100644
--- a/drivers/scsi/bnx2fc/bnx2fc.h
+++ b/drivers/scsi/bnx2fc/bnx2fc.h
@@ -64,7 +64,7 @@
 #include bnx2fc_constants.h

 #define BNX2FC_NAMEbnx2fc
-#define BNX2FC_VERSION1.0.13
+#define BNX2FC_VERSION1.0.14

 #define PFXbnx2fc: 

diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c 
b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c

index 1e852d6..9ab62da 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -22,7 +22,7 @@ DEFINE_PER_CPU(struct bnx2fc_percpu_s, bnx2fc_percpu);

 #define DRV_MODULE_NAMEbnx2fc
 #define DRV_MODULE_VERSIONBNX2FC_VERSION
-#define DRV_MODULE_RELDATEDec 21, 2012
+#define DRV_MODULE_RELDATEMar 08, 2013


 static char version[] =
--
1.7.1


thanks,
Bhanu
  
  
  static char version[] =




--
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 5/15] drivers/scsi/bnx2fc/bnx2fc_io.c: adjust duplicate test

2013-01-21 Thread Bhanu Prakash Gollapudi

On 01/21/2013 05:02 AM, Julia Lawall wrote:

From: Julia Lawall julia.law...@lip6.fr

Delete successive tests to the same location.  The code tested the result
of a previous allocation, that itself was already tested.  It is changed to
test the result of the most recent allocation.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// smpl
@s exists@
local idexpression y;
expression x,e;
@@

*if ( \(x == NULL\|IS_ERR(x)\|y != 0\) )
  { ... when forall
return ...; }
... when != \(y = e\|y += e\|y -= e\|y |= e\|y = e\|y++\|y--\|y\)
 when != \(XT_GETPAGE(...,y)\|WMI_CMD_BUF(...)\)
*if ( \(x == NULL\|IS_ERR(x)\|y != 0\) )
  { ... when forall
return ...; }
// /smpl

Signed-off-by: Julia Lawall julia.law...@lip6.fr

---
  drivers/scsi/bnx2fc/bnx2fc_io.c |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c
index 8d4626c..8bea53d 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_io.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_io.c
@@ -654,7 +654,7 @@ int bnx2fc_init_mp_req(struct bnx2fc_cmd *io_req)
mp_req-mp_resp_bd = dma_alloc_coherent(hba-pcidev-dev, sz,
 mp_req-mp_resp_bd_dma,
 GFP_ATOMIC);
-   if (!mp_req-mp_req_bd) {
+   if (!mp_req-mp_resp_bd) {
printk(KERN_ERR PFX unable to alloc MP resp bd\n);
bnx2fc_free_mp_resc(io_req);
return FAILED;



Acked-by: Bhanu Prakash Gollapudi bprak...@broadcom.com


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


[v2 PATCH 3/8] bnx2fc: support software fcoe target

2013-01-10 Thread Bhanu Prakash Gollapudi
James, Please pick up v2 version of patch 3 in the patch series.
If you have already picked up the patches, please let me know so
that I can create a new patch.

Thanks.

V2: incorrectly used bitwise 'or' instead of bitwise 'and' operation. Fixed it
in this V2 patch.

Software FCoE target always advertises RETRY bit even when there are no
tape LUNs behind the target. This causes the driver to enable FW support
for sequence level error recovery and perform REC/SRR. This patch
arrests the behavior by not enabling SLER feature for this target.

Signed-off-by: Bhanu Prakash Gollapudi bprak...@broadcom.com
---
 drivers/scsi/bnx2fc/bnx2fc_tgt.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc_tgt.c b/drivers/scsi/bnx2fc/bnx2fc_tgt.c
index b9d0d9c..eba2328 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_tgt.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_tgt.c
@@ -381,7 +381,9 @@ static int bnx2fc_init_tgt(struct bnx2fc_rport *tgt,
tgt-rq_cons_idx = 0;
atomic_set(tgt-num_active_ios, 0);
 
-   if (rdata-flags  FC_RP_FLAGS_RETRY) {
+   if (rdata-flags  FC_RP_FLAGS_RETRY 
+   rdata-ids.roles  FC_RPORT_ROLE_FCP_TARGET 
+   !(rdata-ids.roles  FC_RPORT_ROLE_FCP_INITIATOR)) {
tgt-dev_type = TYPE_TAPE;
tgt-io_timeout = 0; /* use default ULP timeout */
} else {
-- 
1.7.0.6


--
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 0/8] bnx2fc version 1.0.13

2012-12-21 Thread Bhanu Prakash Gollapudi
Hi James,

Please consider including the following patches in 3.8+ merge window.

Thanks,
Bhanu

Bhanu Prakash Gollapudi (6):
  bnx2fc: support software fcoe target
  bnx2fc: Move offload/upload wait logic into a function
  bnx2fc: Map the doorbell register between offload and enable requests
  bnx2fc: Tx/Rx byte counts reset to 0 when exceeding 32 bit values
  bnx2fc: Support max IO size to 512KB
  bnx2fc: Bumped version to 1.0.13

Cyril Roelandt (1):
  bnx2fc: remove useless calls to memset().

Julia Lawall (1):
  bnx2fc: Remove potential NULL dereference

 drivers/scsi/bnx2fc/bnx2fc.h  |   27 ++-
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |   21 +---
 drivers/scsi/bnx2fc/bnx2fc_hwi.c  |   29 ++-
 drivers/scsi/bnx2fc/bnx2fc_io.c   |6 ++-
 drivers/scsi/bnx2fc/bnx2fc_tgt.c  |   95 +++-
 5 files changed, 100 insertions(+), 78 deletions(-)


--
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 2/8] bnx2fc: Remove potential NULL dereference

2012-12-21 Thread Bhanu Prakash Gollapudi
From: Julia Lawall julia.law...@lip6.fr

If the NULL test is necessary, the initialization involving a dereference of
the tested value should be moved after the NULL test.

The sematic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)

// smpl
@@
type T;
expression E;
identifier i,fld;
statement S;
@@

- T i = E-fld;
+ T i;
  ... when != E
  when != i
  if (E == NULL) S
+ i = E-fld;
// /smpl

Signed-off-by: Julia Lawall julia.law...@lip6.fr
Signed-off-by: Bhanu Prakash Gollapudi bprak...@broadcom.com
---
 drivers/scsi/bnx2fc/bnx2fc_io.c |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c
index 8d4626c..c661ccd 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_io.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_io.c
@@ -685,8 +685,8 @@ int bnx2fc_init_mp_req(struct bnx2fc_cmd *io_req)
 static int bnx2fc_initiate_tmf(struct scsi_cmnd *sc_cmd, u8 tm_flags)
 {
struct fc_lport *lport;
-   struct fc_rport *rport = starget_to_rport(scsi_target(sc_cmd-device));
-   struct fc_rport_libfc_priv *rp = rport-dd_data;
+   struct fc_rport *rport;
+   struct fc_rport_libfc_priv *rp;
struct fcoe_port *port;
struct bnx2fc_interface *interface;
struct bnx2fc_rport *tgt;
@@ -704,6 +704,7 @@ static int bnx2fc_initiate_tmf(struct scsi_cmnd *sc_cmd, u8 
tm_flags)
unsigned long start = jiffies;
 
lport = shost_priv(host);
+   rport = starget_to_rport(scsi_target(sc_cmd-device));
port = lport_priv(lport);
interface = port-priv;
 
@@ -712,6 +713,7 @@ static int bnx2fc_initiate_tmf(struct scsi_cmnd *sc_cmd, u8 
tm_flags)
rc = FAILED;
goto tmf_err;
}
+   rp = rport-dd_data;
 
rc = fc_block_scsi_eh(sc_cmd);
if (rc)
-- 
1.7.0.6


--
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 1/8] bnx2fc: remove useless calls to memset().

2012-12-21 Thread Bhanu Prakash Gollapudi
From: Cyril Roelandt tipec...@gmail.com

These calls are followed by calls to memcpy() on the same memory area, so they
can be safely removed.

Signed-off-by: Cyril Roelandt tipec...@gmail.com
Signed-off-by: Bhanu Prakash Gollapudi bprak...@broadcom.com
---
 drivers/scsi/bnx2fc/bnx2fc_hwi.c |4 
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc_hwi.c b/drivers/scsi/bnx2fc/bnx2fc_hwi.c
index 6d6eee4..c31523b 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_hwi.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_hwi.c
@@ -759,8 +759,6 @@ static void bnx2fc_process_unsol_compl(struct bnx2fc_rport 
*tgt, u16 wqe)
case FCOE_ERROR_CODE_DATA_SOFN_SEQ_ACTIVE_RESET:
BNX2FC_TGT_DBG(tgt, REC TOV popped for xid - 0x%x\n,
   xid);
-   memset(io_req-err_entry, 0,
-  sizeof(struct fcoe_err_report_entry));
memcpy(io_req-err_entry, err_entry,
   sizeof(struct fcoe_err_report_entry));
if (!test_bit(BNX2FC_FLAG_SRR_SENT,
@@ -847,8 +845,6 @@ ret_err_rqe:
goto ret_warn_rqe;
}
 
-   memset(io_req-err_entry, 0,
-  sizeof(struct fcoe_err_report_entry));
memcpy(io_req-err_entry, err_entry,
   sizeof(struct fcoe_err_report_entry));
 
-- 
1.7.0.6


--
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 6/8] bnx2fc: Tx/Rx byte counts reset to 0 when exceeding 32 bit values

2012-12-21 Thread Bhanu Prakash Gollapudi
Since the FW counters are 32-bit, accumulate the stats in the driver.

Signed-off-by: Bhanu Prakash Gollapudi bprak...@broadcom.com
---
 drivers/scsi/bnx2fc/bnx2fc.h  |   22 ++
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |   17 -
 2 files changed, 34 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc.h b/drivers/scsi/bnx2fc/bnx2fc.h
index 6c9e717..6bbc0c1 100644
--- a/drivers/scsi/bnx2fc/bnx2fc.h
+++ b/drivers/scsi/bnx2fc/bnx2fc.h
@@ -156,6 +156,18 @@
 #define BNX2FC_RELOGIN_WAIT_TIME   200
 #define BNX2FC_RELOGIN_WAIT_CNT10
 
+#define BNX2FC_STATS(hba, stat, cnt)   \
+   do {\
+   u32 val;\
+   \
+   val = fw_stats-stat.cnt;   \
+   if (hba-prev_stats.stat.cnt = val)\
+   val -= hba-prev_stats.stat.cnt;\
+   else\
+   val += (0xfff - hba-prev_stats.stat.cnt);  \
+   hba-bfw_stats.cnt += val;  \
+   } while (0);
+
 /* bnx2fc driver uses only one instance of fcoe_percpu_s */
 extern struct fcoe_percpu_s bnx2fc_global;
 
@@ -167,6 +179,14 @@ struct bnx2fc_percpu_s {
spinlock_t fp_work_lock;
 };
 
+struct bnx2fc_fw_stats {
+   u64 fc_crc_cnt;
+   u64 fcoe_tx_pkt_cnt;
+   u64 fcoe_rx_pkt_cnt;
+   u64 fcoe_tx_byte_cnt;
+   u64 fcoe_rx_byte_cnt;
+};
+
 struct bnx2fc_hba {
struct list_head list;
struct cnic_dev *cnic;
@@ -207,6 +227,8 @@ struct bnx2fc_hba {
struct bnx2fc_rport **tgt_ofld_list;
 
/* statistics */
+   struct bnx2fc_fw_stats bfw_stats;
+   struct fcoe_statistics_params prev_stats;
struct fcoe_statistics_params *stats_buffer;
dma_addr_t stats_buf_dma;
struct completion stat_req_done;
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c 
b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index e055865..e021e43 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -687,11 +687,16 @@ static struct fc_host_statistics 
*bnx2fc_get_host_stats(struct Scsi_Host *shost)
BNX2FC_HBA_DBG(lport, FW stat req timed out\n);
return bnx2fc_stats;
}
-   bnx2fc_stats-invalid_crc_count += fw_stats-rx_stat2.fc_crc_cnt;
-   bnx2fc_stats-tx_frames += fw_stats-tx_stat.fcoe_tx_pkt_cnt;
-   bnx2fc_stats-tx_words += (fw_stats-tx_stat.fcoe_tx_byte_cnt) / 4;
-   bnx2fc_stats-rx_frames += fw_stats-rx_stat0.fcoe_rx_pkt_cnt;
-   bnx2fc_stats-rx_words += (fw_stats-rx_stat0.fcoe_rx_byte_cnt) / 4;
+   BNX2FC_STATS(hba, rx_stat2, fc_crc_cnt);
+   bnx2fc_stats-invalid_crc_count += hba-bfw_stats.fc_crc_cnt;
+   BNX2FC_STATS(hba, tx_stat, fcoe_tx_pkt_cnt);
+   bnx2fc_stats-tx_frames += hba-bfw_stats.fcoe_tx_pkt_cnt;
+   BNX2FC_STATS(hba, tx_stat, fcoe_tx_byte_cnt);
+   bnx2fc_stats-tx_words += ((hba-bfw_stats.fcoe_tx_byte_cnt) / 4);
+   BNX2FC_STATS(hba, rx_stat0, fcoe_rx_pkt_cnt);
+   bnx2fc_stats-rx_frames += hba-bfw_stats.fcoe_rx_pkt_cnt;
+   BNX2FC_STATS(hba, rx_stat0, fcoe_rx_byte_cnt);
+   bnx2fc_stats-rx_words += ((hba-bfw_stats.fcoe_rx_byte_cnt) / 4);
 
bnx2fc_stats-dumped_frames = 0;
bnx2fc_stats-lip_count = 0;
@@ -700,6 +705,8 @@ static struct fc_host_statistics 
*bnx2fc_get_host_stats(struct Scsi_Host *shost)
bnx2fc_stats-loss_of_signal_count = 0;
bnx2fc_stats-prim_seq_protocol_err_count = 0;
 
+   memcpy(hba-prev_stats, hba-stats_buffer,
+  sizeof(struct fcoe_statistics_params));
return bnx2fc_stats;
 }
 
-- 
1.7.0.6


--
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 7/8] bnx2fc: Support max IO size to 512KB

2012-12-21 Thread Bhanu Prakash Gollapudi
Increase max_sectors from 512 to 1024 in order to support max IO size of 512KB.

Signed-off-by: Bhanu Prakash Gollapudi bprak...@broadcom.com
---
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c 
b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index e021e43..3701eab 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -2667,7 +2667,7 @@ static struct scsi_host_template bnx2fc_shost_template = {
.can_queue  = BNX2FC_CAN_QUEUE,
.use_clustering = ENABLE_CLUSTERING,
.sg_tablesize   = BNX2FC_MAX_BDS_PER_CMD,
-   .max_sectors= 512,
+   .max_sectors= 1024,
 };
 
 static struct libfc_function_template bnx2fc_libfc_fcn_templ = {
-- 
1.7.0.6


--
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 5/8] bnx2fc: Map the doorbell register between offload and enable requests

2012-12-21 Thread Bhanu Prakash Gollapudi
We used to map doorbell register after FW enable request is complete.
This causes a race condition when unsolicited event is received, and FW
sends a CQE for it. Since the doorbell is not mapped, driver does not
arm CQ, which means FW will not notify the driver for further CQ
completions.  To resolve this, map the doorbell between offload and
enable, so that driver is ready to receive the unsolicited packets and
arm the CQ as soon as FW enable is performed.

Signed-off-by: Bhanu Prakash Gollapudi bprak...@broadcom.com
---
 drivers/scsi/bnx2fc/bnx2fc.h |3 +++
 drivers/scsi/bnx2fc/bnx2fc_hwi.c |   25 ++---
 drivers/scsi/bnx2fc/bnx2fc_tgt.c |   26 +-
 3 files changed, 26 insertions(+), 28 deletions(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc.h b/drivers/scsi/bnx2fc/bnx2fc.h
index 3486845..6c9e717 100644
--- a/drivers/scsi/bnx2fc/bnx2fc.h
+++ b/drivers/scsi/bnx2fc/bnx2fc.h
@@ -280,6 +280,7 @@ struct bnx2fc_rport {
 #define BNX2FC_FLAG_UPLD_REQ_COMPL 0x7
 #define BNX2FC_FLAG_EXPL_LOGO  0x8
 #define BNX2FC_FLAG_DISABLE_FAILED 0x9
+#define BNX2FC_FLAG_ENABLED0xa
 
u8 src_addr[ETH_ALEN];
u32 max_sqes;
@@ -468,6 +469,8 @@ int bnx2fc_send_fw_fcoe_init_msg(struct bnx2fc_hba *hba);
 int bnx2fc_send_fw_fcoe_destroy_msg(struct bnx2fc_hba *hba);
 int bnx2fc_send_session_ofld_req(struct fcoe_port *port,
struct bnx2fc_rport *tgt);
+int bnx2fc_send_session_enable_req(struct fcoe_port *port,
+   struct bnx2fc_rport *tgt);
 int bnx2fc_send_session_disable_req(struct fcoe_port *port,
struct bnx2fc_rport *tgt);
 int bnx2fc_send_session_destroy_req(struct bnx2fc_hba *hba,
diff --git a/drivers/scsi/bnx2fc/bnx2fc_hwi.c b/drivers/scsi/bnx2fc/bnx2fc_hwi.c
index c31523b..46163e2 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_hwi.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_hwi.c
@@ -347,7 +347,7 @@ int bnx2fc_send_session_ofld_req(struct fcoe_port *port,
  * @port:  port structure pointer
  * @tgt:   bnx2fc_rport structure pointer
  */
-static int bnx2fc_send_session_enable_req(struct fcoe_port *port,
+int bnx2fc_send_session_enable_req(struct fcoe_port *port,
struct bnx2fc_rport *tgt)
 {
struct kwqe *kwqe_arr[2];
@@ -1120,7 +1120,6 @@ static void bnx2fc_process_ofld_cmpl(struct bnx2fc_hba 
*hba,
struct bnx2fc_interface *interface;
u32 conn_id;
u32 context_id;
-   int rc;
 
conn_id = ofld_kcqe-fcoe_conn_id;
context_id = ofld_kcqe-fcoe_conn_context_id;
@@ -1149,17 +1148,10 @@ static void bnx2fc_process_ofld_cmpl(struct bnx2fc_hba 
*hba,
resources\n);
set_bit(BNX2FC_FLAG_CTX_ALLOC_FAILURE, tgt-flags);
}
-   goto ofld_cmpl_err;
} else {
-
-   /* now enable the session */
-   rc = bnx2fc_send_session_enable_req(port, tgt);
-   if (rc) {
-   printk(KERN_ERR PFX enable session failed\n);
-   goto ofld_cmpl_err;
-   }
+   /* FW offload request successfully completed */
+   set_bit(BNX2FC_FLAG_OFFLOADED, tgt-flags);
}
-   return;
 ofld_cmpl_err:
set_bit(BNX2FC_FLAG_OFLD_REQ_CMPL, tgt-flags);
wake_up_interruptible(tgt-ofld_wait);
@@ -1206,15 +1198,9 @@ static void bnx2fc_process_enable_conn_cmpl(struct 
bnx2fc_hba *hba,
printk(KERN_ERR PFX bnx2fc-enbl_cmpl: HBA mis-match\n);
goto enbl_cmpl_err;
}
-   if (ofld_kcqe-completion_status)
-   goto enbl_cmpl_err;
-   else {
+   if (!ofld_kcqe-completion_status)
/* enable successful - rport ready for issuing IOs */
-   set_bit(BNX2FC_FLAG_OFFLOADED, tgt-flags);
-   set_bit(BNX2FC_FLAG_OFLD_REQ_CMPL, tgt-flags);
-   wake_up_interruptible(tgt-ofld_wait);
-   }
-   return;
+   set_bit(BNX2FC_FLAG_ENABLED, tgt-flags);
 
 enbl_cmpl_err:
set_bit(BNX2FC_FLAG_OFLD_REQ_CMPL, tgt-flags);
@@ -1247,6 +1233,7 @@ static void bnx2fc_process_conn_disable_cmpl(struct 
bnx2fc_hba *hba,
/* disable successful */
BNX2FC_TGT_DBG(tgt, disable successful\n);
clear_bit(BNX2FC_FLAG_OFFLOADED, tgt-flags);
+   clear_bit(BNX2FC_FLAG_ENABLED, tgt-flags);
set_bit(BNX2FC_FLAG_DISABLED, tgt-flags);
set_bit(BNX2FC_FLAG_UPLD_REQ_COMPL, tgt-flags);
wake_up_interruptible(tgt-upld_wait);
diff --git a/drivers/scsi/bnx2fc/bnx2fc_tgt.c b/drivers/scsi/bnx2fc/bnx2fc_tgt.c
index cc4a4fd..1d4c56e 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_tgt.c
+++ b/drivers/scsi/bnx2fc

Re: [PATCH 05/16] libfcoe, fcoe, bnx2fc: Add new fcoe control interface

2012-12-16 Thread Bhanu Prakash Gollapudi

On 12/12/2012 03:22 PM, Robert Love wrote:

+ssize_t fcoe_ctlr_create_store(struct bus_type *bus,
+  const char *buf, size_t count)
+{
+   struct net_device *netdev = NULL;
+   struct fcoe_transport *ft = NULL;
+   struct fcoe_ctlr_device *ctlr_dev = NULL;
+   int rc = 0;
+   int err;
+
+   mutex_lock(ft_mutex);
+
+   netdev = fcoe_if_to_netdev(buf);
+   if (!netdev) {
+   LIBFCOE_TRANSPORT_DBG(Invalid device %s.\n, buf);
+   rc = -ENODEV;
+   goto out_nodev;
+   }
+
+   ft = fcoe_netdev_map_lookup(netdev);
+   if (ft) {
+   LIBFCOE_TRANSPORT_DBG(transport %s already has existing 
+ FCoE instance on %s.\n,
+ ft-name, netdev-name);
+   rc = -EEXIST;
+   goto out_putdev;
+   }
+
+   ft = fcoe_transport_lookup(netdev);
+   if (!ft) {
+   LIBFCOE_TRANSPORT_DBG(no FCoE transport found for %s.\n,
+ netdev-name);
+   rc = -ENODEV;
+   goto out_putdev;
+   }
+
+   /* pass to transport create */
+   err = ft-alloc ? ft-alloc(netdev) : -ENODEV;
+   if (err) {
+   fcoe_del_netdev_mapping(netdev);
+   rc = -ENOMEM;
+   goto out_putdev;
+   }
+
+   err = fcoe_add_netdev_mapping(netdev, ft);
+   if (err) {
+   LIBFCOE_TRANSPORT_DBG(failed to add new netdev mapping 
+ for FCoE transport %s for %s.\n,
+ ft-name, netdev-name);
+   rc = -ENODEV;
+   goto out_putdev;
+   }
+
+   LIBFCOE_TRANSPORT_DBG(transport %s %s to create fcoe on %s.\n,
+ ft-name, (ctlr_dev) ? succeeded : failed,
+ netdev-name);


ctlr_dev is initialized to NULL and not updated anywhere in this 
function, and hence the above debug statement will always say that 
'create' failed.



+
+out_putdev:
+   dev_put(netdev);
+out_nodev:
+   mutex_unlock(ft_mutex);
+   if (rc)
+   return rc;
+   return count;
+}




--
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 00/16] libfc, libfcoe and fcoe updates for 3.8

2012-12-16 Thread Bhanu Prakash Gollapudi

On 12/12/2012 03:22 PM, Robert Love wrote:

There are two primary changes within this update. Additionally there are two or 
three fix/cleanup patches.

The first change is the addition of the fcoe_sysfs control interfaces. These 
patches were well vetted on the scsi mailing list and have only seen validation and a 
minor fix or two, as the result testing, since the last RFC posting.

The second change is a cleanup/consolidation series from Yi that touches 
libfcoe.ko, fcoe.ko and bnx2fc.ko. These patches were well vetted on the fcoe 
mailing list and should be good to go as well. They make no functional change.

I will compose a pull-request and send it soon, but I wanted to make sure the 
most recent versions of these patches were posted to linux-scsi first.

---

Al Viro (1):
   debris left by [SCSI] libfcoe: Remove mutex_trylock/restart_syscall 
checks

Robert Love (7):
   Documentation: Add missing devices/ to devices path
   libfcoe: Save some memory and optimize name lookups
   libfcoe: Add fcoe_sysfs debug logging level
   libfcoe, fcoe, bnx2fc: Add new fcoe control interface
   fcoe: Use the fcoe_sysfs control interface
   bnx2fc: Use the fcoe_sysfs control interface
   libfc, libfcoe, fcoe: Convert debug_logging macros to pr_info

Vasu Dev (1):
   libfc: fix REC handling

Yi Zou (7):
   fcoe: prep work to start consolidate the usage of fcoe_netdev
   fcoe: add support to the get_netdev() for fcoe_interface
   libfcoe, fcoe: move fcoe_link_speed_update() to libfcoe and export it
   libfcoe, fcoe: consolidate the fcoe_ctlr_get_lesb/fcoe_get_lesb
   bnx2fc: add support to get_netdev for bnx2f_interface
   bnx2fc: use fcoe_link_speed_update() from the exported symbol in libfcoe
   bnx2fc: use fcoe_get_lesb/fcoe_ctlr_get_lesb() directly from libfcoe


  Documentation/ABI/testing/sysfs-bus-fcoe |   45 +
  drivers/scsi/bnx2fc/bnx2fc_fcoe.c|  256 +-
  drivers/scsi/fcoe/fcoe.c |  212 +++--
  drivers/scsi/fcoe/fcoe.h |6 -
  drivers/scsi/fcoe/fcoe_ctlr.c|   17 +-
  drivers/scsi/fcoe/fcoe_sysfs.c   |  186 ++
  drivers/scsi/fcoe/fcoe_transport.c   |  199 +++
  drivers/scsi/fcoe/libfcoe.h  |   20 +-
  drivers/scsi/libfc/fc_fcp.c  |6 -
  drivers/scsi/libfc/fc_libfc.h|   38 ++--
  include/scsi/fcoe_sysfs.h|   11 +
  include/scsi/libfcoe.h   |   32 
  12 files changed, 749 insertions(+), 279 deletions(-)


Changes look good to me, except for the minor comment in patch 5.

Reviewed-by: Bhanu Prakash Gollapudi bprak...@broadcom.com


--
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] bnx2fc: fix NULL checking in bnx2fc_initiate_tmf()

2012-11-05 Thread Bhanu Prakash Gollapudi

On 11/04/2012 10:15 PM, Xi Wang wrote:

The dereference rport-data should come after the NULL check of rport.

Signed-off-by: Xi Wang xi.w...@gmail.com
---
  drivers/scsi/bnx2fc/bnx2fc_io.c |3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c
index 8d4626c..eebe93c 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_io.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_io.c
@@ -686,7 +686,7 @@ static int bnx2fc_initiate_tmf(struct scsi_cmnd *sc_cmd, u8 
tm_flags)
  {
struct fc_lport *lport;
struct fc_rport *rport = starget_to_rport(scsi_target(sc_cmd-device));
-   struct fc_rport_libfc_priv *rp = rport-dd_data;
+   struct fc_rport_libfc_priv *rp;
struct fcoe_port *port;
struct bnx2fc_interface *interface;
struct bnx2fc_rport *tgt;
@@ -712,6 +712,7 @@ static int bnx2fc_initiate_tmf(struct scsi_cmnd *sc_cmd, u8 
tm_flags)
rc = FAILED;
goto tmf_err;
}
+   rp = rport-dd_data;
  
  	rc = fc_block_scsi_eh(sc_cmd);

if (rc)
I thought I acked similar patch sometime back, but this did not make it 
to the tree yet.


doing it again. Thanks!

Acked-by: Bhanu Prakash Gollapudi bprak...@broadcom.com


--
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: [RFC PATCH v2 5/5] bnx2fc: Use the fcoe_sysfs control interface

2012-10-01 Thread Bhanu Prakash Gollapudi

On 09/26/2012 07:02 PM, Robert Love wrote:

This patch adds support for the new fcoe_sysfs
control interface to bnx2fc.ko. It keeps the deprecated
interface in tact and therefore either the legacy
or the new control interfaces can be used. A mixed mode
is not supported. A user must either use the new
interfaces or the old ones, but not both.

The fcoe_ctlr's link state is now driven by both the
netdev link state as well as the fcoe_ctlr_device's
enabled attribute. The link must be up and the
fcoe_ctlr_device must be enabled before the FCoE
Controller starts discovery or login.

Signed-off-by: Robert Love robert.w.l...@intel.com


Changes look good to me. I did some testing and did not observe any 
issues, except that a small modification is required in _bnx2fc_create() 
(see below). In fact, I like the new design, as we do not have any user 
space compatibility issues.


I also see that even the non-netdev based FCoE driver can also take 
advantage of this provided they use libfcoe for FIP, which is good.


Thanks.


+/**
+ * _bnx2fc_create() - Create bnx2fc FCoE interface
+ * @netdev  :   The net_device object the Ethernet interface to create on
+ * @fip_mode:   The FIP mode for this creation
+ * @link_state: The ctlr link state on creation
   *
- * Called from sysfs.
+ * Called from either the libfcoe 'create' module parameter
+ * via fcoe_create or from fcoe_syfs's ctlr_create file.
+ *
+ * libfcoe's 'create' module parameter is deprecated so some
+ * consolidation of code can be done when that interface is
+ * removed.
   *
   * Returns: 0 for success
   */
-static int bnx2fc_create(struct net_device *netdev, enum fip_state fip_mode)
+static int _bnx2fc_create(struct net_device *netdev,
+ enum fip_state fip_mode,
+ enum bnx2fc_create_link_state link_state)
  {
+   struct fcoe_ctlr_device *cdev;
struct fcoe_ctlr *ctlr;
struct bnx2fc_interface *interface;
struct bnx2fc_hba *hba;
@@ -2111,7 +2177,15 @@ static int bnx2fc_create(struct net_device *netdev, enum 
fip_state fip_mode)
/* Make this master N_port */
ctlr-lp = lport;
  
-	if (!bnx2fc_link_ok(lport)) {

+   cdev = fcoe_ctlr_to_ctlr_dev(ctlr);
+
+   if (link_state == BNX2FC_CREATE_LINK_UP)
+   cdev-enabled = FCOE_CTLR_ENABLED;
+   else
+   cdev-enabled = FCOE_CTLR_DISABLED;
+
+   if (link_state == BNX2FC_CREATE_LINK_UP 
+   !bnx2fc_link_ok(lport)) {
fcoe_ctlr_link_up(ctlr);
fc_host_port_type(lport-host) = FC_PORTTYPE_NPORT;
set_bit(ADAPTER_STATE_READY, interface-hba-adapter_state);
bnx2fc needs the following check in _bnx2fc_create. Otherwise, during 
ifup, bnx2fc_ulp_start() may start the interface even if enabled is not set.


diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c 
b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c

index 60baf88..e96bf54 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -2193,7 +2193,8 @@ static int _bnx2fc_create(struct net_device *netdev,

BNX2FC_HBA_DBG(lport, create: START DISC\n);
bnx2fc_start_disc(interface);
-   interface-enabled = true;
+   if (link_state == BNX2FC_CREATE_LINK_UP)
+   interface-enabled = true;
/*
 * Release from kref_init in bnx2fc_interface_setup, on success
 * lport should be holding a reference taken in bnx2fc_if_create



@@ -2145,6 +2219,37 @@ mod_err:
  }
  
  /**

+ * bnx2fc_create() - Create a bnx2fc interface
+ * @netdev  : The net_device object the Ethernet interface to create on
+ * @fip_mode: The FIP mode for this creation
+ *
+ * Called from fcoe transport
+ *
+ * Returns: 0 for success
+ */
+static int bnx2fc_create(struct net_device *netdev, enum fip_state fip_mode)
+{
+   return _bnx2fc_create(netdev, fip_mode, BNX2FC_CREATE_LINK_UP);
+}
+
+/**
+ * bnx2fc_ctlr_alloc() - Allocate a bnx2fc interface from fcoe_sysfs
+ * @netdev: The net_device to be used by the allocated FCoE Controller
+ *
+ * This routine is called from fcoe_sysfs. It will start the fcoe_ctlr
+ * in a link_down state. The allows the user an opportunity to configure
+ * the FCoE Controller from sysfs before enabling the FCoE Controller.
+ *
+ * Creating in with this routine starts the FCoE Controller in Fabric
+ * mode. The user can change to VN2VN or another mode before enabling.
+ */
+static int bnx2fc_ctlr_alloc(struct net_device *netdev)
+{
+   return _bnx2fc_create(netdev, FIP_MODE_FABRIC,
+ BNX2FC_CREATE_LINK_DOWN);
+}
+
+/**
   * bnx2fc_find_hba_for_cnic - maps cnic instance to bnx2fc hba instance
   *
   * @cnic: Pointer to cnic device instance
@@ -2270,6 +2375,7 @@ static struct fcoe_transport bnx2fc_transport = {
.name = {bnx2fc},
.attached = false,
.list = LIST_HEAD_INIT(bnx2fc_transport.list),
+   .alloc = bnx2fc_ctlr_alloc,
.match = bnx2fc_match,

Re: [RFC PATCH 4/5] bnx2fc: Use new fcoe_sysfs control interface

2012-09-14 Thread Bhanu Prakash Gollapudi

On 09/10/2012 03:59 PM, Robert Love wrote:

Convert bnx2fc to use the new fcoe_sysfs create, delete,
enable, disable, start and mode.

bnx2fc doesn't support VN2VN. bnx2fc will not initialize
the set_fcoe_ctlr_mode routine and therefore its instances
will always be in FABRIC mode. There was previously an
explicit check for the ctlr's mode, but this is no longer
needed because not implementing set_fcoe_ctlr_mode implies
that the ctlr cannot change from the FABRIC mode.

Signed-off-by: Robert Love robert.w.l...@intel.com
---
  drivers/scsi/bnx2fc/bnx2fc_fcoe.c |   98 +++--
  1 file changed, 60 insertions(+), 38 deletions(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c 
b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index f52f668f..560c8c8 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c

snip


  /**
+ * bnx2fc_alloc - Alocate a bnx2fc FCoE interface
+ *
+ * @cdev: The FCoE Controller Device to start
+ *
+ * Called from sysfs.
+ *
+ * Returns: 0 for success
+ */
+static int bnx2fc_start(struct fcoe_ctlr_device *cdev)
+{
+   struct fcoe_ctlr *ctlr = fcoe_ctlr_device_priv(cdev);
+   struct fc_lport *lport = ctlr-lp;
+   struct fcoe_port *port = lport_priv(lport);
+   struct bnx2fc_interface *interface = port-priv;
+
+   lport-boot_time = jiffies;
+
+   /* Make this master N_port */
+   ctlr-lp = lport;


ctlr-lp should be set in bnx2fc_alloc() as we access it here in the 
beginning of this function.



+
+   if (!bnx2fc_link_ok(lport)) {
+   fcoe_ctlr_link_up(ctlr);
+   fc_host_port_type(lport-host) = FC_PORTTYPE_NPORT;
+   set_bit(ADAPTER_STATE_READY, interface-hba-adapter_state);
+   }
+
+   BNX2FC_HBA_DBG(lport, create: START DISC\n);
+   bnx2fc_start_disc(interface);
I think more changes are required for bnx2fc as fc_lport_init() is 
called just before calling fc_fabric_login() - whcih is called during 
'start'. Because of this, if we just call 'create' followed by 'destroy' 
without calling 'start', lport is not initialized and I expect to see 
some panics when destroy is called.


Let me try testing your patches and send you any fixes that are required.


+   interface-enabled = true;
+
+   return 0;
+}
+
+/**
   * bnx2fc_find_hba_for_cnic - maps cnic instance to bnx2fc hba instance
   *
   * @cnic: Pointer to cnic device instance
@@ -2271,10 +2292,8 @@ static struct fcoe_transport bnx2fc_transport = {
.attached = false,
.list = LIST_HEAD_INIT(bnx2fc_transport.list),
.match = bnx2fc_match,
-   .create = bnx2fc_create,
+   .alloc = bnx2fc_alloc,
.destroy = bnx2fc_destroy,
-   .enable = bnx2fc_enable,
-   .disable = bnx2fc_disable,
  };
  
  /**

@@ -2514,6 +2533,9 @@ module_init(bnx2fc_mod_init);
  module_exit(bnx2fc_mod_exit);
  
  static struct fcoe_sysfs_function_template bnx2fc_fcoe_sysfs_templ = {

+   .set_fcoe_ctlr_start = bnx2fc_start,
+   .set_fcoe_ctlr_enable = bnx2fc_enable,
+   .set_fcoe_ctlr_disable = bnx2fc_disable,
.get_fcoe_ctlr_mode = fcoe_ctlr_get_fip_mode,
.get_fcoe_ctlr_link_fail = bnx2fc_ctlr_get_lesb,
.get_fcoe_ctlr_vlink_fail = bnx2fc_ctlr_get_lesb,






--
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: [RFC PATCH 0/5] Reorganize libfcoe control interfaces

2012-09-11 Thread Bhanu Prakash Gollapudi

On 9/11/2012 10:36 AM, Love, Robert W wrote:

On Tue 11 Sep 2012 10:06:29 AM PDT, Chris Leech wrote:

On Mon, Sep 10, 2012 at 3:59 PM, Robert Love robert.w.l...@intel.com wrote:


snip


1) Create/alloc the port
 - Allocate kernel memory and create per-instance sysfs devices
 - No discovery or login



# echo eth3.172-fcoe  /sys/bus/fcoe/ctlr_create


I'm assuming the existing functionality of automatically creating the 
vlan interface by fcoemon (using the cfg-ethX) continues to exist and 
the above is not a replacement for fcoeadm -c.




results in:

/sys/bus/fcoe/devices/ctlr_0/


2) Configure the port
 - Change mode, set ddp_min, etc...



# echo Fabric  /sys/bus/fcoe/devices/ctlr_0/mode

no visible change


3) Start the port
 - Begins discovery and/or login (depending on mode)



# echo 1  /sys/bus/fcoe/devices/ctlr_0/start

Begins discovery and login. Assuming there are FCFs then results in:

/sys/bus/fcoe/devices/fcf_0


I'm also assuming that the above three steps can be clubbed by 
fcoeutils, perhaps by adding 'mode' parameter into the cfg-ethX file. 
That way 'service fcoe start' will be no different with the proposed 
model, except that there will be multiple entry points into the driver 
(alloc, config, start) instead of just one (create).





4) Destroy the port
 - Logout and free all memory


# echo eth3.172-fcoe  /sys/bus/fcoe/ctlr_destroy

/sys/bus/fcoe/devices/ctlr_0 is removed.



I'm looking for feedback on using sysfs files as control interfaces that
the user (application) would write interface names to. I modeled this
series off of the bonding sysfs interface, but it was suggested to me that
it might not be a good example. I belive bonding uses two values per-file
a '+' or a '- to add or delete and then the ifname apended. I am simply
writing the ifname to the ctlr_create or ctlr_destroy.


Can you give an example session that goes through the 4 steps above
and what the sysfs hierarchy looks like at each step?  I mostly get it
from the patch descriptions, but I think it would help discussion of
your proposed interfaces to see an example of them in use.



See above. bash-style.


This feels a little awkward with all the special control files.  Have
you thought about something designed for creating kernel objects, like
configfs?  Similarly the separate start, enable, disable files vs.


Let me do some more reading about configfs. I may not have given it
enough thought.


having some sort of status attribute that can take different values.
I feel like these need to be rethought as attributes instead of
triggers.  Is there a big difference between start and enable?  Can
you achieve the split between create and start by having it come up in
a disabled state by default?



It's a good idea. I'll look into it.


That being said, I'm glad this is being reworked.  Do you have any
other functionality in mind that this is laying the groundwork for?



I have one feature and a few ideas. I currently have a patch that adds
a fabric selection feature. I add another RW attribute to the ctlr_X
device. If the user writes fabric name to the file libfcoe uses it in
it's FCF selection algorithm. Here's my commit message from that patch.
I can share the patch if people would like to see it too. The current
implementation also allows the user to force the login through a
specific FCF.

  libfcoe, bnx2fc, fcoe: Add 'selection' attribute

 This patch adds a 'selection' attribute to the
 fcoe_ctlr_device. The user can write either a
 '0x' prefixed fabric name or a ':' separated
 MAC address to this file. If a fabric name is
 provided the fcoe ctlr will only consider FCFs
 with the fabric name when choosing a FCF to login
 to. If a MAC address is provided the initiator
 will only login to a FCF with the given Ethernet
 address. Only one selection is valid at a time.

 There are corresponding changes to fcoe-utils
 to take advantage of this kernel feature and
 to make it more accessible for the user.

To accompany this feature I created a new fipfcf application based on
fipvlan that sends out a discovery solicitation and displays
advertising FCFs.

I've also been talking with Mark Rustad about doing an 'auto' mode
where Fabric discovery is attempted first and if it fails then it tries
VN2VN discovery, but so for we've only had hallway conversations about
it and nothing has been flushed out.

Thanks, 
//Rob�{.n�+���+%��lzwm��b�맲��r��zX���(����ܨ}���Ơz�j:+v���zZ+��+zf���h���~i���z��w���?�)ߢf




--
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: [RFC PATCH 0/5] Reorganize libfcoe control interfaces

2012-09-10 Thread Bhanu Prakash Gollapudi

On 9/10/2012 3:59 PM, Robert Love wrote:

The following series implements a move from using module parameters
as control interfaces to /sys/bus/fcoe based interfaces. A sysfs infrastructure
was added to the kernel a few cycles ago, this series builds on that work.

It moves the create, vn2vn_create, destroy, enable and disable interfaces
from /sys/module/libfcoe/parameters/ to various places under /sys/bus/fcoe/.
These interfaces simply are not module configurations- they are control
interfaces.

A second goal of this series is to change the initialization sequence for
a FCoE device. The result of this series is that interfaces created using
libfcoe.ko interfaces (i.e. fcoe.ko or bnx2fc.ko) will have the following
starting steps-

1) Create/alloc the port
- Allocate kernel memory and create per-instance sysfs devices
- No discovery or login

2) Configure the port
- Change mode, set ddp_min, etc...

3) Start the port
- Begins discovery and/or login (depending on mode)

4) Destroy the port
- Logout and free all memory


Robert, Can you please let me now what is the motivation for this change 
and what problem are we solving with this approach? Is this primarily to 
allow user to set the mode?


I'm concerned that we will be breaking user space compatibility with 
this change, as there should be a corresponding fcoemon/fipvlan change 
along with this, and existing utilities will not work.  Also the way we 
start fcoe will be completely different and the user may need to do the 
scripting changes, if any.


Thanks,
Bhanu



I'm looking for feedback on using sysfs files as control interfaces that
the user (application) would write interface names to. I modeled this
series off of the bonding sysfs interface, but it was suggested to me that
it might not be a good example. I belive bonding uses two values per-file
a '+' or a '- to add or delete and then the ifname apended. I am simply
writing the ifname to the ctlr_create or ctlr_destroy.

Series compiled and tested against v3.5. libfcoe.ko compile warning fixed
upstream after v3.5, anyone who compiles this can ignore section mismatch
warning. Also note that a modified fcoemon is needed to use the fcoe system
service against this kernel modification. I'd be happy to provide that
fcoemon code on request.

---

Robert Love (5):
   libfcoe, fcoe: Allow user to set a ctlr's mode
   libfcoe: Create new libfcoe control interfaces
   fcoe: Use new fcoe_sysfs control interface
   bnx2fc: Use new fcoe_sysfs control interface
   libfcoe, fcoe: Remove libfcoe module parameters


  Documentation/ABI/testing/sysfs-bus-fcoe |   51 +++
  drivers/scsi/bnx2fc/bnx2fc_fcoe.c|   98 -
  drivers/scsi/fcoe/fcoe.c |  229 +++---
  drivers/scsi/fcoe/fcoe.h |9 +
  drivers/scsi/fcoe/fcoe_ctlr.c|   24 +++
  drivers/scsi/fcoe/fcoe_sysfs.c   |  139 ++
  drivers/scsi/fcoe/fcoe_transport.c   |  174 ---
  include/scsi/fcoe_sysfs.h|5 +
  include/scsi/libfcoe.h   |   20 ++-
  9 files changed, 445 insertions(+), 304 deletions(-)




--
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: [RFC PATCH 0/5] Reorganize libfcoe control interfaces

2012-09-10 Thread Bhanu Prakash Gollapudi

On 9/10/2012 6:41 PM, Love, Robert W wrote:

On Mon 10 Sep 2012 05:05:20 PM PDT, Bhanu Prakash Gollapudi wrote:

On 9/10/2012 3:59 PM, Robert Love wrote:

The following series implements a move from using module parameters
as control interfaces to /sys/bus/fcoe based interfaces. A sysfs
infrastructure
was added to the kernel a few cycles ago, this series builds on that
work.

It moves the create, vn2vn_create, destroy, enable and disable
interfaces
from /sys/module/libfcoe/parameters/ to various places under
/sys/bus/fcoe/.
These interfaces simply are not module configurations- they are control
interfaces.

A second goal of this series is to change the initialization sequence
for
a FCoE device. The result of this series is that interfaces created
using
libfcoe.ko interfaces (i.e. fcoe.ko or bnx2fc.ko) will have the
following
starting steps-

1) Create/alloc the port
 - Allocate kernel memory and create per-instance sysfs devices
 - No discovery or login

2) Configure the port
 - Change mode, set ddp_min, etc...

3) Start the port
 - Begins discovery and/or login (depending on mode)

4) Destroy the port
 - Logout and free all memory


Robert, Can you please let me now what is the motivation for this
change and what problem are we solving with this approach? Is this
primarily to allow user to set the mode?



The main problem is that our control interfaces shouldn't be module
parameters. I think of module parameters as things that globally alter
the module.

I also think that moving to a create/configure/start model gives us
more flexibility going forward. We don't have too many FC/FCoE knobs to
tune right now, but if we wanted to add more we don't have a good way
to do it without starting the whole discovery/login process and then
making changes during the discovery/login.

I think the module parameter problem is the justification, but I'm
trying to be comprehensive in coming up with a flexible interface that
will allow us to evolve as well.


I'm concerned that we will be breaking user space compatibility with
this change, as there should be a corresponding fcoemon/fipvlan change
along with this, and existing utilities will not work.  Also the way
we start fcoe will be completely different and the user may need to do
the scripting changes, if any.


See the last statement from my initial posting (it's below). I have
patches to modify fcoemon to use these new interfaces. I'd be happy to
share them, I just didn't want to spam this broad of a audience.

Thanks Robert for the explanation. Appreciate if you could share the 
fcoeutils patches also.




--
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 2/5] drivers/scsi/bnx2fc/bnx2fc_io.c: Remove potential NULL dereference

2012-09-07 Thread Bhanu Prakash Gollapudi

On 8/14/2012 8:49 AM, Julia Lawall wrote:

From: Julia Lawall julia.law...@lip6.fr

If the NULL test is necessary, the initialization involving a dereference of
the tested value should be moved after the NULL test.

The sematic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)

// smpl
@@
type T;
expression E;
identifier i,fld;
statement S;
@@

- T i = E-fld;
+ T i;
   ... when != E
   when != i
   if (E == NULL) S
+ i = E-fld;
// /smpl

Signed-off-by: Julia Lawall julia.law...@lip6.fr

---
  drivers/scsi/bnx2fc/bnx2fc_io.c |3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c
index 73f231c..1dd82db 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_io.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_io.c
@@ -686,7 +686,7 @@ static int bnx2fc_initiate_tmf(struct scsi_cmnd *sc_cmd, u8 
tm_flags)
  {
struct fc_lport *lport;
struct fc_rport *rport = starget_to_rport(scsi_target(sc_cmd-device));
-   struct fc_rport_libfc_priv *rp = rport-dd_data;
+   struct fc_rport_libfc_priv *rp;
struct fcoe_port *port;
struct bnx2fc_interface *interface;
struct bnx2fc_rport *tgt;
@@ -712,6 +712,7 @@ static int bnx2fc_initiate_tmf(struct scsi_cmnd *sc_cmd, u8 
tm_flags)
rc = FAILED;
goto tmf_err;
}
+   rp = rport-dd_data;

rc = fc_block_scsi_eh(sc_cmd);
if (rc)



Thanks Julia.

Acked-by: Bhanu Prakash Gollapudi bprak...@broadcom.com


--
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] Fix incorrect memset in bnx2fc_parse_fcp_rsp

2012-09-03 Thread Bhanu Prakash Gollapudi

On 9/3/2012 11:50 AM, Andi Kleen wrote:

gcc 4.8 warns because the memset only clears sizeof(char *) bytes, not
the whole buffer. Use the correct buffer size and clear the whole sense
buffer.

/backup/lsrc/git/linux-lto-2.6/drivers/scsi/bnx2fc/bnx2fc_io.c: In
function 'bnx2fc_parse_fcp_rsp':
/backup/lsrc/git/linux-lto-2.6/drivers/scsi/bnx2fc/bnx2fc_io.c:1810:41:
warning: argument to 'sizeof' in 'memset' call is the same expression as
the destination; did you mean to provide an explicit length?
[-Wsizeof-pointer-memaccess]
memset(sc_cmd-sense_buffer, 0, sizeof(sc_cmd-sense_buffer));
  ^

Signed-off-by: Andi Kleen a...@linux.intel.com



diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c
index 73f231c..8d4626c 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_io.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_io.c
@@ -1807,7 +1807,7 @@ static void bnx2fc_parse_fcp_rsp(struct bnx2fc_cmd 
*io_req,
fcp_sns_len = SCSI_SENSE_BUFFERSIZE;
}

-   memset(sc_cmd-sense_buffer, 0, sizeof(sc_cmd-sense_buffer));
+   memset(sc_cmd-sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
if (fcp_sns_len)
memcpy(sc_cmd-sense_buffer, rq_data, fcp_sns_len);



Thanks Andi. Looks good to me.

Acked-by: Bhanu Prakash Gollapudi bprak...@broadcom.com


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