aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/bnx2i
diff options
context:
space:
mode:
authorEddie Wai <eddie.wai@broadcom.com>2010-07-01 18:34:51 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-07-27 13:03:57 -0400
commit46012e8b8de325472790d154f4cfb1cf2d4fc49a (patch)
treed6dfb8a8782e937c367255b528d7b2a2c047e69a /drivers/scsi/bnx2i
parent6447f286326690a936c35f9f913499307f869934 (diff)
[SCSI] 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. Signed-off-by: Eddie Wai <eddie.wai@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Reviewed-by: Benjamin Li <benli@broadcom.com> Acked-by: Anil Veerabhadrappa <anilgv@broadcom.com> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/bnx2i')
-rw-r--r--drivers/scsi/bnx2i/bnx2i.h4
-rw-r--r--drivers/scsi/bnx2i/bnx2i_iscsi.c46
2 files changed, 47 insertions, 3 deletions
diff --git a/drivers/scsi/bnx2i/bnx2i.h b/drivers/scsi/bnx2i/bnx2i.h
index 6b624e767d3b..c17c3a3d52b8 100644
--- a/drivers/scsi/bnx2i/bnx2i.h
+++ b/drivers/scsi/bnx2i/bnx2i.h
@@ -299,6 +299,7 @@ struct iscsi_cid_queue {
299 * @cid_que: iscsi cid queue 299 * @cid_que: iscsi cid queue
300 * @ep_rdwr_lock: read / write lock to synchronize various ep lists 300 * @ep_rdwr_lock: read / write lock to synchronize various ep lists
301 * @ep_ofld_list: connection list for pending offload completion 301 * @ep_ofld_list: connection list for pending offload completion
302 * @ep_active_list: connection list for active offload endpoints
302 * @ep_destroy_list: connection list for pending offload completion 303 * @ep_destroy_list: connection list for pending offload completion
303 * @mp_bd_tbl: BD table to be used with middle path requests 304 * @mp_bd_tbl: BD table to be used with middle path requests
304 * @mp_bd_dma: DMA address of 'mp_bd_tbl' memory buffer 305 * @mp_bd_dma: DMA address of 'mp_bd_tbl' memory buffer
@@ -369,6 +370,7 @@ struct bnx2i_hba {
369 370
370 rwlock_t ep_rdwr_lock; 371 rwlock_t ep_rdwr_lock;
371 struct list_head ep_ofld_list; 372 struct list_head ep_ofld_list;
373 struct list_head ep_active_list;
372 struct list_head ep_destroy_list; 374 struct list_head ep_destroy_list;
373 375
374 /* 376 /*
@@ -645,6 +647,7 @@ enum {
645 * @link: list head to link elements 647 * @link: list head to link elements
646 * @hba: adapter to which this connection belongs 648 * @hba: adapter to which this connection belongs
647 * @conn: iscsi connection this EP is linked to 649 * @conn: iscsi connection this EP is linked to
650 * @cls_ep: associated iSCSI endpoint pointer
648 * @sess: iscsi session this EP is linked to 651 * @sess: iscsi session this EP is linked to
649 * @cm_sk: cnic sock struct 652 * @cm_sk: cnic sock struct
650 * @hba_age: age to detect if 'iscsid' issues ep_disconnect() 653 * @hba_age: age to detect if 'iscsid' issues ep_disconnect()
@@ -664,6 +667,7 @@ struct bnx2i_endpoint {
664 struct list_head link; 667 struct list_head link;
665 struct bnx2i_hba *hba; 668 struct bnx2i_hba *hba;
666 struct bnx2i_conn *conn; 669 struct bnx2i_conn *conn;
670 struct iscsi_endpoint *cls_ep;
667 struct cnic_sock *cm_sk; 671 struct cnic_sock *cm_sk;
668 u32 hba_age; 672 u32 hba_age;
669 u32 state; 673 u32 state;
diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c
index 6edfde5f2e09..fb5fe88de90f 100644
--- a/drivers/scsi/bnx2i/bnx2i_iscsi.c
+++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c
@@ -386,6 +386,7 @@ static struct iscsi_endpoint *bnx2i_alloc_ep(struct bnx2i_hba *hba)
386 } 386 }
387 387
388 bnx2i_ep = ep->dd_data; 388 bnx2i_ep = ep->dd_data;
389 bnx2i_ep->cls_ep = ep;
389 INIT_LIST_HEAD(&bnx2i_ep->link); 390 INIT_LIST_HEAD(&bnx2i_ep->link);
390 bnx2i_ep->state = EP_STATE_IDLE; 391 bnx2i_ep->state = EP_STATE_IDLE;
391 bnx2i_ep->ep_iscsi_cid = (u16) -1; 392 bnx2i_ep->ep_iscsi_cid = (u16) -1;
@@ -678,7 +679,6 @@ bnx2i_find_ep_in_ofld_list(struct bnx2i_hba *hba, u32 iscsi_cid)
678 return ep; 679 return ep;
679} 680}
680 681
681
682/** 682/**
683 * bnx2i_find_ep_in_destroy_list - find iscsi_cid in destroy list 683 * bnx2i_find_ep_in_destroy_list - find iscsi_cid in destroy list
684 * @hba: pointer to adapter instance 684 * @hba: pointer to adapter instance
@@ -708,6 +708,39 @@ bnx2i_find_ep_in_destroy_list(struct bnx2i_hba *hba, u32 iscsi_cid)
708 return ep; 708 return ep;
709} 709}
710 710
711
712/**
713 * bnx2i_ep_active_list_add - add an entry to ep active list
714 * @hba: pointer to adapter instance
715 * @ep: pointer to endpoint (transport indentifier) structure
716 *
717 * current active conn queue manager
718 */
719static void bnx2i_ep_active_list_add(struct bnx2i_hba *hba,
720 struct bnx2i_endpoint *ep)
721{
722 write_lock_bh(&hba->ep_rdwr_lock);
723 list_add_tail(&ep->link, &hba->ep_active_list);
724 write_unlock_bh(&hba->ep_rdwr_lock);
725}
726
727
728/**
729 * bnx2i_ep_active_list_del - deletes an entry to ep active list
730 * @hba: pointer to adapter instance
731 * @ep: pointer to endpoint (transport indentifier) structure
732 *
733 * current active conn queue manager
734 */
735static void bnx2i_ep_active_list_del(struct bnx2i_hba *hba,
736 struct bnx2i_endpoint *ep)
737{
738 write_lock_bh(&hba->ep_rdwr_lock);
739 list_del_init(&ep->link);
740 write_unlock_bh(&hba->ep_rdwr_lock);
741}
742
743
711/** 744/**
712 * bnx2i_setup_host_queue_size - assigns shost->can_queue param 745 * bnx2i_setup_host_queue_size - assigns shost->can_queue param
713 * @hba: pointer to adapter instance 746 * @hba: pointer to adapter instance
@@ -784,6 +817,7 @@ struct bnx2i_hba *bnx2i_alloc_hba(struct cnic_dev *cnic)
784 goto mp_bdt_mem_err; 817 goto mp_bdt_mem_err;
785 818
786 INIT_LIST_HEAD(&hba->ep_ofld_list); 819 INIT_LIST_HEAD(&hba->ep_ofld_list);
820 INIT_LIST_HEAD(&hba->ep_active_list);
787 INIT_LIST_HEAD(&hba->ep_destroy_list); 821 INIT_LIST_HEAD(&hba->ep_destroy_list);
788 rwlock_init(&hba->ep_rdwr_lock); 822 rwlock_init(&hba->ep_rdwr_lock);
789 823
@@ -857,6 +891,7 @@ void bnx2i_free_hba(struct bnx2i_hba *hba)
857 891
858 iscsi_host_remove(shost); 892 iscsi_host_remove(shost);
859 INIT_LIST_HEAD(&hba->ep_ofld_list); 893 INIT_LIST_HEAD(&hba->ep_ofld_list);
894 INIT_LIST_HEAD(&hba->ep_active_list);
860 INIT_LIST_HEAD(&hba->ep_destroy_list); 895 INIT_LIST_HEAD(&hba->ep_destroy_list);
861 pci_dev_put(hba->pcidev); 896 pci_dev_put(hba->pcidev);
862 897
@@ -1754,15 +1789,19 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost,
1754 goto conn_failed; 1789 goto conn_failed;
1755 } else 1790 } else
1756 rc = cnic->cm_connect(bnx2i_ep->cm_sk, &saddr); 1791 rc = cnic->cm_connect(bnx2i_ep->cm_sk, &saddr);
1757
1758 if (rc) 1792 if (rc)
1759 goto release_ep; 1793 goto release_ep;
1760 1794
1795 bnx2i_ep_active_list_add(hba, bnx2i_ep);
1796
1761 if (bnx2i_map_ep_dbell_regs(bnx2i_ep)) 1797 if (bnx2i_map_ep_dbell_regs(bnx2i_ep))
1762 goto release_ep; 1798 goto del_active_ep;
1799
1763 mutex_unlock(&hba->net_dev_lock); 1800 mutex_unlock(&hba->net_dev_lock);
1764 return ep; 1801 return ep;
1765 1802
1803del_active_ep:
1804 bnx2i_ep_active_list_del(hba, bnx2i_ep);
1766release_ep: 1805release_ep:
1767 if (bnx2i_tear_down_conn(hba, bnx2i_ep)) { 1806 if (bnx2i_tear_down_conn(hba, bnx2i_ep)) {
1768 mutex_unlock(&hba->net_dev_lock); 1807 mutex_unlock(&hba->net_dev_lock);
@@ -1931,6 +1970,7 @@ int bnx2i_hw_ep_disconnect(struct bnx2i_endpoint *bnx2i_ep)
1931 del_timer_sync(&bnx2i_ep->ofld_timer); 1970 del_timer_sync(&bnx2i_ep->ofld_timer);
1932 1971
1933destroy_conn: 1972destroy_conn:
1973 bnx2i_ep_active_list_del(hba, bnx2i_ep);
1934 if (bnx2i_tear_down_conn(hba, bnx2i_ep)) 1974 if (bnx2i_tear_down_conn(hba, bnx2i_ep))
1935 ret = -EINVAL; 1975 ret = -EINVAL;
1936out: 1976out: