bnx2fc version 1.0.12
Subsystems (2)
cover bnx2fc version 1.0.12
James,
Please consider including the following patches in the 3.5+ merge window.
Thanks,
Bhanu
Bhanu Prakash Gollapudi (4):
bnx2fc: Support interface creation on non-VLAN interface also.
bnx2fc: Improve error recovery by handling parity errors
bnx2fc: use list_entry instead of explicit cast
bnx2fc: Bumped version to 1.0.12
Eric Dumazet (1):
bnx2fc: use kthread_create_on_node
Joe Perches (1):
bnx2fc: Reduce object size by consolidating formats
drivers/scsi/bnx2fc/Makefile | 3 +- drivers/scsi/bnx2fc/bnx2fc.h | 9 +++- drivers/scsi/bnx2fc/bnx2fc_debug.c | 70 ++++++++++++++++++++++++++++++++++ drivers/scsi/bnx2fc/bnx2fc_debug.h | 73 +++++++++--------------------------- drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 46 +++++++++++------------ drivers/scsi/bnx2fc/bnx2fc_hwi.c | 4 +- drivers/scsi/bnx2fc/bnx2fc_io.c | 21 +++------- drivers/scsi/bnx2fc/bnx2fc_tgt.c | 39 ++++++++++++------- 8 files changed, 153 insertions(+), 112 deletions(-) create mode 100644 drivers/scsi/bnx2fc/bnx2fc_debug.c
PATCH 1/6 bnx2fc: use kthread_create_on_node
From: Eric Dumazet <[email protected]>
Since bnx2fc_percpu_thread_create() creates percpu kthread, it makes sense to use kthread_create_on_node() to get proper NUMA affinity for kthread stack.
--- drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +3 -3
@@ -2290,9 +2290,9 @@ static void bnx2fc_percpu_thread_create(unsigned int cpu) p = &per_cpu (bnx2fc_percpu, cpu); - thread =kthread_create (bnx2fc_percpu_io_thread, - (void *)p, -"bnx2fc_thread/%d" , cpu); + thread =kthread_create_on_node (bnx2fc_percpu_io_thread, + (void *)p,cpu_to_node (cpu), +"bnx2fc_thread/%d" , cpu);/* bind thread to the cpu */ if (likely (!IS_ERR (thread))) {kthread_bind (thread, cpu);
Signature · 1 line
1.7.0.6
PATCH 2/6 bnx2fc: Reduce object size by consolidating formats
In reply to Bhanu Prakash GollapudiFrom: Joe Perches <[email protected]>
Deduplication of formats and consolidating tests
makes the object much smaller.
Add bnx2fc_debug.c, add functions for a few logging functions (BNX2FC_IO_DBG, BNX2FC_TGT_DBG, BNX2FC_HBA_DBG). Use printf extension %pV.
Add and use pr_fmt and pr_<level>.
Move the debug #include below structure definitions.
$ size drivers/scsi/bnx2fc/built-in.o* text data bss dec hex filename 101563 1165 24976 127704 1f2d8 drivers/scsi/bnx2fc/built-in.o.new 138473 1109 33400 172982 2a3b6 drivers/scsi/bnx2fc/built-in.o.old
--- drivers/scsi/bnx2fc/Makefile | 3 +- drivers/scsi/bnx2fc/bnx2fc.h | 6 ++- drivers/scsi/bnx2fc/bnx2fc_debug.c | 70 ++++++++++++++++++++++++++++++++++ drivers/scsi/bnx2fc/bnx2fc_debug.h | 73 +++++++++--------------------------- 4 files changed, 95 insertions(+), 57 deletions(-) create mode 100644 drivers/scsi/bnx2fc/bnx2fc_debug.c
drivers/scsi/bnx2fc/Makefile +2 -1
@@ -1,3 +1,4 @@ obj-$(CONFIG_SCSI_BNX2X_FCOE) += bnx2fc.o -bnx2fc-y := bnx2fc_els.o bnx2fc_fcoe.o bnx2fc_hwi.o bnx2fc_io.o bnx2fc_tgt.o +bnx2fc-y := bnx2fc_els.o bnx2fc_fcoe.o bnx2fc_hwi.o bnx2fc_io.o bnx2fc_tgt.o \ + bnx2fc_debug.o
drivers/scsi/bnx2fc/bnx2fc.h +5 -1
@@ -11,6 +11,8 @@* Written by: Bhanu Prakash Gollapudi ([email protected]) */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/module.h> #include <linux/moduleparam.h> #include <linux/kernel.h>
@@ -57,7 +59,6 @@#include <scsi/fc/fc_fcp.h> #include "57xx_hsi_bnx2fc.h" -#include "bnx2fc_debug.h" #include "../../net/ethernet/broadcom/cnic_if.h" #include "bnx2fc_constants.h"
@@ -554,4 +555,7 @@ void bnx2fc_process_seq_cleanup_compl(struct bnx2fc_cmd *seq_clnup_req,int bnx2fc_initiate_seq_cleanup (struct bnx2fc_cmd *orig_io_req,u32 offset,enum fc_rctl r_ctl); + +#include "bnx2fc_debug.h" +#endif
drivers/scsi/bnx2fc/bnx2fc_debug.c new file +70 -0
70 lines not on this page · raw message
drivers/scsi/bnx2fc/bnx2fc_debug.h +18 -55
78 lines not on this page · raw message
Signature · 1 line
1.7.0.6
PATCH 3/6 bnx2fc: Support interface creation on non-VLAN interface also.
In reply to Bhanu Prakash Gollapudibnx2fc had an assumption that the fcoe interface will always start on the vlan dev. However, some switch implementations (Eg., HP virtual connect FlexFabric) expects the fcoe interface to be started on physical interface. Do not error out if the netdev is not a vlan dev.
--- drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 33 +++++++++++++++++---------------- 1 files changed, 17 insertions(+), 16 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +17 -16
@@ -2019,11 +2019,11 @@ static int bnx2fc_create(struct net_device *netdev, enum fip_state fip_mode)struct fcoe_ctlr *ctlr;struct bnx2fc_interface *interface;struct bnx2fc_hba *hba; -struct net_device *phys_dev; +struct net_device *phys_dev = netdev;struct fc_lport *lport;struct ethtool_drvinfo drvinfo;int rc =0 ; -int vlan_id; +int vlan_id =0 ;BNX2FC_MISC_DBG ("Entered bnx2fc_create\n" );if (fip_mode !=FIP_MODE_FABRIC ) {
@@ -2041,14 +2041,9 @@ static int bnx2fc_create(struct net_device *netdev, enum fip_state fip_mode) }/* obtain physical netdev */ -if (netdev->priv_flags &IFF_802_1Q_VLAN ) { +if (netdev->priv_flags &IFF_802_1Q_VLAN ) phys_dev =vlan_dev_real_dev (netdev); - vlan_id =vlan_dev_vlan_id (netdev); - }else { - printk(KERN_ERR PFX "Not a vlan device\n"); - rc = -EINVAL ; - goto netdev_err; - } +/* verify if the physical device is a netxtreme2 device */ if (phys_dev->ethtool_ops && phys_dev->ethtool_ops->get_drvinfo) {memset (&drvinfo,0 ,sizeof (drvinfo));
@@ -2083,9 +2078,13 @@ static int bnx2fc_create(struct net_device *netdev, enum fip_state fip_mode) goto ifput_err; } +if (netdev->priv_flags &IFF_802_1Q_VLAN ) { + vlan_id =vlan_dev_vlan_id (netdev); + interface->vlan_enabled =1 ; + } + ctlr =bnx2fc_to_ctlr (interface); interface->vlan_id = vlan_id; - interface->vlan_enabled =1 ; interface->timer_work_queue =create_singlethread_workqueue ("bnx2fc_timer_wq" );
@@ -2252,15 +2251,17 @@ static int bnx2fc_fcoe_reset(struct Scsi_Host *shost)static bool bnx2fc_match (struct net_device *netdev) { +struct net_device *phys_dev = netdev; +mutex_lock (&bnx2fc_dev_lock); -if (netdev->priv_flags &IFF_802_1Q_VLAN ) { -struct net_device *phys_dev =vlan_dev_real_dev (netdev); +if (netdev->priv_flags &IFF_802_1Q_VLAN ) + phys_dev =vlan_dev_real_dev (netdev); -if (bnx2fc_hba_lookup (phys_dev)) { -mutex_unlock (&bnx2fc_dev_lock); -return true; - } +if (bnx2fc_hba_lookup (phys_dev)) { +mutex_unlock (&bnx2fc_dev_lock); +return true; } +mutex_unlock (&bnx2fc_dev_lock);return false; }
Signature · 1 line
1.7.0.6
PATCH 4/6 bnx2fc: Improve error recovery by handling parity errors
In reply to Bhanu Prakash GollapudiDuring parity errors, the ramrods are not issued to FW. bnx2fc waits for the timeout value, and proceeds with cleaning up the IOs. Since we are already out-of-sync with FW, cleanup commands timeout too, and do not get the completion. This operation takes 36 secs for each session to upload causing huge delays. To fix this, bnx2fc now gets a PARITY_ERROR from cnic driver, and upon failure, the driver does not issue any commands to the FW and finishes the upload process sooner.
--- drivers/scsi/bnx2fc/bnx2fc.h | 1 + drivers/scsi/bnx2fc/bnx2fc_hwi.c | 4 +++- drivers/scsi/bnx2fc/bnx2fc_tgt.c | 22 ++++++++++++++++++---- 3 files changed, 22 insertions(+), 5 deletions(-)
drivers/scsi/bnx2fc/bnx2fc.h +1 -0
@@ -275,6 +275,7 @@ struct bnx2fc_rport {#define BNX2FC_FLAG_CTX_ALLOC_FAILURE 0x6#define BNX2FC_FLAG_UPLD_REQ_COMPL 0x7#define BNX2FC_FLAG_EXPL_LOGO 0x8 +#define BNX2FC_FLAG_DISABLE_FAILED 0x9u8 src_addr[ETH_ALEN ];u32 max_sqes;
drivers/scsi/bnx2fc/bnx2fc_hwi.c +3 -1
@@ -1244,7 +1244,9 @@ static void bnx2fc_process_conn_disable_cmpl(struct bnx2fc_hba *hba,if (disable_kcqe->completion_status) { printk(KERN_ERR PFX "Disable failed with cmpl status %d\n", disable_kcqe->completion_status); -return ; +set_bit (BNX2FC_FLAG_DISABLE_FAILED , &tgt->flags); +set_bit (BNX2FC_FLAG_UPLD_REQ_COMPL , &tgt->flags); +wake_up_interruptible (&tgt->upld_wait); }else {/* disable successful */ BNX2FC_TGT_DBG (tgt,"disable successful\n" );
drivers/scsi/bnx2fc/bnx2fc_tgt.c +18 -4
@@ -181,8 +181,14 @@ void bnx2fc_flush_active_ios(struct bnx2fc_rport *tgt)set_bit (BNX2FC_FLAG_IO_COMPL , &io_req->req_flags);set_bit (BNX2FC_FLAG_IO_CLEANUP , &io_req->req_flags); - rc =bnx2fc_initiate_cleanup (io_req); -BUG_ON (rc); + +/* Do not issue cleanup when disable request failed */ +if (test_bit (BNX2FC_FLAG_DISABLE_FAILED , &tgt->flags)) +bnx2fc_process_cleanup_compl (io_req, io_req->task,0 ); +else { + rc =bnx2fc_initiate_cleanup (io_req); +BUG_ON (rc); + } }list_for_each_safe (list, tmp, &tgt->active_tm_queue) {
@@ -212,8 +218,13 @@ void bnx2fc_flush_active_ios(struct bnx2fc_rport *tgt) io_req->cb_arg =NULL ; } - rc =bnx2fc_initiate_cleanup (io_req); -BUG_ON (rc); +/* Do not issue cleanup when disable request failed */ +if (test_bit (BNX2FC_FLAG_DISABLE_FAILED , &tgt->flags)) +bnx2fc_process_cleanup_compl (io_req, io_req->task,0 ); +else { + rc =bnx2fc_initiate_cleanup (io_req); +BUG_ON (rc); + } }list_for_each_safe (list, tmp, &tgt->io_retire_queue) {
@@ -321,6 +332,9 @@ static void bnx2fc_upload_session(struct fcoe_port *port,del_timer_sync (&tgt->upld_timer); + }else if (test_bit (BNX2FC_FLAG_DISABLE_FAILED , &tgt->flags)) + printk(KERN_ERR PFX "ERROR!! DISABLE req failed, destroy" +" not sent to FW\n" ); }else printk(KERN_ERR PFX "ERROR!! DISABLE req timed out, destroy"" not sent to FW\n" );
Signature · 1 line
1.7.0.6
Re: [PATCH 4/6] bnx2fc: Improve error recovery by handling parity errors
drivers/scsi/bnx2fc/bnx2fc_tgt.c static void bnx2fc_upload_session(struct fcoe_port *port, · line 340
Quoted 10 lines · Bhanu Prakash Gollapudi
drivers/scsi/bnx2fc/bnx2fc_tgt.c +3
-0@@ -321,6 +332,9 @@ static void bnx2fc_upload_session(struct fcoe_port *port,del_timer_sync (&tgt->upld_timer); + }else if (test_bit (BNX2FC_FLAG_DISABLE_FAILED , &tgt->flags)) + printk(KERN_ERR PFX "ERROR!! DISABLE req failed, destroy" +" not sent to FW\n" ); }else printk(KERN_ERR PFX "ERROR!! DISABLE req timed out, destroy"" not sent to FW\n" );
You didn't actually compile this did you? That else if has to have an opening brace to match the closing one on the next else ...
James
Re: [PATCH 4/6] bnx2fc: Improve error recovery by handling parity errors
Quoted 5 lines · James Bottomley
Quoted 4 lines · Bhanu Prakash Gollapudi
drivers/scsi/bnx2fc/bnx2fc_tgt.c +0
-0@@ -321,6 +332,9 @@ static void bnx2fc_upload_session(struct fcoe_port *port,del_timer_sync (&tgt->upld_timer);
Quoted 9 lines
drivers/scsi/bnx2fc/bnx2fc_tgt.c static void bnx2fc_upload_session(struct fcoe_port *port, · line 340
Quoted 6 lines
drivers/scsi/bnx2fc/bnx2fc_tgt.c +3
-0+ }else if (test_bit (BNX2FC_FLAG_DISABLE_FAILED ,&tgt->flags)) + printk(KERN_ERR PFX "ERROR!! DISABLE req failed, destroy" +" not sent to FW\n" ); }else printk(KERN_ERR PFX "ERROR!! DISABLE req timed out, destroy"" not sent to FW\n" );You didn't actually compile this did you? That else if has to have an opening brace to match the closing one on the next else ...
My bad. I fixed this compilation error, but by mistake I applied that change to next patch. I'll correct it and submit the last three patches shortly, as you've already picked up the first three.
Thanks,
Bhanu
Quoted 4 lines
James
��칻�&�~�&���+-��ݶ��w��˛���m�b��lrȢ��^n�r���z���h����&���G���h�(�階�ݢj"���m�����z�ޖ���f���h���~�m�
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 5/6 bnx2fc: use list_entry instead of explicit cast
In reply to Bhanu Prakash GollapudiUse list_for_each_entry_safe() instead of explicit cast to avoid relying on struct layout
--- drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 5 +---- drivers/scsi/bnx2fc/bnx2fc_io.c | 21 +++++++-------------- drivers/scsi/bnx2fc/bnx2fc_tgt.c | 17 ++++++----------- 3 files changed, 14 insertions(+), 29 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +1 -4
@@ -2151,13 +2151,10 @@ mod_err:**/ static struct bnx2fc_hba *bnx2fc_find_hba_for_cnic (struct cnic_dev *cnic) { -struct list_head *list; -struct list_head *temp;struct bnx2fc_hba *hba;/* Called with bnx2fc_dev_lock held */ -list_for_each_safe (list, temp, &adapter_list) { - hba = (struct bnx2fc_hba *)list; +list_for_each_entry (hba, &adapter_list, list) {if (hba->cnic == cnic)return hba; }
drivers/scsi/bnx2fc/bnx2fc_io.c +7 -14
@@ -405,11 +405,10 @@ free_cmd_pool: goto free_cmgr;for (i =0 ; i <num_possible_cpus () +1 ; i++) { -struct list_head *list; -struct list_head *tmp; +struct bnx2fc_cmd *tmp, *io_req; -list_for_each_safe (list, tmp, &cmgr->free_list[i]) { -struct bnx2fc_cmd *io_req = (struct bnx2fc_cmd *)list; +list_for_each_entry_safe (io_req, tmp, + &cmgr->free_list[i], link) {list_del (&io_req->link);kfree (io_req); }
@@ -1436,9 +1435,7 @@ static void bnx2fc_lun_reset_cmpl(struct bnx2fc_cmd *io_req) {struct scsi_cmnd *sc_cmd = io_req->sc_cmd;struct bnx2fc_rport *tgt = io_req->tgt; -struct list_head *list; -struct list_head *tmp; -struct bnx2fc_cmd *cmd; +struct bnx2fc_cmd *cmd, *tmp;int tm_lun = sc_cmd->device->lun;int rc =0 ;int lun;
@@ -1449,9 +1446,8 @@ static void bnx2fc_lun_reset_cmpl(struct bnx2fc_cmd *io_req)* Walk thru the active_ios queue and ABORT the IO * that matches with the LUN that was reset */ -list_for_each_safe (list, tmp, &tgt->active_cmd_queue) { +list_for_each_entry_safe (cmd, tmp, &tgt->active_cmd_queue, link) {BNX2FC_TGT_DBG (tgt,"LUN RST cmpl: scan for pending IOs\n" ); - cmd = (struct bnx2fc_cmd *)list; lun = cmd->sc_cmd->device->lun;if (lun == tm_lun) {/* Initiate ABTS on this cmd */
@@ -1476,9 +1472,7 @@ static void bnx2fc_lun_reset_cmpl(struct bnx2fc_cmd *io_req)static void bnx2fc_tgt_reset_cmpl (struct bnx2fc_cmd *io_req) {struct bnx2fc_rport *tgt = io_req->tgt; -struct list_head *list; -struct list_head *tmp; -struct bnx2fc_cmd *cmd; +struct bnx2fc_cmd *cmd, *tmp;int rc =0 ;/* called with tgt_lock held */
@@ -1487,9 +1481,8 @@ static void bnx2fc_tgt_reset_cmpl(struct bnx2fc_cmd *io_req)* Walk thru the active_ios queue and ABORT the IO * that matches with the LUN that was reset */ -list_for_each_safe (list, tmp, &tgt->active_cmd_queue) { +list_for_each_entry_safe (cmd, tmp, &tgt->active_cmd_queue, link) {BNX2FC_TGT_DBG (tgt,"TGT RST cmpl: scan for pending IOs\n" ); - cmd = (struct bnx2fc_cmd *)list;/* Initiate ABTS */ if (!test_and_set_bit (BNX2FC_FLAG_ISSUE_ABTS , &cmd->req_flags)) {
drivers/scsi/bnx2fc/bnx2fc_tgt.c +6 -11
@@ -150,8 +150,7 @@ tgt_init_err:void bnx2fc_flush_active_ios (struct bnx2fc_rport *tgt) {struct bnx2fc_cmd *io_req; -struct list_head *list; -struct list_head *tmp; +struct bnx2fc_cmd *tmp;int rc;int i =0 ; BNX2FC_TGT_DBG(tgt, "Entered flush_active_ios - %d\n",
@@ -160,9 +159,8 @@ void bnx2fc_flush_active_ios(struct bnx2fc_rport *tgt)spin_lock_bh (&tgt->tgt_lock); tgt->flush_in_prog =1 ; -list_for_each_safe (list, tmp, &tgt->active_cmd_queue) { +list_for_each_entry_safe (io_req, tmp, &tgt->active_cmd_queue, link) { i++; - io_req = (struct bnx2fc_cmd *)list;list_del_init (&io_req->link); io_req->on_active_queue =0 ;BNX2FC_IO_DBG (io_req,"cmd_queue cleanup\n" );
@@ -191,9 +189,8 @@ void bnx2fc_flush_active_ios(struct bnx2fc_rport *tgt) } } -list_for_each_safe (list, tmp, &tgt->active_tm_queue) { +list_for_each_entry_safe (io_req, tmp, &tgt->active_tm_queue, link) { i++; - io_req = (struct bnx2fc_cmd *)list;list_del_init (&io_req->link); io_req->on_tmf_queue =0 ;BNX2FC_IO_DBG (io_req,"tm_queue cleanup\n" );
@@ -201,9 +198,8 @@ void bnx2fc_flush_active_ios(struct bnx2fc_rport *tgt)complete (&io_req->tm_done); } -list_for_each_safe (list, tmp, &tgt->els_queue) { +list_for_each_entry_safe (io_req, tmp, &tgt->els_queue, link) { i++; - io_req = (struct bnx2fc_cmd *)list;list_del_init (&io_req->link); io_req->on_active_queue =0 ;
@@ -227,9 +223,8 @@ void bnx2fc_flush_active_ios(struct bnx2fc_rport *tgt) } } -list_for_each_safe (list, tmp, &tgt->io_retire_queue) { +list_for_each_entry_safe (io_req, tmp, &tgt->io_retire_queue, link) { i++; - io_req = (struct bnx2fc_cmd *)list;list_del_init (&io_req->link);BNX2FC_IO_DBG (io_req,"retire_queue flush\n" );
@@ -335,7 +330,7 @@ static void bnx2fc_upload_session(struct fcoe_port *port, }else if (test_bit (BNX2FC_FLAG_DISABLE_FAILED , &tgt->flags)) printk(KERN_ERR PFX "ERROR!! DISABLE req failed, destroy"" not sent to FW\n" ); - }else +else printk(KERN_ERR PFX "ERROR!! DISABLE req timed out, destroy"" not sent to FW\n" );
Signature · 1 line
1.7.0.6
PATCH 6/6 bnx2fc: Bumped version to 1.0.12
In reply to Bhanu Prakash Gollapudi--- drivers/scsi/bnx2fc/bnx2fc.h | 2 +- drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/bnx2fc/bnx2fc.h +1 -1
@@ -63,7 +63,7 @@#include "bnx2fc_constants.h" #define BNX2FC_NAME "bnx2fc" -#define BNX2FC_VERSION "1.0.11" +#define BNX2FC_VERSION "1.0.12"#define PFX "bnx2fc: "
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +1 -1
@@ -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 "Apr 24, 2012" +#define DRV_MODULE_RELDATE "Jun 04, 2012" static char version[] __devinitdata =
Signature · 1 line
1.7.0.6