BNX2I: Patch set to fix various disconnect conditions
Subsystems (10)
A message that is not in the archive (sent off-list or not yet received): Eddie Wai <[email protected]
cover BNX2I: Patch set to fix various disconnect conditions
Hello,
This patch set contains various code fixes and optimization which mostly deals with disconnect and clean up issues.
Your comments are grealy appreciated. Please review, thanks.
Eddie
Eddie Wai (7):
BNX2I: Separated the hardware's cleanup procedure from ep_disconnect
BNX2I: Created an active linklist which holds bnx2i endpoints
BNX2I: Optimized the bnx2i_stop connection clean up procedure
BNX2I: Fine tuned conn destroy and context destroy timeout values
BNX2I: Fixed the TCP graceful termination initiation
BNX2I: Added host param ISCSI_HOST_PARAM_IPADDRESS
BNX2I: Updated version from 2.1.1 to 2.1.2
drivers/scsi/bnx2i/bnx2i.h | 14 +++ drivers/scsi/bnx2i/bnx2i_hwi.c | 4 + drivers/scsi/bnx2i/bnx2i_init.c | 39 ++++++- drivers/scsi/bnx2i/bnx2i_iscsi.c | 229 +++++++++++++++++++++++++++++--------- 4 files changed, 226 insertions(+), 60 deletions(-)
PATCH 1/7 BNX2I: Separated the hardware's cleanup procedure from ep_disconnect
In reply to a message not in the archiveThis patch introduces a new bnx2i_hw_ep_disconnect routine which contains all chip related disconnect and clean up procedure of iSCSI offload connections. This separation is intended as a preparation for the subsequent bnx2i_stop patch.
--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 122 ++++++++++++++++++++++++------------- 1 files changed, 79 insertions(+), 43 deletions(-)
drivers/scsi/bnx2i/bnx2i_iscsi.c +79 -43
@@ -1866,54 +1866,35 @@ static int bnx2i_ep_tcp_conn_active(struct bnx2i_endpoint *bnx2i_ep) } -/** -* bnx2i_ep_disconnect - executes TCP connection teardown process -* @ep: TCP connection (endpoint) handle +/* +* bnx2i_hw_ep_disconnect - executes TCP connection teardown process in the hw +* @ep: TCP connection (bnx2i endpoint) handle * * executes TCP connection teardown process */ -static void bnx2i_ep_disconnect (struct iscsi_endpoint *ep) +int bnx2i_hw_ep_disconnect (struct bnx2i_endpoint *bnx2i_ep) { -struct bnx2i_endpoint *bnx2i_ep; -struct bnx2i_conn *bnx2i_conn =NULL ; -struct iscsi_session *session =NULL ; -struct iscsi_conn *conn; +struct bnx2i_hba *hba = bnx2i_ep->hba;struct cnic_dev *cnic; -struct bnx2i_hba *hba; +struct iscsi_session *session =NULL ; +struct iscsi_conn *conn =NULL ; +int ret =0 ; - bnx2i_ep = ep->dd_data; +if (!hba) +return 0 ; -/* driver should not attempt connection cleanup until TCP_CONNECT -* completes either successfully or fails. Timeout is 9-secs, so -* wait for it to complete -*/ -while ((bnx2i_ep->state ==EP_STATE_CONNECT_START ) && - !time_after (jiffies, bnx2i_ep->timestamp + (12 *HZ ))) -msleep (250 ); + cnic = hba->cnic; +if (!cnic) +return 0 ; + +if (!bnx2i_ep_tcp_conn_active (bnx2i_ep)) + goto destroy_conn;if (bnx2i_ep->conn) { - bnx2i_conn = bnx2i_ep->conn; - conn = bnx2i_conn->cls_conn->dd_data; + conn = bnx2i_ep->conn->cls_conn->dd_data; session = conn->session; - -iscsi_suspend_queue (conn); } - hba = bnx2i_ep->hba; -if (bnx2i_ep->state ==EP_STATE_IDLE ) - goto return_bnx2i_ep; - cnic = hba->cnic; - -mutex_lock (&hba->net_dev_lock); - -if (!test_bit (ADAPTER_STATE_UP , &hba->adapter_state)) - goto free_resc; -if (bnx2i_ep->hba_age != hba->age) - goto free_resc; - -if (!bnx2i_ep_tcp_conn_active (bnx2i_ep)) - goto destory_conn; - bnx2i_ep->state =EP_STATE_DISCONN_START ;init_timer (&bnx2i_ep->ofld_timer);
@@ -1924,6 +1905,7 @@ static void bnx2i_ep_disconnect(struct iscsi_endpoint *ep)if (test_bit (BNX2I_CNIC_REGISTERED , &hba->reg_with_cnic)) {int close =0 ; +int close_ret =0 ;if (session) {spin_lock_bh (&session->lock);
@@ -1932,11 +1914,13 @@ static void bnx2i_ep_disconnect(struct iscsi_endpoint *ep)spin_unlock_bh (&session->lock); }if (close) - cnic->cm_close (bnx2i_ep->cm_sk); + close_ret = cnic->cm_close (bnx2i_ep->cm_sk);else - cnic->cm_abort (bnx2i_ep->cm_sk); + close_ret = cnic->cm_abort (bnx2i_ep->cm_sk); +if (close_ret) + bnx2i_ep->state =EP_STATE_DISCONN_COMPL ; }else - goto free_resc; + goto out;/* wait for option-2 conn teardown */ wait_event_interruptible(bnx2i_ep->ofld_wait,
@@ -1946,20 +1930,72 @@ static void bnx2i_ep_disconnect(struct iscsi_endpoint *ep)flush_signals (current);del_timer_sync (&bnx2i_ep->ofld_timer); -destory_conn: -if (bnx2i_tear_down_conn (hba, bnx2i_ep)) { +destroy_conn: +if (bnx2i_tear_down_conn (hba, bnx2i_ep)) + ret = -EINVAL ; +out: + bnx2i_ep->state =EP_STATE_IDLE ; +return ret; +} + + +/** +* bnx2i_ep_disconnect - executes TCP connection teardown process +* @ep: TCP connection (iscsi endpoint) handle +* +* executes TCP connection teardown process +*/ +static void bnx2i_ep_disconnect (struct iscsi_endpoint *ep) +{ +struct bnx2i_endpoint *bnx2i_ep; +struct bnx2i_conn *bnx2i_conn =NULL ; +struct iscsi_conn *conn =NULL ; +struct bnx2i_hba *hba; + + bnx2i_ep = ep->dd_data; + +/* driver should not attempt connection cleanup until TCP_CONNECT +* completes either successfully or fails. Timeout is 9-secs, so +* wait for it to complete +*/ +while ((bnx2i_ep->state ==EP_STATE_CONNECT_START ) && + !time_after (jiffies, bnx2i_ep->timestamp + (12 *HZ ))) +msleep (250 ); + +if (bnx2i_ep->conn) { + bnx2i_conn = bnx2i_ep->conn; + conn = bnx2i_conn->cls_conn->dd_data; +iscsi_suspend_queue (conn); + } + hba = bnx2i_ep->hba; +if (!hba) + goto out; + +mutex_lock (&hba->net_dev_lock); + +if (bnx2i_ep->state ==EP_STATE_IDLE ) + goto return_bnx2i_ep; + +if (!test_bit (ADAPTER_STATE_UP , &hba->adapter_state)) + goto free_resc; + +if (bnx2i_ep->hba_age != hba->age) + goto free_resc; + +/* Do all chip cleanup here */ +if (bnx2i_hw_ep_disconnect (bnx2i_ep)) {mutex_unlock (&hba->net_dev_lock);return ; } free_resc: -mutex_unlock (&hba->net_dev_lock);bnx2i_free_qp_resc (hba, bnx2i_ep); return_bnx2i_ep:if (bnx2i_conn) bnx2i_conn->ep =NULL ;bnx2i_free_ep (ep); - +mutex_unlock (&hba->net_dev_lock); +out:if (!hba->ofld_conns_active)bnx2i_unreg_dev_all ();
Signature · 1 line
1.7.0.5
Re: [PATCH 1/7] BNX2I: Separated the hardware's cleanup procedure from ep_disconnect
Quoted 21 lines · Eddie Wai
drivers/scsi/bnx2i/bnx2i_iscsi.c +21
-0+/** +* bnx2i_ep_disconnect - executes TCP connection teardown process +* @ep: TCP connection (iscsi endpoint) handle +* +* executes TCP connection teardown process +*/ +static void bnx2i_ep_disconnect (struct iscsi_endpoint *ep) +{ +struct bnx2i_endpoint *bnx2i_ep; +struct bnx2i_conn *bnx2i_conn =NULL ; +struct iscsi_conn *conn =NULL ; +struct bnx2i_hba *hba; + + bnx2i_ep = ep->dd_data; + +/* driver should not attempt connection cleanup until TCP_CONNECT +* completes either successfully or fails. Timeout is 9-secs, so +* wait for it to complete +*/ +while ((bnx2i_ep->state ==EP_STATE_CONNECT_START )&& + !time_after (jiffies, bnx2i_ep->timestamp + (12 *HZ )))
drivers/scsi/bnx2i/bnx2i_iscsi.c static void bnx2i_ep_disconnect(struct iscsi_endpoint *ep) · line 1972
Quoted 10 lines
drivers/scsi/bnx2i/bnx2i_iscsi.c +10
-0+msleep (250 ); + +if (bnx2i_ep->conn) { + bnx2i_conn = bnx2i_ep->conn; + conn = bnx2i_conn->cls_conn->dd_data; +iscsi_suspend_queue (conn); + } + hba = bnx2i_ep->hba; +if (!hba) + goto out;
Here you have a ep, so if you goto out you will not release it. Need to call iscsi_destroy_endpoint at least. Can you hit this "if" even?
Re: [PATCH 1/7] BNX2I: Separated the hardware's cleanup procedure from ep_disconnect
Hello Mike,
You're right. That extra checking for !hba was added recently as defensive programming and it should never hit. I'll remove it in v2.
Thanks,
Eddie
Quoted 37 lines · Mike Christie
Quoted 21 lines · Eddie Wai
drivers/scsi/bnx2i/bnx2i_iscsi.c +21
-0+/** +* bnx2i_ep_disconnect - executes TCP connection teardown process +* @ep: TCP connection (iscsi endpoint) handle +* +* executes TCP connection teardown process +*/ +static void bnx2i_ep_disconnect (struct iscsi_endpoint *ep) +{ +struct bnx2i_endpoint *bnx2i_ep; +struct bnx2i_conn *bnx2i_conn =NULL ; +struct iscsi_conn *conn =NULL ; +struct bnx2i_hba *hba; + + bnx2i_ep = ep->dd_data; + +/* driver should not attempt connection cleanup until TCP_CONNECT +* completes either successfully or fails. Timeout is 9-secs, so +* wait for it to complete +*/ +while ((bnx2i_ep->state ==EP_STATE_CONNECT_START )&& + !time_after (jiffies, bnx2i_ep->timestamp + (12 *HZ )))drivers/scsi/bnx2i/bnx2i_iscsi.c static void bnx2i_ep_disconnect(struct iscsi_endpoint *ep) · line 1972
Quoted 10 lines
drivers/scsi/bnx2i/bnx2i_iscsi.c +10
-0+msleep (250 ); + +if (bnx2i_ep->conn) { + bnx2i_conn = bnx2i_ep->conn; + conn = bnx2i_conn->cls_conn->dd_data; +iscsi_suspend_queue (conn); + } + hba = bnx2i_ep->hba; +if (!hba) + goto out;Here you have a ep, so if you goto out you will not release it. Need to call
iscsi_destroy_endpointat least. Can you hit this "if" even?
PATCH 2/7 BNX2I: Created an active linklist which holds bnx2i endpoints
In reply to a message not in the archiveThis introduces a new active linklist which would link up all active bnx2i_endpoints. This will be used by subsequent patches that follows.
--- drivers/scsi/bnx2i/bnx2i.h | 4 +++ drivers/scsi/bnx2i/bnx2i_iscsi.c | 43 +++++++++++++++++++++++++++++++++++++- 2 files changed, 46 insertions(+), 1 deletions(-)
drivers/scsi/bnx2i/bnx2i.h +4 -0
@@ -299,6 +299,7 @@ struct iscsi_cid_queue {* @cid_que: iscsi cid queue * @ep_rdwr_lock: read / write lock to synchronize various ep lists * @ep_ofld_list: connection list for pending offload completion +* @ep_active_list: connection list for active offload endpoints * @ep_destroy_list: connection list for pending offload completion * @mp_bd_tbl: BD table to be used with middle path requests * @mp_bd_dma: DMA address of 'mp_bd_tbl' memory buffer
@@ -369,6 +370,7 @@ struct bnx2i_hba {rwlock_t ep_rdwr_lock;struct list_head ep_ofld_list; +struct list_head ep_active_list;struct list_head ep_destroy_list;/*
@@ -645,6 +647,7 @@ enum {* @link: list head to link elements * @hba: adapter to which this connection belongs * @conn: iscsi connection this EP is linked to +* @cls_ep: associated iSCSI endpoint pointer * @sess: iscsi session this EP is linked to * @cm_sk: cnic sock struct * @hba_age: age to detect if 'iscsid' issues ep_disconnect()
@@ -664,6 +667,7 @@ struct bnx2i_endpoint {struct list_head link;struct bnx2i_hba *hba;struct bnx2i_conn *conn; +struct iscsi_endpoint *cls_ep;struct cnic_sock *cm_sk;u32 hba_age;u32 state;
drivers/scsi/bnx2i/bnx2i_iscsi.c +42 -1
91 lines not on this page · raw message
Signature · 1 line
1.7.0.5
A message that is not in the archive (sent off-list or not yet received): 1277516372-469-3-git-send-email-eddie.wai-dY08KVG/lbpWk0Htik3J/[email protected]
Re: [PATCH 2/7] BNX2I: Created an active linklist which holds bnx2i endpoints
Quoted 5 lines · Eddie Wai
drivers/scsi/bnx2i/bnx2i_iscsi.c +5
-0+/** +* bnx2i_ep_active_list_add - add an entry to ep active list +* @hba: pointer to adapter instance +* @ep: pointer to endpoint (transport indentifier) structure +*
drivers/scsi/bnx2i/bnx2i_iscsi.c bnx2i_find_ep_in_destroy_list(struct bnx2i_hba *hba, u32 iscsi_cid) · line 726
Quoted 10 lines
drivers/scsi/bnx2i/bnx2i_iscsi.c +10
-0+* current active conn queue manager +*/ +static int bnx2i_ep_active_list_add (struct bnx2i_hba *hba, +struct bnx2i_endpoint *ep) +{ +write_lock_bh (&hba->ep_rdwr_lock); +list_add_tail (&ep->link,&hba->ep_active_list); +write_unlock_bh (&hba->ep_rdwr_lock); +return 0 ; +}
I do not think you need the return here. It is always zero and no one ever checks it.
Quoted 7 lines
drivers/scsi/bnx2i/bnx2i_iscsi.c +7
-0+ + +/** +* bnx2i_ep_active_list_del - deletes an entry to ep active list +* @hba: pointer to adapter instance +* @ep: pointer to endpoint (transport indentifier) structure +*
drivers/scsi/bnx2i/bnx2i_iscsi.c bnx2i_find_ep_in_destroy_list(struct bnx2i_hba *hba, u32 iscsi_cid) · line 743
Quoted 10 lines
drivers/scsi/bnx2i/bnx2i_iscsi.c +10
-0+* current active conn queue manager +*/ +static int bnx2i_ep_active_list_del (struct bnx2i_hba *hba, +struct bnx2i_endpoint *ep) +{ +write_lock_bh (&hba->ep_rdwr_lock); +list_del_init (&ep->link); +write_unlock_bh (&hba->ep_rdwr_lock); +return 0 ; +}
Same as above.
drivers/scsi/bnx2i/bnx2i_iscsi.c static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost, · line 1798
Quoted 8 lines
drivers/scsi/bnx2i/bnx2i_iscsi.c +2
-0@@ -1755,6 +1792,8 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost, }else rc = cnic->cm_connect (bnx2i_ep->cm_sk,&saddr); +bnx2i_ep_active_list_add (hba, bnx2i_ep); +if (rc) goto release_ep;
This is a little strange. It seems cleaner to just do:
if (bnx2i_map_ep_dbell_regs(bnx2i_ep))
goto del_active_ep:del_active_ep:
bnx2i_ep_active_list_del(hba, bnx2i_ep);
release_ep:
if (bnx2i_tear_down_conn(hba, bnx2i_ep)) {
mutex_unlock(&hba->net_dev_lock);
return ERR_PTR(rc);Quoted 17 lines
drivers/scsi/bnx2i/bnx2i_iscsi.c +2
-0@@ -1764,6 +1803,7 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost,return ep; release_ep: +bnx2i_ep_active_list_del (hba, bnx2i_ep);if (bnx2i_tear_down_conn (hba, bnx2i_ep)) {mutex_unlock (&hba->net_dev_lock);return ERR_PTR (rc);@@ -1931,6 +1971,7 @@ int bnx2i_hw_ep_disconnect(struct bnx2i_endpoint *bnx2i_ep)del_timer_sync (&bnx2i_ep->ofld_timer); destroy_conn: +bnx2i_ep_active_list_del (hba, bnx2i_ep);if (bnx2i_tear_down_conn (hba, bnx2i_ep)) ret = -EINVAL ; out:
Signature · 4 lines
You received this message because you are subscribed to the Google Groups "open-iscsi" group. To post to this group, send email to open-iscsi-/JYPxA39Uh5TLH3MbocFF+G/[email protected] To unsubscribe from this group, send email to open-iscsi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] For more options, visit this group at http://groups.google.com/group/open-iscsi?hl=en.
PATCH 3/7 BNX2I: Optimized the bnx2i_stop connection clean up procedure
In reply to a message not in the archiveFor cases where the iSCSI disconnection procedure times out due to the iSCSI daemon being slow or unresponsive, the bnx2i_stop routine will now perform hardware cleanup via bnx2i_hw_ep_disconnect on all active endpoints so that subsequent operations will perform properly. Also moved the mutex locks inside ep_connect and ep_disconnect so that proper exclusivity can resolve simultaneous calls to the ep_disconnect routine.
--- drivers/scsi/bnx2i/bnx2i.h | 4 ++++ drivers/scsi/bnx2i/bnx2i_init.c | 35 ++++++++++++++++++++++++++++++++--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 11 ++++++----- 3 files changed, 42 insertions(+), 8 deletions(-)
drivers/scsi/bnx2i/bnx2i.h +4 -0
@@ -295,6 +295,7 @@ struct iscsi_cid_queue {* @max_cqes: CQ size * @num_ccell: number of command cells per connection * @ofld_conns_active: active connection list +* @eh_wait: wait queue for the endpoint to shutdown * @max_active_conns: max offload connections supported by this device * @cid_que: iscsi cid queue * @ep_rdwr_lock: read / write lock to synchronize various ep lists
@@ -306,6 +307,7 @@ struct iscsi_cid_queue {* @dummy_buffer: Dummy buffer to be used with zero length scsicmd reqs * @dummy_buf_dma: DMA address of 'dummy_buffer' memory buffer * @lock: lock to synchonize access to hba structure +* @hba_shutdown_tmo: Timeout value to shutdown each connection * @pci_did: PCI device ID * @pci_vid: PCI vendor ID * @pci_sdid: PCI subsystem device ID
@@ -770,6 +772,8 @@ extern struct bnx2i_endpoint *bnx2i_find_ep_in_destroy_list(extern int bnx2i_map_ep_dbell_regs (struct bnx2i_endpoint *ep);extern void bnx2i_arm_cq_event_coalescing (struct bnx2i_endpoint *ep,u8 action); +extern int bnx2i_hw_ep_disconnect (struct bnx2i_endpoint *bnx2i_ep); +/* Debug related function prototypes */ extern void bnx2i_print_pend_cmd_queue (struct bnx2i_conn *conn);extern void bnx2i_print_active_cmd_queue (struct bnx2i_conn *conn);
drivers/scsi/bnx2i/bnx2i_init.c +32 -3
@@ -176,6 +176,9 @@ void bnx2i_start(void *handle) void bnx2i_stop(void *handle) { struct bnx2i_hba *hba = handle; + struct list_head *pos, *tmp; + struct bnx2i_endpoint *bnx2i_ep; + int conns_active; /* check if cleanup happened in GOING_DOWN context */ if (!test_and_clear_bit(ADAPTER_STATE_GOING_DOWN,
@@ -187,9 +190,35 @@ void bnx2i_stop(void *handle)* control returns to network driver. So it is required to cleanup and * release all connection resources before returning from this routine. */ -wait_event_interruptible_timeout (hba->eh_wait, - (hba->ofld_conns_active ==0 ), - hba->hba_shutdown_tmo); +while (hba->ofld_conns_active) { + conns_active = hba->ofld_conns_active; +wait_event_interruptible_timeout (hba->eh_wait, + (hba->ofld_conns_active != conns_active), + hba->hba_shutdown_tmo); +if (hba->ofld_conns_active == conns_active) +break ; + } +if (hba->ofld_conns_active) { +/* Stage to force the disconnection +* This is the case where the daemon is either slow or +* not present +*/ +printk (KERN_ALERT "bnx2i: Wait timeout, force all eps " +"to disconnect (%d)\n" , hba->ofld_conns_active); +mutex_lock (&hba->net_dev_lock); +read_lock_bh (&hba->ep_rdwr_lock); +list_for_each_safe (pos, tmp, &hba->ep_active_list) { + bnx2i_ep = list_entry(pos, struct bnx2i_endpoint, link); +/* Clean up the chip only */ +bnx2i_hw_ep_disconnect (bnx2i_ep); + } +read_unlock_bh (&hba->ep_rdwr_lock); +mutex_unlock (&hba->net_dev_lock); +if (hba->ofld_conns_active) +printk (KERN_ERR "bnx2i: EP disconnect timeout (%d)!\n" , + hba->ofld_conns_active); + } +/* This flag should be cleared last so that ep_disconnect() gracefully * cleans up connection context */
drivers/scsi/bnx2i/bnx2i_iscsi.c +6 -5
@@ -858,9 +858,9 @@ struct bnx2i_hba *bnx2i_alloc_hba(struct cnic_dev *cnic)mutex_init (&hba->net_dev_lock);init_waitqueue_head (&hba->eh_wait);if (test_bit (BNX2I_NX2_DEV_57710 , &hba->cnic_dev_type)) - hba->hba_shutdown_tmo =240 *HZ ; + hba->hba_shutdown_tmo =20 *HZ ;else /* 5706/5708/5709 */ - hba->hba_shutdown_tmo =30 *HZ ; + hba->hba_shutdown_tmo =20 *HZ ;if (iscsi_host_add (shost, &hba->pcidev->dev)) goto free_dump_mem;
@@ -1702,10 +1702,11 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost,if (!hba ||test_bit (ADAPTER_STATE_GOING_DOWN , &hba->adapter_state)) { rc = -EINVAL ; - goto check_busy; + goto nohba; } cnic = hba->cnic; +mutex_lock (&hba->net_dev_lock); ep =bnx2i_alloc_ep (hba);if (!ep) { rc = -ENOMEM ;
@@ -1713,7 +1714,6 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost, } bnx2i_ep = ep->dd_data; -mutex_lock (&hba->net_dev_lock);if (bnx2i_adapter_ready (hba)) { rc = -EPERM ; goto net_if_down;
@@ -1814,8 +1814,9 @@ iscsi_cid_err:bnx2i_free_qp_resc (hba, bnx2i_ep); qp_resc_err:bnx2i_free_ep (ep); -mutex_unlock (&hba->net_dev_lock); check_busy: +mutex_unlock (&hba->net_dev_lock); +nohba:bnx2i_unreg_dev_all ();return ERR_PTR (rc); }
Signature · 1 line
1.7.0.5
Re: [PATCH 3/7] BNX2I: Optimized the bnx2i_stop connection clean up procedure
Quoted 2 lines · Eddie Wai
For cases where the iSCSI disconnection procedure times out due to the iSCSI daemon being slow or unresponsive, the
bnx2i_stoproutine
Could you describe when iscsid is slow a little more? The unresponsive case sounds like if iscsid is not running, right? For the slow case, it sounds like you are trying to work around a bug in there.
I am also not sure how it helps exactly. iscsid still has to cleanup the iscsi resources like the scsi commands running on the connection (conn stop is called after ep disconnect), so I am not sure how this helps. Does doing it this way skip some steps?
Re: [PATCH 3/7] BNX2I: Optimized the bnx2i_stop connection clean up procedure
Our test group has generated a case where a MTU change or an ifdown was performed while having active sessions outstanding. While the disconnection effort works normally, but for the case where iscsid is forced to stop, our driver was previously designed to dead wait for 240s before resuming operation. Once the wait is over, any leftover chip resources allocated + previously active iscsi_endpoints would be forfeited. For this kind of destructive testing, we decided that it is best to clean up our chip so that other operations such as L2 or FCoE would not get affected.
The 'slow' case mentioned is just a hypothetical case which we have not encountered first hand. But the code has been worked so that if iscsid were to come back up and continue to call ep_disconnect again, only the endpoints would get cleanup and will no longer attempt to clean up the hardware. We're not trying to work around a bug here...
For the case presented, bnx2i_stop was actually called from cnic's ulp_stop due to the different test case described. The hard 240s timeout was there to wait for iscsid to cleanup all the active connections. If it were to be exceeded somehow, the same lost resource
+ endpoint condition would happen.
Eddie
Quoted 13 lines · Mike Christie
Quoted 2 lines · Eddie Wai
For cases where the iSCSI disconnection procedure times out due to the iSCSI daemon being slow or unresponsive, the
bnx2i_stoproutineCould you describe when iscsid is slow a little more? The unresponsive case sounds like if iscsid is not running, right? For the slow case, it sounds like you are trying to work around a bug in there.
I am also not sure how it helps exactly. iscsid still has to cleanup the iscsi resources like the scsi commands running on the connection (conn stop is called after ep disconnect), so I am not sure how this helps. Does doing it this way skip some steps?
PATCH 4/7 BNX2I: Fine tuned conn destroy and context destroy timeout values
In reply to a message not in the archiveAdded variables to separate the fine tuned timeout values for connection destroy and context destroy for both 1g and 10g devices.
--- drivers/scsi/bnx2i/bnx2i.h | 4 ++++ drivers/scsi/bnx2i/bnx2i_iscsi.c | 13 +++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-)
drivers/scsi/bnx2i/bnx2i.h +4 -0
@@ -308,6 +308,8 @@ struct iscsi_cid_queue {* @dummy_buf_dma: DMA address of 'dummy_buffer' memory buffer * @lock: lock to synchonize access to hba structure * @hba_shutdown_tmo: Timeout value to shutdown each connection +* @conn_teardown_tmo: Timeout value to tear down each connection +* @conn_ctx_destroy_tmo: Timeout value to destroy context of each connection * @pci_did: PCI device ID * @pci_vid: PCI vendor ID * @pci_sdid: PCI subsystem device ID
@@ -387,6 +389,8 @@ struct bnx2i_hba {struct mutex net_dev_lock;/* sync net device access */ int hba_shutdown_tmo; +int conn_teardown_tmo; +int conn_ctx_destroy_tmo;/* * PCI related info. */
drivers/scsi/bnx2i/bnx2i_iscsi.c +9 -4
@@ -857,10 +857,15 @@ struct bnx2i_hba *bnx2i_alloc_hba(struct cnic_dev *cnic)spin_lock_init (&hba->lock);mutex_init (&hba->net_dev_lock);init_waitqueue_head (&hba->eh_wait); -if (test_bit (BNX2I_NX2_DEV_57710 , &hba->cnic_dev_type)) +if (test_bit (BNX2I_NX2_DEV_57710 , &hba->cnic_dev_type)) { hba->hba_shutdown_tmo =20 *HZ ; -else /* 5706/5708/5709 */ + hba->conn_teardown_tmo =10 *HZ ; + hba->conn_ctx_destroy_tmo =6 *HZ ; + }else {/* 5706/5708/5709 */ hba->hba_shutdown_tmo =20 *HZ ; + hba->conn_teardown_tmo =10 *HZ ; + hba->conn_ctx_destroy_tmo =2 *HZ ; + }if (iscsi_host_add (shost, &hba->pcidev->dev)) goto free_dump_mem;
@@ -1636,7 +1641,7 @@ static int bnx2i_tear_down_conn(struct bnx2i_hba *hba, ep->state =EP_STATE_CLEANUP_START ;init_timer (&ep->ofld_timer); - ep->ofld_timer.expires =10 *HZ + jiffies; + ep->ofld_timer.expires = hba->conn_ctx_destroy_tmo + jiffies; ep->ofld_timer.function = bnx2i_ep_ofld_timer; ep->ofld_timer.data = (unsigned long ) ep;add_timer (&ep->ofld_timer);
@@ -1939,7 +1944,7 @@ int bnx2i_hw_ep_disconnect(struct bnx2i_endpoint *bnx2i_ep) bnx2i_ep->state =EP_STATE_DISCONN_START ;init_timer (&bnx2i_ep->ofld_timer); - bnx2i_ep->ofld_timer.expires =10 *HZ + jiffies; + bnx2i_ep->ofld_timer.expires = hba->conn_teardown_tmo + jiffies; bnx2i_ep->ofld_timer.function = bnx2i_ep_ofld_timer; bnx2i_ep->ofld_timer.data = (unsigned long ) bnx2i_ep;add_timer (&bnx2i_ep->ofld_timer);
Signature · 1 line
1.7.0.5
PATCH 5/7 BNX2I: Fixed the TCP graceful termination initiation
In reply to a message not in the archiveIn compliance to RFC793, a TCP graceful termination will be used instead of an abortive termination for the case where the remote has initiated the close of the connection. Additionally, a TCP abortive termination will be used to close the connection when a logout response is not received in time after a logout request has been initiated.
--- drivers/scsi/bnx2i/bnx2i.h | 2 ++ drivers/scsi/bnx2i/bnx2i_hwi.c | 4 ++++ drivers/scsi/bnx2i/bnx2i_iscsi.c | 21 ++++++++++++++++++--- 3 files changed, 24 insertions(+), 3 deletions(-)
drivers/scsi/bnx2i/bnx2i.h +2 -0
@@ -639,6 +639,8 @@ enum {EP_STATE_CLEANUP_CMPL =0x800 ,EP_STATE_TCP_FIN_RCVD =0x1000 ,EP_STATE_TCP_RST_RCVD =0x2000 , +EP_STATE_LOGOUT_SENT =0x4000 , +EP_STATE_LOGOUT_RESP_RCVD =0x8000 ,EP_STATE_PG_OFLD_FAILED =0x1000000 ,EP_STATE_ULP_UPDATE_FAILED =0x2000000 , EP_STATE_CLEANUP_FAILED = 0x4000000,
drivers/scsi/bnx2i/bnx2i_hwi.c +4 -0
@@ -562,6 +562,8 @@ int bnx2i_send_iscsi_logout(struct bnx2i_conn *bnx2i_conn, logout_wqe->num_bds =1 ; logout_wqe->cq_index =0 ;/* CQ# used for completion, 5771x only */ + bnx2i_conn->ep->state =EP_STATE_LOGOUT_SENT ; +bnx2i_ring_dbell_update_sq_params (bnx2i_conn,1 );return 0 ; }
@@ -1482,6 +1484,8 @@ static int bnx2i_process_logout_resp(struct iscsi_session *session, resp_hdr->t2retain =cpu_to_be32 (logout->time_to_retain);__iscsi_complete_pdu (conn, (struct iscsi_hdr *)resp_hdr,NULL ,0 ); + + bnx2i_conn->ep->state =EP_STATE_LOGOUT_RESP_RCVD ; done:spin_unlock (&session->lock);return 0 ;
drivers/scsi/bnx2i/bnx2i_iscsi.c +18 -3
@@ -1892,6 +1892,8 @@ static int bnx2i_ep_tcp_conn_active(struct bnx2i_endpoint *bnx2i_ep)case EP_STATE_ULP_UPDATE_START :case EP_STATE_ULP_UPDATE_COMPL :case EP_STATE_TCP_FIN_RCVD : +case EP_STATE_LOGOUT_SENT : +case EP_STATE_LOGOUT_RESP_RCVD :case EP_STATE_ULP_UPDATE_FAILED : ret =1 ;break ;
@@ -1941,8 +1943,6 @@ int bnx2i_hw_ep_disconnect(struct bnx2i_endpoint *bnx2i_ep) session = conn->session; } - bnx2i_ep->state =EP_STATE_DISCONN_START ; -init_timer (&bnx2i_ep->ofld_timer); bnx2i_ep->ofld_timer.expires = hba->conn_teardown_tmo + jiffies; bnx2i_ep->ofld_timer.function = bnx2i_ep_ofld_timer;
@@ -1955,10 +1955,25 @@ int bnx2i_hw_ep_disconnect(struct bnx2i_endpoint *bnx2i_ep)if (session) {spin_lock_bh (&session->lock); -if (session->state ==ISCSI_STATE_LOGGING_OUT ) +if (bnx2i_ep->state !=EP_STATE_TCP_FIN_RCVD ) { +if (session->state ==ISCSI_STATE_LOGGING_OUT ) { +if (bnx2i_ep->state == +EP_STATE_LOGOUT_SENT ) { +/* Logout sent, but no resp */ +printk (KERN_ALERT "bnx2i - " +"WARNING logout response" +" was not received!\n" ); + }else if (bnx2i_ep->state == +EP_STATE_LOGOUT_RESP_RCVD ) + close =1 ; + } + }else close =1 ; +spin_unlock_bh (&session->lock); } + bnx2i_ep->state =EP_STATE_DISCONN_START ; +if (close) close_ret = cnic->cm_close (bnx2i_ep->cm_sk);else
Signature · 1 line
1.7.0.5
Re: [PATCH 5/7] BNX2I: Fixed the TCP graceful termination initiation
Quoted 8 lines · Eddie Wai
if (session) { spin_lock_bh(&session->lock);drivers/scsi/bnx2i/bnx2i_iscsi.c +5
-1-if (session->state ==ISCSI_STATE_LOGGING_OUT ) +if (bnx2i_ep->state !=EP_STATE_TCP_FIN_RCVD ) { +if (session->state ==ISCSI_STATE_LOGGING_OUT ) { +if (bnx2i_ep->state == +EP_STATE_LOGOUT_SENT ) { +/* Logout sent, but no resp */
drivers/scsi/bnx2i/bnx2i_iscsi.c int bnx2i_hw_ep_disconnect(struct bnx2i_endpoint *bnx2i_ep) · line 1972
Quoted 10 lines
drivers/scsi/bnx2i/bnx2i_iscsi.c +9
-0+printk (KERN_ALERT "bnx2i - " +"WARNING logout response" +" was not received!\n" ); + }else if (bnx2i_ep->state == +EP_STATE_LOGOUT_RESP_RCVD ) + close =1 ; + } + }else close =1 ; +
I think you can make this chunk easier to read if you did
If (!test_bit(BNX2I_CNIC_REGISTERED, &hba->reg_with_cnic))
goto out;
then do the:
if (session) {
........It gives you an extra tab so you do not have break up some lines, the tabbing/spacing will be right on the printk text, and and your eyes do not get crammed looking at the far right corner so much.
PATCH 6/7 BNX2I: Added host param ISCSI_HOST_PARAM_IPADDRESS
In reply to a message not in the archiveFrom: Michael Chan <[email protected]>
This sysfs attribute is proven to be useful during pivot_root.
--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 23 ++++++++++++++++++++++- 1 files changed, 22 insertions(+), 1 deletions(-)
drivers/scsi/bnx2i/bnx2i_iscsi.c +22 -1
@@ -1503,6 +1503,26 @@ static int bnx2i_host_get_param(struct Scsi_Host *shost,case ISCSI_HOST_PARAM_NETDEV_NAME : len =sprintf (buf,"%s\n" , hba->netdev->name);break ; +case ISCSI_HOST_PARAM_IPADDRESS : { +struct list_head *active_list = &hba->ep_active_list; + +read_lock_bh (&hba->ep_rdwr_lock); +if (!list_empty (&hba->ep_active_list)) { +struct bnx2i_endpoint *bnx2i_ep; +struct cnic_sock *csk; + + bnx2i_ep =list_first_entry (active_list, + struct bnx2i_endpoint, + link); + csk = bnx2i_ep->cm_sk; +if (test_bit (SK_F_IPV6 , &csk->flags)) + len =sprintf (buf,"%pI6\n" , csk->src_ip); +else + len =sprintf (buf,"%pI4\n" , csk->src_ip); + } +read_unlock_bh (&hba->ep_rdwr_lock); +break ; + }default :return iscsi_host_get_param (shost, param, buf); }
@@ -2136,7 +2156,8 @@ struct iscsi_transport bnx2i_iscsi_transport = {ISCSI_LU_RESET_TMO |ISCSI_TGT_RESET_TMO |ISCSI_PING_TMO |ISCSI_RECV_TMO | ISCSI_IFACE_NAME | ISCSI_INITIATOR_NAME, - .host_param_mask = ISCSI_HOST_HWADDRESS | ISCSI_HOST_NETDEV_NAME, + .host_param_mask =ISCSI_HOST_HWADDRESS |ISCSI_HOST_IPADDRESS | + ISCSI_HOST_NETDEV_NAME, .create_session = bnx2i_session_create, .destroy_session = bnx2i_session_destroy, .create_conn = bnx2i_conn_create,
Signature · 1 line
1.7.0.5
PATCH 7/7 BNX2I: Updated version from 2.1.1 to 2.1.2
In reply to a message not in the archive--- drivers/scsi/bnx2i/bnx2i_init.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/bnx2i/bnx2i_init.c +2 -2
@@ -17,8 +17,8 @@ static struct list_head adapter_list = LIST_HEAD_INIT(adapter_list);static u32 adapter_count;#define DRV_MODULE_NAME "bnx2i" -#define DRV_MODULE_VERSION "2.1.1" -#define DRV_MODULE_RELDATE "Mar 24, 2010" +#define DRV_MODULE_VERSION "2.1.2" +#define DRV_MODULE_RELDATE "Jun 24, 2010"static char version[]__devinitdata ="Broadcom NetXtreme II iSCSI Driver " DRV_MODULE_NAME \
Signature · 1 line
1.7.0.5
PATCH v2 1/7 BNX2I: Separated the hardware's cleanup procedure from ep_disconnect
In reply to a message not in the archiveThis patch introduces a new bnx2i_hw_ep_disconnect routine which contains all chip related disconnect and clean up procedure of iSCSI offload connections. This separation is intended as a preparation for the subsequent bnx2i_stop patch.
--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 119 ++++++++++++++++++++++++-------------- 1 files changed, 76 insertions(+), 43 deletions(-)
drivers/scsi/bnx2i/bnx2i_iscsi.c +76 -43
@@ -1866,54 +1866,35 @@ static int bnx2i_ep_tcp_conn_active(struct bnx2i_endpoint *bnx2i_ep) } -/** -* bnx2i_ep_disconnect - executes TCP connection teardown process -* @ep: TCP connection (endpoint) handle +/* +* bnx2i_hw_ep_disconnect - executes TCP connection teardown process in the hw +* @ep: TCP connection (bnx2i endpoint) handle * * executes TCP connection teardown process */ -static void bnx2i_ep_disconnect (struct iscsi_endpoint *ep) +int bnx2i_hw_ep_disconnect (struct bnx2i_endpoint *bnx2i_ep) { -struct bnx2i_endpoint *bnx2i_ep; -struct bnx2i_conn *bnx2i_conn =NULL ; -struct iscsi_session *session =NULL ; -struct iscsi_conn *conn; +struct bnx2i_hba *hba = bnx2i_ep->hba;struct cnic_dev *cnic; -struct bnx2i_hba *hba; +struct iscsi_session *session =NULL ; +struct iscsi_conn *conn =NULL ; +int ret =0 ; - bnx2i_ep = ep->dd_data; +if (!hba) +return 0 ; -/* driver should not attempt connection cleanup until TCP_CONNECT -* completes either successfully or fails. Timeout is 9-secs, so -* wait for it to complete -*/ -while ((bnx2i_ep->state ==EP_STATE_CONNECT_START ) && - !time_after (jiffies, bnx2i_ep->timestamp + (12 *HZ ))) -msleep (250 ); + cnic = hba->cnic; +if (!cnic) +return 0 ; + +if (!bnx2i_ep_tcp_conn_active (bnx2i_ep)) + goto destroy_conn;if (bnx2i_ep->conn) { - bnx2i_conn = bnx2i_ep->conn; - conn = bnx2i_conn->cls_conn->dd_data; + conn = bnx2i_ep->conn->cls_conn->dd_data; session = conn->session; - -iscsi_suspend_queue (conn); } - hba = bnx2i_ep->hba; -if (bnx2i_ep->state ==EP_STATE_IDLE ) - goto return_bnx2i_ep; - cnic = hba->cnic; - -mutex_lock (&hba->net_dev_lock); - -if (!test_bit (ADAPTER_STATE_UP , &hba->adapter_state)) - goto free_resc; -if (bnx2i_ep->hba_age != hba->age) - goto free_resc; - -if (!bnx2i_ep_tcp_conn_active (bnx2i_ep)) - goto destory_conn; - bnx2i_ep->state =EP_STATE_DISCONN_START ;init_timer (&bnx2i_ep->ofld_timer);
@@ -1924,6 +1905,7 @@ static void bnx2i_ep_disconnect(struct iscsi_endpoint *ep)if (test_bit (BNX2I_CNIC_REGISTERED , &hba->reg_with_cnic)) {int close =0 ; +int close_ret =0 ;if (session) {spin_lock_bh (&session->lock);
@@ -1932,11 +1914,13 @@ static void bnx2i_ep_disconnect(struct iscsi_endpoint *ep)spin_unlock_bh (&session->lock); }if (close) - cnic->cm_close (bnx2i_ep->cm_sk); + close_ret = cnic->cm_close (bnx2i_ep->cm_sk);else - cnic->cm_abort (bnx2i_ep->cm_sk); + close_ret = cnic->cm_abort (bnx2i_ep->cm_sk); +if (close_ret) + bnx2i_ep->state =EP_STATE_DISCONN_COMPL ; }else - goto free_resc; + goto out;/* wait for option-2 conn teardown */ wait_event_interruptible(bnx2i_ep->ofld_wait,
@@ -1946,20 +1930,69 @@ static void bnx2i_ep_disconnect(struct iscsi_endpoint *ep)flush_signals (current);del_timer_sync (&bnx2i_ep->ofld_timer); -destory_conn: -if (bnx2i_tear_down_conn (hba, bnx2i_ep)) { +destroy_conn: +if (bnx2i_tear_down_conn (hba, bnx2i_ep)) + ret = -EINVAL ; +out: + bnx2i_ep->state =EP_STATE_IDLE ; +return ret; +} + + +/** +* bnx2i_ep_disconnect - executes TCP connection teardown process +* @ep: TCP connection (iscsi endpoint) handle +* +* executes TCP connection teardown process +*/ +static void bnx2i_ep_disconnect (struct iscsi_endpoint *ep) +{ +struct bnx2i_endpoint *bnx2i_ep; +struct bnx2i_conn *bnx2i_conn =NULL ; +struct iscsi_conn *conn =NULL ; +struct bnx2i_hba *hba; + + bnx2i_ep = ep->dd_data; + +/* driver should not attempt connection cleanup until TCP_CONNECT +* completes either successfully or fails. Timeout is 9-secs, so +* wait for it to complete +*/ +while ((bnx2i_ep->state ==EP_STATE_CONNECT_START ) && + !time_after (jiffies, bnx2i_ep->timestamp + (12 *HZ ))) +msleep (250 ); + +if (bnx2i_ep->conn) { + bnx2i_conn = bnx2i_ep->conn; + conn = bnx2i_conn->cls_conn->dd_data; +iscsi_suspend_queue (conn); + } + hba = bnx2i_ep->hba; + +mutex_lock (&hba->net_dev_lock); + +if (bnx2i_ep->state ==EP_STATE_IDLE ) + goto return_bnx2i_ep; + +if (!test_bit (ADAPTER_STATE_UP , &hba->adapter_state)) + goto free_resc; + +if (bnx2i_ep->hba_age != hba->age) + goto free_resc; + +/* Do all chip cleanup here */ +if (bnx2i_hw_ep_disconnect (bnx2i_ep)) {mutex_unlock (&hba->net_dev_lock);return ; } free_resc: -mutex_unlock (&hba->net_dev_lock);bnx2i_free_qp_resc (hba, bnx2i_ep); return_bnx2i_ep:if (bnx2i_conn) bnx2i_conn->ep =NULL ;bnx2i_free_ep (ep); - +mutex_unlock (&hba->net_dev_lock);if (!hba->ofld_conns_active)bnx2i_unreg_dev_all ();
Signature · 1 line
1.7.0.5
PATCH v2 3/7 BNX2I: Optimized the bnx2i_stop connection clean up procedure
In reply to a message not in the archiveFor cases where the iSCSI disconnection procedure times out due to the iSCSI daemon being slow or unresponsive, the bnx2i_stop routine will now perform hardware cleanup via bnx2i_hw_ep_disconnect on all active endpoints so that subsequent operations will perform properly. Also moved the mutex locks inside ep_connect and ep_disconnect so that proper exclusivity can resolve simultaneous calls to the ep_disconnect routine.
v2: Removed the unnecessary read lock in the bnx2i_stop
--- drivers/scsi/bnx2i/bnx2i.h | 4 ++++ drivers/scsi/bnx2i/bnx2i_init.c | 33 ++++++++++++++++++++++++++++++--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 12 ++++++------ 3 files changed, 40 insertions(+), 9 deletions(-)
drivers/scsi/bnx2i/bnx2i.h +4 -0
@@ -295,6 +295,7 @@ struct iscsi_cid_queue {* @max_cqes: CQ size * @num_ccell: number of command cells per connection * @ofld_conns_active: active connection list +* @eh_wait: wait queue for the endpoint to shutdown * @max_active_conns: max offload connections supported by this device * @cid_que: iscsi cid queue * @ep_rdwr_lock: read / write lock to synchronize various ep lists
@@ -306,6 +307,7 @@ struct iscsi_cid_queue {* @dummy_buffer: Dummy buffer to be used with zero length scsicmd reqs * @dummy_buf_dma: DMA address of 'dummy_buffer' memory buffer * @lock: lock to synchonize access to hba structure +* @hba_shutdown_tmo: Timeout value to shutdown each connection * @pci_did: PCI device ID * @pci_vid: PCI vendor ID * @pci_sdid: PCI subsystem device ID
@@ -770,6 +772,8 @@ extern struct bnx2i_endpoint *bnx2i_find_ep_in_destroy_list(extern int bnx2i_map_ep_dbell_regs (struct bnx2i_endpoint *ep);extern void bnx2i_arm_cq_event_coalescing (struct bnx2i_endpoint *ep,u8 action); +extern int bnx2i_hw_ep_disconnect (struct bnx2i_endpoint *bnx2i_ep); +/* Debug related function prototypes */ extern void bnx2i_print_pend_cmd_queue (struct bnx2i_conn *conn);extern void bnx2i_print_active_cmd_queue (struct bnx2i_conn *conn);
drivers/scsi/bnx2i/bnx2i_init.c +30 -3
@@ -176,6 +176,9 @@ void bnx2i_start(void *handle) void bnx2i_stop(void *handle) { struct bnx2i_hba *hba = handle; + struct list_head *pos, *tmp; + struct bnx2i_endpoint *bnx2i_ep; + int conns_active; /* check if cleanup happened in GOING_DOWN context */ if (!test_and_clear_bit(ADAPTER_STATE_GOING_DOWN,
@@ -187,9 +190,33 @@ void bnx2i_stop(void *handle)* control returns to network driver. So it is required to cleanup and * release all connection resources before returning from this routine. */ -wait_event_interruptible_timeout (hba->eh_wait, - (hba->ofld_conns_active ==0 ), - hba->hba_shutdown_tmo); +while (hba->ofld_conns_active) { + conns_active = hba->ofld_conns_active; +wait_event_interruptible_timeout (hba->eh_wait, + (hba->ofld_conns_active != conns_active), + hba->hba_shutdown_tmo); +if (hba->ofld_conns_active == conns_active) +break ; + } +if (hba->ofld_conns_active) { +/* Stage to force the disconnection +* This is the case where the daemon is either slow or +* not present +*/ +printk (KERN_ALERT "bnx2i: Wait timeout, force all eps " +"to disconnect (%d)\n" , hba->ofld_conns_active); +mutex_lock (&hba->net_dev_lock); +list_for_each_safe (pos, tmp, &hba->ep_active_list) { + bnx2i_ep = list_entry(pos, struct bnx2i_endpoint, link); +/* Clean up the chip only */ +bnx2i_hw_ep_disconnect (bnx2i_ep); + } +mutex_unlock (&hba->net_dev_lock); +if (hba->ofld_conns_active) +printk (KERN_ERR "bnx2i: EP disconnect timeout (%d)!\n" , + hba->ofld_conns_active); + } +/* This flag should be cleared last so that ep_disconnect() gracefully * cleans up connection context */
drivers/scsi/bnx2i/bnx2i_iscsi.c +6 -6
@@ -708,7 +708,6 @@ bnx2i_find_ep_in_destroy_list(struct bnx2i_hba *hba, u32 iscsi_cid)return ep; } -/** * bnx2i_ep_active_list_add - add an entry to ep active list * @hba: pointer to adapter instance
@@ -856,9 +855,9 @@ struct bnx2i_hba *bnx2i_alloc_hba(struct cnic_dev *cnic)mutex_init (&hba->net_dev_lock);init_waitqueue_head (&hba->eh_wait);if (test_bit (BNX2I_NX2_DEV_57710 , &hba->cnic_dev_type)) - hba->hba_shutdown_tmo =240 *HZ ; + hba->hba_shutdown_tmo =20 *HZ ;else /* 5706/5708/5709 */ - hba->hba_shutdown_tmo =30 *HZ ; + hba->hba_shutdown_tmo =20 *HZ ;if (iscsi_host_add (shost, &hba->pcidev->dev)) goto free_dump_mem;
@@ -1700,10 +1699,11 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost,if (!hba ||test_bit (ADAPTER_STATE_GOING_DOWN , &hba->adapter_state)) { rc = -EINVAL ; - goto check_busy; + goto nohba; } cnic = hba->cnic; +mutex_lock (&hba->net_dev_lock); ep =bnx2i_alloc_ep (hba);if (!ep) { rc = -ENOMEM ;
@@ -1711,7 +1711,6 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost, } bnx2i_ep = ep->dd_data; -mutex_lock (&hba->net_dev_lock);if (bnx2i_adapter_ready (hba)) { rc = -EPERM ; goto net_if_down;
@@ -1813,8 +1812,9 @@ iscsi_cid_err:bnx2i_free_qp_resc (hba, bnx2i_ep); qp_resc_err:bnx2i_free_ep (ep); -mutex_unlock (&hba->net_dev_lock); check_busy: +mutex_unlock (&hba->net_dev_lock); +nohba:bnx2i_unreg_dev_all ();return ERR_PTR (rc); }
Signature · 1 line
1.7.0.5
PATCH v2 5/7 BNX2I: Fixed the TCP graceful termination initiation
In reply to a message not in the archiveIn compliance to RFC793, a TCP graceful termination will be used instead of an abortive termination for the case where the remote has initiated the close of the connection. Additionally, a TCP abortive termination will be used to close the connection when a logout response is not received in time after a logout request has been initiated.
--- drivers/scsi/bnx2i/bnx2i.h | 2 + drivers/scsi/bnx2i/bnx2i_hwi.c | 4 +++ drivers/scsi/bnx2i/bnx2i_iscsi.c | 53 ++++++++++++++++++++++++------------- 3 files changed, 40 insertions(+), 19 deletions(-)
drivers/scsi/bnx2i/bnx2i.h +2 -0
@@ -639,6 +639,8 @@ enum {EP_STATE_CLEANUP_CMPL =0x800 ,EP_STATE_TCP_FIN_RCVD =0x1000 ,EP_STATE_TCP_RST_RCVD =0x2000 , +EP_STATE_LOGOUT_SENT =0x4000 , +EP_STATE_LOGOUT_RESP_RCVD =0x8000 ,EP_STATE_PG_OFLD_FAILED =0x1000000 ,EP_STATE_ULP_UPDATE_FAILED =0x2000000 , EP_STATE_CLEANUP_FAILED = 0x4000000,
drivers/scsi/bnx2i/bnx2i_hwi.c +4 -0
@@ -562,6 +562,8 @@ int bnx2i_send_iscsi_logout(struct bnx2i_conn *bnx2i_conn, logout_wqe->num_bds =1 ; logout_wqe->cq_index =0 ;/* CQ# used for completion, 5771x only */ + bnx2i_conn->ep->state =EP_STATE_LOGOUT_SENT ; +bnx2i_ring_dbell_update_sq_params (bnx2i_conn,1 );return 0 ; }
@@ -1482,6 +1484,8 @@ static int bnx2i_process_logout_resp(struct iscsi_session *session, resp_hdr->t2retain =cpu_to_be32 (logout->time_to_retain);__iscsi_complete_pdu (conn, (struct iscsi_hdr *)resp_hdr,NULL ,0 ); + + bnx2i_conn->ep->state =EP_STATE_LOGOUT_RESP_RCVD ; done:spin_unlock (&session->lock);return 0 ;
drivers/scsi/bnx2i/bnx2i_iscsi.c +34 -19
79 lines not on this page · raw message
Signature · 1 line
1.7.0.5
PATCH v2 6/7 BNX2I: Added host param ISCSI_HOST_PARAM_IPADDRESS
In reply to a message not in the archiveFrom: Michael Chan <[email protected]>
This sysfs attribute is proven to be useful during pivot_root.
--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 23 ++++++++++++++++++++++- 1 files changed, 22 insertions(+), 1 deletions(-)
drivers/scsi/bnx2i/bnx2i_iscsi.c +22 -1
@@ -1500,6 +1500,26 @@ static int bnx2i_host_get_param(struct Scsi_Host *shost,case ISCSI_HOST_PARAM_NETDEV_NAME : len =sprintf (buf,"%s\n" , hba->netdev->name);break ; +case ISCSI_HOST_PARAM_IPADDRESS : { +struct list_head *active_list = &hba->ep_active_list; + +read_lock_bh (&hba->ep_rdwr_lock); +if (!list_empty (&hba->ep_active_list)) { +struct bnx2i_endpoint *bnx2i_ep; +struct cnic_sock *csk; + + bnx2i_ep =list_first_entry (active_list, + struct bnx2i_endpoint, + link); + csk = bnx2i_ep->cm_sk; +if (test_bit (SK_F_IPV6 , &csk->flags)) + len =sprintf (buf,"%pI6\n" , csk->src_ip); +else + len =sprintf (buf,"%pI4\n" , csk->src_ip); + } +read_unlock_bh (&hba->ep_rdwr_lock); +break ; + }default :return iscsi_host_get_param (shost, param, buf); }
@@ -2131,7 +2151,8 @@ struct iscsi_transport bnx2i_iscsi_transport = {ISCSI_LU_RESET_TMO |ISCSI_TGT_RESET_TMO |ISCSI_PING_TMO |ISCSI_RECV_TMO | ISCSI_IFACE_NAME | ISCSI_INITIATOR_NAME, - .host_param_mask = ISCSI_HOST_HWADDRESS | ISCSI_HOST_NETDEV_NAME, + .host_param_mask =ISCSI_HOST_HWADDRESS |ISCSI_HOST_IPADDRESS | + ISCSI_HOST_NETDEV_NAME, .create_session = bnx2i_session_create, .destroy_session = bnx2i_session_destroy, .create_conn = bnx2i_conn_create,
Signature · 1 line
1.7.0.5
v2 cover BNX2I: Patch set to fix various disconnect conditions
In reply to a message not in the archiveHello,
This patch set contains various code fixes and optimization which mostly deals with disconnect and clean up issues.
The following is a list of changes for v2:
1) Extended the disconnect timeout from 10s to 20s as the 10g firmware has a FIN retransmission timeout of 16s. This fixes one of the iscsi_endpoint leak issues when the target is slow or non-responsive to our TCP FIN sent.
2) Removed the unnecessary read lock in the bnx2i_stop.
3) Optimized various code paths based on Mike Christie's comments.
Your comments are greatly appreciated. Please review, thanks.
Eddie
Eddie Wai (7):
BNX2I: Separated the hardware's cleanup procedure from ep_disconnect
BNX2I: Created an active linklist which holds bnx2i endpoints
BNX2I: Optimized the bnx2i_stop connection clean up procedure
BNX2I: Fine tuned conn destroy and context destroy timeout values
BNX2I: Fixed the TCP graceful termination initiation
BNX2I: Added host param ISCSI_HOST_PARAM_IPADDRESS
BNX2I: Updated version from 2.1.1 to 2.1.2
drivers/scsi/bnx2i/bnx2i.h | 14 +++ drivers/scsi/bnx2i/bnx2i_hwi.c | 4 + drivers/scsi/bnx2i/bnx2i_init.c | 39 ++++++- drivers/scsi/bnx2i/bnx2i_iscsi.c | 229 +++++++++++++++++++++++++++++--------- 4 files changed, 226 insertions(+), 60 deletions(-)
Quoted 28 lines · Eddie Wai
Hello,
This patch set contains various code fixes and optimization which mostly deals with disconnect and clean up issues.
The following is a list of changes for v2:
1) Extended the disconnect timeout from 10s to 20s as the 10g firmware has a FIN retransmission timeout of 16s. This fixes one of theiscsi_endpointleak issues when the target is slow or non-responsive to our TCP FIN sent.2) Removed the unnecessary read lock in the
bnx2i_stop.3) Optimized various code paths based on Mike Christie's comments.
Your comments are greatly appreciated. Please review, thanks.
Eddie
Eddie Wai (7):
BNX2I: Separated the hardware's cleanup procedure fromep_disconnect
BNX2I: Created an active linklist which holds bnx2i endpoints
BNX2I: Optimized thebnx2i_stopconnection clean up procedure
BNX2I: Fine tuned conn destroy and context destroy timeout values
BNX2I: Fixed the TCP graceful termination initiation
BNX2I: Added host paramISCSI_HOST_PARAM_IPADDRESS
BNX2I: Updated version from 2.1.1 to 2.1.2
Quoted 7 lines
drivers/scsi/bnx2i/bnx2i.h | 14 +++ drivers/scsi/bnx2i/bnx2i_hwi.c | 4 + drivers/scsi/bnx2i/bnx2i_init.c | 39 ++++++- drivers/scsi/bnx2i/bnx2i_iscsi.c | 229 +++++++++++++++++++++++++++++--------- 4 files changed, 226 insertions(+), 60 deletions(-)
Thanks for the update. Updated patches look ok to me.
PATCH v2 7/7 BNX2I: Updated version from 2.1.1 to 2.1.2
In reply to a message not in the archive--- drivers/scsi/bnx2i/bnx2i_init.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/bnx2i/bnx2i_init.c +2 -2
@@ -17,8 +17,8 @@ static struct list_head adapter_list = LIST_HEAD_INIT(adapter_list);static u32 adapter_count;#define DRV_MODULE_NAME "bnx2i" -#define DRV_MODULE_VERSION "2.1.1" -#define DRV_MODULE_RELDATE "Mar 24, 2010" +#define DRV_MODULE_VERSION "2.1.2" +#define DRV_MODULE_RELDATE "Jun 28, 2010"static char version[]__devinitdata ="Broadcom NetXtreme II iSCSI Driver " DRV_MODULE_NAME \
Signature · 1 line
1.7.0.5
A message that is not in the archive (sent off-list or not yet received): Eddie Wai <eddie.wai-dY08KVG/lbpWk0Htik3J/[email protected]
PATCH v2 2/7 BNX2I: Created an active linklist which holds bnx2i endpoints
This introduces a new active linklist which would link up all active bnx2i_endpoints. This will be used by subsequent patches that follows.
--- drivers/scsi/bnx2i/bnx2i.h | 4 +++ drivers/scsi/bnx2i/bnx2i_iscsi.c | 46 +++++++++++++++++++++++++++++++++++-- 2 files changed, 47 insertions(+), 3 deletions(-)
drivers/scsi/bnx2i/bnx2i.h +4 -0
@@ -299,6 +299,7 @@ struct iscsi_cid_queue {* @cid_que: iscsi cid queue * @ep_rdwr_lock: read / write lock to synchronize various ep lists * @ep_ofld_list: connection list for pending offload completion +* @ep_active_list: connection list for active offload endpoints * @ep_destroy_list: connection list for pending offload completion * @mp_bd_tbl: BD table to be used with middle path requests * @mp_bd_dma: DMA address of 'mp_bd_tbl' memory buffer
@@ -369,6 +370,7 @@ struct bnx2i_hba {rwlock_t ep_rdwr_lock;struct list_head ep_ofld_list; +struct list_head ep_active_list;struct list_head ep_destroy_list;/*
@@ -645,6 +647,7 @@ enum {* @link: list head to link elements * @hba: adapter to which this connection belongs * @conn: iscsi connection this EP is linked to +* @cls_ep: associated iSCSI endpoint pointer * @sess: iscsi session this EP is linked to * @cm_sk: cnic sock struct * @hba_age: age to detect if 'iscsid' issues ep_disconnect()
@@ -664,6 +667,7 @@ struct bnx2i_endpoint {struct list_head link;struct bnx2i_hba *hba;struct bnx2i_conn *conn; +struct iscsi_endpoint *cls_ep;struct cnic_sock *cm_sk;u32 hba_age;u32 state;
drivers/scsi/bnx2i/bnx2i_iscsi.c +43 -3
95 lines not on this page · raw message
Signature · 8 lines
1.7.0.5 -- You received this message because you are subscribed to the Google Groups "open-iscsi" group. To post to this group, send email to open-iscsi-/JYPxA39Uh5TLH3MbocFF+G/[email protected] To unsubscribe from this group, send email to open-iscsi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] For more options, visit this group at http://groups.google.com/group/open-iscsi?hl=en.
PATCH v2 4/7 BNX2I: Fine tuned conn destroy and context destroy timeout values
In reply to a message not in the archiveAdded variables to separate the fine tuned timeout values for connection destroy and context destroy for both 1g and 10g devices.
v2: Extended the 5771X disconnect timeout from 10s to 20s as the firmware has a retransmission timeout of 16s. This fixes one of the iscsi_endpoint leak issues when the target is slow or non-responsive to our TCP FIN.
--- drivers/scsi/bnx2i/bnx2i.h | 4 ++++ drivers/scsi/bnx2i/bnx2i_iscsi.c | 13 +++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-)
drivers/scsi/bnx2i/bnx2i.h +4 -0
@@ -308,6 +308,8 @@ struct iscsi_cid_queue {* @dummy_buf_dma: DMA address of 'dummy_buffer' memory buffer * @lock: lock to synchonize access to hba structure * @hba_shutdown_tmo: Timeout value to shutdown each connection +* @conn_teardown_tmo: Timeout value to tear down each connection +* @conn_ctx_destroy_tmo: Timeout value to destroy context of each connection * @pci_did: PCI device ID * @pci_vid: PCI vendor ID * @pci_sdid: PCI subsystem device ID
@@ -387,6 +389,8 @@ struct bnx2i_hba {struct mutex net_dev_lock;/* sync net device access */ int hba_shutdown_tmo; +int conn_teardown_tmo; +int conn_ctx_destroy_tmo;/* * PCI related info. */
drivers/scsi/bnx2i/bnx2i_iscsi.c +9 -4
@@ -854,10 +854,15 @@ struct bnx2i_hba *bnx2i_alloc_hba(struct cnic_dev *cnic)spin_lock_init (&hba->lock);mutex_init (&hba->net_dev_lock);init_waitqueue_head (&hba->eh_wait); -if (test_bit (BNX2I_NX2_DEV_57710 , &hba->cnic_dev_type)) +if (test_bit (BNX2I_NX2_DEV_57710 , &hba->cnic_dev_type)) { hba->hba_shutdown_tmo =20 *HZ ; -else /* 5706/5708/5709 */ + hba->conn_teardown_tmo =20 *HZ ; + hba->conn_ctx_destroy_tmo =6 *HZ ; + }else {/* 5706/5708/5709 */ hba->hba_shutdown_tmo =20 *HZ ; + hba->conn_teardown_tmo =10 *HZ ; + hba->conn_ctx_destroy_tmo =2 *HZ ; + }if (iscsi_host_add (shost, &hba->pcidev->dev)) goto free_dump_mem;
@@ -1633,7 +1638,7 @@ static int bnx2i_tear_down_conn(struct bnx2i_hba *hba, ep->state =EP_STATE_CLEANUP_START ;init_timer (&ep->ofld_timer); - ep->ofld_timer.expires =10 *HZ + jiffies; + ep->ofld_timer.expires = hba->conn_ctx_destroy_tmo + jiffies; ep->ofld_timer.function = bnx2i_ep_ofld_timer; ep->ofld_timer.data = (unsigned long ) ep;add_timer (&ep->ofld_timer);
@@ -1937,7 +1942,7 @@ int bnx2i_hw_ep_disconnect(struct bnx2i_endpoint *bnx2i_ep) bnx2i_ep->state =EP_STATE_DISCONN_START ;init_timer (&bnx2i_ep->ofld_timer); - bnx2i_ep->ofld_timer.expires =10 *HZ + jiffies; + bnx2i_ep->ofld_timer.expires = hba->conn_teardown_tmo + jiffies; bnx2i_ep->ofld_timer.function = bnx2i_ep_ofld_timer; bnx2i_ep->ofld_timer.data = (unsigned long ) bnx2i_ep;add_timer (&bnx2i_ep->ofld_timer);
Signature · 8 lines
1.7.0.5 -- You received this message because you are subscribed to the Google Groups "open-iscsi" group. To post to this group, send email to open-iscsi-/JYPxA39Uh5TLH3MbocFF+G/[email protected] To unsubscribe from this group, send email to open-iscsi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] For more options, visit this group at http://groups.google.com/group/open-iscsi?hl=en.
PATCH 1/5 BNX2I: Fixed a protocol violation on nopout responses
In reply to a message not in the archiveAccording to RFC3720, nopout packet sent in response to unsolicited nopin packet requesting a response must retain the TTT of the requester.
--- drivers/scsi/bnx2i/bnx2i.h | 2 +- drivers/scsi/bnx2i/bnx2i_hwi.c | 5 ++--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 2 -- 3 files changed, 3 insertions(+), 6 deletions(-)
drivers/scsi/bnx2i/bnx2i.h +1 -1
@@ -753,7 +753,7 @@ extern int bnx2i_send_iscsi_tmf(struct bnx2i_conn *conn,extern int bnx2i_send_iscsi_scsicmd (struct bnx2i_conn *conn,struct bnx2i_cmd *cmnd);extern int bnx2i_send_iscsi_nopout (struct bnx2i_conn *conn, -struct iscsi_task *mtask,u32 ttt, +struct iscsi_task *mtask,char *datap,int data_len,int unsol);extern int bnx2i_send_iscsi_logout (struct bnx2i_conn *conn,struct iscsi_task *mtask);
drivers/scsi/bnx2i/bnx2i_hwi.c +2 -3
@@ -464,7 +464,6 @@ int bnx2i_send_iscsi_scsicmd(struct bnx2i_conn *bnx2i_conn,* @conn: iscsi connection * @cmd: driver command structure which is requesting * a WQE to sent to chip for further processing -* @ttt: TTT to be used when building pdu header * @datap: payload buffer pointer * @data_len: payload data length * @unsol: indicated whether nopout pdu is unsolicited pdu or
@@ -473,7 +472,7 @@ int bnx2i_send_iscsi_scsicmd(struct bnx2i_conn *bnx2i_conn,* prepare and post a nopout request WQE to CNIC firmware */ int bnx2i_send_iscsi_nopout (struct bnx2i_conn *bnx2i_conn, -struct iscsi_task *task,u32 ttt, +struct iscsi_task *task,char *datap,int data_len,int unsol) {struct bnx2i_endpoint *ep = bnx2i_conn->ep;
@@ -498,7 +497,7 @@ int bnx2i_send_iscsi_nopout(struct bnx2i_conn *bnx2i_conn, nopout_wqe->itt = ((u16 )task->itt | (ISCSI_TASK_TYPE_MPATH <<ISCSI_TMF_REQUEST_TYPE_SHIFT )); - nopout_wqe->ttt = ttt; + nopout_wqe->ttt = nopout_hdr->ttt; nopout_wqe->flags =0 ;if (!unsol) nopout_wqe->flags =ISCSI_NOP_OUT_REQUEST_LOCAL_COMPLETION ;
drivers/scsi/bnx2i/bnx2i_iscsi.c +0 -2
@@ -1078,11 +1078,9 @@ static int bnx2i_iscsi_send_generic_request(struct iscsi_task *task) buf = bnx2i_conn->gen_pdu.req_buf;if (data_len) rc =bnx2i_send_iscsi_nopout (bnx2i_conn, task, -RESERVED_ITT , buf, data_len,1 );else rc =bnx2i_send_iscsi_nopout (bnx2i_conn, task, -RESERVED_ITT ,NULL ,0 ,1 );break ;case ISCSI_OP_LOGOUT :
Signature · 8 lines
1.7.0.5 -- You received this message because you are subscribed to the Google Groups "open-iscsi" group. To post to this group, send email to open-iscsi-/JYPxA39Uh5TLH3MbocFF+G/[email protected] To unsubscribe from this group, send email to open-iscsi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] For more options, visit this group at http://groups.google.com/group/open-iscsi?hl=en.
PATCH 3/5 BNX2I: Recouple the CFC delete cleanup with cm_abort/close completion
In reply to a message not in the archiveSpecific to the Broadcom 10g chipset, the CFC delete operation must be coupled with the cm_abort/close with does the SRC delete/terminate offload operation prior.
--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-)
drivers/scsi/bnx2i/bnx2i_iscsi.c +6 -4
@@ -1996,11 +1996,13 @@ int bnx2i_hw_ep_disconnect(struct bnx2i_endpoint *bnx2i_ep)else close_ret = cnic->cm_abort (bnx2i_ep->cm_sk); +/* No longer allow CFC delete if cm_close/abort fails the request */ if (close_ret) - bnx2i_ep->state =EP_STATE_DISCONN_COMPL ; - -/* wait for option-2 conn teardown */ -wait_event_interruptible (bnx2i_ep->ofld_wait, +printk (KERN_ALERT "bnx2i: %s close/abort(%d) returned %d\n" , + bnx2i_ep->hba->netdev->name, close, close_ret); +else +/* wait for option-2 conn teardown */ +wait_event_interruptible (bnx2i_ep->ofld_wait, bnx2i_ep->state !=EP_STATE_DISCONN_START );if (signal_pending (current))
Signature · 8 lines
1.7.0.5 -- You received this message because you are subscribed to the Google Groups "open-iscsi" group. To post to this group, send email to open-iscsi-/JYPxA39Uh5TLH3MbocFF+G/[email protected] To unsubscribe from this group, send email to open-iscsi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] For more options, visit this group at http://groups.google.com/group/open-iscsi?hl=en.
PATCH 8/16 BNX2I: Added mutex lock protection to conn_get_param
In reply to a message not in the archiveAdded net_dev mutex lock protection before accessing the csk parameters.
--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 17 +++++++++++++---- 1 files changed, 13 insertions(+), 4 deletions(-)
drivers/scsi/bnx2i/bnx2i_iscsi.c +13 -4
@@ -1473,21 +1473,30 @@ static int bnx2i_conn_get_param(struct iscsi_cls_conn *cls_conn,struct bnx2i_conn *bnx2i_conn = conn->dd_data;int len =0 ; +if (!(bnx2i_conn && bnx2i_conn->ep && bnx2i_conn->ep->hba)) + goto out; +switch (param) {case ISCSI_PARAM_CONN_PORT : -if (bnx2i_conn->ep) +mutex_lock (&bnx2i_conn->ep->hba->net_dev_lock); +if (bnx2i_conn->ep->cm_sk) len =sprintf (buf,"%hu\n" , bnx2i_conn->ep->cm_sk->dst_port); +mutex_unlock (&bnx2i_conn->ep->hba->net_dev_lock);break ;case ISCSI_PARAM_CONN_ADDRESS : -if (bnx2i_conn->ep) +mutex_lock (&bnx2i_conn->ep->hba->net_dev_lock); +if (bnx2i_conn->ep->cm_sk) len =sprintf (buf,"%pI4\n" , &bnx2i_conn->ep->cm_sk->dst_ip); +mutex_unlock (&bnx2i_conn->ep->hba->net_dev_lock);break ;default : -return iscsi_conn_get_param (cls_conn, param, buf); + len =iscsi_conn_get_param (cls_conn, param, buf); +if (len == -ENOSYS ) + len =0 ; } - +out:return len; }
Signature · 8 lines
1.7.0.5 -- You received this message because you are subscribed to the Google Groups "open-iscsi" group. To post to this group, send email to open-iscsi-/JYPxA39Uh5TLH3MbocFF+G/[email protected] To unsubscribe from this group, send email to open-iscsi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] For more options, visit this group at http://groups.google.com/group/open-iscsi?hl=en.
Re: [PATCH 08/16] BNX2I: Added mutex lock protection to conn_get_param
drivers/scsi/bnx2i/bnx2i_iscsi.c static int bnx2i_conn_get_param(struct iscsi_cls_conn *cls_conn, · line 1497
Quoted 4 lines · Eddie Wai
drivers/scsi/bnx2i/bnx2i_iscsi.c +3
-1-return iscsi_conn_get_param (cls_conn, param, buf); + len =iscsi_conn_get_param (cls_conn, param, buf); +if (len == -ENOSYS ) + len =0 ;
Why are you returning 0 here?
Re: [PATCH 08/16] BNX2I: Added mutex lock protection to conn_get_param
Quoted 8 lines · Mike Christie
drivers/scsi/bnx2i/bnx2i_iscsi.c static int bnx2i_conn_get_param(struct iscsi_cls_conn *cls_conn, · line 1497
Quoted 4 lines · Eddie Wai
drivers/scsi/bnx2i/bnx2i_iscsi.c +3
-1-return iscsi_conn_get_param (cls_conn, param, buf); + len =iscsi_conn_get_param (cls_conn, param, buf); +if (len == -ENOSYS ) + len =0 ;Why are you returning 0 here?
Looks like returning -ENOSYS as-is is the expected behavior as cross referenced to iscsi_tcp. I'll remove this. Thanks.
Quoted 1 line
PATCH 10/16 BNX2I: Fixed a cid leak issue for 5771X (10g)
In reply to a message not in the archiveA cid leak issue was found when the connect destroy request exceeded the driver's disconnection timeout. This will lead to a cid resource leak issue.
The fix is to allow the cid cleanup even when this happens.
--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 24 ++++++++++++++++-------- 1 files changed, 16 insertions(+), 8 deletions(-)
drivers/scsi/bnx2i/bnx2i_iscsi.c +16 -8
@@ -1659,18 +1659,26 @@ no_nx2_route:static int bnx2i_tear_down_conn (struct bnx2i_hba *hba,struct bnx2i_endpoint *ep) { -if (test_bit (BNX2I_CNIC_REGISTERED , &hba->reg_with_cnic)) +if (test_bit (BNX2I_CNIC_REGISTERED , &hba->reg_with_cnic) && ep->cm_sk) hba->cnic->cm_destroy (ep->cm_sk); -if (test_bit (ADAPTER_STATE_GOING_DOWN , &ep->hba->adapter_state)) - ep->state =EP_STATE_DISCONN_COMPL ; -if (test_bit (BNX2I_NX2_DEV_57710 , &hba->cnic_dev_type) && ep->state ==EP_STATE_DISCONN_TIMEDOUT ) { -printk (KERN_ALERT "bnx2i - ERROR - please submit GRC Dump," -" NW/PCIe trace, driver msgs to developers" -" for analysis\n" ); -return 1 ; +if (ep->conn && ep->conn->cls_conn && + ep->conn->cls_conn->dd_data) { +struct iscsi_conn *conn = ep->conn->cls_conn->dd_data; + +/* Must suspend all rx queue activity for this ep */ +set_bit (ISCSI_SUSPEND_BIT , &conn->suspend_rx); + } +/* CONN_DISCONNECT timeout may or may not be an issue depending +* on what transcribed in TCP layer, different targets behave +* differently +*/ +printk (KERN_ALERT "bnx2i (%s): - WARN - CONN_DISCON timed out, " +"please submit GRC Dump, NW/PCIe trace, " +"driver msgs to developers for analysis\n" , + hba->netdev->name); } ep->state =EP_STATE_CLEANUP_START ;
Signature · 8 lines
1.7.0.5 -- You received this message because you are subscribed to the Google Groups "open-iscsi" group. To post to this group, send email to open-iscsi-/JYPxA39Uh5TLH3MbocFF+G/[email protected] To unsubscribe from this group, send email to open-iscsi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] For more options, visit this group at http://groups.google.com/group/open-iscsi?hl=en.
PATCH v3 7/13 BNX2I: Added mutex lock protection to conn_get_param
In reply to a message not in the archiveAdded net_dev mutex lock protection before accessing the csk parameters.
--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-)
drivers/scsi/bnx2i/bnx2i_iscsi.c +10 -3
@@ -1461,21 +1461,28 @@ static int bnx2i_conn_get_param(struct iscsi_cls_conn *cls_conn,struct bnx2i_conn *bnx2i_conn = conn->dd_data;int len =0 ; +if (!(bnx2i_conn && bnx2i_conn->ep && bnx2i_conn->ep->hba)) + goto out; +switch (param) {case ISCSI_PARAM_CONN_PORT : -if (bnx2i_conn->ep) +mutex_lock (&bnx2i_conn->ep->hba->net_dev_lock); +if (bnx2i_conn->ep->cm_sk) len =sprintf (buf,"%hu\n" , bnx2i_conn->ep->cm_sk->dst_port); +mutex_unlock (&bnx2i_conn->ep->hba->net_dev_lock);break ;case ISCSI_PARAM_CONN_ADDRESS : -if (bnx2i_conn->ep) +mutex_lock (&bnx2i_conn->ep->hba->net_dev_lock); +if (bnx2i_conn->ep->cm_sk) len =sprintf (buf,"%pI4\n" , &bnx2i_conn->ep->cm_sk->dst_ip); +mutex_unlock (&bnx2i_conn->ep->hba->net_dev_lock);break ;default :return iscsi_conn_get_param (cls_conn, param, buf); } - +out:return len; }
Signature · 8 lines
1.7.0.5 -- You received this message because you are subscribed to the Google Groups "open-iscsi" group. To post to this group, send email to open-iscsi-/JYPxA39Uh5TLH3MbocFF+G/[email protected] To unsubscribe from this group, send email to open-iscsi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] For more options, visit this group at http://groups.google.com/group/open-iscsi?hl=en.
PATCH 1/1 BNX2I: Fixed the override of the error_mask module param
In reply to a message not in the archiveThe error_mask module param overrides has a bug which prevented the new module param values to take effect.
Also changed the type attribute of the error_mask1/2 module params from int to uint to allow the MSB to be set.
--- drivers/scsi/bnx2i/bnx2i_hwi.c | 12 ++++++++---- drivers/scsi/bnx2i/bnx2i_init.c | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-)
drivers/scsi/bnx2i/bnx2i_hwi.c +8 -4
@@ -1312,14 +1312,18 @@ int bnx2i_send_fw_iscsi_init_msg(struct bnx2i_hba *hba) ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_EXP_DATASN) |/* EMC */ (1ULL << ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_LUN)); -if (error_mask1) +if (error_mask1) { iscsi_init2.error_bit_map[0 ] = error_mask1; -else + mask64 &= (u32)(~mask64); + mask64 |= error_mask1; + }else iscsi_init2.error_bit_map[0 ] = (u32 ) mask64; -if (error_mask2) +if (error_mask2) { iscsi_init2.error_bit_map[1 ] = error_mask2; -else + mask64 &=0xffffffff ; + mask64 |= ((u64 )error_mask2 <<32 ); + }else iscsi_init2.error_bit_map[1 ] = (u32) (mask64 >>32 ); iscsi_error_mask = mask64;
drivers/scsi/bnx2i/bnx2i_init.c +2 -2
@@ -49,11 +49,11 @@ module_param(en_tcp_dack, int, 0664);MODULE_PARM_DESC (en_tcp_dack,"Enable TCP Delayed ACK" );unsigned int error_mask1 =0x00 ; -module_param (error_mask1, int,0664 ); +module_param (error_mask1, uint,0664 );MODULE_PARM_DESC (error_mask1,"Config FW iSCSI Error Mask #1" );unsigned int error_mask2 =0x00 ; -module_param (error_mask2, int,0664 ); +module_param (error_mask2, uint,0664 );MODULE_PARM_DESC (error_mask2,"Config FW iSCSI Error Mask #2" );unsigned int sq_size;
Signature · 8 lines
1.7.7.4 -- You received this message because you are subscribed to the Google Groups "open-iscsi" group. To post to this group, send email to open-iscsi-/JYPxA39Uh5TLH3MbocFF+G/[email protected] To unsubscribe from this group, send email to open-iscsi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] For more options, visit this group at http://groups.google.com/group/open-iscsi?hl=en.
PATCH 1/1 BNX2I: Fixed NULL ptr deference for 1G bnx2 Linux iSCSI offload
In reply to a message not in the archiveThis patch fixes the following kernel panic invoked by uninitialized fields in the chip initialization for the 1G bnx2 iSCSI offload.
One of the bits in the chip initialization is being used by the latest firmware to control overflow packets. When this control bit gets enabled erroneously, it would ultimately result in a bad packet placement which would cause the bnx2 driver to dereference a NULL ptr in the placement handler.
This can happen under certain stress I/O environment under the Linux iSCSI offload operation.
This change only affects Broadcom's 5709 chipset.
Unable to handle kernel NULL pointer dereference at 0000000000000008 RIP: [<ffffffff881f0e7d>] :bnx2:bnx2_poll_work+0xd0d/0x13c5 Pid: 0, comm: swapper Tainted: G ---- 2.6.18-333.el5debug #2 RIP: 0010:[<ffffffff881f0e7d>] [<ffffffff881f0e7d>] :bnx2:bnx2_poll_work+0xd0d/0x13c5 RSP: 0018:ffff8101b575bd50 EFLAGS: 00010216 RAX: 0000000000000005 RBX: ffff81007c5fb180 RCX: 0000000000000000 RDX: 0000000000000ffc RSI: 00000000817e8000 RDI: 0000000000000220 RBP: ffff81015bbd7ec0 R08: ffff8100817e9000 R09: 0000000000000000 R10: ffff81007c5fb180 R11: 00000000000000c8 R12: 000000007a25a010 R13: 0000000000000000 R14: 0000000000000005 R15: ffff810159f80558 FS: 0000000000000000(0000) GS:ffff8101afebc240(0000) knlGS:0000000000000000 CS: 0010 DS: 0018 ES: 0018 CR0: 000000008005003b CR2: 0000000000000008 CR3: 0000000000201000 CR4: 00000000000006a0 Process swapper (pid: 0, threadinfo ffff8101b5754000, task ffff8101afebd820) Stack: 000000000000000b ffff810159f80000 0000000000000040 ffff810159f80520 ffff810159f80500 00cf00cf8008e84b ffffc200100939e0 ffff810009035b20 0000502900000000 000000be00000001 ffff8100817e7810 00d08101b575bea8 Call Trace: <IRQ> [<ffffffff8008e0d0>] show_schedstat+0x1c2/0x25b [<ffffffff881f1886>] :bnx2:bnx2_poll+0xf6/0x231 [<ffffffff8000c9b9>] net_rx_action+0xac/0x1b1 [<ffffffff800125a0>] __do_softirq+0x89/0x133 [<ffffffff8005e30c>] call_softirq+0x1c/0x28 [<ffffffff8006d5de>] do_softirq+0x2c/0x7d [<ffffffff8006d46e>] do_IRQ+0xee/0xf7 [<ffffffff8005d625>] ret_from_intr+0x0/0xa <EOI> [<ffffffff801a5780>] acpi_processor_idle_simple+0x1c5/0x341 [<ffffffff801a573d>] acpi_processor_idle_simple+0x182/0x341 [<ffffffff801a55bb>] acpi_processor_idle_simple+0x0/0x341 [<ffffffff80049560>] cpu_idle+0x95/0xb8 [<ffffffff80078b1c>] start_secondary+0x479/0x488
--- drivers/scsi/bnx2i/bnx2i_hwi.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/scsi/bnx2i/bnx2i_hwi.c +3 -0
@@ -1264,6 +1264,9 @@ int bnx2i_send_fw_iscsi_init_msg(struct bnx2i_hba *hba)int rc =0 ;u64 mask64; +memset (&iscsi_init,0x00 ,sizeof (struct iscsi_kwqe_init1 )); +memset (&iscsi_init2,0x00 ,sizeof (struct iscsi_kwqe_init2 )); +bnx2i_adjust_qp_size (hba); iscsi_init.flags =
Signature · 8 lines
1.7.7.4 -- You received this message because you are subscribed to the Google Groups "open-iscsi" group. To post to this group, send email to open-iscsi-/JYPxA39Uh5TLH3MbocFF+G/[email protected] To unsubscribe from this group, send email to open-iscsi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] For more options, visit this group at http://groups.google.com/group/open-iscsi?hl=en.
A message that is not in the archive (sent off-list or not yet received): 1345570553-23067-1-git-send-email-eddie.wai-dY08KVG/lbpWk0Htik3J/[email protected]
Mike Christie
Reviewed-byRe: [PATCH] BNX2I: Fixed NULL ptr deference for 1G bnx2 Linux iSCSI offload
Quoted 57 lines · Eddie Wai
This patch fixes the following kernel panic invoked by uninitialized fields in the chip initialization for the 1G bnx2 iSCSI offload.
One of the bits in the chip initialization is being used by the latest firmware to control overflow packets. When this control bit gets enabled erroneously, it would ultimately result in a bad packet placement which would cause the bnx2 driver to dereference a NULL ptr in the placement handler.
This can happen under certain stress I/O environment under the Linux iSCSI offload operation.
This change only affects Broadcom's 5709 chipset.
Unable to handle kernel NULL pointer dereference at 0000000000000008 RIP: [<ffffffff881f0e7d>] :bnx2:bnx2_poll_work+0xd0d/0x13c5 Pid: 0, comm: swapper Tainted: G ---- 2.6.18-333.el5debug #2 RIP: 0010:[<ffffffff881f0e7d>] [<ffffffff881f0e7d>] :bnx2:bnx2_poll_work+0xd0d/0x13c5 RSP: 0018:ffff8101b575bd50 EFLAGS: 00010216 RAX: 0000000000000005 RBX: ffff81007c5fb180 RCX: 0000000000000000 RDX: 0000000000000ffc RSI: 00000000817e8000 RDI: 0000000000000220 RBP: ffff81015bbd7ec0 R08: ffff8100817e9000 R09: 0000000000000000 R10: ffff81007c5fb180 R11: 00000000000000c8 R12: 000000007a25a010 R13: 0000000000000000 R14: 0000000000000005 R15: ffff810159f80558 FS: 0000000000000000(0000) GS:ffff8101afebc240(0000) knlGS:0000000000000000 CS: 0010 DS: 0018 ES: 0018 CR0: 000000008005003b CR2: 0000000000000008 CR3: 0000000000201000 CR4: 00000000000006a0 Process swapper (pid: 0, threadinfo ffff8101b5754000, task ffff8101afebd820) Stack: 000000000000000b ffff810159f80000 0000000000000040 ffff810159f80520 ffff810159f80500 00cf00cf8008e84b ffffc200100939e0 ffff810009035b20 0000502900000000 000000be00000001 ffff8100817e7810 00d08101b575bea8 Call Trace: <IRQ> [<ffffffff8008e0d0>] show_schedstat+0x1c2/0x25b [<ffffffff881f1886>] :bnx2:bnx2_poll+0xf6/0x231 [<ffffffff8000c9b9>] net_rx_action+0xac/0x1b1 [<ffffffff800125a0>] __do_softirq+0x89/0x133 [<ffffffff8005e30c>] call_softirq+0x1c/0x28 [<ffffffff8006d5de>] do_softirq+0x2c/0x7d [<ffffffff8006d46e>] do_IRQ+0xee/0xf7 [<ffffffff8005d625>] ret_from_intr+0x0/0xa <EOI> [<ffffffff801a5780>] acpi_processor_idle_simple+0x1c5/0x341 [<ffffffff801a573d>] acpi_processor_idle_simple+0x182/0x341 [<ffffffff801a55bb>] acpi_processor_idle_simple+0x0/0x341 [<ffffffff80049560>] cpu_idle+0x95/0xb8 [<ffffffff80078b1c>] start_secondary+0x479/0x488--- drivers/scsi/bnx2i/bnx2i_hwi.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)drivers/scsi/bnx2i/bnx2i_hwi.c +0
-0
drivers/scsi/bnx2i/bnx2i_hwi.c int bnx2i_send_fw_iscsi_init_msg(struct bnx2i_hba *hba) · line 1272
Quoted 9 lines
drivers/scsi/bnx2i/bnx2i_hwi.c +3
-0@@ -1264,6 +1264,9 @@ int bnx2i_send_fw_iscsi_init_msg(struct bnx2i_hba *hba)int rc =0 ;u64 mask64; +memset (&iscsi_init,0x00 ,sizeof (struct iscsi_kwqe_init1 )); +memset (&iscsi_init2,0x00 ,sizeof (struct iscsi_kwqe_init2 )); +bnx2i_adjust_qp_size (hba); iscsi_init.flags =
Seems ok to me.
Signature · 4 lines
You received this message because you are subscribed to the Google Groups "open-iscsi" group. To post to this group, send email to open-iscsi-/JYPxA39Uh5TLH3MbocFF+G/[email protected] To unsubscribe from this group, send email to open-iscsi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] For more options, visit this group at http://groups.google.com/group/open-iscsi?hl=en.
PATCH 1/1 BNX2I: Removed the individual PCI DEVICE ID checking
In reply to a message not in the archiveRemoved the individual PCI DEVICE ID checking inside bnx2i. The device type can easily be read from the corresponding cnic->flags. This will free bnx2i from having to get updated for every new device ID that gets added.
--- drivers/scsi/bnx2i/bnx2i.h | 2 +- drivers/scsi/bnx2i/bnx2i_init.c | 43 +++++++++++++++----------------------- drivers/scsi/bnx2i/bnx2i_iscsi.c | 2 +- 3 files changed, 19 insertions(+), 28 deletions(-)
drivers/scsi/bnx2i/bnx2i.h +1 -1
@@ -800,7 +800,7 @@ extern struct device_attribute *bnx2i_dev_attributes[];/* * Function Prototypes */ -extern void bnx2i_identify_device (struct bnx2i_hba *hba); +extern void bnx2i_identify_device (struct bnx2i_hba *hba,struct cnic_dev *dev);extern void bnx2i_ulp_init (struct cnic_dev *dev);extern void bnx2i_ulp_exit (struct cnic_dev *dev);
drivers/scsi/bnx2i/bnx2i_init.c +17 -26
59 lines not on this page · raw message
drivers/scsi/bnx2i/bnx2i_iscsi.c +1 -1
@@ -808,7 +808,7 @@ struct bnx2i_hba *bnx2i_alloc_hba(struct cnic_dev *cnic) hba->pci_func =PCI_FUNC (hba->pcidev->devfn); hba->pci_devno =PCI_SLOT (hba->pcidev->devfn); -bnx2i_identify_device (hba); +bnx2i_identify_device (hba, cnic);bnx2i_setup_host_queue_size (hba, shost); hba->reg_base =pci_resource_start (hba->pcidev,0 );
Signature · 8 lines
1.7.7.4 -- You received this message because you are subscribed to the Google Groups "open-iscsi" group. To post to this group, send email to open-iscsi-/JYPxA39Uh5TLH3MbocFF+G/[email protected] To unsubscribe from this group, send email to open-iscsi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] For more options, visit this group at http://groups.google.com/group/open-iscsi?hl=en.
Re: [PATCH] BNX2I: Removed the individual PCI DEVICE ID checking
Quoted 7 lines · Eddie Wai
Removed the individual PCI DEVICE ID checking inside bnx2i. The device type can easily be read from the corresponding
cnic->flags. This will free bnx2i from having to get updated for every new device ID that gets added.Signed-off-by Eddie Wai <[email protected]>Acked-by Michael Chan <[email protected]>
Looks ok.
PATCH 1/1 SCSI: amd_iommu dma_boundary overflow
In reply to a message not in the archiveHello,
For a 64-bit DMA capable PCIe storage HBA running under the 64-bit AMD-VI IOMMU environment, the amd_iommu code was observed to hit an overflow when it tries to page align the dma_parms->segment_boundary_mask. This overflow would eventually trigger the BUG_ON in the iommu-helper's iommu_is_span_boundary is_power_of_2 check.
A little back tracking shows that since the device is 64-bit DMA capable, the pcidev->dma_mask was correctly set to DMA_BIT_MASK(64). This dma_mask was then transferred to the SCSI host's dma_boundary param (by the iSCSI driver) and was eventually used to populate the q->limits.seg_boundary_mask (via blk_queue_segment_boundary) and the dma_parms->segment_boundary_mask (via dma_set_seg_boundary) during the scsi queue allocation.
The code seems correct as it make sense to impose the same hardware segment boundary limit on both the blk queue and the DMA code. It would be an easy alternative to simply prevent the shost->dma_boundary from being set to DMA_BIT_MASK(64), but it seems more correct to fix the amd_iommu code itself to detect and handle this max 64-bit mask condition.
Please let me know your comments.
Thanks,
Eddie
--- drivers/iommu/amd_iommu.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)
drivers/iommu/amd_iommu.c +5 -2
@@ -1526,11 +1526,14 @@ static unsigned long dma_ops_area_alloc(struct device *dev,unsigned long boundary_size;unsigned long address =-1 ;unsigned long limit; +unsigned long mask; next_bit >>=PAGE_SHIFT ; - boundary_size =ALIGN (dma_get_seg_boundary (dev) +1 , -PAGE_SIZE ) >>PAGE_SHIFT ; + mask =dma_get_seg_boundary (dev); + boundary_size = mask +1 ? +ALIGN (mask +1 ,PAGE_SIZE ) >>PAGE_SHIFT : +1UL << (BITS_PER_LONG -PAGE_SHIFT );for (;i < max_index; ++i) {unsigned long offset = dom->aperture[i]->offset >>PAGE_SHIFT ;
Signature · 9 lines
1.7.7.4 -- You received this message because you are subscribed to the Google Groups "open-iscsi" group. To unsubscribe from this group and stop receiving emails from it, send an email to open-iscsi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] To post to this group, send email to open-iscsi-/JYPxA39Uh5TLH3MbocFF+G/[email protected] Visit this group at http://groups.google.com/group/open-iscsi?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: [PATCH] SCSI: amd_iommu dma_boundary overflow
This is a bit tricky, since AMD laid off the team who were maintaining this, but I added to the cc' one of the original maintainers in the hopes they can take a look.
James
Quoted 52 lines · Eddie Wai
Hello,
For a 64-bit DMA capable PCIe storage HBA running under the 64-bit AMD-VI IOMMU environment, the
amd_iommucode was observed to hit an overflow when it tries to page align thedma_parms->segment_boundary_mask. This overflow would eventually trigger theBUG_ONin the iommu-helper'siommu_is_span_boundaryis_power_of_2check.A little back tracking shows that since the device is 64-bit DMA capable, the
pcidev->dma_maskwas correctly set toDMA_BIT_MASK(64). Thisdma_maskwas then transferred to the SCSI host'sdma_boundaryparam (by the iSCSI driver) and was eventually used to populate theq->limits.seg_boundary_mask(viablk_queue_segment_boundary) and thedma_parms->segment_boundary_mask(viadma_set_seg_boundary) during the scsi queue allocation.The code seems correct as it make sense to impose the same hardware segment boundary limit on both the blk queue and the DMA code. It would be an easy alternative to simply prevent the
shost->dma_boundaryfrom being set toDMA_BIT_MASK(64), but it seems more correct to fix theamd_iommucode itself to detect and handle this max 64-bit mask condition.Please let me know your comments.
Thanks,
EddieSigned-off-by Eddie Wai <[email protected]>--- drivers/iommu/amd_iommu.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)drivers/iommu/amd_iommu.c +5
-2@@ -1526,11 +1526,14 @@ static unsigned long dma_ops_area_alloc(struct device *dev,unsigned long boundary_size;unsigned long address =-1 ;unsigned long limit; +unsigned long mask; next_bit >>=PAGE_SHIFT ; - boundary_size =ALIGN (dma_get_seg_boundary (dev) +1 , -PAGE_SIZE ) >>PAGE_SHIFT ; + mask =dma_get_seg_boundary (dev); + boundary_size = mask +1 ? +ALIGN (mask +1 ,PAGE_SIZE ) >>PAGE_SHIFT : +1UL << (BITS_PER_LONG -PAGE_SHIFT );for (;i < max_index; ++i) {unsigned long offset = dom->aperture[i]->offset >>PAGE_SHIFT ;
Joerg Roedel
maintainerRe: [PATCH] SCSI: amd_iommu dma_boundary overflow
Hi Eddie,
Quoted 6 lines · Eddie Wai
Quoted 5 lines
The code seems correct as it make sense to impose the same hardware segment boundary limit on both the blk queue and the DMA code. It would be an easy alternative to simply prevent the
shost->dma_boundaryfrom being set toDMA_BIT_MASK(64), but it seems more correct to fix theamd_iommucode itself to detect and handle this max 64-bit mask condition.
Thanks for tracking this problem down. It turns out that this code does not only exist in the AMD IOMMU driver but also in other ones (Calgary and GART at least, havn't checked all).
Quoted 8 lines
Quoted 8 lines
drivers/iommu/amd_iommu.c +1
-0@@ -1526,11 +1526,14 @@ static unsigned long dma_ops_area_alloc(struct device *dev,unsigned long boundary_size;unsigned long address =-1 ;unsigned long limit; +unsigned long mask;
Quoted 4 lines
drivers/iommu/amd_iommu.c static unsigned long dma_ops_area_alloc(struct device *dev, · line 1533
Quoted 4 lines
drivers/iommu/amd_iommu.c +0
-2next_bit >>=PAGE_SHIFT ; - boundary_size =ALIGN (dma_get_seg_boundary (dev) +1 , -PAGE_SIZE ) >>PAGE_SHIFT ;
Given that there is a BUG_ON() in the iommu-helpers which checks for !is_power_of_2(boundary_size) I think we can simplify the this macro and avoid the overflow in a more clever way:
boundary_size = (dma_get_seg_boundary(dev) >> PAGE_SHIFT) + 1;
This should work because dma_get_seg_boundary(dev) really needs to be a bitmask which becomes a power_of_2 on incrementing.
Regards,
Joerg
cover Fixed a race condition and a rtnl_lock deadlock for bnx2fc
In reply to a message not in the archiveHello Robert and all,
My name is Eddie and I'm taking over for Bhanu as the new maintainer for bnx2fc (I'm also the current maintainer for bnx2i). Please include me in all bnx2fc related discussions moving forward. Thanks!
The following is a set of patches which fixes a race condition and a rtnl_lock in bnx2fc as described.
The first patch fixes the race condition between bnx2fc's SCSI_CMD timeout handling and the SCSI layer's task abort handling. There is a situation where the corresponding scsi_done for the timed out SCSI_CMD would never get called.
The second patch fixes a rtnl_lock deadlock in the rmmod bnx2x path where the fcoemon's write to the ctlr->enabled sysfs control param made the call to bnx2fc_disable which contented for the rtnl_lock. In this path of operation, there is no need to lock the netdev nor the interface as the ctlr is directly passed from the store_ctlr_enabled routine and the interface cannot be released until the this sysfs write is finished anyway. The __bnx2fc_enable/disable routine can continue to persist even after the bnx2fc_enable/disable are deprecated.
I've also bumped the version to 2.4.1 in an effort to align the upstream and the out-of-tree releases of bnx2fc.
Comments are welcome. Thanks.
Eddie
Eddie Wai (4):
BNX2FC: Fixed a SCSI CMD cmpl race condition between ABTS and
CLEANUP
BNX2FC: hung task timeout warning observed when rmmod bnx2x with
active FCoE targets
BNX2FC: Bump version from 1.0.14 to 2.4.1
MAINTAINER: Updated maintainer info for bnx2fc
MAINTAINERS | 2 +- drivers/scsi/bnx2fc/bnx2fc.h | 2 +- drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 62 +++++++++++++++++++++++++++--------- drivers/scsi/bnx2fc/bnx2fc_io.c | 6 +++ 4 files changed, 54 insertions(+), 18 deletions(-)
PATCH 1/1 Added fix for unsolicited NOP-In handling
In reply to a message not in the archiveHello,
Two unsolicited NOP-In fixes are included in this patch set:
1 - ITT bug fix for the unsolicited NOP-In handling
2 - added the RQE extraction even when the rx pipe is suspended
Your comments are greatly appreciated. Please review, thanks. Eddie
Eddie Wai (1):
BNX2I: Fixed bugs in the handling of unsolicited NOP-Ins
drivers/scsi/bnx2i/bnx2i_hwi.c | 22 ++++++++++++++-------- 1 files changed, 14 insertions(+), 8 deletions(-)
PATCH 1/1 BNX2I: Fixed bugs in the handling of unsolicited NOP-Ins
In reply to a message not in the archiveUnsolicited NOP-Ins are placed in the receive queue of the hardware which requires to be read out regardless if the receive pipe is suspended or not. This patch adds the disposal of this RQ element under this condition.
Also fixed the bug in the unsolicited NOP-In handling routine which checks for the RESERVED_ITT.
--- drivers/scsi/bnx2i/bnx2i_hwi.c | 22 ++++++++++++++-------- 1 files changed, 14 insertions(+), 8 deletions(-)
drivers/scsi/bnx2i/bnx2i_hwi.c +14 -8
@@ -1544,11 +1544,9 @@ static int bnx2i_process_nopin_mesg(struct iscsi_session *session,struct iscsi_task *task;struct bnx2i_nop_in_msg *nop_in;struct iscsi_nopin *hdr; -u32 itt;int tgt_async_nop =0 ; nop_in = (struct bnx2i_nop_in_msg *)cqe; - itt = nop_in->itt &ISCSI_NOP_IN_MSG_INDEX ;spin_lock (&session->lock); hdr = (struct iscsi_nopin *)&bnx2i_conn->gen_pdu.resp_hdr;
@@ -1558,7 +1556,7 @@ static int bnx2i_process_nopin_mesg(struct iscsi_session *session, hdr->exp_cmdsn =cpu_to_be32 (nop_in->exp_cmd_sn); hdr->ttt =cpu_to_be32 (nop_in->ttt); -if (itt == (u16 )RESERVED_ITT ) { +if (nop_in->itt == (u16 )RESERVED_ITT ) {bnx2i_unsol_pdu_adjust_rq (bnx2i_conn); hdr->itt =RESERVED_ITT ; tgt_async_nop =1 ;
@@ -1566,7 +1564,8 @@ static int bnx2i_process_nopin_mesg(struct iscsi_session *session, }/* this is a response to one of our nop-outs */ - task =iscsi_itt_to_task (conn, itt); + task =iscsi_itt_to_task (conn, + (u32) (nop_in->itt &ISCSI_NOP_IN_MSG_INDEX ));if (task) { hdr->flags =ISCSI_FLAG_CMD_FINAL ; hdr->itt = task->hdr->itt;
@@ -1716,9 +1715,17 @@ static void bnx2i_process_new_cqes(struct bnx2i_conn *bnx2i_conn)if (nopin->cq_req_sn != qp->cqe_exp_seq_sn)break ; -if (unlikely (test_bit (ISCSI_SUSPEND_BIT , &conn->suspend_rx))) +if (unlikely (test_bit (ISCSI_SUSPEND_BIT , &conn->suspend_rx))) { +if (nopin->op_code ==ISCSI_OP_NOOP_IN ) { +printk (KERN_ALERT "bnx2i: Unsolicited " +"NOP-In detected for suspended " +"connection dev=%s!\n" , + bnx2i_conn->hba->netdev->name); +bnx2i_unsol_pdu_adjust_rq (bnx2i_conn); + goto cqe_out; + }break ; - + } tgt_async_msg =0 ;switch (nopin->op_code) {
@@ -1765,10 +1772,9 @@ static void bnx2i_process_new_cqes(struct bnx2i_conn *bnx2i_conn)printk (KERN_ALERT "bnx2i: unknown opcode 0x%x\n" , nopin->op_code); } -if (!tgt_async_msg) bnx2i_conn->ep->num_active_cmds--; - +cqe_out:/* clear out in production version only, till beta keep opcode * field intact, will be helpful in debugging (context dump) * nopin->op_code = 0;
Signature · 1 line
1.7.0.5
A message that is not in the archive (sent off-list or not yet received): 1279738270-21911-2-git-send-email-eddie.wai-dY08KVG/lbpWk0Htik3J/[email protected]
Mike Christie
Reviewed-byRe: [PATCH] BNX2I: Fixed bugs in the handling of unsolicited NOP-Ins
Quoted 7 lines · Eddie Wai
Unsolicited NOP-Ins are placed in the receive queue of the hardware which requires to be read out regardless if the receive pipe is suspended or not. This patch adds the disposal of this RQ element under this condition.
Also fixed the bug in the unsolicited NOP-In handling routine which checks for theRESERVED_ITT.
Looks ok.
Signature · 4 lines
You received this message because you are subscribed to the Google Groups "open-iscsi" group. To post to this group, send email to open-iscsi-/JYPxA39Uh5TLH3MbocFF+G/[email protected] To unsubscribe from this group, send email to open-iscsi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] For more options, visit this group at http://groups.google.com/group/open-iscsi?hl=en.
PATCH 1/1 BNX2I: Added fix for NOP-Out response panic from unsolicited NOP-In
In reply to a message not in the archiveThe patch fixes the following situations where NOP-Out pkt is called for:
- local unsolicited NOP-Out requests (requesting no NOP-In response)
- local NOP-Out responses to unsolicited NOP-In requests
kernel panic is observed due to double session spin_lock requests; one in the bnx2i_process_nopin_local_cmpl routine in bnx2i_hwi.c and the other in the iscsi_put_task routine in libiscsi.c
The proposed fix is to export the currently static __iscsi_put_task() routine and have bnx2i call it directly instead of the iscsi_put_task() routine which holds the session spin lock.
--- drivers/scsi/bnx2i/bnx2i_hwi.c | 2 +- drivers/scsi/libiscsi.c | 3 ++- include/scsi/libiscsi.h | 1 + 3 files changed, 4 insertions(+), 2 deletions(-)
drivers/scsi/bnx2i/bnx2i_hwi.c +1 -1
@@ -1512,7 +1512,7 @@ static void bnx2i_process_nopin_local_cmpl(struct iscsi_session *session, task =iscsi_itt_to_task (conn, nop_in->itt &ISCSI_NOP_IN_MSG_INDEX );if (task) -iscsi_put_task (task); +__iscsi_put_task (task);spin_unlock (&session->lock); }
drivers/scsi/libiscsi.c +2 -1
@@ -539,11 +539,12 @@ void __iscsi_get_task(struct iscsi_task *task) }EXPORT_SYMBOL_GPL (__iscsi_get_task); -static void __iscsi_put_task (struct iscsi_task *task) +void __iscsi_put_task (struct iscsi_task *task) {if (atomic_dec_and_test (&task->refcount))iscsi_free_task (task); } +EXPORT_SYMBOL_GPL (__iscsi_put_task);void iscsi_put_task (struct iscsi_task *task) {
include/scsi/libiscsi.h +1 -0
@@ -420,6 +420,7 @@ extern struct iscsi_task *iscsi_itt_to_ctask(struct iscsi_conn *, itt_t);extern struct iscsi_task *iscsi_itt_to_task (struct iscsi_conn *,itt_t );extern void iscsi_requeue_task (struct iscsi_task *task);extern void iscsi_put_task (struct iscsi_task *task); +extern void __iscsi_put_task (struct iscsi_task *task);extern void __iscsi_get_task (struct iscsi_task *task);extern void iscsi_complete_scsi_task (struct iscsi_task *task,uint32_t exp_cmdsn,uint32_t max_cmdsn);
Signature · 1 line
1.7.0.5
Re: [PATCH] BNX2I: Added fix for NOP-Out response panic from unsolicited NOP-In
Quoted 59 lines · Eddie Wai
The patch fixes the following situations where NOP-Out pkt is called for:
- local unsolicited NOP-Out requests (requesting no NOP-In response)
- local NOP-Out responses to unsolicited NOP-In requestskernel panic is observed due to double session
spin_lockrequests; one in thebnx2i_process_nopin_local_cmplroutine inbnx2i_hwi.cand the other in theiscsi_put_taskroutine inlibiscsi.cThe proposed fix is to export the currently static
__iscsi_put_task()routine and have bnx2i call it directly instead of theiscsi_put_task()routine which holds the session spin lock.Signed-off-by Eddie Wai<[email protected]>Reviewed-by Michael Chan<[email protected]>Reviewed-by Anil Veerabhadrappa<[email protected]>Acked-by Benjamin Li<[email protected]>--- drivers/scsi/bnx2i/bnx2i_hwi.c | 2 +- drivers/scsi/libiscsi.c | 3 ++- include/scsi/libiscsi.h | 1 + 3 files changed, 4 insertions(+), 2 deletions(-)drivers/scsi/bnx2i/bnx2i_hwi.c +1
-1@@ -1512,7 +1512,7 @@ static void bnx2i_process_nopin_local_cmpl(struct iscsi_session *session, task =iscsi_itt_to_task (conn, nop_in->itt&ISCSI_NOP_IN_MSG_INDEX );if (task) -iscsi_put_task (task); +__iscsi_put_task (task);spin_unlock (&session->lock); }drivers/scsi/libiscsi.c +2
-1@@ -539,11 +539,12 @@ void __iscsi_get_task(struct iscsi_task *task) }EXPORT_SYMBOL_GPL (__iscsi_get_task); -static void __iscsi_put_task (struct iscsi_task *task) +void __iscsi_put_task (struct iscsi_task *task) {if (atomic_dec_and_test (&task->refcount))iscsi_free_task (task); } +EXPORT_SYMBOL_GPL (__iscsi_put_task);void iscsi_put_task (struct iscsi_task *task) {include/scsi/libiscsi.h +0
-0
include/scsi/libiscsi.h extern struct iscsi_task *iscsi_itt_to_ctask(struct iscsi_conn *, itt_t); · line 426
Quoted 7 lines
include/scsi/libiscsi.h +1
-0@@ -420,6 +420,7 @@ extern struct iscsi_task *iscsi_itt_to_ctask(struct iscsi_conn *, itt_t);extern struct iscsi_task *iscsi_itt_to_task (struct iscsi_conn *,itt_t );extern void iscsi_requeue_task (struct iscsi_task *task);extern void iscsi_put_task (struct iscsi_task *task); +extern void __iscsi_put_task (struct iscsi_task *task);extern void __iscsi_get_task (struct iscsi_task *task);extern void iscsi_complete_scsi_task (struct iscsi_task *task,uint32_t exp_cmdsn,uint32_t max_cmdsn);
Patch is correct.
PATCH 2/5 BNX2I: Added support for other TMFs besides ABORT_TASK
In reply to a message not in the archiveExpanded the TMF request routine to support other TMFs such as LUN RESET, etc.
--- drivers/scsi/bnx2i/bnx2i_hwi.c | 64 +++++++++++++++++++++++----------------- 1 files changed, 37 insertions(+), 27 deletions(-)
drivers/scsi/bnx2i/bnx2i_hwi.c +37 -27
@@ -393,38 +393,48 @@ int bnx2i_send_iscsi_tmf(struct bnx2i_conn *bnx2i_conn, bnx2i_conn->ep->qp.sq_prod_qe; tmfabort_wqe->op_code = tmfabort_hdr->opcode; - tmfabort_wqe->op_attr =0 ; - tmfabort_wqe->op_attr = -ISCSI_TMF_REQUEST_ALWAYS_ONE |ISCSI_TM_FUNC_ABORT_TASK ; + tmfabort_wqe->op_attr = tmfabort_hdr->flags; tmfabort_wqe->itt = (mtask->itt | (ISCSI_TASK_TYPE_MPATH <<14 )); tmfabort_wqe->reserved2 =0 ; tmfabort_wqe->cmd_sn =be32_to_cpu (tmfabort_hdr->cmdsn); - ctask =iscsi_itt_to_task (conn, tmfabort_hdr->rtt); -if (!ctask || !ctask->sc) -/* -* the iscsi layer must have completed the cmd while this -* was starting up. -* -* Note: In the case of a SCSI cmd timeout, the task's sc -* is still active; hence ctask->sc != 0 -* In this case, the task must be aborted -*/ -return 0 ; - - ref_sc = ctask->sc; - -/* Retrieve LUN directly from the ref_sc */ -int_to_scsilun (ref_sc->device->lun, (struct scsi_lun *) scsi_lun); - tmfabort_wqe->lun[0 ] =be32_to_cpu (scsi_lun[0 ]); - tmfabort_wqe->lun[1 ] =be32_to_cpu (scsi_lun[1 ]); - -if (ref_sc->sc_data_direction ==DMA_TO_DEVICE ) - dword = (ISCSI_TASK_TYPE_WRITE <<ISCSI_CMD_REQUEST_TYPE_SHIFT ); -else - dword = (ISCSI_TASK_TYPE_READ <<ISCSI_CMD_REQUEST_TYPE_SHIFT ); - tmfabort_wqe->ref_itt = (dword | (tmfabort_hdr->rtt &ISCSI_ITT_MASK )); +switch (tmfabort_hdr->flags &ISCSI_FLAG_TM_FUNC_MASK ) { +case ISCSI_TM_FUNC_ABORT_TASK : +case ISCSI_TM_FUNC_TASK_REASSIGN : + ctask =iscsi_itt_to_task (conn, tmfabort_hdr->rtt); +if (!ctask || !ctask->sc) +/* +* the iscsi layer must have completed the cmd while +* was starting up. +* +* Note: In the case of a SCSI cmd timeout, the task's +* sc is still active; hence ctask->sc != 0 +* In this case, the task must be aborted +*/ +return 0 ; + + ref_sc = ctask->sc; + +/* Retrieve LUN directly from the ref_sc */ +int_to_scsilun (ref_sc->device->lun, + (struct scsi_lun *) scsi_lun); + tmfabort_wqe->lun[0 ] =be32_to_cpu (scsi_lun[0 ]); + tmfabort_wqe->lun[1 ] =be32_to_cpu (scsi_lun[1 ]); + +if (ref_sc->sc_data_direction ==DMA_TO_DEVICE ) + dword = (ISCSI_TASK_TYPE_WRITE << +ISCSI_CMD_REQUEST_TYPE_SHIFT ); +else + dword = (ISCSI_TASK_TYPE_READ << +ISCSI_CMD_REQUEST_TYPE_SHIFT ); + tmfabort_wqe->ref_itt = (dword | + (tmfabort_hdr->rtt &ISCSI_ITT_MASK )); +break ; +default : +memcpy (tmfabort_wqe->lun, tmfabort_hdr->lun,8 ); + tmfabort_wqe->ref_itt =RESERVED_ITT ; + } tmfabort_wqe->ref_cmd_sn =be32_to_cpu (tmfabort_hdr->refcmdsn); tmfabort_wqe->bd_list_addr_lo = (u32 ) bnx2i_conn->hba->mp_bd_dma;
Signature · 1 line
1.7.0.5
A message that is not in the archive (sent off-list or not yet received): 1281467374-6182-3-git-send-email-eddie.wai-dY08KVG/lbpWk0Htik3J/[email protected]
Re: [PATCH 2/5] BNX2I: Added support for other TMFs besides ABORT_TASK
drivers/scsi/bnx2i/bnx2i_hwi.c int bnx2i_send_iscsi_tmf(struct bnx2i_conn *bnx2i_conn,
Quoted 11 lines · Eddie Wai
drivers/scsi/bnx2i/bnx2i_hwi.c +8
-0+/* Retrieve LUN directly from the ref_sc */ +int_to_scsilun (ref_sc->device->lun, + (struct scsi_lun *) scsi_lun); + tmfabort_wqe->lun[0 ] =be32_to_cpu (scsi_lun[0 ]); + tmfabort_wqe->lun[1 ] =be32_to_cpu (scsi_lun[1 ]); + +default : +memcpy (tmfabort_wqe->lun, tmfabort_hdr->lun,8 );
Why do you copy the lun differently?
Signature · 4 lines
You received this message because you are subscribed to the Google Groups "open-iscsi" group. To post to this group, send email to open-iscsi-/JYPxA39Uh5TLH3MbocFF+G/[email protected] To unsubscribe from this group, send email to open-iscsi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] For more options, visit this group at http://groups.google.com/group/open-iscsi?hl=en.
RE: [PATCH 2/5] BNX2I: Added support for other TMFs besides ABORT_TASK
Hello Mike,
Thanks for reviewing. Since both scsi_device->lun and the local scsi_lun array variable are defined as u32 so we're using a direct u32 manipulation. It's also consistent to the old code.
We chose to use memcpy for the default case as both tmfabort_wqe->lun and tmfabort_hdr->lun are defined to be u8. This u8 copying is also consistent to the other code paths in the existing bnx2i like nopout_wqe, etc.
Thanks,
Eddie
-----Original Message-----
From: Mike Christie [mailto:[email protected]]
Sent: Wednesday, August 11, 2010 12:07 PM
To: Eddie Wai
Cc: James Bottomley; open-iscsi; linux-scsi; Michael Chan; Anil Veerabhadrappa; Benjamin Li
Subject: Re: [PATCH 2/5] BNX2I: Added support for other TMFs besides ABORT_TASK
drivers/scsi/bnx2i/bnx2i_hwi.c int bnx2i_send_iscsi_tmf(struct bnx2i_conn *bnx2i_conn,
Quoted 11 lines · Eddie Wai
drivers/scsi/bnx2i/bnx2i_hwi.c +8
-0+/* Retrieve LUN directly from the ref_sc */ +int_to_scsilun (ref_sc->device->lun, + (struct scsi_lun *) scsi_lun); + tmfabort_wqe->lun[0 ] =be32_to_cpu (scsi_lun[0 ]); + tmfabort_wqe->lun[1 ] =be32_to_cpu (scsi_lun[1 ]); + +default : +memcpy (tmfabort_wqe->lun, tmfabort_hdr->lun,8 );
Why do you copy the lun differently?
Re: [PATCH 2/5] BNX2I: Added support for other TMFs besides ABORT_TASK
Quoted 6 lines · Eddie Wai
Hello Mike,
Thanks for reviewing. Since both
scsi_device->lunand the localscsi_lunarray variable are defined as u32 so we're using a direct u32 manipulation. It's also consistent to the old code.We chose to use memcpy for the default case as both
tmfabort_wqe->lunandtmfabort_hdr->lunare defined to be u8. This u8 copying is also consistent to the other code paths in the existing bnx2i likenopout_wqe, etc.
You can do the same for the abort case. For aborts the tmfabort_hdr->lun has already been converted from a int to a scsi_lun for you so you should be able to copy it too.
Quoted 30 lines
Thanks,
Eddie-----Original Message-----
From: Mike Christie [mailto:[email protected]]
Sent: Wednesday, August 11, 2010 12:07 PM
To: Eddie Wai
Cc: James Bottomley; open-iscsi; linux-scsi; Michael Chan; Anil Veerabhadrappa; Benjamin Li
Subject: Re: [PATCH 2/5] BNX2I: Added support for other TMFs besidesABORT_TASKdrivers/scsi/bnx2i/bnx2i_hwi.c int bnx2i_send_iscsi_tmf(struct bnx2i_conn *bnx2i_conn,
Quoted 11 lines · Eddie Wai
drivers/scsi/bnx2i/bnx2i_hwi.c +8
-0+/* Retrieve LUN directly from the ref_sc */ +int_to_scsilun (ref_sc->device->lun, + (struct scsi_lun *) scsi_lun); + tmfabort_wqe->lun[0 ] =be32_to_cpu (scsi_lun[0 ]); + tmfabort_wqe->lun[1 ] =be32_to_cpu (scsi_lun[1 ]); + +default : +memcpy (tmfabort_wqe->lun, tmfabort_hdr->lun,8 );Why do you copy the lun differently?
--
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 4/5 BNX2I: Added chip cleanup for the remove module path
In reply to a message not in the archiveIn the case when an ep_connect request is interrupted due to route request stall, if the iSCSI daemon is terminated by the user, the chip will be left in a state which will not get cleaned up upon module removal. Upon module reload, when the same context id is used for a new connection, chip panic would occur.
This patch adds chip cleanup in the module removal path.
--- drivers/scsi/bnx2i/bnx2i_init.c | 53 +++++++++++++++++++++++-------------- drivers/scsi/bnx2i/bnx2i_iscsi.c | 3 ++ 2 files changed, 36 insertions(+), 20 deletions(-)
drivers/scsi/bnx2i/bnx2i_init.c +33 -20
@@ -167,6 +167,37 @@ void bnx2i_start(void *handle)/** +* bnx2i_chip_cleanup - local routine to handle chip cleanup +* +* Driver checks if adapter still has any active connections before +* executing the cleanup process +*/ +static void bnx2i_chip_cleanup (struct bnx2i_hba *hba) +{ +struct bnx2i_endpoint *bnx2i_ep; +struct list_head *pos, *tmp; + +if (hba->ofld_conns_active) { +/* Stage to force the disconnection +* This is the case where the daemon is either slow or +* not present +*/ +printk (KERN_ALERT "bnx2i: (%s) chip cleanup for %d active " +"connections\n" , hba->netdev->name, + hba->ofld_conns_active); +mutex_lock (&hba->net_dev_lock); +list_for_each_safe (pos, tmp, &hba->ep_active_list) { + bnx2i_ep = list_entry(pos, struct bnx2i_endpoint, link); +/* Clean up the chip only */ +bnx2i_hw_ep_disconnect (bnx2i_ep); + bnx2i_ep->cm_sk =NULL ; + } +mutex_unlock (&hba->net_dev_lock); + } +} + + +/** * bnx2i_stop - cnic callback to shutdown adapter instance * @handle: transparent handle pointing to adapter structure *
@@ -176,8 +207,6 @@ void bnx2i_start(void *handle)void bnx2i_stop (void *handle) {struct bnx2i_hba *hba = handle; -struct list_head *pos, *tmp; -struct bnx2i_endpoint *bnx2i_ep;int conns_active;/* check if cleanup happened in GOING_DOWN context */
@@ -198,24 +227,7 @@ void bnx2i_stop(void *handle)if (hba->ofld_conns_active == conns_active)break ; } -if (hba->ofld_conns_active) { -/* Stage to force the disconnection -* This is the case where the daemon is either slow or -* not present -*/ -printk (KERN_ALERT "bnx2i: Wait timeout, force all eps " -"to disconnect (%d)\n" , hba->ofld_conns_active); -mutex_lock (&hba->net_dev_lock); -list_for_each_safe (pos, tmp, &hba->ep_active_list) { - bnx2i_ep = list_entry(pos, struct bnx2i_endpoint, link); -/* Clean up the chip only */ -bnx2i_hw_ep_disconnect (bnx2i_ep); - } -mutex_unlock (&hba->net_dev_lock); -if (hba->ofld_conns_active) -printk (KERN_ERR "bnx2i: EP disconnect timeout (%d)!\n" , - hba->ofld_conns_active); - } +bnx2i_chip_cleanup (hba);/* This flag should be cleared last so that ep_disconnect() gracefully * cleans up connection context
@@ -457,6 +469,7 @@ static void __exit bnx2i_mod_exit(void) adapter_count--;if (test_bit (BNX2I_CNIC_REGISTERED , &hba->reg_with_cnic)) { +bnx2i_chip_cleanup (hba); hba->cnic->unregister_device (hba->cnic,CNIC_ULP_ISCSI );clear_bit (BNX2I_CNIC_REGISTERED , &hba->reg_with_cnic); }
drivers/scsi/bnx2i/bnx2i_iscsi.c +3 -0
@@ -1953,6 +1953,9 @@ int bnx2i_hw_ep_disconnect(struct bnx2i_endpoint *bnx2i_ep)if (!cnic)return 0 ; +if (bnx2i_ep->state ==EP_STATE_IDLE ) +return 0 ; +if (!bnx2i_ep_tcp_conn_active (bnx2i_ep)) goto destroy_conn;
Signature · 1 line
1.7.0.5
Re: [PATCH 4/5] BNX2I: Added chip cleanup for the remove module path
Quoted 20 lines · Eddie Wai
In the case when an
ep_connectrequest is interrupted due to route request stall, if the iSCSI daemon is terminated by the user, the chip will be left in a state which will not get cleaned up upon module removal. Upon module reload, when the same context id is used for a new connection, chip panic would occur.This patch adds chip cleanup in the module removal path.
Signed-off-by Eddie Wai<[email protected]>Acked-by Benjamin Li<[email protected]>--- drivers/scsi/bnx2i/bnx2i_init.c | 53 +++++++++++++++++++++++-------------- drivers/scsi/bnx2i/bnx2i_iscsi.c | 3 ++ 2 files changed, 36 insertions(+), 20 deletions(-)drivers/scsi/bnx2i/bnx2i_init.c +0
-0
drivers/scsi/bnx2i/bnx2i_init.c void bnx2i_start(void *handle) · line 170
Quoted 4 lines
drivers/scsi/bnx2i/bnx2i_init.c +1
-0@@ -167,6 +167,37 @@ void bnx2i_start(void *handle)/** +* bnx2i_chip_cleanup - local routine to handle chip cleanup
For docbook comments you need the argument info
@hba: driver's hba struct
cover Patch set to fix various bugs in bnx2i
In reply to a message not in the archiveThe first 2 patches fix issues related to rfc3720 for nopout and TMF. The last 2 patches fix issues related to Broadcom specific cleanup under different situations.
Please review, thanks.
Eddie
Eddie Wai (5):
BNX2I: Fixed a protocol violation on nopout responses
BNX2I: Added support for other TMFs besides ABORT_TASK
BNX2I: Recouple the CFC delete cleanup with cm_abort/close completion
BNX2I: Added chip cleanup for the remove module path
BNX2I: Updated version to bnx2i-2.1.3
drivers/scsi/bnx2i/bnx2i.h | 2 +- drivers/scsi/bnx2i/bnx2i_hwi.c | 69 +++++++++++++++++++++---------------- drivers/scsi/bnx2i/bnx2i_init.c | 61 +++++++++++++++++++++------------ drivers/scsi/bnx2i/bnx2i_iscsi.c | 15 +++++--- 4 files changed, 87 insertions(+), 60 deletions(-)
PATCH 5/5 BNX2I: Updated version to bnx2i-2.1.3
In reply to a message not in the archiveAlso updated maintainer info.
--- drivers/scsi/bnx2i/bnx2i_init.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-)
drivers/scsi/bnx2i/bnx2i_init.c +5 -3
@@ -17,15 +17,17 @@ static struct list_head adapter_list = LIST_HEAD_INIT(adapter_list);static u32 adapter_count;#define DRV_MODULE_NAME "bnx2i" -#define DRV_MODULE_VERSION "2.1.2" -#define DRV_MODULE_RELDATE "Jun 28, 2010" +#define DRV_MODULE_VERSION "2.1.3" +#define DRV_MODULE_RELDATE "Aug 10, 2010"static char version[]__devinitdata ="Broadcom NetXtreme II iSCSI Driver " DRV_MODULE_NAME \" v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n" ; -MODULE_AUTHOR ("Anil Veerabhadrappa <[email protected]>" ); +MODULE_AUTHOR ("Anil Veerabhadrappa <[email protected]> and " +"Eddie Wai <[email protected]>" ); +MODULE_DESCRIPTION ("Broadcom NetXtreme II BCM5706/5708/5709/57710/57711" " iSCSI Driver" );MODULE_LICENSE ("GPL" );
Signature · 1 line
1.7.0.5
PATCH v2 1/5 BNX2I: Fixed a protocol violation on nopout responses
In reply to a message not in the archiveAccording to RFC3720, nopout packet sent in response to unsolicited nopin packet requesting a response must retain the TTT of the requester.
--- drivers/scsi/bnx2i/bnx2i.h | 2 +- drivers/scsi/bnx2i/bnx2i_hwi.c | 5 ++--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 2 -- 3 files changed, 3 insertions(+), 6 deletions(-)
drivers/scsi/bnx2i/bnx2i.h +1 -1
@@ -753,7 +753,7 @@ extern int bnx2i_send_iscsi_tmf(struct bnx2i_conn *conn,extern int bnx2i_send_iscsi_scsicmd (struct bnx2i_conn *conn,struct bnx2i_cmd *cmnd);extern int bnx2i_send_iscsi_nopout (struct bnx2i_conn *conn, -struct iscsi_task *mtask,u32 ttt, +struct iscsi_task *mtask,char *datap,int data_len,int unsol);extern int bnx2i_send_iscsi_logout (struct bnx2i_conn *conn,struct iscsi_task *mtask);
drivers/scsi/bnx2i/bnx2i_hwi.c +2 -3
@@ -464,7 +464,6 @@ int bnx2i_send_iscsi_scsicmd(struct bnx2i_conn *bnx2i_conn,* @conn: iscsi connection * @cmd: driver command structure which is requesting * a WQE to sent to chip for further processing -* @ttt: TTT to be used when building pdu header * @datap: payload buffer pointer * @data_len: payload data length * @unsol: indicated whether nopout pdu is unsolicited pdu or
@@ -473,7 +472,7 @@ int bnx2i_send_iscsi_scsicmd(struct bnx2i_conn *bnx2i_conn,* prepare and post a nopout request WQE to CNIC firmware */ int bnx2i_send_iscsi_nopout (struct bnx2i_conn *bnx2i_conn, -struct iscsi_task *task,u32 ttt, +struct iscsi_task *task,char *datap,int data_len,int unsol) {struct bnx2i_endpoint *ep = bnx2i_conn->ep;
@@ -498,7 +497,7 @@ int bnx2i_send_iscsi_nopout(struct bnx2i_conn *bnx2i_conn, nopout_wqe->itt = ((u16 )task->itt | (ISCSI_TASK_TYPE_MPATH <<ISCSI_TMF_REQUEST_TYPE_SHIFT )); - nopout_wqe->ttt = ttt; + nopout_wqe->ttt = nopout_hdr->ttt; nopout_wqe->flags =0 ;if (!unsol) nopout_wqe->flags =ISCSI_NOP_OUT_REQUEST_LOCAL_COMPLETION ;
drivers/scsi/bnx2i/bnx2i_iscsi.c +0 -2
@@ -1078,11 +1078,9 @@ static int bnx2i_iscsi_send_generic_request(struct iscsi_task *task) buf = bnx2i_conn->gen_pdu.req_buf;if (data_len) rc =bnx2i_send_iscsi_nopout (bnx2i_conn, task, -RESERVED_ITT , buf, data_len,1 );else rc =bnx2i_send_iscsi_nopout (bnx2i_conn, task, -RESERVED_ITT ,NULL ,0 ,1 );break ;case ISCSI_OP_LOGOUT :
Signature · 1 line
1.7.0.5
PATCH v2 2/5 BNX2I: Added support for other TMFs besides ABORT_TASK
In reply to a message not in the archiveExpanded the TMF request routine to support other TMFs such as LUN RESET, etc.
--- drivers/scsi/bnx2i/bnx2i_hwi.c | 59 +++++++++++++++++++++------------------- 1 files changed, 31 insertions(+), 28 deletions(-)
drivers/scsi/bnx2i/bnx2i_hwi.c +31 -28
@@ -385,7 +385,6 @@ int bnx2i_send_iscsi_tmf(struct bnx2i_conn *bnx2i_conn,struct bnx2i_cmd *bnx2i_cmd;struct bnx2i_tmf_request *tmfabort_wqe;u32 dword; -u32 scsi_lun[2 ]; bnx2i_cmd = (struct bnx2i_cmd *)mtask->dd_data; tmfabort_hdr = (struct iscsi_tm *)mtask->hdr;
@@ -393,38 +392,42 @@ int bnx2i_send_iscsi_tmf(struct bnx2i_conn *bnx2i_conn, bnx2i_conn->ep->qp.sq_prod_qe; tmfabort_wqe->op_code = tmfabort_hdr->opcode; - tmfabort_wqe->op_attr =0 ; - tmfabort_wqe->op_attr = -ISCSI_TMF_REQUEST_ALWAYS_ONE |ISCSI_TM_FUNC_ABORT_TASK ; + tmfabort_wqe->op_attr = tmfabort_hdr->flags; tmfabort_wqe->itt = (mtask->itt | (ISCSI_TASK_TYPE_MPATH <<14 )); tmfabort_wqe->reserved2 =0 ; tmfabort_wqe->cmd_sn =be32_to_cpu (tmfabort_hdr->cmdsn); - ctask =iscsi_itt_to_task (conn, tmfabort_hdr->rtt); -if (!ctask || !ctask->sc) -/* -* the iscsi layer must have completed the cmd while this -* was starting up. -* -* Note: In the case of a SCSI cmd timeout, the task's sc -* is still active; hence ctask->sc != 0 -* In this case, the task must be aborted -*/ -return 0 ; - - ref_sc = ctask->sc; - -/* Retrieve LUN directly from the ref_sc */ -int_to_scsilun (ref_sc->device->lun, (struct scsi_lun *) scsi_lun); - tmfabort_wqe->lun[0 ] =be32_to_cpu (scsi_lun[0 ]); - tmfabort_wqe->lun[1 ] =be32_to_cpu (scsi_lun[1 ]); - -if (ref_sc->sc_data_direction ==DMA_TO_DEVICE ) - dword = (ISCSI_TASK_TYPE_WRITE <<ISCSI_CMD_REQUEST_TYPE_SHIFT ); -else - dword = (ISCSI_TASK_TYPE_READ <<ISCSI_CMD_REQUEST_TYPE_SHIFT ); - tmfabort_wqe->ref_itt = (dword | (tmfabort_hdr->rtt &ISCSI_ITT_MASK )); +switch (tmfabort_hdr->flags &ISCSI_FLAG_TM_FUNC_MASK ) { +case ISCSI_TM_FUNC_ABORT_TASK : +case ISCSI_TM_FUNC_TASK_REASSIGN : +memcpy (tmfabort_wqe->lun, tmfabort_hdr->lun,8 ); + ctask =iscsi_itt_to_task (conn, tmfabort_hdr->rtt); +if (!ctask || !ctask->sc) +/* +* the iscsi layer must have completed the cmd while +* was starting up. +* +* Note: In the case of a SCSI cmd timeout, the task's +* sc is still active; hence ctask->sc != 0 +* In this case, the task must be aborted +*/ +return 0 ; + + ref_sc = ctask->sc; +if (ref_sc->sc_data_direction ==DMA_TO_DEVICE ) + dword = (ISCSI_TASK_TYPE_WRITE << +ISCSI_CMD_REQUEST_TYPE_SHIFT ); +else + dword = (ISCSI_TASK_TYPE_READ << +ISCSI_CMD_REQUEST_TYPE_SHIFT ); + tmfabort_wqe->ref_itt = (dword | + (tmfabort_hdr->rtt &ISCSI_ITT_MASK )); +break ; +default : +memcpy (tmfabort_wqe->lun, tmfabort_hdr->lun,8 ); + tmfabort_wqe->ref_itt =RESERVED_ITT ; + } tmfabort_wqe->ref_cmd_sn =be32_to_cpu (tmfabort_hdr->refcmdsn); tmfabort_wqe->bd_list_addr_lo = (u32 ) bnx2i_conn->hba->mp_bd_dma;
Signature · 1 line
1.7.0.5
Re: [PATCH 2/5 v2] BNX2I: Added support for other TMFs besides ABORT_TASK
Quoted 5 lines · Eddie Wai
drivers/scsi/bnx2i/bnx2i_hwi.c +4
-1- tmfabort_wqe->ref_itt = (dword | (tmfabort_hdr->rtt&ISCSI_ITT_MASK )); +switch (tmfabort_hdr->flags&ISCSI_FLAG_TM_FUNC_MASK ) { +case ISCSI_TM_FUNC_ABORT_TASK : +case ISCSI_TM_FUNC_TASK_REASSIGN : +memcpy (tmfabort_wqe->lun, tmfabort_hdr->lun,8 );
....
drivers/scsi/bnx2i/bnx2i_hwi.c int bnx2i_send_iscsi_tmf(struct bnx2i_conn *bnx2i_conn, · line 431
Quoted 5 lines
drivers/scsi/bnx2i/bnx2i_hwi.c +4
-0+default : +memcpy (tmfabort_wqe->lun, tmfabort_hdr->lun,8 ); + tmfabort_wqe->ref_itt =RESERVED_ITT ; + } tmfabort_wqe->ref_cmd_sn =be32_to_cpu (tmfabort_hdr->refcmdsn);
The 2 memcpys are exactly the same so just do it once right here:
memcpy(tmfabort_wqe->lun, tmfabort_hdr->lun, 8);
Quoted 2 lines
tmfabort_wqe->bd_list_addr_lo = (u32) bnx2i_conn->hba->mp_bd_dma;
PATCH v2 3/5 BNX2I: Recouple the CFC delete cleanup with cm_abort/close completion
In reply to a message not in the archiveSpecific to the Broadcom 10g chipset, the CFC delete operation must be coupled with the cm_abort/close with does the SRC delete/terminate offload operation prior.
--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-)
drivers/scsi/bnx2i/bnx2i_iscsi.c +6 -4
@@ -1996,11 +1996,13 @@ int bnx2i_hw_ep_disconnect(struct bnx2i_endpoint *bnx2i_ep)else close_ret = cnic->cm_abort (bnx2i_ep->cm_sk); +/* No longer allow CFC delete if cm_close/abort fails the request */ if (close_ret) - bnx2i_ep->state =EP_STATE_DISCONN_COMPL ; - -/* wait for option-2 conn teardown */ -wait_event_interruptible (bnx2i_ep->ofld_wait, +printk (KERN_ALERT "bnx2i: %s close/abort(%d) returned %d\n" , + bnx2i_ep->hba->netdev->name, close, close_ret); +else +/* wait for option-2 conn teardown */ +wait_event_interruptible (bnx2i_ep->ofld_wait, bnx2i_ep->state !=EP_STATE_DISCONN_START );if (signal_pending (current))
Signature · 1 line
1.7.0.5
v2 cover Patch set to fix various bugs in bnx2i
In reply to a message not in the archiveThe first 2 patches fix issues related to rfc3720 for nopout and TMF. The last 2 patches fix issues related to Broadcom specific cleanup under different situations.
Please review, thanks.
Eddie
Eddie Wai (5):
BNX2I: Fixed a protocol violation on nopout responses
BNX2I: Added support for other TMFs besides ABORT_TASK
BNX2I: Recouple the CFC delete cleanup with cm_abort/close completion
BNX2I: Added chip cleanup for the remove module path
BNX2I: Updated version to bnx2i-2.1.3
drivers/scsi/bnx2i/bnx2i.h | 2 +- drivers/scsi/bnx2i/bnx2i_hwi.c | 64 +++++++++++++++++++------------------ drivers/scsi/bnx2i/bnx2i_init.c | 62 +++++++++++++++++++++++------------- drivers/scsi/bnx2i/bnx2i_iscsi.c | 15 +++++--- 4 files changed, 82 insertions(+), 61 deletions(-)
PATCH v2 4/5 BNX2I: Added chip cleanup for the remove module path
In reply to a message not in the archiveIn the case when an ep_connect request is interrupted due to route request stall, if the iSCSI daemon is terminated by the user, the chip will be left in a state which will not get cleaned up upon module removal. Upon module reload, when the same context id is used for a new connection, chip panic would occur.
This patch adds chip cleanup in the module removal path.
--- drivers/scsi/bnx2i/bnx2i_init.c | 54 ++++++++++++++++++++++++-------------- drivers/scsi/bnx2i/bnx2i_iscsi.c | 3 ++ 2 files changed, 37 insertions(+), 20 deletions(-)
drivers/scsi/bnx2i/bnx2i_init.c +34 -20
@@ -167,6 +167,38 @@ void bnx2i_start(void *handle)/** +* bnx2i_chip_cleanup - local routine to handle chip cleanup +* @hba: Adapter instance to register +* +* Driver checks if adapter still has any active connections before +* executing the cleanup process +*/ +static void bnx2i_chip_cleanup (struct bnx2i_hba *hba) +{ +struct bnx2i_endpoint *bnx2i_ep; +struct list_head *pos, *tmp; + +if (hba->ofld_conns_active) { +/* Stage to force the disconnection +* This is the case where the daemon is either slow or +* not present +*/ +printk (KERN_ALERT "bnx2i: (%s) chip cleanup for %d active " +"connections\n" , hba->netdev->name, + hba->ofld_conns_active); +mutex_lock (&hba->net_dev_lock); +list_for_each_safe (pos, tmp, &hba->ep_active_list) { + bnx2i_ep = list_entry(pos, struct bnx2i_endpoint, link); +/* Clean up the chip only */ +bnx2i_hw_ep_disconnect (bnx2i_ep); + bnx2i_ep->cm_sk =NULL ; + } +mutex_unlock (&hba->net_dev_lock); + } +} + + +/** * bnx2i_stop - cnic callback to shutdown adapter instance * @handle: transparent handle pointing to adapter structure *
@@ -176,8 +208,6 @@ void bnx2i_start(void *handle)void bnx2i_stop (void *handle) {struct bnx2i_hba *hba = handle; -struct list_head *pos, *tmp; -struct bnx2i_endpoint *bnx2i_ep;int conns_active;/* check if cleanup happened in GOING_DOWN context */
@@ -198,24 +228,7 @@ void bnx2i_stop(void *handle)if (hba->ofld_conns_active == conns_active)break ; } -if (hba->ofld_conns_active) { -/* Stage to force the disconnection -* This is the case where the daemon is either slow or -* not present -*/ -printk (KERN_ALERT "bnx2i: Wait timeout, force all eps " -"to disconnect (%d)\n" , hba->ofld_conns_active); -mutex_lock (&hba->net_dev_lock); -list_for_each_safe (pos, tmp, &hba->ep_active_list) { - bnx2i_ep = list_entry(pos, struct bnx2i_endpoint, link); -/* Clean up the chip only */ -bnx2i_hw_ep_disconnect (bnx2i_ep); - } -mutex_unlock (&hba->net_dev_lock); -if (hba->ofld_conns_active) -printk (KERN_ERR "bnx2i: EP disconnect timeout (%d)!\n" , - hba->ofld_conns_active); - } +bnx2i_chip_cleanup (hba);/* This flag should be cleared last so that ep_disconnect() gracefully * cleans up connection context
@@ -457,6 +470,7 @@ static void __exit bnx2i_mod_exit(void) adapter_count--;if (test_bit (BNX2I_CNIC_REGISTERED , &hba->reg_with_cnic)) { +bnx2i_chip_cleanup (hba); hba->cnic->unregister_device (hba->cnic,CNIC_ULP_ISCSI );clear_bit (BNX2I_CNIC_REGISTERED , &hba->reg_with_cnic); }
drivers/scsi/bnx2i/bnx2i_iscsi.c +3 -0
@@ -1953,6 +1953,9 @@ int bnx2i_hw_ep_disconnect(struct bnx2i_endpoint *bnx2i_ep)if (!cnic)return 0 ; +if (bnx2i_ep->state ==EP_STATE_IDLE ) +return 0 ; +if (!bnx2i_ep_tcp_conn_active (bnx2i_ep)) goto destroy_conn;
Signature · 1 line
1.7.0.5
PATCH v2 5/5 BNX2I: Updated version to bnx2i-2.1.3
In reply to a message not in the archiveAlso updated maintainer info.
--- drivers/scsi/bnx2i/bnx2i_init.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-)
drivers/scsi/bnx2i/bnx2i_init.c +5 -3
@@ -17,15 +17,17 @@ static struct list_head adapter_list = LIST_HEAD_INIT(adapter_list);static u32 adapter_count;#define DRV_MODULE_NAME "bnx2i" -#define DRV_MODULE_VERSION "2.1.2" -#define DRV_MODULE_RELDATE "Jun 28, 2010" +#define DRV_MODULE_VERSION "2.1.3" +#define DRV_MODULE_RELDATE "Aug 10, 2010"static char version[]__devinitdata ="Broadcom NetXtreme II iSCSI Driver " DRV_MODULE_NAME \" v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n" ; -MODULE_AUTHOR ("Anil Veerabhadrappa <[email protected]>" ); +MODULE_AUTHOR ("Anil Veerabhadrappa <[email protected]> and " +"Eddie Wai <[email protected]>" ); +MODULE_DESCRIPTION ("Broadcom NetXtreme II BCM5706/5708/5709/57710/57711" " iSCSI Driver" );MODULE_LICENSE ("GPL" );
Signature · 1 line
1.7.0.5
PATCH v3 2/5 BNX2I: Added support for other TMFs besides ABORT_TASK
In reply to a message not in the archiveExpanded the TMF request routine to support other TMFs such as LUN RESET, etc.
--- drivers/scsi/bnx2i/bnx2i_hwi.c | 58 ++++++++++++++++++++------------------- 1 files changed, 30 insertions(+), 28 deletions(-)
drivers/scsi/bnx2i/bnx2i_hwi.c +30 -28
@@ -385,7 +385,6 @@ int bnx2i_send_iscsi_tmf(struct bnx2i_conn *bnx2i_conn,struct bnx2i_cmd *bnx2i_cmd;struct bnx2i_tmf_request *tmfabort_wqe;u32 dword; -u32 scsi_lun[2 ]; bnx2i_cmd = (struct bnx2i_cmd *)mtask->dd_data; tmfabort_hdr = (struct iscsi_tm *)mtask->hdr;
@@ -393,38 +392,41 @@ int bnx2i_send_iscsi_tmf(struct bnx2i_conn *bnx2i_conn, bnx2i_conn->ep->qp.sq_prod_qe; tmfabort_wqe->op_code = tmfabort_hdr->opcode; - tmfabort_wqe->op_attr =0 ; - tmfabort_wqe->op_attr = -ISCSI_TMF_REQUEST_ALWAYS_ONE |ISCSI_TM_FUNC_ABORT_TASK ; + tmfabort_wqe->op_attr = tmfabort_hdr->flags; tmfabort_wqe->itt = (mtask->itt | (ISCSI_TASK_TYPE_MPATH <<14 )); tmfabort_wqe->reserved2 =0 ; tmfabort_wqe->cmd_sn =be32_to_cpu (tmfabort_hdr->cmdsn); - ctask =iscsi_itt_to_task (conn, tmfabort_hdr->rtt); -if (!ctask || !ctask->sc) -/* -* the iscsi layer must have completed the cmd while this -* was starting up. -* -* Note: In the case of a SCSI cmd timeout, the task's sc -* is still active; hence ctask->sc != 0 -* In this case, the task must be aborted -*/ -return 0 ; - - ref_sc = ctask->sc; - -/* Retrieve LUN directly from the ref_sc */ -int_to_scsilun (ref_sc->device->lun, (struct scsi_lun *) scsi_lun); - tmfabort_wqe->lun[0 ] =be32_to_cpu (scsi_lun[0 ]); - tmfabort_wqe->lun[1 ] =be32_to_cpu (scsi_lun[1 ]); - -if (ref_sc->sc_data_direction ==DMA_TO_DEVICE ) - dword = (ISCSI_TASK_TYPE_WRITE <<ISCSI_CMD_REQUEST_TYPE_SHIFT ); -else - dword = (ISCSI_TASK_TYPE_READ <<ISCSI_CMD_REQUEST_TYPE_SHIFT ); - tmfabort_wqe->ref_itt = (dword | (tmfabort_hdr->rtt &ISCSI_ITT_MASK )); +switch (tmfabort_hdr->flags &ISCSI_FLAG_TM_FUNC_MASK ) { +case ISCSI_TM_FUNC_ABORT_TASK : +case ISCSI_TM_FUNC_TASK_REASSIGN : + ctask =iscsi_itt_to_task (conn, tmfabort_hdr->rtt); +if (!ctask || !ctask->sc) +/* +* the iscsi layer must have completed the cmd while +* was starting up. +* +* Note: In the case of a SCSI cmd timeout, the task's +* sc is still active; hence ctask->sc != 0 +* In this case, the task must be aborted +*/ +return 0 ; + + ref_sc = ctask->sc; +if (ref_sc->sc_data_direction ==DMA_TO_DEVICE ) + dword = (ISCSI_TASK_TYPE_WRITE << +ISCSI_CMD_REQUEST_TYPE_SHIFT ); +else + dword = (ISCSI_TASK_TYPE_READ << +ISCSI_CMD_REQUEST_TYPE_SHIFT ); + tmfabort_wqe->ref_itt = (dword | + (tmfabort_hdr->rtt &ISCSI_ITT_MASK )); +break ; +default : + tmfabort_wqe->ref_itt =RESERVED_ITT ; + } +memcpy (tmfabort_wqe->lun, tmfabort_hdr->lun,sizeof (struct scsi_lun )); tmfabort_wqe->ref_cmd_sn =be32_to_cpu (tmfabort_hdr->refcmdsn); tmfabort_wqe->bd_list_addr_lo = (u32 ) bnx2i_conn->hba->mp_bd_dma;
Signature · 1 line
1.7.0.5
Re: [PATCH 2/5 v3] BNX2I: Added support for other TMFs besides ABORT_TASK
Quoted 3 lines · Eddie Wai
Expanded the TMF request routine to support other TMFs such as LUN RESET, etc.
All the patches look ok to me. Thanks.
cover BNX2I: Patch set to fix various bug fixes
In reply to a message not in the archiveHello,
This patch set contains various bug fixes as categorized in the following:
- scsi command handling (nop-ins, tmfs)
- various connection clean up bug fixes
Your comments are grealy appreciated. Please review, thanks.
Eddie
Eddie Wai (16):
BNX2I: Fixed bugs in the handling of unsolicited NOP-Ins
BNX2I: Added fix for NOP-Out response panic from unsolicited NOP-In
BNX2I: Fixed the endian bug in the TMF LUN cmd send
BNX2I: Updated the handling of NETEVENTs to alleviate recovery
BNX2I: Modified the bnx2i stop path to compensate for in progress ops
BNX2I: Added code to handle the binding of an existing connection
BNX2I: Fixed the remote TCP RST handling for the 570X (1g)
BNX2I: Added mutex lock protection to conn_get_param
BNX2I: Removed the dynamic registration of CNIC
BNX2I: Fixed a cid leak issue for 5771X (10g)
BNX2I: Added return code check for chip kwqe submission request
BNX2I: Added feature to silently drop NOPOUT request
BNX2I: Cleaned up various error conditions in ep_connect/disconnect
BNX2I: Allow to abort the connection if connect request times out
BNX2I: Updated copyright and maintainer info
BNX2I: Updated version to 2.6.2.2
drivers/scsi/bnx2i/57xx_iscsi_constants.h | 3 +- drivers/scsi/bnx2i/57xx_iscsi_hsi.h | 3 +- drivers/scsi/bnx2i/bnx2i.h | 18 ++-- drivers/scsi/bnx2i/bnx2i_hwi.c | 152 ++++++++++++++++++++----- drivers/scsi/bnx2i/bnx2i_init.c | 108 ++++-------------- drivers/scsi/bnx2i/bnx2i_iscsi.c | 177 +++++++++++++++++++--------- drivers/scsi/bnx2i/bnx2i_sysfs.c | 3 +- drivers/scsi/libiscsi.c | 3 +- include/scsi/libiscsi.h | 1 + 9 files changed, 280 insertions(+), 188 deletions(-)
PATCH 1/16 BNX2I: Fixed bugs in the handling of unsolicited NOP-Ins
In reply to a message not in the archiveUnsolicited NOP-Ins are placed in the receive queue of the hardware which requires to be read out regardless if the receive pipe is suspended or not. This patch adds the disposal of this RQ element under this condition.
Also fixed the bug in the unsolicited NOP-In handling routine which checks for the RESERVED_ITT.
--- drivers/scsi/bnx2i/bnx2i_hwi.c | 23 +++++++++++++++-------- 1 files changed, 15 insertions(+), 8 deletions(-)
drivers/scsi/bnx2i/bnx2i_hwi.c +15 -8
@@ -1549,11 +1549,9 @@ static int bnx2i_process_nopin_mesg(struct iscsi_session *session,struct iscsi_task *task;struct bnx2i_nop_in_msg *nop_in;struct iscsi_nopin *hdr; -u32 itt;int tgt_async_nop =0 ; nop_in = (struct bnx2i_nop_in_msg *)cqe; - itt = nop_in->itt &ISCSI_NOP_IN_MSG_INDEX ;spin_lock (&session->lock); hdr = (struct iscsi_nopin *)&bnx2i_conn->gen_pdu.resp_hdr;
@@ -1563,7 +1561,7 @@ static int bnx2i_process_nopin_mesg(struct iscsi_session *session, hdr->exp_cmdsn =cpu_to_be32 (nop_in->exp_cmd_sn); hdr->ttt =cpu_to_be32 (nop_in->ttt); -if (itt == (u16 )RESERVED_ITT ) { +if (nop_in->itt == (u16 )RESERVED_ITT ) {bnx2i_unsol_pdu_adjust_rq (bnx2i_conn); hdr->itt =RESERVED_ITT ; tgt_async_nop =1 ;
@@ -1571,7 +1569,8 @@ static int bnx2i_process_nopin_mesg(struct iscsi_session *session, }/* this is a response to one of our nop-outs */ - task =iscsi_itt_to_task (conn, itt); + task =iscsi_itt_to_task (conn, + (itt_t) (nop_in->itt &ISCSI_NOP_IN_MSG_INDEX ));if (task) { hdr->flags =ISCSI_FLAG_CMD_FINAL ; hdr->itt = task->hdr->itt;
@@ -1721,9 +1720,18 @@ static void bnx2i_process_new_cqes(struct bnx2i_conn *bnx2i_conn)if (nopin->cq_req_sn != qp->cqe_exp_seq_sn)break ; -if (unlikely (test_bit (ISCSI_SUSPEND_BIT , &conn->suspend_rx))) +if (unlikely (test_bit (ISCSI_SUSPEND_BIT , &conn->suspend_rx))) { +if (nopin->op_code ==ISCSI_OP_NOOP_IN && + nopin->itt == (u16 )RESERVED_ITT ) { +printk (KERN_ALERT "bnx2i: Unsolicited " +"NOP-In detected for suspended " +"connection dev=%s!\n" , + bnx2i_conn->hba->netdev->name); +bnx2i_unsol_pdu_adjust_rq (bnx2i_conn); + goto cqe_out; + }break ; - + } tgt_async_msg =0 ;switch (nopin->op_code) {
@@ -1770,10 +1778,9 @@ static void bnx2i_process_new_cqes(struct bnx2i_conn *bnx2i_conn)printk (KERN_ALERT "bnx2i: unknown opcode 0x%x\n" , nopin->op_code); } -if (!tgt_async_msg) bnx2i_conn->ep->num_active_cmds--; - +cqe_out:/* clear out in production version only, till beta keep opcode * field intact, will be helpful in debugging (context dump) * nopin->op_code = 0;
Signature · 1 line
1.7.0.5
PATCH 2/16 BNX2I: Added fix for NOP-Out response panic from unsolicited NOP-In
In reply to a message not in the archiveThe patch fixes the following situations where NOP-Out pkt is called for:
- local unsolicited NOP-Out requests (requesting no NOP-In response)
- local NOP-Out responses to unsolicited NOP-In requests
kernel panic is observed due to double session spin_lock requests; one in the bnx2i_process_nopin_local_cmpl routine in bnx2i_hwi.c and the other in the iscsi_put_task routine in libiscsi.c
The proposed fix is to export the currently static __iscsi_put_task() routine and have bnx2i call it directly instead of the iscsi_put_task() routine which holds the session spin lock.
--- drivers/scsi/bnx2i/bnx2i_hwi.c | 2 +- drivers/scsi/libiscsi.c | 3 ++- include/scsi/libiscsi.h | 1 + 3 files changed, 4 insertions(+), 2 deletions(-)
drivers/scsi/bnx2i/bnx2i_hwi.c +1 -1
@@ -1513,7 +1513,7 @@ static void bnx2i_process_nopin_local_cmpl(struct iscsi_session *session, task =iscsi_itt_to_task (conn, nop_in->itt &ISCSI_NOP_IN_MSG_INDEX );if (task) -iscsi_put_task (task); +__iscsi_put_task (task);spin_unlock (&session->lock); }
drivers/scsi/libiscsi.c +2 -1
@@ -539,11 +539,12 @@ void __iscsi_get_task(struct iscsi_task *task) }EXPORT_SYMBOL_GPL (__iscsi_get_task); -static void __iscsi_put_task (struct iscsi_task *task) +void __iscsi_put_task (struct iscsi_task *task) {if (atomic_dec_and_test (&task->refcount))iscsi_free_task (task); } +EXPORT_SYMBOL_GPL (__iscsi_put_task);void iscsi_put_task (struct iscsi_task *task) {
include/scsi/libiscsi.h +1 -0
@@ -420,6 +420,7 @@ extern struct iscsi_task *iscsi_itt_to_ctask(struct iscsi_conn *, itt_t);extern struct iscsi_task *iscsi_itt_to_task (struct iscsi_conn *,itt_t );extern void iscsi_requeue_task (struct iscsi_task *task);extern void iscsi_put_task (struct iscsi_task *task); +extern void __iscsi_put_task (struct iscsi_task *task);extern void __iscsi_get_task (struct iscsi_task *task);extern void iscsi_complete_scsi_task (struct iscsi_task *task,uint32_t exp_cmdsn,uint32_t max_cmdsn);
Signature · 1 line
1.7.0.5
PATCH 3/16 BNX2I: Fixed the endian bug in the TMF LUN cmd send
In reply to a message not in the archiveAdded a be32_to_cpu call for the TMF LUN wqe.
--- drivers/scsi/bnx2i/bnx2i_hwi.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
drivers/scsi/bnx2i/bnx2i_hwi.c +5 -1
@@ -385,6 +385,7 @@ int bnx2i_send_iscsi_tmf(struct bnx2i_conn *bnx2i_conn,struct bnx2i_cmd *bnx2i_cmd;struct bnx2i_tmf_request *tmfabort_wqe;u32 dword; +__be32 scsi_lun[2 ]; bnx2i_cmd = (struct bnx2i_cmd *)mtask->dd_data; tmfabort_hdr = (struct iscsi_tm *)mtask->hdr;
@@ -426,7 +427,10 @@ int bnx2i_send_iscsi_tmf(struct bnx2i_conn *bnx2i_conn,default : tmfabort_wqe->ref_itt =RESERVED_ITT ; } -memcpy (tmfabort_wqe->lun, tmfabort_hdr->lun,sizeof (struct scsi_lun )); +memcpy (scsi_lun, tmfabort_hdr->lun,sizeof (struct scsi_lun )); + tmfabort_wqe->lun[0 ] =be32_to_cpu (scsi_lun[0 ]); + tmfabort_wqe->lun[1 ] =be32_to_cpu (scsi_lun[1 ]); + tmfabort_wqe->ref_cmd_sn =be32_to_cpu (tmfabort_hdr->refcmdsn); tmfabort_wqe->bd_list_addr_lo = (u32 ) bnx2i_conn->hba->mp_bd_dma;
Signature · 1 line
1.7.0.5
PATCH 4/16 BNX2I: Updated the handling of NETEVENTs to alleviate recovery
In reply to a message not in the archiveThe NETDEV_GOING_DOWN handling will no longer request to put all active sessions into recovery mode until the NETDEV_DOWN event. This will eliminate the unnecessary recovery request to iscsid in the NETDEV_GOING_DOWN->NETDEV_UNREGISTER path which will remove the host anyway.
--- drivers/scsi/bnx2i/bnx2i.h | 3 ++ drivers/scsi/bnx2i/bnx2i_hwi.c | 53 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 53 insertions(+), 3 deletions(-)
drivers/scsi/bnx2i/bnx2i.h +3 -0
@@ -227,6 +227,7 @@ struct bnx2i_cmd {* @gen_pdu: login/nopout/logout pdu resources * @violation_notified: bit mask used to track iscsi error/warning messages * already printed out +* @prev_sess_state: tracks the previous connection state * * iSCSI connection structure */
@@ -250,6 +251,8 @@ struct bnx2i_conn {*/ struct generic_pdu_resc gen_pdu;u64 violation_notified; + +int prev_sess_state; };
drivers/scsi/bnx2i/bnx2i_hwi.c +50 -3
69 lines not on this page · raw message
Signature · 1 line
1.7.0.5
Re: [PATCH 04/16] BNX2I: Updated the handling of NETEVENTs to alleviate recovery
Quoted 7 lines · Eddie Wai
case
NETDEV_GOING_DOWN:drivers/scsi/bnx2i/bnx2i_hwi.c +3
-3-set_bit (ADAPTER_STATE_GOING_DOWN ,&hba->adapter_state); -iscsi_host_for_each_session (hba->shost, - bnx2i_drop_session); +/* Suspend all data transmissions */ +for (i =0 ; i< hba->max_active_conns; i++) { + bnx2i_conn =bnx2i_get_conn_from_id (hba, i);
drivers/scsi/bnx2i/bnx2i_hwi.c static void bnx2i_indicate_netevent(void *context, unsigned long event)
Quoted 10 lines
drivers/scsi/bnx2i/bnx2i_hwi.c +10
-0+if (bnx2i_conn) { + conn = bnx2i_conn->cls_conn->dd_data; + session = conn->session; +spin_lock_irqsave (&session->lock, flags); + bnx2i_conn->prev_sess_state = session->state; +if (conn->stop_stage ==0 ) + session->state =ISCSI_STATE_FAILED ; +spin_unlock_irqrestore (&session->lock, flags); +iscsi_suspend_queue (conn); +set_bit (ISCSI_SUSPEND_BIT ,&conn->suspend_rx);
How do you go from going down to down? What happens (does net layer shutdown connections running and have the net driver clean something up)? How long does it take?
You should not be digging into the session state and conn stop_stage and probably the suspend_rx bit.
Add some libiscsi function that just calls something like iscsi_conn_failure that does not initiate recovery. So basically just mv everything but the iscsi_conn_error_event call in iscsi_conn_failure to some new function iscsi_conn_suspend. Have iscsi_conn_failure call iscsi_conn_suspend and iscsi_conn_error_event, and then have your driver call iscsi_conn_suspend.
Re: [PATCH 04/16] BNX2I: Updated the handling of NETEVENTs to alleviate recovery
Quoted 15 lines · Mike Christie
Quoted 14 lines · Eddie Wai
case
NETDEV_GOING_DOWN:drivers/scsi/bnx2i/bnx2i_hwi.c +10
-3-set_bit (ADAPTER_STATE_GOING_DOWN ,&hba->adapter_state); -iscsi_host_for_each_session (hba->shost, - bnx2i_drop_session); +/* Suspend all data transmissions */ +for (i =0 ; i< hba->max_active_conns; i++) { + bnx2i_conn =bnx2i_get_conn_from_id (hba, i); +if (bnx2i_conn) { + conn = bnx2i_conn->cls_conn->dd_data; + session = conn->session; +spin_lock_irqsave (&session->lock, flags); + bnx2i_conn->prev_sess_state = session->state; +if (conn->stop_stage ==0 ) + session->state =ISCSI_STATE_FAILED ;
Quoted 8 lines
drivers/scsi/bnx2i/bnx2i_hwi.c static void bnx2i_indicate_netevent(void *context, unsigned long event)
Quoted 3 lines
drivers/scsi/bnx2i/bnx2i_hwi.c +3
-0+spin_unlock_irqrestore (&session->lock, flags); +iscsi_suspend_queue (conn); +set_bit (ISCSI_SUSPEND_BIT ,&conn->suspend_rx);How do you go from going down to down? What happens (does net layer shutdown connections running and have the net driver clean something up)? How long does it take?
All upper layer clean up will be conducted in another code path from the net layer via cnic. This will do the actual iSCSI connection cleanup.
Quoted 10 lines
You should not be digging into the session state and conn
stop_stageand probably thesuspend_rxbit.Add some libiscsi function that just calls something like
iscsi_conn_failurethat does not initiate recovery. So basically just mv everything but theiscsi_conn_error_eventcall iniscsi_conn_failureto some new functioniscsi_conn_suspend. Haveiscsi_conn_failurecalliscsi_conn_suspendandiscsi_conn_error_event, and then have your driver calliscsi_conn_suspend.
Agreed. Modifying the iscsi_conn_failure is a better solution. We'll defer this change for now.
Thanks,
Eddie
Re: [PATCH 04/16] BNX2I: Updated the handling of NETEVENTs to alleviate recovery
In reply to Mike ChristieQuoted 15 lines · Mike Christie
Quoted 14 lines · Eddie Wai
case
NETDEV_GOING_DOWN:drivers/scsi/bnx2i/bnx2i_hwi.c +10
-3-set_bit (ADAPTER_STATE_GOING_DOWN ,&hba->adapter_state); -iscsi_host_for_each_session (hba->shost, - bnx2i_drop_session); +/* Suspend all data transmissions */ +for (i =0 ; i< hba->max_active_conns; i++) { + bnx2i_conn =bnx2i_get_conn_from_id (hba, i); +if (bnx2i_conn) { + conn = bnx2i_conn->cls_conn->dd_data; + session = conn->session; +spin_lock_irqsave (&session->lock, flags); + bnx2i_conn->prev_sess_state = session->state; +if (conn->stop_stage ==0 ) + session->state =ISCSI_STATE_FAILED ;
Quoted 8 lines
drivers/scsi/bnx2i/bnx2i_hwi.c static void bnx2i_indicate_netevent(void *context, unsigned long event)
Quoted 3 lines
drivers/scsi/bnx2i/bnx2i_hwi.c +3
-0+spin_unlock_irqrestore (&session->lock, flags); +iscsi_suspend_queue (conn); +set_bit (ISCSI_SUSPEND_BIT ,&conn->suspend_rx);How do you go from going down to down? What happens (does net layer shutdown connections running and have the net driver clean something up)? How long does it take?
net layer will just stop transmitting on devices that are down. But with iSCSI connections offloaded to our chips, these connections must be terminated and deleted before the net driver resets the chip. Otherwise, the chip won't come up correctly after reset.
Quoted 11 lines
You should not be digging into the session state and conn
stop_stageand probably thesuspend_rxbit.Add some libiscsi function that just calls something like
iscsi_conn_failurethat does not initiate recovery. So basically just mv everything but theiscsi_conn_error_eventcall iniscsi_conn_failureto some new functioniscsi_conn_suspend. Haveiscsi_conn_failurecalliscsi_conn_suspendandiscsi_conn_error_event, and then have your driver calliscsi_conn_suspend.
PATCH 5/16 BNX2I: Modified the bnx2i stop path to compensate for in progress ops
In reply to a message not in the archiveThe stop path has been augmented to wait a max of 10s for all in progress offload and destroy activities to complete before proceeding to terminate all active connections (via iscsid or forcefully).
Note that any new offload and destroy requests are now blocked and return to the caller immediately.
--- drivers/scsi/bnx2i/bnx2i_init.c | 21 +++++++++++++++++---- drivers/scsi/bnx2i/bnx2i_iscsi.c | 7 ++++++- 2 files changed, 23 insertions(+), 5 deletions(-)
drivers/scsi/bnx2i/bnx2i_init.c +17 -4
@@ -211,13 +211,24 @@ void bnx2i_stop(void *handle) {struct bnx2i_hba *hba = handle;int conns_active; +int wait_delay =1 *HZ ;/* check if cleanup happened in GOING_DOWN context */ -if (!test_and_clear_bit (ADAPTER_STATE_GOING_DOWN , - &hba->adapter_state)) +if (!test_and_set_bit (ADAPTER_STATE_GOING_DOWN , + &hba->adapter_state)) {iscsi_host_for_each_session (hba->shost, bnx2i_drop_session); - + wait_delay = hba->hba_shutdown_tmo; + } +/* Wait for inflight offload connection tasks to complete before +* proceeding. Forcefully terminate all connection recovery in +* progress at the earliest, either in bind(), send_pdu(LOGIN), +* or conn_start() +*/ +wait_event_interruptible_timeout (hba->eh_wait, + (list_empty (&hba->ep_ofld_list) && +list_empty (&hba->ep_destroy_list)), +10 *HZ );/* Wait for all endpoints to be torn down, Chip will be reset once * control returns to network driver. So it is required to cleanup and * release all connection resources before returning from this routine.
@@ -226,7 +237,7 @@ void bnx2i_stop(void *handle) conns_active = hba->ofld_conns_active;wait_event_interruptible_timeout (hba->eh_wait, (hba->ofld_conns_active != conns_active), - hba->hba_shutdown_tmo); + wait_delay);if (hba->ofld_conns_active == conns_active)break ; }
@@ -235,9 +246,11 @@ void bnx2i_stop(void *handle)/* This flag should be cleared last so that ep_disconnect() gracefully * cleans up connection context */ +clear_bit (ADAPTER_STATE_GOING_DOWN , &hba->adapter_state);clear_bit (ADAPTER_STATE_UP , &hba->adapter_state); } +/** * bnx2i_register_device - register bnx2i adapter instance with the cnic driver * @hba: Adapter instance to register
drivers/scsi/bnx2i/bnx2i_iscsi.c +6 -1
@@ -1383,6 +1383,12 @@ static int bnx2i_conn_bind(struct iscsi_cls_session *cls_session, ep =iscsi_lookup_endpoint (transport_fd);if (!ep)return -EINVAL ; +/* +* Forcefully terminate all in progress connection recovery at the +* earliest, either in bind(), send_pdu(LOGIN), or conn_start() +*/ +if (bnx2i_adapter_ready (hba)) +return -EIO ; bnx2i_ep = ep->dd_data; if ((bnx2i_ep->state == EP_STATE_TCP_FIN_RCVD) ||
@@ -1404,7 +1410,6 @@ static int bnx2i_conn_bind(struct iscsi_cls_session *cls_session, hba->netdev->name);return -EEXIST ; } - bnx2i_ep->conn = bnx2i_conn; bnx2i_conn->ep = bnx2i_ep; bnx2i_conn->iscsi_conn_cid = bnx2i_ep->ep_iscsi_cid;
Signature · 1 line
1.7.0.5
PATCH 6/16 BNX2I: Added code to handle the binding of an existing connection
In reply to a message not in the archiveThis is the case when iscsid gets re-launched due to features like iSCSI boot which requires the daemon to re-launch due to pivot root. If the code detected the connection had an existing endpoint, the old endpoint must get cleaned up.
--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
drivers/scsi/bnx2i/bnx2i_iscsi.c +7 -0
@@ -1410,6 +1410,13 @@ static int bnx2i_conn_bind(struct iscsi_cls_session *cls_session, hba->netdev->name);return -EEXIST ; } +if (bnx2i_conn->ep) { +printk (KERN_ALERT "bnx2i: Binding to an existing endpoint " +"detected. Disconnecting the old...\n" ); +mutex_lock (&hba->net_dev_lock); +bnx2i_hw_ep_disconnect (bnx2i_conn->ep); +mutex_unlock (&hba->net_dev_lock); + } bnx2i_ep->conn = bnx2i_conn; bnx2i_conn->ep = bnx2i_ep; bnx2i_conn->iscsi_conn_cid = bnx2i_ep->ep_iscsi_cid;
Signature · 1 line
1.7.0.5
Re: [PATCH 06/16] BNX2I: Added code to handle the binding of an existing connection
Quoted 19 lines · Eddie Wai
This is the case when iscsid gets re-launched due to features like iSCSI boot which requires the daemon to re-launch due to pivot root. If the code detected the connection had an existing endpoint, the old endpoint must get cleaned up.
Signed-off-by Eddie Wai<[email protected]>--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)drivers/scsi/bnx2i/bnx2i_iscsi.c +0
-0@@ -1410,6 +1410,13 @@ static int bnx2i_conn_bind(struct iscsi_cls_session *cls_session, hba->netdev->name);return -EEXIST ; }
drivers/scsi/bnx2i/bnx2i_iscsi.c static int bnx2i_conn_bind(struct iscsi_cls_session *cls_session, · line 1422
Quoted 10 lines
drivers/scsi/bnx2i/bnx2i_iscsi.c +7
-0+if (bnx2i_conn->ep) { +printk (KERN_ALERT "bnx2i: Binding to an existing endpoint " +"detected. Disconnecting the old...\n" ); +mutex_lock (&hba->net_dev_lock); +bnx2i_hw_ep_disconnect (bnx2i_conn->ep); +mutex_unlock (&hba->net_dev_lock); + } bnx2i_ep->conn = bnx2i_conn; bnx2i_conn->ep = bnx2i_ep; bnx2i_conn->iscsi_conn_cid = bnx2i_ep->ep_iscsi_cid;
Don't you still leak what bnx2i_free_ep frees?
In userspace you should have iscsid/iscsi_sync_session match the iscsi endpoint with the iscsi conn and set transport_ep_handle. ep_disconnect will then get called like normal to clean up the old connection.
Re: [PATCH 06/16] BNX2I: Added code to handle the binding of an existing connection
Quoted 35 lines · Mike Christie
Quoted 30 lines · Eddie Wai
This is the case when iscsid gets re-launched due to features like iSCSI boot which requires the daemon to re-launch due to pivot root. If the code detected the connection had an existing endpoint, the old endpoint must get cleaned up.
Signed-off-by Eddie Wai<[email protected]>---
drivers/scsi/bnx2i/bnx2i_iscsi.c| 7 +++++++1 files changed, 7 insertions(+), 0 deletions(-)drivers/scsi/bnx2i/bnx2i_iscsi.c +7
-0@@ -1410,6 +1410,13 @@ static int bnx2i_conn_bind(struct iscsi_cls_session *cls_session, hba->netdev->name);return -EEXIST ; } +if (bnx2i_conn->ep) { +printk (KERN_ALERT "bnx2i: Binding to an existing endpoint " +"detected. Disconnecting the old...\n" ); +mutex_lock (&hba->net_dev_lock); +bnx2i_hw_ep_disconnect (bnx2i_conn->ep); +mutex_unlock (&hba->net_dev_lock); + } bnx2i_ep->conn = bnx2i_conn; bnx2i_conn->ep = bnx2i_ep;Quoted 1 line
bnx2i_conn->iscsi_conn_cid=bnx2i_ep->ep_iscsi_cid;Don't you still leak what
bnx2i_free_epfrees?
Quoted 4 lines
In userspace you should have iscsid/iscsi_sync_session match the iscsi endpoint with the iscsi conn and set
transport_ep_handle.ep_disconnectwill then get called like normal to clean up the old connection.
I went a different way. In the attached patch we detect the problem when binding and will force a disconnect of the old ep before binding a new one.
Try it out and let me know.
drivers/infiniband/ulp/iser/iscsi_iser.c +6 -6
@@ -331,8 +331,7 @@ iscsi_iser_conn_destroy(struct iscsi_cls_conn *cls_conn)static int iscsi_iser_conn_bind (struct iscsi_cls_session *cls_session, -struct iscsi_cls_conn *cls_conn,uint64_t transport_eph, -int is_leading) +struct iscsi_cls_conn *cls_conn,uint64_t transport_eph) {struct iscsi_conn *conn = cls_conn->dd_data;struct iscsi_iser_conn *iser_conn;
@@ -340,10 +339,6 @@ iscsi_iser_conn_bind(struct iscsi_cls_session *cls_session,struct iscsi_endpoint *ep;int error; - error =iscsi_conn_bind (cls_session, cls_conn, is_leading); -if (error) -return error; -/* the transport ep handle comes from user space so it must be * verified against the global ib connections list */ ep =iscsi_lookup_endpoint (transport_eph);
@@ -352,6 +347,11 @@ iscsi_iser_conn_bind(struct iscsi_cls_session *cls_session, (unsigned long long)transport_eph);return -EINVAL ; } + + error =iscsi_conn_bind (cls_session, cls_conn, ep); +if (error) +return error; + ib_conn = ep->dd_data;/* binds the iSER connection retrieved from the previously
drivers/scsi/be2iscsi/be_iscsi.c +2 -2
@@ -174,7 +174,7 @@ static int beiscsi_bindconn_cid(struct beiscsi_hba *phba,*/ int beiscsi_conn_bind (struct iscsi_cls_session *cls_session,struct iscsi_cls_conn *cls_conn, -u64 transport_fd,int is_leading) +u64 transport_fd) {struct iscsi_conn *conn = cls_conn->dd_data;struct beiscsi_conn *beiscsi_conn = conn->dd_data;
@@ -191,7 +191,7 @@ int beiscsi_conn_bind(struct iscsi_cls_session *cls_session, beiscsi_ep = ep->dd_data; -if (iscsi_conn_bind (cls_session, cls_conn, is_leading)) +if (iscsi_conn_bind (cls_session, cls_conn, ep))return -EINVAL ;if (beiscsi_ep->phba != phba) {
drivers/scsi/be2iscsi/be_iscsi.h +1 -1
@@ -46,7 +46,7 @@ struct iscsi_cls_conn *beiscsi_conn_create(struct iscsi_cls_sessionint beiscsi_conn_bind (struct iscsi_cls_session *cls_session,struct iscsi_cls_conn *cls_conn, -uint64_t transport_fd,int is_leading); +uint64_t transport_fd);int beiscsi_conn_get_param (struct iscsi_cls_conn *cls_conn,enum iscsi_param param,char *buf);
drivers/scsi/bnx2i/bnx2i_iscsi.c +2 -2
@@ -1373,7 +1373,7 @@ free_conn:*/ static int bnx2i_conn_bind (struct iscsi_cls_session *cls_session,struct iscsi_cls_conn *cls_conn, -uint64_t transport_fd,int is_leading) +uint64_t transport_fd) {struct iscsi_conn *conn = cls_conn->dd_data;struct bnx2i_conn *bnx2i_conn = conn->dd_data;
@@ -1399,7 +1399,7 @@ static int bnx2i_conn_bind(struct iscsi_cls_session *cls_session,/* Peer disconnect via' FIN or RST */ return -EINVAL ; -if (iscsi_conn_bind (cls_session, cls_conn, is_leading)) +if (iscsi_conn_bind (cls_session, cls_conn, ep))return -EINVAL ;if (bnx2i_ep->hba != hba) {
drivers/scsi/cxgbi/libcxgbi.c +2 -2
@@ -2264,7 +2264,7 @@ EXPORT_SYMBOL_GPL(cxgbi_create_conn);int cxgbi_bind_conn (struct iscsi_cls_session *cls_session,struct iscsi_cls_conn *cls_conn, -u64 transport_eph,int is_leading) +u64 transport_eph) {struct iscsi_conn *conn = cls_conn->dd_data;struct iscsi_tcp_conn *tcp_conn = conn->dd_data;
@@ -2285,7 +2285,7 @@ int cxgbi_bind_conn(struct iscsi_cls_session *cls_session,if (err <0 )return err; - err =iscsi_conn_bind (cls_session, cls_conn, is_leading); + err =iscsi_conn_bind (cls_session, cls_conn, ep);if (err)return -EINVAL ;
drivers/scsi/cxgbi/libcxgbi.h +1 -1
@@ -718,7 +718,7 @@ int cxgbi_set_conn_param(struct iscsi_cls_conn *,int cxgbi_get_conn_param (struct iscsi_cls_conn *,enum iscsi_param ,char *);struct iscsi_cls_conn *cxgbi_create_conn (struct iscsi_cls_session *,u32 );int cxgbi_bind_conn (struct iscsi_cls_session *, -struct iscsi_cls_conn *,u64 ,int ); +struct iscsi_cls_conn *,u64 );void cxgbi_destroy_session (struct iscsi_cls_session *);struct iscsi_cls_session *cxgbi_create_session (struct iscsi_endpoint *,u16 ,u16 ,u32 );
drivers/scsi/iscsi_tcp.c +2 -3
@@ -651,8 +651,7 @@ free_addr:static int iscsi_sw_tcp_conn_bind (struct iscsi_cls_session *cls_session, -struct iscsi_cls_conn *cls_conn,uint64_t transport_eph, -int is_leading) +struct iscsi_cls_conn *cls_conn,uint64_t transport_eph) {struct Scsi_Host *shost =iscsi_session_to_shost (cls_session);struct iscsi_host *ihost =shost_priv (shost);
@@ -685,7 +684,7 @@ iscsi_sw_tcp_conn_bind(struct iscsi_cls_session *cls_session,if (err) goto free_socket; - err =iscsi_conn_bind (cls_session, cls_conn, is_leading); + err =iscsi_conn_bind (cls_session, cls_conn,NULL );if (err) goto free_socket;
drivers/scsi/libiscsi.c +5 -3
@@ -3137,16 +3137,18 @@ void iscsi_conn_stop(struct iscsi_cls_conn *cls_conn, int flag)EXPORT_SYMBOL_GPL (iscsi_conn_stop);int iscsi_conn_bind (struct iscsi_cls_session *cls_session, -struct iscsi_cls_conn *cls_conn,int is_leading) +struct iscsi_cls_conn *cls_conn, +struct iscsi_endpoint *ep) {struct iscsi_session *session = cls_session->dd_data;struct iscsi_conn *conn = cls_conn->dd_data;spin_lock_bh (&session->lock); -if (is_leading) - session->leadconn = conn; + session->leadconn = conn;spin_unlock_bh (&session->lock); + ep->conn = cls_conn; + cls_conn->ep = ep;/* * Unblock xmitworker(), Login Phase will pass through. */
drivers/scsi/scsi_transport_iscsi.c +26 -12
@@ -975,7 +975,6 @@ iscsi_create_conn(struct iscsi_cls_session *session, int dd_size, uint32_t cid)spin_lock_irqsave (&connlock, flags);list_add (&conn->conn_list, &connlist); - conn->active =1 ;spin_unlock_irqrestore (&connlock, flags);ISCSI_DBG_TRANS_CONN (conn,"Completed conn creation\n" );
@@ -1001,7 +1000,6 @@ int iscsi_destroy_conn(struct iscsi_cls_conn *conn)unsigned long flags;spin_lock_irqsave (&connlock, flags); - conn->active =0 ;list_del (&conn->conn_list);spin_unlock_irqrestore (&connlock, flags);
@@ -1430,6 +1428,26 @@ release_host:return err; } +static int iscsi_if_ep_disconnect (struct iscsi_transport *transport, +u64 ep_handle) +{ +struct iscsi_cls_conn *conn; +struct iscsi_endpoint *ep; + +if (!transport->ep_disconnect) +return -EINVAL ; + + ep =iscsi_lookup_endpoint (ep_handle); +if (!ep) +return -EINVAL ; + conn = ep->conn; + + transport->ep_disconnect (ep); +if (conn) + conn->ep =NULL ; +return 0 ; +} +static int iscsi_if_transport_ep (struct iscsi_transport *transport,struct iscsi_uevent *ev,int msg_type)
@@ -1454,14 +1472,8 @@ iscsi_if_transport_ep(struct iscsi_transport *transport, ev->u.ep_poll.timeout_ms);break ;case ISCSI_UEVENT_TRANSPORT_EP_DISCONNECT : -if (!transport->ep_disconnect) -return -EINVAL ; - - ep =iscsi_lookup_endpoint (ev->u.ep_disconnect.ep_handle); -if (!ep) -return -EINVAL ; - - transport->ep_disconnect (ep); + rc =iscsi_if_ep_disconnect (transport, + ev->u.ep_disconnect.ep_handle);break ; }return rc;
@@ -1609,10 +1621,12 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group) session =iscsi_session_lookup (ev->u.b_conn.sid); conn =iscsi_conn_lookup (ev->u.b_conn.sid, ev->u.b_conn.cid); +if (conn && conn->ep) +iscsi_if_ep_disconnect (transport, conn->ep->id); +if (session && conn) ev->r.retcode = transport->bind_conn (session, conn, - ev->u.b_conn.transport_eph, - ev->u.b_conn.is_leading); + ev->u.b_conn.transport_eph);else err = -EINVAL ;break ;
include/scsi/libiscsi.h +1 -1
@@ -388,7 +388,7 @@ extern void iscsi_conn_teardown(struct iscsi_cls_conn *);extern int iscsi_conn_start (struct iscsi_cls_conn *);extern void iscsi_conn_stop (struct iscsi_cls_conn *,int );extern int iscsi_conn_bind (struct iscsi_cls_session *,struct iscsi_cls_conn *, -int ); +struct iscsi_endpoint *);extern void iscsi_conn_failure (struct iscsi_conn *conn,enum iscsi_err err);extern void iscsi_session_failure (struct iscsi_session *session,enum iscsi_err err);
include/scsi/scsi_transport_iscsi.h +3 -2
@@ -95,7 +95,7 @@ struct iscsi_transport { uint32_t cid);int (*bind_conn) (struct iscsi_cls_session *session,struct iscsi_cls_conn *cls_conn, -uint64_t transport_eph,int is_leading); +uint64_t transport_eph);int (*start_conn) (struct iscsi_cls_conn *conn);void (*stop_conn) (struct iscsi_cls_conn *conn,int flag);void (*destroy_conn) (struct iscsi_cls_conn *conn);
@@ -160,8 +160,8 @@ struct iscsi_cls_conn {void *dd_data;/* LLD private data */ struct iscsi_transport *transport;uint32_t cid;/* connection id */ +struct iscsi_endpoint *ep; -int active;/* must be accessed with the connlock */ struct device dev;/* sysfs transport/container device */ };
@@ -222,6 +222,7 @@ struct iscsi_endpoint {void *dd_data;/* LLD private data */ struct device dev;uint64_t id; +struct iscsi_cls_conn *conn; };/*
Re: [PATCH 06/16] BNX2I: Added code to handle the binding of an existing connection
Quoted 17 lines · Mike Christie
I went a different way. In the attached patch we detect the problem when binding and will force a disconnect of the old ep before binding a new one. Try it out and let me know.
drivers/scsi/iscsi_tcp.c +1
-2@@ -651,8 +651,7 @@ free_addr:static int iscsi_sw_tcp_conn_bind (struct iscsi_cls_session *cls_session, -struct iscsi_cls_conn *cls_conn,uint64_t transport_eph, -int is_leading) +struct iscsi_cls_conn *cls_conn,uint64_t transport_eph) {struct Scsi_Host *shost =iscsi_session_to_shost (cls_session);struct iscsi_host *ihost =shost_priv (shost);
drivers/scsi/iscsi_tcp.c iscsi_sw_tcp_conn_bind(struct iscsi_cls_session *cls_session, · line 687
Quoted 5 lines
drivers/scsi/iscsi_tcp.c +1
-1@@ -685,7 +684,7 @@ iscsi_sw_tcp_conn_bind(struct iscsi_cls_session *cls_session,if (err) goto free_socket; - err =iscsi_conn_bind (cls_session, cls_conn, is_leading); + err =iscsi_conn_bind (cls_session, cls_conn,NULL );
should this be transport_eph instead of NULL?
Quoted 11 lines
drivers/scsi/libiscsi.c +2
-1@@ -3137,16 +3137,18 @@ void iscsi_conn_stop(struct iscsi_cls_conn *cls_conn, int flag)EXPORT_SYMBOL_GPL (iscsi_conn_stop);int iscsi_conn_bind (struct iscsi_cls_session *cls_session, -struct iscsi_cls_conn *cls_conn,int is_leading) +struct iscsi_cls_conn *cls_conn, +struct iscsi_endpoint *ep) {struct iscsi_session *session = cls_session->dd_data;
drivers/scsi/libiscsi.c void iscsi_conn_stop(struct iscsi_cls_conn *cls_conn, int flag) · line 3151
Quoted 10 lines
drivers/scsi/libiscsi.c +3
-2struct iscsi_conn *conn = cls_conn->dd_data;spin_lock_bh (&session->lock); -if (is_leading) - session->leadconn = conn; + session->leadconn = conn;spin_unlock_bh (&session->lock); + ep->conn = cls_conn; + cls_conn->ep = ep;
if not, it doesn't look like ep can be null here...
Quoted 10 lines
include/scsi/libiscsi.h +1
-1@@ -388,7 +388,7 @@ extern void iscsi_conn_teardown(struct iscsi_cls_conn *);extern int iscsi_conn_bind (struct iscsi_cls_session *,struct iscsi_cls_conn *, -int ); +struct iscsi_endpoint *);
include/scsi/scsi_transport_iscsi.h struct iscsi_transport { · line 98
Quoted 5 lines
include/scsi/scsi_transport_iscsi.h +1
-1@@ -95,7 +95,7 @@ struct iscsi_transport { uint32_t cid);int (*bind_conn) (struct iscsi_cls_session *session,struct iscsi_cls_conn *cls_conn, -uint64_t transport_eph,int is_leading); +uint64_t transport_eph);
so we're implicitly casting from u64 to ep pointer? I guess this should be fine.
Or.
Re: [PATCH 06/16] BNX2I: Added code to handle the binding of an existing connection
Quoted 21 lines · Or Gerlitz
Quoted 20 lines · Mike Christie
I went a different way. In the attached patch we detect the problem when binding and will force a disconnect of the old ep before binding a new one. Try it out and let me know.
drivers/scsi/iscsi_tcp.c +1
-2@@ -651,8 +651,7 @@ free_addr:static int iscsi_sw_tcp_conn_bind (struct iscsi_cls_session *cls_session, -struct iscsi_cls_conn *cls_conn,uint64_t transport_eph, -int is_leading) +struct iscsi_cls_conn *cls_conn,uint64_t transport_eph) {struct Scsi_Host *shost =iscsi_session_to_shost (cls_session);struct iscsi_host *ihost =shost_priv (shost);@@ -685,7 +684,7 @@ iscsi_sw_tcp_conn_bind(struct iscsi_cls_session *cls_session,if (err) goto free_socket;
Quoted 4 lines
drivers/scsi/iscsi_tcp.c iscsi_sw_tcp_conn_bind(struct iscsi_cls_session *cls_session, · line 687
Quoted 2 lines
drivers/scsi/iscsi_tcp.c +1
-1- err =iscsi_conn_bind (cls_session, cls_conn, is_leading); + err =iscsi_conn_bind (cls_session, cls_conn,NULL );should this be
transport_ephinstead of NULL?
No. iscsi_tcp does not use the iscsi_endpoint abstraction becuase it actually uses normal old sockets that are created in userspace.
Quoted 20 lines
Quoted 20 lines
drivers/scsi/libiscsi.c +3
-3@@ -3137,16 +3137,18 @@ void iscsi_conn_stop(struct iscsi_cls_conn *cls_conn, int flag)EXPORT_SYMBOL_GPL (iscsi_conn_stop);int iscsi_conn_bind (struct iscsi_cls_session *cls_session, -struct iscsi_cls_conn *cls_conn,int is_leading) +struct iscsi_cls_conn *cls_conn, +struct iscsi_endpoint *ep) {struct iscsi_session *session = cls_session->dd_data;struct iscsi_conn *conn = cls_conn->dd_data;spin_lock_bh (&session->lock); -if (is_leading) - session->leadconn = conn; + session->leadconn = conn;spin_unlock_bh (&session->lock);
Quoted 4 lines
drivers/scsi/libiscsi.c void iscsi_conn_stop(struct iscsi_cls_conn *cls_conn, int flag) · line 3151
Quoted 2 lines
drivers/scsi/libiscsi.c +2
-0+ ep->conn = cls_conn; + cls_conn->ep = ep;if not, it doesn't look like ep can be null here...
Will fix. Tested offload and did not test software iscsi.
Quoted 9 lines
Quoted 8 lines
include/scsi/libiscsi.h +1
-1@@ -388,7 +388,7 @@ extern void iscsi_conn_teardown(struct iscsi_cls_conn *);extern int iscsi_conn_bind (struct iscsi_cls_session *,struct iscsi_cls_conn *, -int ); +struct iscsi_endpoint *);
Quoted 11 lines
include/scsi/scsi_transport_iscsi.h struct iscsi_transport { · line 98
Quoted 8 lines
include/scsi/scsi_transport_iscsi.h +1
-1@@ -95,7 +95,7 @@ struct iscsi_transport { uint32_t cid);int (*bind_conn) (struct iscsi_cls_session *session,struct iscsi_cls_conn *cls_conn, -uint64_t transport_eph,int is_leading); +uint64_t transport_eph);so we're implicitly casting from u64 to ep pointer? I guess this should be fine.
No. The transport->bind_conn takes the u64 id. The driver then looks that up and passes iscsi_bind_conn a pointer to the ep struct.
PATCH 7/16 BNX2I: Fixed the remote TCP RST handling for the 570X (1g)
In reply to a message not in the archiveModified the handling of the remote TCP RST code so the chip can now flush the tx pipe accordingly upon a remote TCP RST reception.
--- drivers/scsi/bnx2i/bnx2i_hwi.c | 11 ++++++++--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 8 +++----- 2 files changed, 11 insertions(+), 8 deletions(-)
drivers/scsi/bnx2i/bnx2i_hwi.c +8 -3
@@ -2380,12 +2380,17 @@ static void bnx2i_cm_abort_cmpl(struct cnic_sock *cm_sk)static void bnx2i_cm_remote_close (struct cnic_sock *cm_sk) {struct bnx2i_endpoint *ep = (struct bnx2i_endpoint *) cm_sk->context; +u32 old_state = ep->state; - ep->state =EP_STATE_TCP_FIN_RCVD ; -if (ep->conn) -bnx2i_recovery_que_add_conn (ep->hba, ep->conn); + ep->state =EP_STATE_TCP_RST_RCVD ; +if (old_state ==EP_STATE_DISCONN_START ) +wake_up_interruptible (&ep->ofld_wait); +else +if (ep->conn) +bnx2i_recovery_que_add_conn (ep->hba, ep->conn); } +/** * bnx2i_cm_remote_abort - process TCP RST and start conn cleanup * @hba: adapter structure pointer
drivers/scsi/bnx2i/bnx2i_iscsi.c +3 -5
@@ -1911,6 +1911,7 @@ static int bnx2i_ep_tcp_conn_active(struct bnx2i_endpoint *bnx2i_ep)switch (bnx2i_ep->state) {case EP_STATE_CONNECT_START : +case EP_STATE_CONNECT_FAILED :case EP_STATE_CLEANUP_FAILED :case EP_STATE_OFLD_FAILED :case EP_STATE_DISCONN_TIMEDOUT :
@@ -1926,13 +1927,10 @@ static int bnx2i_ep_tcp_conn_active(struct bnx2i_endpoint *bnx2i_ep) ret =1 ;break ;case EP_STATE_TCP_RST_RCVD : - ret =0 ; -break ; -case EP_STATE_CONNECT_FAILED :if (cnic_dev_10g) - ret =1 ; -else ret =0 ; +else + ret =1 ;break ;default : ret =0 ;
Signature · 1 line
1.7.0.5
PATCH 9/16 BNX2I: Removed the dynamic registration of CNIC
In reply to a message not in the archiveThe code no longer needs to dynamically register and unregister the CNIC device. The CNIC device will be kept registered until module unload.
--- drivers/scsi/bnx2i/bnx2i.h | 3 - drivers/scsi/bnx2i/bnx2i_init.c | 82 -------------------------------------- drivers/scsi/bnx2i/bnx2i_iscsi.c | 9 +---- 3 files changed, 1 insertions(+), 93 deletions(-)
drivers/scsi/bnx2i/bnx2i.h +0 -3
@@ -720,14 +720,11 @@ extern struct device_attribute *bnx2i_dev_attributes[];* Function Prototypes */ extern void bnx2i_identify_device (struct bnx2i_hba *hba); -extern void bnx2i_register_device (struct bnx2i_hba *hba);extern void bnx2i_ulp_init (struct cnic_dev *dev);extern void bnx2i_ulp_exit (struct cnic_dev *dev);extern void bnx2i_start (void *handle);extern void bnx2i_stop (void *handle); -extern void bnx2i_reg_dev_all (void ); -extern void bnx2i_unreg_dev_all (void );extern struct bnx2i_hba *get_adapter_list_head (void ); struct bnx2i_conn *bnx2i_get_conn_from_id(struct bnx2i_hba *hba,
drivers/scsi/bnx2i/bnx2i_init.c +0 -82
94 lines not on this page · raw message
drivers/scsi/bnx2i/bnx2i_iscsi.c +1 -8
@@ -1620,8 +1620,6 @@ static struct bnx2i_hba *bnx2i_check_route(struct sockaddr *dst_addr)struct bnx2i_hba *hba;struct cnic_dev *cnic =NULL ; -bnx2i_reg_dev_all (); - hba =get_adapter_list_head ();if (hba && hba->cnic) cnic = hba->cnic->cm_select_dev (desti,CNIC_ULP_ISCSI );
@@ -1732,8 +1730,6 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost,if (shost) {/* driver is given scsi host to work with */ hba =iscsi_host_priv (shost); -/* Register the device with cnic if not already done so */ -bnx2i_register_device (hba); }else /* * check if the given destination can be reached through
@@ -1859,7 +1855,6 @@ qp_resc_err: check_busy:mutex_unlock (&hba->net_dev_lock); nohba: -bnx2i_unreg_dev_all ();return ERR_PTR (rc); }
@@ -2095,9 +2090,7 @@ return_bnx2i_ep:bnx2i_free_ep (ep);mutex_unlock (&hba->net_dev_lock); -if (!hba->ofld_conns_active) -bnx2i_unreg_dev_all (); - +wake_up_interruptible (&hba->eh_wait); }
Signature · 1 line
1.7.0.5
Re: [PATCH 09/16] BNX2I: Removed the dynamic registration of CNIC
Quoted 4 lines · Eddie Wai
The code no longer needs to dynamically register and unregister the CNIC device. The CNIC device will be kept registered until module unload.
trailing whitespace in the patch.
PATCH 11/16 BNX2I: Added return code check for chip kwqe submission request
In reply to a message not in the archiveAdded the handling for cases when a chip request is made to the CNIC module but the hardware is not ready to accept. This would lead to many unnecessary wait timeouts.
This code adds check in the connect establishment and destruction path.
--- drivers/scsi/bnx2i/bnx2i.h | 9 +++--- drivers/scsi/bnx2i/bnx2i_hwi.c | 54 ++++++++++++++++++++++++++++---------- drivers/scsi/bnx2i/bnx2i_iscsi.c | 17 ++++++++++- 3 files changed, 60 insertions(+), 20 deletions(-)
drivers/scsi/bnx2i/bnx2i.h +5 -4
@@ -652,6 +652,7 @@ enum {EP_STATE_OFLD_FAILED =0x8000000 ,EP_STATE_CONNECT_FAILED =0x10000000 ,EP_STATE_DISCONN_TIMEDOUT =0x20000000 , + EP_STATE_OFLD_FAILED_CID_BUSY = 0x80000000, };/**
@@ -761,11 +762,11 @@ extern int bnx2i_send_iscsi_logout(struct bnx2i_conn *conn, struct iscsi_task *mtask);extern void bnx2i_send_cmd_cleanup_req (struct bnx2i_hba *hba,struct bnx2i_cmd *cmd); -extern void bnx2i_send_conn_ofld_req (struct bnx2i_hba *hba, -struct bnx2i_endpoint *ep); -extern void bnx2i_update_iscsi_conn (struct iscsi_conn *conn); -extern void bnx2i_send_conn_destroy (struct bnx2i_hba *hba, +extern int bnx2i_send_conn_ofld_req (struct bnx2i_hba *hba,struct bnx2i_endpoint *ep); +extern void bnx2i_update_iscsi_conn (struct iscsi_conn *conn); +extern int bnx2i_send_conn_destroy (struct bnx2i_hba *hba, +struct bnx2i_endpoint *ep);extern int bnx2i_alloc_qp_resc (struct bnx2i_hba *hba,struct bnx2i_endpoint *ep);
drivers/scsi/bnx2i/bnx2i_hwi.c +40 -14
122 lines not on this page · raw message
drivers/scsi/bnx2i/bnx2i_iscsi.c +15 -2
@@ -1691,7 +1691,9 @@ static int bnx2i_tear_down_conn(struct bnx2i_hba *hba,bnx2i_ep_destroy_list_add (hba, ep);/* destroy iSCSI context, wait for it to complete */ -bnx2i_send_conn_destroy (hba, ep); +if (bnx2i_send_conn_destroy (hba, ep)) + ep->state =EP_STATE_CLEANUP_CMPL ; +wait_event_interruptible (ep->ofld_wait, (ep->state !=EP_STATE_CLEANUP_START ));
@@ -1790,7 +1792,18 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost, bnx2i_ep->ofld_timer.data = (unsigned long ) bnx2i_ep;add_timer (&bnx2i_ep->ofld_timer); -bnx2i_send_conn_ofld_req (hba, bnx2i_ep); +if (bnx2i_send_conn_ofld_req (hba, bnx2i_ep)) { +if (bnx2i_ep->state ==EP_STATE_OFLD_FAILED_CID_BUSY ) { +printk (KERN_ALERT "bnx2i (%s): iscsi cid %d is busy\n" , + hba->netdev->name, bnx2i_ep->ep_iscsi_cid); + rc = -EBUSY ; + }else + rc = -ENOSPC ; +printk (KERN_ALERT "bnx2i (%s): unable to send conn offld kwqe" +"\n" , hba->netdev->name); +bnx2i_ep_ofld_list_del (hba, bnx2i_ep); + goto conn_failed; + }/* Wait for CNIC hardware to setup conn context and return 'cid' */ wait_event_interruptible(bnx2i_ep->ofld_wait,
Signature · 1 line
1.7.0.5
PATCH 12/16 BNX2I: Added feature to silently drop NOPOUT request
In reply to a message not in the archiveIn the case the chip is undergoing different invasive operation which requires a chip reset, all NOPOUT request during this period must be silently dropped from queuing to the hardware. This patch will respond to libiscsi immediately with sent success. Since the request was not actually sent, the NOPIN wait timeout will get triggered and another NOPOUT request will commence through the proper channel.
--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-)
drivers/scsi/bnx2i/bnx2i_iscsi.c +16 -0
@@ -1068,6 +1068,22 @@ static int bnx2i_iscsi_send_generic_request(struct iscsi_task *task)char *buf;int data_len; +/* +* Forcefully terminate all in progress connection recovery at the +* earliest, either in bind(), send_pdu(LOGIN), or conn_start() +*/ +if (bnx2i_adapter_ready (bnx2i_conn->ep->hba)) { +if ((task->hdr->opcode &ISCSI_OPCODE_MASK ) == +ISCSI_OP_NOOP_OUT ) +/* This is a WA to indicate to libiscsi that the nopout +* request was sent successfully without actually +* submitting to the hardware. +* Just silently drop the nopout request +*/ +return 0 ; +else +return -EIO ; + }bnx2i_iscsi_prep_generic_pdu_bd (bnx2i_conn);switch (task->hdr->opcode &ISCSI_OPCODE_MASK ) {case ISCSI_OP_LOGIN :
Signature · 1 line
1.7.0.5
Re: [PATCH 12/16] BNX2I: Added feature to silently drop NOPOUT request
Quoted 2 lines · Eddie Wai
In the case the chip is undergoing different invasive operation which requires a chip reset, all NOPOUT request during this period
For these invasive operations that reset the chip, do we always end up having to relogin the connection/session or once the reset is done are we able to just go on happily like nothing ever happened?
Quoted 39 lines
must be silently dropped from queuing to the hardware. This patch will respond to libiscsi immediately with sent success. Since the request was not actually sent, the NOPIN wait timeout will get triggered and another NOPOUT request will commence through the proper channel.
Signed-off-by Eddie Wai<[email protected]>--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-)drivers/scsi/bnx2i/bnx2i_iscsi.c +16
-0@@ -1068,6 +1068,22 @@ static int bnx2i_iscsi_send_generic_request(struct iscsi_task *task)char *buf;int data_len; +/* +* Forcefully terminate all in progress connection recovery at the +* earliest, either in bind(), send_pdu(LOGIN), or conn_start() +*/ +if (bnx2i_adapter_ready (bnx2i_conn->ep->hba)) { +if ((task->hdr->opcode&ISCSI_OPCODE_MASK ) == +ISCSI_OP_NOOP_OUT ) +/* This is a WA to indicate to libiscsi that the nopout +* request was sent successfully without actually +* submitting to the hardware. +* Just silently drop the nopout request +*/ +return 0 ; +else +return -EIO ; + }bnx2i_iscsi_prep_generic_pdu_bd (bnx2i_conn);switch (task->hdr->opcode&ISCSI_OPCODE_MASK ) {case ISCSI_OP_LOGIN :
Re: [PATCH 12/16] BNX2I: Added feature to silently drop NOPOUT request
Quoted 7 lines · Mike Christie
Quoted 2 lines · Eddie Wai
In the case the chip is undergoing different invasive operation which requires a chip reset, all NOPOUT request during this period
For these invasive operations that reset the chip, do we always end up having to relogin the connection/session or once the reset is done are we able to just go on happily like nothing ever happened?
Operations like mtu change/ifupdown/etc will require the chip to undergo reset. Prior to this, the connections will be cleaned up via the conn_failure->ep_disconnect path and eventually put into the reopen recovery path. During this period, we must disallow any send pdu requests to be queued to the chip for a more immediately connection tear down time (so we don't have to wait for the pdu's completion).
We had to treat NOPOUT requests differently as the routine in libiscsi would continuously loop until the NOPOUT send request returns with success. This is the why we added the NOPOUT workaround.
Once the chip reset is completed, the ep_connect requests from the recovery path will be honored and the pre-existed connections will get re-established.
Quoted 42 lines
Quoted 40 lines
must be silently dropped from queuing to the hardware. This patch will respond to libiscsi immediately with sent success. Since the request was not actually sent, the NOPIN wait timeout will get triggered and another NOPOUT request will commence through the proper channel.
Signed-off-by Eddie Wai<[email protected]>--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-)drivers/scsi/bnx2i/bnx2i_iscsi.c +16
-0@@ -1068,6 +1068,22 @@ static int bnx2i_iscsi_send_generic_request(struct iscsi_task *task)char *buf;int data_len; +/* +* Forcefully terminate all in progress connection recovery at the +* earliest, either in bind(), send_pdu(LOGIN), or conn_start() +*/ +if (bnx2i_adapter_ready (bnx2i_conn->ep->hba)) { +if ((task->hdr->opcode&ISCSI_OPCODE_MASK ) == +ISCSI_OP_NOOP_OUT ) +/* This is a WA to indicate to libiscsi that the nopout +* request was sent successfully without actually +* submitting to the hardware. +* Just silently drop the nopout request +*/ +return 0 ; +else +return -EIO ; + }bnx2i_iscsi_prep_generic_pdu_bd (bnx2i_conn);switch (task->hdr->opcode&ISCSI_OPCODE_MASK ) {case ISCSI_OP_LOGIN :
Re: [PATCH 12/16] BNX2I: Added feature to silently drop NOPOUT request
Quoted 16 lines · Eddie Wai
Quoted 7 lines · Mike Christie
Quoted 2 lines · Eddie Wai
In the case the chip is undergoing different invasive operation which requires a chip reset, all NOPOUT request during this period
For these invasive operations that reset the chip, do we always end up having to relogin the connection/session or once the reset is done are we able to just go on happily like nothing ever happened?
Operations like mtu change/ifupdown/etc will require the chip to undergo reset. Prior to this, the connections will be cleaned up via the
conn_failure->ep_disconnectpath and eventually put into the reopen recovery path. During this period, we must disallow any send pdu requests to be queued to the chip for a more immediately connection tear down time (so we don't have to wait for the pdu's completion).
Quoted 3 lines
We had to treat NOPOUT requests differently as the routine in libiscsi would continuously loop until the NOPOUT send request returns with success. This is the why we added the NOPOUT workaround.
At this time, have you already called iscsi_conn or session failure? If so then I think it sounds like there is bug in iscsi_send_nopout or __iscsi_conn_send_pdu. If the conn/session has been failed, I think we want to add a check in __iscsi_conn_send_pdu where if the conn/session is down then we do not send NOPs. There is no point iSCSI RFC wise and it screws up drivers.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 12/16] BNX2I: Added feature to silently drop NOPOUT request
Quoted 21 lines · Mike Christie
Quoted 16 lines · Eddie Wai
Quoted 7 lines · Mike Christie
Quoted 2 lines · Eddie Wai
In the case the chip is undergoing different invasive operation which requires a chip reset, all NOPOUT request during this period
For these invasive operations that reset the chip, do we always end up having to relogin the connection/session or once the reset is done are we able to just go on happily like nothing ever happened?
Operations like mtu change/ifupdown/etc will require the chip to undergo reset. Prior to this, the connections will be cleaned up via the
conn_failure->ep_disconnectpath and eventually put into the reopen recovery path. During this period, we must disallow any send pdu requests to be queued to the chip for a more immediately connection tear down time (so we don't have to wait for the pdu's completion).Quoted 3 lines
We had to treat NOPOUT requests differently as the routine in libiscsi would continuously loop until the NOPOUT send request returns with success. This is the why we added the NOPOUT workaround.
Quoted 6 lines
At this time, have you already called
iscsi_connor session failure? If so then I think it sounds like there is bug iniscsi_send_nopoutor__iscsi_conn_send_pdu. If the conn/session has been failed, I think we want to add a check in__iscsi_conn_send_pduwhere if the conn/session is down then we do not send NOPs. There is no point iSCSI RFC wise and it screws up drivers.
We actually have a check in __iscsi_conn_send_pdu. There is the session->state == ISCSI_STATE_LOGGED_IN, so I guess you have not called one of the iscsi failure functions.
At this time, is just the apdater_state getting changed? What code path is that?
Maybe related... For bnx2i_get_link_state ADAPTER_STATE_LINK_DOWN, I think you will want to call the iscsi_suspend_queue function discussed in the other mail. When the link state comes back up though, do we always have to reconnect and relogin to the target or are their cases where we can just restart the queues?
Signature · 4 lines
You received this message because you are subscribed to the Google Groups "open-iscsi" group. To post to this group, send email to open-iscsi-/JYPxA39Uh5TLH3MbocFF+G/[email protected] To unsubscribe from this group, send email to open-iscsi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] For more options, visit this group at http://groups.google.com/group/open-iscsi?hl=en.
Re: [PATCH 12/16] BNX2I: Added feature to silently drop NOPOUT request
Quoted 29 lines · Mike Christie
Quoted 21 lines · Mike Christie
Quoted 16 lines · Eddie Wai
Quoted 7 lines · Mike Christie
Quoted 2 lines · Eddie Wai
In the case the chip is undergoing different invasive operation which requires a chip reset, all NOPOUT request during this period
For these invasive operations that reset the chip, do we always end up having to relogin the connection/session or once the reset is done are we able to just go on happily like nothing ever happened?
Operations like mtu change/ifupdown/etc will require the chip to undergo reset. Prior to this, the connections will be cleaned up via the
conn_failure->ep_disconnectpath and eventually put into the reopen recovery path. During this period, we must disallow any send pdu requests to be queued to the chip for a more immediately connection tear down time (so we don't have to wait for the pdu's completion).Quoted 3 lines
We had to treat NOPOUT requests differently as the routine in libiscsi would continuously loop until the NOPOUT send request returns with success. This is the why we added the NOPOUT workaround.
Quoted 6 lines
At this time, have you already called
iscsi_connor session failure? If so then I think it sounds like there is bug iniscsi_send_nopoutor__iscsi_conn_send_pdu. If the conn/session has been failed, I think we want to add a check in__iscsi_conn_send_pduwhere if the conn/session is down then we do not send NOPs. There is no point iSCSI RFC wise and it screws up drivers.
Quoted 4 lines
We actually have a check in
__iscsi_conn_send_pdu. There is thesession->state==ISCSI_STATE_LOGGED_IN, so I guess you have not called one of the iscsi failure functions.
The check is correct, but its just that the conn failures were not being called prior to these inflight send_pdu calls. We want to terminate these calls immediately before they get queued up to the chip.
As for the NOPOUT requests, since the NOPOUT send request failed, the last_ping jiffies count would not get updated. Then the iscsi_check_transport_timeouts callback will just keeps getting called and stalling the system.
Perhaps a better way to do this is to allow the last_ping jiffies to be updated but use a different ping_timeout value for failed nopout ping conditions.
Quoted 9 lines
At this time, is just the
apdater_stategetting changed? What code path is that?Maybe related... For
bnx2i_get_link_stateADAPTER_STATE_LINK_DOWN, I think you will want to call theiscsi_suspend_queuefunction discussed in the other mail. When the link state comes back up though, do we always have to reconnect and relogin to the target or are their cases where we can just restart the queues?
Re: [PATCH 12/16] BNX2I: Added feature to silently drop NOPOUT request
Quoted 9 lines · Eddie Wai
As for the NOPOUT requests, since the NOPOUT send request failed, the
last_pingjiffies count would not get updated. Then theiscsi_check_transport_timeoutscallback will just keeps getting called and stalling the system.Perhaps a better way to do this is to allow the
last_pingjiffies to be updated but use a differentping_timeoutvalue for failed nopout ping conditions.
If this is a hard error then we can just have xmit_task return a error, and then have iscsi_send_nopout call iscsi_conn_failure for the driver.
Is there any issue with starting the eh process at this time? Would the quicker swing around to ep_disconnect and ep_connect cause problems?
PATCH 13/16 BNX2I: Cleaned up various error conditions in ep_connect/disconnect
In reply to a message not in the archiveVarious error conditions inside ep_connect and ep_disconnect were either not being handled or not being handled correctly. This patch fixes all those issues.
--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 67 ++++++++++++++++++++++--------------- 1 files changed, 40 insertions(+), 27 deletions(-)
drivers/scsi/bnx2i/bnx2i_iscsi.c +40 -27
@@ -411,7 +411,9 @@ static void bnx2i_free_ep(struct iscsi_endpoint *ep) bnx2i_ep->state =EP_STATE_IDLE ; bnx2i_ep->hba->ofld_conns_active--; -bnx2i_free_iscsi_cid (bnx2i_ep->hba, bnx2i_ep->ep_iscsi_cid); +if (bnx2i_ep->ep_iscsi_cid != (u16) -1 ) +bnx2i_free_iscsi_cid (bnx2i_ep->hba, bnx2i_ep->ep_iscsi_cid); +if (bnx2i_ep->conn) { bnx2i_ep->conn->ep =NULL ; bnx2i_ep->conn =NULL ;
@@ -1763,13 +1765,17 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost,*/ hba =bnx2i_check_route (dst_addr); -if (!hba ||test_bit (ADAPTER_STATE_GOING_DOWN , &hba->adapter_state)) { +if (!hba) { rc = -EINVAL ; goto nohba; } +mutex_lock (&hba->net_dev_lock); +if (bnx2i_adapter_ready (hba) || !hba->cid_que.cid_free_cnt) { + rc = -EPERM ; + goto check_busy; + } cnic = hba->cnic; -mutex_lock (&hba->net_dev_lock); ep =bnx2i_alloc_ep (hba);if (!ep) { rc = -ENOMEM ;
@@ -1777,23 +1783,21 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost, } bnx2i_ep = ep->dd_data; -if (bnx2i_adapter_ready (hba)) { - rc = -EPERM ; - goto net_if_down; - } - bnx2i_ep->num_active_cmds =0 ; iscsi_cid =bnx2i_alloc_iscsi_cid (hba);if (iscsi_cid ==-1 ) { -printk (KERN_ALERT "alloc_ep: unable to allocate iscsi cid\n" ); +printk (KERN_ALERT "bnx2i (%s): alloc_ep - unable to allocate " +"iscsi cid\n" , hba->netdev->name); rc = -ENOMEM ; - goto iscsi_cid_err; +bnx2i_free_ep (ep); + goto check_busy; } bnx2i_ep->hba_age = hba->age; rc =bnx2i_alloc_qp_resc (hba, bnx2i_ep);if (rc !=0 ) { -printk (KERN_ALERT "bnx2i: ep_conn, alloc QP resc error\n" ); +printk (KERN_ALERT "bnx2i (%s): ep_conn - alloc QP resc error" +"\n" , hba->netdev->name); rc = -ENOMEM ; goto qp_resc_err; }
@@ -1832,7 +1836,12 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost,bnx2i_ep_ofld_list_del (hba, bnx2i_ep);if (bnx2i_ep->state !=EP_STATE_OFLD_COMPL ) { - rc = -ENOSPC ; +if (bnx2i_ep->state ==EP_STATE_OFLD_FAILED_CID_BUSY ) { +printk (KERN_ALERT "bnx2i (%s): iscsi cid %d is busy\n" , + hba->netdev->name, bnx2i_ep->ep_iscsi_cid); + rc = -EBUSY ; + }else + rc = -ENOSPC ; goto conn_failed; }
@@ -1840,7 +1849,8 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost, iscsi_cid, &bnx2i_ep->cm_sk, bnx2i_ep);if (rc) { rc = -EINVAL ; - goto conn_failed; +/* Need to terminate and cleanup the connection */ + goto release_ep; } bnx2i_ep->cm_sk->rcv_buf =256 *1024 ;
@@ -1884,8 +1894,6 @@ release_ep:return ERR_PTR (rc); } conn_failed: -net_if_down: -iscsi_cid_err:bnx2i_free_qp_resc (hba, bnx2i_ep); qp_resc_err:bnx2i_free_ep (ep);
@@ -2004,7 +2012,8 @@ int bnx2i_hw_ep_disconnect(struct bnx2i_endpoint *bnx2i_ep)if (!cnic)return 0 ; -if (bnx2i_ep->state ==EP_STATE_IDLE ) +if (bnx2i_ep->state ==EP_STATE_IDLE || + bnx2i_ep->state ==EP_STATE_DISCONN_TIMEDOUT )return 0 ;if (!bnx2i_ep_tcp_conn_active (bnx2i_ep))
@@ -2030,9 +2039,10 @@ int bnx2i_hw_ep_disconnect(struct bnx2i_endpoint *bnx2i_ep)if (session->state ==ISCSI_STATE_LOGGING_OUT ) {if (bnx2i_ep->state ==EP_STATE_LOGOUT_SENT ) {/* Logout sent, but no resp */ -printk (KERN_ALERT "bnx2i - WARNING " -"logout response was not " -"received!\n" ); +printk (KERN_ALERT "bnx2i (%s): WARNING" +" logout response was not " +"received!\n" , + bnx2i_ep->hba->netdev->name); }else if (bnx2i_ep->state ==EP_STATE_LOGOUT_RESP_RCVD ) close =1 ;
@@ -2050,9 +2060,8 @@ int bnx2i_hw_ep_disconnect(struct bnx2i_endpoint *bnx2i_ep)else close_ret = cnic->cm_abort (bnx2i_ep->cm_sk); -/* No longer allow CFC delete if cm_close/abort fails the request */ if (close_ret) -printk (KERN_ALERT "bnx2i: %s close/abort(%d) returned %d\n" , +printk (KERN_ALERT "bnx2i (%s): close/abort(%d) returned %d\n" , bnx2i_ep->hba->netdev->name, close, close_ret);else /* wait for option-2 conn teardown */
@@ -2066,7 +2075,7 @@ int bnx2i_hw_ep_disconnect(struct bnx2i_endpoint *bnx2i_ep) destroy_conn:bnx2i_ep_active_list_del (hba, bnx2i_ep);if (bnx2i_tear_down_conn (hba, bnx2i_ep)) - ret = -EINVAL ; +return -EINVAL ; out: bnx2i_ep->state =EP_STATE_IDLE ;return ret;
@@ -2105,14 +2114,17 @@ static void bnx2i_ep_disconnect(struct iscsi_endpoint *ep)mutex_lock (&hba->net_dev_lock); -if (bnx2i_ep->state ==EP_STATE_IDLE ) - goto return_bnx2i_ep; +if (bnx2i_ep->state ==EP_STATE_DISCONN_TIMEDOUT ) + goto out; -if (!test_bit (ADAPTER_STATE_UP , &hba->adapter_state)) +if (bnx2i_ep->state ==EP_STATE_IDLE ) goto free_resc; -if (bnx2i_ep->hba_age != hba->age) +if (!test_bit (ADAPTER_STATE_UP , &hba->adapter_state) || + (bnx2i_ep->hba_age != hba->age)) { +bnx2i_ep_active_list_del (hba, bnx2i_ep); goto free_resc; + }/* Do all chip cleanup here */ if (bnx2i_hw_ep_disconnect (bnx2i_ep)) {
@@ -2121,11 +2133,12 @@ static void bnx2i_ep_disconnect(struct iscsi_endpoint *ep) } free_resc:bnx2i_free_qp_resc (hba, bnx2i_ep); -return_bnx2i_ep: +if (bnx2i_conn) bnx2i_conn->ep =NULL ;bnx2i_free_ep (ep); +out:mutex_unlock (&hba->net_dev_lock);wake_up_interruptible (&hba->eh_wait);
Signature · 1 line
1.7.0.5
PATCH 14/16 BNX2I: Allow to abort the connection if connect request times out
In reply to a message not in the archiveIn the situation where the connect completion response arrives after the connect request has already timed out, the connection was not being aborted but only the resource was being freed. This creates a problem for 5771X (10g) as the chip flags this with an assertion.
This change will properly aborts the connection before freeing the resource.
--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/bnx2i/bnx2i_iscsi.c +1 -1
@@ -1959,13 +1959,13 @@ static int bnx2i_ep_tcp_conn_active(struct bnx2i_endpoint *bnx2i_ep) cnic_dev_10g =1 ;switch (bnx2i_ep->state) { -case EP_STATE_CONNECT_START :case EP_STATE_CONNECT_FAILED :case EP_STATE_CLEANUP_FAILED :case EP_STATE_OFLD_FAILED :case EP_STATE_DISCONN_TIMEDOUT : ret =0 ;break ; +case EP_STATE_CONNECT_START :case EP_STATE_CONNECT_COMPL :case EP_STATE_ULP_UPDATE_START :case EP_STATE_ULP_UPDATE_COMPL :
Signature · 1 line
1.7.0.5
PATCH 15/16 BNX2I: Updated copyright and maintainer info
In reply to a message not in the archive--- drivers/scsi/bnx2i/57xx_iscsi_constants.h | 3 ++- drivers/scsi/bnx2i/57xx_iscsi_hsi.h | 3 ++- drivers/scsi/bnx2i/bnx2i.h | 3 ++- drivers/scsi/bnx2i/bnx2i_hwi.c | 3 ++- drivers/scsi/bnx2i/bnx2i_init.c | 3 ++- drivers/scsi/bnx2i/bnx2i_iscsi.c | 3 ++- drivers/scsi/bnx2i/bnx2i_sysfs.c | 3 ++- 7 files changed, 14 insertions(+), 7 deletions(-)
drivers/scsi/bnx2i/57xx_iscsi_constants.h +2 -1
@@ -1,12 +1,13 @@/* 57xx_iscsi_constants.h: Broadcom NetXtreme II iSCSI HSI * -* Copyright (c) 2006 - 2009 Broadcom Corporation +* Copyright (c) 2006 - 2010 Broadcom Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation. * * Written by: Anil Veerabhadrappa ([email protected]) +* Maintained by: Eddie Wai ([email protected]) */ #ifndef __57XX_ISCSI_CONSTANTS_H_#define __57XX_ISCSI_CONSTANTS_H_
drivers/scsi/bnx2i/57xx_iscsi_hsi.h +2 -1
@@ -1,12 +1,13 @@/* 57xx_iscsi_hsi.h: Broadcom NetXtreme II iSCSI HSI. * -* Copyright (c) 2006 - 2009 Broadcom Corporation +* Copyright (c) 2006 - 2010 Broadcom Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation. * * Written by: Anil Veerabhadrappa ([email protected]) +* Maintained by: Eddie Wai ([email protected]) */ #ifndef __57XX_ISCSI_HSI_LINUX_LE__#define __57XX_ISCSI_HSI_LINUX_LE__
drivers/scsi/bnx2i/bnx2i.h +2 -1
@@ -1,6 +1,6 @@/* bnx2i.h: Broadcom NetXtreme II iSCSI driver. * -* Copyright (c) 2006 - 2009 Broadcom Corporation +* Copyright (c) 2006 - 2010 Broadcom Corporation * Copyright (c) 2007, 2008 Red Hat, Inc. All rights reserved. * Copyright (c) 2007, 2008 Mike Christie *
@@ -9,6 +9,7 @@* the Free Software Foundation. * * Written by: Anil Veerabhadrappa ([email protected]) +* Maintained by: Eddie Wai ([email protected]) */ #ifndef _BNX2I_H_
drivers/scsi/bnx2i/bnx2i_hwi.c +2 -1
@@ -1,6 +1,6 @@/* bnx2i_hwi.c: Broadcom NetXtreme II iSCSI driver. * -* Copyright (c) 2006 - 2009 Broadcom Corporation +* Copyright (c) 2006 - 2010 Broadcom Corporation * Copyright (c) 2007, 2008 Red Hat, Inc. All rights reserved. * Copyright (c) 2007, 2008 Mike Christie *
@@ -9,6 +9,7 @@* the Free Software Foundation. * * Written by: Anil Veerabhadrappa ([email protected]) +* Maintained by: Eddie Wai ([email protected]) */ #include <linux/gfp.h>
drivers/scsi/bnx2i/bnx2i_init.c +2 -1
@@ -1,6 +1,6 @@/* bnx2i.c: Broadcom NetXtreme II iSCSI driver. * -* Copyright (c) 2006 - 2009 Broadcom Corporation +* Copyright (c) 2006 - 2010 Broadcom Corporation * Copyright (c) 2007, 2008 Red Hat, Inc. All rights reserved. * Copyright (c) 2007, 2008 Mike Christie *
@@ -9,6 +9,7 @@* the Free Software Foundation. * * Written by: Anil Veerabhadrappa ([email protected]) +* Maintained by: Eddie Wai ([email protected]) */ #include "bnx2i.h"
drivers/scsi/bnx2i/bnx2i_iscsi.c +2 -1
@@ -1,7 +1,7 @@/* * bnx2i_iscsi.c: Broadcom NetXtreme II iSCSI driver. * -* Copyright (c) 2006 - 2009 Broadcom Corporation +* Copyright (c) 2006 - 2010 Broadcom Corporation * Copyright (c) 2007, 2008 Red Hat, Inc. All rights reserved. * Copyright (c) 2007, 2008 Mike Christie *
@@ -10,6 +10,7 @@* the Free Software Foundation. * * Written by: Anil Veerabhadrappa ([email protected]) +* Maintained by: Eddie Wai ([email protected]) */ #include <linux/slab.h>
drivers/scsi/bnx2i/bnx2i_sysfs.c +2 -1
@@ -1,12 +1,13 @@/* bnx2i_sysfs.c: Broadcom NetXtreme II iSCSI driver. * -* Copyright (c) 2004 - 2009 Broadcom Corporation +* Copyright (c) 2004 - 2010 Broadcom Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation. * * Written by: Anil Veerabhadrappa ([email protected]) +* Maintained by: Eddie Wai ([email protected]) */ #include "bnx2i.h"
Signature · 1 line
1.7.0.5
PATCH 16/16 BNX2I: Updated version to 2.6.2.2
In reply to a message not in the archive--- drivers/scsi/bnx2i/bnx2i_init.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/bnx2i/bnx2i_init.c +2 -2
@@ -18,8 +18,8 @@ static struct list_head adapter_list = LIST_HEAD_INIT(adapter_list);static u32 adapter_count;#define DRV_MODULE_NAME "bnx2i" -#define DRV_MODULE_VERSION "2.1.3" -#define DRV_MODULE_RELDATE "Aug 10, 2010" +#define DRV_MODULE_VERSION "2.6.2.2" +#define DRV_MODULE_RELDATE "Oct 28, 2010"static char version[]__devinitdata ="Broadcom NetXtreme II iSCSI Driver " DRV_MODULE_NAME \
Signature · 1 line
1.7.0.5
PATCH v2 1/14 BNX2I: Fixed bugs in the handling of unsolicited NOP-Ins
In reply to a message not in the archiveUnsolicited NOP-Ins are placed in the receive queue of the hardware which requires to be read out regardless if the receive pipe is suspended or not. This patch adds the disposal of this RQ element under this condition.
Also fixed the bug in the unsolicited NOP-In handling routine which checks for the RESERVED_ITT.
--- drivers/scsi/bnx2i/bnx2i_hwi.c | 23 +++++++++++++++-------- 1 files changed, 15 insertions(+), 8 deletions(-)
drivers/scsi/bnx2i/bnx2i_hwi.c +15 -8
@@ -1549,11 +1549,9 @@ static int bnx2i_process_nopin_mesg(struct iscsi_session *session,struct iscsi_task *task;struct bnx2i_nop_in_msg *nop_in;struct iscsi_nopin *hdr; -u32 itt;int tgt_async_nop =0 ; nop_in = (struct bnx2i_nop_in_msg *)cqe; - itt = nop_in->itt &ISCSI_NOP_IN_MSG_INDEX ;spin_lock (&session->lock); hdr = (struct iscsi_nopin *)&bnx2i_conn->gen_pdu.resp_hdr;
@@ -1563,7 +1561,7 @@ static int bnx2i_process_nopin_mesg(struct iscsi_session *session, hdr->exp_cmdsn =cpu_to_be32 (nop_in->exp_cmd_sn); hdr->ttt =cpu_to_be32 (nop_in->ttt); -if (itt == (u16 )RESERVED_ITT ) { +if (nop_in->itt == (u16 )RESERVED_ITT ) {bnx2i_unsol_pdu_adjust_rq (bnx2i_conn); hdr->itt =RESERVED_ITT ; tgt_async_nop =1 ;
@@ -1571,7 +1569,8 @@ static int bnx2i_process_nopin_mesg(struct iscsi_session *session, }/* this is a response to one of our nop-outs */ - task =iscsi_itt_to_task (conn, itt); + task =iscsi_itt_to_task (conn, + (itt_t) (nop_in->itt &ISCSI_NOP_IN_MSG_INDEX ));if (task) { hdr->flags =ISCSI_FLAG_CMD_FINAL ; hdr->itt = task->hdr->itt;
@@ -1721,9 +1720,18 @@ static void bnx2i_process_new_cqes(struct bnx2i_conn *bnx2i_conn)if (nopin->cq_req_sn != qp->cqe_exp_seq_sn)break ; -if (unlikely (test_bit (ISCSI_SUSPEND_BIT , &conn->suspend_rx))) +if (unlikely (test_bit (ISCSI_SUSPEND_BIT , &conn->suspend_rx))) { +if (nopin->op_code ==ISCSI_OP_NOOP_IN && + nopin->itt == (u16 )RESERVED_ITT ) { +printk (KERN_ALERT "bnx2i: Unsolicited " +"NOP-In detected for suspended " +"connection dev=%s!\n" , + bnx2i_conn->hba->netdev->name); +bnx2i_unsol_pdu_adjust_rq (bnx2i_conn); + goto cqe_out; + }break ; - + } tgt_async_msg =0 ;switch (nopin->op_code) {
@@ -1770,10 +1778,9 @@ static void bnx2i_process_new_cqes(struct bnx2i_conn *bnx2i_conn)printk (KERN_ALERT "bnx2i: unknown opcode 0x%x\n" , nopin->op_code); } -if (!tgt_async_msg) bnx2i_conn->ep->num_active_cmds--; - +cqe_out:/* clear out in production version only, till beta keep opcode * field intact, will be helpful in debugging (context dump) * nopin->op_code = 0;
Signature · 1 line
1.7.0.5
PATCH v2 2/14 BNX2I: Added fix for NOP-Out response panic from unsolicited NOP-In
In reply to a message not in the archiveThe patch fixes the following situations where NOP-Out pkt is called for:
- local unsolicited NOP-Out requests (requesting no NOP-In response)
- local NOP-Out responses to unsolicited NOP-In requests
kernel panic is observed due to double session spin_lock requests; one in the bnx2i_process_nopin_local_cmpl routine in bnx2i_hwi.c and the other in the iscsi_put_task routine in libiscsi.c
The proposed fix is to export the currently static __iscsi_put_task() routine and have bnx2i call it directly instead of the iscsi_put_task() routine which holds the session spin lock.
--- drivers/scsi/bnx2i/bnx2i_hwi.c | 2 +- drivers/scsi/libiscsi.c | 3 ++- include/scsi/libiscsi.h | 1 + 3 files changed, 4 insertions(+), 2 deletions(-)
drivers/scsi/bnx2i/bnx2i_hwi.c +1 -1
@@ -1513,7 +1513,7 @@ static void bnx2i_process_nopin_local_cmpl(struct iscsi_session *session, task =iscsi_itt_to_task (conn, nop_in->itt &ISCSI_NOP_IN_MSG_INDEX );if (task) -iscsi_put_task (task); +__iscsi_put_task (task);spin_unlock (&session->lock); }
drivers/scsi/libiscsi.c +2 -1
@@ -539,11 +539,12 @@ void __iscsi_get_task(struct iscsi_task *task) }EXPORT_SYMBOL_GPL (__iscsi_get_task); -static void __iscsi_put_task (struct iscsi_task *task) +void __iscsi_put_task (struct iscsi_task *task) {if (atomic_dec_and_test (&task->refcount))iscsi_free_task (task); } +EXPORT_SYMBOL_GPL (__iscsi_put_task);void iscsi_put_task (struct iscsi_task *task) {
include/scsi/libiscsi.h +1 -0
@@ -420,6 +420,7 @@ extern struct iscsi_task *iscsi_itt_to_ctask(struct iscsi_conn *, itt_t);extern struct iscsi_task *iscsi_itt_to_task (struct iscsi_conn *,itt_t );extern void iscsi_requeue_task (struct iscsi_task *task);extern void iscsi_put_task (struct iscsi_task *task); +extern void __iscsi_put_task (struct iscsi_task *task);extern void __iscsi_get_task (struct iscsi_task *task);extern void iscsi_complete_scsi_task (struct iscsi_task *task,uint32_t exp_cmdsn,uint32_t max_cmdsn);
Signature · 1 line
1.7.0.5
PATCH v2 3/14 BNX2I: Fixed the endian bug in the TMF LUN cmd send
In reply to a message not in the archiveAdded a be32_to_cpu call for the TMF LUN wqe.
--- drivers/scsi/bnx2i/bnx2i_hwi.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
drivers/scsi/bnx2i/bnx2i_hwi.c +5 -1
@@ -385,6 +385,7 @@ int bnx2i_send_iscsi_tmf(struct bnx2i_conn *bnx2i_conn,struct bnx2i_cmd *bnx2i_cmd;struct bnx2i_tmf_request *tmfabort_wqe;u32 dword; +u32 scsi_lun[2 ]; bnx2i_cmd = (struct bnx2i_cmd *)mtask->dd_data; tmfabort_hdr = (struct iscsi_tm *)mtask->hdr;
@@ -426,7 +427,10 @@ int bnx2i_send_iscsi_tmf(struct bnx2i_conn *bnx2i_conn,default : tmfabort_wqe->ref_itt =RESERVED_ITT ; } -memcpy (tmfabort_wqe->lun, tmfabort_hdr->lun,sizeof (struct scsi_lun )); +memcpy (scsi_lun, tmfabort_hdr->lun,sizeof (struct scsi_lun )); + tmfabort_wqe->lun[0 ] =be32_to_cpu (scsi_lun[0 ]); + tmfabort_wqe->lun[1 ] =be32_to_cpu (scsi_lun[1 ]); + tmfabort_wqe->ref_cmd_sn =be32_to_cpu (tmfabort_hdr->refcmdsn); tmfabort_wqe->bd_list_addr_lo = (u32 ) bnx2i_conn->hba->mp_bd_dma;
Signature · 1 line
1.7.0.5
PATCH v2 4/14 BNX2I: Fixed a cid leak issue for 5771X (10g)
In reply to a message not in the archiveA cid leak issue was found when the connect destroy request exceeded the driver's disconnection timeout. This will lead to a cid resource leak issue.
The fix is to allow the cid cleanup even when this happens.
--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 24 ++++++++++++++++-------- 1 files changed, 16 insertions(+), 8 deletions(-)
drivers/scsi/bnx2i/bnx2i_iscsi.c +16 -8
@@ -1640,18 +1640,26 @@ no_nx2_route:static int bnx2i_tear_down_conn (struct bnx2i_hba *hba,struct bnx2i_endpoint *ep) { -if (test_bit (BNX2I_CNIC_REGISTERED , &hba->reg_with_cnic)) +if (test_bit (BNX2I_CNIC_REGISTERED , &hba->reg_with_cnic) && ep->cm_sk) hba->cnic->cm_destroy (ep->cm_sk); -if (test_bit (ADAPTER_STATE_GOING_DOWN , &ep->hba->adapter_state)) - ep->state =EP_STATE_DISCONN_COMPL ; -if (test_bit (BNX2I_NX2_DEV_57710 , &hba->cnic_dev_type) && ep->state ==EP_STATE_DISCONN_TIMEDOUT ) { -printk (KERN_ALERT "bnx2i - ERROR - please submit GRC Dump," -" NW/PCIe trace, driver msgs to developers" -" for analysis\n" ); -return 1 ; +if (ep->conn && ep->conn->cls_conn && + ep->conn->cls_conn->dd_data) { +struct iscsi_conn *conn = ep->conn->cls_conn->dd_data; + +/* Must suspend all rx queue activity for this ep */ +set_bit (ISCSI_SUSPEND_BIT , &conn->suspend_rx); + } +/* CONN_DISCONNECT timeout may or may not be an issue depending +* on what transcribed in TCP layer, different targets behave +* differently +*/ +printk (KERN_ALERT "bnx2i (%s): - WARN - CONN_DISCON timed out, " +"please submit GRC Dump, NW/PCIe trace, " +"driver msgs to developers for analysis\n" , + hba->netdev->name); } ep->state =EP_STATE_CLEANUP_START ;
Signature · 1 line
1.7.0.5
PATCH v2 5/14 BNX2I: Fixed the remote TCP RST handling for the 570X (1g)
In reply to a message not in the archiveModified the handling of the remote TCP RST code so the chip can now flush the tx pipe accordingly upon a remote TCP RST reception.
--- drivers/scsi/bnx2i/bnx2i_hwi.c | 11 ++++++++--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 8 +++----- 2 files changed, 11 insertions(+), 8 deletions(-)
drivers/scsi/bnx2i/bnx2i_hwi.c +8 -3
@@ -2333,12 +2333,17 @@ static void bnx2i_cm_abort_cmpl(struct cnic_sock *cm_sk)static void bnx2i_cm_remote_close (struct cnic_sock *cm_sk) {struct bnx2i_endpoint *ep = (struct bnx2i_endpoint *) cm_sk->context; +u32 old_state = ep->state; - ep->state =EP_STATE_TCP_FIN_RCVD ; -if (ep->conn) -bnx2i_recovery_que_add_conn (ep->hba, ep->conn); + ep->state =EP_STATE_TCP_RST_RCVD ; +if (old_state ==EP_STATE_DISCONN_START ) +wake_up_interruptible (&ep->ofld_wait); +else +if (ep->conn) +bnx2i_recovery_que_add_conn (ep->hba, ep->conn); } +/** * bnx2i_cm_remote_abort - process TCP RST and start conn cleanup * @hba: adapter structure pointer
drivers/scsi/bnx2i/bnx2i_iscsi.c +3 -5
@@ -1907,6 +1907,7 @@ static int bnx2i_ep_tcp_conn_active(struct bnx2i_endpoint *bnx2i_ep)switch (bnx2i_ep->state) {case EP_STATE_CONNECT_START : +case EP_STATE_CONNECT_FAILED :case EP_STATE_CLEANUP_FAILED :case EP_STATE_OFLD_FAILED :case EP_STATE_DISCONN_TIMEDOUT :
@@ -1922,13 +1923,10 @@ static int bnx2i_ep_tcp_conn_active(struct bnx2i_endpoint *bnx2i_ep) ret =1 ;break ;case EP_STATE_TCP_RST_RCVD : - ret =0 ; -break ; -case EP_STATE_CONNECT_FAILED :if (cnic_dev_10g) - ret =1 ; -else ret =0 ; +else + ret =1 ;break ;default : ret =0 ;
Signature · 1 line
1.7.0.5
PATCH v2 6/14 BNX2I: Allow to abort the connection if connect request times out
In reply to a message not in the archiveIn the situation where the connect completion response arrives after the connect request has already timed out, the connection was not being aborted but only the resource was being freed. This creates a problem for 5771X (10g) as the chip flags this with an assertion.
This change will properly aborts the connection before freeing the resource.
--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/bnx2i/bnx2i_iscsi.c +1 -1
@@ -1906,13 +1906,13 @@ static int bnx2i_ep_tcp_conn_active(struct bnx2i_endpoint *bnx2i_ep) cnic_dev_10g =1 ;switch (bnx2i_ep->state) { -case EP_STATE_CONNECT_START :case EP_STATE_CONNECT_FAILED :case EP_STATE_CLEANUP_FAILED :case EP_STATE_OFLD_FAILED :case EP_STATE_DISCONN_TIMEDOUT : ret =0 ;break ; +case EP_STATE_CONNECT_START :case EP_STATE_CONNECT_COMPL :case EP_STATE_ULP_UPDATE_START :case EP_STATE_ULP_UPDATE_COMPL :
Signature · 1 line
1.7.0.5
PATCH v2 7/14 BNX2I: Added mutex lock protection to conn_get_param
In reply to a message not in the archiveAdded net_dev mutex lock protection before accessing the csk parameters.
--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-)
drivers/scsi/bnx2i/bnx2i_iscsi.c +10 -3
@@ -1461,21 +1461,28 @@ static int bnx2i_conn_get_param(struct iscsi_cls_conn *cls_conn,struct bnx2i_conn *bnx2i_conn = conn->dd_data;int len =0 ; +if (!(bnx2i_conn && bnx2i_conn->ep && bnx2i_conn->ep->hba)) + goto out; +switch (param) {case ISCSI_PARAM_CONN_PORT : -if (bnx2i_conn->ep) +mutex_lock (&bnx2i_conn->ep->hba->net_dev_lock); +if (bnx2i_conn->ep->cm_sk) len =sprintf (buf,"%hu\n" , bnx2i_conn->ep->cm_sk->dst_port); +mutex_unlock (&bnx2i_conn->ep->hba->net_dev_lock);break ;case ISCSI_PARAM_CONN_ADDRESS : -if (bnx2i_conn->ep) +mutex_lock (&bnx2i_conn->ep->hba->net_dev_lock); +if (bnx2i_conn->ep->cm_sk) len =sprintf (buf,"%pI4\n" , &bnx2i_conn->ep->cm_sk->dst_ip); +mutex_unlock (&bnx2i_conn->ep->hba->net_dev_lock);break ;default :return iscsi_conn_get_param (cls_conn, param, buf); } - +out:return len; }
Signature · 1 line
1.7.0.5
PATCH v2 8/14 BNX2I: Removed the dynamic registration of CNIC
In reply to a message not in the archiveThe code no longer needs to dynamically register and unregister the CNIC device. The CNIC device will be kept registered until module unload.
--- drivers/scsi/bnx2i/bnx2i.h | 3 - drivers/scsi/bnx2i/bnx2i_init.c | 82 -------------------------------------- drivers/scsi/bnx2i/bnx2i_iscsi.c | 7 --- 3 files changed, 0 insertions(+), 92 deletions(-)
drivers/scsi/bnx2i/bnx2i.h +0 -3
@@ -717,14 +717,11 @@ extern struct device_attribute *bnx2i_dev_attributes[];* Function Prototypes */ extern void bnx2i_identify_device (struct bnx2i_hba *hba); -extern void bnx2i_register_device (struct bnx2i_hba *hba);extern void bnx2i_ulp_init (struct cnic_dev *dev);extern void bnx2i_ulp_exit (struct cnic_dev *dev);extern void bnx2i_start (void *handle);extern void bnx2i_stop (void *handle); -extern void bnx2i_reg_dev_all (void ); -extern void bnx2i_unreg_dev_all (void );extern struct bnx2i_hba *get_adapter_list_head (void ); struct bnx2i_conn *bnx2i_get_conn_from_id(struct bnx2i_hba *hba,
drivers/scsi/bnx2i/bnx2i_init.c +0 -82
94 lines not on this page · raw message
drivers/scsi/bnx2i/bnx2i_iscsi.c +0 -7
@@ -1606,8 +1606,6 @@ static struct bnx2i_hba *bnx2i_check_route(struct sockaddr *dst_addr)struct bnx2i_hba *hba;struct cnic_dev *cnic =NULL ; -bnx2i_reg_dev_all (); - hba =get_adapter_list_head ();if (hba && hba->cnic) cnic = hba->cnic->cm_select_dev (desti,CNIC_ULP_ISCSI );
@@ -1726,8 +1724,6 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost,if (shost) {/* driver is given scsi host to work with */ hba =iscsi_host_priv (shost); -/* Register the device with cnic if not already done so */ -bnx2i_register_device (hba); }else /* * check if the given destination can be reached through
@@ -1853,7 +1849,6 @@ qp_resc_err: check_busy:mutex_unlock (&hba->net_dev_lock); nohba: -bnx2i_unreg_dev_all ();return ERR_PTR (rc); }
@@ -2089,8 +2084,6 @@ return_bnx2i_ep:bnx2i_free_ep (ep);mutex_unlock (&hba->net_dev_lock); -if (!hba->ofld_conns_active) -bnx2i_unreg_dev_all ();wake_up_interruptible (&hba->eh_wait); }
Signature · 1 line
1.7.0.5
PATCH v2 9/14 BNX2I: Modified the bnx2i stop path to compensate for in progress ops
In reply to a message not in the archiveThe stop path has been augmented to wait a max of 10s for all in progress offload and destroy activities to complete before proceeding to terminate all active connections (via iscsid or forcefully).
Note that any new offload and destroy requests are now blocked and return to the caller immediately.
--- drivers/scsi/bnx2i/bnx2i_init.c | 21 +++++++++++++++++---- drivers/scsi/bnx2i/bnx2i_iscsi.c | 7 ++++++- 2 files changed, 23 insertions(+), 5 deletions(-)
drivers/scsi/bnx2i/bnx2i_init.c +17 -4
@@ -209,13 +209,24 @@ void bnx2i_stop(void *handle) {struct bnx2i_hba *hba = handle;int conns_active; +int wait_delay =1 *HZ ;/* check if cleanup happened in GOING_DOWN context */ -if (!test_and_clear_bit (ADAPTER_STATE_GOING_DOWN , - &hba->adapter_state)) +if (!test_and_set_bit (ADAPTER_STATE_GOING_DOWN , + &hba->adapter_state)) {iscsi_host_for_each_session (hba->shost, bnx2i_drop_session); - + wait_delay = hba->hba_shutdown_tmo; + } +/* Wait for inflight offload connection tasks to complete before +* proceeding. Forcefully terminate all connection recovery in +* progress at the earliest, either in bind(), send_pdu(LOGIN), +* or conn_start() +*/ +wait_event_interruptible_timeout (hba->eh_wait, + (list_empty (&hba->ep_ofld_list) && +list_empty (&hba->ep_destroy_list)), +10 *HZ );/* Wait for all endpoints to be torn down, Chip will be reset once * control returns to network driver. So it is required to cleanup and * release all connection resources before returning from this routine.
@@ -224,7 +235,7 @@ void bnx2i_stop(void *handle) conns_active = hba->ofld_conns_active;wait_event_interruptible_timeout (hba->eh_wait, (hba->ofld_conns_active != conns_active), - hba->hba_shutdown_tmo); + wait_delay);if (hba->ofld_conns_active == conns_active)break ; }
@@ -233,9 +244,11 @@ void bnx2i_stop(void *handle)/* This flag should be cleared last so that ep_disconnect() gracefully * cleans up connection context */ +clear_bit (ADAPTER_STATE_GOING_DOWN , &hba->adapter_state);clear_bit (ADAPTER_STATE_UP , &hba->adapter_state); } +/** * bnx2i_init_one - initialize an adapter instance and allocate memory resources * @hba: bnx2i adapter instance
drivers/scsi/bnx2i/bnx2i_iscsi.c +6 -1
@@ -1383,6 +1383,12 @@ static int bnx2i_conn_bind(struct iscsi_cls_session *cls_session, ep =iscsi_lookup_endpoint (transport_fd);if (!ep)return -EINVAL ; +/* +* Forcefully terminate all in progress connection recovery at the +* earliest, either in bind(), send_pdu(LOGIN), or conn_start() +*/ +if (bnx2i_adapter_ready (hba)) +return -EIO ; bnx2i_ep = ep->dd_data; if ((bnx2i_ep->state == EP_STATE_TCP_FIN_RCVD) ||
@@ -1404,7 +1410,6 @@ static int bnx2i_conn_bind(struct iscsi_cls_session *cls_session, hba->netdev->name);return -EEXIST ; } - bnx2i_ep->conn = bnx2i_conn; bnx2i_conn->ep = bnx2i_ep; bnx2i_conn->iscsi_conn_cid = bnx2i_ep->ep_iscsi_cid;
Signature · 1 line
1.7.0.5
cover BNX2I: Patch set to fix various bug fixes
In reply to a message not in the archiveHello,
Quoted 3 lines
This patch set contains various bug fixes as categorized in the following:
- scsi command handling (nop-ins, tmfs)
- various connection clean up bug fixes
In v2, the following patches are modified based on Mike Christie's comments:
BNX2I: Added mutex lock protection to conn_get_param (rm ret 0)
BNX2I: Removed the dynamic registration of CNIC (trailing space)
These patches were removed pending better resolution:
BNX2I: Updated the handling of NETEVENTs to alleviate recovery
BNX2I: Added code to handle the binding of an existing connection
Your comments are grealy appreciated. Please review, thanks.
Eddie
Eddie Wai (14):
BNX2I: Fixed bugs in the handling of unsolicited NOP-Ins
BNX2I: Added fix for NOP-Out response panic from unsolicited NOP-In
BNX2I: Fixed the endian bug in the TMF LUN cmd send
BNX2I: Fixed a cid leak issue for 5771X (10g)
BNX2I: Fixed the remote TCP RST handling for the 570X (1g)
BNX2I: Allow to abort the connection if connect request times out
BNX2I: Added mutex lock protection to conn_get_param
BNX2I: Removed the dynamic registration of CNIC
BNX2I: Modified the bnx2i stop path to compensate for in progress ops
BNX2I: Added return code check for chip kwqe submission request
BNX2I: Added feature to silently drop NOPOUT request
BNX2I: Cleaned up various error conditions in ep_connect/disconnect
BNX2I: Updated copyright and maintainer info
BNX2I: Updated version to 2.6.2.1
drivers/scsi/bnx2i/57xx_iscsi_constants.h | 3 +- drivers/scsi/bnx2i/57xx_iscsi_hsi.h | 3 +- drivers/scsi/bnx2i/bnx2i.h | 15 ++-- drivers/scsi/bnx2i/bnx2i_hwi.c | 99 +++++++++++++----- drivers/scsi/bnx2i/bnx2i_init.c | 108 ++++--------------- drivers/scsi/bnx2i/bnx2i_iscsi.c | 164 +++++++++++++++++++---------- drivers/scsi/bnx2i/bnx2i_sysfs.c | 3 +- drivers/scsi/libiscsi.c | 3 +- include/scsi/libiscsi.h | 1 + 9 files changed, 216 insertions(+), 183 deletions(-)
PATCH v2 10/14 BNX2I: Added return code check for chip kwqe submission request
In reply to a message not in the archiveAdded the handling for cases when a chip request is made to the CNIC module but the hardware is not ready to accept. This would lead to many unnecessary wait timeouts.
This code adds check in the connect establishment and destruction path.
--- drivers/scsi/bnx2i/bnx2i.h | 9 +++--- drivers/scsi/bnx2i/bnx2i_hwi.c | 54 ++++++++++++++++++++++++++++---------- drivers/scsi/bnx2i/bnx2i_iscsi.c | 17 ++++++++++- 3 files changed, 60 insertions(+), 20 deletions(-)
drivers/scsi/bnx2i/bnx2i.h +5 -4
@@ -649,6 +649,7 @@ enum {EP_STATE_OFLD_FAILED =0x8000000 ,EP_STATE_CONNECT_FAILED =0x10000000 ,EP_STATE_DISCONN_TIMEDOUT =0x20000000 , + EP_STATE_OFLD_FAILED_CID_BUSY = 0x80000000, };/**
@@ -758,11 +759,11 @@ extern int bnx2i_send_iscsi_logout(struct bnx2i_conn *conn, struct iscsi_task *mtask);extern void bnx2i_send_cmd_cleanup_req (struct bnx2i_hba *hba,struct bnx2i_cmd *cmd); -extern void bnx2i_send_conn_ofld_req (struct bnx2i_hba *hba, -struct bnx2i_endpoint *ep); -extern void bnx2i_update_iscsi_conn (struct iscsi_conn *conn); -extern void bnx2i_send_conn_destroy (struct bnx2i_hba *hba, +extern int bnx2i_send_conn_ofld_req (struct bnx2i_hba *hba,struct bnx2i_endpoint *ep); +extern void bnx2i_update_iscsi_conn (struct iscsi_conn *conn); +extern int bnx2i_send_conn_destroy (struct bnx2i_hba *hba, +struct bnx2i_endpoint *ep);extern int bnx2i_alloc_qp_resc (struct bnx2i_hba *hba,struct bnx2i_endpoint *ep);
drivers/scsi/bnx2i/bnx2i_hwi.c +40 -14
122 lines not on this page · raw message
drivers/scsi/bnx2i/bnx2i_iscsi.c +15 -2
@@ -1682,7 +1682,9 @@ static int bnx2i_tear_down_conn(struct bnx2i_hba *hba,bnx2i_ep_destroy_list_add (hba, ep);/* destroy iSCSI context, wait for it to complete */ -bnx2i_send_conn_destroy (hba, ep); +if (bnx2i_send_conn_destroy (hba, ep)) + ep->state =EP_STATE_CLEANUP_CMPL ; +wait_event_interruptible (ep->ofld_wait, (ep->state !=EP_STATE_CLEANUP_START ));
@@ -1781,7 +1783,18 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost, bnx2i_ep->ofld_timer.data = (unsigned long ) bnx2i_ep;add_timer (&bnx2i_ep->ofld_timer); -bnx2i_send_conn_ofld_req (hba, bnx2i_ep); +if (bnx2i_send_conn_ofld_req (hba, bnx2i_ep)) { +if (bnx2i_ep->state ==EP_STATE_OFLD_FAILED_CID_BUSY ) { +printk (KERN_ALERT "bnx2i (%s): iscsi cid %d is busy\n" , + hba->netdev->name, bnx2i_ep->ep_iscsi_cid); + rc = -EBUSY ; + }else + rc = -ENOSPC ; +printk (KERN_ALERT "bnx2i (%s): unable to send conn offld kwqe" +"\n" , hba->netdev->name); +bnx2i_ep_ofld_list_del (hba, bnx2i_ep); + goto conn_failed; + }/* Wait for CNIC hardware to setup conn context and return 'cid' */ wait_event_interruptible(bnx2i_ep->ofld_wait,
Signature · 1 line
1.7.0.5
PATCH v2 11/14 BNX2I: Added feature to silently drop NOPOUT request
In reply to a message not in the archiveIn the case the chip is undergoing different invasive operation which requires a chip reset, all NOPOUT request during this period must be silently dropped from queuing to the hardware. This patch will respond to libiscsi immediately with sent success. Since the request was not actually sent, the NOPIN wait timeout will get triggered and another NOPOUT request will commence through the proper channel.
--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-)
drivers/scsi/bnx2i/bnx2i_iscsi.c +16 -0
@@ -1068,6 +1068,22 @@ static int bnx2i_iscsi_send_generic_request(struct iscsi_task *task)char *buf;int data_len; +/* +* Forcefully terminate all in progress connection recovery at the +* earliest, either in bind(), send_pdu(LOGIN), or conn_start() +*/ +if (bnx2i_adapter_ready (bnx2i_conn->ep->hba)) { +if ((task->hdr->opcode &ISCSI_OPCODE_MASK ) == +ISCSI_OP_NOOP_OUT ) +/* This is a WA to indicate to libiscsi that the nopout +* request was sent successfully without actually +* submitting to the hardware. +* Just silently drop the nopout request +*/ +return 0 ; +else +return -EIO ; + }bnx2i_iscsi_prep_generic_pdu_bd (bnx2i_conn);switch (task->hdr->opcode &ISCSI_OPCODE_MASK ) {case ISCSI_OP_LOGIN :
Signature · 1 line
1.7.0.5
A message that is not in the archive (sent off-list or not yet received): 1290130209-32133-12-git-send-email-eddie.wai-dY08KVG/lbpWk0Htik3J/[email protected]
Re: [PATCH v2 11/14] BNX2I: Added feature to silently drop NOPOUT request
Quoted 25 lines · Eddie Wai
In the case the chip is undergoing different invasive operation which requires a chip reset, all NOPOUT request during this period must be silently dropped from queuing to the hardware. This patch will respond to libiscsi immediately with sent success. Since the request was not actually sent, the NOPIN wait timeout will get triggered and another NOPOUT request will commence through the proper channel.
--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-)drivers/scsi/bnx2i/bnx2i_iscsi.c +3
-0@@ -1068,6 +1068,22 @@ static int bnx2i_iscsi_send_generic_request(struct iscsi_task *task)char *buf;int data_len; +/* +* Forcefully terminate all in progress connection recovery at the +* earliest, either in bind(), send_pdu(LOGIN), or conn_start()
drivers/scsi/bnx2i/bnx2i_iscsi.c static int bnx2i_iscsi_send_generic_request(struct iscsi_task *task) · line 1083
Quoted 10 lines
drivers/scsi/bnx2i/bnx2i_iscsi.c +10
-0+*/ +if (bnx2i_adapter_ready (bnx2i_conn->ep->hba)) { +if ((task->hdr->opcode&ISCSI_OPCODE_MASK ) == +ISCSI_OP_NOOP_OUT ) +/* This is a WA to indicate to libiscsi that the nopout +* request was sent successfully without actually +* submitting to the hardware. +* Just silently drop the nopout request +*/ +return 0 ;
I'd like to just have libiscsi handle a error code here instead of hacking around its lack of eh handling.
Quoted 6 lines
drivers/scsi/bnx2i/bnx2i_iscsi.c +3
-0+else +return -EIO ; + }bnx2i_iscsi_prep_generic_pdu_bd (bnx2i_conn);switch (task->hdr->opcode&ISCSI_OPCODE_MASK ) {case ISCSI_OP_LOGIN :
Signature · 4 lines
You received this message because you are subscribed to the Google Groups "open-iscsi" group. To post to this group, send email to open-iscsi-/JYPxA39Uh5TLH3MbocFF+G/[email protected] To unsubscribe from this group, send email to open-iscsi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] For more options, visit this group at http://groups.google.com/group/open-iscsi?hl=en.
PATCH v2 12/14 BNX2I: Cleaned up various error conditions in ep_connect/disconnect
In reply to a message not in the archiveVarious error conditions inside ep_connect and ep_disconnect were either not being handled or not being handled correctly. This patch fixes all those issues.
--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 67 ++++++++++++++++++++++--------------- 1 files changed, 40 insertions(+), 27 deletions(-)
drivers/scsi/bnx2i/bnx2i_iscsi.c +40 -27
@@ -411,7 +411,9 @@ static void bnx2i_free_ep(struct iscsi_endpoint *ep) bnx2i_ep->state =EP_STATE_IDLE ; bnx2i_ep->hba->ofld_conns_active--; -bnx2i_free_iscsi_cid (bnx2i_ep->hba, bnx2i_ep->ep_iscsi_cid); +if (bnx2i_ep->ep_iscsi_cid != (u16) -1 ) +bnx2i_free_iscsi_cid (bnx2i_ep->hba, bnx2i_ep->ep_iscsi_cid); +if (bnx2i_ep->conn) { bnx2i_ep->conn->ep =NULL ; bnx2i_ep->conn =NULL ;
@@ -1754,13 +1756,17 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost,*/ hba =bnx2i_check_route (dst_addr); -if (!hba ||test_bit (ADAPTER_STATE_GOING_DOWN , &hba->adapter_state)) { +if (!hba) { rc = -EINVAL ; goto nohba; } +mutex_lock (&hba->net_dev_lock); +if (bnx2i_adapter_ready (hba) || !hba->cid_que.cid_free_cnt) { + rc = -EPERM ; + goto check_busy; + } cnic = hba->cnic; -mutex_lock (&hba->net_dev_lock); ep =bnx2i_alloc_ep (hba);if (!ep) { rc = -ENOMEM ;
@@ -1768,23 +1774,21 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost, } bnx2i_ep = ep->dd_data; -if (bnx2i_adapter_ready (hba)) { - rc = -EPERM ; - goto net_if_down; - } - bnx2i_ep->num_active_cmds =0 ; iscsi_cid =bnx2i_alloc_iscsi_cid (hba);if (iscsi_cid ==-1 ) { -printk (KERN_ALERT "alloc_ep: unable to allocate iscsi cid\n" ); +printk (KERN_ALERT "bnx2i (%s): alloc_ep - unable to allocate " +"iscsi cid\n" , hba->netdev->name); rc = -ENOMEM ; - goto iscsi_cid_err; +bnx2i_free_ep (ep); + goto check_busy; } bnx2i_ep->hba_age = hba->age; rc =bnx2i_alloc_qp_resc (hba, bnx2i_ep);if (rc !=0 ) { -printk (KERN_ALERT "bnx2i: ep_conn, alloc QP resc error\n" ); +printk (KERN_ALERT "bnx2i (%s): ep_conn - alloc QP resc error" +"\n" , hba->netdev->name); rc = -ENOMEM ; goto qp_resc_err; }
@@ -1823,7 +1827,12 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost,bnx2i_ep_ofld_list_del (hba, bnx2i_ep);if (bnx2i_ep->state !=EP_STATE_OFLD_COMPL ) { - rc = -ENOSPC ; +if (bnx2i_ep->state ==EP_STATE_OFLD_FAILED_CID_BUSY ) { +printk (KERN_ALERT "bnx2i (%s): iscsi cid %d is busy\n" , + hba->netdev->name, bnx2i_ep->ep_iscsi_cid); + rc = -EBUSY ; + }else + rc = -ENOSPC ; goto conn_failed; }
@@ -1831,7 +1840,8 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost, iscsi_cid, &bnx2i_ep->cm_sk, bnx2i_ep);if (rc) { rc = -EINVAL ; - goto conn_failed; +/* Need to terminate and cleanup the connection */ + goto release_ep; } bnx2i_ep->cm_sk->rcv_buf =256 *1024 ;
@@ -1875,8 +1885,6 @@ release_ep:return ERR_PTR (rc); } conn_failed: -net_if_down: -iscsi_cid_err:bnx2i_free_qp_resc (hba, bnx2i_ep); qp_resc_err:bnx2i_free_ep (ep);
@@ -1995,7 +2003,8 @@ int bnx2i_hw_ep_disconnect(struct bnx2i_endpoint *bnx2i_ep)if (!cnic)return 0 ; -if (bnx2i_ep->state ==EP_STATE_IDLE ) +if (bnx2i_ep->state ==EP_STATE_IDLE || + bnx2i_ep->state ==EP_STATE_DISCONN_TIMEDOUT )return 0 ;if (!bnx2i_ep_tcp_conn_active (bnx2i_ep))
@@ -2021,9 +2030,10 @@ int bnx2i_hw_ep_disconnect(struct bnx2i_endpoint *bnx2i_ep)if (session->state ==ISCSI_STATE_LOGGING_OUT ) {if (bnx2i_ep->state ==EP_STATE_LOGOUT_SENT ) {/* Logout sent, but no resp */ -printk (KERN_ALERT "bnx2i - WARNING " -"logout response was not " -"received!\n" ); +printk (KERN_ALERT "bnx2i (%s): WARNING" +" logout response was not " +"received!\n" , + bnx2i_ep->hba->netdev->name); }else if (bnx2i_ep->state ==EP_STATE_LOGOUT_RESP_RCVD ) close =1 ;
@@ -2041,9 +2051,8 @@ int bnx2i_hw_ep_disconnect(struct bnx2i_endpoint *bnx2i_ep)else close_ret = cnic->cm_abort (bnx2i_ep->cm_sk); -/* No longer allow CFC delete if cm_close/abort fails the request */ if (close_ret) -printk (KERN_ALERT "bnx2i: %s close/abort(%d) returned %d\n" , +printk (KERN_ALERT "bnx2i (%s): close/abort(%d) returned %d\n" , bnx2i_ep->hba->netdev->name, close, close_ret);else /* wait for option-2 conn teardown */
@@ -2057,7 +2066,7 @@ int bnx2i_hw_ep_disconnect(struct bnx2i_endpoint *bnx2i_ep) destroy_conn:bnx2i_ep_active_list_del (hba, bnx2i_ep);if (bnx2i_tear_down_conn (hba, bnx2i_ep)) - ret = -EINVAL ; +return -EINVAL ; out: bnx2i_ep->state =EP_STATE_IDLE ;return ret;
@@ -2096,14 +2105,17 @@ static void bnx2i_ep_disconnect(struct iscsi_endpoint *ep)mutex_lock (&hba->net_dev_lock); -if (bnx2i_ep->state ==EP_STATE_IDLE ) - goto return_bnx2i_ep; +if (bnx2i_ep->state ==EP_STATE_DISCONN_TIMEDOUT ) + goto out; -if (!test_bit (ADAPTER_STATE_UP , &hba->adapter_state)) +if (bnx2i_ep->state ==EP_STATE_IDLE ) goto free_resc; -if (bnx2i_ep->hba_age != hba->age) +if (!test_bit (ADAPTER_STATE_UP , &hba->adapter_state) || + (bnx2i_ep->hba_age != hba->age)) { +bnx2i_ep_active_list_del (hba, bnx2i_ep); goto free_resc; + }/* Do all chip cleanup here */ if (bnx2i_hw_ep_disconnect (bnx2i_ep)) {
@@ -2112,11 +2124,12 @@ static void bnx2i_ep_disconnect(struct iscsi_endpoint *ep) } free_resc:bnx2i_free_qp_resc (hba, bnx2i_ep); -return_bnx2i_ep: +if (bnx2i_conn) bnx2i_conn->ep =NULL ;bnx2i_free_ep (ep); +out:mutex_unlock (&hba->net_dev_lock);wake_up_interruptible (&hba->eh_wait);
Signature · 1 line
1.7.0.5
PATCH v2 13/14 BNX2I: Updated copyright and maintainer info
In reply to a message not in the archive--- drivers/scsi/bnx2i/57xx_iscsi_constants.h | 3 ++- drivers/scsi/bnx2i/57xx_iscsi_hsi.h | 3 ++- drivers/scsi/bnx2i/bnx2i.h | 3 ++- drivers/scsi/bnx2i/bnx2i_hwi.c | 3 ++- drivers/scsi/bnx2i/bnx2i_init.c | 3 ++- drivers/scsi/bnx2i/bnx2i_iscsi.c | 3 ++- drivers/scsi/bnx2i/bnx2i_sysfs.c | 3 ++- 7 files changed, 14 insertions(+), 7 deletions(-)
drivers/scsi/bnx2i/57xx_iscsi_constants.h +2 -1
@@ -1,12 +1,13 @@/* 57xx_iscsi_constants.h: Broadcom NetXtreme II iSCSI HSI * -* Copyright (c) 2006 - 2009 Broadcom Corporation +* Copyright (c) 2006 - 2010 Broadcom Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation. * * Written by: Anil Veerabhadrappa ([email protected]) +* Maintained by: Eddie Wai ([email protected]) */ #ifndef __57XX_ISCSI_CONSTANTS_H_#define __57XX_ISCSI_CONSTANTS_H_
drivers/scsi/bnx2i/57xx_iscsi_hsi.h +2 -1
@@ -1,12 +1,13 @@/* 57xx_iscsi_hsi.h: Broadcom NetXtreme II iSCSI HSI. * -* Copyright (c) 2006 - 2009 Broadcom Corporation +* Copyright (c) 2006 - 2010 Broadcom Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation. * * Written by: Anil Veerabhadrappa ([email protected]) +* Maintained by: Eddie Wai ([email protected]) */ #ifndef __57XX_ISCSI_HSI_LINUX_LE__#define __57XX_ISCSI_HSI_LINUX_LE__
drivers/scsi/bnx2i/bnx2i.h +2 -1
@@ -1,6 +1,6 @@/* bnx2i.h: Broadcom NetXtreme II iSCSI driver. * -* Copyright (c) 2006 - 2009 Broadcom Corporation +* Copyright (c) 2006 - 2010 Broadcom Corporation * Copyright (c) 2007, 2008 Red Hat, Inc. All rights reserved. * Copyright (c) 2007, 2008 Mike Christie *
@@ -9,6 +9,7 @@* the Free Software Foundation. * * Written by: Anil Veerabhadrappa ([email protected]) +* Maintained by: Eddie Wai ([email protected]) */ #ifndef _BNX2I_H_
drivers/scsi/bnx2i/bnx2i_hwi.c +2 -1
@@ -1,6 +1,6 @@/* bnx2i_hwi.c: Broadcom NetXtreme II iSCSI driver. * -* Copyright (c) 2006 - 2009 Broadcom Corporation +* Copyright (c) 2006 - 2010 Broadcom Corporation * Copyright (c) 2007, 2008 Red Hat, Inc. All rights reserved. * Copyright (c) 2007, 2008 Mike Christie *
@@ -9,6 +9,7 @@* the Free Software Foundation. * * Written by: Anil Veerabhadrappa ([email protected]) +* Maintained by: Eddie Wai ([email protected]) */ #include <linux/gfp.h>
drivers/scsi/bnx2i/bnx2i_init.c +2 -1
@@ -1,6 +1,6 @@/* bnx2i.c: Broadcom NetXtreme II iSCSI driver. * -* Copyright (c) 2006 - 2009 Broadcom Corporation +* Copyright (c) 2006 - 2010 Broadcom Corporation * Copyright (c) 2007, 2008 Red Hat, Inc. All rights reserved. * Copyright (c) 2007, 2008 Mike Christie *
@@ -9,6 +9,7 @@* the Free Software Foundation. * * Written by: Anil Veerabhadrappa ([email protected]) +* Maintained by: Eddie Wai ([email protected]) */ #include "bnx2i.h"
drivers/scsi/bnx2i/bnx2i_iscsi.c +2 -1
@@ -1,7 +1,7 @@/* * bnx2i_iscsi.c: Broadcom NetXtreme II iSCSI driver. * -* Copyright (c) 2006 - 2009 Broadcom Corporation +* Copyright (c) 2006 - 2010 Broadcom Corporation * Copyright (c) 2007, 2008 Red Hat, Inc. All rights reserved. * Copyright (c) 2007, 2008 Mike Christie *
@@ -10,6 +10,7 @@* the Free Software Foundation. * * Written by: Anil Veerabhadrappa ([email protected]) +* Maintained by: Eddie Wai ([email protected]) */ #include <linux/slab.h>
drivers/scsi/bnx2i/bnx2i_sysfs.c +2 -1
@@ -1,12 +1,13 @@/* bnx2i_sysfs.c: Broadcom NetXtreme II iSCSI driver. * -* Copyright (c) 2004 - 2009 Broadcom Corporation +* Copyright (c) 2004 - 2010 Broadcom Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation. * * Written by: Anil Veerabhadrappa ([email protected]) +* Maintained by: Eddie Wai ([email protected]) */ #include "bnx2i.h"
Signature · 1 line
1.7.0.5
PATCH v2 14/14 BNX2I: Updated version to 2.6.2.1
In reply to a message not in the archive--- drivers/scsi/bnx2i/bnx2i_init.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/bnx2i/bnx2i_init.c +2 -2
@@ -18,8 +18,8 @@ static struct list_head adapter_list = LIST_HEAD_INIT(adapter_list);static u32 adapter_count;#define DRV_MODULE_NAME "bnx2i" -#define DRV_MODULE_VERSION "2.1.3" -#define DRV_MODULE_RELDATE "Aug 10, 2010" +#define DRV_MODULE_VERSION "2.6.2.1" +#define DRV_MODULE_RELDATE "Nov 18, 2010"static char version[]__devinitdata ="Broadcom NetXtreme II iSCSI Driver " DRV_MODULE_NAME \
Signature · 1 line
1.7.0.5
PATCH v3 1/13 BNX2I: Fixed bugs in the handling of unsolicited NOP-Ins
In reply to a message not in the archiveUnsolicited NOP-Ins are placed in the receive queue of the hardware which requires to be read out regardless if the receive pipe is suspended or not. This patch adds the disposal of this RQ element under this condition.
Also fixed the bug in the unsolicited NOP-In handling routine which checks for the RESERVED_ITT.
--- drivers/scsi/bnx2i/bnx2i_hwi.c | 23 +++++++++++++++-------- 1 files changed, 15 insertions(+), 8 deletions(-)
drivers/scsi/bnx2i/bnx2i_hwi.c +15 -8
@@ -1549,11 +1549,9 @@ static int bnx2i_process_nopin_mesg(struct iscsi_session *session,struct iscsi_task *task;struct bnx2i_nop_in_msg *nop_in;struct iscsi_nopin *hdr; -u32 itt;int tgt_async_nop =0 ; nop_in = (struct bnx2i_nop_in_msg *)cqe; - itt = nop_in->itt &ISCSI_NOP_IN_MSG_INDEX ;spin_lock (&session->lock); hdr = (struct iscsi_nopin *)&bnx2i_conn->gen_pdu.resp_hdr;
@@ -1563,7 +1561,7 @@ static int bnx2i_process_nopin_mesg(struct iscsi_session *session, hdr->exp_cmdsn =cpu_to_be32 (nop_in->exp_cmd_sn); hdr->ttt =cpu_to_be32 (nop_in->ttt); -if (itt == (u16 )RESERVED_ITT ) { +if (nop_in->itt == (u16 )RESERVED_ITT ) {bnx2i_unsol_pdu_adjust_rq (bnx2i_conn); hdr->itt =RESERVED_ITT ; tgt_async_nop =1 ;
@@ -1571,7 +1569,8 @@ static int bnx2i_process_nopin_mesg(struct iscsi_session *session, }/* this is a response to one of our nop-outs */ - task =iscsi_itt_to_task (conn, itt); + task =iscsi_itt_to_task (conn, + (itt_t) (nop_in->itt &ISCSI_NOP_IN_MSG_INDEX ));if (task) { hdr->flags =ISCSI_FLAG_CMD_FINAL ; hdr->itt = task->hdr->itt;
@@ -1721,9 +1720,18 @@ static void bnx2i_process_new_cqes(struct bnx2i_conn *bnx2i_conn)if (nopin->cq_req_sn != qp->cqe_exp_seq_sn)break ; -if (unlikely (test_bit (ISCSI_SUSPEND_BIT , &conn->suspend_rx))) +if (unlikely (test_bit (ISCSI_SUSPEND_BIT , &conn->suspend_rx))) { +if (nopin->op_code ==ISCSI_OP_NOOP_IN && + nopin->itt == (u16 )RESERVED_ITT ) { +printk (KERN_ALERT "bnx2i: Unsolicited " +"NOP-In detected for suspended " +"connection dev=%s!\n" , + bnx2i_conn->hba->netdev->name); +bnx2i_unsol_pdu_adjust_rq (bnx2i_conn); + goto cqe_out; + }break ; - + } tgt_async_msg =0 ;switch (nopin->op_code) {
@@ -1770,10 +1778,9 @@ static void bnx2i_process_new_cqes(struct bnx2i_conn *bnx2i_conn)printk (KERN_ALERT "bnx2i: unknown opcode 0x%x\n" , nopin->op_code); } -if (!tgt_async_msg) bnx2i_conn->ep->num_active_cmds--; - +cqe_out:/* clear out in production version only, till beta keep opcode * field intact, will be helpful in debugging (context dump) * nopin->op_code = 0;
Signature · 1 line
1.7.0.5
PATCH v3 2/13 BNX2I: Added fix for NOP-Out response panic from unsolicited NOP-In
In reply to a message not in the archiveThe patch fixes the following situations where NOP-Out pkt is called for:
- local unsolicited NOP-Out requests (requesting no NOP-In response)
- local NOP-Out responses to unsolicited NOP-In requests
kernel panic is observed due to double session spin_lock requests; one in the bnx2i_process_nopin_local_cmpl routine in bnx2i_hwi.c and the other in the iscsi_put_task routine in libiscsi.c
The proposed fix is to export the currently static __iscsi_put_task() routine and have bnx2i call it directly instead of the iscsi_put_task() routine which holds the session spin lock.
--- drivers/scsi/bnx2i/bnx2i_hwi.c | 2 +- drivers/scsi/libiscsi.c | 3 ++- include/scsi/libiscsi.h | 1 + 3 files changed, 4 insertions(+), 2 deletions(-)
drivers/scsi/bnx2i/bnx2i_hwi.c +1 -1
@@ -1513,7 +1513,7 @@ static void bnx2i_process_nopin_local_cmpl(struct iscsi_session *session, task =iscsi_itt_to_task (conn, nop_in->itt &ISCSI_NOP_IN_MSG_INDEX );if (task) -iscsi_put_task (task); +__iscsi_put_task (task);spin_unlock (&session->lock); }
drivers/scsi/libiscsi.c +2 -1
@@ -539,11 +539,12 @@ void __iscsi_get_task(struct iscsi_task *task) }EXPORT_SYMBOL_GPL (__iscsi_get_task); -static void __iscsi_put_task (struct iscsi_task *task) +void __iscsi_put_task (struct iscsi_task *task) {if (atomic_dec_and_test (&task->refcount))iscsi_free_task (task); } +EXPORT_SYMBOL_GPL (__iscsi_put_task);void iscsi_put_task (struct iscsi_task *task) {
include/scsi/libiscsi.h +1 -0
@@ -420,6 +420,7 @@ extern struct iscsi_task *iscsi_itt_to_ctask(struct iscsi_conn *, itt_t);extern struct iscsi_task *iscsi_itt_to_task (struct iscsi_conn *,itt_t );extern void iscsi_requeue_task (struct iscsi_task *task);extern void iscsi_put_task (struct iscsi_task *task); +extern void __iscsi_put_task (struct iscsi_task *task);extern void __iscsi_get_task (struct iscsi_task *task);extern void iscsi_complete_scsi_task (struct iscsi_task *task,uint32_t exp_cmdsn,uint32_t max_cmdsn);
Signature · 1 line
1.7.0.5
PATCH v3 3/13 BNX2I: Fixed the endian bug in the TMF LUN cmd send
In reply to a message not in the archiveAdded a be32_to_cpu call for the TMF LUN wqe.
--- drivers/scsi/bnx2i/bnx2i_hwi.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
drivers/scsi/bnx2i/bnx2i_hwi.c +5 -1
@@ -385,6 +385,7 @@ int bnx2i_send_iscsi_tmf(struct bnx2i_conn *bnx2i_conn,struct bnx2i_cmd *bnx2i_cmd;struct bnx2i_tmf_request *tmfabort_wqe;u32 dword; +u32 scsi_lun[2 ]; bnx2i_cmd = (struct bnx2i_cmd *)mtask->dd_data; tmfabort_hdr = (struct iscsi_tm *)mtask->hdr;
@@ -426,7 +427,10 @@ int bnx2i_send_iscsi_tmf(struct bnx2i_conn *bnx2i_conn,default : tmfabort_wqe->ref_itt =RESERVED_ITT ; } -memcpy (tmfabort_wqe->lun, tmfabort_hdr->lun,sizeof (struct scsi_lun )); +memcpy (scsi_lun, tmfabort_hdr->lun,sizeof (struct scsi_lun )); + tmfabort_wqe->lun[0 ] =be32_to_cpu (scsi_lun[0 ]); + tmfabort_wqe->lun[1 ] =be32_to_cpu (scsi_lun[1 ]); + tmfabort_wqe->ref_cmd_sn =be32_to_cpu (tmfabort_hdr->refcmdsn); tmfabort_wqe->bd_list_addr_lo = (u32 ) bnx2i_conn->hba->mp_bd_dma;
Signature · 1 line
1.7.0.5
PATCH 00/13] BNX2I: Patch set to fix various bug fixes
In reply to a message not in the archiveHello,
This patch set contains various bug fixes as categorized in the following:
- scsi command handling (nop-ins, tmfs)
- various connection clean up bug fixes
In v3, the following patches are updated:
BNX2I: Fixed the remote TCP RST handling for the 570X (1g)
Quoted 4 lines
In v2, the following patches are modified based on Mike Christie's comments:
BNX2I: Added mutex lock protection toconn_get_param(rm ret 0)
BNX2I: Removed the dynamic registration of CNIC (trailing space)
In v3, these patches were removed pending better resolution:
BNX2I: Added feature to silently drop NOPOUT request
Quoted 2 lines
BNX2I: Updated the handling of NETEVENTs to alleviate recovery
BNX2I: Added code to handle the binding of an existing connection
Your comments are grealy appreciated. Please review, thanks.
Eddie
Eddie Wai (13):
BNX2I: Fixed bugs in the handling of unsolicited NOP-Ins
BNX2I: Added fix for NOP-Out response panic from unsolicited NOP-In
BNX2I: Fixed the endian bug in the TMF LUN cmd send
BNX2I: Fixed a cid leak issue for 5771X (10g)
BNX2I: Fixed the remote TCP RST handling for the 570X (1g)
BNX2I: Allow to abort the connection if connect request times out
BNX2I: Added mutex lock protection to conn_get_param
BNX2I: Removed the dynamic registration of CNIC
BNX2I: Modified the bnx2i stop path to compensate for in progress ops
BNX2I: Added return code check for chip kwqe submission request
BNX2I: Cleaned up various error conditions in ep_connect/disconnect
BNX2I: Updated copyright and maintainer info
BNX2I: Updated version to 2.6.2.2
drivers/scsi/bnx2i/57xx_iscsi_constants.h | 3 +- drivers/scsi/bnx2i/57xx_iscsi_hsi.h | 3 +- drivers/scsi/bnx2i/bnx2i.h | 15 ++-- drivers/scsi/bnx2i/bnx2i_hwi.c | 96 +++++++++++++----- drivers/scsi/bnx2i/bnx2i_init.c | 108 ++++----------------- drivers/scsi/bnx2i/bnx2i_iscsi.c | 148 ++++++++++++++++++----------- drivers/scsi/bnx2i/bnx2i_sysfs.c | 3 +- drivers/scsi/libiscsi.c | 3 +- include/scsi/libiscsi.h | 1 + 9 files changed, 198 insertions(+), 182 deletions(-)
Mike Christie
Reviewed-byRe: PATCH 00/13] BNX2I: Patch set to fix various bug fixes
Quoted 13 lines · Eddie Wai
Hello,
This patch set contains various bug fixes as categorized in the following:
- scsi command handling (nop-ins, tmfs)
- various connection clean up bug fixes
In v3, the following patches are updated:
BNX2I: Fixed the remote TCP RST handling for the 570X (1g)Quoted 4 lines
In v2, the following patches are modified based on Mike Christie's comments:
BNX2I: Added mutex lock protection toconn_get_param(rm ret 0)
BNX2I: Removed the dynamic registration of CNIC (trailing space)
Quoted 7 lines
In v3, these patches were removed pending better resolution:
BNX2I: Added feature to silently drop NOPOUT requestQuoted 2 lines
BNX2I: Updated the handling of NETEVENTs to alleviate recovery
BNX2I: Added code to handle the binding of an existing connectionYour comments are grealy appreciated. Please review, thanks.
Looks ok. Thanks
PATCH v3 4/13 BNX2I: Fixed a cid leak issue for 5771X (10g)
In reply to a message not in the archiveA cid leak issue was found when the connect destroy request exceeded the driver's disconnection timeout. This will lead to a cid resource leak issue.
The fix is to allow the cid cleanup even when this happens.
--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 24 ++++++++++++++++-------- 1 files changed, 16 insertions(+), 8 deletions(-)
drivers/scsi/bnx2i/bnx2i_iscsi.c +16 -8
@@ -1640,18 +1640,26 @@ no_nx2_route:static int bnx2i_tear_down_conn (struct bnx2i_hba *hba,struct bnx2i_endpoint *ep) { -if (test_bit (BNX2I_CNIC_REGISTERED , &hba->reg_with_cnic)) +if (test_bit (BNX2I_CNIC_REGISTERED , &hba->reg_with_cnic) && ep->cm_sk) hba->cnic->cm_destroy (ep->cm_sk); -if (test_bit (ADAPTER_STATE_GOING_DOWN , &ep->hba->adapter_state)) - ep->state =EP_STATE_DISCONN_COMPL ; -if (test_bit (BNX2I_NX2_DEV_57710 , &hba->cnic_dev_type) && ep->state ==EP_STATE_DISCONN_TIMEDOUT ) { -printk (KERN_ALERT "bnx2i - ERROR - please submit GRC Dump," -" NW/PCIe trace, driver msgs to developers" -" for analysis\n" ); -return 1 ; +if (ep->conn && ep->conn->cls_conn && + ep->conn->cls_conn->dd_data) { +struct iscsi_conn *conn = ep->conn->cls_conn->dd_data; + +/* Must suspend all rx queue activity for this ep */ +set_bit (ISCSI_SUSPEND_BIT , &conn->suspend_rx); + } +/* CONN_DISCONNECT timeout may or may not be an issue depending +* on what transcribed in TCP layer, different targets behave +* differently +*/ +printk (KERN_ALERT "bnx2i (%s): - WARN - CONN_DISCON timed out, " +"please submit GRC Dump, NW/PCIe trace, " +"driver msgs to developers for analysis\n" , + hba->netdev->name); } ep->state =EP_STATE_CLEANUP_START ;
Signature · 1 line
1.7.0.5
PATCH v3 5/13 BNX2I: Fixed the remote TCP RST handling for the 570X (1g)
In reply to a message not in the archiveModified the handling of the remote TCP RST code so the chip can now flush the tx pipe accordingly upon a remote TCP RST reception.
--- drivers/scsi/bnx2i/bnx2i_hwi.c | 8 ++++++-- drivers/scsi/bnx2i/bnx2i_iscsi.c | 8 +++----- 2 files changed, 9 insertions(+), 7 deletions(-)
drivers/scsi/bnx2i/bnx2i_hwi.c +6 -2
@@ -2350,10 +2350,14 @@ static void bnx2i_cm_remote_close(struct cnic_sock *cm_sk)static void bnx2i_cm_remote_abort (struct cnic_sock *cm_sk) {struct bnx2i_endpoint *ep = (struct bnx2i_endpoint *) cm_sk->context; +u32 old_state = ep->state; ep->state =EP_STATE_TCP_RST_RCVD ; -if (ep->conn) -bnx2i_recovery_que_add_conn (ep->hba, ep->conn); +if (old_state ==EP_STATE_DISCONN_START ) +wake_up_interruptible (&ep->ofld_wait); +else +if (ep->conn) +bnx2i_recovery_que_add_conn (ep->hba, ep->conn); }
drivers/scsi/bnx2i/bnx2i_iscsi.c +3 -5
@@ -1907,6 +1907,7 @@ static int bnx2i_ep_tcp_conn_active(struct bnx2i_endpoint *bnx2i_ep)switch (bnx2i_ep->state) {case EP_STATE_CONNECT_START : +case EP_STATE_CONNECT_FAILED :case EP_STATE_CLEANUP_FAILED :case EP_STATE_OFLD_FAILED :case EP_STATE_DISCONN_TIMEDOUT :
@@ -1922,13 +1923,10 @@ static int bnx2i_ep_tcp_conn_active(struct bnx2i_endpoint *bnx2i_ep) ret =1 ;break ;case EP_STATE_TCP_RST_RCVD : - ret =0 ; -break ; -case EP_STATE_CONNECT_FAILED :if (cnic_dev_10g) - ret =1 ; -else ret =0 ; +else + ret =1 ;break ;default : ret =0 ;
Signature · 1 line
1.7.0.5
PATCH v3 6/13 BNX2I: Allow to abort the connection if connect request times out
In reply to a message not in the archiveIn the situation where the connect completion response arrives after the connect request has already timed out, the connection was not being aborted but only the resource was being freed. This creates a problem for 5771X (10g) as the chip flags this with an assertion.
This change will properly aborts the connection before freeing the resource.
--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/bnx2i/bnx2i_iscsi.c +1 -1
@@ -1906,13 +1906,13 @@ static int bnx2i_ep_tcp_conn_active(struct bnx2i_endpoint *bnx2i_ep) cnic_dev_10g =1 ;switch (bnx2i_ep->state) { -case EP_STATE_CONNECT_START :case EP_STATE_CONNECT_FAILED :case EP_STATE_CLEANUP_FAILED :case EP_STATE_OFLD_FAILED :case EP_STATE_DISCONN_TIMEDOUT : ret =0 ;break ; +case EP_STATE_CONNECT_START :case EP_STATE_CONNECT_COMPL :case EP_STATE_ULP_UPDATE_START :case EP_STATE_ULP_UPDATE_COMPL :
Signature · 1 line
1.7.0.5
PATCH v3 8/13 BNX2I: Removed the dynamic registration of CNIC
In reply to a message not in the archiveThe code no longer needs to dynamically register and unregister the CNIC device. The CNIC device will be kept registered until module unload.
--- drivers/scsi/bnx2i/bnx2i.h | 3 - drivers/scsi/bnx2i/bnx2i_init.c | 82 -------------------------------------- drivers/scsi/bnx2i/bnx2i_iscsi.c | 7 --- 3 files changed, 0 insertions(+), 92 deletions(-)
drivers/scsi/bnx2i/bnx2i.h +0 -3
@@ -717,14 +717,11 @@ extern struct device_attribute *bnx2i_dev_attributes[];* Function Prototypes */ extern void bnx2i_identify_device (struct bnx2i_hba *hba); -extern void bnx2i_register_device (struct bnx2i_hba *hba);extern void bnx2i_ulp_init (struct cnic_dev *dev);extern void bnx2i_ulp_exit (struct cnic_dev *dev);extern void bnx2i_start (void *handle);extern void bnx2i_stop (void *handle); -extern void bnx2i_reg_dev_all (void ); -extern void bnx2i_unreg_dev_all (void );extern struct bnx2i_hba *get_adapter_list_head (void ); struct bnx2i_conn *bnx2i_get_conn_from_id(struct bnx2i_hba *hba,
drivers/scsi/bnx2i/bnx2i_init.c +0 -82
94 lines not on this page · raw message
drivers/scsi/bnx2i/bnx2i_iscsi.c +0 -7
@@ -1606,8 +1606,6 @@ static struct bnx2i_hba *bnx2i_check_route(struct sockaddr *dst_addr)struct bnx2i_hba *hba;struct cnic_dev *cnic =NULL ; -bnx2i_reg_dev_all (); - hba =get_adapter_list_head ();if (hba && hba->cnic) cnic = hba->cnic->cm_select_dev (desti,CNIC_ULP_ISCSI );
@@ -1726,8 +1724,6 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost,if (shost) {/* driver is given scsi host to work with */ hba =iscsi_host_priv (shost); -/* Register the device with cnic if not already done so */ -bnx2i_register_device (hba); }else /* * check if the given destination can be reached through
@@ -1853,7 +1849,6 @@ qp_resc_err: check_busy:mutex_unlock (&hba->net_dev_lock); nohba: -bnx2i_unreg_dev_all ();return ERR_PTR (rc); }
@@ -2089,8 +2084,6 @@ return_bnx2i_ep:bnx2i_free_ep (ep);mutex_unlock (&hba->net_dev_lock); -if (!hba->ofld_conns_active) -bnx2i_unreg_dev_all ();wake_up_interruptible (&hba->eh_wait); }
Signature · 1 line
1.7.0.5
PATCH v3 9/13 BNX2I: Modified the bnx2i stop path to compensate for in progress ops
In reply to a message not in the archiveThe stop path has been augmented to wait a max of 10s for all in progress offload and destroy activities to complete before proceeding to terminate all active connections (via iscsid or forcefully).
Note that any new offload and destroy requests are now blocked and return to the caller immediately.
--- drivers/scsi/bnx2i/bnx2i_init.c | 21 +++++++++++++++++---- drivers/scsi/bnx2i/bnx2i_iscsi.c | 7 ++++++- 2 files changed, 23 insertions(+), 5 deletions(-)
drivers/scsi/bnx2i/bnx2i_init.c +17 -4
@@ -209,13 +209,24 @@ void bnx2i_stop(void *handle) {struct bnx2i_hba *hba = handle;int conns_active; +int wait_delay =1 *HZ ;/* check if cleanup happened in GOING_DOWN context */ -if (!test_and_clear_bit (ADAPTER_STATE_GOING_DOWN , - &hba->adapter_state)) +if (!test_and_set_bit (ADAPTER_STATE_GOING_DOWN , + &hba->adapter_state)) {iscsi_host_for_each_session (hba->shost, bnx2i_drop_session); - + wait_delay = hba->hba_shutdown_tmo; + } +/* Wait for inflight offload connection tasks to complete before +* proceeding. Forcefully terminate all connection recovery in +* progress at the earliest, either in bind(), send_pdu(LOGIN), +* or conn_start() +*/ +wait_event_interruptible_timeout (hba->eh_wait, + (list_empty (&hba->ep_ofld_list) && +list_empty (&hba->ep_destroy_list)), +10 *HZ );/* Wait for all endpoints to be torn down, Chip will be reset once * control returns to network driver. So it is required to cleanup and * release all connection resources before returning from this routine.
@@ -224,7 +235,7 @@ void bnx2i_stop(void *handle) conns_active = hba->ofld_conns_active;wait_event_interruptible_timeout (hba->eh_wait, (hba->ofld_conns_active != conns_active), - hba->hba_shutdown_tmo); + wait_delay);if (hba->ofld_conns_active == conns_active)break ; }
@@ -233,9 +244,11 @@ void bnx2i_stop(void *handle)/* This flag should be cleared last so that ep_disconnect() gracefully * cleans up connection context */ +clear_bit (ADAPTER_STATE_GOING_DOWN , &hba->adapter_state);clear_bit (ADAPTER_STATE_UP , &hba->adapter_state); } +/** * bnx2i_init_one - initialize an adapter instance and allocate memory resources * @hba: bnx2i adapter instance
drivers/scsi/bnx2i/bnx2i_iscsi.c +6 -1
@@ -1383,6 +1383,12 @@ static int bnx2i_conn_bind(struct iscsi_cls_session *cls_session, ep =iscsi_lookup_endpoint (transport_fd);if (!ep)return -EINVAL ; +/* +* Forcefully terminate all in progress connection recovery at the +* earliest, either in bind(), send_pdu(LOGIN), or conn_start() +*/ +if (bnx2i_adapter_ready (hba)) +return -EIO ; bnx2i_ep = ep->dd_data; if ((bnx2i_ep->state == EP_STATE_TCP_FIN_RCVD) ||
@@ -1404,7 +1410,6 @@ static int bnx2i_conn_bind(struct iscsi_cls_session *cls_session, hba->netdev->name);return -EEXIST ; } - bnx2i_ep->conn = bnx2i_conn; bnx2i_conn->ep = bnx2i_ep; bnx2i_conn->iscsi_conn_cid = bnx2i_ep->ep_iscsi_cid;
Signature · 1 line
1.7.0.5
PATCH v3 10/13 BNX2I: Added return code check for chip kwqe submission request
In reply to a message not in the archiveAdded the handling for cases when a chip request is made to the CNIC module but the hardware is not ready to accept. This would lead to many unnecessary wait timeouts.
This code adds check in the connect establishment and destruction path.
--- drivers/scsi/bnx2i/bnx2i.h | 9 +++--- drivers/scsi/bnx2i/bnx2i_hwi.c | 54 ++++++++++++++++++++++++++++---------- drivers/scsi/bnx2i/bnx2i_iscsi.c | 17 ++++++++++- 3 files changed, 60 insertions(+), 20 deletions(-)
drivers/scsi/bnx2i/bnx2i.h +5 -4
@@ -649,6 +649,7 @@ enum {EP_STATE_OFLD_FAILED =0x8000000 ,EP_STATE_CONNECT_FAILED =0x10000000 ,EP_STATE_DISCONN_TIMEDOUT =0x20000000 , + EP_STATE_OFLD_FAILED_CID_BUSY = 0x80000000, };/**
@@ -758,11 +759,11 @@ extern int bnx2i_send_iscsi_logout(struct bnx2i_conn *conn, struct iscsi_task *mtask);extern void bnx2i_send_cmd_cleanup_req (struct bnx2i_hba *hba,struct bnx2i_cmd *cmd); -extern void bnx2i_send_conn_ofld_req (struct bnx2i_hba *hba, -struct bnx2i_endpoint *ep); -extern void bnx2i_update_iscsi_conn (struct iscsi_conn *conn); -extern void bnx2i_send_conn_destroy (struct bnx2i_hba *hba, +extern int bnx2i_send_conn_ofld_req (struct bnx2i_hba *hba,struct bnx2i_endpoint *ep); +extern void bnx2i_update_iscsi_conn (struct iscsi_conn *conn); +extern int bnx2i_send_conn_destroy (struct bnx2i_hba *hba, +struct bnx2i_endpoint *ep);extern int bnx2i_alloc_qp_resc (struct bnx2i_hba *hba,struct bnx2i_endpoint *ep);
drivers/scsi/bnx2i/bnx2i_hwi.c +40 -14
122 lines not on this page · raw message
drivers/scsi/bnx2i/bnx2i_iscsi.c +15 -2
@@ -1682,7 +1682,9 @@ static int bnx2i_tear_down_conn(struct bnx2i_hba *hba,bnx2i_ep_destroy_list_add (hba, ep);/* destroy iSCSI context, wait for it to complete */ -bnx2i_send_conn_destroy (hba, ep); +if (bnx2i_send_conn_destroy (hba, ep)) + ep->state =EP_STATE_CLEANUP_CMPL ; +wait_event_interruptible (ep->ofld_wait, (ep->state !=EP_STATE_CLEANUP_START ));
@@ -1781,7 +1783,18 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost, bnx2i_ep->ofld_timer.data = (unsigned long ) bnx2i_ep;add_timer (&bnx2i_ep->ofld_timer); -bnx2i_send_conn_ofld_req (hba, bnx2i_ep); +if (bnx2i_send_conn_ofld_req (hba, bnx2i_ep)) { +if (bnx2i_ep->state ==EP_STATE_OFLD_FAILED_CID_BUSY ) { +printk (KERN_ALERT "bnx2i (%s): iscsi cid %d is busy\n" , + hba->netdev->name, bnx2i_ep->ep_iscsi_cid); + rc = -EBUSY ; + }else + rc = -ENOSPC ; +printk (KERN_ALERT "bnx2i (%s): unable to send conn offld kwqe" +"\n" , hba->netdev->name); +bnx2i_ep_ofld_list_del (hba, bnx2i_ep); + goto conn_failed; + }/* Wait for CNIC hardware to setup conn context and return 'cid' */ wait_event_interruptible(bnx2i_ep->ofld_wait,
Signature · 1 line
1.7.0.5
PATCH v3 11/13 BNX2I: Cleaned up various error conditions in ep_connect/disconnect
In reply to a message not in the archiveVarious error conditions inside ep_connect and ep_disconnect were either not being handled or not being handled correctly. This patch fixes all those issues.
--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 67 ++++++++++++++++++++++--------------- 1 files changed, 40 insertions(+), 27 deletions(-)
drivers/scsi/bnx2i/bnx2i_iscsi.c +40 -27
@@ -411,7 +411,9 @@ static void bnx2i_free_ep(struct iscsi_endpoint *ep) bnx2i_ep->state =EP_STATE_IDLE ; bnx2i_ep->hba->ofld_conns_active--; -bnx2i_free_iscsi_cid (bnx2i_ep->hba, bnx2i_ep->ep_iscsi_cid); +if (bnx2i_ep->ep_iscsi_cid != (u16) -1 ) +bnx2i_free_iscsi_cid (bnx2i_ep->hba, bnx2i_ep->ep_iscsi_cid); +if (bnx2i_ep->conn) { bnx2i_ep->conn->ep =NULL ; bnx2i_ep->conn =NULL ;
@@ -1738,13 +1740,17 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost,*/ hba =bnx2i_check_route (dst_addr); -if (!hba ||test_bit (ADAPTER_STATE_GOING_DOWN , &hba->adapter_state)) { +if (!hba) { rc = -EINVAL ; goto nohba; } +mutex_lock (&hba->net_dev_lock); +if (bnx2i_adapter_ready (hba) || !hba->cid_que.cid_free_cnt) { + rc = -EPERM ; + goto check_busy; + } cnic = hba->cnic; -mutex_lock (&hba->net_dev_lock); ep =bnx2i_alloc_ep (hba);if (!ep) { rc = -ENOMEM ;
@@ -1752,23 +1758,21 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost, } bnx2i_ep = ep->dd_data; -if (bnx2i_adapter_ready (hba)) { - rc = -EPERM ; - goto net_if_down; - } - bnx2i_ep->num_active_cmds =0 ; iscsi_cid =bnx2i_alloc_iscsi_cid (hba);if (iscsi_cid ==-1 ) { -printk (KERN_ALERT "alloc_ep: unable to allocate iscsi cid\n" ); +printk (KERN_ALERT "bnx2i (%s): alloc_ep - unable to allocate " +"iscsi cid\n" , hba->netdev->name); rc = -ENOMEM ; - goto iscsi_cid_err; +bnx2i_free_ep (ep); + goto check_busy; } bnx2i_ep->hba_age = hba->age; rc =bnx2i_alloc_qp_resc (hba, bnx2i_ep);if (rc !=0 ) { -printk (KERN_ALERT "bnx2i: ep_conn, alloc QP resc error\n" ); +printk (KERN_ALERT "bnx2i (%s): ep_conn - alloc QP resc error" +"\n" , hba->netdev->name); rc = -ENOMEM ; goto qp_resc_err; }
@@ -1807,7 +1811,12 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost,bnx2i_ep_ofld_list_del (hba, bnx2i_ep);if (bnx2i_ep->state !=EP_STATE_OFLD_COMPL ) { - rc = -ENOSPC ; +if (bnx2i_ep->state ==EP_STATE_OFLD_FAILED_CID_BUSY ) { +printk (KERN_ALERT "bnx2i (%s): iscsi cid %d is busy\n" , + hba->netdev->name, bnx2i_ep->ep_iscsi_cid); + rc = -EBUSY ; + }else + rc = -ENOSPC ; goto conn_failed; }
@@ -1815,7 +1824,8 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost, iscsi_cid, &bnx2i_ep->cm_sk, bnx2i_ep);if (rc) { rc = -EINVAL ; - goto conn_failed; +/* Need to terminate and cleanup the connection */ + goto release_ep; } bnx2i_ep->cm_sk->rcv_buf =256 *1024 ;
@@ -1859,8 +1869,6 @@ release_ep:return ERR_PTR (rc); } conn_failed: -net_if_down: -iscsi_cid_err:bnx2i_free_qp_resc (hba, bnx2i_ep); qp_resc_err:bnx2i_free_ep (ep);
@@ -1979,7 +1987,8 @@ int bnx2i_hw_ep_disconnect(struct bnx2i_endpoint *bnx2i_ep)if (!cnic)return 0 ; -if (bnx2i_ep->state ==EP_STATE_IDLE ) +if (bnx2i_ep->state ==EP_STATE_IDLE || + bnx2i_ep->state ==EP_STATE_DISCONN_TIMEDOUT )return 0 ;if (!bnx2i_ep_tcp_conn_active (bnx2i_ep))
@@ -2005,9 +2014,10 @@ int bnx2i_hw_ep_disconnect(struct bnx2i_endpoint *bnx2i_ep)if (session->state ==ISCSI_STATE_LOGGING_OUT ) {if (bnx2i_ep->state ==EP_STATE_LOGOUT_SENT ) {/* Logout sent, but no resp */ -printk (KERN_ALERT "bnx2i - WARNING " -"logout response was not " -"received!\n" ); +printk (KERN_ALERT "bnx2i (%s): WARNING" +" logout response was not " +"received!\n" , + bnx2i_ep->hba->netdev->name); }else if (bnx2i_ep->state ==EP_STATE_LOGOUT_RESP_RCVD ) close =1 ;
@@ -2025,9 +2035,8 @@ int bnx2i_hw_ep_disconnect(struct bnx2i_endpoint *bnx2i_ep)else close_ret = cnic->cm_abort (bnx2i_ep->cm_sk); -/* No longer allow CFC delete if cm_close/abort fails the request */ if (close_ret) -printk (KERN_ALERT "bnx2i: %s close/abort(%d) returned %d\n" , +printk (KERN_ALERT "bnx2i (%s): close/abort(%d) returned %d\n" , bnx2i_ep->hba->netdev->name, close, close_ret);else /* wait for option-2 conn teardown */
@@ -2041,7 +2050,7 @@ int bnx2i_hw_ep_disconnect(struct bnx2i_endpoint *bnx2i_ep) destroy_conn:bnx2i_ep_active_list_del (hba, bnx2i_ep);if (bnx2i_tear_down_conn (hba, bnx2i_ep)) - ret = -EINVAL ; +return -EINVAL ; out: bnx2i_ep->state =EP_STATE_IDLE ;return ret;
@@ -2080,14 +2089,17 @@ static void bnx2i_ep_disconnect(struct iscsi_endpoint *ep)mutex_lock (&hba->net_dev_lock); -if (bnx2i_ep->state ==EP_STATE_IDLE ) - goto return_bnx2i_ep; +if (bnx2i_ep->state ==EP_STATE_DISCONN_TIMEDOUT ) + goto out; -if (!test_bit (ADAPTER_STATE_UP , &hba->adapter_state)) +if (bnx2i_ep->state ==EP_STATE_IDLE ) goto free_resc; -if (bnx2i_ep->hba_age != hba->age) +if (!test_bit (ADAPTER_STATE_UP , &hba->adapter_state) || + (bnx2i_ep->hba_age != hba->age)) { +bnx2i_ep_active_list_del (hba, bnx2i_ep); goto free_resc; + }/* Do all chip cleanup here */ if (bnx2i_hw_ep_disconnect (bnx2i_ep)) {
@@ -2096,11 +2108,12 @@ static void bnx2i_ep_disconnect(struct iscsi_endpoint *ep) } free_resc:bnx2i_free_qp_resc (hba, bnx2i_ep); -return_bnx2i_ep: +if (bnx2i_conn) bnx2i_conn->ep =NULL ;bnx2i_free_ep (ep); +out:mutex_unlock (&hba->net_dev_lock);wake_up_interruptible (&hba->eh_wait);
Signature · 1 line
1.7.0.5
PATCH v3 12/13 BNX2I: Updated copyright and maintainer info
In reply to a message not in the archive--- drivers/scsi/bnx2i/57xx_iscsi_constants.h | 3 ++- drivers/scsi/bnx2i/57xx_iscsi_hsi.h | 3 ++- drivers/scsi/bnx2i/bnx2i.h | 3 ++- drivers/scsi/bnx2i/bnx2i_hwi.c | 3 ++- drivers/scsi/bnx2i/bnx2i_init.c | 3 ++- drivers/scsi/bnx2i/bnx2i_iscsi.c | 3 ++- drivers/scsi/bnx2i/bnx2i_sysfs.c | 3 ++- 7 files changed, 14 insertions(+), 7 deletions(-)
drivers/scsi/bnx2i/57xx_iscsi_constants.h +2 -1
@@ -1,12 +1,13 @@/* 57xx_iscsi_constants.h: Broadcom NetXtreme II iSCSI HSI * -* Copyright (c) 2006 - 2009 Broadcom Corporation +* Copyright (c) 2006 - 2010 Broadcom Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation. * * Written by: Anil Veerabhadrappa ([email protected]) +* Maintained by: Eddie Wai ([email protected]) */ #ifndef __57XX_ISCSI_CONSTANTS_H_#define __57XX_ISCSI_CONSTANTS_H_
drivers/scsi/bnx2i/57xx_iscsi_hsi.h +2 -1
@@ -1,12 +1,13 @@/* 57xx_iscsi_hsi.h: Broadcom NetXtreme II iSCSI HSI. * -* Copyright (c) 2006 - 2009 Broadcom Corporation +* Copyright (c) 2006 - 2010 Broadcom Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation. * * Written by: Anil Veerabhadrappa ([email protected]) +* Maintained by: Eddie Wai ([email protected]) */ #ifndef __57XX_ISCSI_HSI_LINUX_LE__#define __57XX_ISCSI_HSI_LINUX_LE__
drivers/scsi/bnx2i/bnx2i.h +2 -1
@@ -1,6 +1,6 @@/* bnx2i.h: Broadcom NetXtreme II iSCSI driver. * -* Copyright (c) 2006 - 2009 Broadcom Corporation +* Copyright (c) 2006 - 2010 Broadcom Corporation * Copyright (c) 2007, 2008 Red Hat, Inc. All rights reserved. * Copyright (c) 2007, 2008 Mike Christie *
@@ -9,6 +9,7 @@* the Free Software Foundation. * * Written by: Anil Veerabhadrappa ([email protected]) +* Maintained by: Eddie Wai ([email protected]) */ #ifndef _BNX2I_H_
drivers/scsi/bnx2i/bnx2i_hwi.c +2 -1
@@ -1,6 +1,6 @@/* bnx2i_hwi.c: Broadcom NetXtreme II iSCSI driver. * -* Copyright (c) 2006 - 2009 Broadcom Corporation +* Copyright (c) 2006 - 2010 Broadcom Corporation * Copyright (c) 2007, 2008 Red Hat, Inc. All rights reserved. * Copyright (c) 2007, 2008 Mike Christie *
@@ -9,6 +9,7 @@* the Free Software Foundation. * * Written by: Anil Veerabhadrappa ([email protected]) +* Maintained by: Eddie Wai ([email protected]) */ #include <linux/gfp.h>
drivers/scsi/bnx2i/bnx2i_init.c +2 -1
@@ -1,6 +1,6 @@/* bnx2i.c: Broadcom NetXtreme II iSCSI driver. * -* Copyright (c) 2006 - 2009 Broadcom Corporation +* Copyright (c) 2006 - 2010 Broadcom Corporation * Copyright (c) 2007, 2008 Red Hat, Inc. All rights reserved. * Copyright (c) 2007, 2008 Mike Christie *
@@ -9,6 +9,7 @@* the Free Software Foundation. * * Written by: Anil Veerabhadrappa ([email protected]) +* Maintained by: Eddie Wai ([email protected]) */ #include "bnx2i.h"
drivers/scsi/bnx2i/bnx2i_iscsi.c +2 -1
@@ -1,7 +1,7 @@/* * bnx2i_iscsi.c: Broadcom NetXtreme II iSCSI driver. * -* Copyright (c) 2006 - 2009 Broadcom Corporation +* Copyright (c) 2006 - 2010 Broadcom Corporation * Copyright (c) 2007, 2008 Red Hat, Inc. All rights reserved. * Copyright (c) 2007, 2008 Mike Christie *
@@ -10,6 +10,7 @@* the Free Software Foundation. * * Written by: Anil Veerabhadrappa ([email protected]) +* Maintained by: Eddie Wai ([email protected]) */ #include <linux/slab.h>
drivers/scsi/bnx2i/bnx2i_sysfs.c +2 -1
@@ -1,12 +1,13 @@/* bnx2i_sysfs.c: Broadcom NetXtreme II iSCSI driver. * -* Copyright (c) 2004 - 2009 Broadcom Corporation +* Copyright (c) 2004 - 2010 Broadcom Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation. * * Written by: Anil Veerabhadrappa ([email protected]) +* Maintained by: Eddie Wai ([email protected]) */ #include "bnx2i.h"
Signature · 1 line
1.7.0.5
PATCH v3 13/13 BNX2I: Updated version to 2.6.2.2
In reply to a message not in the archive--- drivers/scsi/bnx2i/bnx2i_init.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/bnx2i/bnx2i_init.c +2 -2
@@ -18,8 +18,8 @@ static struct list_head adapter_list = LIST_HEAD_INIT(adapter_list);static u32 adapter_count;#define DRV_MODULE_NAME "bnx2i" -#define DRV_MODULE_VERSION "2.1.3" -#define DRV_MODULE_RELDATE "Aug 10, 2010" +#define DRV_MODULE_VERSION "2.6.2.2" +#define DRV_MODULE_RELDATE "Nov 23, 2010"static char version[]__devinitdata ="Broadcom NetXtreme II iSCSI Driver " DRV_MODULE_NAME \
Signature · 1 line
1.7.0.5
PATCH 1/8 BNX2I: Allow ep CONNECT_FAILED condition to go through proper cleanup
In reply to a message not in the archiveAllow CNIC to go through the proper cleanup procedure for an endpoint which failed to connect. Proper cleanup is necessary for the chip to reset back to the initial state for the offloaded endpoint.
--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/bnx2i/bnx2i_iscsi.c +1 -1
@@ -1935,13 +1935,13 @@ static int bnx2i_ep_tcp_conn_active(struct bnx2i_endpoint *bnx2i_ep) cnic_dev_10g =1 ;switch (bnx2i_ep->state) { -case EP_STATE_CONNECT_FAILED :case EP_STATE_CLEANUP_FAILED :case EP_STATE_OFLD_FAILED :case EP_STATE_DISCONN_TIMEDOUT : ret =0 ;break ;case EP_STATE_CONNECT_START : +case EP_STATE_CONNECT_FAILED :case EP_STATE_CONNECT_COMPL :case EP_STATE_ULP_UPDATE_START :case EP_STATE_ULP_UPDATE_COMPL :
Signature · 1 line
1.7.0.5
PATCH 2/8 BNX2I: Fixed the 32-bit swapping of the LUN field for nopouts for 5771X
In reply to a message not in the archiveFixed a bug where the 64-bit LUN field for nopouts were 32-bit swapped. This only pertains to 5771X devices.
--- drivers/scsi/bnx2i/bnx2i_hwi.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/bnx2i/bnx2i_hwi.c +3 -3
@@ -498,10 +498,10 @@ int bnx2i_send_iscsi_nopout(struct bnx2i_conn *bnx2i_conn,memcpy (nopout_wqe->lun, nopout_hdr->lun,8 );if (test_bit (BNX2I_NX2_DEV_57710 , &ep->hba->cnic_dev_type)) { -u32 tmp = nopout_hdr->lun[0 ]; +u32 tmp = nopout_wqe->lun[0 ];/* 57710 requires LUN field to be swapped */ - nopout_hdr->lun[0 ] = nopout_hdr->lun[1 ]; - nopout_hdr->lun[1 ] = tmp; + nopout_wqe->lun[0 ] = nopout_wqe->lun[1 ]; + nopout_wqe->lun[1 ] = tmp; } nopout_wqe->itt = ((u16)task->itt |
Signature · 1 line
1.7.0.5
cover Added bug fixes and several features for BNX2I
In reply to a message not in the archiveHello,
This patch set contains two fixes and added various features as titled. The two fixes are:
1 - connection cleanup fix which fixes a chip panic issue
2 - nopout LUN field fix which fixes nopout timeouts
The features added includes TCP timestamp, jumbo MTU, text pdu support for discovery offload, and 57712(E) support.
Please review. Thanks.
Eddie
Eddie Wai (8):
BNX2I: Allow ep CONNECT_FAILED condition to go through proper cleanup
BNX2I: Fixed the 32-bit swapping of the LUN field for nopouts for
5771X
BNX2I: Added handling for unsupported iSCSI offload hba
BNX2I: Added support for the 57712(E) devices
BNX2I: Added TCP timestamps option support
BNX2I: Added jumbo MTU support for the no shost case
BNX2I: Added iSCSI text pdu support for iSCSI offload
BNX2I: Updated to version 2.6.2.3
drivers/net/bnx2x/bnx2x_main.c | 7 -- drivers/scsi/bnx2i/bnx2i.h | 5 +- drivers/scsi/bnx2i/bnx2i_hwi.c | 122 +++++++++++++++++++++++++++++++++++++- drivers/scsi/bnx2i/bnx2i_init.c | 33 ++++++++-- drivers/scsi/bnx2i/bnx2i_iscsi.c | 10 +++- include/linux/pci_ids.h | 2 + 6 files changed, 160 insertions(+), 19 deletions(-)
Re: [PATCH 0/8] Added bug fixes and several features for BNX2I
Quoted 6 lines · Eddie Wai
Hello,
This patch set contains two fixes and added various features as titled. The two fixes are:
1 - connection cleanup fix which fixes a chip panic issue
2 - nopout LUN field fix which fixes nopout timeouts
So the immediate question is do these need backporting to earlier kernels via the stable tree (in which case a cc: [email protected] tag would be needed)?
James
Quoted 30 lines
The features added includes TCP timestamp, jumbo MTU, text pdu support for discovery offload, and 57712(E) support.
Please review. Thanks.
EddieEddie Wai (8):
BNX2I: Allow epCONNECT_FAILEDcondition to go through proper cleanup
BNX2I: Fixed the 32-bit swapping of the LUN field for nopouts for5771XBNX2I: Added handling for unsupported iSCSI offload hba
BNX2I: Added support for the 57712(E) devices
BNX2I: Added TCP timestamps option support
BNX2I: Added jumbo MTU support for the no shost case
BNX2I: Added iSCSI text pdu support for iSCSI offload
BNX2I: Updated to version 2.6.2.3drivers/net/bnx2x/bnx2x_main.c | 7 -- drivers/scsi/bnx2i/bnx2i.h | 5 +- drivers/scsi/bnx2i/bnx2i_hwi.c | 122 +++++++++++++++++++++++++++++++++++++- drivers/scsi/bnx2i/bnx2i_init.c | 33 ++++++++-- drivers/scsi/bnx2i/bnx2i_iscsi.c | 10 +++- include/linux/pci_ids.h | 2 + 6 files changed, 160 insertions(+), 19 deletions(-)--
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
A message that is not in the archive (sent off-list or not yet received): 1294260724.16957.29.camel-0iu6Cu4xQGLYCGPCin2YbQ@public.gmane.org
Re: [PATCH 0/8] Added bug fixes and several features for BNX2I
Quoted 11 lines · James Bottomley
Quoted 6 lines · Eddie Wai
Hello,
This patch set contains two fixes and added various features as titled. The two fixes are:
1 - connection cleanup fix which fixes a chip panic issue
2 - nopout LUN field fix which fixes nopout timeoutsSo the immediate question is do these need backporting to earlier
kernels via the stable tree (in which case a cc: [email protected] tag would be needed)?
Both bugs have been present in the code for quite a while. I think its just recently that they got exposed. The severity of the chip panic is higher as the chip will need to be reset to recover. But it's not easy to trigger this and was found only by our PQA doing extraordinary tests. The nopout LUN bug is more common and will hamper I/O performance if the nopout LUN field is not 32-bit symmetric. But the result is not catastrophic.
I would recommend having these be backported to the stable tree if possible. Let me know if you want to move forward with the stable tree patch. Thanks.
Quoted 37 lines
James
Quoted 30 lines
The features added includes TCP timestamp, jumbo MTU, text pdu support for discovery offload, and 57712(E) support.
Please review. Thanks.
EddieEddie Wai (8):
BNX2I: Allow epCONNECT_FAILEDcondition to go through proper cleanup
BNX2I: Fixed the 32-bit swapping of the LUN field for nopouts for5771XBNX2I: Added handling for unsupported iSCSI offload hba
BNX2I: Added support for the 57712(E) devices
BNX2I: Added TCP timestamps option support
BNX2I: Added jumbo MTU support for the no shost case
BNX2I: Added iSCSI text pdu support for iSCSI offload
BNX2I: Updated to version 2.6.2.3drivers/net/bnx2x/bnx2x_main.c | 7 -- drivers/scsi/bnx2i/bnx2i.h | 5 +- drivers/scsi/bnx2i/bnx2i_hwi.c | 122 +++++++++++++++++++++++++++++++++++++- drivers/scsi/bnx2i/bnx2i_init.c | 33 ++++++++-- drivers/scsi/bnx2i/bnx2i_iscsi.c | 10 +++- include/linux/pci_ids.h | 2 + 6 files changed, 160 insertions(+), 19 deletions(-)--
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
Signature · 4 lines
You received this message because you are subscribed to the Google Groups "open-iscsi" group. To post to this group, send email to open-iscsi-/JYPxA39Uh5TLH3MbocFF+G/[email protected] To unsubscribe from this group, send email to open-iscsi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] For more options, visit this group at http://groups.google.com/group/open-iscsi?hl=en.
Re: [PATCH 0/8] Added bug fixes and several features for BNX2I
In reply to Eddie WaiQuoted 9 lines · Eddie Wai
Hello,
This patch set contains two fixes and added various features as titled. The two fixes are:
1 - connection cleanup fix which fixes a chip panic issue
2 - nopout LUN field fix which fixes nopout timeoutsThe features added includes TCP timestamp, jumbo MTU, text pdu support for discovery offload, and 57712(E) support.
All patches but "[PATCH 5/8] BNX2I: Added TCP timestamps option support" look ok. I am working on a common way to set tcp settings for 2.6.39, so lets wait on that.
Quoted 1 line
BNX2I: Added TCP timestamps option support
Mike Christie
Reviewed-byRe: [PATCH 0/8] Added bug fixes and several features for BNX2I
Quoted 8 lines · Mike Christie
Quoted 7 lines · Eddie Wai
Hello,
This patch set contains two fixes and added various features as titled. The two fixes are:
1 - connection cleanup fix which fixes a chip panic issue
2 - nopout LUN field fix which fixes nopout timeouts
Quoted 7 lines
Quoted 2 lines
The features added includes TCP timestamp, jumbo MTU, text pdu support for discovery offload, and 57712(E) support.
All patches but "[PATCH 5/8] BNX2I: Added TCP timestamps option support" look ok. I am working on a common way to set tcp settings for 2.6.39, so lets wait on that.
I think I miswrote that. I meant to write all patches except "[PATCH 5/8] BNX2I: Added TCP timestamps option support" are ok so:
on them.
This patch
"[PATCH 5/8] BNX2I: Added TCP timestamps option support" should be done generically so just drop this patch.
PATCH 3/8 BNX2I: Added handling for unsupported iSCSI offload hba
In reply to a message not in the archiveThe hba will now be unregistered and freed when iSCSI offload is not supported by the NIC.
--- drivers/scsi/bnx2i/bnx2i_init.c | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-)
drivers/scsi/bnx2i/bnx2i_init.c +15 -0
@@ -161,6 +161,21 @@ void bnx2i_start(void *handle)struct bnx2i_hba *hba = handle;int i =HZ ; +if (!hba->cnic->max_iscsi_conn) { +printk (KERN_ALERT "bnx2i: dev %s does not support " +"iSCSI\n" , hba->netdev->name); + +if (test_bit (BNX2I_CNIC_REGISTERED , &hba->reg_with_cnic)) { +mutex_lock (&bnx2i_dev_lock); +list_del_init (&hba->link); + adapter_count--; + hba->cnic->unregister_device (hba->cnic,CNIC_ULP_ISCSI ); +clear_bit (BNX2I_CNIC_REGISTERED , &hba->reg_with_cnic); +mutex_unlock (&bnx2i_dev_lock); +bnx2i_free_hba (hba); + } +return ; + }bnx2i_send_fw_iscsi_init_msg (hba);while (!test_bit (ADAPTER_STATE_UP , &hba->adapter_state) && i--)msleep (BNX2I_INIT_POLL_TIME );
Signature · 1 line
1.7.0.5
PATCH 4/8 BNX2I: Added support for the 57712(E) devices
In reply to a message not in the archiveMoved all PCI_DEVICE_ID_NX2_57712(E) definitions to pci_ids.h
--- drivers/net/bnx2x/bnx2x_main.c | 7 ------- drivers/scsi/bnx2i/bnx2i_init.c | 10 ++++++---- include/linux/pci_ids.h | 2 ++ 3 files changed, 8 insertions(+), 11 deletions(-)
drivers/net/bnx2x/bnx2x_main.c +0 -7
@@ -140,13 +140,6 @@ static struct { { "Broadcom NetXtreme II BCM57712E XGb" } }; -#ifndef PCI_DEVICE_ID_NX2_57712 -#define PCI_DEVICE_ID_NX2_57712 0x1662 -#endif -#ifndef PCI_DEVICE_ID_NX2_57712E -#define PCI_DEVICE_ID_NX2_57712E 0x1663 -#endif -static DEFINE_PCI_DEVICE_TABLE (bnx2x_pci_tbl) = { {PCI_VDEVICE (BROADCOM ,PCI_DEVICE_ID_NX2_57710 ),BCM57710 }, {PCI_VDEVICE (BROADCOM ,PCI_DEVICE_ID_NX2_57711 ),BCM57711 },
drivers/scsi/bnx2i/bnx2i_init.c +6 -4
@@ -29,7 +29,7 @@ static char version[] __devinitdata =MODULE_AUTHOR ("Anil Veerabhadrappa <[email protected]> and " "Eddie Wai <[email protected]>" ); -MODULE_DESCRIPTION ("Broadcom NetXtreme II BCM5706/5708/5709/57710/57711" +MODULE_DESCRIPTION ("Broadcom NetXtreme II BCM5706/5708/5709/57710/57711/57712" " iSCSI Driver" );MODULE_LICENSE ("GPL" );MODULE_VERSION (DRV_MODULE_VERSION );
@@ -88,9 +88,11 @@ void bnx2i_identify_device(struct bnx2i_hba *hba) (hba->pci_did == PCI_DEVICE_ID_NX2_5709S)) {set_bit (BNX2I_NX2_DEV_5709 , &hba->cnic_dev_type); hba->mail_queue_access =BNX2I_MQ_BIN_MODE ; - } else if (hba->pci_did == PCI_DEVICE_ID_NX2_57710 || - hba->pci_did == PCI_DEVICE_ID_NX2_57711 || - hba->pci_did == PCI_DEVICE_ID_NX2_57711E) + } else if (hba->pci_did == PCI_DEVICE_ID_NX2_57710 || + hba->pci_did == PCI_DEVICE_ID_NX2_57711 || + hba->pci_did == PCI_DEVICE_ID_NX2_57711E || + hba->pci_did == PCI_DEVICE_ID_NX2_57712 || + hba->pci_did == PCI_DEVICE_ID_NX2_57712E) set_bit(BNX2I_NX2_DEV_57710, &hba->cnic_dev_type); else printk(KERN_ALERT "bnx2i: unknown device, 0x%x\n",
include/linux/pci_ids.h +2 -0
@@ -2067,6 +2067,8 @@#define PCI_DEVICE_ID_TIGON3_5723 0x165b#define PCI_DEVICE_ID_TIGON3_5705M 0x165d#define PCI_DEVICE_ID_TIGON3_5705M_2 0x165e +#define PCI_DEVICE_ID_NX2_57712 0x1662 +#define PCI_DEVICE_ID_NX2_57712E 0x1663#define PCI_DEVICE_ID_TIGON3_5714 0x1668#define PCI_DEVICE_ID_TIGON3_5714S 0x1669#define PCI_DEVICE_ID_TIGON3_5780 0x166a
Signature · 1 line
1.7.0.5
PATCH 5/8 BNX2I: Added TCP timestamps option support
In reply to a message not in the archiveThis TCP timestamps option is a module wise feature which can be enabled via the module param (time_stamps). Once enabled, the TCP connection will advertise timestamps as an option to get negotiated.
--- drivers/scsi/bnx2i/bnx2i.h | 1 + drivers/scsi/bnx2i/bnx2i_init.c | 4 ++++ drivers/scsi/bnx2i/bnx2i_iscsi.c | 2 ++ 3 files changed, 7 insertions(+), 0 deletions(-)
drivers/scsi/bnx2i/bnx2i.h +1 -0
@@ -701,6 +701,7 @@ struct bnx2i_endpoint {extern unsigned int error_mask1, error_mask2;extern u64 iscsi_error_mask;extern unsigned int en_tcp_dack; +extern unsigned int time_stamps;extern unsigned int event_coal_div;extern unsigned int event_coal_min;
drivers/scsi/bnx2i/bnx2i_init.c +4 -0
@@ -48,6 +48,10 @@ unsigned int en_tcp_dack = 1;module_param (en_tcp_dack, int,0664 );MODULE_PARM_DESC (en_tcp_dack,"Enable TCP Delayed ACK" ); +unsigned int time_stamps =0x00 ; +module_param (time_stamps, int,0664 ); +MODULE_PARM_DESC (time_stamps,"Enable TCP TimeStamps [1 = Enable]" ); +unsigned int error_mask1 =0x00 ;module_param (error_mask1, int,0664 );MODULE_PARM_DESC (error_mask1,"Config FW iSCSI Error Mask #1" );
drivers/scsi/bnx2i/bnx2i_iscsi.c +2 -0
@@ -1832,6 +1832,8 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost, bnx2i_ep->cm_sk->rcv_buf =256 *1024 ; bnx2i_ep->cm_sk->snd_buf =256 *1024 ;clear_bit (SK_TCP_TIMESTAMP , &bnx2i_ep->cm_sk->tcp_flags); +if (time_stamps) +set_bit (SK_TCP_TIMESTAMP , &bnx2i_ep->cm_sk->tcp_flags);memset (&saddr,0 ,sizeof (saddr));if (dst_addr->sa_family ==AF_INET ) {
Signature · 1 line
1.7.0.5
Re: [PATCH 5/8] BNX2I: Added TCP timestamps option support
Quoted 4 lines · Eddie Wai
This TCP timestamps option is a module wise feature which can be enabled via the module param (
time_stamps). Once enabled, the TCP connection will advertise timestamps as an option to get negotiated.
Is there any reason this has to be module wide? Can the hw support having it per connection?
Re: [PATCH 5/8] BNX2I: Added TCP timestamps option support
Quoted 9 lines · Mike Christie
Quoted 4 lines · Eddie Wai
This TCP timestamps option is a module wise feature which can be enabled via the module param (
time_stamps). Once enabled, the TCP connection will advertise timestamps as an option to get negotiated.Is there any reason this has to be module wide? Can the hw support having it per connection?
Oh yeah, what other tcp settings do you guys have? And do you have something like a send/recv window setting?
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 5/8] BNX2I: Added TCP timestamps option support
Quoted 11 lines · Mike Christie
Quoted 9 lines · Mike Christie
Quoted 4 lines · Eddie Wai
This TCP timestamps option is a module wise feature which can be enabled via the module param (
time_stamps). Once enabled, the TCP connection will advertise timestamps as an option to get negotiated.Is there any reason this has to be module wide? Can the hw support having it per connection?
Ya, the hw can indeed support TCP time stamp on a per connection based. It would be great if perhaps we can support this via open-iscsi and have a tcp option's parameter in the nodes?
Quoted 2 lines
Oh yeah, what other tcp settings do you guys have? And do you have something like a send/recv window setting?
At this time, the TCP windows/scale setting is not an option we can alter from the driver. But some of the other options like delay ACK, nagle, sack are supported (depends on individual chipset as well).
Quoted 1 line
Signature · 4 lines
You received this message because you are subscribed to the Google Groups "open-iscsi" group. To post to this group, send email to open-iscsi-/JYPxA39Uh5TLH3MbocFF+G/[email protected] To unsubscribe from this group, send email to open-iscsi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] For more options, visit this group at http://groups.google.com/group/open-iscsi?hl=en.
PATCH 6/8 BNX2I: Added jumbo MTU support for the no shost case
In reply to a message not in the archiveFor scenarios where the shost is not being passed to bnx2i for the iSCSI offload connection request, the code would consult the routing table to select the CNIC device.
This code path will erroneously error out if the corresponding L2 interface's MTU has been setup to > 1500.
--- drivers/scsi/bnx2i/bnx2i.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/bnx2i/bnx2i.h +1 -1
@@ -360,7 +360,7 @@ struct bnx2i_hba {#define ADAPTER_STATE_LINK_DOWN 2#define ADAPTER_STATE_INIT_FAILED 31unsigned int mtu_supported; -#define BNX2I_MAX_MTU_SUPPORTED 1500 +#define BNX2I_MAX_MTU_SUPPORTED 9000struct Scsi_Host *shost;
Signature · 1 line
1.7.0.5
Re: [PATCH 6/8] BNX2I: Added jumbo MTU support for the no shost case
Quoted 6 lines · Eddie Wai
For scenarios where the shost is not being passed to bnx2i for the iSCSI offload connection request, the code would consult the routing table to select the CNIC device.
This code path will erroneously error out if the corresponding L2 interface's MTU has been setup to> 1500.
When have you guys actually hit this? What tools and what version does this?
Re: [PATCH 6/8] BNX2I: Added jumbo MTU support for the no shost case
Quoted 9 lines · Mike Christie
Quoted 6 lines · Eddie Wai
For scenarios where the shost is not being passed to bnx2i for the iSCSI offload connection request, the code would consult the routing table to select the CNIC device.
This code path will erroneously error out if the corresponding L2 interface's MTU has been setup to> 1500.When have you guys actually hit this? What tools and what version does this?
I believe we had run into this case in the past by not specifying the ifacename parameter in a static node but use transport of bnx2i. I would have to go back and revisit that for verification. But its a scenario our driver has supports for in the past. The jumbo MTU support was added to the shost case a while back. Adding this is more for completeness.
Quoted 1 line
PATCH 7/8 BNX2I: Added iSCSI text pdu support for iSCSI offload
In reply to a message not in the archiveThis is part of an effort to support send target discovery via the iSCSI offload path.
--- drivers/scsi/bnx2i/bnx2i.h | 2 + drivers/scsi/bnx2i/bnx2i_hwi.c | 116 ++++++++++++++++++++++++++++++++++++++ drivers/scsi/bnx2i/bnx2i_iscsi.c | 6 ++- 3 files changed, 123 insertions(+), 1 deletions(-)
drivers/scsi/bnx2i/bnx2i.h +2 -0
@@ -752,6 +752,8 @@ extern int bnx2i_send_iscsi_login(struct bnx2i_conn *conn, struct iscsi_task *mtask);extern int bnx2i_send_iscsi_tmf (struct bnx2i_conn *conn,struct iscsi_task *mtask); +extern int bnx2i_send_iscsi_text (struct bnx2i_conn *conn, +struct iscsi_task *mtask);extern int bnx2i_send_iscsi_scsicmd (struct bnx2i_conn *conn,struct bnx2i_cmd *cmnd); extern int bnx2i_send_iscsi_nopout(struct bnx2i_conn *conn,
drivers/scsi/bnx2i/bnx2i_hwi.c +116 -0
134 lines not on this page · raw message
drivers/scsi/bnx2i/bnx2i_iscsi.c +5 -1
@@ -1092,6 +1092,9 @@ static int bnx2i_iscsi_send_generic_request(struct iscsi_task *task)case ISCSI_OP_SCSI_TMFUNC : rc =bnx2i_send_iscsi_tmf (bnx2i_conn, task);break ; +case ISCSI_OP_TEXT : + rc =bnx2i_send_iscsi_text (bnx2i_conn, task); +break ;default : iscsi_conn_printk(KERN_ALERT, bnx2i_conn->cls_conn->dd_data, "send_gen: unsupported op 0x%x\n",
@@ -2169,7 +2172,8 @@ struct iscsi_transport bnx2i_iscsi_transport = { .name = "bnx2i", .caps =CAP_RECOVERY_L0 |CAP_HDRDGST |CAP_MULTI_R2T |CAP_DATADGST | - CAP_DATA_PATH_OFFLOAD, +CAP_DATA_PATH_OFFLOAD | + CAP_TEXT_NEGO, .param_mask =ISCSI_MAX_RECV_DLENGTH |ISCSI_MAX_XMIT_DLENGTH | ISCSI_HDRDGST_EN |
Signature · 1 line
1.7.0.5
PATCH 8/8 BNX2I: Updated to version 2.6.2.3
In reply to a message not in the archive--- drivers/scsi/bnx2i/bnx2i_init.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/bnx2i/bnx2i_init.c +2 -2
@@ -18,8 +18,8 @@ static struct list_head adapter_list = LIST_HEAD_INIT(adapter_list);static u32 adapter_count;#define DRV_MODULE_NAME "bnx2i" -#define DRV_MODULE_VERSION "2.6.2.2" -#define DRV_MODULE_RELDATE "Nov 23, 2010" +#define DRV_MODULE_VERSION "2.6.2.3" +#define DRV_MODULE_RELDATE "Dec 31, 2010"static char version[]__devinitdata ="Broadcom NetXtreme II iSCSI Driver " DRV_MODULE_NAME \
Signature · 1 line
1.7.0.5
PATCH 1/1 BNX2I: Added reconnect fix connecting against Lefthand targets
In reply to a message not in the archiveThe nopout's reserved field was not being initialized to zero before being reused. Stale CDB values from previous SCSI cmds of the same BHS offset was the cause of the disconnection initiated by the Lefthand target.
--- drivers/scsi/bnx2i/bnx2i_hwi.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/scsi/bnx2i/bnx2i_hwi.c +3 -0
@@ -490,6 +490,9 @@ int bnx2i_send_iscsi_nopout(struct bnx2i_conn *bnx2i_conn, bnx2i_cmd = (struct bnx2i_cmd *)task->dd_data; nopout_hdr = (struct iscsi_nopout *)task->hdr; nopout_wqe = (struct bnx2i_nop_out_request *)ep->qp.sq_prod_qe; + +memset (nopout_wqe,0x00 ,sizeof (struct bnx2i_nop_out_request )); + nopout_wqe->op_code = nopout_hdr->opcode; nopout_wqe->op_attr =ISCSI_FLAG_CMD_FINAL ;memcpy (nopout_wqe->lun, nopout_hdr->lun,8 );
Signature · 1 line
1.7.0.5
Re: [PATCH] BNX2I: Added reconnect fix connecting against Lefthand targets
Quoted 15 lines · Eddie Wai
The nopout's reserved field was not being initialized to zero before being reused. Stale CDB values from previous SCSI cmds of the same BHS offset was the cause of the disconnection initiated by the Lefthand target.
Signed-off-by Eddie Wai<[email protected]>--- drivers/scsi/bnx2i/bnx2i_hwi.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)drivers/scsi/bnx2i/bnx2i_hwi.c +0
-0
drivers/scsi/bnx2i/bnx2i_hwi.c int bnx2i_send_iscsi_nopout(struct bnx2i_conn *bnx2i_conn, · line 498
Quoted 9 lines
drivers/scsi/bnx2i/bnx2i_hwi.c +3
-0@@ -490,6 +490,9 @@ int bnx2i_send_iscsi_nopout(struct bnx2i_conn *bnx2i_conn, bnx2i_cmd = (struct bnx2i_cmd *)task->dd_data; nopout_hdr = (struct iscsi_nopout *)task->hdr; nopout_wqe = (struct bnx2i_nop_out_request *)ep->qp.sq_prod_qe; + +memset (nopout_wqe,0x00 ,sizeof (struct bnx2i_nop_out_request )); + nopout_wqe->op_code = nopout_hdr->opcode; nopout_wqe->op_attr =ISCSI_FLAG_CMD_FINAL ;memcpy (nopout_wqe->lun, nopout_hdr->lun,8 );
Looks ok.
cover BNX2I: Bug fixes and Performance Optimization
In reply to a message not in the archiveHello,
This patch set contains a bug fix and some performance optimization for iSCSI offload connection cleanup/recovery and throughput.
Please review, thanks.
Eddie Wai (3):
BNX2I: Fixed packet error created when the sq_size is set to 16
BNX2I: Updated the connection shutdown/cleanup timeout
BNX2I: Optimized the iSCSI offload performance
drivers/scsi/bnx2i/bnx2i.h | 16 ++++++++++------ drivers/scsi/bnx2i/bnx2i_hwi.c | 27 +++++++++++++++------------ drivers/scsi/bnx2i/bnx2i_init.c | 2 +- drivers/scsi/bnx2i/bnx2i_iscsi.c | 13 +++++++++++-- 4 files changed, 37 insertions(+), 21 deletions(-)
Re: [PATCH 0/3] BNX2I: Bug fixes and Performance Optimization
Quoted 12 lines · Eddie Wai
Hello,
This patch set contains a bug fix and some performance optimization for iSCSI offload connection cleanup/recovery and throughput.
Please review, thanks.
Eddie Wai (3):
BNX2I: Fixed packet error created when thesq_sizeis set to 16
BNX2I: Updated the connection shutdown/cleanup timeout
BNX2I: Optimized the iSCSI offload performance
Quoted 6 lines
drivers/scsi/bnx2i/bnx2i.h | 16 ++++++++++------ drivers/scsi/bnx2i/bnx2i_hwi.c | 27 +++++++++++++++------------ drivers/scsi/bnx2i/bnx2i_init.c | 2 +- drivers/scsi/bnx2i/bnx2i_iscsi.c | 13 +++++++++++-- 4 files changed, 37 insertions(+), 21 deletions(-)
Got my question in the other mail answered.
Patches look ok.
PATCH 1/3 BNX2I: Fixed packet error created when the sq_size is set to 16
In reply to a message not in the archiveThe number of chip's internal command cell, which is use to generate SCSI cmd packets to the target, was not initialized correctly by the driver when the sq_size is changed from the default 128. This, in turn, will create a problem where the chip's transmit pipe will erroneously reuse an old command cell that is no longer valid. The fix is to correctly initialize the chip's command cell upon setup.
--- drivers/scsi/bnx2i/bnx2i_hwi.c | 1 + drivers/scsi/bnx2i/bnx2i_iscsi.c | 3 +++ 2 files changed, 4 insertions(+), 0 deletions(-)
drivers/scsi/bnx2i/bnx2i_hwi.c +1 -0
@@ -1274,6 +1274,7 @@ int bnx2i_send_fw_iscsi_init_msg(struct bnx2i_hba *hba) iscsi_init.dummy_buffer_addr_hi = (u32) ((u64 ) hba->dummy_buf_dma >>32 ); + hba->num_ccell = hba->max_sqes >>1 ; hba->ctx_ccell_tasks = ((hba->num_ccell &0xFFFF ) | (hba->max_sqes <<16 )); iscsi_init.num_ccells_per_conn = hba->num_ccell;
drivers/scsi/bnx2i/bnx2i_iscsi.c +3 -0
@@ -1208,6 +1208,9 @@ static int bnx2i_task_xmit(struct iscsi_task *task)struct bnx2i_cmd *cmd = task->dd_data;struct iscsi_cmd *hdr = (struct iscsi_cmd *) task->hdr; +if (bnx2i_conn->ep->num_active_cmds +1 > hba->max_sqes) +return -ENOMEM ; +/* * If there is no scsi_cmnd this must be a mgmt task */
Signature · 1 line
1.7.0.5
PATCH 2/3 BNX2I: Updated the connection shutdown/cleanup timeout
In reply to a message not in the archiveModified the 10s wait time for inflight offload connections to advance to the next state to 2s based on test result. Modified the 20s shutdown timeout to 30s based on test result.
--- drivers/scsi/bnx2i/bnx2i_init.c | 2 +- drivers/scsi/bnx2i/bnx2i_iscsi.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/bnx2i/bnx2i_init.c +1 -1
@@ -244,7 +244,7 @@ void bnx2i_stop(void *handle)wait_event_interruptible_timeout (hba->eh_wait, (list_empty (&hba->ep_ofld_list) &&list_empty (&hba->ep_destroy_list)), -10 *HZ ); +2 *HZ );/* Wait for all endpoints to be torn down, Chip will be reset once * control returns to network driver. So it is required to cleanup and * release all connection resources before returning from this routine.
drivers/scsi/bnx2i/bnx2i_iscsi.c +1 -1
@@ -858,7 +858,7 @@ struct bnx2i_hba *bnx2i_alloc_hba(struct cnic_dev *cnic)mutex_init (&hba->net_dev_lock);init_waitqueue_head (&hba->eh_wait);if (test_bit (BNX2I_NX2_DEV_57710 , &hba->cnic_dev_type)) { - hba->hba_shutdown_tmo =20 *HZ ; + hba->hba_shutdown_tmo =30 *HZ ; hba->conn_teardown_tmo =20 *HZ ; hba->conn_ctx_destroy_tmo =6 *HZ ; }else {/* 5706/5708/5709 */
Signature · 1 line
1.7.0.5
PATCH 3/3 BNX2I: Optimized the iSCSI offload performance
In reply to a message not in the archiveModified the event coalescing code for iSCSI offload to combat both corner cases and optimize performance as follows:
1. Added mechanism to loop back a second time to process any leftover CQEs that was generated by the hardware during the time the driver is busy processing previous CQEs in the bh. This not only helps the performance but also fixes the corner case when no more CQEs are being generated in the pipeline; so those leftover CQEs will get a a chance to be processed.
2. Added ARM_CQE_FP to distinguish between fast path arming versus slow path arming. This change will guarantee that the CQEs will always get a chance to be re-armed during fast path completions.
3. Removed the inline event coalescing division for perf optimization. Also fixed a division-by-zero error when the event_coal_div module param was set to 0.
4. Changed the default SQ WQEs size from 256 to 128 to match chip default.
5. Changed the cmd_per_lun from 32 to 24.
--- drivers/scsi/bnx2i/bnx2i.h | 16 ++++++++++------ drivers/scsi/bnx2i/bnx2i_hwi.c | 26 ++++++++++++++------------ drivers/scsi/bnx2i/bnx2i_iscsi.c | 8 +++++++- 3 files changed, 31 insertions(+), 19 deletions(-)
drivers/scsi/bnx2i/bnx2i.h +10 -6
@@ -66,11 +66,11 @@#define BD_SPLIT_SIZE 32768/* min, max & default values for SQ/RQ/CQ size, configurable via' modparam */ -#define BNX2I_SQ_WQES_MIN 16 -#define BNX2I_570X_SQ_WQES_MAX 128 -#define BNX2I_5770X_SQ_WQES_MAX 512 -#define BNX2I_570X_SQ_WQES_DEFAULT 128 -#define BNX2I_5770X_SQ_WQES_DEFAULT 256 +#define BNX2I_SQ_WQES_MIN 16 +#define BNX2I_570X_SQ_WQES_MAX 128 +#define BNX2I_5770X_SQ_WQES_MAX 512 +#define BNX2I_570X_SQ_WQES_DEFAULT 128 +#define BNX2I_5770X_SQ_WQES_DEFAULT 128#define BNX2I_570X_CQ_WQES_MAX 128#define BNX2I_5770X_CQ_WQES_MAX 512
@@ -115,6 +115,7 @@#define BNX2X_MAX_CQS 8#define CNIC_ARM_CQE 1 +#define CNIC_ARM_CQE_FP 2#define CNIC_DISARM_CQE 0#define REG_RD (__hba, offset) \
@@ -666,7 +667,9 @@ enum {* after HBA reset is completed by bnx2i/cnic/bnx2 * modules * @state: tracks offload connection state machine -* @teardown_mode: indicates if conn teardown is abortive or orderly +* @timestamp: tracks the start time when the ep begins to connect +* @num_active_cmds: tracks the number of outstanding commands for this ep +* @ec_shift: the amount of shift as part of the event coal calc * @qp: QP information * @ids: contains chip allocated *context id* & driver assigned * *iscsi cid*
@@ -685,6 +688,7 @@ struct bnx2i_endpoint {u32 state;unsigned long timestamp;int num_active_cmds; +u32 ec_shift;struct qp_info qp;struct ep_handles ids;
drivers/scsi/bnx2i/bnx2i_hwi.c +14 -12
@@ -138,7 +138,6 @@ void bnx2i_arm_cq_event_coalescing(struct bnx2i_endpoint *ep, u8 action)u16 next_index;u32 num_active_cmds; -/* Coalesce CQ entries only on 10G devices */ if (!test_bit (BNX2I_NX2_DEV_57710 , &ep->hba->cnic_dev_type))return ;
@@ -148,16 +147,19 @@ void bnx2i_arm_cq_event_coalescing(struct bnx2i_endpoint *ep, u8 action)* interrupts and other unwanted results */ cq_db = (struct bnx2i_5771x_cq_db *) ep->qp.cq_pgtbl_virt; -if (cq_db->sqn[0 ] && cq_db->sqn[0 ] !=0xFFFF ) -return ; -if (action ==CNIC_ARM_CQE ) { +if (action !=CNIC_ARM_CQE_FP ) +if (cq_db->sqn[0 ] && cq_db->sqn[0 ] !=0xFFFF ) +return ; + +if (action ==CNIC_ARM_CQE || action ==CNIC_ARM_CQE_FP ) { num_active_cmds = ep->num_active_cmds;if (num_active_cmds <= event_coal_min) next_index =1 ;else next_index = event_coal_min + - (num_active_cmds - event_coal_min) / event_coal_div; + ((num_active_cmds - event_coal_min) >> + ep->ec_shift);if (!next_index) next_index =1 ; cq_index = ep->qp.cqe_exp_seq_sn + next_index -1 ;
@@ -1935,7 +1937,6 @@ cqe_out: qp->cq_cons_idx++; } } -bnx2i_arm_cq_event_coalescing (bnx2i_conn->ep,CNIC_ARM_CQE ); }/**
@@ -1949,22 +1950,23 @@ cqe_out:static void bnx2i_fastpath_notification (struct bnx2i_hba *hba,struct iscsi_kcqe *new_cqe_kcqe) { -struct bnx2i_conn *conn; +struct bnx2i_conn *bnx2i_conn;u32 iscsi_cid; iscsi_cid = new_cqe_kcqe->iscsi_conn_id; - conn =bnx2i_get_conn_from_id (hba, iscsi_cid); + bnx2i_conn =bnx2i_get_conn_from_id (hba, iscsi_cid); -if (!conn) { +if (!bnx2i_conn) {printk (KERN_ALERT "cid #%x not valid\n" , iscsi_cid);return ; } -if (!conn->ep) { +if (!bnx2i_conn->ep) {printk (KERN_ALERT "cid #%x - ep not bound\n" , iscsi_cid);return ; } - -bnx2i_process_new_cqes (conn); +bnx2i_process_new_cqes (bnx2i_conn); +bnx2i_arm_cq_event_coalescing (bnx2i_conn->ep,CNIC_ARM_CQE_FP ); +bnx2i_process_new_cqes (bnx2i_conn); }
drivers/scsi/bnx2i/bnx2i_iscsi.c +7 -1
@@ -379,6 +379,7 @@ static struct iscsi_endpoint *bnx2i_alloc_ep(struct bnx2i_hba *hba) {struct iscsi_endpoint *ep;struct bnx2i_endpoint *bnx2i_ep; +u32 ec_div; ep =iscsi_create_endpoint (sizeof (*bnx2i_ep));if (!ep) {
@@ -393,6 +394,11 @@ static struct iscsi_endpoint *bnx2i_alloc_ep(struct bnx2i_hba *hba) bnx2i_ep->ep_iscsi_cid = (u16) -1 ; bnx2i_ep->hba = hba; bnx2i_ep->hba_age = hba->age; + + ec_div = event_coal_div; +while (ec_div >>=1 ) + bnx2i_ep->ec_shift +=1 ; + hba->ofld_conns_active++;init_waitqueue_head (&bnx2i_ep->ofld_wait);return ep;
@@ -2159,7 +2165,7 @@ static struct scsi_host_template bnx2i_host_template = { .change_queue_depth = iscsi_change_queue_depth, .can_queue = 1024, .max_sectors = 127, - .cmd_per_lun = 32, + .cmd_per_lun = 24, .this_id = -1, .use_clustering = ENABLE_CLUSTERING, .sg_tablesize = ISCSI_MAX_BDS_PER_CMD,
Signature · 1 line
1.7.0.5
Re: [PATCH 3/3] BNX2I: Optimized the iSCSI offload performance
Quoted 2 lines · Eddie Wai
5. Changed the
cmd_per_lunfrom 32 to 24.
What was the reason for this?
Quoted 9 lines
drivers/scsi/bnx2i/bnx2i_iscsi.c +1
-1@@ -2159,7 +2165,7 @@ static struct scsi_host_template bnx2i_host_template = { .change_queue_depth = iscsi_change_queue_depth, .can_queue = 1024, .max_sectors = 127, - .cmd_per_lun = 32, + .cmd_per_lun = 24, .this_id = -1, .use_clustering = ENABLE_CLUSTERING, .sg_tablesize = ISCSI_MAX_BDS_PER_CMD,
PATCH 1/4 BNX2I: Added the use of kthreads to handle SCSI cmd completion
In reply to a message not in the archiveThis patch breaks the SCSI cmd completion into two parts:
1. The bh will allocate and queued work to the cmd specific CPU IO completion kthread. The CPU for the cmd is recorded in task_xmit.
2. The CPU specific IO completion kthread will call the scsi_cmd_resp routine to do the actual cmd completion.
In the normal case, these IO completion kthreads should complete before the blk IO times out at 60s. However, in the case when these kthreads are blocked for whatever reason and exceeded the timeout, the call to conn_destroy will have to iterate and exhaust all related work in the percpu work list for all online CPUs. This will guarantee the protection of the work->session and conn pointers before they get freed.
Also modified the event coalescing formula to have at least the event_coal_min outstanding cmds in the pipeline so the SCSI producer would not get underrun.
Also changed the following SCSI parameters:
- can_queue from 1024 to 2048
- cmds_per_lun from 24 to 128
--- drivers/scsi/bnx2i/bnx2i.h | 33 ++++++- drivers/scsi/bnx2i/bnx2i_hwi.c | 184 ++++++++++++++++++++++++++++++++------ drivers/scsi/bnx2i/bnx2i_init.c | 118 ++++++++++++++++++++++++- drivers/scsi/bnx2i/bnx2i_iscsi.c | 41 ++++++++- 4 files changed, 341 insertions(+), 35 deletions(-)
drivers/scsi/bnx2i/bnx2i.h +30 -3
@@ -22,11 +22,14 @@#include <linux/pci.h> #include <linux/spinlock.h> #include <linux/interrupt.h> +#include <linux/delay.h> #include <linux/sched.h> #include <linux/in.h> #include <linux/kfifo.h> #include <linux/netdevice.h> #include <linux/completion.h> +#include <linux/kthread.h> +#include <linux/cpu.h> #include <scsi/scsi_cmnd.h> #include <scsi/scsi_device.h>
@@ -202,10 +205,14 @@ struct io_bdt {/** * bnx2i_cmd - iscsi command structure * +* @hdr: iSCSI header +* @conn: iscsi_conn pointer * @scsi_cmd: SCSI-ML task pointer corresponding to this iscsi cmd * @sg: SG list * @io_tbl: buffer descriptor (BD) table * @bd_tbl_dma: buffer descriptor (BD) table's dma address +* @req: bnx2i specific command request struct +* @cpu: CPU number of the specific cmd; for completion purposes */ struct bnx2i_cmd {struct iscsi_hdr hdr;
@@ -215,6 +222,7 @@ struct bnx2i_cmd {struct io_bdt io_tbl;dma_addr_t bd_tbl_dma;struct bnx2i_cmd_request req; +u32 cpu; };
@@ -229,6 +237,7 @@ struct bnx2i_cmd {* @gen_pdu: login/nopout/logout pdu resources * @violation_notified: bit mask used to track iscsi error/warning messages * already printed out +* @work_cnt: keeps track of the number of outstanding work * * iSCSI connection structure */
@@ -252,6 +261,8 @@ struct bnx2i_conn {*/ struct generic_pdu_resc gen_pdu;u64 violation_notified; + +atomic_t work_cnt; };
@@ -661,7 +672,6 @@ enum {* @hba: adapter to which this connection belongs * @conn: iscsi connection this EP is linked to * @cls_ep: associated iSCSI endpoint pointer -* @sess: iscsi session this EP is linked to * @cm_sk: cnic sock struct * @hba_age: age to detect if 'iscsid' issues ep_disconnect() * after HBA reset is completed by bnx2i/cnic/bnx2
@@ -687,7 +697,7 @@ struct bnx2i_endpoint {u32 hba_age;u32 state;unsigned long timestamp; -int num_active_cmds; +atomic_t num_active_cmds;u32 ec_shift;struct qp_info qp;
@@ -700,6 +710,19 @@ struct bnx2i_endpoint { }; +struct bnx2i_work { +struct list_head list; +struct iscsi_session *session; +struct bnx2i_conn *bnx2i_conn; +struct cqe cqe; +}; + +struct bnx2i_percpu_s { +struct task_struct *iothread; +struct list_head work_list; +spinlock_t p_work_lock; +}; +/* Global variables */ extern unsigned int error_mask1, error_mask2;
@@ -783,7 +806,7 @@ extern struct bnx2i_endpoint *bnx2i_find_ep_in_destroy_list( struct bnx2i_hba *hba, u32 iscsi_cid);extern int bnx2i_map_ep_dbell_regs (struct bnx2i_endpoint *ep); -extern void bnx2i_arm_cq_event_coalescing (struct bnx2i_endpoint *ep,u8 action); +extern int bnx2i_arm_cq_event_coalescing (struct bnx2i_endpoint *ep,u8 action);extern int bnx2i_hw_ep_disconnect (struct bnx2i_endpoint *bnx2i_ep);
@@ -793,4 +816,8 @@ extern void bnx2i_print_active_cmd_queue(struct bnx2i_conn *conn);extern void bnx2i_print_xmit_pdu_queue (struct bnx2i_conn *conn);extern void bnx2i_print_recv_state (struct bnx2i_conn *conn); +extern int bnx2i_percpu_io_thread (void *arg); +extern int bnx2i_process_scsi_cmd_resp (struct iscsi_session *session, +struct bnx2i_conn *bnx2i_conn, +struct cqe *cqe);#endif
drivers/scsi/bnx2i/bnx2i_hwi.c +157 -27
313 lines not on this page · raw message
drivers/scsi/bnx2i/bnx2i_init.c +117 -1
160 lines not on this page · raw message
drivers/scsi/bnx2i/bnx2i_iscsi.c +37 -4
86 lines not on this page · raw message
Signature · 1 line
1.7.0.5
Re: [PATCH 1/4] BNX2I: Added the use of kthreads to handle SCSI cmd completion
Quoted 6 lines · Eddie Wai
This patch breaks the SCSI cmd completion into two parts:
1. The bh will allocate and queued work to the cmd specific CPU IO completion kthread. The CPU for the cmd is recorded intask_xmit.2. The CPU specific IO completion kthread will call the
scsi_cmd_resproutine to do the actual cmd completion.
I think you should use blkio poll. Modify it so it does what you want. But I think since other drivers are getting in without converting then that can wait.
drivers/scsi/bnx2i/bnx2i.h struct bnx2i_cmd { · line 225
Quoted 7 lines
struct
bnx2i_cmd{drivers/scsi/bnx2i/bnx2i.h +1
-0struct iscsi_hdr hdr;@@ -215,6 +222,7 @@ struct bnx2i_cmd {struct io_bdt io_tbl;dma_addr_t bd_tbl_dma;struct bnx2i_cmd_request req; +u32 cpu;
You can just use scsi_cmnd->request->cpu
Re: [PATCH 1/4] BNX2I: Added the use of kthreads to handle SCSI cmd completion
Quoted 5 lines · Mike Christie
Quoted 4 lines · Eddie Wai
This patch breaks the SCSI cmd completion into two parts:
1. The bh will allocate and queued work to the cmd specific CPU IO completion kthread. The CPU for the cmd is recorded intask_xmit.
Quoted 7 lines
Quoted 2 lines
2. The CPU specific IO completion kthread will call the
scsi_cmd_resproutine to do the actual cmd completion.I think you should use blkio poll. Modify it so it does what you want. But I think since other drivers are getting in without converting then that can wait.
Noted. I will revisit this later then.
Quoted 12 lines
drivers/scsi/bnx2i/bnx2i.h struct bnx2i_cmd { · line 225
Quoted 9 lines
struct
bnx2i_cmd{drivers/scsi/bnx2i/bnx2i.h +1
-0struct iscsi_hdr hdr;@@ -215,6 +222,7 @@ struct bnx2i_cmd {struct io_bdt io_tbl;dma_addr_t bd_tbl_dma;struct bnx2i_cmd_request req; +u32 cpu;You can just use
scsi_cmnd->request->cpu
Ok, I'll make the change to use this instead of grabbing the cpu explicitly in our driver.
Quoted 1 line
PATCH 2/4 BNX2I: Modified to skip CNIC registration if iSCSI is not supported
In reply to a message not in the archiveThe init routine will now examine the cnic->max_iscsi_conn variable before registering to CNIC during ulp_init.
--- drivers/scsi/bnx2i/bnx2i_init.c | 29 +++++++++++++++-------------- 1 files changed, 15 insertions(+), 14 deletions(-)
drivers/scsi/bnx2i/bnx2i_init.c +15 -14
@@ -172,21 +172,14 @@ void bnx2i_start(void *handle)struct bnx2i_hba *hba = handle;int i =HZ ; -if (!hba->cnic->max_iscsi_conn) { -printk (KERN_ALERT "bnx2i: dev %s does not support " -"iSCSI\n" , hba->netdev->name); +/* +* We should never register devices that don't support iSCSI +* (see bnx2i_init_one), so something is wrong if we try to +* start a iSCSI adapter on hardware with 0 supported iSCSI +* connections +*/ +BUG_ON (!hba->cnic->max_iscsi_conn); -if (test_bit (BNX2I_CNIC_REGISTERED , &hba->reg_with_cnic)) { -mutex_lock (&bnx2i_dev_lock); -list_del_init (&hba->link); - adapter_count--; - hba->cnic->unregister_device (hba->cnic,CNIC_ULP_ISCSI ); -clear_bit (BNX2I_CNIC_REGISTERED , &hba->reg_with_cnic); -mutex_unlock (&bnx2i_dev_lock); -bnx2i_free_hba (hba); - } -return ; - }bnx2i_send_fw_iscsi_init_msg (hba);while (!test_bit (ADAPTER_STATE_UP , &hba->adapter_state) && i--)msleep (BNX2I_INIT_POLL_TIME );
@@ -290,6 +283,13 @@ static int bnx2i_init_one(struct bnx2i_hba *hba, struct cnic_dev *cnic)int rc;mutex_lock (&bnx2i_dev_lock); +if (!cnic->max_iscsi_conn) { +printk (KERN_ALERT "bnx2i: dev %s does not support " +"iSCSI\n" , hba->netdev->name); + rc = -EOPNOTSUPP ; + goto out; + } + hba->cnic = cnic; rc = cnic->register_device (cnic,CNIC_ULP_ISCSI , hba);if (!rc) {
@@ -307,6 +307,7 @@ static int bnx2i_init_one(struct bnx2i_hba *hba, struct cnic_dev *cnic)else printk (KERN_ERR "bnx2i dev reg, unknown error, %d\n" , rc); +out:mutex_unlock (&bnx2i_dev_lock);return rc;
Signature · 1 line
1.7.0.5
PATCH 3/4 BNX2I: Changed the nopout_wqe->lun memcpy to use sizeof instead
In reply to a message not in the archiveModified the memcpy of nopout_wqe->lun to use sizeof(struct scsi_lun) instead of the hardcoded value 8 as noted by review comments.
--- drivers/scsi/bnx2i/bnx2i_hwi.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/bnx2i/bnx2i_hwi.c +1 -1
@@ -551,7 +551,7 @@ int bnx2i_send_iscsi_nopout(struct bnx2i_conn *bnx2i_conn, nopout_wqe->op_code = nopout_hdr->opcode; nopout_wqe->op_attr =ISCSI_FLAG_CMD_FINAL ; -memcpy (nopout_wqe->lun, nopout_hdr->lun,8 ); +memcpy (nopout_wqe->lun, nopout_hdr->lun,sizeof (struct scsi_lun ));if (test_bit (BNX2I_NX2_DEV_57710 , &ep->hba->cnic_dev_type)) {u32 tmp = nopout_wqe->lun[0 ];
Signature · 1 line
1.7.0.5
Re: [PATCH 3/4] BNX2I: Changed the nopout_wqe->lun memcpy to use sizeof instead
Quoted 22 lines
Modified the memcpy of
nopout_wqe->lunto usesizeof(struct scsi_lun)instead of the hardcoded value 8 as noted by review comments.Signed-off-by Eddie Wai <[email protected]>--- drivers/scsi/bnx2i/bnx2i_hwi.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/scsi/bnx2i/bnx2i_hwi.c +1
-1@@ -551,7 +551,7 @@ int bnx2i_send_iscsi_nopout(struct bnx2i_conn *bnx2i_conn, nopout_wqe->op_code = nopout_hdr->opcode; nopout_wqe->op_attr =ISCSI_FLAG_CMD_FINAL ; -memcpy (nopout_wqe->lun, nopout_hdr->lun,8 ); +memcpy (nopout_wqe->lun, nopout_hdr->lun,sizeof (struct scsi_lun ));if (test_bit (BNX2I_NX2_DEV_57710 , &ep->hba->cnic_dev_type)) {
Quoted 1 line
u32 tmp = nopout_wqe->lun[0];
Why not just use sizeof(*nopout_wqe->lun)?
Eike
cover BNX2I: Code and performance optimization
In reply to a message not in the archiveThis patch set contains a collection of code and performance optimization changes.
Your comments are welcome. Please review.
Eddie
Eddie Wai (4):
BNX2I: Added the use of kthreads to handle SCSI cmd completion
BNX2I: Modified to skip CNIC registration if iSCSI is not supported
BNX2I: Changed the nopout_wqe->lun memcpy to use sizeof instead
BNX2I: Updated copyright and bump version
drivers/scsi/bnx2i/57xx_iscsi_constants.h | 2 +- drivers/scsi/bnx2i/57xx_iscsi_hsi.h | 2 +- drivers/scsi/bnx2i/bnx2i.h | 35 +++++- drivers/scsi/bnx2i/bnx2i_hwi.c | 188 ++++++++++++++++++++++++----- drivers/scsi/bnx2i/bnx2i_init.c | 153 +++++++++++++++++++++--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 43 ++++++- drivers/scsi/bnx2i/bnx2i_sysfs.c | 2 +- 7 files changed, 366 insertions(+), 59 deletions(-)
PATCH 4/4 BNX2I: Updated copyright and bump version
In reply to a message not in the archiveBumped version from 2.6.2.3 to 2.7.0.3
--- drivers/scsi/bnx2i/57xx_iscsi_constants.h | 2 +- drivers/scsi/bnx2i/57xx_iscsi_hsi.h | 2 +- drivers/scsi/bnx2i/bnx2i.h | 2 +- drivers/scsi/bnx2i/bnx2i_hwi.c | 2 +- drivers/scsi/bnx2i/bnx2i_init.c | 6 +++--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 2 +- drivers/scsi/bnx2i/bnx2i_sysfs.c | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-)
drivers/scsi/bnx2i/57xx_iscsi_constants.h +1 -1
@@ -1,6 +1,6 @@/* 57xx_iscsi_constants.h: Broadcom NetXtreme II iSCSI HSI * -* Copyright (c) 2006 - 2010 Broadcom Corporation +* Copyright (c) 2006 - 2011 Broadcom Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
drivers/scsi/bnx2i/57xx_iscsi_hsi.h +1 -1
@@ -1,6 +1,6 @@/* 57xx_iscsi_hsi.h: Broadcom NetXtreme II iSCSI HSI. * -* Copyright (c) 2006 - 2010 Broadcom Corporation +* Copyright (c) 2006 - 2011 Broadcom Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
drivers/scsi/bnx2i/bnx2i.h +1 -1
@@ -1,6 +1,6 @@/* bnx2i.h: Broadcom NetXtreme II iSCSI driver. * -* Copyright (c) 2006 - 2010 Broadcom Corporation +* Copyright (c) 2006 - 2011 Broadcom Corporation * Copyright (c) 2007, 2008 Red Hat, Inc. All rights reserved. * Copyright (c) 2007, 2008 Mike Christie *
drivers/scsi/bnx2i/bnx2i_hwi.c +1 -1
@@ -1,6 +1,6 @@/* bnx2i_hwi.c: Broadcom NetXtreme II iSCSI driver. * -* Copyright (c) 2006 - 2010 Broadcom Corporation +* Copyright (c) 2006 - 2011 Broadcom Corporation * Copyright (c) 2007, 2008 Red Hat, Inc. All rights reserved. * Copyright (c) 2007, 2008 Mike Christie *
drivers/scsi/bnx2i/bnx2i_init.c +3 -3
@@ -1,6 +1,6 @@/* bnx2i.c: Broadcom NetXtreme II iSCSI driver. * -* Copyright (c) 2006 - 2010 Broadcom Corporation +* Copyright (c) 2006 - 2011 Broadcom Corporation * Copyright (c) 2007, 2008 Red Hat, Inc. All rights reserved. * Copyright (c) 2007, 2008 Mike Christie *
@@ -18,8 +18,8 @@ static struct list_head adapter_list = LIST_HEAD_INIT(adapter_list);static u32 adapter_count;#define DRV_MODULE_NAME "bnx2i" -#define DRV_MODULE_VERSION "2.6.2.3" -#define DRV_MODULE_RELDATE "Dec 31, 2010" +#define DRV_MODULE_VERSION "2.7.0.3" +#define DRV_MODULE_RELDATE "Jun 15, 2011"static char version[]__devinitdata ="Broadcom NetXtreme II iSCSI Driver " DRV_MODULE_NAME \
drivers/scsi/bnx2i/bnx2i_iscsi.c +1 -1
@@ -1,7 +1,7 @@/* * bnx2i_iscsi.c: Broadcom NetXtreme II iSCSI driver. * -* Copyright (c) 2006 - 2010 Broadcom Corporation +* Copyright (c) 2006 - 2011 Broadcom Corporation * Copyright (c) 2007, 2008 Red Hat, Inc. All rights reserved. * Copyright (c) 2007, 2008 Mike Christie *
drivers/scsi/bnx2i/bnx2i_sysfs.c +1 -1
@@ -1,6 +1,6 @@/* bnx2i_sysfs.c: Broadcom NetXtreme II iSCSI driver. * -* Copyright (c) 2004 - 2010 Broadcom Corporation +* Copyright (c) 2004 - 2011 Broadcom Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
Signature · 1 line
1.7.0.5
v2 cover BNX2I: Code and performance optimization
In reply to a message not in the archiveThis patch set contains a collection of code and performance optimization changes.
Changes from v2:
- Comments from Mike Christie to use sc->request->cpu instead of the newly defined bnx2i_cmd->cpu
- Comments from Fubo Chen to process the work in the percpu io completion kthread before calling schedule() to avoid potential race condition.
Your comments are welcome. Please review.
Thanks,
Eddie
Eddie Wai (4):
BNX2I: Added the use of kthreads to handle SCSI cmd completion
BNX2I: Modified to skip CNIC registration if iSCSI is not supported
BNX2I: Changed the nopout_wqe->lun memcpy to use sizeof instead
BNX2I: Updated copyright and bump version
drivers/scsi/bnx2i/57xx_iscsi_constants.h | 2 +- drivers/scsi/bnx2i/57xx_iscsi_hsi.h | 2 +- drivers/scsi/bnx2i/bnx2i.h | 33 +++++- drivers/scsi/bnx2i/bnx2i_hwi.c | 187 ++++++++++++++++++++++++----- drivers/scsi/bnx2i/bnx2i_init.c | 153 +++++++++++++++++++++--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 38 +++++- drivers/scsi/bnx2i/bnx2i_sysfs.c | 2 +- 7 files changed, 358 insertions(+), 59 deletions(-)
PATCH v2 1/4 BNX2I: Added the use of kthreads to handle SCSI cmd completion
In reply to a message not in the archiveThis patch breaks the SCSI cmd completion into two parts:
1. The bh will allocate and queued work to the cmd specific CPU IO completion kthread. The CPU for the cmd is from the sc->request->cpu.
2. The CPU specific IO completion kthread will call the scsi_cmd_resp routine to do the actual cmd completion.
In the normal case, these IO completion kthreads should complete before the blk IO times out at 60s. However, in the case when these kthreads are blocked for whatever reason and exceeded the timeout, the call to conn_destroy will have to iterate and exhaust all related work in the percpu work list for all online CPUs. This will guarantee the protection of the work->session and conn pointers before they get freed.
Also modified the event coalescing formula to have at least the event_coal_min outstanding cmds in the pipeline so the SCSI producer would not get underrun.
Also changed the following SCSI parameters:
- can_queue from 1024 to 2048
- cmds_per_lun from 24 to 128
--- drivers/scsi/bnx2i/bnx2i.h | 31 ++++++- drivers/scsi/bnx2i/bnx2i_hwi.c | 183 ++++++++++++++++++++++++++++++++------ drivers/scsi/bnx2i/bnx2i_init.c | 118 ++++++++++++++++++++++++- drivers/scsi/bnx2i/bnx2i_iscsi.c | 36 +++++++- 4 files changed, 333 insertions(+), 35 deletions(-)
drivers/scsi/bnx2i/bnx2i.h +28 -3
@@ -22,11 +22,14 @@#include <linux/pci.h> #include <linux/spinlock.h> #include <linux/interrupt.h> +#include <linux/delay.h> #include <linux/sched.h> #include <linux/in.h> #include <linux/kfifo.h> #include <linux/netdevice.h> #include <linux/completion.h> +#include <linux/kthread.h> +#include <linux/cpu.h> #include <scsi/scsi_cmnd.h> #include <scsi/scsi_device.h>
@@ -202,10 +205,13 @@ struct io_bdt {/** * bnx2i_cmd - iscsi command structure * +* @hdr: iSCSI header +* @conn: iscsi_conn pointer * @scsi_cmd: SCSI-ML task pointer corresponding to this iscsi cmd * @sg: SG list * @io_tbl: buffer descriptor (BD) table * @bd_tbl_dma: buffer descriptor (BD) table's dma address +* @req: bnx2i specific command request struct */ struct bnx2i_cmd {struct iscsi_hdr hdr;
@@ -229,6 +235,7 @@ struct bnx2i_cmd {* @gen_pdu: login/nopout/logout pdu resources * @violation_notified: bit mask used to track iscsi error/warning messages * already printed out +* @work_cnt: keeps track of the number of outstanding work * * iSCSI connection structure */
@@ -252,6 +259,8 @@ struct bnx2i_conn {*/ struct generic_pdu_resc gen_pdu;u64 violation_notified; + +atomic_t work_cnt; };
@@ -661,7 +670,6 @@ enum {* @hba: adapter to which this connection belongs * @conn: iscsi connection this EP is linked to * @cls_ep: associated iSCSI endpoint pointer -* @sess: iscsi session this EP is linked to * @cm_sk: cnic sock struct * @hba_age: age to detect if 'iscsid' issues ep_disconnect() * after HBA reset is completed by bnx2i/cnic/bnx2
@@ -687,7 +695,7 @@ struct bnx2i_endpoint {u32 hba_age;u32 state;unsigned long timestamp; -int num_active_cmds; +atomic_t num_active_cmds;u32 ec_shift;struct qp_info qp;
@@ -700,6 +708,19 @@ struct bnx2i_endpoint { }; +struct bnx2i_work { +struct list_head list; +struct iscsi_session *session; +struct bnx2i_conn *bnx2i_conn; +struct cqe cqe; +}; + +struct bnx2i_percpu_s { +struct task_struct *iothread; +struct list_head work_list; +spinlock_t p_work_lock; +}; +/* Global variables */ extern unsigned int error_mask1, error_mask2;
@@ -783,7 +804,7 @@ extern struct bnx2i_endpoint *bnx2i_find_ep_in_destroy_list( struct bnx2i_hba *hba, u32 iscsi_cid);extern int bnx2i_map_ep_dbell_regs (struct bnx2i_endpoint *ep); -extern void bnx2i_arm_cq_event_coalescing (struct bnx2i_endpoint *ep,u8 action); +extern int bnx2i_arm_cq_event_coalescing (struct bnx2i_endpoint *ep,u8 action);extern int bnx2i_hw_ep_disconnect (struct bnx2i_endpoint *bnx2i_ep);
@@ -793,4 +814,8 @@ extern void bnx2i_print_active_cmd_queue(struct bnx2i_conn *conn);extern void bnx2i_print_xmit_pdu_queue (struct bnx2i_conn *conn);extern void bnx2i_print_recv_state (struct bnx2i_conn *conn); +extern int bnx2i_percpu_io_thread (void *arg); +extern int bnx2i_process_scsi_cmd_resp (struct iscsi_session *session, +struct bnx2i_conn *bnx2i_conn, +struct cqe *cqe);#endif
drivers/scsi/bnx2i/bnx2i_hwi.c +156 -27
312 lines not on this page · raw message
drivers/scsi/bnx2i/bnx2i_init.c +117 -1
160 lines not on this page · raw message
drivers/scsi/bnx2i/bnx2i_iscsi.c +32 -4
@@ -27,6 +27,7 @@ static struct scsi_host_template bnx2i_host_template;*/ static DEFINE_SPINLOCK (bnx2i_resc_lock);/* protects global resources */ +DECLARE_PER_CPU(struct bnx2i_percpu_s, bnx2i_percpu);static int bnx2i_adapter_ready (struct bnx2i_hba *hba) {
@@ -1214,7 +1215,8 @@ static int bnx2i_task_xmit(struct iscsi_task *task)struct bnx2i_cmd *cmd = task->dd_data;struct iscsi_cmd *hdr = (struct iscsi_cmd *) task->hdr; -if (bnx2i_conn->ep->num_active_cmds +1 > hba->max_sqes) +if (atomic_read (&bnx2i_conn->ep->num_active_cmds) +1 > + hba->max_sqes)return -ENOMEM ;/*
@@ -1354,6 +1356,9 @@ bnx2i_conn_create(struct iscsi_cls_session *cls_session, uint32_t cid) bnx2i_conn = conn->dd_data; bnx2i_conn->cls_conn = cls_conn; bnx2i_conn->hba = hba; + +atomic_set (&bnx2i_conn->work_cnt,0 ); +/* 'ep' ptr will be assigned in bind() call */ bnx2i_conn->ep =NULL ;init_completion (&bnx2i_conn->cmd_cleanup_cmpl);
@@ -1457,11 +1462,34 @@ static void bnx2i_conn_destroy(struct iscsi_cls_conn *cls_conn)struct bnx2i_conn *bnx2i_conn = conn->dd_data;struct Scsi_Host *shost;struct bnx2i_hba *hba; +struct bnx2i_work *work, *tmp; +unsigned cpu =0 ; +struct bnx2i_percpu_s *p; shost =iscsi_session_to_shost (iscsi_conn_to_session (cls_conn)); hba =iscsi_host_priv (shost);bnx2i_conn_free_login_resources (hba, bnx2i_conn); + +if (atomic_read (&bnx2i_conn->work_cnt)) { +for_each_online_cpu (cpu) { + p = &per_cpu (bnx2i_percpu, cpu); +spin_lock_bh (&p->p_work_lock); +list_for_each_entry_safe (work, tmp, + &p->work_list, list) { +if (work->session == conn->session && + work->bnx2i_conn == bnx2i_conn) { +list_del_init (&work->list); +kfree (work); +if (!atomic_dec_and_test ( + &bnx2i_conn->work_cnt)) +break ; + } + } +spin_unlock_bh (&p->p_work_lock); + } + } +iscsi_conn_teardown (cls_conn); }
@@ -1769,7 +1797,7 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost, } bnx2i_ep = ep->dd_data; - bnx2i_ep->num_active_cmds =0 ; +atomic_set (&bnx2i_ep->num_active_cmds,0 ); iscsi_cid =bnx2i_alloc_iscsi_cid (hba);if (iscsi_cid ==-1 ) { printk(KERN_ALERT "bnx2i (%s): alloc_ep - unable to allocate "
@@ -2163,9 +2191,9 @@ static struct scsi_host_template bnx2i_host_template = { .eh_device_reset_handler = iscsi_eh_device_reset, .eh_target_reset_handler = iscsi_eh_recover_target, .change_queue_depth = iscsi_change_queue_depth, - .can_queue = 1024, + .can_queue = 2048, .max_sectors = 127, - .cmd_per_lun = 24, + .cmd_per_lun = 128, .this_id = -1, .use_clustering = ENABLE_CLUSTERING, .sg_tablesize = ISCSI_MAX_BDS_PER_CMD,
Signature · 1 line
1.7.0.5
PATCH v2 1/4 BNX2FC: Fixed a SCSI CMD cmpl race condition between ABTS and CLEANUP
In reply to a message not in the archiveIn the case when a SCSI_CMD times out, bnx2fc will initiate the sending of the ABTS. However, if the SCSI layer's SCSI command timer also times out, it'll instantiate a task abort of the same xid.
The race condition this patch tries to fix is as follows:
SCSI_CMD timeout (20s)
thread 1 thread 2
send ABTS
rx ABTS cmpl
task abort_eh
explicit LOGO since ABTS was engaged CLEANUP cmplSCSI_CMD cmpl (ABTS cmpl)
instantiate RRQ
wait 10s
attempt to send RRQ (because of LOGO, it wouldn't continue)
Note that there is no call to scsi_done for this SCSI_CMD cmpletion in this path.
The patch changes the path of execution to call scsi_done immediately instead of instantiating the RRQ.
--- drivers/scsi/bnx2fc/bnx2fc_io.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_io.c +6 -0
@@ -1246,6 +1246,12 @@ int bnx2fc_eh_abort(struct scsi_cmnd *sc_cmd)kref_put (&io_req->refcount, bnx2fc_cmd_release);/* drop timer hold */ rc =bnx2fc_expl_logo (lport, io_req); +/* This only occurs when an task abort was requested while ABTS +is in progress. Setting the IO_CLEANUP flag will skip the +RRQ process in the case when the fw generated SCSI_CMD cmpl +was a result from the ABTS request rather than the CLEANUP +request */ +set_bit (BNX2FC_FLAG_IO_CLEANUP , &io_req->req_flags); goto out; }
Signature · 1 line
1.7.1
PATCH v2 2/4 BNX2I: Modified to skip CNIC registration if iSCSI is not supported
In reply to a message not in the archiveThe init routine will now examine the cnic->max_iscsi_conn variable before registering to CNIC during ulp_init.
--- drivers/scsi/bnx2i/bnx2i_init.c | 29 +++++++++++++++-------------- 1 files changed, 15 insertions(+), 14 deletions(-)
drivers/scsi/bnx2i/bnx2i_init.c +15 -14
@@ -172,21 +172,14 @@ void bnx2i_start(void *handle)struct bnx2i_hba *hba = handle;int i =HZ ; -if (!hba->cnic->max_iscsi_conn) { -printk (KERN_ALERT "bnx2i: dev %s does not support " -"iSCSI\n" , hba->netdev->name); +/* +* We should never register devices that don't support iSCSI +* (see bnx2i_init_one), so something is wrong if we try to +* start a iSCSI adapter on hardware with 0 supported iSCSI +* connections +*/ +BUG_ON (!hba->cnic->max_iscsi_conn); -if (test_bit (BNX2I_CNIC_REGISTERED , &hba->reg_with_cnic)) { -mutex_lock (&bnx2i_dev_lock); -list_del_init (&hba->link); - adapter_count--; - hba->cnic->unregister_device (hba->cnic,CNIC_ULP_ISCSI ); -clear_bit (BNX2I_CNIC_REGISTERED , &hba->reg_with_cnic); -mutex_unlock (&bnx2i_dev_lock); -bnx2i_free_hba (hba); - } -return ; - }bnx2i_send_fw_iscsi_init_msg (hba);while (!test_bit (ADAPTER_STATE_UP , &hba->adapter_state) && i--)msleep (BNX2I_INIT_POLL_TIME );
@@ -290,6 +283,13 @@ static int bnx2i_init_one(struct bnx2i_hba *hba, struct cnic_dev *cnic)int rc;mutex_lock (&bnx2i_dev_lock); +if (!cnic->max_iscsi_conn) { +printk (KERN_ALERT "bnx2i: dev %s does not support " +"iSCSI\n" , hba->netdev->name); + rc = -EOPNOTSUPP ; + goto out; + } + hba->cnic = cnic; rc = cnic->register_device (cnic,CNIC_ULP_ISCSI , hba);if (!rc) {
@@ -307,6 +307,7 @@ static int bnx2i_init_one(struct bnx2i_hba *hba, struct cnic_dev *cnic)else printk (KERN_ERR "bnx2i dev reg, unknown error, %d\n" , rc); +out:mutex_unlock (&bnx2i_dev_lock);return rc;
Signature · 1 line
1.7.0.5
PATCH v2 2/4 BNX2FC: hung task timeout warning observed when rmmod bnx2x with active FCoE targets
In reply to a message not in the archiveA rtnl_lock deadlock was observed from the rmmod thread where it tries to unregister the fcoe_ctlr device. This unregistration triggered a flush of the sysfs queue of the associated ctlr and led to a call to the set_fcoe_ctlr_enabled routine. This will eventually propagate down to call the bnx2fc_disable routine and contented for the rtnl_lock in the same context.
This patch creates a subset of the bnx2fc_enable/disable routine which removes the unnecesary rtnl_lock and the bnx2fc_dev_lock acquisition from the set_fcoe_ctlr_enabled path.
kernel: INFO: task rmmod:7874 blocked for more than 120 seconds.
kernel: Tainted: G W --------------- 2.6.32-415.0.1.el6.x86_64 #1
kernel: "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
kernel: rmmod D 000000000000000f 0 7874 6518 0x00000080
kernel: ffff88022158f7d8 0000000000000086 0000000000000000 0000000000000000
kernel: ffff88023fe72600 ffff88043c74d410 ffff88043c74d400 ffff88043c74d000
kernel: ffff88021ecbe5f8 ffff88022158ffd8 000000000000fbc8 ffff88021ecbe5f8
kernel: Call Trace:
kernel: [<ffffffff81525985>] schedule_timeout+0x215/0x2e0
kernel: [<ffffffff810680c0>] ? pick_next_task_fair+0xd0/0x130
kernel: [<ffffffff81524858>] ? schedule+0x178/0x3b2
kernel: [<ffffffff81525603>] wait_for_common+0x123/0x180
kernel: [<ffffffff81066b40>] ? default_wake_function+0x0/0x20
kernel: [<ffffffff811a486e>] ? ifind_fast+0x5e/0xb0
kernel: [<ffffffff8152571d>] wait_for_completion+0x1d/0x20
kernel: [<ffffffff81203868>] sysfs_addrm_finish+0x228/0x270
kernel: [<ffffffff812014ab>] sysfs_hash_and_remove+0x5b/0x90
kernel: [<ffffffff812056af>] sysfs_remove_group+0x5f/0x100
kernel: [<ffffffff81367e8b>] device_remove_groups+0x3b/0x60
kernel: [<ffffffff8136811d>] device_remove_attrs+0x3d/0x90
kernel: [<ffffffff81368295>] device_del+0x125/0x1e0
kernel: [<ffffffff81368372>] device_unregister+0x22/0x60
kernel: [<ffffffffa038ead2>] fcoe_ctlr_device_delete+0xe2/0xf4 [libfcoe]
kernel: [<ffffffffa03c43cb>] bnx2fc_interface_release+0x5b/0x90 [bnx2fc]
kernel: [<ffffffffa03c4370>] ? bnx2fc_interface_release+0x0/0x90 [bnx2fc]
kernel: [<ffffffff812835e7>] kref_put+0x37/0x70
kernel: [<ffffffffa03c4192>] __bnx2fc_destroy+0x72/0xa0 [bnx2fc]
kernel: [<ffffffffa03c5265>] bnx2fc_ulp_exit+0xf5/0x160 [bnx2fc] <- got bnx2fc_dev_lock mutex_lock
kernel: [<ffffffffa03b03c6>] cnic_ulp_exit+0xb6/0xc0 [cnic]
kernel: [<ffffffffa03b5418>] cnic_netdev_event+0x368/0x370 [cnic]
kernel: [<ffffffffa038c56c>] ? fcoe_del_netdev_mapping+0x8c/0xa0 [libfcoe]
kernel: [<ffffffff8152a6e5>] notifier_call_chain+0x55/0x80
kernel: [<ffffffff810a0a46>] raw_notifier_call_chain+0x16/0x20
kernel: [<ffffffff81459beb>] call_netdevice_notifiers+0x1b/0x20
kernel: [<ffffffff8145ab34>] rollback_registered_many+0x154/0x280
kernel: [<ffffffff8145ad08>] rollback_registered+0x38/0x50
kernel: [<ffffffff8145ad78>] unregister_netdevice_queue+0x58/0xa0
kernel: [<ffffffff8145add0>] unregister_netdevice+0x10/0x20
kernel: [<ffffffff8145adfe>] unregister_netdev+0x1e/0x30 <- got rtnl_lock!!!!!!!!!
kernel: [<ffffffffa0122278>] __bnx2x_remove+0x48/0x270 [bnx2x] <- got & rel rtnl_lock
kernel: [<ffffffffa0122554>] bnx2x_remove_one+0x44/0x80 [bnx2x]
kernel: [<ffffffff812a3af7>] pci_device_remove+0x37/0x70
kernel: [<ffffffff8136b2ef>] __device_release_driver+0x6f/0xe0
kernel: [<ffffffff8136b428>] driver_detach+0xc8/0xd0
kernel: [<ffffffff8136a22e>] bus_remove_driver+0x8e/0x110
kernel: [<ffffffff8136bc12>] driver_unregister+0x62/0xa0
kernel: [<ffffffff812a3e04>] pci_unregister_driver+0x44/0xb0
kernel: [<ffffffffa0191954>] bnx2x_cleanup+0x18/0x73 [bnx2x]
kernel: [<ffffffff810b8be4>] sys_delete_module+0x194/0x260
kernel: [<ffffffff810e1347>] ? audit_syscall_entry+0x1d7/0x200
kernel: [<ffffffff8100b072>] system_call_fastpath+0x16/0x1b
--- drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 60 +++++++++++++++++++++++++++--------- 1 files changed, 45 insertions(+), 15 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +45 -15
@@ -1809,6 +1809,7 @@ static void bnx2fc_stop(struct bnx2fc_interface *interface)FC_PORTTYPE_UNKNOWN ;mutex_unlock (&lport->lp_mutex);fc_host_port_type (lport->host) =FC_PORTTYPE_UNKNOWN ; + interface->enabled = false;fcoe_ctlr_link_down (ctlr);fcoe_clean_pending_queue (lport); }
@@ -2004,6 +2005,24 @@ static void bnx2fc_ulp_init(struct cnic_dev *dev)set_bit (BNX2FC_CNIC_REGISTERED , &hba->reg_with_cnic); } +/* Assumes rtnl_lock and the bnx2fc_dev_lock are already taken */ +static int __bnx2fc_disable (struct fcoe_ctlr *ctlr) +{ +struct bnx2fc_interface *interface =fcoe_ctlr_priv (ctlr); + +if (interface->enabled == true) { +if (!ctlr->lp) { +pr_err (PFX "__bnx2fc_disable: lport not found\n" ); +return -ENODEV ; + }else { + interface->enabled = false; +fcoe_ctlr_link_down (ctlr); +fcoe_clean_pending_queue (ctlr->lp); + } + } +return 0 ; +} +/** * Deperecated: Use bnx2fc_enabled() */
@@ -2018,20 +2037,34 @@ static int bnx2fc_disable(struct net_device *netdev) interface =bnx2fc_interface_lookup (netdev); ctlr =bnx2fc_to_ctlr (interface); -if (!interface || !ctlr->lp) { + +if (!interface) { rc = -ENODEV ; - printk(KERN_ERR PFX "bnx2fc_disable: interface or lport not found\n"); +pr_err (PFX "bnx2fc_disable: interface not found\n" ); }else { - interface->enabled = false; -fcoe_ctlr_link_down (ctlr); -fcoe_clean_pending_queue (ctlr->lp); + rc =__bnx2fc_disable (ctlr); } -mutex_unlock (&bnx2fc_dev_lock);rtnl_unlock ();return rc; } +static int __bnx2fc_enable (struct fcoe_ctlr *ctlr) +{ +struct bnx2fc_interface *interface =fcoe_ctlr_priv (ctlr); + +if (interface->enabled == false) { +if (!ctlr->lp) { +pr_err (PFX "__bnx2fc_enable: lport not found\n" ); +return -ENODEV ; + }else if (!bnx2fc_link_ok (ctlr->lp)) { +fcoe_ctlr_link_up (ctlr); + interface->enabled = true; + } + } +return 0 ; +} +/** * Deprecated: Use bnx2fc_enabled() */
@@ -2046,12 +2079,11 @@ static int bnx2fc_enable(struct net_device *netdev) interface =bnx2fc_interface_lookup (netdev); ctlr =bnx2fc_to_ctlr (interface); -if (!interface || !ctlr->lp) { +if (!interface) { rc = -ENODEV ; - printk(KERN_ERR PFX "bnx2fc_enable: interface or lport not found\n"); - }else if (!bnx2fc_link_ok (ctlr->lp)) { -fcoe_ctlr_link_up (ctlr); - interface->enabled = true; +pr_err (PFX "bnx2fc_enable: interface not found\n" ); + }else { + rc =__bnx2fc_enable (ctlr); }mutex_unlock (&bnx2fc_dev_lock);
@@ -2072,14 +2104,12 @@ static int bnx2fc_enable(struct net_device *netdev)static int bnx2fc_ctlr_enabled (struct fcoe_ctlr_device *cdev) {struct fcoe_ctlr *ctlr =fcoe_ctlr_device_priv (cdev); -struct fc_lport *lport = ctlr->lp; -struct net_device *netdev =bnx2fc_netdev (lport);switch (cdev->enabled) {case FCOE_CTLR_ENABLED : -return bnx2fc_enable (netdev); +return __bnx2fc_enable (ctlr);case FCOE_CTLR_DISABLED : -return bnx2fc_disable (netdev); +return __bnx2fc_disable (ctlr);case FCOE_CTLR_UNUSED :default :return -ENOTSUPP ;
Signature · 1 line
1.7.1
PATCH 1/1 BNX2I: Fixed kernel panic due to illegal usage of sc->request->cpu
In reply to a message not in the archiveA kernel panic was observed when passing the sc->request->cpu = -1 to retrieve the per_cpu variable pointer:
#0 [ffff880011203960] machine_kexec at ffffffff81022bc3 #1 [ffff8800112039b0] crash_kexec at ffffffff81088630
#2 [ffff880011203a80] __die at ffffffff8139ea20
#3 [ffff880011203aa0] no_context at ffffffff8102f3a7
#4 [ffff880011203ae0] __bad_area_nosemaphore at ffffffff8102f665 #5 [ffff880011203ba0] retint_signal at ffffffff8139dd1f #6 [ffff880011203cc8] bnx2i_indicate_kcqe at ffffffffa03dc4f2 #7 [ffff880011203da8] service_kcqes at ffffffffa03cb04f #8 [ffff880011203e68] cnic_service_bnx2x_kcq at ffffffffa03cb14a #9 [ffff880011203e88] cnic_service_bnx2x_bh at ffffffffa03cb1b3
The problem lies in the sg_io (and perhaps sg_scsi_ioctl) call to blk_get_request->get_request/wait->blk_alloc_request->blk_rq_init which re-initializes the request->cpu to -1. There is no assignment for cpu from that to the request_fn call to low level drivers.
When this happens, the sc->request->cpu will be using the init value of -1. This will create a kernel panic when it hits bnx2i because the code refers it to get the per_cpu variables ptr.
This change is to put in a guard against that and also for cases when CONFIG_SMP/BIO_CPU_AFFINE is not enabled. In those cases, the cpu affinitization code would not get run in __make_request either; hence the request->cpu will remain a -1 also.
This bug was created from commit: b5cf6b63f73abdc051035f0050b367beeb2ef94c
--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/scsi/bnx2i/bnx2i_iscsi.c +4 -0
@@ -1225,6 +1225,10 @@ static int bnx2i_task_xmit(struct iscsi_task *task)if (!sc)return bnx2i_mtask_xmit (conn, task); +if (!blk_rq_cpu_valid (sc->request)) { + sc->request->cpu =get_cpu (); +put_cpu (); + }bnx2i_setup_cmd_wqe_template (cmd); cmd->req.op_code =ISCSI_OP_SCSI_CMD ; cmd->conn = bnx2i_conn;
Signature · 1 line
1.7.0.5
A message that is not in the archive (sent off-list or not yet received): 1310408095-11882-1-git-send-email-eddie.wai-dY08KVG/lbpWk0Htik3J/[email protected]
Re: [PATCH] BNX2I: Fixed kernel panic due to illegal usage of sc->request->cpu
Quoted 35 lines · Eddie Wai
A kernel panic was observed when passing the
sc->request->cpu= -1 to retrieve theper_cpuvariable pointer:
#0 [ffff880011203960]machine_kexecatffffffff81022bc3#1 [ffff8800112039b0]crash_kexecatffffffff81088630
#2 [ffff880011203a80]__dieatffffffff8139ea20
#3 [ffff880011203aa0]no_contextatffffffff8102f3a7
#4 [ffff880011203ae0]__bad_area_nosemaphoreatffffffff8102f665#5 [ffff880011203ba0]retint_signalatffffffff8139dd1f#6 [ffff880011203cc8]bnx2i_indicate_kcqeatffffffffa03dc4f2#7 [ffff880011203da8]service_kcqesatffffffffa03cb04f#8 [ffff880011203e68]cnic_service_bnx2x_kcqatffffffffa03cb14a#9 [ffff880011203e88]cnic_service_bnx2x_bhatffffffffa03cb1b3The problem lies in the
sg_io(and perhapssg_scsi_ioctl) call to blk_get_request->get_request/wait->blk_alloc_request->blk_rq_init which re-initializes therequest->cputo -1. There is no assignment for cpu from that to therequest_fncall to low level drivers.When this happens, the
sc->request->cpuwill be using the init value of -1. This will create a kernel panic when it hits bnx2i because the code refers it to get theper_cpuvariables ptr.This change is to put in a guard against that and also for cases when CONFIG_SMP/BIO_CPU_AFFINE is not enabled. In those cases, the cpu affinitization code would not get run in
__make_requesteither; hence therequest->cpuwill remain a -1 also.drivers/scsi/bnx2i/bnx2i_iscsi.c +0
-0
drivers/scsi/bnx2i/bnx2i_iscsi.c static int bnx2i_task_xmit(struct iscsi_task *task) · line 1231
Quoted 7 lines
drivers/scsi/bnx2i/bnx2i_iscsi.c +4
-0@@ -1225,6 +1225,10 @@ static int bnx2i_task_xmit(struct iscsi_task *task)if (!sc)return bnx2i_mtask_xmit (conn, task); +if (!blk_rq_cpu_valid (sc->request)) { + sc->request->cpu =get_cpu (); +put_cpu (); + }
If I understand you right, then I think this needs to get fixed in the block or scsi layer instead of each LLD.
Signature · 4 lines
You received this message because you are subscribed to the Google Groups "open-iscsi" group. To post to this group, send email to open-iscsi-/JYPxA39Uh5TLH3MbocFF+G/[email protected] To unsubscribe from this group, send email to open-iscsi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] For more options, visit this group at http://groups.google.com/group/open-iscsi?hl=en.
Re: [PATCH] BNX2I: Fixed kernel panic due to illegal usage of sc->request->cpu
Quoted 39 lines · Mike Christie
Quoted 38 lines · Eddie Wai
A kernel panic was observed when passing the
sc->request->cpu= -1 to retrieve theper_cpuvariable pointer:
#0 [ffff880011203960]machine_kexecatffffffff81022bc3#1 [ffff8800112039b0]crash_kexecatffffffff81088630
#2 [ffff880011203a80]__dieatffffffff8139ea20
#3 [ffff880011203aa0]no_contextatffffffff8102f3a7
#4 [ffff880011203ae0]__bad_area_nosemaphoreatffffffff8102f665#5 [ffff880011203ba0]retint_signalatffffffff8139dd1f#6 [ffff880011203cc8]bnx2i_indicate_kcqeatffffffffa03dc4f2#7 [ffff880011203da8]service_kcqesatffffffffa03cb04f#8 [ffff880011203e68]cnic_service_bnx2x_kcqatffffffffa03cb14a#9 [ffff880011203e88]cnic_service_bnx2x_bhatffffffffa03cb1b3The problem lies in the
sg_io(and perhapssg_scsi_ioctl) call to blk_get_request->get_request/wait->blk_alloc_request->blk_rq_init which re-initializes therequest->cputo -1. There is no assignment for cpu from that to therequest_fncall to low level drivers.When this happens, the
sc->request->cpuwill be using the init value of -1. This will create a kernel panic when it hits bnx2i because the code refers it to get theper_cpuvariables ptr.This change is to put in a guard against that and also for cases when CONFIG_SMP/BIO_CPU_AFFINE is not enabled. In those cases, the cpu affinitization code would not get run in
__make_requesteither; hence therequest->cpuwill remain a -1 also.drivers/scsi/bnx2i/bnx2i_iscsi.c +0
-0@@ -1225,6 +1225,10 @@ static int bnx2i_task_xmit(struct iscsi_task *task)if (!sc)return bnx2i_mtask_xmit (conn, task);
Quoted 8 lines
drivers/scsi/bnx2i/bnx2i_iscsi.c static int bnx2i_task_xmit(struct iscsi_task *task) · line 1231
Quoted 4 lines
drivers/scsi/bnx2i/bnx2i_iscsi.c +4
-0+if (!blk_rq_cpu_valid (sc->request)) { + sc->request->cpu =get_cpu (); +put_cpu (); + }If I understand you right, then I think this needs to get fixed in the block or scsi layer instead of each LLD.
Absolutely, but this bnx2i fix is still applicable alongside the fixes I'm proposing in the block layer below.
I think the whole idea behind the tracking of the blk req->cpu is so that the blk completion can be fired off from the same CPU to take advantage of the CPU's llc. However, this is only being done when the queue is defined with the QUEUE_FLAG_SAME_COMP queue_flag enabled. In the case when the queue is defined without this enforced, it would then be up to the blk completion code to complete the blk request with the current CPU of the thread.
The same analogy should apply to the iSCSI LLD for cmd completion as well. So if the sc->request->cpu is left at -1, the LLD should then decide how it wants the cmd completion to take place. For all the other cases, the request->cpu id should be used instead. For bnx2i, if the blk layer didn't set the request->cpu, we would want to align and complete the cmd against the task_xmit issuer's CPU id unconditionally; hence the explicit get_cpu call.
In the current block code, this CPU affinity code is only being called in the __make_request code path. I believe the same code needs to be executed in all the other code paths where the blk request is being added to the queue for execution. This change will then properly place the desired CPU to the request->cpu when the queue is defined with QUEUE_FLAG_SAME_COMP. Otherwise, the request->cpu will assume the init value of -1.
Please throw in your 2 cents if anyone thinks otherwise. I should have the blk layer patches submitted soon. Thanks.
Re: [PATCH] BNX2I: Fixed kernel panic due to illegal usage of sc->request->cpu
Quoted 59 lines · Eddie Wai
Quoted 39 lines · Mike Christie
Quoted 38 lines · Eddie Wai
A kernel panic was observed when passing the
sc->request->cpu= -1 to retrieve theper_cpuvariable pointer:
#0 [ffff880011203960]machine_kexecatffffffff81022bc3#1 [ffff8800112039b0]crash_kexecatffffffff81088630
#2 [ffff880011203a80]__dieatffffffff8139ea20
#3 [ffff880011203aa0]no_contextatffffffff8102f3a7
#4 [ffff880011203ae0]__bad_area_nosemaphoreatffffffff8102f665#5 [ffff880011203ba0]retint_signalatffffffff8139dd1f#6 [ffff880011203cc8]bnx2i_indicate_kcqeatffffffffa03dc4f2#7 [ffff880011203da8]service_kcqesatffffffffa03cb04f#8 [ffff880011203e68]cnic_service_bnx2x_kcqatffffffffa03cb14a#9 [ffff880011203e88]cnic_service_bnx2x_bhatffffffffa03cb1b3The problem lies in the
sg_io(and perhapssg_scsi_ioctl) call to blk_get_request->get_request/wait->blk_alloc_request->blk_rq_init which re-initializes therequest->cputo -1. There is no assignment for cpu from that to therequest_fncall to low level drivers.When this happens, the
sc->request->cpuwill be using the init value of -1. This will create a kernel panic when it hits bnx2i because the code refers it to get theper_cpuvariables ptr.This change is to put in a guard against that and also for cases when CONFIG_SMP/BIO_CPU_AFFINE is not enabled. In those cases, the cpu affinitization code would not get run in
__make_requesteither; hence therequest->cpuwill remain a -1 also.drivers/scsi/bnx2i/bnx2i_iscsi.c +0
-0@@ -1225,6 +1225,10 @@ static int bnx2i_task_xmit(struct iscsi_task *task)if (!sc)return bnx2i_mtask_xmit (conn, task);Quoted 8 lines
drivers/scsi/bnx2i/bnx2i_iscsi.c static int bnx2i_task_xmit(struct iscsi_task *task) · line 1231
Quoted 4 lines
drivers/scsi/bnx2i/bnx2i_iscsi.c +4
-0+if (!blk_rq_cpu_valid (sc->request)) { + sc->request->cpu =get_cpu (); +put_cpu (); + }If I understand you right, then I think this needs to get fixed in the block or scsi layer instead of each LLD.
Absolutely, but this bnx2i fix is still applicable alongside the fixes I'm proposing in the block layer below.
I think the whole idea behind the tracking of the blk
req->cpuis so that the blk completion can be fired off from the same CPU to take advantage of the CPU's llc. However, this is only being done when the queue is defined with theQUEUE_FLAG_SAME_COMPqueue_flagenabled. In the case when the queue is defined without this enforced, it would then be up to the blk completion code to complete the blk request with the current CPU of the thread.
Quoted 5 lines
The same analogy should apply to the iSCSI LLD for cmd completion as well. So if the
sc->request->cpuis left at -1, the LLD should then decide how it wants the cmd completion to take place. For all the other cases, therequest->cpuid should be used instead. For bnx2i, if the blk layer didn't set therequest->cpu, we would want to align and complete the cmd against thetask_xmitissuer's CPU id unconditionally; hence the explicitget_cpucall.
I actually think all this should go in the block layer. We should not have driver specific setting/interfaces for this. The driver should be able to just have the block layer complete all the IO on some soft irq/thread and do the right thing. Then we can have one interface in the block layer too.
We do not want to end up with every driver adding some sysfs/modparm interfaces to control if we are going to complete the IO on the same cpu, round robin cpus, etc.
I think we need to change the blkio poll code so it is usefull to everyone. It does not make sense for every driver to want to do some completion processing in a thread/softirq then have every driver create their own threading and completing code/policies. From there we can have a common interface to control the cpu completion polciy.
It will be really strange to tell users that in one case we use the block layer policy but in another case we use the LLD policy interface.
I think right now we are ending up with a mess where someone can set the rq_affinity, the LLD will ignore this and do round robin completion on its own threads, then when the block layer soft irq completion code runs it will complete on the cpu set by the rq_affinity code.
Quoted 7 lines
In the current block code, this CPU affinity code is only being called in the
__make_requestcode path. I believe the same code needs to be executed in all the other code paths where the blk request is being added to the queue for execution. This change will then properly place the desired CPU to therequest->cpuwhen the queue is defined withQUEUE_FLAG_SAME_COMP. Otherwise, therequest->cpuwill assume the init value of -1.
I am not disagreeing with that.
Re: [PATCH] BNX2I: Fixed kernel panic due to illegal usage of sc->request->cpu
In reply to Eddie WaiQuoted 59 lines · Eddie Wai
Quoted 39 lines · Mike Christie
Quoted 38 lines · Eddie Wai
A kernel panic was observed when passing the
sc->request->cpu= -1 to retrieve theper_cpuvariable pointer:
#0 [ffff880011203960]machine_kexecatffffffff81022bc3#1 [ffff8800112039b0]crash_kexecatffffffff81088630
#2 [ffff880011203a80]__dieatffffffff8139ea20
#3 [ffff880011203aa0]no_contextatffffffff8102f3a7
#4 [ffff880011203ae0]__bad_area_nosemaphoreatffffffff8102f665#5 [ffff880011203ba0]retint_signalatffffffff8139dd1f#6 [ffff880011203cc8]bnx2i_indicate_kcqeatffffffffa03dc4f2#7 [ffff880011203da8]service_kcqesatffffffffa03cb04f#8 [ffff880011203e68]cnic_service_bnx2x_kcqatffffffffa03cb14a#9 [ffff880011203e88]cnic_service_bnx2x_bhatffffffffa03cb1b3The problem lies in the
sg_io(and perhapssg_scsi_ioctl) call to blk_get_request->get_request/wait->blk_alloc_request->blk_rq_init which re-initializes therequest->cputo -1. There is no assignment for cpu from that to therequest_fncall to low level drivers.When this happens, the
sc->request->cpuwill be using the init value of -1. This will create a kernel panic when it hits bnx2i because the code refers it to get theper_cpuvariables ptr.This change is to put in a guard against that and also for cases when CONFIG_SMP/BIO_CPU_AFFINE is not enabled. In those cases, the cpu affinitization code would not get run in
__make_requesteither; hence therequest->cpuwill remain a -1 also.drivers/scsi/bnx2i/bnx2i_iscsi.c +0
-0@@ -1225,6 +1225,10 @@ static int bnx2i_task_xmit(struct iscsi_task *task)if (!sc)return bnx2i_mtask_xmit (conn, task);Quoted 8 lines
drivers/scsi/bnx2i/bnx2i_iscsi.c static int bnx2i_task_xmit(struct iscsi_task *task) · line 1231
Quoted 4 lines
drivers/scsi/bnx2i/bnx2i_iscsi.c +4
-0+if (!blk_rq_cpu_valid (sc->request)) { + sc->request->cpu =get_cpu (); +put_cpu (); + }If I understand you right, then I think this needs to get fixed in the block or scsi layer instead of each LLD.
Absolutely, but this bnx2i fix is still applicable alongside the fixes I'm proposing in the block layer below.
I think the whole idea behind the tracking of the blk
req->cpuis so that the blk completion can be fired off from the same CPU to take advantage of the CPU's llc. However, this is only being done when the queue is defined with theQUEUE_FLAG_SAME_COMPqueue_flagenabled. In the case when the queue is defined without this enforced, it would then be up to the blk completion code to complete the blk request with the current CPU of the thread.
Quoted 5 lines
The same analogy should apply to the iSCSI LLD for cmd completion as well. So if the
sc->request->cpuis left at -1, the LLD should then decide how it wants the cmd completion to take place. For all the other cases, therequest->cpuid should be used instead. For bnx2i, if the blk layer didn't set therequest->cpu, we would want to align and complete the cmd against thetask_xmitissuer's CPU id unconditionally; hence the explicitget_cpucall.
Oh yeah, wrt the code we have today (so I mean ignoring my rant in the other mail :)), I think what you are doing in your patch is sort of ok. I am not sure if we want to be touching the request->cpu field in a LLD though. I do not think LLDs should be modifying a block layer struct like that probably.
Re: [PATCH] BNX2I: Fixed kernel panic due to illegal usage of sc->request->cpu
Quoted 66 lines · Mike Christie
Quoted 59 lines · Eddie Wai
Quoted 39 lines · Mike Christie
Quoted 38 lines · Eddie Wai
A kernel panic was observed when passing the
sc->request->cpu= -1 to retrieve theper_cpuvariable pointer:
#0 [ffff880011203960]machine_kexecatffffffff81022bc3#1 [ffff8800112039b0]crash_kexecatffffffff81088630
#2 [ffff880011203a80]__dieatffffffff8139ea20
#3 [ffff880011203aa0]no_contextatffffffff8102f3a7
#4 [ffff880011203ae0]__bad_area_nosemaphoreatffffffff8102f665#5 [ffff880011203ba0]retint_signalatffffffff8139dd1f#6 [ffff880011203cc8]bnx2i_indicate_kcqeatffffffffa03dc4f2#7 [ffff880011203da8]service_kcqesatffffffffa03cb04f#8 [ffff880011203e68]cnic_service_bnx2x_kcqatffffffffa03cb14a#9 [ffff880011203e88]cnic_service_bnx2x_bhatffffffffa03cb1b3The problem lies in the
sg_io(and perhapssg_scsi_ioctl) call to blk_get_request->get_request/wait->blk_alloc_request->blk_rq_init which re-initializes therequest->cputo -1. There is no assignment for cpu from that to therequest_fncall to low level drivers.When this happens, the
sc->request->cpuwill be using the init value of -1. This will create a kernel panic when it hits bnx2i because the code refers it to get theper_cpuvariables ptr.This change is to put in a guard against that and also for cases when CONFIG_SMP/BIO_CPU_AFFINE is not enabled. In those cases, the cpu affinitization code would not get run in
__make_requesteither; hence therequest->cpuwill remain a -1 also.drivers/scsi/bnx2i/bnx2i_iscsi.c +0
-0@@ -1225,6 +1225,10 @@ static int bnx2i_task_xmit(struct iscsi_task *task)if (!sc)return bnx2i_mtask_xmit (conn, task);Quoted 8 lines
drivers/scsi/bnx2i/bnx2i_iscsi.c static int bnx2i_task_xmit(struct iscsi_task *task) · line 1231
Quoted 4 lines
drivers/scsi/bnx2i/bnx2i_iscsi.c +4
-0+if (!blk_rq_cpu_valid (sc->request)) { + sc->request->cpu =get_cpu (); +put_cpu (); + }If I understand you right, then I think this needs to get fixed in the block or scsi layer instead of each LLD.
Absolutely, but this bnx2i fix is still applicable alongside the fixes I'm proposing in the block layer below.
I think the whole idea behind the tracking of the blk
req->cpuis so that the blk completion can be fired off from the same CPU to take advantage of the CPU's llc. However, this is only being done when the queue is defined with theQUEUE_FLAG_SAME_COMPqueue_flagenabled. In the case when the queue is defined without this enforced, it would then be up to the blk completion code to complete the blk request with the current CPU of the thread.Quoted 5 lines
The same analogy should apply to the iSCSI LLD for cmd completion as well. So if the
sc->request->cpuis left at -1, the LLD should then decide how it wants the cmd completion to take place. For all the other cases, therequest->cpuid should be used instead. For bnx2i, if the blk layer didn't set therequest->cpu, we would want to align and complete the cmd against thetask_xmitissuer's CPU id unconditionally; hence the explicitget_cpucall.
Quoted 6 lines
Oh yeah, wrt the code we have today (so I mean ignoring my rant in the other mail :)), I think what you are doing in your patch is sort of ok. I am not sure if we want to be touching the
request->cpufield in a LLD though. I do not think LLDs should be modifying a block layer struct like that probably.
Agreed. sc->request->cpu should be left to -1 in this case. I'll go ahead and defined a local variable to keep track of it. Thanks.
PATCH v2 1/1 BNX2I: Fixed kernel panic due to illegal usage of sc->request->cpu
In reply to a message not in the archiveA kernel panic was observed when passing the sc->request->cpu = -1 to retrieve the per_cpu variable pointer:
#0 [ffff880011203960] machine_kexec at ffffffff81022bc3 #1 [ffff8800112039b0] crash_kexec at ffffffff81088630
#2 [ffff880011203a80] __die at ffffffff8139ea20
#3 [ffff880011203aa0] no_context at ffffffff8102f3a7
#4 [ffff880011203ae0] __bad_area_nosemaphore at ffffffff8102f665 #5 [ffff880011203ba0] retint_signal at ffffffff8139dd1f #6 [ffff880011203cc8] bnx2i_indicate_kcqe at ffffffffa03dc4f2 #7 [ffff880011203da8] service_kcqes at ffffffffa03cb04f #8 [ffff880011203e68] cnic_service_bnx2x_kcq at ffffffffa03cb14a #9 [ffff880011203e88] cnic_service_bnx2x_bh at ffffffffa03cb1b3
The problem lies in the sg_io (and perhaps sg_scsi_ioctl) call to blk_get_request->get_request/wait->blk_alloc_request->blk_rq_init which re-initializes the request->cpu to -1. There is no assignment for cpu from that to the request_fn call to low level drivers.
When this happens, the sc->request->cpu will be using the init value of -1. This will create a kernel panic when it hits bnx2i because the code refers it to get the per_cpu variables ptr.
This change is to put in a guard against that and also for cases when bio affinity/queue completion to the same cpu is not enabled. In those cases, the request->cpu will remain a -1 also.
This bug was created from commit: b5cf6b63f73abdc051035f0050b367beeb2ef94c
For the case when the blk layer did not setup the request->cpu, bnx2i will complete the sc with the current CPU of the thread.
--- drivers/scsi/bnx2i/bnx2i_hwi.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)
drivers/scsi/bnx2i/bnx2i_hwi.c +8 -1
@@ -1901,6 +1901,7 @@ static int bnx2i_queue_scsi_cmd_resp(struct iscsi_session *session,struct iscsi_task *task;struct scsi_cmnd *sc;int rc =0 ; +int cpu;spin_lock (&session->lock); task = iscsi_itt_to_task(bnx2i_conn->cls_conn->dd_data,
@@ -1912,7 +1913,13 @@ static int bnx2i_queue_scsi_cmd_resp(struct iscsi_session *session, sc = task->sc;spin_unlock (&session->lock); - p = &per_cpu (bnx2i_percpu, sc->request->cpu); +if (!blk_rq_cpu_valid (sc->request)) { + cpu =get_cpu (); +put_cpu (); + }else + cpu = sc->request->cpu; + + p = &per_cpu (bnx2i_percpu, cpu);spin_lock (&p->p_work_lock);if (unlikely (!p->iothread)) { rc = -EINVAL ;
Signature · 1 line
1.7.0.5
Re: [PATCH v2] BNX2I: Fixed kernel panic due to illegal usage of sc->request->cpu
Quoted 49 lines · Eddie Wai
A kernel panic was observed when passing the
sc->request->cpu= -1 to retrieve theper_cpuvariable pointer:
#0 [ffff880011203960]machine_kexecatffffffff81022bc3#1 [ffff8800112039b0]crash_kexecatffffffff81088630
#2 [ffff880011203a80]__dieatffffffff8139ea20
#3 [ffff880011203aa0]no_contextatffffffff8102f3a7
#4 [ffff880011203ae0]__bad_area_nosemaphoreatffffffff8102f665#5 [ffff880011203ba0]retint_signalatffffffff8139dd1f#6 [ffff880011203cc8]bnx2i_indicate_kcqeatffffffffa03dc4f2#7 [ffff880011203da8]service_kcqesatffffffffa03cb04f#8 [ffff880011203e68]cnic_service_bnx2x_kcqatffffffffa03cb14a#9 [ffff880011203e88]cnic_service_bnx2x_bhatffffffffa03cb1b3The problem lies in the
sg_io(and perhapssg_scsi_ioctl) call to blk_get_request->get_request/wait->blk_alloc_request->blk_rq_init which re-initializes therequest->cputo -1. There is no assignment for cpu from that to therequest_fncall to low level drivers.When this happens, the
sc->request->cpuwill be using the init value of -1. This will create a kernel panic when it hits bnx2i because the code refers it to get theper_cpuvariables ptr.This change is to put in a guard against that and also for cases when bio affinity/queue completion to the same cpu is not enabled. In those cases, the
request->cpuwill remain a -1 also.This bug was created from commit:
b5cf6b63f73abdc051035f0050b367beeb2ef94cFor the case when the blk layer did not setup the
request->cpu, bnx2i will complete the sc with the current CPU of the thread.Signed-off-by Eddie Wai <[email protected]>--- drivers/scsi/bnx2i/bnx2i_hwi.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)drivers/scsi/bnx2i/bnx2i_hwi.c +1
-0@@ -1901,6 +1901,7 @@ static int bnx2i_queue_scsi_cmd_resp(struct iscsi_session *session,struct iscsi_task *task;struct scsi_cmnd *sc;int rc =0 ; +int cpu;spin_lock (&session->lock); task = iscsi_itt_to_task(bnx2i_conn->cls_conn->dd_data,
drivers/scsi/bnx2i/bnx2i_hwi.c static int bnx2i_queue_scsi_cmd_resp(struct iscsi_session *session, · line 1918
Quoted 7 lines
drivers/scsi/bnx2i/bnx2i_hwi.c +3
-1@@ -1912,7 +1913,13 @@ static int bnx2i_queue_scsi_cmd_resp(struct iscsi_session *session, sc = task->sc;spin_unlock (&session->lock); - p = &per_cpu (bnx2i_percpu, sc->request->cpu); +if (!blk_rq_cpu_valid (sc->request)) { + cpu =get_cpu (); +put_cpu ();
Why not just use smp_processor_id()?
Quoted 7 lines
drivers/scsi/bnx2i/bnx2i_hwi.c +4
-0+ }else + cpu = sc->request->cpu; + + p = &per_cpu (bnx2i_percpu, cpu);spin_lock (&p->p_work_lock);if (unlikely (!p->iothread)) { rc = -EINVAL ;
Re: [PATCH v2] BNX2I: Fixed kernel panic due to illegal usage of sc->request->cpu
Quoted 53 lines · Michael Chan
Quoted 52 lines · Eddie Wai
A kernel panic was observed when passing the
sc->request->cpu= -1 to retrieve theper_cpuvariable pointer:
#0 [ffff880011203960]machine_kexecatffffffff81022bc3#1 [ffff8800112039b0]crash_kexecatffffffff81088630
#2 [ffff880011203a80]__dieatffffffff8139ea20
#3 [ffff880011203aa0]no_contextatffffffff8102f3a7
#4 [ffff880011203ae0]__bad_area_nosemaphoreatffffffff8102f665#5 [ffff880011203ba0]retint_signalatffffffff8139dd1f#6 [ffff880011203cc8]bnx2i_indicate_kcqeatffffffffa03dc4f2#7 [ffff880011203da8]service_kcqesatffffffffa03cb04f#8 [ffff880011203e68]cnic_service_bnx2x_kcqatffffffffa03cb14a#9 [ffff880011203e88]cnic_service_bnx2x_bhatffffffffa03cb1b3The problem lies in the
sg_io(and perhapssg_scsi_ioctl) call to blk_get_request->get_request/wait->blk_alloc_request->blk_rq_init which re-initializes therequest->cputo -1. There is no assignment for cpu from that to therequest_fncall to low level drivers.When this happens, the
sc->request->cpuwill be using the init value of -1. This will create a kernel panic when it hits bnx2i because the code refers it to get theper_cpuvariables ptr.This change is to put in a guard against that and also for cases when bio affinity/queue completion to the same cpu is not enabled. In those cases, the
request->cpuwill remain a -1 also.This bug was created from commit:
b5cf6b63f73abdc051035f0050b367beeb2ef94cFor the case when the blk layer did not setup the
request->cpu, bnx2i will complete the sc with the current CPU of the thread.Signed-off-by Eddie Wai <[email protected]>--- drivers/scsi/bnx2i/bnx2i_hwi.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)drivers/scsi/bnx2i/bnx2i_hwi.c +1
-0@@ -1901,6 +1901,7 @@ static int bnx2i_queue_scsi_cmd_resp(struct iscsi_session *session,struct iscsi_task *task;struct scsi_cmnd *sc;int rc =0 ; +int cpu;spin_lock (&session->lock); task = iscsi_itt_to_task(bnx2i_conn->cls_conn->dd_data,@@ -1912,7 +1913,13 @@ static int bnx2i_queue_scsi_cmd_resp(struct iscsi_session *session, sc = task->sc;spin_unlock (&session->lock);
Quoted 6 lines
drivers/scsi/bnx2i/bnx2i_hwi.c static int bnx2i_queue_scsi_cmd_resp(struct iscsi_session *session, · line 1918
Quoted 4 lines
drivers/scsi/bnx2i/bnx2i_hwi.c +3
-1- p = &per_cpu (bnx2i_percpu, sc->request->cpu); +if (!blk_rq_cpu_valid (sc->request)) { + cpu =get_cpu (); +put_cpu ();Why not just use
smp_processor_id()?
Good point. This is run inside a tasklet which preemption is already disabled. I'll make the change, thanks.
Quoted 9 lines
Quoted 8 lines
drivers/scsi/bnx2i/bnx2i_hwi.c +4
-0+ }else + cpu = sc->request->cpu; + + p = &per_cpu (bnx2i_percpu, cpu);spin_lock (&p->p_work_lock);if (unlikely (!p->iothread)) { rc = -EINVAL ;
PATCH v3 1/1 BNX2I: Fixed kernel panic due to illegal usage of sc->request->cpu
In reply to a message not in the archiveA kernel panic was observed when passing the sc->request->cpu = -1 to retrieve the per_cpu variable pointer:
#0 [ffff880011203960] machine_kexec at ffffffff81022bc3 #1 [ffff8800112039b0] crash_kexec at ffffffff81088630
#2 [ffff880011203a80] __die at ffffffff8139ea20
#3 [ffff880011203aa0] no_context at ffffffff8102f3a7
#4 [ffff880011203ae0] __bad_area_nosemaphore at ffffffff8102f665 #5 [ffff880011203ba0] retint_signal at ffffffff8139dd1f #6 [ffff880011203cc8] bnx2i_indicate_kcqe at ffffffffa03dc4f2 #7 [ffff880011203da8] service_kcqes at ffffffffa03cb04f #8 [ffff880011203e68] cnic_service_bnx2x_kcq at ffffffffa03cb14a #9 [ffff880011203e88] cnic_service_bnx2x_bh at ffffffffa03cb1b3
The problem lies in the slow path sg_io (and perhaps sg_scsi_ioctl) call to blk_get_request->get_request/wait->blk_alloc_request->blk_rq_init which re-initializes the request->cpu to -1. There is no assignment for cpu from that to the request_fn call to low level drivers.
When this happens, the sc->request->cpu will be using the init value of -1. This will create a kernel panic when it hits bnx2i because the code refers it to get the per_cpu variables ptr.
This change is to put in a guard against that and also for cases when bio affinity/queue completion to the same cpu is not enabled. In those cases, the request->cpu will remain a -1 also.
This bug was created from commit: b5cf6b63f73abdc051035f0050b367beeb2ef94c
For the case when the blk layer did not setup the request->cpu, bnx2i will complete the sc with the current CPU of the thread.
--- drivers/scsi/bnx2i/bnx2i_hwi.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
drivers/scsi/bnx2i/bnx2i_hwi.c +7 -1
@@ -1901,6 +1901,7 @@ static int bnx2i_queue_scsi_cmd_resp(struct iscsi_session *session,struct iscsi_task *task;struct scsi_cmnd *sc;int rc =0 ; +int cpu;spin_lock (&session->lock); task = iscsi_itt_to_task(bnx2i_conn->cls_conn->dd_data,
@@ -1912,7 +1913,12 @@ static int bnx2i_queue_scsi_cmd_resp(struct iscsi_session *session, sc = task->sc;spin_unlock (&session->lock); - p = &per_cpu (bnx2i_percpu, sc->request->cpu); +if (!blk_rq_cpu_valid (sc->request)) + cpu =smp_processor_id (); +else + cpu = sc->request->cpu; + + p = &per_cpu (bnx2i_percpu, cpu);spin_lock (&p->p_work_lock);if (unlikely (!p->iothread)) { rc = -EINVAL ;
Signature · 1 line
1.7.0.5
PATCH 1/2 BNX2I: Added the setting of target can_queue via target_alloc
In reply to a message not in the archiveThis will set the target can_queue limit to the number of preallocated session tasks set during creation.
"Could not send nopout" messages were observed without this when the iSCSI connection experiences dropped frames under heavy I/O stress.
--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/scsi/bnx2i/bnx2i_iscsi.c +1 -0
@@ -2244,6 +2244,7 @@ static struct scsi_host_template bnx2i_host_template = { .eh_device_reset_handler = iscsi_eh_device_reset, .eh_target_reset_handler = iscsi_eh_recover_target, .change_queue_depth = iscsi_change_queue_depth, + .target_alloc = iscsi_target_alloc, .can_queue = 2048, .max_sectors = 127, .cmd_per_lun = 128,
Signature · 1 line
1.7.7.4
A message that is not in the archive (sent off-list or not yet received): 1335391425-30410-1-git-send-email-eddie.wai-dY08KVG/lbpWk0Htik3J/[email protected]
Mike Christie
Reviewed-byRe: [PATCH 1/2] BNX2I: Added the setting of target can_queue via target_alloc
Quoted 7 lines · Eddie Wai
This will set the target
can_queuelimit to the number of preallocated session tasks set during creation."Could not send nopout" messages were observed without this when the iSCSI connection experiences dropped frames under heavy I/O stress.
Both patches look ok to me.
Signature · 4 lines
You received this message because you are subscribed to the Google Groups "open-iscsi" group. To post to this group, send email to open-iscsi-/JYPxA39Uh5TLH3MbocFF+G/[email protected] To unsubscribe from this group, send email to open-iscsi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] For more options, visit this group at http://groups.google.com/group/open-iscsi?hl=en.
PATCH 1/2 BNX2I: Update version and copyright year 2013
In reply to a message not in the archiveOld version: 2.7.2.2
New version: 2.7.6.2
--- drivers/scsi/bnx2i/57xx_iscsi_constants.h | 2 +- drivers/scsi/bnx2i/57xx_iscsi_hsi.h | 2 +- drivers/scsi/bnx2i/bnx2i.h | 2 +- drivers/scsi/bnx2i/bnx2i_hwi.c | 2 +- drivers/scsi/bnx2i/bnx2i_init.c | 6 +++--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 2 +- drivers/scsi/bnx2i/bnx2i_sysfs.c | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-)
drivers/scsi/bnx2i/57xx_iscsi_constants.h +1 -1
@@ -1,6 +1,6 @@/* 57xx_iscsi_constants.h: Broadcom NetXtreme II iSCSI HSI * -* Copyright (c) 2006 - 2012 Broadcom Corporation +* Copyright (c) 2006 - 2013 Broadcom Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
drivers/scsi/bnx2i/57xx_iscsi_hsi.h +1 -1
@@ -1,6 +1,6 @@/* 57xx_iscsi_hsi.h: Broadcom NetXtreme II iSCSI HSI. * -* Copyright (c) 2006 - 2012 Broadcom Corporation +* Copyright (c) 2006 - 2013 Broadcom Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
drivers/scsi/bnx2i/bnx2i.h +1 -1
@@ -1,6 +1,6 @@/* bnx2i.h: Broadcom NetXtreme II iSCSI driver. * -* Copyright (c) 2006 - 2012 Broadcom Corporation +* Copyright (c) 2006 - 2013 Broadcom Corporation * Copyright (c) 2007, 2008 Red Hat, Inc. All rights reserved. * Copyright (c) 2007, 2008 Mike Christie *
drivers/scsi/bnx2i/bnx2i_hwi.c +1 -1
@@ -1,6 +1,6 @@/* bnx2i_hwi.c: Broadcom NetXtreme II iSCSI driver. * -* Copyright (c) 2006 - 2012 Broadcom Corporation +* Copyright (c) 2006 - 2013 Broadcom Corporation * Copyright (c) 2007, 2008 Red Hat, Inc. All rights reserved. * Copyright (c) 2007, 2008 Mike Christie *
drivers/scsi/bnx2i/bnx2i_init.c +3 -3
@@ -1,6 +1,6 @@/* bnx2i.c: Broadcom NetXtreme II iSCSI driver. * -* Copyright (c) 2006 - 2012 Broadcom Corporation +* Copyright (c) 2006 - 2013 Broadcom Corporation * Copyright (c) 2007, 2008 Red Hat, Inc. All rights reserved. * Copyright (c) 2007, 2008 Mike Christie *
@@ -18,8 +18,8 @@ static struct list_head adapter_list = LIST_HEAD_INIT(adapter_list);static u32 adapter_count;#define DRV_MODULE_NAME "bnx2i" -#define DRV_MODULE_VERSION "2.7.2.2" -#define DRV_MODULE_RELDATE "Apr 25, 2012" +#define DRV_MODULE_VERSION "2.7.6.2" +#define DRV_MODULE_RELDATE "Jun 06, 2013"static char version[] ="Broadcom NetXtreme II iSCSI Driver " DRV_MODULE_NAME \
drivers/scsi/bnx2i/bnx2i_iscsi.c +1 -1
@@ -1,7 +1,7 @@/* * bnx2i_iscsi.c: Broadcom NetXtreme II iSCSI driver. * -* Copyright (c) 2006 - 2012 Broadcom Corporation +* Copyright (c) 2006 - 2013 Broadcom Corporation * Copyright (c) 2007, 2008 Red Hat, Inc. All rights reserved. * Copyright (c) 2007, 2008 Mike Christie *
drivers/scsi/bnx2i/bnx2i_sysfs.c +1 -1
@@ -1,6 +1,6 @@/* bnx2i_sysfs.c: Broadcom NetXtreme II iSCSI driver. * -* Copyright (c) 2004 - 2012 Broadcom Corporation +* Copyright (c) 2004 - 2013 Broadcom Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
Signature · 1 line
1.7.7.4
PATCH 2/2 MAINTAINER: Added maintainer info for bnx2i
--- MAINTAINERS | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
MAINTAINERS +6 -0
@@ -1816,6 +1816,12 @@ L: [email protected] S: Supported F: drivers/scsi/bnx2fc/ +BROADCOM BNX2I 1/10 GIGABIT iSCSI DRIVER +M: Eddie Wai <[email protected]> +L: [email protected] +S: Supported +F: drivers/scsi/bnx2i/ + BROADCOM SPECIFIC AMBA DRIVER (BCMA) M: Rafał Miłecki <[email protected]> L: [email protected]
Signature · 7 lines
1.7.7.4 -- 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 1/1 BNX2I: Removed the reference to the netdev->base_addr
In reply to a message not in the archiveThe netdev->base_addr parameter has been deprecated in the L2 bnx2 driver. This is used by bnx2i for the BARn iomapping.
This patch will directly reference the pci_resource_start instead of using the deprecated netdev->base_addr.
--- drivers/scsi/bnx2i/bnx2i.h | 1 + drivers/scsi/bnx2i/bnx2i_hwi.c | 3 +-- drivers/scsi/bnx2i/bnx2i_iscsi.c | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-)
drivers/scsi/bnx2i/bnx2i.h +1 -0
@@ -350,6 +350,7 @@ struct bnx2i_hba {struct pci_dev *pcidev;struct net_device *netdev;void __iomem *regview; +resource_size_t reg_base;u32 age;unsigned long cnic_dev_type;
drivers/scsi/bnx2i/bnx2i_hwi.c +1 -2
@@ -2724,7 +2724,6 @@ int bnx2i_map_ep_dbell_regs(struct bnx2i_endpoint *ep) goto arm_cq; } - reg_base = ep->hba->netdev->base_addr;if ((test_bit (BNX2I_NX2_DEV_5709 , &ep->hba->cnic_dev_type)) && (ep->hba->mail_queue_access ==BNX2I_MQ_BIN_MODE )) { config2 =REG_RD (ep->hba,BNX2_MQ_CONFIG2 );
@@ -2740,7 +2739,7 @@ int bnx2i_map_ep_dbell_regs(struct bnx2i_endpoint *ep)/* 5709 device in normal node and 5706/5708 devices */ reg_off =CTX_OFFSET + (MB_KERNEL_CTX_SIZE * cid_num); - ep->qp.ctx_base =ioremap_nocache (reg_base + reg_off, + ep->qp.ctx_base =ioremap_nocache (ep->hba->reg_base + reg_off,MB_KERNEL_CTX_SIZE );if (!ep->qp.ctx_base)return -ENOMEM ;
drivers/scsi/bnx2i/bnx2i_iscsi.c +5 -5
@@ -811,13 +811,13 @@ struct bnx2i_hba *bnx2i_alloc_hba(struct cnic_dev *cnic)bnx2i_identify_device (hba);bnx2i_setup_host_queue_size (hba, shost); + hba->reg_base =pci_resource_start (hba->pcidev,0 );if (test_bit (BNX2I_NX2_DEV_5709 , &hba->cnic_dev_type)) { - hba->regview =ioremap_nocache (hba->netdev->base_addr, -BNX2_MQ_CONFIG2 ); + hba->regview =pci_iomap (hba->pcidev,0 ,BNX2_MQ_CONFIG2 );if (!hba->regview) goto ioreg_map_err; }else if (test_bit (BNX2I_NX2_DEV_57710 , &hba->cnic_dev_type)) { - hba->regview =ioremap_nocache (hba->netdev->base_addr,4096 ); + hba->regview =pci_iomap (hba->pcidev,0 ,4096 );if (!hba->regview) goto ioreg_map_err; }
@@ -884,7 +884,7 @@ cid_que_err:bnx2i_free_mp_bdt (hba); mp_bdt_mem_err:if (hba->regview) { -iounmap (hba->regview); +pci_iounmap (hba->pcidev, hba->regview); hba->regview =NULL ; } ioreg_map_err:
@@ -910,7 +910,7 @@ void bnx2i_free_hba(struct bnx2i_hba *hba)pci_dev_put (hba->pcidev);if (hba->regview) { -iounmap (hba->regview); +pci_iounmap (hba->pcidev, hba->regview); hba->regview =NULL ; }bnx2i_free_mp_bdt (hba);
Signature · 1 line
1.7.7.4
A message that is not in the archive (sent off-list or not yet received): 1341013055-16339-1-git-send-email-eddie.wai-dY08KVG/lbpWk0Htik3J/[email protected]
Mike Christie
Reviewed-byRe: [PATCH] BNX2I: Removed the reference to the netdev->base_addr
Quoted 7 lines · Eddie Wai
The
netdev->base_addrparameter has been deprecated in the L2 bnx2 driver. This is used by bnx2i for the BARn iomapping.This patch will directly reference the
pci_resource_startinstead of using the deprecatednetdev->base_addr.
Looks ok to me
Signature · 4 lines
You received this message because you are subscribed to the Google Groups "open-iscsi" group. To post to this group, send email to open-iscsi-/JYPxA39Uh5TLH3MbocFF+G/[email protected] To unsubscribe from this group, send email to open-iscsi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] For more options, visit this group at http://groups.google.com/group/open-iscsi?hl=en.
Re: [PATCH] BNX2I: Removed the reference to the netdev->base_addr
Thanks, Mike.
Hello James,
This patch is actually a critical bug fix as the 1G bnx2 driver no longer supports the netdev->base_addr in the current kernel of the scsi tree. This means that Broadcom's 1G Linux iSCSI offload solution would not work at all without this patch. If at all possible, please consider including this patch into the fixes branch.
Thanks,
Eddie
Quoted 14 lines · Mike Christie
Quoted 7 lines · Eddie Wai
The
netdev->base_addrparameter has been deprecated in the L2 bnx2 driver. This is used by bnx2i for the BARn iomapping.This patch will directly reference the
pci_resource_startinstead of using the deprecatednetdev->base_addr.Signed-off-by Eddie Wai <[email protected]>Looks ok to me
Reviewed-by Mike Christie <[email protected]>
PATCH 1/1 LIBISCSI: Added the new boot_nic entry in the session sysfs
In reply to a message not in the archiveThis is the kernel part of the modification to extract the net params from the ibft sysfs to the iface struct used for the connection request upon sync_session in the open-iscsi util.
--- drivers/scsi/libiscsi.c | 6 ++++++ drivers/scsi/scsi_transport_iscsi.c | 4 ++++ include/scsi/iscsi_if.h | 2 ++ include/scsi/libiscsi.h | 2 ++ 4 files changed, 14 insertions(+), 0 deletions(-)
drivers/scsi/libiscsi.c +6 -0
@@ -2809,6 +2809,7 @@ void iscsi_session_teardown(struct iscsi_cls_session *cls_session)kfree (session->targetname);kfree (session->targetalias);kfree (session->initiatorname); +kfree (session->boot_nic);kfree (session->ifacename);iscsi_destroy_session (cls_session);
@@ -3248,6 +3249,8 @@ int iscsi_set_param(struct iscsi_cls_conn *cls_conn,return iscsi_switch_str_param (&session->ifacename, buf);case ISCSI_PARAM_INITIATOR_NAME :return iscsi_switch_str_param (&session->initiatorname, buf); +case ISCSI_PARAM_BOOT_NIC : +return iscsi_switch_str_param (&session->boot_nic, buf);default :return -ENOSYS ; }
@@ -3326,6 +3329,9 @@ int iscsi_session_get_param(struct iscsi_cls_session *cls_session,case ISCSI_PARAM_INITIATOR_NAME : len =sprintf (buf,"%s\n" , session->initiatorname);break ; +case ISCSI_PARAM_BOOT_NIC : + len =sprintf (buf,"%s\n" , session->boot_nic); +break ;default :return -ENOSYS ; }
drivers/scsi/scsi_transport_iscsi.c +4 -0
@@ -2484,6 +2484,7 @@ iscsi_session_attr(tgt_reset_tmo, ISCSI_PARAM_TGT_RESET_TMO, 0);iscsi_session_attr (ifacename,ISCSI_PARAM_IFACE_NAME ,0 );iscsi_session_attr (initiatorname,ISCSI_PARAM_INITIATOR_NAME ,0 );iscsi_session_attr (targetalias,ISCSI_PARAM_TARGET_ALIAS ,0 ); +iscsi_session_attr (boot_nic,ISCSI_PARAM_BOOT_NIC ,0 ); static ssize_t show_priv_session_state(struct device *dev, struct device_attribute *attr,
@@ -2570,6 +2571,7 @@ static struct attribute *iscsi_session_attrs[] = { &dev_attr_sess_ifacename.attr, &dev_attr_sess_initiatorname.attr, &dev_attr_sess_targetalias.attr, + &dev_attr_sess_boot_nic.attr, &dev_attr_priv_sess_recovery_tmo.attr, &dev_attr_priv_sess_state.attr, &dev_attr_priv_sess_creator.attr,
@@ -2632,6 +2634,8 @@ static umode_t iscsi_session_attr_is_visible(struct kobject *kobj, param =ISCSI_PARAM_INITIATOR_NAME ; else if (attr == &dev_attr_sess_targetalias.attr) param =ISCSI_PARAM_TARGET_ALIAS ; + else if (attr == &dev_attr_sess_boot_nic.attr) + param =ISCSI_PARAM_BOOT_NIC ; else if (attr == &dev_attr_priv_sess_recovery_tmo.attr)return S_IRUGO |S_IWUSR ; else if (attr == &dev_attr_priv_sess_state.attr)
include/scsi/iscsi_if.h +2 -0
@@ -452,6 +452,8 @@ enum iscsi_param {ISCSI_PARAM_TGT_RESET_TMO ,ISCSI_PARAM_TARGET_ALIAS , +ISCSI_PARAM_BOOT_NIC , +ISCSI_PARAM_CHAP_IN_IDX , ISCSI_PARAM_CHAP_OUT_IDX,/* must always be last */
include/scsi/libiscsi.h +2 -0
@@ -287,6 +287,8 @@ struct iscsi_session {char *targetalias;char *ifacename;char *initiatorname; +char *boot_nic; +/* control data */ struct iscsi_transport *tt;struct Scsi_Host *host;
Signature · 1 line
1.7.7.4
PATCH v2 1/1 LIBISCSI: Added new boot entries in the session sysfs
In reply to a message not in the archivev2: Moved the new BOOT params to the end of the iscsi_param enum
This is the kernel part of the modification to extract the net params from the ibft sysfs to the iface struct used for the connection request upon sync_session in the open-iscsi util.
Three new session sysfs params are defined:boot_root - holds the name of the /sys/firmware/ibft or iscsi_rootN boot_nic - holds the ethernetN nameboot_target - holds the targetN name
--- drivers/scsi/libiscsi.c | 18 ++++++++++++++++++ drivers/scsi/scsi_transport_iscsi.c | 12 ++++++++++++ include/scsi/iscsi_if.h | 5 +++++ include/scsi/libiscsi.h | 4 ++++ 4 files changed, 39 insertions(+), 0 deletions(-)
drivers/scsi/libiscsi.c +18 -0
@@ -2808,6 +2808,9 @@ void iscsi_session_teardown(struct iscsi_cls_session *cls_session)kfree (session->targetname);kfree (session->targetalias);kfree (session->initiatorname); +kfree (session->boot_root); +kfree (session->boot_nic); +kfree (session->boot_target);kfree (session->ifacename);iscsi_destroy_session (cls_session);
@@ -3248,6 +3251,12 @@ int iscsi_set_param(struct iscsi_cls_conn *cls_conn,return iscsi_switch_str_param (&session->ifacename, buf);case ISCSI_PARAM_INITIATOR_NAME :return iscsi_switch_str_param (&session->initiatorname, buf); +case ISCSI_PARAM_BOOT_ROOT : +return iscsi_switch_str_param (&session->boot_root, buf); +case ISCSI_PARAM_BOOT_NIC : +return iscsi_switch_str_param (&session->boot_nic, buf); +case ISCSI_PARAM_BOOT_TARGET : +return iscsi_switch_str_param (&session->boot_target, buf);default :return -ENOSYS ; }
@@ -3326,6 +3335,15 @@ int iscsi_session_get_param(struct iscsi_cls_session *cls_session,case ISCSI_PARAM_INITIATOR_NAME : len =sprintf (buf,"%s\n" , session->initiatorname);break ; +case ISCSI_PARAM_BOOT_ROOT : + len =sprintf (buf,"%s\n" , session->boot_root); +break ; +case ISCSI_PARAM_BOOT_NIC : + len =sprintf (buf,"%s\n" , session->boot_nic); +break ; +case ISCSI_PARAM_BOOT_TARGET : + len =sprintf (buf,"%s\n" , session->boot_target); +break ;default :return -ENOSYS ; }
drivers/scsi/scsi_transport_iscsi.c +12 -0
@@ -3473,6 +3473,9 @@ iscsi_session_attr(tgt_reset_tmo, ISCSI_PARAM_TGT_RESET_TMO, 0);iscsi_session_attr (ifacename,ISCSI_PARAM_IFACE_NAME ,0 );iscsi_session_attr (initiatorname,ISCSI_PARAM_INITIATOR_NAME ,0 );iscsi_session_attr (targetalias,ISCSI_PARAM_TARGET_ALIAS ,0 ); +iscsi_session_attr (boot_root,ISCSI_PARAM_BOOT_ROOT ,0 ); +iscsi_session_attr (boot_nic,ISCSI_PARAM_BOOT_NIC ,0 ); +iscsi_session_attr (boot_target,ISCSI_PARAM_BOOT_TARGET ,0 ); static ssize_t show_priv_session_state(struct device *dev, struct device_attribute *attr,
@@ -3568,6 +3571,9 @@ static struct attribute *iscsi_session_attrs[] = { &dev_attr_sess_ifacename.attr, &dev_attr_sess_initiatorname.attr, &dev_attr_sess_targetalias.attr, + &dev_attr_sess_boot_root.attr, + &dev_attr_sess_boot_nic.attr, + &dev_attr_sess_boot_target.attr, &dev_attr_priv_sess_recovery_tmo.attr, &dev_attr_priv_sess_state.attr, &dev_attr_priv_sess_creator.attr,
@@ -3631,6 +3637,12 @@ static umode_t iscsi_session_attr_is_visible(struct kobject *kobj, param =ISCSI_PARAM_INITIATOR_NAME ; else if (attr == &dev_attr_sess_targetalias.attr) param =ISCSI_PARAM_TARGET_ALIAS ; + else if (attr == &dev_attr_sess_boot_root.attr) + param =ISCSI_PARAM_BOOT_ROOT ; + else if (attr == &dev_attr_sess_boot_nic.attr) + param =ISCSI_PARAM_BOOT_NIC ; + else if (attr == &dev_attr_sess_boot_target.attr) + param =ISCSI_PARAM_BOOT_TARGET ; else if (attr == &dev_attr_priv_sess_recovery_tmo.attr)return S_IRUGO |S_IWUSR ; else if (attr == &dev_attr_priv_sess_state.attr)
include/scsi/iscsi_if.h +5 -0
@@ -489,6 +489,11 @@ enum iscsi_param {ISCSI_PARAM_CHAP_IN_IDX ,ISCSI_PARAM_CHAP_OUT_IDX , + +ISCSI_PARAM_BOOT_ROOT , +ISCSI_PARAM_BOOT_NIC , +ISCSI_PARAM_BOOT_TARGET , +/* must always be last */ ISCSI_PARAM_MAX, };
include/scsi/libiscsi.h +4 -0
@@ -287,6 +287,10 @@ struct iscsi_session {char *targetalias;char *ifacename;char *initiatorname; +char *boot_root; +char *boot_nic; +char *boot_target; +/* control data */ struct iscsi_transport *tt;struct Scsi_Host *host;
Signature · 1 line
1.7.7.4
A message that is not in the archive (sent off-list or not yet received): 1371748886-5018-1-git-send-email-eddie.wai-dY08KVG/lbpWk0Htik3J/[email protected]
Mike Christie
Reviewed-byRe: [PATCH v2] LIBISCSI: Added new boot entries in the session sysfs
Quoted 6 lines · Eddie Wai
v2: Moved the new BOOT params to the end of the
iscsi_paramenumThis is the kernel part of the modification to extract the net params from the ibft sysfs to the iface struct used for the connection request upon
sync_sessionin the open-iscsi util.
Quoted 6 lines
Three new session sysfs params are defined:
boot_root- holds the name of the/sys/firmware/ibftoriscsi_rootNboot_nic- holds the ethernetN nameboot_target- holds the targetN name
Ok.
Signature · 5 lines
You received this message because you are subscribed to the Google Groups "open-iscsi" group. To unsubscribe from this group and stop receiving emails from it, send an email to open-iscsi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] To post to this group, send email to open-iscsi-/JYPxA39Uh5TLH3MbocFF+G/[email protected] Visit this group at http://groups.google.com/group/open-iscsi. For more options, visit https://groups.google.com/groups/opt_out.