diff options
author | Karen Xie <kxie@chelsio.com> | 2009-04-01 14:11:23 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2009-04-03 10:23:11 -0400 |
commit | 515f1c885af2ba8a9500c8a7aa4ed16bbbfa3ef4 (patch) | |
tree | 5d6833dc4f2ecc26a72fd72f560286cc847a74a9 /drivers/scsi/cxgb3i | |
parent | d8e965076514dcb16410c0d18c6c8de4dcba19fc (diff) |
[SCSI] cxgb3i: subscribe to error notification from cxgb3 driver
Add error notification handling function which is called during chip reset.
Signed-off-by: Karen Xie <kxie@chelsio.com>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/cxgb3i')
-rw-r--r-- | drivers/scsi/cxgb3i/cxgb3i.h | 10 | ||||
-rw-r--r-- | drivers/scsi/cxgb3i/cxgb3i_init.c | 25 | ||||
-rw-r--r-- | drivers/scsi/cxgb3i/cxgb3i_iscsi.c | 27 |
3 files changed, 52 insertions, 10 deletions
diff --git a/drivers/scsi/cxgb3i/cxgb3i.h b/drivers/scsi/cxgb3i/cxgb3i.h index a7cf550b9cca..0942227aa7ba 100644 --- a/drivers/scsi/cxgb3i/cxgb3i.h +++ b/drivers/scsi/cxgb3i/cxgb3i.h | |||
@@ -66,10 +66,12 @@ struct cxgb3i_hba { | |||
66 | * @pdev: pointer to pci dev | 66 | * @pdev: pointer to pci dev |
67 | * @hba_cnt: # of hbas (the same as # of ports) | 67 | * @hba_cnt: # of hbas (the same as # of ports) |
68 | * @hba: all the hbas on this adapter | 68 | * @hba: all the hbas on this adapter |
69 | * @flags: bit flag for adapter event/status | ||
69 | * @tx_max_size: max. tx packet size supported | 70 | * @tx_max_size: max. tx packet size supported |
70 | * @rx_max_size: max. rx packet size supported | 71 | * @rx_max_size: max. rx packet size supported |
71 | * @tag_format: ddp tag format settings | 72 | * @tag_format: ddp tag format settings |
72 | */ | 73 | */ |
74 | #define CXGB3I_ADAPTER_FLAG_RESET 0x1 | ||
73 | struct cxgb3i_adapter { | 75 | struct cxgb3i_adapter { |
74 | struct list_head list_head; | 76 | struct list_head list_head; |
75 | spinlock_t lock; | 77 | spinlock_t lock; |
@@ -78,6 +80,7 @@ struct cxgb3i_adapter { | |||
78 | unsigned char hba_cnt; | 80 | unsigned char hba_cnt; |
79 | struct cxgb3i_hba *hba[MAX_NPORTS]; | 81 | struct cxgb3i_hba *hba[MAX_NPORTS]; |
80 | 82 | ||
83 | unsigned int flags; | ||
81 | unsigned int tx_max_size; | 84 | unsigned int tx_max_size; |
82 | unsigned int rx_max_size; | 85 | unsigned int rx_max_size; |
83 | 86 | ||
@@ -137,10 +140,9 @@ struct cxgb3i_task_data { | |||
137 | int cxgb3i_iscsi_init(void); | 140 | int cxgb3i_iscsi_init(void); |
138 | void cxgb3i_iscsi_cleanup(void); | 141 | void cxgb3i_iscsi_cleanup(void); |
139 | 142 | ||
140 | struct cxgb3i_adapter *cxgb3i_adapter_add(struct t3cdev *); | 143 | struct cxgb3i_adapter *cxgb3i_adapter_find_by_tdev(struct t3cdev *); |
141 | void cxgb3i_adapter_remove(struct t3cdev *); | 144 | struct cxgb3i_adapter *cxgb3i_adapter_open(struct t3cdev *); |
142 | int cxgb3i_adapter_ulp_init(struct cxgb3i_adapter *); | 145 | void cxgb3i_adapter_close(struct t3cdev *); |
143 | void cxgb3i_adapter_ulp_cleanup(struct cxgb3i_adapter *); | ||
144 | 146 | ||
145 | struct cxgb3i_hba *cxgb3i_hba_find_by_netdev(struct net_device *); | 147 | struct cxgb3i_hba *cxgb3i_hba_find_by_netdev(struct net_device *); |
146 | struct cxgb3i_hba *cxgb3i_hba_host_add(struct cxgb3i_adapter *, | 148 | struct cxgb3i_hba *cxgb3i_hba_host_add(struct cxgb3i_adapter *, |
diff --git a/drivers/scsi/cxgb3i/cxgb3i_init.c b/drivers/scsi/cxgb3i/cxgb3i_init.c index 1ce9f244e46c..833dbfa3f88a 100644 --- a/drivers/scsi/cxgb3i/cxgb3i_init.c +++ b/drivers/scsi/cxgb3i/cxgb3i_init.c | |||
@@ -26,6 +26,7 @@ MODULE_VERSION(DRV_MODULE_VERSION); | |||
26 | 26 | ||
27 | static void open_s3_dev(struct t3cdev *); | 27 | static void open_s3_dev(struct t3cdev *); |
28 | static void close_s3_dev(struct t3cdev *); | 28 | static void close_s3_dev(struct t3cdev *); |
29 | static void s3_err_handler(struct t3cdev *tdev, u32 status, u32 error); | ||
29 | 30 | ||
30 | static cxgb3_cpl_handler_func cxgb3i_cpl_handlers[NUM_CPL_CMDS]; | 31 | static cxgb3_cpl_handler_func cxgb3i_cpl_handlers[NUM_CPL_CMDS]; |
31 | static struct cxgb3_client t3c_client = { | 32 | static struct cxgb3_client t3c_client = { |
@@ -33,6 +34,7 @@ static struct cxgb3_client t3c_client = { | |||
33 | .handlers = cxgb3i_cpl_handlers, | 34 | .handlers = cxgb3i_cpl_handlers, |
34 | .add = open_s3_dev, | 35 | .add = open_s3_dev, |
35 | .remove = close_s3_dev, | 36 | .remove = close_s3_dev, |
37 | .err_handler = s3_err_handler, | ||
36 | }; | 38 | }; |
37 | 39 | ||
38 | /** | 40 | /** |
@@ -49,7 +51,7 @@ static void open_s3_dev(struct t3cdev *t3dev) | |||
49 | } | 51 | } |
50 | 52 | ||
51 | cxgb3i_sdev_add(t3dev, &t3c_client); | 53 | cxgb3i_sdev_add(t3dev, &t3c_client); |
52 | cxgb3i_adapter_add(t3dev); | 54 | cxgb3i_adapter_open(t3dev); |
53 | } | 55 | } |
54 | 56 | ||
55 | /** | 57 | /** |
@@ -58,10 +60,29 @@ static void open_s3_dev(struct t3cdev *t3dev) | |||
58 | */ | 60 | */ |
59 | static void close_s3_dev(struct t3cdev *t3dev) | 61 | static void close_s3_dev(struct t3cdev *t3dev) |
60 | { | 62 | { |
61 | cxgb3i_adapter_remove(t3dev); | 63 | cxgb3i_adapter_close(t3dev); |
62 | cxgb3i_sdev_remove(t3dev); | 64 | cxgb3i_sdev_remove(t3dev); |
63 | } | 65 | } |
64 | 66 | ||
67 | static void s3_err_handler(struct t3cdev *tdev, u32 status, u32 error) | ||
68 | { | ||
69 | struct cxgb3i_adapter *snic = cxgb3i_adapter_find_by_tdev(tdev); | ||
70 | |||
71 | cxgb3i_log_info("snic 0x%p, tdev 0x%p, status 0x%x, err 0x%x.\n", | ||
72 | snic, tdev, status, error); | ||
73 | if (!snic) | ||
74 | return; | ||
75 | |||
76 | switch (status) { | ||
77 | case OFFLOAD_STATUS_DOWN: | ||
78 | snic->flags |= CXGB3I_ADAPTER_FLAG_RESET; | ||
79 | break; | ||
80 | case OFFLOAD_STATUS_UP: | ||
81 | snic->flags &= ~CXGB3I_ADAPTER_FLAG_RESET; | ||
82 | break; | ||
83 | } | ||
84 | } | ||
85 | |||
65 | /** | 86 | /** |
66 | * cxgb3i_init_module - module init entry point | 87 | * cxgb3i_init_module - module init entry point |
67 | * | 88 | * |
diff --git a/drivers/scsi/cxgb3i/cxgb3i_iscsi.c b/drivers/scsi/cxgb3i/cxgb3i_iscsi.c index e185dedc4c1f..ff6bfd66733f 100644 --- a/drivers/scsi/cxgb3i/cxgb3i_iscsi.c +++ b/drivers/scsi/cxgb3i/cxgb3i_iscsi.c | |||
@@ -53,11 +53,30 @@ static LIST_HEAD(cxgb3i_snic_list); | |||
53 | static DEFINE_RWLOCK(cxgb3i_snic_rwlock); | 53 | static DEFINE_RWLOCK(cxgb3i_snic_rwlock); |
54 | 54 | ||
55 | /** | 55 | /** |
56 | * cxgb3i_adapter_add - init a s3 adapter structure and any h/w settings | 56 | * cxgb3i_adpater_find_by_tdev - find the cxgb3i_adapter structure via t3cdev |
57 | * @tdev: t3cdev pointer | ||
58 | */ | ||
59 | struct cxgb3i_adapter *cxgb3i_adapter_find_by_tdev(struct t3cdev *tdev) | ||
60 | { | ||
61 | struct cxgb3i_adapter *snic; | ||
62 | |||
63 | read_lock(&cxgb3i_snic_rwlock); | ||
64 | list_for_each_entry(snic, &cxgb3i_snic_list, list_head) { | ||
65 | if (snic->tdev == tdev) { | ||
66 | read_unlock(&cxgb3i_snic_rwlock); | ||
67 | return snic; | ||
68 | } | ||
69 | } | ||
70 | read_unlock(&cxgb3i_snic_rwlock); | ||
71 | return NULL; | ||
72 | } | ||
73 | |||
74 | /** | ||
75 | * cxgb3i_adapter_open - init a s3 adapter structure and any h/w settings | ||
57 | * @t3dev: t3cdev adapter | 76 | * @t3dev: t3cdev adapter |
58 | * return the resulting cxgb3i_adapter struct | 77 | * return the resulting cxgb3i_adapter struct |
59 | */ | 78 | */ |
60 | struct cxgb3i_adapter *cxgb3i_adapter_add(struct t3cdev *t3dev) | 79 | struct cxgb3i_adapter *cxgb3i_adapter_open(struct t3cdev *t3dev) |
61 | { | 80 | { |
62 | struct cxgb3i_adapter *snic; | 81 | struct cxgb3i_adapter *snic; |
63 | struct adapter *adapter = tdev2adap(t3dev); | 82 | struct adapter *adapter = tdev2adap(t3dev); |
@@ -101,10 +120,10 @@ free_snic: | |||
101 | } | 120 | } |
102 | 121 | ||
103 | /** | 122 | /** |
104 | * cxgb3i_adapter_remove - release the resources held and cleanup h/w settings | 123 | * cxgb3i_adapter_close - release the resources held and cleanup h/w settings |
105 | * @t3dev: t3cdev adapter | 124 | * @t3dev: t3cdev adapter |
106 | */ | 125 | */ |
107 | void cxgb3i_adapter_remove(struct t3cdev *t3dev) | 126 | void cxgb3i_adapter_close(struct t3cdev *t3dev) |
108 | { | 127 | { |
109 | int i; | 128 | int i; |
110 | struct cxgb3i_adapter *snic; | 129 | struct cxgb3i_adapter *snic; |