diff options
Diffstat (limited to 'drivers')
43 files changed, 818 insertions, 531 deletions
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index 02114a0bd0d9..128b2632512d 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c | |||
@@ -1981,10 +1981,6 @@ static int __init cmm_init(void) | |||
1981 | if (!cmm_class) | 1981 | if (!cmm_class) |
1982 | return -1; | 1982 | return -1; |
1983 | 1983 | ||
1984 | rc = pcmcia_register_driver(&cm4000_driver); | ||
1985 | if (rc < 0) | ||
1986 | return rc; | ||
1987 | |||
1988 | major = register_chrdev(0, DEVICE_NAME, &cm4000_fops); | 1984 | major = register_chrdev(0, DEVICE_NAME, &cm4000_fops); |
1989 | if (major < 0) { | 1985 | if (major < 0) { |
1990 | printk(KERN_WARNING MODULE_NAME | 1986 | printk(KERN_WARNING MODULE_NAME |
@@ -1992,6 +1988,12 @@ static int __init cmm_init(void) | |||
1992 | return -1; | 1988 | return -1; |
1993 | } | 1989 | } |
1994 | 1990 | ||
1991 | rc = pcmcia_register_driver(&cm4000_driver); | ||
1992 | if (rc < 0) { | ||
1993 | unregister_chrdev(major, DEVICE_NAME); | ||
1994 | return rc; | ||
1995 | } | ||
1996 | |||
1995 | return 0; | 1997 | return 0; |
1996 | } | 1998 | } |
1997 | 1999 | ||
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c index 29efa64580a8..47a8465bf95b 100644 --- a/drivers/char/pcmcia/cm4040_cs.c +++ b/drivers/char/pcmcia/cm4040_cs.c | |||
@@ -724,16 +724,19 @@ static int __init cm4040_init(void) | |||
724 | if (!cmx_class) | 724 | if (!cmx_class) |
725 | return -1; | 725 | return -1; |
726 | 726 | ||
727 | rc = pcmcia_register_driver(&reader_driver); | ||
728 | if (rc < 0) | ||
729 | return rc; | ||
730 | |||
731 | major = register_chrdev(0, DEVICE_NAME, &reader_fops); | 727 | major = register_chrdev(0, DEVICE_NAME, &reader_fops); |
732 | if (major < 0) { | 728 | if (major < 0) { |
733 | printk(KERN_WARNING MODULE_NAME | 729 | printk(KERN_WARNING MODULE_NAME |
734 | ": could not get major number\n"); | 730 | ": could not get major number\n"); |
735 | return -1; | 731 | return -1; |
736 | } | 732 | } |
733 | |||
734 | rc = pcmcia_register_driver(&reader_driver); | ||
735 | if (rc < 0) { | ||
736 | unregister_chrdev(major, DEVICE_NAME); | ||
737 | return rc; | ||
738 | } | ||
739 | |||
737 | return 0; | 740 | return 0; |
738 | } | 741 | } |
739 | 742 | ||
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c index 15121cb5a1f6..21f9282c1b25 100644 --- a/drivers/infiniband/core/sysfs.c +++ b/drivers/infiniband/core/sysfs.c | |||
@@ -336,7 +336,7 @@ static ssize_t show_pma_counter(struct ib_port *p, struct port_attribute *attr, | |||
336 | switch (width) { | 336 | switch (width) { |
337 | case 4: | 337 | case 4: |
338 | ret = sprintf(buf, "%u\n", (out_mad->data[40 + offset / 8] >> | 338 | ret = sprintf(buf, "%u\n", (out_mad->data[40 + offset / 8] >> |
339 | (offset % 4)) & 0xf); | 339 | (4 - (offset % 8))) & 0xf); |
340 | break; | 340 | break; |
341 | case 8: | 341 | case 8: |
342 | ret = sprintf(buf, "%u\n", out_mad->data[40 + offset / 8]); | 342 | ret = sprintf(buf, "%u\n", out_mad->data[40 + offset / 8]); |
diff --git a/drivers/infiniband/hw/mthca/mthca_cq.c b/drivers/infiniband/hw/mthca/mthca_cq.c index 312cf90731ea..205854e9c662 100644 --- a/drivers/infiniband/hw/mthca/mthca_cq.c +++ b/drivers/infiniband/hw/mthca/mthca_cq.c | |||
@@ -238,9 +238,9 @@ void mthca_cq_event(struct mthca_dev *dev, u32 cqn, | |||
238 | spin_lock(&dev->cq_table.lock); | 238 | spin_lock(&dev->cq_table.lock); |
239 | 239 | ||
240 | cq = mthca_array_get(&dev->cq_table.cq, cqn & (dev->limits.num_cqs - 1)); | 240 | cq = mthca_array_get(&dev->cq_table.cq, cqn & (dev->limits.num_cqs - 1)); |
241 | |||
242 | if (cq) | 241 | if (cq) |
243 | atomic_inc(&cq->refcount); | 242 | ++cq->refcount; |
243 | |||
244 | spin_unlock(&dev->cq_table.lock); | 244 | spin_unlock(&dev->cq_table.lock); |
245 | 245 | ||
246 | if (!cq) { | 246 | if (!cq) { |
@@ -254,8 +254,10 @@ void mthca_cq_event(struct mthca_dev *dev, u32 cqn, | |||
254 | if (cq->ibcq.event_handler) | 254 | if (cq->ibcq.event_handler) |
255 | cq->ibcq.event_handler(&event, cq->ibcq.cq_context); | 255 | cq->ibcq.event_handler(&event, cq->ibcq.cq_context); |
256 | 256 | ||
257 | if (atomic_dec_and_test(&cq->refcount)) | 257 | spin_lock(&dev->cq_table.lock); |
258 | if (!--cq->refcount) | ||
258 | wake_up(&cq->wait); | 259 | wake_up(&cq->wait); |
260 | spin_unlock(&dev->cq_table.lock); | ||
259 | } | 261 | } |
260 | 262 | ||
261 | static inline int is_recv_cqe(struct mthca_cqe *cqe) | 263 | static inline int is_recv_cqe(struct mthca_cqe *cqe) |
@@ -267,23 +269,13 @@ static inline int is_recv_cqe(struct mthca_cqe *cqe) | |||
267 | return !(cqe->is_send & 0x80); | 269 | return !(cqe->is_send & 0x80); |
268 | } | 270 | } |
269 | 271 | ||
270 | void mthca_cq_clean(struct mthca_dev *dev, u32 cqn, u32 qpn, | 272 | void mthca_cq_clean(struct mthca_dev *dev, struct mthca_cq *cq, u32 qpn, |
271 | struct mthca_srq *srq) | 273 | struct mthca_srq *srq) |
272 | { | 274 | { |
273 | struct mthca_cq *cq; | ||
274 | struct mthca_cqe *cqe; | 275 | struct mthca_cqe *cqe; |
275 | u32 prod_index; | 276 | u32 prod_index; |
276 | int nfreed = 0; | 277 | int nfreed = 0; |
277 | 278 | ||
278 | spin_lock_irq(&dev->cq_table.lock); | ||
279 | cq = mthca_array_get(&dev->cq_table.cq, cqn & (dev->limits.num_cqs - 1)); | ||
280 | if (cq) | ||
281 | atomic_inc(&cq->refcount); | ||
282 | spin_unlock_irq(&dev->cq_table.lock); | ||
283 | |||
284 | if (!cq) | ||
285 | return; | ||
286 | |||
287 | spin_lock_irq(&cq->lock); | 279 | spin_lock_irq(&cq->lock); |
288 | 280 | ||
289 | /* | 281 | /* |
@@ -301,7 +293,7 @@ void mthca_cq_clean(struct mthca_dev *dev, u32 cqn, u32 qpn, | |||
301 | 293 | ||
302 | if (0) | 294 | if (0) |
303 | mthca_dbg(dev, "Cleaning QPN %06x from CQN %06x; ci %d, pi %d\n", | 295 | mthca_dbg(dev, "Cleaning QPN %06x from CQN %06x; ci %d, pi %d\n", |
304 | qpn, cqn, cq->cons_index, prod_index); | 296 | qpn, cq->cqn, cq->cons_index, prod_index); |
305 | 297 | ||
306 | /* | 298 | /* |
307 | * Now sweep backwards through the CQ, removing CQ entries | 299 | * Now sweep backwards through the CQ, removing CQ entries |
@@ -325,8 +317,6 @@ void mthca_cq_clean(struct mthca_dev *dev, u32 cqn, u32 qpn, | |||
325 | } | 317 | } |
326 | 318 | ||
327 | spin_unlock_irq(&cq->lock); | 319 | spin_unlock_irq(&cq->lock); |
328 | if (atomic_dec_and_test(&cq->refcount)) | ||
329 | wake_up(&cq->wait); | ||
330 | } | 320 | } |
331 | 321 | ||
332 | void mthca_cq_resize_copy_cqes(struct mthca_cq *cq) | 322 | void mthca_cq_resize_copy_cqes(struct mthca_cq *cq) |
@@ -821,7 +811,7 @@ int mthca_init_cq(struct mthca_dev *dev, int nent, | |||
821 | } | 811 | } |
822 | 812 | ||
823 | spin_lock_init(&cq->lock); | 813 | spin_lock_init(&cq->lock); |
824 | atomic_set(&cq->refcount, 1); | 814 | cq->refcount = 1; |
825 | init_waitqueue_head(&cq->wait); | 815 | init_waitqueue_head(&cq->wait); |
826 | 816 | ||
827 | memset(cq_context, 0, sizeof *cq_context); | 817 | memset(cq_context, 0, sizeof *cq_context); |
@@ -896,6 +886,17 @@ err_out: | |||
896 | return err; | 886 | return err; |
897 | } | 887 | } |
898 | 888 | ||
889 | static inline int get_cq_refcount(struct mthca_dev *dev, struct mthca_cq *cq) | ||
890 | { | ||
891 | int c; | ||
892 | |||
893 | spin_lock_irq(&dev->cq_table.lock); | ||
894 | c = cq->refcount; | ||
895 | spin_unlock_irq(&dev->cq_table.lock); | ||
896 | |||
897 | return c; | ||
898 | } | ||
899 | |||
899 | void mthca_free_cq(struct mthca_dev *dev, | 900 | void mthca_free_cq(struct mthca_dev *dev, |
900 | struct mthca_cq *cq) | 901 | struct mthca_cq *cq) |
901 | { | 902 | { |
@@ -929,6 +930,7 @@ void mthca_free_cq(struct mthca_dev *dev, | |||
929 | spin_lock_irq(&dev->cq_table.lock); | 930 | spin_lock_irq(&dev->cq_table.lock); |
930 | mthca_array_clear(&dev->cq_table.cq, | 931 | mthca_array_clear(&dev->cq_table.cq, |
931 | cq->cqn & (dev->limits.num_cqs - 1)); | 932 | cq->cqn & (dev->limits.num_cqs - 1)); |
933 | --cq->refcount; | ||
932 | spin_unlock_irq(&dev->cq_table.lock); | 934 | spin_unlock_irq(&dev->cq_table.lock); |
933 | 935 | ||
934 | if (dev->mthca_flags & MTHCA_FLAG_MSI_X) | 936 | if (dev->mthca_flags & MTHCA_FLAG_MSI_X) |
@@ -936,8 +938,7 @@ void mthca_free_cq(struct mthca_dev *dev, | |||
936 | else | 938 | else |
937 | synchronize_irq(dev->pdev->irq); | 939 | synchronize_irq(dev->pdev->irq); |
938 | 940 | ||
939 | atomic_dec(&cq->refcount); | 941 | wait_event(cq->wait, !get_cq_refcount(dev, cq)); |
940 | wait_event(cq->wait, !atomic_read(&cq->refcount)); | ||
941 | 942 | ||
942 | if (cq->is_kernel) { | 943 | if (cq->is_kernel) { |
943 | mthca_free_cq_buf(dev, &cq->buf, cq->ibcq.cqe); | 944 | mthca_free_cq_buf(dev, &cq->buf, cq->ibcq.cqe); |
diff --git a/drivers/infiniband/hw/mthca/mthca_dev.h b/drivers/infiniband/hw/mthca/mthca_dev.h index 4c1dcb4c1822..f8160b8de090 100644 --- a/drivers/infiniband/hw/mthca/mthca_dev.h +++ b/drivers/infiniband/hw/mthca/mthca_dev.h | |||
@@ -496,7 +496,7 @@ void mthca_free_cq(struct mthca_dev *dev, | |||
496 | void mthca_cq_completion(struct mthca_dev *dev, u32 cqn); | 496 | void mthca_cq_completion(struct mthca_dev *dev, u32 cqn); |
497 | void mthca_cq_event(struct mthca_dev *dev, u32 cqn, | 497 | void mthca_cq_event(struct mthca_dev *dev, u32 cqn, |
498 | enum ib_event_type event_type); | 498 | enum ib_event_type event_type); |
499 | void mthca_cq_clean(struct mthca_dev *dev, u32 cqn, u32 qpn, | 499 | void mthca_cq_clean(struct mthca_dev *dev, struct mthca_cq *cq, u32 qpn, |
500 | struct mthca_srq *srq); | 500 | struct mthca_srq *srq); |
501 | void mthca_cq_resize_copy_cqes(struct mthca_cq *cq); | 501 | void mthca_cq_resize_copy_cqes(struct mthca_cq *cq); |
502 | int mthca_alloc_cq_buf(struct mthca_dev *dev, struct mthca_cq_buf *buf, int nent); | 502 | int mthca_alloc_cq_buf(struct mthca_dev *dev, struct mthca_cq_buf *buf, int nent); |
diff --git a/drivers/infiniband/hw/mthca/mthca_mr.c b/drivers/infiniband/hw/mthca/mthca_mr.c index 25e1c1db9a40..a486dec1707e 100644 --- a/drivers/infiniband/hw/mthca/mthca_mr.c +++ b/drivers/infiniband/hw/mthca/mthca_mr.c | |||
@@ -761,6 +761,7 @@ void mthca_arbel_fmr_unmap(struct mthca_dev *dev, struct mthca_fmr *fmr) | |||
761 | 761 | ||
762 | int __devinit mthca_init_mr_table(struct mthca_dev *dev) | 762 | int __devinit mthca_init_mr_table(struct mthca_dev *dev) |
763 | { | 763 | { |
764 | unsigned long addr; | ||
764 | int err, i; | 765 | int err, i; |
765 | 766 | ||
766 | err = mthca_alloc_init(&dev->mr_table.mpt_alloc, | 767 | err = mthca_alloc_init(&dev->mr_table.mpt_alloc, |
@@ -796,9 +797,12 @@ int __devinit mthca_init_mr_table(struct mthca_dev *dev) | |||
796 | goto err_fmr_mpt; | 797 | goto err_fmr_mpt; |
797 | } | 798 | } |
798 | 799 | ||
800 | addr = pci_resource_start(dev->pdev, 4) + | ||
801 | ((pci_resource_len(dev->pdev, 4) - 1) & | ||
802 | dev->mr_table.mpt_base); | ||
803 | |||
799 | dev->mr_table.tavor_fmr.mpt_base = | 804 | dev->mr_table.tavor_fmr.mpt_base = |
800 | ioremap(dev->mr_table.mpt_base, | 805 | ioremap(addr, (1 << i) * sizeof(struct mthca_mpt_entry)); |
801 | (1 << i) * sizeof (struct mthca_mpt_entry)); | ||
802 | 806 | ||
803 | if (!dev->mr_table.tavor_fmr.mpt_base) { | 807 | if (!dev->mr_table.tavor_fmr.mpt_base) { |
804 | mthca_warn(dev, "MPT ioremap for FMR failed.\n"); | 808 | mthca_warn(dev, "MPT ioremap for FMR failed.\n"); |
@@ -806,9 +810,12 @@ int __devinit mthca_init_mr_table(struct mthca_dev *dev) | |||
806 | goto err_fmr_mpt; | 810 | goto err_fmr_mpt; |
807 | } | 811 | } |
808 | 812 | ||
813 | addr = pci_resource_start(dev->pdev, 4) + | ||
814 | ((pci_resource_len(dev->pdev, 4) - 1) & | ||
815 | dev->mr_table.mtt_base); | ||
816 | |||
809 | dev->mr_table.tavor_fmr.mtt_base = | 817 | dev->mr_table.tavor_fmr.mtt_base = |
810 | ioremap(dev->mr_table.mtt_base, | 818 | ioremap(addr, (1 << i) * MTHCA_MTT_SEG_SIZE); |
811 | (1 << i) * MTHCA_MTT_SEG_SIZE); | ||
812 | if (!dev->mr_table.tavor_fmr.mtt_base) { | 819 | if (!dev->mr_table.tavor_fmr.mtt_base) { |
813 | mthca_warn(dev, "MTT ioremap for FMR failed.\n"); | 820 | mthca_warn(dev, "MTT ioremap for FMR failed.\n"); |
814 | err = -ENOMEM; | 821 | err = -ENOMEM; |
diff --git a/drivers/infiniband/hw/mthca/mthca_provider.h b/drivers/infiniband/hw/mthca/mthca_provider.h index 6676a786d690..179a8f610d0f 100644 --- a/drivers/infiniband/hw/mthca/mthca_provider.h +++ b/drivers/infiniband/hw/mthca/mthca_provider.h | |||
@@ -139,11 +139,12 @@ struct mthca_ah { | |||
139 | * a qp may be locked, with the send cq locked first. No other | 139 | * a qp may be locked, with the send cq locked first. No other |
140 | * nesting should be done. | 140 | * nesting should be done. |
141 | * | 141 | * |
142 | * Each struct mthca_cq/qp also has an atomic_t ref count. The | 142 | * Each struct mthca_cq/qp also has an ref count, protected by the |
143 | * pointer from the cq/qp_table to the struct counts as one reference. | 143 | * corresponding table lock. The pointer from the cq/qp_table to the |
144 | * This reference also is good for access through the consumer API, so | 144 | * struct counts as one reference. This reference also is good for |
145 | * modifying the CQ/QP etc doesn't need to take another reference. | 145 | * access through the consumer API, so modifying the CQ/QP etc doesn't |
146 | * Access because of a completion being polled does need a reference. | 146 | * need to take another reference. Access to a QP because of a |
147 | * completion being polled does not need a reference either. | ||
147 | * | 148 | * |
148 | * Finally, each struct mthca_cq/qp has a wait_queue_head_t for the | 149 | * Finally, each struct mthca_cq/qp has a wait_queue_head_t for the |
149 | * destroy function to sleep on. | 150 | * destroy function to sleep on. |
@@ -159,8 +160,9 @@ struct mthca_ah { | |||
159 | * - decrement ref count; if zero, wake up waiters | 160 | * - decrement ref count; if zero, wake up waiters |
160 | * | 161 | * |
161 | * To destroy a CQ/QP, we can do the following: | 162 | * To destroy a CQ/QP, we can do the following: |
162 | * - lock cq/qp_table, remove pointer, unlock cq/qp_table lock | 163 | * - lock cq/qp_table |
163 | * - decrement ref count | 164 | * - remove pointer and decrement ref count |
165 | * - unlock cq/qp_table lock | ||
164 | * - wait_event until ref count is zero | 166 | * - wait_event until ref count is zero |
165 | * | 167 | * |
166 | * It is the consumer's responsibilty to make sure that no QP | 168 | * It is the consumer's responsibilty to make sure that no QP |
@@ -197,7 +199,7 @@ struct mthca_cq_resize { | |||
197 | struct mthca_cq { | 199 | struct mthca_cq { |
198 | struct ib_cq ibcq; | 200 | struct ib_cq ibcq; |
199 | spinlock_t lock; | 201 | spinlock_t lock; |
200 | atomic_t refcount; | 202 | int refcount; |
201 | int cqn; | 203 | int cqn; |
202 | u32 cons_index; | 204 | u32 cons_index; |
203 | struct mthca_cq_buf buf; | 205 | struct mthca_cq_buf buf; |
@@ -217,7 +219,7 @@ struct mthca_cq { | |||
217 | struct mthca_srq { | 219 | struct mthca_srq { |
218 | struct ib_srq ibsrq; | 220 | struct ib_srq ibsrq; |
219 | spinlock_t lock; | 221 | spinlock_t lock; |
220 | atomic_t refcount; | 222 | int refcount; |
221 | int srqn; | 223 | int srqn; |
222 | int max; | 224 | int max; |
223 | int max_gs; | 225 | int max_gs; |
@@ -254,7 +256,7 @@ struct mthca_wq { | |||
254 | 256 | ||
255 | struct mthca_qp { | 257 | struct mthca_qp { |
256 | struct ib_qp ibqp; | 258 | struct ib_qp ibqp; |
257 | atomic_t refcount; | 259 | int refcount; |
258 | u32 qpn; | 260 | u32 qpn; |
259 | int is_direct; | 261 | int is_direct; |
260 | u8 port; /* for SQP and memfree use only */ | 262 | u8 port; /* for SQP and memfree use only */ |
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c index f37b0e367323..19765f6f8d58 100644 --- a/drivers/infiniband/hw/mthca/mthca_qp.c +++ b/drivers/infiniband/hw/mthca/mthca_qp.c | |||
@@ -240,7 +240,7 @@ void mthca_qp_event(struct mthca_dev *dev, u32 qpn, | |||
240 | spin_lock(&dev->qp_table.lock); | 240 | spin_lock(&dev->qp_table.lock); |
241 | qp = mthca_array_get(&dev->qp_table.qp, qpn & (dev->limits.num_qps - 1)); | 241 | qp = mthca_array_get(&dev->qp_table.qp, qpn & (dev->limits.num_qps - 1)); |
242 | if (qp) | 242 | if (qp) |
243 | atomic_inc(&qp->refcount); | 243 | ++qp->refcount; |
244 | spin_unlock(&dev->qp_table.lock); | 244 | spin_unlock(&dev->qp_table.lock); |
245 | 245 | ||
246 | if (!qp) { | 246 | if (!qp) { |
@@ -257,8 +257,10 @@ void mthca_qp_event(struct mthca_dev *dev, u32 qpn, | |||
257 | if (qp->ibqp.event_handler) | 257 | if (qp->ibqp.event_handler) |
258 | qp->ibqp.event_handler(&event, qp->ibqp.qp_context); | 258 | qp->ibqp.event_handler(&event, qp->ibqp.qp_context); |
259 | 259 | ||
260 | if (atomic_dec_and_test(&qp->refcount)) | 260 | spin_lock(&dev->qp_table.lock); |
261 | if (!--qp->refcount) | ||
261 | wake_up(&qp->wait); | 262 | wake_up(&qp->wait); |
263 | spin_unlock(&dev->qp_table.lock); | ||
262 | } | 264 | } |
263 | 265 | ||
264 | static int to_mthca_state(enum ib_qp_state ib_state) | 266 | static int to_mthca_state(enum ib_qp_state ib_state) |
@@ -833,10 +835,10 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask) | |||
833 | * entries and reinitialize the QP. | 835 | * entries and reinitialize the QP. |
834 | */ | 836 | */ |
835 | if (new_state == IB_QPS_RESET && !qp->ibqp.uobject) { | 837 | if (new_state == IB_QPS_RESET && !qp->ibqp.uobject) { |
836 | mthca_cq_clean(dev, to_mcq(qp->ibqp.send_cq)->cqn, qp->qpn, | 838 | mthca_cq_clean(dev, to_mcq(qp->ibqp.send_cq), qp->qpn, |
837 | qp->ibqp.srq ? to_msrq(qp->ibqp.srq) : NULL); | 839 | qp->ibqp.srq ? to_msrq(qp->ibqp.srq) : NULL); |
838 | if (qp->ibqp.send_cq != qp->ibqp.recv_cq) | 840 | if (qp->ibqp.send_cq != qp->ibqp.recv_cq) |
839 | mthca_cq_clean(dev, to_mcq(qp->ibqp.recv_cq)->cqn, qp->qpn, | 841 | mthca_cq_clean(dev, to_mcq(qp->ibqp.recv_cq), qp->qpn, |
840 | qp->ibqp.srq ? to_msrq(qp->ibqp.srq) : NULL); | 842 | qp->ibqp.srq ? to_msrq(qp->ibqp.srq) : NULL); |
841 | 843 | ||
842 | mthca_wq_init(&qp->sq); | 844 | mthca_wq_init(&qp->sq); |
@@ -1096,7 +1098,7 @@ static int mthca_alloc_qp_common(struct mthca_dev *dev, | |||
1096 | int ret; | 1098 | int ret; |
1097 | int i; | 1099 | int i; |
1098 | 1100 | ||
1099 | atomic_set(&qp->refcount, 1); | 1101 | qp->refcount = 1; |
1100 | init_waitqueue_head(&qp->wait); | 1102 | init_waitqueue_head(&qp->wait); |
1101 | qp->state = IB_QPS_RESET; | 1103 | qp->state = IB_QPS_RESET; |
1102 | qp->atomic_rd_en = 0; | 1104 | qp->atomic_rd_en = 0; |
@@ -1318,6 +1320,17 @@ int mthca_alloc_sqp(struct mthca_dev *dev, | |||
1318 | return err; | 1320 | return err; |
1319 | } | 1321 | } |
1320 | 1322 | ||
1323 | static inline int get_qp_refcount(struct mthca_dev *dev, struct mthca_qp *qp) | ||
1324 | { | ||
1325 | int c; | ||
1326 | |||
1327 | spin_lock_irq(&dev->qp_table.lock); | ||
1328 | c = qp->refcount; | ||
1329 | spin_unlock_irq(&dev->qp_table.lock); | ||
1330 | |||
1331 | return c; | ||
1332 | } | ||
1333 | |||
1321 | void mthca_free_qp(struct mthca_dev *dev, | 1334 | void mthca_free_qp(struct mthca_dev *dev, |
1322 | struct mthca_qp *qp) | 1335 | struct mthca_qp *qp) |
1323 | { | 1336 | { |
@@ -1339,14 +1352,14 @@ void mthca_free_qp(struct mthca_dev *dev, | |||
1339 | spin_lock(&dev->qp_table.lock); | 1352 | spin_lock(&dev->qp_table.lock); |
1340 | mthca_array_clear(&dev->qp_table.qp, | 1353 | mthca_array_clear(&dev->qp_table.qp, |
1341 | qp->qpn & (dev->limits.num_qps - 1)); | 1354 | qp->qpn & (dev->limits.num_qps - 1)); |
1355 | --qp->refcount; | ||
1342 | spin_unlock(&dev->qp_table.lock); | 1356 | spin_unlock(&dev->qp_table.lock); |
1343 | 1357 | ||
1344 | if (send_cq != recv_cq) | 1358 | if (send_cq != recv_cq) |
1345 | spin_unlock(&recv_cq->lock); | 1359 | spin_unlock(&recv_cq->lock); |
1346 | spin_unlock_irq(&send_cq->lock); | 1360 | spin_unlock_irq(&send_cq->lock); |
1347 | 1361 | ||
1348 | atomic_dec(&qp->refcount); | 1362 | wait_event(qp->wait, !get_qp_refcount(dev, qp)); |
1349 | wait_event(qp->wait, !atomic_read(&qp->refcount)); | ||
1350 | 1363 | ||
1351 | if (qp->state != IB_QPS_RESET) | 1364 | if (qp->state != IB_QPS_RESET) |
1352 | mthca_MODIFY_QP(dev, qp->state, IB_QPS_RESET, qp->qpn, 0, | 1365 | mthca_MODIFY_QP(dev, qp->state, IB_QPS_RESET, qp->qpn, 0, |
@@ -1358,10 +1371,10 @@ void mthca_free_qp(struct mthca_dev *dev, | |||
1358 | * unref the mem-free tables and free the QPN in our table. | 1371 | * unref the mem-free tables and free the QPN in our table. |
1359 | */ | 1372 | */ |
1360 | if (!qp->ibqp.uobject) { | 1373 | if (!qp->ibqp.uobject) { |
1361 | mthca_cq_clean(dev, to_mcq(qp->ibqp.send_cq)->cqn, qp->qpn, | 1374 | mthca_cq_clean(dev, to_mcq(qp->ibqp.send_cq), qp->qpn, |
1362 | qp->ibqp.srq ? to_msrq(qp->ibqp.srq) : NULL); | 1375 | qp->ibqp.srq ? to_msrq(qp->ibqp.srq) : NULL); |
1363 | if (qp->ibqp.send_cq != qp->ibqp.recv_cq) | 1376 | if (qp->ibqp.send_cq != qp->ibqp.recv_cq) |
1364 | mthca_cq_clean(dev, to_mcq(qp->ibqp.recv_cq)->cqn, qp->qpn, | 1377 | mthca_cq_clean(dev, to_mcq(qp->ibqp.recv_cq), qp->qpn, |
1365 | qp->ibqp.srq ? to_msrq(qp->ibqp.srq) : NULL); | 1378 | qp->ibqp.srq ? to_msrq(qp->ibqp.srq) : NULL); |
1366 | 1379 | ||
1367 | mthca_free_memfree(dev, qp); | 1380 | mthca_free_memfree(dev, qp); |
diff --git a/drivers/infiniband/hw/mthca/mthca_srq.c b/drivers/infiniband/hw/mthca/mthca_srq.c index adcaf85355ae..1ea433291fa7 100644 --- a/drivers/infiniband/hw/mthca/mthca_srq.c +++ b/drivers/infiniband/hw/mthca/mthca_srq.c | |||
@@ -241,7 +241,7 @@ int mthca_alloc_srq(struct mthca_dev *dev, struct mthca_pd *pd, | |||
241 | goto err_out_mailbox; | 241 | goto err_out_mailbox; |
242 | 242 | ||
243 | spin_lock_init(&srq->lock); | 243 | spin_lock_init(&srq->lock); |
244 | atomic_set(&srq->refcount, 1); | 244 | srq->refcount = 1; |
245 | init_waitqueue_head(&srq->wait); | 245 | init_waitqueue_head(&srq->wait); |
246 | 246 | ||
247 | if (mthca_is_memfree(dev)) | 247 | if (mthca_is_memfree(dev)) |
@@ -308,6 +308,17 @@ err_out: | |||
308 | return err; | 308 | return err; |
309 | } | 309 | } |
310 | 310 | ||
311 | static inline int get_srq_refcount(struct mthca_dev *dev, struct mthca_srq *srq) | ||
312 | { | ||
313 | int c; | ||
314 | |||
315 | spin_lock_irq(&dev->srq_table.lock); | ||
316 | c = srq->refcount; | ||
317 | spin_unlock_irq(&dev->srq_table.lock); | ||
318 | |||
319 | return c; | ||
320 | } | ||
321 | |||
311 | void mthca_free_srq(struct mthca_dev *dev, struct mthca_srq *srq) | 322 | void mthca_free_srq(struct mthca_dev *dev, struct mthca_srq *srq) |
312 | { | 323 | { |
313 | struct mthca_mailbox *mailbox; | 324 | struct mthca_mailbox *mailbox; |
@@ -329,10 +340,10 @@ void mthca_free_srq(struct mthca_dev *dev, struct mthca_srq *srq) | |||
329 | spin_lock_irq(&dev->srq_table.lock); | 340 | spin_lock_irq(&dev->srq_table.lock); |
330 | mthca_array_clear(&dev->srq_table.srq, | 341 | mthca_array_clear(&dev->srq_table.srq, |
331 | srq->srqn & (dev->limits.num_srqs - 1)); | 342 | srq->srqn & (dev->limits.num_srqs - 1)); |
343 | --srq->refcount; | ||
332 | spin_unlock_irq(&dev->srq_table.lock); | 344 | spin_unlock_irq(&dev->srq_table.lock); |
333 | 345 | ||
334 | atomic_dec(&srq->refcount); | 346 | wait_event(srq->wait, !get_srq_refcount(dev, srq)); |
335 | wait_event(srq->wait, !atomic_read(&srq->refcount)); | ||
336 | 347 | ||
337 | if (!srq->ibsrq.uobject) { | 348 | if (!srq->ibsrq.uobject) { |
338 | mthca_free_srq_buf(dev, srq); | 349 | mthca_free_srq_buf(dev, srq); |
@@ -414,7 +425,7 @@ void mthca_srq_event(struct mthca_dev *dev, u32 srqn, | |||
414 | spin_lock(&dev->srq_table.lock); | 425 | spin_lock(&dev->srq_table.lock); |
415 | srq = mthca_array_get(&dev->srq_table.srq, srqn & (dev->limits.num_srqs - 1)); | 426 | srq = mthca_array_get(&dev->srq_table.srq, srqn & (dev->limits.num_srqs - 1)); |
416 | if (srq) | 427 | if (srq) |
417 | atomic_inc(&srq->refcount); | 428 | ++srq->refcount; |
418 | spin_unlock(&dev->srq_table.lock); | 429 | spin_unlock(&dev->srq_table.lock); |
419 | 430 | ||
420 | if (!srq) { | 431 | if (!srq) { |
@@ -431,8 +442,10 @@ void mthca_srq_event(struct mthca_dev *dev, u32 srqn, | |||
431 | srq->ibsrq.event_handler(&event, srq->ibsrq.srq_context); | 442 | srq->ibsrq.event_handler(&event, srq->ibsrq.srq_context); |
432 | 443 | ||
433 | out: | 444 | out: |
434 | if (atomic_dec_and_test(&srq->refcount)) | 445 | spin_lock(&dev->srq_table.lock); |
446 | if (!--srq->refcount) | ||
435 | wake_up(&srq->wait); | 447 | wake_up(&srq->wait); |
448 | spin_unlock(&dev->srq_table.lock); | ||
436 | } | 449 | } |
437 | 450 | ||
438 | /* | 451 | /* |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_vlan.c b/drivers/infiniband/ulp/ipoib/ipoib_vlan.c index 4ca175553f9f..f887780e8093 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_vlan.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_vlan.c | |||
@@ -158,10 +158,8 @@ int ipoib_vlan_delete(struct net_device *pdev, unsigned short pkey) | |||
158 | if (priv->pkey == pkey) { | 158 | if (priv->pkey == pkey) { |
159 | unregister_netdev(priv->dev); | 159 | unregister_netdev(priv->dev); |
160 | ipoib_dev_cleanup(priv->dev); | 160 | ipoib_dev_cleanup(priv->dev); |
161 | |||
162 | list_del(&priv->list); | 161 | list_del(&priv->list); |
163 | 162 | free_netdev(priv->dev); | |
164 | kfree(priv); | ||
165 | 163 | ||
166 | ret = 0; | 164 | ret = 0; |
167 | break; | 165 | break; |
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 5bb55742ada6..c32ce4348e1b 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c | |||
@@ -409,6 +409,34 @@ static int srp_connect_target(struct srp_target_port *target) | |||
409 | } | 409 | } |
410 | } | 410 | } |
411 | 411 | ||
412 | static void srp_unmap_data(struct scsi_cmnd *scmnd, | ||
413 | struct srp_target_port *target, | ||
414 | struct srp_request *req) | ||
415 | { | ||
416 | struct scatterlist *scat; | ||
417 | int nents; | ||
418 | |||
419 | if (!scmnd->request_buffer || | ||
420 | (scmnd->sc_data_direction != DMA_TO_DEVICE && | ||
421 | scmnd->sc_data_direction != DMA_FROM_DEVICE)) | ||
422 | return; | ||
423 | |||
424 | /* | ||
425 | * This handling of non-SG commands can be killed when the | ||
426 | * SCSI midlayer no longer generates non-SG commands. | ||
427 | */ | ||
428 | if (likely(scmnd->use_sg)) { | ||
429 | nents = scmnd->use_sg; | ||
430 | scat = scmnd->request_buffer; | ||
431 | } else { | ||
432 | nents = 1; | ||
433 | scat = &req->fake_sg; | ||
434 | } | ||
435 | |||
436 | dma_unmap_sg(target->srp_host->dev->dma_device, scat, nents, | ||
437 | scmnd->sc_data_direction); | ||
438 | } | ||
439 | |||
412 | static int srp_reconnect_target(struct srp_target_port *target) | 440 | static int srp_reconnect_target(struct srp_target_port *target) |
413 | { | 441 | { |
414 | struct ib_cm_id *new_cm_id; | 442 | struct ib_cm_id *new_cm_id; |
@@ -455,16 +483,16 @@ static int srp_reconnect_target(struct srp_target_port *target) | |||
455 | list_for_each_entry(req, &target->req_queue, list) { | 483 | list_for_each_entry(req, &target->req_queue, list) { |
456 | req->scmnd->result = DID_RESET << 16; | 484 | req->scmnd->result = DID_RESET << 16; |
457 | req->scmnd->scsi_done(req->scmnd); | 485 | req->scmnd->scsi_done(req->scmnd); |
486 | srp_unmap_data(req->scmnd, target, req); | ||
458 | } | 487 | } |
459 | 488 | ||
460 | target->rx_head = 0; | 489 | target->rx_head = 0; |
461 | target->tx_head = 0; | 490 | target->tx_head = 0; |
462 | target->tx_tail = 0; | 491 | target->tx_tail = 0; |
463 | target->req_head = 0; | 492 | INIT_LIST_HEAD(&target->free_reqs); |
464 | for (i = 0; i < SRP_SQ_SIZE - 1; ++i) | ||
465 | target->req_ring[i].next = i + 1; | ||
466 | target->req_ring[SRP_SQ_SIZE - 1].next = -1; | ||
467 | INIT_LIST_HEAD(&target->req_queue); | 493 | INIT_LIST_HEAD(&target->req_queue); |
494 | for (i = 0; i < SRP_SQ_SIZE; ++i) | ||
495 | list_add_tail(&target->req_ring[i].list, &target->free_reqs); | ||
468 | 496 | ||
469 | ret = srp_connect_target(target); | 497 | ret = srp_connect_target(target); |
470 | if (ret) | 498 | if (ret) |
@@ -589,40 +617,10 @@ static int srp_map_data(struct scsi_cmnd *scmnd, struct srp_target_port *target, | |||
589 | return len; | 617 | return len; |
590 | } | 618 | } |
591 | 619 | ||
592 | static void srp_unmap_data(struct scsi_cmnd *scmnd, | 620 | static void srp_remove_req(struct srp_target_port *target, struct srp_request *req) |
593 | struct srp_target_port *target, | ||
594 | struct srp_request *req) | ||
595 | { | ||
596 | struct scatterlist *scat; | ||
597 | int nents; | ||
598 | |||
599 | if (!scmnd->request_buffer || | ||
600 | (scmnd->sc_data_direction != DMA_TO_DEVICE && | ||
601 | scmnd->sc_data_direction != DMA_FROM_DEVICE)) | ||
602 | return; | ||
603 | |||
604 | /* | ||
605 | * This handling of non-SG commands can be killed when the | ||
606 | * SCSI midlayer no longer generates non-SG commands. | ||
607 | */ | ||
608 | if (likely(scmnd->use_sg)) { | ||
609 | nents = scmnd->use_sg; | ||
610 | scat = scmnd->request_buffer; | ||
611 | } else { | ||
612 | nents = 1; | ||
613 | scat = &req->fake_sg; | ||
614 | } | ||
615 | |||
616 | dma_unmap_sg(target->srp_host->dev->dma_device, scat, nents, | ||
617 | scmnd->sc_data_direction); | ||
618 | } | ||
619 | |||
620 | static void srp_remove_req(struct srp_target_port *target, struct srp_request *req, | ||
621 | int index) | ||
622 | { | 621 | { |
623 | list_del(&req->list); | 622 | srp_unmap_data(req->scmnd, target, req); |
624 | req->next = target->req_head; | 623 | list_move_tail(&req->list, &target->free_reqs); |
625 | target->req_head = index; | ||
626 | } | 624 | } |
627 | 625 | ||
628 | static void srp_process_rsp(struct srp_target_port *target, struct srp_rsp *rsp) | 626 | static void srp_process_rsp(struct srp_target_port *target, struct srp_rsp *rsp) |
@@ -647,7 +645,7 @@ static void srp_process_rsp(struct srp_target_port *target, struct srp_rsp *rsp) | |||
647 | req->tsk_status = rsp->data[3]; | 645 | req->tsk_status = rsp->data[3]; |
648 | complete(&req->done); | 646 | complete(&req->done); |
649 | } else { | 647 | } else { |
650 | scmnd = req->scmnd; | 648 | scmnd = req->scmnd; |
651 | if (!scmnd) | 649 | if (!scmnd) |
652 | printk(KERN_ERR "Null scmnd for RSP w/tag %016llx\n", | 650 | printk(KERN_ERR "Null scmnd for RSP w/tag %016llx\n", |
653 | (unsigned long long) rsp->tag); | 651 | (unsigned long long) rsp->tag); |
@@ -665,14 +663,11 @@ static void srp_process_rsp(struct srp_target_port *target, struct srp_rsp *rsp) | |||
665 | else if (rsp->flags & (SRP_RSP_FLAG_DIOVER | SRP_RSP_FLAG_DIUNDER)) | 663 | else if (rsp->flags & (SRP_RSP_FLAG_DIOVER | SRP_RSP_FLAG_DIUNDER)) |
666 | scmnd->resid = be32_to_cpu(rsp->data_in_res_cnt); | 664 | scmnd->resid = be32_to_cpu(rsp->data_in_res_cnt); |
667 | 665 | ||
668 | srp_unmap_data(scmnd, target, req); | ||
669 | |||
670 | if (!req->tsk_mgmt) { | 666 | if (!req->tsk_mgmt) { |
671 | req->scmnd = NULL; | ||
672 | scmnd->host_scribble = (void *) -1L; | 667 | scmnd->host_scribble = (void *) -1L; |
673 | scmnd->scsi_done(scmnd); | 668 | scmnd->scsi_done(scmnd); |
674 | 669 | ||
675 | srp_remove_req(target, req, rsp->tag & ~SRP_TAG_TSK_MGMT); | 670 | srp_remove_req(target, req); |
676 | } else | 671 | } else |
677 | req->cmd_done = 1; | 672 | req->cmd_done = 1; |
678 | } | 673 | } |
@@ -859,7 +854,6 @@ static int srp_queuecommand(struct scsi_cmnd *scmnd, | |||
859 | struct srp_request *req; | 854 | struct srp_request *req; |
860 | struct srp_iu *iu; | 855 | struct srp_iu *iu; |
861 | struct srp_cmd *cmd; | 856 | struct srp_cmd *cmd; |
862 | long req_index; | ||
863 | int len; | 857 | int len; |
864 | 858 | ||
865 | if (target->state == SRP_TARGET_CONNECTING) | 859 | if (target->state == SRP_TARGET_CONNECTING) |
@@ -879,22 +873,20 @@ static int srp_queuecommand(struct scsi_cmnd *scmnd, | |||
879 | dma_sync_single_for_cpu(target->srp_host->dev->dma_device, iu->dma, | 873 | dma_sync_single_for_cpu(target->srp_host->dev->dma_device, iu->dma, |
880 | SRP_MAX_IU_LEN, DMA_TO_DEVICE); | 874 | SRP_MAX_IU_LEN, DMA_TO_DEVICE); |
881 | 875 | ||
882 | req_index = target->req_head; | 876 | req = list_entry(target->free_reqs.next, struct srp_request, list); |
883 | 877 | ||
884 | scmnd->scsi_done = done; | 878 | scmnd->scsi_done = done; |
885 | scmnd->result = 0; | 879 | scmnd->result = 0; |
886 | scmnd->host_scribble = (void *) req_index; | 880 | scmnd->host_scribble = (void *) (long) req->index; |
887 | 881 | ||
888 | cmd = iu->buf; | 882 | cmd = iu->buf; |
889 | memset(cmd, 0, sizeof *cmd); | 883 | memset(cmd, 0, sizeof *cmd); |
890 | 884 | ||
891 | cmd->opcode = SRP_CMD; | 885 | cmd->opcode = SRP_CMD; |
892 | cmd->lun = cpu_to_be64((u64) scmnd->device->lun << 48); | 886 | cmd->lun = cpu_to_be64((u64) scmnd->device->lun << 48); |
893 | cmd->tag = req_index; | 887 | cmd->tag = req->index; |
894 | memcpy(cmd->cdb, scmnd->cmnd, scmnd->cmd_len); | 888 | memcpy(cmd->cdb, scmnd->cmnd, scmnd->cmd_len); |
895 | 889 | ||
896 | req = &target->req_ring[req_index]; | ||
897 | |||
898 | req->scmnd = scmnd; | 890 | req->scmnd = scmnd; |
899 | req->cmd = iu; | 891 | req->cmd = iu; |
900 | req->cmd_done = 0; | 892 | req->cmd_done = 0; |
@@ -919,8 +911,7 @@ static int srp_queuecommand(struct scsi_cmnd *scmnd, | |||
919 | goto err_unmap; | 911 | goto err_unmap; |
920 | } | 912 | } |
921 | 913 | ||
922 | target->req_head = req->next; | 914 | list_move_tail(&req->list, &target->req_queue); |
923 | list_add_tail(&req->list, &target->req_queue); | ||
924 | 915 | ||
925 | return 0; | 916 | return 0; |
926 | 917 | ||
@@ -1143,30 +1134,20 @@ static int srp_cm_handler(struct ib_cm_id *cm_id, struct ib_cm_event *event) | |||
1143 | return 0; | 1134 | return 0; |
1144 | } | 1135 | } |
1145 | 1136 | ||
1146 | static int srp_send_tsk_mgmt(struct scsi_cmnd *scmnd, u8 func) | 1137 | static int srp_send_tsk_mgmt(struct srp_target_port *target, |
1138 | struct srp_request *req, u8 func) | ||
1147 | { | 1139 | { |
1148 | struct srp_target_port *target = host_to_target(scmnd->device->host); | ||
1149 | struct srp_request *req; | ||
1150 | struct srp_iu *iu; | 1140 | struct srp_iu *iu; |
1151 | struct srp_tsk_mgmt *tsk_mgmt; | 1141 | struct srp_tsk_mgmt *tsk_mgmt; |
1152 | int req_index; | ||
1153 | int ret = FAILED; | ||
1154 | 1142 | ||
1155 | spin_lock_irq(target->scsi_host->host_lock); | 1143 | spin_lock_irq(target->scsi_host->host_lock); |
1156 | 1144 | ||
1157 | if (target->state == SRP_TARGET_DEAD || | 1145 | if (target->state == SRP_TARGET_DEAD || |
1158 | target->state == SRP_TARGET_REMOVED) { | 1146 | target->state == SRP_TARGET_REMOVED) { |
1159 | scmnd->result = DID_BAD_TARGET << 16; | 1147 | req->scmnd->result = DID_BAD_TARGET << 16; |
1160 | goto out; | 1148 | goto out; |
1161 | } | 1149 | } |
1162 | 1150 | ||
1163 | if (scmnd->host_scribble == (void *) -1L) | ||
1164 | goto out; | ||
1165 | |||
1166 | req_index = (long) scmnd->host_scribble; | ||
1167 | printk(KERN_ERR "Abort for req_index %d\n", req_index); | ||
1168 | |||
1169 | req = &target->req_ring[req_index]; | ||
1170 | init_completion(&req->done); | 1151 | init_completion(&req->done); |
1171 | 1152 | ||
1172 | iu = __srp_get_tx_iu(target); | 1153 | iu = __srp_get_tx_iu(target); |
@@ -1177,10 +1158,10 @@ static int srp_send_tsk_mgmt(struct scsi_cmnd *scmnd, u8 func) | |||
1177 | memset(tsk_mgmt, 0, sizeof *tsk_mgmt); | 1158 | memset(tsk_mgmt, 0, sizeof *tsk_mgmt); |
1178 | 1159 | ||
1179 | tsk_mgmt->opcode = SRP_TSK_MGMT; | 1160 | tsk_mgmt->opcode = SRP_TSK_MGMT; |
1180 | tsk_mgmt->lun = cpu_to_be64((u64) scmnd->device->lun << 48); | 1161 | tsk_mgmt->lun = cpu_to_be64((u64) req->scmnd->device->lun << 48); |
1181 | tsk_mgmt->tag = req_index | SRP_TAG_TSK_MGMT; | 1162 | tsk_mgmt->tag = req->index | SRP_TAG_TSK_MGMT; |
1182 | tsk_mgmt->tsk_mgmt_func = func; | 1163 | tsk_mgmt->tsk_mgmt_func = func; |
1183 | tsk_mgmt->task_tag = req_index; | 1164 | tsk_mgmt->task_tag = req->index; |
1184 | 1165 | ||
1185 | if (__srp_post_send(target, iu, sizeof *tsk_mgmt)) | 1166 | if (__srp_post_send(target, iu, sizeof *tsk_mgmt)) |
1186 | goto out; | 1167 | goto out; |
@@ -1188,37 +1169,85 @@ static int srp_send_tsk_mgmt(struct scsi_cmnd *scmnd, u8 func) | |||
1188 | req->tsk_mgmt = iu; | 1169 | req->tsk_mgmt = iu; |
1189 | 1170 | ||
1190 | spin_unlock_irq(target->scsi_host->host_lock); | 1171 | spin_unlock_irq(target->scsi_host->host_lock); |
1172 | |||
1191 | if (!wait_for_completion_timeout(&req->done, | 1173 | if (!wait_for_completion_timeout(&req->done, |
1192 | msecs_to_jiffies(SRP_ABORT_TIMEOUT_MS))) | 1174 | msecs_to_jiffies(SRP_ABORT_TIMEOUT_MS))) |
1193 | return FAILED; | 1175 | return -1; |
1194 | spin_lock_irq(target->scsi_host->host_lock); | ||
1195 | 1176 | ||
1196 | if (req->cmd_done) { | 1177 | return 0; |
1197 | srp_remove_req(target, req, req_index); | ||
1198 | scmnd->scsi_done(scmnd); | ||
1199 | } else if (!req->tsk_status) { | ||
1200 | srp_remove_req(target, req, req_index); | ||
1201 | scmnd->result = DID_ABORT << 16; | ||
1202 | ret = SUCCESS; | ||
1203 | } | ||
1204 | 1178 | ||
1205 | out: | 1179 | out: |
1206 | spin_unlock_irq(target->scsi_host->host_lock); | 1180 | spin_unlock_irq(target->scsi_host->host_lock); |
1207 | return ret; | 1181 | return -1; |
1182 | } | ||
1183 | |||
1184 | static int srp_find_req(struct srp_target_port *target, | ||
1185 | struct scsi_cmnd *scmnd, | ||
1186 | struct srp_request **req) | ||
1187 | { | ||
1188 | if (scmnd->host_scribble == (void *) -1L) | ||
1189 | return -1; | ||
1190 | |||
1191 | *req = &target->req_ring[(long) scmnd->host_scribble]; | ||
1192 | |||
1193 | return 0; | ||
1208 | } | 1194 | } |
1209 | 1195 | ||
1210 | static int srp_abort(struct scsi_cmnd *scmnd) | 1196 | static int srp_abort(struct scsi_cmnd *scmnd) |
1211 | { | 1197 | { |
1198 | struct srp_target_port *target = host_to_target(scmnd->device->host); | ||
1199 | struct srp_request *req; | ||
1200 | int ret = SUCCESS; | ||
1201 | |||
1212 | printk(KERN_ERR "SRP abort called\n"); | 1202 | printk(KERN_ERR "SRP abort called\n"); |
1213 | 1203 | ||
1214 | return srp_send_tsk_mgmt(scmnd, SRP_TSK_ABORT_TASK); | 1204 | if (srp_find_req(target, scmnd, &req)) |
1205 | return FAILED; | ||
1206 | if (srp_send_tsk_mgmt(target, req, SRP_TSK_ABORT_TASK)) | ||
1207 | return FAILED; | ||
1208 | |||
1209 | spin_lock_irq(target->scsi_host->host_lock); | ||
1210 | |||
1211 | if (req->cmd_done) { | ||
1212 | srp_remove_req(target, req); | ||
1213 | scmnd->scsi_done(scmnd); | ||
1214 | } else if (!req->tsk_status) { | ||
1215 | srp_remove_req(target, req); | ||
1216 | scmnd->result = DID_ABORT << 16; | ||
1217 | } else | ||
1218 | ret = FAILED; | ||
1219 | |||
1220 | spin_unlock_irq(target->scsi_host->host_lock); | ||
1221 | |||
1222 | return ret; | ||
1215 | } | 1223 | } |
1216 | 1224 | ||
1217 | static int srp_reset_device(struct scsi_cmnd *scmnd) | 1225 | static int srp_reset_device(struct scsi_cmnd *scmnd) |
1218 | { | 1226 | { |
1227 | struct srp_target_port *target = host_to_target(scmnd->device->host); | ||
1228 | struct srp_request *req, *tmp; | ||
1229 | |||
1219 | printk(KERN_ERR "SRP reset_device called\n"); | 1230 | printk(KERN_ERR "SRP reset_device called\n"); |
1220 | 1231 | ||
1221 | return srp_send_tsk_mgmt(scmnd, SRP_TSK_LUN_RESET); | 1232 | if (srp_find_req(target, scmnd, &req)) |
1233 | return FAILED; | ||
1234 | if (srp_send_tsk_mgmt(target, req, SRP_TSK_LUN_RESET)) | ||
1235 | return FAILED; | ||
1236 | if (req->tsk_status) | ||
1237 | return FAILED; | ||
1238 | |||
1239 | spin_lock_irq(target->scsi_host->host_lock); | ||
1240 | |||
1241 | list_for_each_entry_safe(req, tmp, &target->req_queue, list) | ||
1242 | if (req->scmnd->device == scmnd->device) { | ||
1243 | req->scmnd->result = DID_RESET << 16; | ||
1244 | scmnd->scsi_done(scmnd); | ||
1245 | srp_remove_req(target, req); | ||
1246 | } | ||
1247 | |||
1248 | spin_unlock_irq(target->scsi_host->host_lock); | ||
1249 | |||
1250 | return SUCCESS; | ||
1222 | } | 1251 | } |
1223 | 1252 | ||
1224 | static int srp_reset_host(struct scsi_cmnd *scmnd) | 1253 | static int srp_reset_host(struct scsi_cmnd *scmnd) |
@@ -1518,10 +1547,12 @@ static ssize_t srp_create_target(struct class_device *class_dev, | |||
1518 | 1547 | ||
1519 | INIT_WORK(&target->work, srp_reconnect_work, target); | 1548 | INIT_WORK(&target->work, srp_reconnect_work, target); |
1520 | 1549 | ||
1521 | for (i = 0; i < SRP_SQ_SIZE - 1; ++i) | 1550 | INIT_LIST_HEAD(&target->free_reqs); |
1522 | target->req_ring[i].next = i + 1; | ||
1523 | target->req_ring[SRP_SQ_SIZE - 1].next = -1; | ||
1524 | INIT_LIST_HEAD(&target->req_queue); | 1551 | INIT_LIST_HEAD(&target->req_queue); |
1552 | for (i = 0; i < SRP_SQ_SIZE; ++i) { | ||
1553 | target->req_ring[i].index = i; | ||
1554 | list_add_tail(&target->req_ring[i].list, &target->free_reqs); | ||
1555 | } | ||
1525 | 1556 | ||
1526 | ret = srp_parse_options(buf, target); | 1557 | ret = srp_parse_options(buf, target); |
1527 | if (ret) | 1558 | if (ret) |
diff --git a/drivers/infiniband/ulp/srp/ib_srp.h b/drivers/infiniband/ulp/srp/ib_srp.h index bd7f7c3115de..c5cd43aae860 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.h +++ b/drivers/infiniband/ulp/srp/ib_srp.h | |||
@@ -101,7 +101,7 @@ struct srp_request { | |||
101 | */ | 101 | */ |
102 | struct scatterlist fake_sg; | 102 | struct scatterlist fake_sg; |
103 | struct completion done; | 103 | struct completion done; |
104 | short next; | 104 | short index; |
105 | u8 cmd_done; | 105 | u8 cmd_done; |
106 | u8 tsk_status; | 106 | u8 tsk_status; |
107 | }; | 107 | }; |
@@ -133,7 +133,7 @@ struct srp_target_port { | |||
133 | unsigned tx_tail; | 133 | unsigned tx_tail; |
134 | struct srp_iu *tx_ring[SRP_SQ_SIZE + 1]; | 134 | struct srp_iu *tx_ring[SRP_SQ_SIZE + 1]; |
135 | 135 | ||
136 | int req_head; | 136 | struct list_head free_reqs; |
137 | struct list_head req_queue; | 137 | struct list_head req_queue; |
138 | struct srp_request req_ring[SRP_SQ_SIZE]; | 138 | struct srp_request req_ring[SRP_SQ_SIZE]; |
139 | 139 | ||
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index 266414ca2814..9080853fe283 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c | |||
@@ -1189,7 +1189,6 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1189 | ioc->diagPending = 0; | 1189 | ioc->diagPending = 0; |
1190 | spin_lock_init(&ioc->diagLock); | 1190 | spin_lock_init(&ioc->diagLock); |
1191 | spin_lock_init(&ioc->fc_rescan_work_lock); | 1191 | spin_lock_init(&ioc->fc_rescan_work_lock); |
1192 | spin_lock_init(&ioc->fc_rport_lock); | ||
1193 | spin_lock_init(&ioc->initializing_hba_lock); | 1192 | spin_lock_init(&ioc->initializing_hba_lock); |
1194 | 1193 | ||
1195 | /* Initialize the event logging. | 1194 | /* Initialize the event logging. |
@@ -5736,11 +5735,13 @@ mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag) | |||
5736 | return rc; | 5735 | return rc; |
5737 | } | 5736 | } |
5738 | 5737 | ||
5738 | # define EVENT_DESCR_STR_SZ 100 | ||
5739 | |||
5739 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 5740 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
5740 | static void | 5741 | static void |
5741 | EventDescriptionStr(u8 event, u32 evData0, char *evStr) | 5742 | EventDescriptionStr(u8 event, u32 evData0, char *evStr) |
5742 | { | 5743 | { |
5743 | char *ds; | 5744 | char *ds = NULL; |
5744 | 5745 | ||
5745 | switch(event) { | 5746 | switch(event) { |
5746 | case MPI_EVENT_NONE: | 5747 | case MPI_EVENT_NONE: |
@@ -5777,9 +5778,9 @@ EventDescriptionStr(u8 event, u32 evData0, char *evStr) | |||
5777 | if (evData0 == MPI_EVENT_LOOP_STATE_CHANGE_LIP) | 5778 | if (evData0 == MPI_EVENT_LOOP_STATE_CHANGE_LIP) |
5778 | ds = "Loop State(LIP) Change"; | 5779 | ds = "Loop State(LIP) Change"; |
5779 | else if (evData0 == MPI_EVENT_LOOP_STATE_CHANGE_LPE) | 5780 | else if (evData0 == MPI_EVENT_LOOP_STATE_CHANGE_LPE) |
5780 | ds = "Loop State(LPE) Change"; /* ??? */ | 5781 | ds = "Loop State(LPE) Change"; /* ??? */ |
5781 | else | 5782 | else |
5782 | ds = "Loop State(LPB) Change"; /* ??? */ | 5783 | ds = "Loop State(LPB) Change"; /* ??? */ |
5783 | break; | 5784 | break; |
5784 | case MPI_EVENT_LOGOUT: | 5785 | case MPI_EVENT_LOGOUT: |
5785 | ds = "Logout"; | 5786 | ds = "Logout"; |
@@ -5841,27 +5842,32 @@ EventDescriptionStr(u8 event, u32 evData0, char *evStr) | |||
5841 | break; | 5842 | break; |
5842 | case MPI_EVENT_SAS_DEVICE_STATUS_CHANGE: | 5843 | case MPI_EVENT_SAS_DEVICE_STATUS_CHANGE: |
5843 | { | 5844 | { |
5844 | char buf[50]; | ||
5845 | u8 id = (u8)(evData0); | 5845 | u8 id = (u8)(evData0); |
5846 | u8 ReasonCode = (u8)(evData0 >> 16); | 5846 | u8 ReasonCode = (u8)(evData0 >> 16); |
5847 | switch (ReasonCode) { | 5847 | switch (ReasonCode) { |
5848 | case MPI_EVENT_SAS_DEV_STAT_RC_ADDED: | 5848 | case MPI_EVENT_SAS_DEV_STAT_RC_ADDED: |
5849 | sprintf(buf,"SAS Device Status Change: Added: id=%d", id); | 5849 | snprintf(evStr, EVENT_DESCR_STR_SZ, |
5850 | "SAS Device Status Change: Added: id=%d", id); | ||
5850 | break; | 5851 | break; |
5851 | case MPI_EVENT_SAS_DEV_STAT_RC_NOT_RESPONDING: | 5852 | case MPI_EVENT_SAS_DEV_STAT_RC_NOT_RESPONDING: |
5852 | sprintf(buf,"SAS Device Status Change: Deleted: id=%d", id); | 5853 | snprintf(evStr, EVENT_DESCR_STR_SZ, |
5854 | "SAS Device Status Change: Deleted: id=%d", id); | ||
5853 | break; | 5855 | break; |
5854 | case MPI_EVENT_SAS_DEV_STAT_RC_SMART_DATA: | 5856 | case MPI_EVENT_SAS_DEV_STAT_RC_SMART_DATA: |
5855 | sprintf(buf,"SAS Device Status Change: SMART Data: id=%d", id); | 5857 | snprintf(evStr, EVENT_DESCR_STR_SZ, |
5858 | "SAS Device Status Change: SMART Data: id=%d", | ||
5859 | id); | ||
5856 | break; | 5860 | break; |
5857 | case MPI_EVENT_SAS_DEV_STAT_RC_NO_PERSIST_ADDED: | 5861 | case MPI_EVENT_SAS_DEV_STAT_RC_NO_PERSIST_ADDED: |
5858 | sprintf(buf,"SAS Device Status Change: No Persistancy Added: id=%d", id); | 5862 | snprintf(evStr, EVENT_DESCR_STR_SZ, |
5863 | "SAS Device Status Change: No Persistancy " | ||
5864 | "Added: id=%d", id); | ||
5859 | break; | 5865 | break; |
5860 | default: | 5866 | default: |
5861 | sprintf(buf,"SAS Device Status Change: Unknown: id=%d", id); | 5867 | snprintf(evStr, EVENT_DESCR_STR_SZ, |
5862 | break; | 5868 | "SAS Device Status Change: Unknown: id=%d", id); |
5869 | break; | ||
5863 | } | 5870 | } |
5864 | ds = buf; | ||
5865 | break; | 5871 | break; |
5866 | } | 5872 | } |
5867 | case MPI_EVENT_ON_BUS_TIMER_EXPIRED: | 5873 | case MPI_EVENT_ON_BUS_TIMER_EXPIRED: |
@@ -5878,41 +5884,46 @@ EventDescriptionStr(u8 event, u32 evData0, char *evStr) | |||
5878 | break; | 5884 | break; |
5879 | case MPI_EVENT_SAS_PHY_LINK_STATUS: | 5885 | case MPI_EVENT_SAS_PHY_LINK_STATUS: |
5880 | { | 5886 | { |
5881 | char buf[50]; | ||
5882 | u8 LinkRates = (u8)(evData0 >> 8); | 5887 | u8 LinkRates = (u8)(evData0 >> 8); |
5883 | u8 PhyNumber = (u8)(evData0); | 5888 | u8 PhyNumber = (u8)(evData0); |
5884 | LinkRates = (LinkRates & MPI_EVENT_SAS_PLS_LR_CURRENT_MASK) >> | 5889 | LinkRates = (LinkRates & MPI_EVENT_SAS_PLS_LR_CURRENT_MASK) >> |
5885 | MPI_EVENT_SAS_PLS_LR_CURRENT_SHIFT; | 5890 | MPI_EVENT_SAS_PLS_LR_CURRENT_SHIFT; |
5886 | switch (LinkRates) { | 5891 | switch (LinkRates) { |
5887 | case MPI_EVENT_SAS_PLS_LR_RATE_UNKNOWN: | 5892 | case MPI_EVENT_SAS_PLS_LR_RATE_UNKNOWN: |
5888 | sprintf(buf,"SAS PHY Link Status: Phy=%d:" | 5893 | snprintf(evStr, EVENT_DESCR_STR_SZ, |
5894 | "SAS PHY Link Status: Phy=%d:" | ||
5889 | " Rate Unknown",PhyNumber); | 5895 | " Rate Unknown",PhyNumber); |
5890 | break; | 5896 | break; |
5891 | case MPI_EVENT_SAS_PLS_LR_RATE_PHY_DISABLED: | 5897 | case MPI_EVENT_SAS_PLS_LR_RATE_PHY_DISABLED: |
5892 | sprintf(buf,"SAS PHY Link Status: Phy=%d:" | 5898 | snprintf(evStr, EVENT_DESCR_STR_SZ, |
5899 | "SAS PHY Link Status: Phy=%d:" | ||
5893 | " Phy Disabled",PhyNumber); | 5900 | " Phy Disabled",PhyNumber); |
5894 | break; | 5901 | break; |
5895 | case MPI_EVENT_SAS_PLS_LR_RATE_FAILED_SPEED_NEGOTIATION: | 5902 | case MPI_EVENT_SAS_PLS_LR_RATE_FAILED_SPEED_NEGOTIATION: |
5896 | sprintf(buf,"SAS PHY Link Status: Phy=%d:" | 5903 | snprintf(evStr, EVENT_DESCR_STR_SZ, |
5904 | "SAS PHY Link Status: Phy=%d:" | ||
5897 | " Failed Speed Nego",PhyNumber); | 5905 | " Failed Speed Nego",PhyNumber); |
5898 | break; | 5906 | break; |
5899 | case MPI_EVENT_SAS_PLS_LR_RATE_SATA_OOB_COMPLETE: | 5907 | case MPI_EVENT_SAS_PLS_LR_RATE_SATA_OOB_COMPLETE: |
5900 | sprintf(buf,"SAS PHY Link Status: Phy=%d:" | 5908 | snprintf(evStr, EVENT_DESCR_STR_SZ, |
5909 | "SAS PHY Link Status: Phy=%d:" | ||
5901 | " Sata OOB Completed",PhyNumber); | 5910 | " Sata OOB Completed",PhyNumber); |
5902 | break; | 5911 | break; |
5903 | case MPI_EVENT_SAS_PLS_LR_RATE_1_5: | 5912 | case MPI_EVENT_SAS_PLS_LR_RATE_1_5: |
5904 | sprintf(buf,"SAS PHY Link Status: Phy=%d:" | 5913 | snprintf(evStr, EVENT_DESCR_STR_SZ, |
5914 | "SAS PHY Link Status: Phy=%d:" | ||
5905 | " Rate 1.5 Gbps",PhyNumber); | 5915 | " Rate 1.5 Gbps",PhyNumber); |
5906 | break; | 5916 | break; |
5907 | case MPI_EVENT_SAS_PLS_LR_RATE_3_0: | 5917 | case MPI_EVENT_SAS_PLS_LR_RATE_3_0: |
5908 | sprintf(buf,"SAS PHY Link Status: Phy=%d:" | 5918 | snprintf(evStr, EVENT_DESCR_STR_SZ, |
5919 | "SAS PHY Link Status: Phy=%d:" | ||
5909 | " Rate 3.0 Gpbs",PhyNumber); | 5920 | " Rate 3.0 Gpbs",PhyNumber); |
5910 | break; | 5921 | break; |
5911 | default: | 5922 | default: |
5912 | sprintf(buf,"SAS PHY Link Status: Phy=%d", PhyNumber); | 5923 | snprintf(evStr, EVENT_DESCR_STR_SZ, |
5924 | "SAS PHY Link Status: Phy=%d", PhyNumber); | ||
5913 | break; | 5925 | break; |
5914 | } | 5926 | } |
5915 | ds = buf; | ||
5916 | break; | 5927 | break; |
5917 | } | 5928 | } |
5918 | case MPI_EVENT_SAS_DISCOVERY_ERROR: | 5929 | case MPI_EVENT_SAS_DISCOVERY_ERROR: |
@@ -5921,9 +5932,8 @@ EventDescriptionStr(u8 event, u32 evData0, char *evStr) | |||
5921 | case MPI_EVENT_IR_RESYNC_UPDATE: | 5932 | case MPI_EVENT_IR_RESYNC_UPDATE: |
5922 | { | 5933 | { |
5923 | u8 resync_complete = (u8)(evData0 >> 16); | 5934 | u8 resync_complete = (u8)(evData0 >> 16); |
5924 | char buf[40]; | 5935 | snprintf(evStr, EVENT_DESCR_STR_SZ, |
5925 | sprintf(buf,"IR Resync Update: Complete = %d:",resync_complete); | 5936 | "IR Resync Update: Complete = %d:",resync_complete); |
5926 | ds = buf; | ||
5927 | break; | 5937 | break; |
5928 | } | 5938 | } |
5929 | case MPI_EVENT_IR2: | 5939 | case MPI_EVENT_IR2: |
@@ -5976,7 +5986,8 @@ EventDescriptionStr(u8 event, u32 evData0, char *evStr) | |||
5976 | ds = "Unknown"; | 5986 | ds = "Unknown"; |
5977 | break; | 5987 | break; |
5978 | } | 5988 | } |
5979 | strcpy(evStr,ds); | 5989 | if (ds) |
5990 | strncpy(evStr, ds, EVENT_DESCR_STR_SZ); | ||
5980 | } | 5991 | } |
5981 | 5992 | ||
5982 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 5993 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
@@ -5998,7 +6009,7 @@ ProcessEventNotification(MPT_ADAPTER *ioc, EventNotificationReply_t *pEventReply | |||
5998 | int ii; | 6009 | int ii; |
5999 | int r = 0; | 6010 | int r = 0; |
6000 | int handlers = 0; | 6011 | int handlers = 0; |
6001 | char evStr[100]; | 6012 | char evStr[EVENT_DESCR_STR_SZ]; |
6002 | u8 event; | 6013 | u8 event; |
6003 | 6014 | ||
6004 | /* | 6015 | /* |
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h index be7e8501b53c..f673cca507e1 100644 --- a/drivers/message/fusion/mptbase.h +++ b/drivers/message/fusion/mptbase.h | |||
@@ -76,8 +76,8 @@ | |||
76 | #define COPYRIGHT "Copyright (c) 1999-2005 " MODULEAUTHOR | 76 | #define COPYRIGHT "Copyright (c) 1999-2005 " MODULEAUTHOR |
77 | #endif | 77 | #endif |
78 | 78 | ||
79 | #define MPT_LINUX_VERSION_COMMON "3.03.08" | 79 | #define MPT_LINUX_VERSION_COMMON "3.03.09" |
80 | #define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.03.08" | 80 | #define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.03.09" |
81 | #define WHAT_MAGIC_STRING "@" "(" "#" ")" | 81 | #define WHAT_MAGIC_STRING "@" "(" "#" ")" |
82 | 82 | ||
83 | #define show_mptmod_ver(s,ver) \ | 83 | #define show_mptmod_ver(s,ver) \ |
@@ -489,7 +489,6 @@ typedef struct _RaidCfgData { | |||
489 | 489 | ||
490 | #define MPT_RPORT_INFO_FLAGS_REGISTERED 0x01 /* rport registered */ | 490 | #define MPT_RPORT_INFO_FLAGS_REGISTERED 0x01 /* rport registered */ |
491 | #define MPT_RPORT_INFO_FLAGS_MISSING 0x02 /* missing from DevPage0 scan */ | 491 | #define MPT_RPORT_INFO_FLAGS_MISSING 0x02 /* missing from DevPage0 scan */ |
492 | #define MPT_RPORT_INFO_FLAGS_MAPPED_VDEV 0x04 /* target mapped in vdev */ | ||
493 | 492 | ||
494 | /* | 493 | /* |
495 | * data allocated for each fc rport device | 494 | * data allocated for each fc rport device |
@@ -501,7 +500,6 @@ struct mptfc_rport_info | |||
501 | struct scsi_target *starget; | 500 | struct scsi_target *starget; |
502 | FCDevicePage0_t pg0; | 501 | FCDevicePage0_t pg0; |
503 | u8 flags; | 502 | u8 flags; |
504 | u8 remap_needed; | ||
505 | }; | 503 | }; |
506 | 504 | ||
507 | /* | 505 | /* |
@@ -628,11 +626,11 @@ typedef struct _MPT_ADAPTER | |||
628 | struct work_struct mptscsih_persistTask; | 626 | struct work_struct mptscsih_persistTask; |
629 | 627 | ||
630 | struct list_head fc_rports; | 628 | struct list_head fc_rports; |
631 | spinlock_t fc_rport_lock; /* list and ri flags */ | ||
632 | spinlock_t fc_rescan_work_lock; | 629 | spinlock_t fc_rescan_work_lock; |
633 | int fc_rescan_work_count; | 630 | int fc_rescan_work_count; |
634 | struct work_struct fc_rescan_work; | 631 | struct work_struct fc_rescan_work; |
635 | 632 | char fc_rescan_work_q_name[KOBJ_NAME_LEN]; | |
633 | struct workqueue_struct *fc_rescan_work_q; | ||
636 | } MPT_ADAPTER; | 634 | } MPT_ADAPTER; |
637 | 635 | ||
638 | /* | 636 | /* |
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c index b343f2a68b1c..856487741ef4 100644 --- a/drivers/message/fusion/mptfc.c +++ b/drivers/message/fusion/mptfc.c | |||
@@ -341,9 +341,6 @@ mptfc_generate_rport_ids(FCDevicePage0_t *pg0, struct fc_rport_identifiers *rid) | |||
341 | rid->port_name = ((u64)pg0->WWPN.High) << 32 | (u64)pg0->WWPN.Low; | 341 | rid->port_name = ((u64)pg0->WWPN.High) << 32 | (u64)pg0->WWPN.Low; |
342 | rid->port_id = pg0->PortIdentifier; | 342 | rid->port_id = pg0->PortIdentifier; |
343 | rid->roles = FC_RPORT_ROLE_UNKNOWN; | 343 | rid->roles = FC_RPORT_ROLE_UNKNOWN; |
344 | rid->roles |= FC_RPORT_ROLE_FCP_TARGET; | ||
345 | if (pg0->Protocol & MPI_FC_DEVICE_PAGE0_PROT_FCP_INITIATOR) | ||
346 | rid->roles |= FC_RPORT_ROLE_FCP_INITIATOR; | ||
347 | 344 | ||
348 | return 0; | 345 | return 0; |
349 | } | 346 | } |
@@ -355,15 +352,18 @@ mptfc_register_dev(MPT_ADAPTER *ioc, int channel, FCDevicePage0_t *pg0) | |||
355 | struct fc_rport *rport; | 352 | struct fc_rport *rport; |
356 | struct mptfc_rport_info *ri; | 353 | struct mptfc_rport_info *ri; |
357 | int new_ri = 1; | 354 | int new_ri = 1; |
358 | u64 pn; | 355 | u64 pn, nn; |
359 | unsigned long flags; | ||
360 | VirtTarget *vtarget; | 356 | VirtTarget *vtarget; |
357 | u32 roles = FC_RPORT_ROLE_UNKNOWN; | ||
361 | 358 | ||
362 | if (mptfc_generate_rport_ids(pg0, &rport_ids) < 0) | 359 | if (mptfc_generate_rport_ids(pg0, &rport_ids) < 0) |
363 | return; | 360 | return; |
364 | 361 | ||
362 | roles |= FC_RPORT_ROLE_FCP_TARGET; | ||
363 | if (pg0->Protocol & MPI_FC_DEVICE_PAGE0_PROT_FCP_INITIATOR) | ||
364 | roles |= FC_RPORT_ROLE_FCP_INITIATOR; | ||
365 | |||
365 | /* scan list looking for a match */ | 366 | /* scan list looking for a match */ |
366 | spin_lock_irqsave(&ioc->fc_rport_lock, flags); | ||
367 | list_for_each_entry(ri, &ioc->fc_rports, list) { | 367 | list_for_each_entry(ri, &ioc->fc_rports, list) { |
368 | pn = (u64)ri->pg0.WWPN.High << 32 | (u64)ri->pg0.WWPN.Low; | 368 | pn = (u64)ri->pg0.WWPN.High << 32 | (u64)ri->pg0.WWPN.Low; |
369 | if (pn == rport_ids.port_name) { /* match */ | 369 | if (pn == rport_ids.port_name) { /* match */ |
@@ -373,11 +373,9 @@ mptfc_register_dev(MPT_ADAPTER *ioc, int channel, FCDevicePage0_t *pg0) | |||
373 | } | 373 | } |
374 | } | 374 | } |
375 | if (new_ri) { /* allocate one */ | 375 | if (new_ri) { /* allocate one */ |
376 | spin_unlock_irqrestore(&ioc->fc_rport_lock, flags); | ||
377 | ri = kzalloc(sizeof(struct mptfc_rport_info), GFP_KERNEL); | 376 | ri = kzalloc(sizeof(struct mptfc_rport_info), GFP_KERNEL); |
378 | if (!ri) | 377 | if (!ri) |
379 | return; | 378 | return; |
380 | spin_lock_irqsave(&ioc->fc_rport_lock, flags); | ||
381 | list_add_tail(&ri->list, &ioc->fc_rports); | 379 | list_add_tail(&ri->list, &ioc->fc_rports); |
382 | } | 380 | } |
383 | 381 | ||
@@ -387,14 +385,11 @@ mptfc_register_dev(MPT_ADAPTER *ioc, int channel, FCDevicePage0_t *pg0) | |||
387 | /* MPT_RPORT_INFO_FLAGS_REGISTERED - rport not previously deleted */ | 385 | /* MPT_RPORT_INFO_FLAGS_REGISTERED - rport not previously deleted */ |
388 | if (!(ri->flags & MPT_RPORT_INFO_FLAGS_REGISTERED)) { | 386 | if (!(ri->flags & MPT_RPORT_INFO_FLAGS_REGISTERED)) { |
389 | ri->flags |= MPT_RPORT_INFO_FLAGS_REGISTERED; | 387 | ri->flags |= MPT_RPORT_INFO_FLAGS_REGISTERED; |
390 | spin_unlock_irqrestore(&ioc->fc_rport_lock, flags); | ||
391 | rport = fc_remote_port_add(ioc->sh, channel, &rport_ids); | 388 | rport = fc_remote_port_add(ioc->sh, channel, &rport_ids); |
392 | spin_lock_irqsave(&ioc->fc_rport_lock, flags); | ||
393 | if (rport) { | 389 | if (rport) { |
394 | ri->rport = rport; | 390 | ri->rport = rport; |
395 | if (new_ri) /* may have been reset by user */ | 391 | if (new_ri) /* may have been reset by user */ |
396 | rport->dev_loss_tmo = mptfc_dev_loss_tmo; | 392 | rport->dev_loss_tmo = mptfc_dev_loss_tmo; |
397 | *((struct mptfc_rport_info **)rport->dd_data) = ri; | ||
398 | /* | 393 | /* |
399 | * if already mapped, remap here. If not mapped, | 394 | * if already mapped, remap here. If not mapped, |
400 | * target_alloc will allocate vtarget and map, | 395 | * target_alloc will allocate vtarget and map, |
@@ -406,16 +401,21 @@ mptfc_register_dev(MPT_ADAPTER *ioc, int channel, FCDevicePage0_t *pg0) | |||
406 | vtarget->target_id = pg0->CurrentTargetID; | 401 | vtarget->target_id = pg0->CurrentTargetID; |
407 | vtarget->bus_id = pg0->CurrentBus; | 402 | vtarget->bus_id = pg0->CurrentBus; |
408 | } | 403 | } |
409 | ri->remap_needed = 0; | ||
410 | } | 404 | } |
405 | *((struct mptfc_rport_info **)rport->dd_data) = ri; | ||
406 | /* scan will be scheduled once rport becomes a target */ | ||
407 | fc_remote_port_rolechg(rport,roles); | ||
408 | |||
409 | pn = (u64)ri->pg0.WWPN.High << 32 | (u64)ri->pg0.WWPN.Low; | ||
410 | nn = (u64)ri->pg0.WWNN.High << 32 | (u64)ri->pg0.WWNN.Low; | ||
411 | dfcprintk ((MYIOC_s_INFO_FMT | 411 | dfcprintk ((MYIOC_s_INFO_FMT |
412 | "mptfc_reg_dev.%d: %x, %llx / %llx, tid %d, " | 412 | "mptfc_reg_dev.%d: %x, %llx / %llx, tid %d, " |
413 | "rport tid %d, tmo %d\n", | 413 | "rport tid %d, tmo %d\n", |
414 | ioc->name, | 414 | ioc->name, |
415 | ioc->sh->host_no, | 415 | ioc->sh->host_no, |
416 | pg0->PortIdentifier, | 416 | pg0->PortIdentifier, |
417 | pg0->WWNN, | 417 | (unsigned long long)nn, |
418 | pg0->WWPN, | 418 | (unsigned long long)pn, |
419 | pg0->CurrentTargetID, | 419 | pg0->CurrentTargetID, |
420 | ri->rport->scsi_target_id, | 420 | ri->rport->scsi_target_id, |
421 | ri->rport->dev_loss_tmo)); | 421 | ri->rport->dev_loss_tmo)); |
@@ -425,8 +425,6 @@ mptfc_register_dev(MPT_ADAPTER *ioc, int channel, FCDevicePage0_t *pg0) | |||
425 | ri = NULL; | 425 | ri = NULL; |
426 | } | 426 | } |
427 | } | 427 | } |
428 | spin_unlock_irqrestore(&ioc->fc_rport_lock,flags); | ||
429 | |||
430 | } | 428 | } |
431 | 429 | ||
432 | /* | 430 | /* |
@@ -476,7 +474,6 @@ mptfc_target_alloc(struct scsi_target *starget) | |||
476 | vtarget->target_id = ri->pg0.CurrentTargetID; | 474 | vtarget->target_id = ri->pg0.CurrentTargetID; |
477 | vtarget->bus_id = ri->pg0.CurrentBus; | 475 | vtarget->bus_id = ri->pg0.CurrentBus; |
478 | ri->starget = starget; | 476 | ri->starget = starget; |
479 | ri->remap_needed = 0; | ||
480 | rc = 0; | 477 | rc = 0; |
481 | } | 478 | } |
482 | } | 479 | } |
@@ -502,10 +499,10 @@ mptfc_slave_alloc(struct scsi_device *sdev) | |||
502 | VirtDevice *vdev; | 499 | VirtDevice *vdev; |
503 | struct scsi_target *starget; | 500 | struct scsi_target *starget; |
504 | struct fc_rport *rport; | 501 | struct fc_rport *rport; |
505 | unsigned long flags; | ||
506 | 502 | ||
507 | 503 | ||
508 | rport = starget_to_rport(scsi_target(sdev)); | 504 | starget = scsi_target(sdev); |
505 | rport = starget_to_rport(starget); | ||
509 | 506 | ||
510 | if (!rport || fc_remote_port_chkready(rport)) | 507 | if (!rport || fc_remote_port_chkready(rport)) |
511 | return -ENXIO; | 508 | return -ENXIO; |
@@ -519,10 +516,8 @@ mptfc_slave_alloc(struct scsi_device *sdev) | |||
519 | return -ENOMEM; | 516 | return -ENOMEM; |
520 | } | 517 | } |
521 | 518 | ||
522 | spin_lock_irqsave(&hd->ioc->fc_rport_lock,flags); | ||
523 | 519 | ||
524 | sdev->hostdata = vdev; | 520 | sdev->hostdata = vdev; |
525 | starget = scsi_target(sdev); | ||
526 | vtarget = starget->hostdata; | 521 | vtarget = starget->hostdata; |
527 | 522 | ||
528 | if (vtarget->num_luns == 0) { | 523 | if (vtarget->num_luns == 0) { |
@@ -535,14 +530,16 @@ mptfc_slave_alloc(struct scsi_device *sdev) | |||
535 | vdev->vtarget = vtarget; | 530 | vdev->vtarget = vtarget; |
536 | vdev->lun = sdev->lun; | 531 | vdev->lun = sdev->lun; |
537 | 532 | ||
538 | spin_unlock_irqrestore(&hd->ioc->fc_rport_lock,flags); | ||
539 | |||
540 | vtarget->num_luns++; | 533 | vtarget->num_luns++; |
541 | 534 | ||
535 | |||
542 | #ifdef DMPT_DEBUG_FC | 536 | #ifdef DMPT_DEBUG_FC |
543 | { | 537 | { |
538 | u64 nn, pn; | ||
544 | struct mptfc_rport_info *ri; | 539 | struct mptfc_rport_info *ri; |
545 | ri = *((struct mptfc_rport_info **)rport->dd_data); | 540 | ri = *((struct mptfc_rport_info **)rport->dd_data); |
541 | pn = (u64)ri->pg0.WWPN.High << 32 | (u64)ri->pg0.WWPN.Low; | ||
542 | nn = (u64)ri->pg0.WWNN.High << 32 | (u64)ri->pg0.WWNN.Low; | ||
546 | dfcprintk ((MYIOC_s_INFO_FMT | 543 | dfcprintk ((MYIOC_s_INFO_FMT |
547 | "mptfc_slv_alloc.%d: num_luns %d, sdev.id %d, " | 544 | "mptfc_slv_alloc.%d: num_luns %d, sdev.id %d, " |
548 | "CurrentTargetID %d, %x %llx %llx\n", | 545 | "CurrentTargetID %d, %x %llx %llx\n", |
@@ -550,7 +547,9 @@ mptfc_slave_alloc(struct scsi_device *sdev) | |||
550 | sdev->host->host_no, | 547 | sdev->host->host_no, |
551 | vtarget->num_luns, | 548 | vtarget->num_luns, |
552 | sdev->id, ri->pg0.CurrentTargetID, | 549 | sdev->id, ri->pg0.CurrentTargetID, |
553 | ri->pg0.PortIdentifier, ri->pg0.WWPN, ri->pg0.WWNN)); | 550 | ri->pg0.PortIdentifier, |
551 | (unsigned long long)pn, | ||
552 | (unsigned long long)nn)); | ||
554 | } | 553 | } |
555 | #endif | 554 | #endif |
556 | 555 | ||
@@ -570,11 +569,31 @@ mptfc_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) | |||
570 | done(SCpnt); | 569 | done(SCpnt); |
571 | return 0; | 570 | return 0; |
572 | } | 571 | } |
572 | |||
573 | /* dd_data is null until finished adding target */ | ||
573 | ri = *((struct mptfc_rport_info **)rport->dd_data); | 574 | ri = *((struct mptfc_rport_info **)rport->dd_data); |
574 | if (unlikely(ri->remap_needed)) | 575 | if (unlikely(!ri)) { |
575 | return SCSI_MLQUEUE_HOST_BUSY; | 576 | dfcprintk ((MYIOC_s_INFO_FMT |
577 | "mptfc_qcmd.%d: %d:%d, dd_data is null.\n", | ||
578 | ((MPT_SCSI_HOST *) SCpnt->device->host->hostdata)->ioc->name, | ||
579 | ((MPT_SCSI_HOST *) SCpnt->device->host->hostdata)->ioc->sh->host_no, | ||
580 | SCpnt->device->id,SCpnt->device->lun)); | ||
581 | SCpnt->result = DID_IMM_RETRY << 16; | ||
582 | done(SCpnt); | ||
583 | return 0; | ||
584 | } | ||
576 | 585 | ||
577 | return mptscsih_qcmd(SCpnt,done); | 586 | err = mptscsih_qcmd(SCpnt,done); |
587 | #ifdef DMPT_DEBUG_FC | ||
588 | if (unlikely(err)) { | ||
589 | dfcprintk ((MYIOC_s_INFO_FMT | ||
590 | "mptfc_qcmd.%d: %d:%d, mptscsih_qcmd returns non-zero.\n", | ||
591 | ((MPT_SCSI_HOST *) SCpnt->device->host->hostdata)->ioc->name, | ||
592 | ((MPT_SCSI_HOST *) SCpnt->device->host->hostdata)->ioc->sh->host_no, | ||
593 | SCpnt->device->id,SCpnt->device->lun)); | ||
594 | } | ||
595 | #endif | ||
596 | return err; | ||
578 | } | 597 | } |
579 | 598 | ||
580 | static void | 599 | static void |
@@ -615,18 +634,17 @@ mptfc_rescan_devices(void *arg) | |||
615 | MPT_ADAPTER *ioc = (MPT_ADAPTER *)arg; | 634 | MPT_ADAPTER *ioc = (MPT_ADAPTER *)arg; |
616 | int ii; | 635 | int ii; |
617 | int work_to_do; | 636 | int work_to_do; |
637 | u64 pn; | ||
618 | unsigned long flags; | 638 | unsigned long flags; |
619 | struct mptfc_rport_info *ri; | 639 | struct mptfc_rport_info *ri; |
620 | 640 | ||
621 | do { | 641 | do { |
622 | /* start by tagging all ports as missing */ | 642 | /* start by tagging all ports as missing */ |
623 | spin_lock_irqsave(&ioc->fc_rport_lock,flags); | ||
624 | list_for_each_entry(ri, &ioc->fc_rports, list) { | 643 | list_for_each_entry(ri, &ioc->fc_rports, list) { |
625 | if (ri->flags & MPT_RPORT_INFO_FLAGS_REGISTERED) { | 644 | if (ri->flags & MPT_RPORT_INFO_FLAGS_REGISTERED) { |
626 | ri->flags |= MPT_RPORT_INFO_FLAGS_MISSING; | 645 | ri->flags |= MPT_RPORT_INFO_FLAGS_MISSING; |
627 | } | 646 | } |
628 | } | 647 | } |
629 | spin_unlock_irqrestore(&ioc->fc_rport_lock,flags); | ||
630 | 648 | ||
631 | /* | 649 | /* |
632 | * now rescan devices known to adapter, | 650 | * now rescan devices known to adapter, |
@@ -639,33 +657,24 @@ mptfc_rescan_devices(void *arg) | |||
639 | } | 657 | } |
640 | 658 | ||
641 | /* delete devices still missing */ | 659 | /* delete devices still missing */ |
642 | spin_lock_irqsave(&ioc->fc_rport_lock, flags); | ||
643 | list_for_each_entry(ri, &ioc->fc_rports, list) { | 660 | list_for_each_entry(ri, &ioc->fc_rports, list) { |
644 | /* if newly missing, delete it */ | 661 | /* if newly missing, delete it */ |
645 | if ((ri->flags & (MPT_RPORT_INFO_FLAGS_REGISTERED | | 662 | if (ri->flags & MPT_RPORT_INFO_FLAGS_MISSING) { |
646 | MPT_RPORT_INFO_FLAGS_MISSING)) | ||
647 | == (MPT_RPORT_INFO_FLAGS_REGISTERED | | ||
648 | MPT_RPORT_INFO_FLAGS_MISSING)) { | ||
649 | 663 | ||
650 | ri->flags &= ~(MPT_RPORT_INFO_FLAGS_REGISTERED| | 664 | ri->flags &= ~(MPT_RPORT_INFO_FLAGS_REGISTERED| |
651 | MPT_RPORT_INFO_FLAGS_MISSING); | 665 | MPT_RPORT_INFO_FLAGS_MISSING); |
652 | ri->remap_needed = 1; | 666 | fc_remote_port_delete(ri->rport); /* won't sleep */ |
653 | fc_remote_port_delete(ri->rport); | ||
654 | /* | ||
655 | * remote port not really deleted 'cause | ||
656 | * binding is by WWPN and driver only | ||
657 | * registers FCP_TARGETs but cannot trust | ||
658 | * data structures. | ||
659 | */ | ||
660 | ri->rport = NULL; | 667 | ri->rport = NULL; |
668 | |||
669 | pn = (u64)ri->pg0.WWPN.High << 32 | | ||
670 | (u64)ri->pg0.WWPN.Low; | ||
661 | dfcprintk ((MYIOC_s_INFO_FMT | 671 | dfcprintk ((MYIOC_s_INFO_FMT |
662 | "mptfc_rescan.%d: %llx deleted\n", | 672 | "mptfc_rescan.%d: %llx deleted\n", |
663 | ioc->name, | 673 | ioc->name, |
664 | ioc->sh->host_no, | 674 | ioc->sh->host_no, |
665 | ri->pg0.WWPN)); | 675 | (unsigned long long)pn)); |
666 | } | 676 | } |
667 | } | 677 | } |
668 | spin_unlock_irqrestore(&ioc->fc_rport_lock,flags); | ||
669 | 678 | ||
670 | /* | 679 | /* |
671 | * allow multiple passes as target state | 680 | * allow multiple passes as target state |
@@ -870,10 +879,23 @@ mptfc_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
870 | goto out_mptfc_probe; | 879 | goto out_mptfc_probe; |
871 | } | 880 | } |
872 | 881 | ||
873 | for (ii=0; ii < ioc->facts.NumberOfPorts; ii++) { | 882 | /* initialize workqueue */ |
874 | mptfc_init_host_attr(ioc,ii); | 883 | |
875 | mptfc_GetFcDevPage0(ioc,ii,mptfc_register_dev); | 884 | snprintf(ioc->fc_rescan_work_q_name, KOBJ_NAME_LEN, "mptfc_wq_%d", |
876 | } | 885 | sh->host_no); |
886 | ioc->fc_rescan_work_q = | ||
887 | create_singlethread_workqueue(ioc->fc_rescan_work_q_name); | ||
888 | if (!ioc->fc_rescan_work_q) | ||
889 | goto out_mptfc_probe; | ||
890 | |||
891 | /* | ||
892 | * scan for rports - | ||
893 | * by doing it via the workqueue, some locking is eliminated | ||
894 | */ | ||
895 | |||
896 | ioc->fc_rescan_work_count = 1; | ||
897 | queue_work(ioc->fc_rescan_work_q, &ioc->fc_rescan_work); | ||
898 | flush_workqueue(ioc->fc_rescan_work_q); | ||
877 | 899 | ||
878 | return 0; | 900 | return 0; |
879 | 901 | ||
@@ -949,8 +971,18 @@ mptfc_init(void) | |||
949 | static void __devexit | 971 | static void __devexit |
950 | mptfc_remove(struct pci_dev *pdev) | 972 | mptfc_remove(struct pci_dev *pdev) |
951 | { | 973 | { |
952 | MPT_ADAPTER *ioc = pci_get_drvdata(pdev); | 974 | MPT_ADAPTER *ioc = pci_get_drvdata(pdev); |
953 | struct mptfc_rport_info *p, *n; | 975 | struct mptfc_rport_info *p, *n; |
976 | struct workqueue_struct *work_q; | ||
977 | unsigned long flags; | ||
978 | |||
979 | /* destroy workqueue */ | ||
980 | if ((work_q=ioc->fc_rescan_work_q)) { | ||
981 | spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags); | ||
982 | ioc->fc_rescan_work_q = NULL; | ||
983 | spin_unlock_irqrestore(&ioc->fc_rescan_work_lock, flags); | ||
984 | destroy_workqueue(work_q); | ||
985 | } | ||
954 | 986 | ||
955 | fc_remove_host(ioc->sh); | 987 | fc_remove_host(ioc->sh); |
956 | 988 | ||
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c index e9716b10acea..af6ec553ff7c 100644 --- a/drivers/message/fusion/mptsas.c +++ b/drivers/message/fusion/mptsas.c | |||
@@ -91,6 +91,7 @@ enum mptsas_hotplug_action { | |||
91 | MPTSAS_DEL_DEVICE, | 91 | MPTSAS_DEL_DEVICE, |
92 | MPTSAS_ADD_RAID, | 92 | MPTSAS_ADD_RAID, |
93 | MPTSAS_DEL_RAID, | 93 | MPTSAS_DEL_RAID, |
94 | MPTSAS_IGNORE_EVENT, | ||
94 | }; | 95 | }; |
95 | 96 | ||
96 | struct mptsas_hotplug_event { | 97 | struct mptsas_hotplug_event { |
@@ -298,6 +299,26 @@ mptsas_find_portinfo_by_handle(MPT_ADAPTER *ioc, u16 handle) | |||
298 | return rc; | 299 | return rc; |
299 | } | 300 | } |
300 | 301 | ||
302 | /* | ||
303 | * Returns true if there is a scsi end device | ||
304 | */ | ||
305 | static inline int | ||
306 | mptsas_is_end_device(struct mptsas_devinfo * attached) | ||
307 | { | ||
308 | if ((attached->handle) && | ||
309 | (attached->device_info & | ||
310 | MPI_SAS_DEVICE_INFO_END_DEVICE) && | ||
311 | ((attached->device_info & | ||
312 | MPI_SAS_DEVICE_INFO_SSP_TARGET) | | ||
313 | (attached->device_info & | ||
314 | MPI_SAS_DEVICE_INFO_STP_TARGET) | | ||
315 | (attached->device_info & | ||
316 | MPI_SAS_DEVICE_INFO_SATA_DEVICE))) | ||
317 | return 1; | ||
318 | else | ||
319 | return 0; | ||
320 | } | ||
321 | |||
301 | static int | 322 | static int |
302 | mptsas_sas_enclosure_pg0(MPT_ADAPTER *ioc, struct mptsas_enclosure *enclosure, | 323 | mptsas_sas_enclosure_pg0(MPT_ADAPTER *ioc, struct mptsas_enclosure *enclosure, |
303 | u32 form, u32 form_specific) | 324 | u32 form, u32 form_specific) |
@@ -872,7 +893,11 @@ mptsas_sas_device_pg0(MPT_ADAPTER *ioc, struct mptsas_devinfo *device_info, | |||
872 | SasDevicePage0_t *buffer; | 893 | SasDevicePage0_t *buffer; |
873 | dma_addr_t dma_handle; | 894 | dma_addr_t dma_handle; |
874 | __le64 sas_address; | 895 | __le64 sas_address; |
875 | int error; | 896 | int error=0; |
897 | |||
898 | if (ioc->sas_discovery_runtime && | ||
899 | mptsas_is_end_device(device_info)) | ||
900 | goto out; | ||
876 | 901 | ||
877 | hdr.PageVersion = MPI_SASDEVICE0_PAGEVERSION; | 902 | hdr.PageVersion = MPI_SASDEVICE0_PAGEVERSION; |
878 | hdr.ExtPageLength = 0; | 903 | hdr.ExtPageLength = 0; |
@@ -1009,7 +1034,11 @@ mptsas_sas_expander_pg1(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info, | |||
1009 | CONFIGPARMS cfg; | 1034 | CONFIGPARMS cfg; |
1010 | SasExpanderPage1_t *buffer; | 1035 | SasExpanderPage1_t *buffer; |
1011 | dma_addr_t dma_handle; | 1036 | dma_addr_t dma_handle; |
1012 | int error; | 1037 | int error=0; |
1038 | |||
1039 | if (ioc->sas_discovery_runtime && | ||
1040 | mptsas_is_end_device(&phy_info->attached)) | ||
1041 | goto out; | ||
1013 | 1042 | ||
1014 | hdr.PageVersion = MPI_SASEXPANDER0_PAGEVERSION; | 1043 | hdr.PageVersion = MPI_SASEXPANDER0_PAGEVERSION; |
1015 | hdr.ExtPageLength = 0; | 1044 | hdr.ExtPageLength = 0; |
@@ -1068,26 +1097,6 @@ mptsas_sas_expander_pg1(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info, | |||
1068 | return error; | 1097 | return error; |
1069 | } | 1098 | } |
1070 | 1099 | ||
1071 | /* | ||
1072 | * Returns true if there is a scsi end device | ||
1073 | */ | ||
1074 | static inline int | ||
1075 | mptsas_is_end_device(struct mptsas_devinfo * attached) | ||
1076 | { | ||
1077 | if ((attached->handle) && | ||
1078 | (attached->device_info & | ||
1079 | MPI_SAS_DEVICE_INFO_END_DEVICE) && | ||
1080 | ((attached->device_info & | ||
1081 | MPI_SAS_DEVICE_INFO_SSP_TARGET) | | ||
1082 | (attached->device_info & | ||
1083 | MPI_SAS_DEVICE_INFO_STP_TARGET) | | ||
1084 | (attached->device_info & | ||
1085 | MPI_SAS_DEVICE_INFO_SATA_DEVICE))) | ||
1086 | return 1; | ||
1087 | else | ||
1088 | return 0; | ||
1089 | } | ||
1090 | |||
1091 | static void | 1100 | static void |
1092 | mptsas_parse_device_info(struct sas_identify *identify, | 1101 | mptsas_parse_device_info(struct sas_identify *identify, |
1093 | struct mptsas_devinfo *device_info) | 1102 | struct mptsas_devinfo *device_info) |
@@ -1737,6 +1746,9 @@ mptsas_hotplug_work(void *arg) | |||
1737 | break; | 1746 | break; |
1738 | case MPTSAS_ADD_DEVICE: | 1747 | case MPTSAS_ADD_DEVICE: |
1739 | 1748 | ||
1749 | if (ev->phys_disk_num_valid) | ||
1750 | mpt_findImVolumes(ioc); | ||
1751 | |||
1740 | /* | 1752 | /* |
1741 | * Refresh sas device pg0 data | 1753 | * Refresh sas device pg0 data |
1742 | */ | 1754 | */ |
@@ -1868,6 +1880,9 @@ mptsas_hotplug_work(void *arg) | |||
1868 | scsi_device_put(sdev); | 1880 | scsi_device_put(sdev); |
1869 | mpt_findImVolumes(ioc); | 1881 | mpt_findImVolumes(ioc); |
1870 | break; | 1882 | break; |
1883 | case MPTSAS_IGNORE_EVENT: | ||
1884 | default: | ||
1885 | break; | ||
1871 | } | 1886 | } |
1872 | 1887 | ||
1873 | kfree(ev); | 1888 | kfree(ev); |
@@ -1940,7 +1955,8 @@ mptscsih_send_raid_event(MPT_ADAPTER *ioc, | |||
1940 | EVENT_DATA_RAID *raid_event_data) | 1955 | EVENT_DATA_RAID *raid_event_data) |
1941 | { | 1956 | { |
1942 | struct mptsas_hotplug_event *ev; | 1957 | struct mptsas_hotplug_event *ev; |
1943 | RAID_VOL0_STATUS * volumeStatus; | 1958 | int status = le32_to_cpu(raid_event_data->SettingsStatus); |
1959 | int state = (status >> 8) & 0xff; | ||
1944 | 1960 | ||
1945 | if (ioc->bus_type != SAS) | 1961 | if (ioc->bus_type != SAS) |
1946 | return; | 1962 | return; |
@@ -1955,6 +1971,7 @@ mptscsih_send_raid_event(MPT_ADAPTER *ioc, | |||
1955 | INIT_WORK(&ev->work, mptsas_hotplug_work, ev); | 1971 | INIT_WORK(&ev->work, mptsas_hotplug_work, ev); |
1956 | ev->ioc = ioc; | 1972 | ev->ioc = ioc; |
1957 | ev->id = raid_event_data->VolumeID; | 1973 | ev->id = raid_event_data->VolumeID; |
1974 | ev->event_type = MPTSAS_IGNORE_EVENT; | ||
1958 | 1975 | ||
1959 | switch (raid_event_data->ReasonCode) { | 1976 | switch (raid_event_data->ReasonCode) { |
1960 | case MPI_EVENT_RAID_RC_PHYSDISK_DELETED: | 1977 | case MPI_EVENT_RAID_RC_PHYSDISK_DELETED: |
@@ -1966,6 +1983,25 @@ mptscsih_send_raid_event(MPT_ADAPTER *ioc, | |||
1966 | ev->phys_disk_num = raid_event_data->PhysDiskNum; | 1983 | ev->phys_disk_num = raid_event_data->PhysDiskNum; |
1967 | ev->event_type = MPTSAS_DEL_DEVICE; | 1984 | ev->event_type = MPTSAS_DEL_DEVICE; |
1968 | break; | 1985 | break; |
1986 | case MPI_EVENT_RAID_RC_PHYSDISK_STATUS_CHANGED: | ||
1987 | switch (state) { | ||
1988 | case MPI_PD_STATE_ONLINE: | ||
1989 | ioc->raid_data.isRaid = 1; | ||
1990 | ev->phys_disk_num_valid = 1; | ||
1991 | ev->phys_disk_num = raid_event_data->PhysDiskNum; | ||
1992 | ev->event_type = MPTSAS_ADD_DEVICE; | ||
1993 | break; | ||
1994 | case MPI_PD_STATE_MISSING: | ||
1995 | case MPI_PD_STATE_NOT_COMPATIBLE: | ||
1996 | case MPI_PD_STATE_OFFLINE_AT_HOST_REQUEST: | ||
1997 | case MPI_PD_STATE_FAILED_AT_HOST_REQUEST: | ||
1998 | case MPI_PD_STATE_OFFLINE_FOR_ANOTHER_REASON: | ||
1999 | ev->event_type = MPTSAS_DEL_DEVICE; | ||
2000 | break; | ||
2001 | default: | ||
2002 | break; | ||
2003 | } | ||
2004 | break; | ||
1969 | case MPI_EVENT_RAID_RC_VOLUME_DELETED: | 2005 | case MPI_EVENT_RAID_RC_VOLUME_DELETED: |
1970 | ev->event_type = MPTSAS_DEL_RAID; | 2006 | ev->event_type = MPTSAS_DEL_RAID; |
1971 | break; | 2007 | break; |
@@ -1973,11 +2009,18 @@ mptscsih_send_raid_event(MPT_ADAPTER *ioc, | |||
1973 | ev->event_type = MPTSAS_ADD_RAID; | 2009 | ev->event_type = MPTSAS_ADD_RAID; |
1974 | break; | 2010 | break; |
1975 | case MPI_EVENT_RAID_RC_VOLUME_STATUS_CHANGED: | 2011 | case MPI_EVENT_RAID_RC_VOLUME_STATUS_CHANGED: |
1976 | volumeStatus = (RAID_VOL0_STATUS *) & | 2012 | switch (state) { |
1977 | raid_event_data->SettingsStatus; | 2013 | case MPI_RAIDVOL0_STATUS_STATE_FAILED: |
1978 | ev->event_type = (volumeStatus->State == | 2014 | case MPI_RAIDVOL0_STATUS_STATE_MISSING: |
1979 | MPI_RAIDVOL0_STATUS_STATE_FAILED) ? | 2015 | ev->event_type = MPTSAS_DEL_RAID; |
1980 | MPTSAS_DEL_RAID : MPTSAS_ADD_RAID; | 2016 | break; |
2017 | case MPI_RAIDVOL0_STATUS_STATE_OPTIMAL: | ||
2018 | case MPI_RAIDVOL0_STATUS_STATE_DEGRADED: | ||
2019 | ev->event_type = MPTSAS_ADD_RAID; | ||
2020 | break; | ||
2021 | default: | ||
2022 | break; | ||
2023 | } | ||
1981 | break; | 2024 | break; |
1982 | default: | 2025 | default: |
1983 | break; | 2026 | break; |
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c index 3729062db317..84fa271eb8f4 100644 --- a/drivers/message/fusion/mptscsih.c +++ b/drivers/message/fusion/mptscsih.c | |||
@@ -632,7 +632,11 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr) | |||
632 | 632 | ||
633 | case MPI_IOCSTATUS_SCSI_DEVICE_NOT_THERE: /* 0x0043 */ | 633 | case MPI_IOCSTATUS_SCSI_DEVICE_NOT_THERE: /* 0x0043 */ |
634 | /* Spoof to SCSI Selection Timeout! */ | 634 | /* Spoof to SCSI Selection Timeout! */ |
635 | sc->result = DID_NO_CONNECT << 16; | 635 | if (ioc->bus_type != FC) |
636 | sc->result = DID_NO_CONNECT << 16; | ||
637 | /* else fibre, just stall until rescan event */ | ||
638 | else | ||
639 | sc->result = DID_REQUEUE << 16; | ||
636 | 640 | ||
637 | if (hd->sel_timeout[pScsiReq->TargetID] < 0xFFFF) | 641 | if (hd->sel_timeout[pScsiReq->TargetID] < 0xFFFF) |
638 | hd->sel_timeout[pScsiReq->TargetID]++; | 642 | hd->sel_timeout[pScsiReq->TargetID]++; |
@@ -877,7 +881,7 @@ mptscsih_search_running_cmds(MPT_SCSI_HOST *hd, VirtDevice *vdevice) | |||
877 | struct scsi_cmnd *sc; | 881 | struct scsi_cmnd *sc; |
878 | 882 | ||
879 | dsprintk((KERN_INFO MYNAM ": search_running target %d lun %d max %d\n", | 883 | dsprintk((KERN_INFO MYNAM ": search_running target %d lun %d max %d\n", |
880 | vdevice->target_id, vdevice->lun, max)); | 884 | vdevice->vtarget->target_id, vdevice->lun, max)); |
881 | 885 | ||
882 | for (ii=0; ii < max; ii++) { | 886 | for (ii=0; ii < max; ii++) { |
883 | if ((sc = hd->ScsiLookup[ii]) != NULL) { | 887 | if ((sc = hd->ScsiLookup[ii]) != NULL) { |
@@ -1645,7 +1649,6 @@ int | |||
1645 | mptscsih_abort(struct scsi_cmnd * SCpnt) | 1649 | mptscsih_abort(struct scsi_cmnd * SCpnt) |
1646 | { | 1650 | { |
1647 | MPT_SCSI_HOST *hd; | 1651 | MPT_SCSI_HOST *hd; |
1648 | MPT_ADAPTER *ioc; | ||
1649 | MPT_FRAME_HDR *mf; | 1652 | MPT_FRAME_HDR *mf; |
1650 | u32 ctx2abort; | 1653 | u32 ctx2abort; |
1651 | int scpnt_idx; | 1654 | int scpnt_idx; |
@@ -1663,14 +1666,6 @@ mptscsih_abort(struct scsi_cmnd * SCpnt) | |||
1663 | return FAILED; | 1666 | return FAILED; |
1664 | } | 1667 | } |
1665 | 1668 | ||
1666 | ioc = hd->ioc; | ||
1667 | if (hd->resetPending) { | ||
1668 | return FAILED; | ||
1669 | } | ||
1670 | |||
1671 | if (hd->timeouts < -1) | ||
1672 | hd->timeouts++; | ||
1673 | |||
1674 | /* Find this command | 1669 | /* Find this command |
1675 | */ | 1670 | */ |
1676 | if ((scpnt_idx = SCPNT_TO_LOOKUP_IDX(SCpnt)) < 0) { | 1671 | if ((scpnt_idx = SCPNT_TO_LOOKUP_IDX(SCpnt)) < 0) { |
@@ -1684,6 +1679,13 @@ mptscsih_abort(struct scsi_cmnd * SCpnt) | |||
1684 | return SUCCESS; | 1679 | return SUCCESS; |
1685 | } | 1680 | } |
1686 | 1681 | ||
1682 | if (hd->resetPending) { | ||
1683 | return FAILED; | ||
1684 | } | ||
1685 | |||
1686 | if (hd->timeouts < -1) | ||
1687 | hd->timeouts++; | ||
1688 | |||
1687 | printk(KERN_WARNING MYNAM ": %s: attempting task abort! (sc=%p)\n", | 1689 | printk(KERN_WARNING MYNAM ": %s: attempting task abort! (sc=%p)\n", |
1688 | hd->ioc->name, SCpnt); | 1690 | hd->ioc->name, SCpnt); |
1689 | scsi_print_command(SCpnt); | 1691 | scsi_print_command(SCpnt); |
@@ -1703,7 +1705,7 @@ mptscsih_abort(struct scsi_cmnd * SCpnt) | |||
1703 | vdev = SCpnt->device->hostdata; | 1705 | vdev = SCpnt->device->hostdata; |
1704 | retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK, | 1706 | retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK, |
1705 | vdev->vtarget->bus_id, vdev->vtarget->target_id, vdev->lun, | 1707 | vdev->vtarget->bus_id, vdev->vtarget->target_id, vdev->lun, |
1706 | ctx2abort, mptscsih_get_tm_timeout(ioc)); | 1708 | ctx2abort, mptscsih_get_tm_timeout(hd->ioc)); |
1707 | 1709 | ||
1708 | printk (KERN_WARNING MYNAM ": %s: task abort: %s (sc=%p)\n", | 1710 | printk (KERN_WARNING MYNAM ": %s: task abort: %s (sc=%p)\n", |
1709 | hd->ioc->name, | 1711 | hd->ioc->name, |
@@ -2521,15 +2523,15 @@ mptscsih_ioc_reset(MPT_ADAPTER *ioc, int reset_phase) | |||
2521 | 2523 | ||
2522 | /* 7. FC: Rescan for blocked rports which might have returned. | 2524 | /* 7. FC: Rescan for blocked rports which might have returned. |
2523 | */ | 2525 | */ |
2524 | else if (ioc->bus_type == FC) { | 2526 | if (ioc->bus_type == FC) { |
2525 | int work_count; | ||
2526 | unsigned long flags; | ||
2527 | |||
2528 | spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags); | 2527 | spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags); |
2529 | work_count = ++ioc->fc_rescan_work_count; | 2528 | if (ioc->fc_rescan_work_q) { |
2529 | if (ioc->fc_rescan_work_count++ == 0) { | ||
2530 | queue_work(ioc->fc_rescan_work_q, | ||
2531 | &ioc->fc_rescan_work); | ||
2532 | } | ||
2533 | } | ||
2530 | spin_unlock_irqrestore(&ioc->fc_rescan_work_lock, flags); | 2534 | spin_unlock_irqrestore(&ioc->fc_rescan_work_lock, flags); |
2531 | if (work_count == 1) | ||
2532 | schedule_work(&ioc->fc_rescan_work); | ||
2533 | } | 2535 | } |
2534 | dtmprintk((MYIOC_s_WARN_FMT "Post-Reset complete.\n", ioc->name)); | 2536 | dtmprintk((MYIOC_s_WARN_FMT "Post-Reset complete.\n", ioc->name)); |
2535 | 2537 | ||
@@ -2544,7 +2546,6 @@ mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply) | |||
2544 | { | 2546 | { |
2545 | MPT_SCSI_HOST *hd; | 2547 | MPT_SCSI_HOST *hd; |
2546 | u8 event = le32_to_cpu(pEvReply->Event) & 0xFF; | 2548 | u8 event = le32_to_cpu(pEvReply->Event) & 0xFF; |
2547 | int work_count; | ||
2548 | unsigned long flags; | 2549 | unsigned long flags; |
2549 | 2550 | ||
2550 | devtverboseprintk((MYIOC_s_INFO_FMT "MPT event (=%02Xh) routed to SCSI host driver!\n", | 2551 | devtverboseprintk((MYIOC_s_INFO_FMT "MPT event (=%02Xh) routed to SCSI host driver!\n", |
@@ -2569,10 +2570,13 @@ mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply) | |||
2569 | 2570 | ||
2570 | case MPI_EVENT_RESCAN: /* 06 */ | 2571 | case MPI_EVENT_RESCAN: /* 06 */ |
2571 | spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags); | 2572 | spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags); |
2572 | work_count = ++ioc->fc_rescan_work_count; | 2573 | if (ioc->fc_rescan_work_q) { |
2574 | if (ioc->fc_rescan_work_count++ == 0) { | ||
2575 | queue_work(ioc->fc_rescan_work_q, | ||
2576 | &ioc->fc_rescan_work); | ||
2577 | } | ||
2578 | } | ||
2573 | spin_unlock_irqrestore(&ioc->fc_rescan_work_lock, flags); | 2579 | spin_unlock_irqrestore(&ioc->fc_rescan_work_lock, flags); |
2574 | if (work_count == 1) | ||
2575 | schedule_work(&ioc->fc_rescan_work); | ||
2576 | break; | 2580 | break; |
2577 | 2581 | ||
2578 | /* | 2582 | /* |
diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c index 09c745b19cc8..f2a4d382ea19 100644 --- a/drivers/message/fusion/mptspi.c +++ b/drivers/message/fusion/mptspi.c | |||
@@ -783,6 +783,70 @@ static struct pci_device_id mptspi_pci_table[] = { | |||
783 | }; | 783 | }; |
784 | MODULE_DEVICE_TABLE(pci, mptspi_pci_table); | 784 | MODULE_DEVICE_TABLE(pci, mptspi_pci_table); |
785 | 785 | ||
786 | |||
787 | /* | ||
788 | * renegotiate for a given target | ||
789 | */ | ||
790 | static void | ||
791 | mptspi_dv_renegotiate_work(void *data) | ||
792 | { | ||
793 | struct work_queue_wrapper *wqw = (struct work_queue_wrapper *)data; | ||
794 | struct _MPT_SCSI_HOST *hd = wqw->hd; | ||
795 | struct scsi_device *sdev; | ||
796 | |||
797 | kfree(wqw); | ||
798 | |||
799 | shost_for_each_device(sdev, hd->ioc->sh) | ||
800 | mptspi_dv_device(hd, sdev); | ||
801 | } | ||
802 | |||
803 | static void | ||
804 | mptspi_dv_renegotiate(struct _MPT_SCSI_HOST *hd) | ||
805 | { | ||
806 | struct work_queue_wrapper *wqw = kmalloc(sizeof(*wqw), GFP_ATOMIC); | ||
807 | |||
808 | if (!wqw) | ||
809 | return; | ||
810 | |||
811 | INIT_WORK(&wqw->work, mptspi_dv_renegotiate_work, wqw); | ||
812 | wqw->hd = hd; | ||
813 | |||
814 | schedule_work(&wqw->work); | ||
815 | } | ||
816 | |||
817 | /* | ||
818 | * spi module reset handler | ||
819 | */ | ||
820 | static int | ||
821 | mptspi_ioc_reset(MPT_ADAPTER *ioc, int reset_phase) | ||
822 | { | ||
823 | struct _MPT_SCSI_HOST *hd = (struct _MPT_SCSI_HOST *)ioc->sh->hostdata; | ||
824 | int rc; | ||
825 | |||
826 | rc = mptscsih_ioc_reset(ioc, reset_phase); | ||
827 | |||
828 | if (reset_phase == MPT_IOC_POST_RESET) | ||
829 | mptspi_dv_renegotiate(hd); | ||
830 | |||
831 | return rc; | ||
832 | } | ||
833 | |||
834 | /* | ||
835 | * spi module resume handler | ||
836 | */ | ||
837 | static int | ||
838 | mptspi_resume(struct pci_dev *pdev) | ||
839 | { | ||
840 | MPT_ADAPTER *ioc = pci_get_drvdata(pdev); | ||
841 | struct _MPT_SCSI_HOST *hd = (struct _MPT_SCSI_HOST *)ioc->sh->hostdata; | ||
842 | int rc; | ||
843 | |||
844 | rc = mptscsih_resume(pdev); | ||
845 | mptspi_dv_renegotiate(hd); | ||
846 | |||
847 | return rc; | ||
848 | } | ||
849 | |||
786 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 850 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
787 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 851 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
788 | /* | 852 | /* |
@@ -1032,7 +1096,7 @@ static struct pci_driver mptspi_driver = { | |||
1032 | .shutdown = mptscsih_shutdown, | 1096 | .shutdown = mptscsih_shutdown, |
1033 | #ifdef CONFIG_PM | 1097 | #ifdef CONFIG_PM |
1034 | .suspend = mptscsih_suspend, | 1098 | .suspend = mptscsih_suspend, |
1035 | .resume = mptscsih_resume, | 1099 | .resume = mptspi_resume, |
1036 | #endif | 1100 | #endif |
1037 | }; | 1101 | }; |
1038 | 1102 | ||
@@ -1061,7 +1125,7 @@ mptspi_init(void) | |||
1061 | ": Registered for IOC event notifications\n")); | 1125 | ": Registered for IOC event notifications\n")); |
1062 | } | 1126 | } |
1063 | 1127 | ||
1064 | if (mpt_reset_register(mptspiDoneCtx, mptscsih_ioc_reset) == 0) { | 1128 | if (mpt_reset_register(mptspiDoneCtx, mptspi_ioc_reset) == 0) { |
1065 | dprintk((KERN_INFO MYNAM | 1129 | dprintk((KERN_INFO MYNAM |
1066 | ": Registered for IOC reset notifications\n")); | 1130 | ": Registered for IOC reset notifications\n")); |
1067 | } | 1131 | } |
diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c index 1f3627470c95..1ddefd281213 100644 --- a/drivers/net/dl2k.c +++ b/drivers/net/dl2k.c | |||
@@ -765,7 +765,7 @@ rio_free_tx (struct net_device *dev, int irq) | |||
765 | break; | 765 | break; |
766 | skb = np->tx_skbuff[entry]; | 766 | skb = np->tx_skbuff[entry]; |
767 | pci_unmap_single (np->pdev, | 767 | pci_unmap_single (np->pdev, |
768 | np->tx_ring[entry].fraginfo & 0xffffffffffff, | 768 | np->tx_ring[entry].fraginfo & DMA_48BIT_MASK, |
769 | skb->len, PCI_DMA_TODEVICE); | 769 | skb->len, PCI_DMA_TODEVICE); |
770 | if (irq) | 770 | if (irq) |
771 | dev_kfree_skb_irq (skb); | 771 | dev_kfree_skb_irq (skb); |
@@ -893,7 +893,7 @@ receive_packet (struct net_device *dev) | |||
893 | /* Small skbuffs for short packets */ | 893 | /* Small skbuffs for short packets */ |
894 | if (pkt_len > copy_thresh) { | 894 | if (pkt_len > copy_thresh) { |
895 | pci_unmap_single (np->pdev, | 895 | pci_unmap_single (np->pdev, |
896 | desc->fraginfo & 0xffffffffffff, | 896 | desc->fraginfo & DMA_48BIT_MASK, |
897 | np->rx_buf_sz, | 897 | np->rx_buf_sz, |
898 | PCI_DMA_FROMDEVICE); | 898 | PCI_DMA_FROMDEVICE); |
899 | skb_put (skb = np->rx_skbuff[entry], pkt_len); | 899 | skb_put (skb = np->rx_skbuff[entry], pkt_len); |
@@ -901,7 +901,7 @@ receive_packet (struct net_device *dev) | |||
901 | } else if ((skb = dev_alloc_skb (pkt_len + 2)) != NULL) { | 901 | } else if ((skb = dev_alloc_skb (pkt_len + 2)) != NULL) { |
902 | pci_dma_sync_single_for_cpu(np->pdev, | 902 | pci_dma_sync_single_for_cpu(np->pdev, |
903 | desc->fraginfo & | 903 | desc->fraginfo & |
904 | 0xffffffffffff, | 904 | DMA_48BIT_MASK, |
905 | np->rx_buf_sz, | 905 | np->rx_buf_sz, |
906 | PCI_DMA_FROMDEVICE); | 906 | PCI_DMA_FROMDEVICE); |
907 | skb->dev = dev; | 907 | skb->dev = dev; |
@@ -913,7 +913,7 @@ receive_packet (struct net_device *dev) | |||
913 | skb_put (skb, pkt_len); | 913 | skb_put (skb, pkt_len); |
914 | pci_dma_sync_single_for_device(np->pdev, | 914 | pci_dma_sync_single_for_device(np->pdev, |
915 | desc->fraginfo & | 915 | desc->fraginfo & |
916 | 0xffffffffffff, | 916 | DMA_48BIT_MASK, |
917 | np->rx_buf_sz, | 917 | np->rx_buf_sz, |
918 | PCI_DMA_FROMDEVICE); | 918 | PCI_DMA_FROMDEVICE); |
919 | } | 919 | } |
@@ -1800,7 +1800,7 @@ rio_close (struct net_device *dev) | |||
1800 | skb = np->rx_skbuff[i]; | 1800 | skb = np->rx_skbuff[i]; |
1801 | if (skb) { | 1801 | if (skb) { |
1802 | pci_unmap_single(np->pdev, | 1802 | pci_unmap_single(np->pdev, |
1803 | np->rx_ring[i].fraginfo & 0xffffffffffff, | 1803 | np->rx_ring[i].fraginfo & DMA_48BIT_MASK, |
1804 | skb->len, PCI_DMA_FROMDEVICE); | 1804 | skb->len, PCI_DMA_FROMDEVICE); |
1805 | dev_kfree_skb (skb); | 1805 | dev_kfree_skb (skb); |
1806 | np->rx_skbuff[i] = NULL; | 1806 | np->rx_skbuff[i] = NULL; |
@@ -1810,7 +1810,7 @@ rio_close (struct net_device *dev) | |||
1810 | skb = np->tx_skbuff[i]; | 1810 | skb = np->tx_skbuff[i]; |
1811 | if (skb) { | 1811 | if (skb) { |
1812 | pci_unmap_single(np->pdev, | 1812 | pci_unmap_single(np->pdev, |
1813 | np->tx_ring[i].fraginfo & 0xffffffffffff, | 1813 | np->tx_ring[i].fraginfo & DMA_48BIT_MASK, |
1814 | skb->len, PCI_DMA_TODEVICE); | 1814 | skb->len, PCI_DMA_TODEVICE); |
1815 | dev_kfree_skb (skb); | 1815 | dev_kfree_skb (skb); |
1816 | np->tx_skbuff[i] = NULL; | 1816 | np->tx_skbuff[i] = NULL; |
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 459443b572ce..1b236bdf6b92 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c | |||
@@ -60,8 +60,10 @@ int mdiobus_register(struct mii_bus *bus) | |||
60 | for (i = 0; i < PHY_MAX_ADDR; i++) { | 60 | for (i = 0; i < PHY_MAX_ADDR; i++) { |
61 | struct phy_device *phydev; | 61 | struct phy_device *phydev; |
62 | 62 | ||
63 | if (bus->phy_mask & (1 << i)) | 63 | if (bus->phy_mask & (1 << i)) { |
64 | bus->phy_map[i] = NULL; | ||
64 | continue; | 65 | continue; |
66 | } | ||
65 | 67 | ||
66 | phydev = get_phy_device(bus, i); | 68 | phydev = get_phy_device(bus, i); |
67 | 69 | ||
diff --git a/drivers/net/sis900.c b/drivers/net/sis900.c index b82191d2bee1..f5a3bf4d959a 100644 --- a/drivers/net/sis900.c +++ b/drivers/net/sis900.c | |||
@@ -127,6 +127,7 @@ static const struct mii_chip_info { | |||
127 | } mii_chip_table[] = { | 127 | } mii_chip_table[] = { |
128 | { "SiS 900 Internal MII PHY", 0x001d, 0x8000, LAN }, | 128 | { "SiS 900 Internal MII PHY", 0x001d, 0x8000, LAN }, |
129 | { "SiS 7014 Physical Layer Solution", 0x0016, 0xf830, LAN }, | 129 | { "SiS 7014 Physical Layer Solution", 0x0016, 0xf830, LAN }, |
130 | { "SiS 900 on Foxconn 661 7MI", 0x0143, 0xBC70, LAN }, | ||
130 | { "Altimata AC101LF PHY", 0x0022, 0x5520, LAN }, | 131 | { "Altimata AC101LF PHY", 0x0022, 0x5520, LAN }, |
131 | { "ADM 7001 LAN PHY", 0x002e, 0xcc60, LAN }, | 132 | { "ADM 7001 LAN PHY", 0x002e, 0xcc60, LAN }, |
132 | { "AMD 79C901 10BASE-T PHY", 0x0000, 0x6B70, LAN }, | 133 | { "AMD 79C901 10BASE-T PHY", 0x0000, 0x6B70, LAN }, |
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 60cdfcabe1fd..ffd267fab21d 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -128,6 +128,7 @@ MODULE_DEVICE_TABLE(pci, sky2_id_table); | |||
128 | /* Avoid conditionals by using array */ | 128 | /* Avoid conditionals by using array */ |
129 | static const unsigned txqaddr[] = { Q_XA1, Q_XA2 }; | 129 | static const unsigned txqaddr[] = { Q_XA1, Q_XA2 }; |
130 | static const unsigned rxqaddr[] = { Q_R1, Q_R2 }; | 130 | static const unsigned rxqaddr[] = { Q_R1, Q_R2 }; |
131 | static const u32 portirq_msk[] = { Y2_IS_PORT_1, Y2_IS_PORT_2 }; | ||
131 | 132 | ||
132 | /* This driver supports yukon2 chipset only */ | 133 | /* This driver supports yukon2 chipset only */ |
133 | static const char *yukon2_name[] = { | 134 | static const char *yukon2_name[] = { |
@@ -1084,7 +1085,7 @@ static int sky2_up(struct net_device *dev) | |||
1084 | 1085 | ||
1085 | /* Enable interrupts from phy/mac for port */ | 1086 | /* Enable interrupts from phy/mac for port */ |
1086 | imask = sky2_read32(hw, B0_IMSK); | 1087 | imask = sky2_read32(hw, B0_IMSK); |
1087 | imask |= (port == 0) ? Y2_IS_PORT_1 : Y2_IS_PORT_2; | 1088 | imask |= portirq_msk[port]; |
1088 | sky2_write32(hw, B0_IMSK, imask); | 1089 | sky2_write32(hw, B0_IMSK, imask); |
1089 | 1090 | ||
1090 | return 0; | 1091 | return 0; |
@@ -1435,7 +1436,7 @@ static int sky2_down(struct net_device *dev) | |||
1435 | 1436 | ||
1436 | /* Disable port IRQ */ | 1437 | /* Disable port IRQ */ |
1437 | imask = sky2_read32(hw, B0_IMSK); | 1438 | imask = sky2_read32(hw, B0_IMSK); |
1438 | imask &= ~(sky2->port == 0) ? Y2_IS_PORT_1 : Y2_IS_PORT_2; | 1439 | imask &= ~portirq_msk[port]; |
1439 | sky2_write32(hw, B0_IMSK, imask); | 1440 | sky2_write32(hw, B0_IMSK, imask); |
1440 | 1441 | ||
1441 | /* turn off LED's */ | 1442 | /* turn off LED's */ |
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c index cb30d9c1153d..0c9c2f400bf6 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c | |||
@@ -219,6 +219,7 @@ ahc_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
219 | ahc->flags |= AHC_39BIT_ADDRESSING; | 219 | ahc->flags |= AHC_39BIT_ADDRESSING; |
220 | } else { | 220 | } else { |
221 | if (dma_set_mask(dev, DMA_32BIT_MASK)) { | 221 | if (dma_set_mask(dev, DMA_32BIT_MASK)) { |
222 | ahc_free(ahc); | ||
222 | printk(KERN_WARNING "aic7xxx: No suitable DMA available.\n"); | 223 | printk(KERN_WARNING "aic7xxx: No suitable DMA available.\n"); |
223 | return (-ENODEV); | 224 | return (-ENODEV); |
224 | } | 225 | } |
diff --git a/drivers/scsi/aic7xxx/aic7xxx_pci.c b/drivers/scsi/aic7xxx/aic7xxx_pci.c index 5f586140e057..3adecef21783 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_pci.c +++ b/drivers/scsi/aic7xxx/aic7xxx_pci.c | |||
@@ -2036,12 +2036,12 @@ ahc_pci_resume(struct ahc_softc *ahc) | |||
2036 | * that the OS doesn't know about and rely on our chip | 2036 | * that the OS doesn't know about and rely on our chip |
2037 | * reset handler to handle the rest. | 2037 | * reset handler to handle the rest. |
2038 | */ | 2038 | */ |
2039 | ahc_pci_write_config(ahc->dev_softc, DEVCONFIG, /*bytes*/4, | 2039 | ahc_pci_write_config(ahc->dev_softc, DEVCONFIG, |
2040 | ahc->bus_softc.pci_softc.devconfig); | 2040 | ahc->bus_softc.pci_softc.devconfig, /*bytes*/4); |
2041 | ahc_pci_write_config(ahc->dev_softc, PCIR_COMMAND, /*bytes*/1, | 2041 | ahc_pci_write_config(ahc->dev_softc, PCIR_COMMAND, |
2042 | ahc->bus_softc.pci_softc.command); | 2042 | ahc->bus_softc.pci_softc.command, /*bytes*/1); |
2043 | ahc_pci_write_config(ahc->dev_softc, CSIZE_LATTIME, /*bytes*/1, | 2043 | ahc_pci_write_config(ahc->dev_softc, CSIZE_LATTIME, |
2044 | ahc->bus_softc.pci_softc.csize_lattime); | 2044 | ahc->bus_softc.pci_softc.csize_lattime, /*bytes*/1); |
2045 | if ((ahc->flags & AHC_HAS_TERM_LOGIC) != 0) { | 2045 | if ((ahc->flags & AHC_HAS_TERM_LOGIC) != 0) { |
2046 | struct seeprom_descriptor sd; | 2046 | struct seeprom_descriptor sd; |
2047 | u_int sxfrctl1; | 2047 | u_int sxfrctl1; |
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c index 0a8ad37ae899..2e9be83a697f 100644 --- a/drivers/scsi/ibmvscsi/ibmvscsi.c +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c | |||
@@ -739,7 +739,8 @@ static void send_mad_adapter_info(struct ibmvscsi_host_data *hostdata) | |||
739 | { | 739 | { |
740 | struct viosrp_adapter_info *req; | 740 | struct viosrp_adapter_info *req; |
741 | struct srp_event_struct *evt_struct; | 741 | struct srp_event_struct *evt_struct; |
742 | 742 | dma_addr_t addr; | |
743 | |||
743 | evt_struct = get_event_struct(&hostdata->pool); | 744 | evt_struct = get_event_struct(&hostdata->pool); |
744 | if (!evt_struct) { | 745 | if (!evt_struct) { |
745 | printk(KERN_ERR "ibmvscsi: couldn't allocate an event " | 746 | printk(KERN_ERR "ibmvscsi: couldn't allocate an event " |
@@ -757,10 +758,10 @@ static void send_mad_adapter_info(struct ibmvscsi_host_data *hostdata) | |||
757 | 758 | ||
758 | req->common.type = VIOSRP_ADAPTER_INFO_TYPE; | 759 | req->common.type = VIOSRP_ADAPTER_INFO_TYPE; |
759 | req->common.length = sizeof(hostdata->madapter_info); | 760 | req->common.length = sizeof(hostdata->madapter_info); |
760 | req->buffer = dma_map_single(hostdata->dev, | 761 | req->buffer = addr = dma_map_single(hostdata->dev, |
761 | &hostdata->madapter_info, | 762 | &hostdata->madapter_info, |
762 | sizeof(hostdata->madapter_info), | 763 | sizeof(hostdata->madapter_info), |
763 | DMA_BIDIRECTIONAL); | 764 | DMA_BIDIRECTIONAL); |
764 | 765 | ||
765 | if (dma_mapping_error(req->buffer)) { | 766 | if (dma_mapping_error(req->buffer)) { |
766 | printk(KERN_ERR | 767 | printk(KERN_ERR |
@@ -770,8 +771,13 @@ static void send_mad_adapter_info(struct ibmvscsi_host_data *hostdata) | |||
770 | return; | 771 | return; |
771 | } | 772 | } |
772 | 773 | ||
773 | if (ibmvscsi_send_srp_event(evt_struct, hostdata)) | 774 | if (ibmvscsi_send_srp_event(evt_struct, hostdata)) { |
774 | printk(KERN_ERR "ibmvscsi: couldn't send ADAPTER_INFO_REQ!\n"); | 775 | printk(KERN_ERR "ibmvscsi: couldn't send ADAPTER_INFO_REQ!\n"); |
776 | dma_unmap_single(hostdata->dev, | ||
777 | addr, | ||
778 | sizeof(hostdata->madapter_info), | ||
779 | DMA_BIDIRECTIONAL); | ||
780 | } | ||
775 | }; | 781 | }; |
776 | 782 | ||
777 | /** | 783 | /** |
@@ -1259,6 +1265,7 @@ static int ibmvscsi_do_host_config(struct ibmvscsi_host_data *hostdata, | |||
1259 | { | 1265 | { |
1260 | struct viosrp_host_config *host_config; | 1266 | struct viosrp_host_config *host_config; |
1261 | struct srp_event_struct *evt_struct; | 1267 | struct srp_event_struct *evt_struct; |
1268 | dma_addr_t addr; | ||
1262 | int rc; | 1269 | int rc; |
1263 | 1270 | ||
1264 | evt_struct = get_event_struct(&hostdata->pool); | 1271 | evt_struct = get_event_struct(&hostdata->pool); |
@@ -1279,8 +1286,9 @@ static int ibmvscsi_do_host_config(struct ibmvscsi_host_data *hostdata, | |||
1279 | memset(host_config, 0x00, sizeof(*host_config)); | 1286 | memset(host_config, 0x00, sizeof(*host_config)); |
1280 | host_config->common.type = VIOSRP_HOST_CONFIG_TYPE; | 1287 | host_config->common.type = VIOSRP_HOST_CONFIG_TYPE; |
1281 | host_config->common.length = length; | 1288 | host_config->common.length = length; |
1282 | host_config->buffer = dma_map_single(hostdata->dev, buffer, length, | 1289 | host_config->buffer = addr = dma_map_single(hostdata->dev, buffer, |
1283 | DMA_BIDIRECTIONAL); | 1290 | length, |
1291 | DMA_BIDIRECTIONAL); | ||
1284 | 1292 | ||
1285 | if (dma_mapping_error(host_config->buffer)) { | 1293 | if (dma_mapping_error(host_config->buffer)) { |
1286 | printk(KERN_ERR | 1294 | printk(KERN_ERR |
@@ -1291,11 +1299,9 @@ static int ibmvscsi_do_host_config(struct ibmvscsi_host_data *hostdata, | |||
1291 | 1299 | ||
1292 | init_completion(&evt_struct->comp); | 1300 | init_completion(&evt_struct->comp); |
1293 | rc = ibmvscsi_send_srp_event(evt_struct, hostdata); | 1301 | rc = ibmvscsi_send_srp_event(evt_struct, hostdata); |
1294 | if (rc == 0) { | 1302 | if (rc == 0) |
1295 | wait_for_completion(&evt_struct->comp); | 1303 | wait_for_completion(&evt_struct->comp); |
1296 | dma_unmap_single(hostdata->dev, host_config->buffer, | 1304 | dma_unmap_single(hostdata->dev, addr, length, DMA_BIDIRECTIONAL); |
1297 | length, DMA_BIDIRECTIONAL); | ||
1298 | } | ||
1299 | 1305 | ||
1300 | return rc; | 1306 | return rc; |
1301 | } | 1307 | } |
diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h index fad607b2e6f4..ee22173fce43 100644 --- a/drivers/scsi/lpfc/lpfc_crtn.h +++ b/drivers/scsi/lpfc/lpfc_crtn.h | |||
@@ -27,7 +27,6 @@ void lpfc_config_link(struct lpfc_hba *, LPFC_MBOXQ_t *); | |||
27 | int lpfc_read_sparam(struct lpfc_hba *, LPFC_MBOXQ_t *); | 27 | int lpfc_read_sparam(struct lpfc_hba *, LPFC_MBOXQ_t *); |
28 | void lpfc_read_config(struct lpfc_hba *, LPFC_MBOXQ_t *); | 28 | void lpfc_read_config(struct lpfc_hba *, LPFC_MBOXQ_t *); |
29 | void lpfc_read_lnk_stat(struct lpfc_hba *, LPFC_MBOXQ_t *); | 29 | void lpfc_read_lnk_stat(struct lpfc_hba *, LPFC_MBOXQ_t *); |
30 | void lpfc_set_slim(struct lpfc_hba *, LPFC_MBOXQ_t *, uint32_t, uint32_t); | ||
31 | int lpfc_reg_login(struct lpfc_hba *, uint32_t, uint8_t *, LPFC_MBOXQ_t *, | 30 | int lpfc_reg_login(struct lpfc_hba *, uint32_t, uint8_t *, LPFC_MBOXQ_t *, |
32 | uint32_t); | 31 | uint32_t); |
33 | void lpfc_unreg_login(struct lpfc_hba *, uint32_t, LPFC_MBOXQ_t *); | 32 | void lpfc_unreg_login(struct lpfc_hba *, uint32_t, LPFC_MBOXQ_t *); |
diff --git a/drivers/scsi/lpfc/lpfc_disc.h b/drivers/scsi/lpfc/lpfc_disc.h index 8932b1be2b60..41cf5d3ea6ce 100644 --- a/drivers/scsi/lpfc/lpfc_disc.h +++ b/drivers/scsi/lpfc/lpfc_disc.h | |||
@@ -113,6 +113,7 @@ struct lpfc_nodelist { | |||
113 | #define NLP_NPR_ADISC 0x2000000 /* Issue ADISC when dq'ed from | 113 | #define NLP_NPR_ADISC 0x2000000 /* Issue ADISC when dq'ed from |
114 | NPR list */ | 114 | NPR list */ |
115 | #define NLP_DELAY_REMOVE 0x4000000 /* Defer removal till end of DSM */ | 115 | #define NLP_DELAY_REMOVE 0x4000000 /* Defer removal till end of DSM */ |
116 | #define NLP_NODEV_REMOVE 0x8000000 /* Defer removal till discovery ends */ | ||
116 | 117 | ||
117 | /* Defines for list searchs */ | 118 | /* Defines for list searchs */ |
118 | #define NLP_SEARCH_MAPPED 0x1 /* search mapped */ | 119 | #define NLP_SEARCH_MAPPED 0x1 /* search mapped */ |
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 4813beaaca8f..283b7d824c34 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c | |||
@@ -302,10 +302,6 @@ lpfc_cmpl_els_flogi_fabric(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, | |||
302 | if (lpfc_reg_login(phba, Fabric_DID, (uint8_t *) sp, mbox, 0)) | 302 | if (lpfc_reg_login(phba, Fabric_DID, (uint8_t *) sp, mbox, 0)) |
303 | goto fail_free_mbox; | 303 | goto fail_free_mbox; |
304 | 304 | ||
305 | /* | ||
306 | * set_slim mailbox command needs to execute first, | ||
307 | * queue this command to be processed later. | ||
308 | */ | ||
309 | mbox->mbox_cmpl = lpfc_mbx_cmpl_fabric_reg_login; | 305 | mbox->mbox_cmpl = lpfc_mbx_cmpl_fabric_reg_login; |
310 | mbox->context2 = ndlp; | 306 | mbox->context2 = ndlp; |
311 | 307 | ||
@@ -781,25 +777,26 @@ lpfc_cmpl_els_plogi(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
781 | if (disc && phba->num_disc_nodes) { | 777 | if (disc && phba->num_disc_nodes) { |
782 | /* Check to see if there are more PLOGIs to be sent */ | 778 | /* Check to see if there are more PLOGIs to be sent */ |
783 | lpfc_more_plogi(phba); | 779 | lpfc_more_plogi(phba); |
784 | } | ||
785 | 780 | ||
786 | if (phba->num_disc_nodes == 0) { | 781 | if (phba->num_disc_nodes == 0) { |
787 | spin_lock_irq(phba->host->host_lock); | 782 | spin_lock_irq(phba->host->host_lock); |
788 | phba->fc_flag &= ~FC_NDISC_ACTIVE; | 783 | phba->fc_flag &= ~FC_NDISC_ACTIVE; |
789 | spin_unlock_irq(phba->host->host_lock); | 784 | spin_unlock_irq(phba->host->host_lock); |
790 | 785 | ||
791 | lpfc_can_disctmo(phba); | 786 | lpfc_can_disctmo(phba); |
792 | if (phba->fc_flag & FC_RSCN_MODE) { | 787 | if (phba->fc_flag & FC_RSCN_MODE) { |
793 | /* Check to see if more RSCNs came in while we were | 788 | /* |
794 | * processing this one. | 789 | * Check to see if more RSCNs came in while |
795 | */ | 790 | * we were processing this one. |
796 | if ((phba->fc_rscn_id_cnt == 0) && | 791 | */ |
797 | (!(phba->fc_flag & FC_RSCN_DISCOVERY))) { | 792 | if ((phba->fc_rscn_id_cnt == 0) && |
798 | spin_lock_irq(phba->host->host_lock); | 793 | (!(phba->fc_flag & FC_RSCN_DISCOVERY))) { |
799 | phba->fc_flag &= ~FC_RSCN_MODE; | 794 | spin_lock_irq(phba->host->host_lock); |
800 | spin_unlock_irq(phba->host->host_lock); | 795 | phba->fc_flag &= ~FC_RSCN_MODE; |
801 | } else { | 796 | spin_unlock_irq(phba->host->host_lock); |
802 | lpfc_els_handle_rscn(phba); | 797 | } else { |
798 | lpfc_els_handle_rscn(phba); | ||
799 | } | ||
803 | } | 800 | } |
804 | } | 801 | } |
805 | } | 802 | } |
@@ -1263,7 +1260,7 @@ lpfc_issue_els_logo(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp, | |||
1263 | psli = &phba->sli; | 1260 | psli = &phba->sli; |
1264 | pring = &psli->ring[LPFC_ELS_RING]; | 1261 | pring = &psli->ring[LPFC_ELS_RING]; |
1265 | 1262 | ||
1266 | cmdsize = 2 * (sizeof (uint32_t) + sizeof (struct lpfc_name)); | 1263 | cmdsize = (2 * sizeof (uint32_t)) + sizeof (struct lpfc_name); |
1267 | elsiocb = lpfc_prep_els_iocb(phba, 1, cmdsize, retry, ndlp, | 1264 | elsiocb = lpfc_prep_els_iocb(phba, 1, cmdsize, retry, ndlp, |
1268 | ndlp->nlp_DID, ELS_CMD_LOGO); | 1265 | ndlp->nlp_DID, ELS_CMD_LOGO); |
1269 | if (!elsiocb) | 1266 | if (!elsiocb) |
@@ -1451,22 +1448,23 @@ lpfc_cancel_retry_delay_tmo(struct lpfc_hba *phba, struct lpfc_nodelist * nlp) | |||
1451 | * PLOGIs to be sent | 1448 | * PLOGIs to be sent |
1452 | */ | 1449 | */ |
1453 | lpfc_more_plogi(phba); | 1450 | lpfc_more_plogi(phba); |
1454 | } | ||
1455 | 1451 | ||
1456 | if (phba->num_disc_nodes == 0) { | 1452 | if (phba->num_disc_nodes == 0) { |
1457 | phba->fc_flag &= ~FC_NDISC_ACTIVE; | 1453 | phba->fc_flag &= ~FC_NDISC_ACTIVE; |
1458 | lpfc_can_disctmo(phba); | 1454 | lpfc_can_disctmo(phba); |
1459 | if (phba->fc_flag & FC_RSCN_MODE) { | 1455 | if (phba->fc_flag & FC_RSCN_MODE) { |
1460 | /* Check to see if more RSCNs | 1456 | /* |
1461 | * came in while we were | 1457 | * Check to see if more RSCNs |
1462 | * processing this one. | 1458 | * came in while we were |
1463 | */ | 1459 | * processing this one. |
1464 | if((phba->fc_rscn_id_cnt==0) && | 1460 | */ |
1465 | (!(phba->fc_flag & FC_RSCN_DISCOVERY))) { | 1461 | if((phba->fc_rscn_id_cnt==0) && |
1466 | phba->fc_flag &= ~FC_RSCN_MODE; | 1462 | !(phba->fc_flag & FC_RSCN_DISCOVERY)) { |
1467 | } | 1463 | phba->fc_flag &= ~FC_RSCN_MODE; |
1468 | else { | 1464 | } |
1469 | lpfc_els_handle_rscn(phba); | 1465 | else { |
1466 | lpfc_els_handle_rscn(phba); | ||
1467 | } | ||
1470 | } | 1468 | } |
1471 | } | 1469 | } |
1472 | } | 1470 | } |
@@ -1872,9 +1870,6 @@ lpfc_cmpl_els_acc(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
1872 | if (mbox) { | 1870 | if (mbox) { |
1873 | if ((rspiocb->iocb.ulpStatus == 0) | 1871 | if ((rspiocb->iocb.ulpStatus == 0) |
1874 | && (ndlp->nlp_flag & NLP_ACC_REGLOGIN)) { | 1872 | && (ndlp->nlp_flag & NLP_ACC_REGLOGIN)) { |
1875 | /* set_slim mailbox command needs to execute first, | ||
1876 | * queue this command to be processed later. | ||
1877 | */ | ||
1878 | lpfc_unreg_rpi(phba, ndlp); | 1873 | lpfc_unreg_rpi(phba, ndlp); |
1879 | mbox->mbox_cmpl = lpfc_mbx_cmpl_reg_login; | 1874 | mbox->mbox_cmpl = lpfc_mbx_cmpl_reg_login; |
1880 | mbox->context2 = ndlp; | 1875 | mbox->context2 = ndlp; |
@@ -1920,6 +1915,7 @@ lpfc_els_rsp_acc(struct lpfc_hba * phba, uint32_t flag, | |||
1920 | uint8_t *pcmd; | 1915 | uint8_t *pcmd; |
1921 | uint16_t cmdsize; | 1916 | uint16_t cmdsize; |
1922 | int rc; | 1917 | int rc; |
1918 | ELS_PKT *els_pkt_ptr; | ||
1923 | 1919 | ||
1924 | psli = &phba->sli; | 1920 | psli = &phba->sli; |
1925 | pring = &psli->ring[LPFC_ELS_RING]; /* ELS ring */ | 1921 | pring = &psli->ring[LPFC_ELS_RING]; /* ELS ring */ |
@@ -1958,6 +1954,23 @@ lpfc_els_rsp_acc(struct lpfc_hba * phba, uint32_t flag, | |||
1958 | pcmd += sizeof (uint32_t); | 1954 | pcmd += sizeof (uint32_t); |
1959 | memcpy(pcmd, &phba->fc_sparam, sizeof (struct serv_parm)); | 1955 | memcpy(pcmd, &phba->fc_sparam, sizeof (struct serv_parm)); |
1960 | break; | 1956 | break; |
1957 | case ELS_CMD_PRLO: | ||
1958 | cmdsize = sizeof (uint32_t) + sizeof (PRLO); | ||
1959 | elsiocb = lpfc_prep_els_iocb(phba, 0, cmdsize, oldiocb->retry, | ||
1960 | ndlp, ndlp->nlp_DID, ELS_CMD_PRLO); | ||
1961 | if (!elsiocb) | ||
1962 | return 1; | ||
1963 | |||
1964 | icmd = &elsiocb->iocb; | ||
1965 | icmd->ulpContext = oldcmd->ulpContext; /* Xri */ | ||
1966 | pcmd = (((struct lpfc_dmabuf *) elsiocb->context2)->virt); | ||
1967 | |||
1968 | memcpy(pcmd, ((struct lpfc_dmabuf *) oldiocb->context2)->virt, | ||
1969 | sizeof (uint32_t) + sizeof (PRLO)); | ||
1970 | *((uint32_t *) (pcmd)) = ELS_CMD_PRLO_ACC; | ||
1971 | els_pkt_ptr = (ELS_PKT *) pcmd; | ||
1972 | els_pkt_ptr->un.prlo.acceptRspCode = PRLO_REQ_EXECUTED; | ||
1973 | break; | ||
1961 | default: | 1974 | default: |
1962 | return 1; | 1975 | return 1; |
1963 | } | 1976 | } |
@@ -2498,7 +2511,7 @@ lpfc_els_rcv_rscn(struct lpfc_hba * phba, | |||
2498 | /* If we are about to begin discovery, just ACC the RSCN. | 2511 | /* If we are about to begin discovery, just ACC the RSCN. |
2499 | * Discovery processing will satisfy it. | 2512 | * Discovery processing will satisfy it. |
2500 | */ | 2513 | */ |
2501 | if (phba->hba_state < LPFC_NS_QRY) { | 2514 | if (phba->hba_state <= LPFC_NS_QRY) { |
2502 | lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, | 2515 | lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, |
2503 | newnode); | 2516 | newnode); |
2504 | return 0; | 2517 | return 0; |
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index 6721e679df62..adb086009ae0 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c | |||
@@ -311,8 +311,8 @@ lpfc_workq_post_event(struct lpfc_hba * phba, void *arg1, void *arg2, | |||
311 | evtp->evt_arg2 = arg2; | 311 | evtp->evt_arg2 = arg2; |
312 | evtp->evt = evt; | 312 | evtp->evt = evt; |
313 | 313 | ||
314 | list_add_tail(&evtp->evt_listp, &phba->work_list); | ||
315 | spin_lock_irq(phba->host->host_lock); | 314 | spin_lock_irq(phba->host->host_lock); |
315 | list_add_tail(&evtp->evt_listp, &phba->work_list); | ||
316 | if (phba->work_wait) | 316 | if (phba->work_wait) |
317 | wake_up(phba->work_wait); | 317 | wake_up(phba->work_wait); |
318 | spin_unlock_irq(phba->host->host_lock); | 318 | spin_unlock_irq(phba->host->host_lock); |
@@ -1071,10 +1071,6 @@ lpfc_register_remote_port(struct lpfc_hba * phba, | |||
1071 | /* initialize static port data */ | 1071 | /* initialize static port data */ |
1072 | rport->maxframe_size = ndlp->nlp_maxframe; | 1072 | rport->maxframe_size = ndlp->nlp_maxframe; |
1073 | rport->supported_classes = ndlp->nlp_class_sup; | 1073 | rport->supported_classes = ndlp->nlp_class_sup; |
1074 | if ((rport->scsi_target_id != -1) && | ||
1075 | (rport->scsi_target_id < MAX_FCP_TARGET)) { | ||
1076 | ndlp->nlp_sid = rport->scsi_target_id; | ||
1077 | } | ||
1078 | rdata = rport->dd_data; | 1074 | rdata = rport->dd_data; |
1079 | rdata->pnode = ndlp; | 1075 | rdata->pnode = ndlp; |
1080 | 1076 | ||
@@ -1087,6 +1083,10 @@ lpfc_register_remote_port(struct lpfc_hba * phba, | |||
1087 | if (rport_ids.roles != FC_RPORT_ROLE_UNKNOWN) | 1083 | if (rport_ids.roles != FC_RPORT_ROLE_UNKNOWN) |
1088 | fc_remote_port_rolechg(rport, rport_ids.roles); | 1084 | fc_remote_port_rolechg(rport, rport_ids.roles); |
1089 | 1085 | ||
1086 | if ((rport->scsi_target_id != -1) && | ||
1087 | (rport->scsi_target_id < MAX_FCP_TARGET)) { | ||
1088 | ndlp->nlp_sid = rport->scsi_target_id; | ||
1089 | } | ||
1090 | 1090 | ||
1091 | return; | 1091 | return; |
1092 | } | 1092 | } |
@@ -1238,6 +1238,7 @@ lpfc_nlp_list(struct lpfc_hba * phba, struct lpfc_nodelist * nlp, int list) | |||
1238 | evt_listp); | 1238 | evt_listp); |
1239 | 1239 | ||
1240 | } | 1240 | } |
1241 | nlp->nlp_flag &= ~NLP_NODEV_REMOVE; | ||
1241 | nlp->nlp_type |= NLP_FC_NODE; | 1242 | nlp->nlp_type |= NLP_FC_NODE; |
1242 | break; | 1243 | break; |
1243 | case NLP_MAPPED_LIST: | 1244 | case NLP_MAPPED_LIST: |
@@ -1258,6 +1259,7 @@ lpfc_nlp_list(struct lpfc_hba * phba, struct lpfc_nodelist * nlp, int list) | |||
1258 | evt_listp); | 1259 | evt_listp); |
1259 | 1260 | ||
1260 | } | 1261 | } |
1262 | nlp->nlp_flag &= ~NLP_NODEV_REMOVE; | ||
1261 | break; | 1263 | break; |
1262 | case NLP_NPR_LIST: | 1264 | case NLP_NPR_LIST: |
1263 | nlp->nlp_flag |= list; | 1265 | nlp->nlp_flag |= list; |
@@ -1402,6 +1404,8 @@ lpfc_check_sli_ndlp(struct lpfc_hba * phba, | |||
1402 | if (icmd->ulpContext == (volatile ushort)ndlp->nlp_rpi) | 1404 | if (icmd->ulpContext == (volatile ushort)ndlp->nlp_rpi) |
1403 | return 1; | 1405 | return 1; |
1404 | case CMD_ELS_REQUEST64_CR: | 1406 | case CMD_ELS_REQUEST64_CR: |
1407 | if (icmd->un.elsreq64.remoteID == ndlp->nlp_DID) | ||
1408 | return 1; | ||
1405 | case CMD_XMIT_ELS_RSP64_CX: | 1409 | case CMD_XMIT_ELS_RSP64_CX: |
1406 | if (iocb->context1 == (uint8_t *) ndlp) | 1410 | if (iocb->context1 == (uint8_t *) ndlp) |
1407 | return 1; | 1411 | return 1; |
@@ -1901,10 +1905,8 @@ lpfc_setup_disc_node(struct lpfc_hba * phba, uint32_t did) | |||
1901 | */ | 1905 | */ |
1902 | if (ndlp->nlp_flag & NLP_DELAY_TMO) | 1906 | if (ndlp->nlp_flag & NLP_DELAY_TMO) |
1903 | lpfc_cancel_retry_delay_tmo(phba, ndlp); | 1907 | lpfc_cancel_retry_delay_tmo(phba, ndlp); |
1904 | } else { | 1908 | } else |
1905 | ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; | ||
1906 | ndlp = NULL; | 1909 | ndlp = NULL; |
1907 | } | ||
1908 | } else { | 1910 | } else { |
1909 | flg = ndlp->nlp_flag & NLP_LIST_MASK; | 1911 | flg = ndlp->nlp_flag & NLP_LIST_MASK; |
1910 | if ((flg == NLP_ADISC_LIST) || (flg == NLP_PLOGI_LIST)) | 1912 | if ((flg == NLP_ADISC_LIST) || (flg == NLP_PLOGI_LIST)) |
diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h index 54d04188f7cc..eedf98801366 100644 --- a/drivers/scsi/lpfc/lpfc_hw.h +++ b/drivers/scsi/lpfc/lpfc_hw.h | |||
@@ -449,6 +449,7 @@ struct serv_parm { /* Structure is in Big Endian format */ | |||
449 | #define ELS_CMD_RRQ 0x12000000 | 449 | #define ELS_CMD_RRQ 0x12000000 |
450 | #define ELS_CMD_PRLI 0x20100014 | 450 | #define ELS_CMD_PRLI 0x20100014 |
451 | #define ELS_CMD_PRLO 0x21100014 | 451 | #define ELS_CMD_PRLO 0x21100014 |
452 | #define ELS_CMD_PRLO_ACC 0x02100014 | ||
452 | #define ELS_CMD_PDISC 0x50000000 | 453 | #define ELS_CMD_PDISC 0x50000000 |
453 | #define ELS_CMD_FDISC 0x51000000 | 454 | #define ELS_CMD_FDISC 0x51000000 |
454 | #define ELS_CMD_ADISC 0x52000000 | 455 | #define ELS_CMD_ADISC 0x52000000 |
@@ -484,6 +485,7 @@ struct serv_parm { /* Structure is in Big Endian format */ | |||
484 | #define ELS_CMD_RRQ 0x12 | 485 | #define ELS_CMD_RRQ 0x12 |
485 | #define ELS_CMD_PRLI 0x14001020 | 486 | #define ELS_CMD_PRLI 0x14001020 |
486 | #define ELS_CMD_PRLO 0x14001021 | 487 | #define ELS_CMD_PRLO 0x14001021 |
488 | #define ELS_CMD_PRLO_ACC 0x14001002 | ||
487 | #define ELS_CMD_PDISC 0x50 | 489 | #define ELS_CMD_PDISC 0x50 |
488 | #define ELS_CMD_FDISC 0x51 | 490 | #define ELS_CMD_FDISC 0x51 |
489 | #define ELS_CMD_ADISC 0x52 | 491 | #define ELS_CMD_ADISC 0x52 |
@@ -1539,6 +1541,7 @@ typedef struct { | |||
1539 | 1541 | ||
1540 | #define FLAGS_TOPOLOGY_FAILOVER 0x0400 /* Bit 10 */ | 1542 | #define FLAGS_TOPOLOGY_FAILOVER 0x0400 /* Bit 10 */ |
1541 | #define FLAGS_LINK_SPEED 0x0800 /* Bit 11 */ | 1543 | #define FLAGS_LINK_SPEED 0x0800 /* Bit 11 */ |
1544 | #define FLAGS_IMED_ABORT 0x04000 /* Bit 14 */ | ||
1542 | 1545 | ||
1543 | uint32_t link_speed; | 1546 | uint32_t link_speed; |
1544 | #define LINK_SPEED_AUTO 0 /* Auto selection */ | 1547 | #define LINK_SPEED_AUTO 0 /* Auto selection */ |
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 66d5d003555d..908d0f27706f 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
@@ -294,15 +294,6 @@ lpfc_config_port_post(struct lpfc_hba * phba) | |||
294 | } | 294 | } |
295 | } | 295 | } |
296 | 296 | ||
297 | /* This should turn on DELAYED ABTS for ELS timeouts */ | ||
298 | lpfc_set_slim(phba, pmb, 0x052198, 0x1); | ||
299 | if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { | ||
300 | phba->hba_state = LPFC_HBA_ERROR; | ||
301 | mempool_free( pmb, phba->mbox_mem_pool); | ||
302 | return -EIO; | ||
303 | } | ||
304 | |||
305 | |||
306 | lpfc_read_config(phba, pmb); | 297 | lpfc_read_config(phba, pmb); |
307 | if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { | 298 | if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { |
308 | lpfc_printf_log(phba, | 299 | lpfc_printf_log(phba, |
@@ -804,7 +795,7 @@ lpfc_get_hba_model_desc(struct lpfc_hba * phba, uint8_t * mdp, uint8_t * descp) | |||
804 | int max_speed; | 795 | int max_speed; |
805 | char * ports; | 796 | char * ports; |
806 | char * bus; | 797 | char * bus; |
807 | } m; | 798 | } m = {"<Unknown>", 0, "", ""}; |
808 | 799 | ||
809 | pci_read_config_byte(phba->pcidev, PCI_HEADER_TYPE, &hdrtype); | 800 | pci_read_config_byte(phba->pcidev, PCI_HEADER_TYPE, &hdrtype); |
810 | ports = (hdrtype == 0x80) ? "2-port " : ""; | 801 | ports = (hdrtype == 0x80) ? "2-port " : ""; |
@@ -1627,7 +1618,7 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
1627 | 1618 | ||
1628 | error = lpfc_alloc_sysfs_attr(phba); | 1619 | error = lpfc_alloc_sysfs_attr(phba); |
1629 | if (error) | 1620 | if (error) |
1630 | goto out_kthread_stop; | 1621 | goto out_remove_host; |
1631 | 1622 | ||
1632 | error = request_irq(phba->pcidev->irq, lpfc_intr_handler, SA_SHIRQ, | 1623 | error = request_irq(phba->pcidev->irq, lpfc_intr_handler, SA_SHIRQ, |
1633 | LPFC_DRIVER_NAME, phba); | 1624 | LPFC_DRIVER_NAME, phba); |
@@ -1644,8 +1635,10 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
1644 | phba->HCregaddr = phba->ctrl_regs_memmap_p + HC_REG_OFFSET; | 1635 | phba->HCregaddr = phba->ctrl_regs_memmap_p + HC_REG_OFFSET; |
1645 | 1636 | ||
1646 | error = lpfc_sli_hba_setup(phba); | 1637 | error = lpfc_sli_hba_setup(phba); |
1647 | if (error) | 1638 | if (error) { |
1639 | error = -ENODEV; | ||
1648 | goto out_free_irq; | 1640 | goto out_free_irq; |
1641 | } | ||
1649 | 1642 | ||
1650 | if (phba->cfg_poll & DISABLE_FCP_RING_INT) { | 1643 | if (phba->cfg_poll & DISABLE_FCP_RING_INT) { |
1651 | spin_lock_irq(phba->host->host_lock); | 1644 | spin_lock_irq(phba->host->host_lock); |
@@ -1700,6 +1693,9 @@ out_free_irq: | |||
1700 | free_irq(phba->pcidev->irq, phba); | 1693 | free_irq(phba->pcidev->irq, phba); |
1701 | out_free_sysfs_attr: | 1694 | out_free_sysfs_attr: |
1702 | lpfc_free_sysfs_attr(phba); | 1695 | lpfc_free_sysfs_attr(phba); |
1696 | out_remove_host: | ||
1697 | fc_remove_host(phba->host); | ||
1698 | scsi_remove_host(phba->host); | ||
1703 | out_kthread_stop: | 1699 | out_kthread_stop: |
1704 | kthread_stop(phba->worker_thread); | 1700 | kthread_stop(phba->worker_thread); |
1705 | out_free_iocbq: | 1701 | out_free_iocbq: |
@@ -1721,12 +1717,14 @@ out_iounmap_slim: | |||
1721 | out_idr_remove: | 1717 | out_idr_remove: |
1722 | idr_remove(&lpfc_hba_index, phba->brd_no); | 1718 | idr_remove(&lpfc_hba_index, phba->brd_no); |
1723 | out_put_host: | 1719 | out_put_host: |
1720 | phba->host = NULL; | ||
1724 | scsi_host_put(host); | 1721 | scsi_host_put(host); |
1725 | out_release_regions: | 1722 | out_release_regions: |
1726 | pci_release_regions(pdev); | 1723 | pci_release_regions(pdev); |
1727 | out_disable_device: | 1724 | out_disable_device: |
1728 | pci_disable_device(pdev); | 1725 | pci_disable_device(pdev); |
1729 | out: | 1726 | out: |
1727 | pci_set_drvdata(pdev, NULL); | ||
1730 | return error; | 1728 | return error; |
1731 | } | 1729 | } |
1732 | 1730 | ||
diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c index c585e2b2e589..e42f22aaf71b 100644 --- a/drivers/scsi/lpfc/lpfc_mbox.c +++ b/drivers/scsi/lpfc/lpfc_mbox.c | |||
@@ -200,6 +200,9 @@ lpfc_init_link(struct lpfc_hba * phba, | |||
200 | break; | 200 | break; |
201 | } | 201 | } |
202 | 202 | ||
203 | /* Enable asynchronous ABTS responses from firmware */ | ||
204 | mb->un.varInitLnk.link_flags |= FLAGS_IMED_ABORT; | ||
205 | |||
203 | /* NEW_FEATURE | 206 | /* NEW_FEATURE |
204 | * Setting up the link speed | 207 | * Setting up the link speed |
205 | */ | 208 | */ |
@@ -292,36 +295,6 @@ lpfc_unreg_did(struct lpfc_hba * phba, uint32_t did, LPFC_MBOXQ_t * pmb) | |||
292 | return; | 295 | return; |
293 | } | 296 | } |
294 | 297 | ||
295 | /***********************************************/ | ||
296 | |||
297 | /* command to write slim */ | ||
298 | /***********************************************/ | ||
299 | void | ||
300 | lpfc_set_slim(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb, uint32_t addr, | ||
301 | uint32_t value) | ||
302 | { | ||
303 | MAILBOX_t *mb; | ||
304 | |||
305 | mb = &pmb->mb; | ||
306 | memset(pmb, 0, sizeof (LPFC_MBOXQ_t)); | ||
307 | |||
308 | /* addr = 0x090597 is AUTO ABTS disable for ELS commands */ | ||
309 | /* addr = 0x052198 is DELAYED ABTS enable for ELS commands */ | ||
310 | |||
311 | /* | ||
312 | * Always turn on DELAYED ABTS for ELS timeouts | ||
313 | */ | ||
314 | if ((addr == 0x052198) && (value == 0)) | ||
315 | value = 1; | ||
316 | |||
317 | mb->un.varWords[0] = addr; | ||
318 | mb->un.varWords[1] = value; | ||
319 | |||
320 | mb->mbxCommand = MBX_SET_SLIM; | ||
321 | mb->mbxOwner = OWN_HOST; | ||
322 | return; | ||
323 | } | ||
324 | |||
325 | /**********************************************/ | 298 | /**********************************************/ |
326 | /* lpfc_read_nv Issue a READ CONFIG */ | 299 | /* lpfc_read_nv Issue a READ CONFIG */ |
327 | /* mailbox command */ | 300 | /* mailbox command */ |
diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c index 3d77bd999b70..27d60ad897cd 100644 --- a/drivers/scsi/lpfc/lpfc_nportdisc.c +++ b/drivers/scsi/lpfc/lpfc_nportdisc.c | |||
@@ -465,14 +465,18 @@ lpfc_rcv_padisc(struct lpfc_hba * phba, | |||
465 | static int | 465 | static int |
466 | lpfc_rcv_logo(struct lpfc_hba * phba, | 466 | lpfc_rcv_logo(struct lpfc_hba * phba, |
467 | struct lpfc_nodelist * ndlp, | 467 | struct lpfc_nodelist * ndlp, |
468 | struct lpfc_iocbq *cmdiocb) | 468 | struct lpfc_iocbq *cmdiocb, |
469 | uint32_t els_cmd) | ||
469 | { | 470 | { |
470 | /* Put ndlp on NPR list with 1 sec timeout for plogi, ACC logo */ | 471 | /* Put ndlp on NPR list with 1 sec timeout for plogi, ACC logo */ |
471 | /* Only call LOGO ACC for first LOGO, this avoids sending unnecessary | 472 | /* Only call LOGO ACC for first LOGO, this avoids sending unnecessary |
472 | * PLOGIs during LOGO storms from a device. | 473 | * PLOGIs during LOGO storms from a device. |
473 | */ | 474 | */ |
474 | ndlp->nlp_flag |= NLP_LOGO_ACC; | 475 | ndlp->nlp_flag |= NLP_LOGO_ACC; |
475 | lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); | 476 | if (els_cmd == ELS_CMD_PRLO) |
477 | lpfc_els_rsp_acc(phba, ELS_CMD_PRLO, cmdiocb, ndlp, NULL, 0); | ||
478 | else | ||
479 | lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); | ||
476 | 480 | ||
477 | if (!(ndlp->nlp_type & NLP_FABRIC) || | 481 | if (!(ndlp->nlp_type & NLP_FABRIC) || |
478 | (ndlp->nlp_state == NLP_STE_ADISC_ISSUE)) { | 482 | (ndlp->nlp_state == NLP_STE_ADISC_ISSUE)) { |
@@ -681,7 +685,7 @@ lpfc_rcv_logo_plogi_issue(struct lpfc_hba * phba, | |||
681 | /* software abort outstanding PLOGI */ | 685 | /* software abort outstanding PLOGI */ |
682 | lpfc_els_abort(phba, ndlp, 1); | 686 | lpfc_els_abort(phba, ndlp, 1); |
683 | 687 | ||
684 | lpfc_rcv_logo(phba, ndlp, cmdiocb); | 688 | lpfc_rcv_logo(phba, ndlp, cmdiocb, ELS_CMD_LOGO); |
685 | return ndlp->nlp_state; | 689 | return ndlp->nlp_state; |
686 | } | 690 | } |
687 | 691 | ||
@@ -788,10 +792,6 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_hba * phba, | |||
788 | if (lpfc_reg_login | 792 | if (lpfc_reg_login |
789 | (phba, irsp->un.elsreq64.remoteID, | 793 | (phba, irsp->un.elsreq64.remoteID, |
790 | (uint8_t *) sp, mbox, 0) == 0) { | 794 | (uint8_t *) sp, mbox, 0) == 0) { |
791 | /* set_slim mailbox command needs to | ||
792 | * execute first, queue this command to | ||
793 | * be processed later. | ||
794 | */ | ||
795 | switch (ndlp->nlp_DID) { | 795 | switch (ndlp->nlp_DID) { |
796 | case NameServer_DID: | 796 | case NameServer_DID: |
797 | mbox->mbox_cmpl = | 797 | mbox->mbox_cmpl = |
@@ -832,11 +832,17 @@ static uint32_t | |||
832 | lpfc_device_rm_plogi_issue(struct lpfc_hba * phba, | 832 | lpfc_device_rm_plogi_issue(struct lpfc_hba * phba, |
833 | struct lpfc_nodelist * ndlp, void *arg, uint32_t evt) | 833 | struct lpfc_nodelist * ndlp, void *arg, uint32_t evt) |
834 | { | 834 | { |
835 | /* software abort outstanding PLOGI */ | 835 | if(ndlp->nlp_flag & NLP_NPR_2B_DISC) { |
836 | lpfc_els_abort(phba, ndlp, 1); | 836 | ndlp->nlp_flag |= NLP_NODEV_REMOVE; |
837 | return ndlp->nlp_state; | ||
838 | } | ||
839 | else { | ||
840 | /* software abort outstanding PLOGI */ | ||
841 | lpfc_els_abort(phba, ndlp, 1); | ||
837 | 842 | ||
838 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 843 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); |
839 | return NLP_STE_FREED_NODE; | 844 | return NLP_STE_FREED_NODE; |
845 | } | ||
840 | } | 846 | } |
841 | 847 | ||
842 | static uint32_t | 848 | static uint32_t |
@@ -851,7 +857,7 @@ lpfc_device_recov_plogi_issue(struct lpfc_hba * phba, | |||
851 | ndlp->nlp_state = NLP_STE_NPR_NODE; | 857 | ndlp->nlp_state = NLP_STE_NPR_NODE; |
852 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); | 858 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); |
853 | spin_lock_irq(phba->host->host_lock); | 859 | spin_lock_irq(phba->host->host_lock); |
854 | ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; | 860 | ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); |
855 | spin_unlock_irq(phba->host->host_lock); | 861 | spin_unlock_irq(phba->host->host_lock); |
856 | 862 | ||
857 | return ndlp->nlp_state; | 863 | return ndlp->nlp_state; |
@@ -905,7 +911,7 @@ lpfc_rcv_logo_adisc_issue(struct lpfc_hba * phba, | |||
905 | /* software abort outstanding ADISC */ | 911 | /* software abort outstanding ADISC */ |
906 | lpfc_els_abort(phba, ndlp, 0); | 912 | lpfc_els_abort(phba, ndlp, 0); |
907 | 913 | ||
908 | lpfc_rcv_logo(phba, ndlp, cmdiocb); | 914 | lpfc_rcv_logo(phba, ndlp, cmdiocb, ELS_CMD_LOGO); |
909 | return ndlp->nlp_state; | 915 | return ndlp->nlp_state; |
910 | } | 916 | } |
911 | 917 | ||
@@ -932,7 +938,7 @@ lpfc_rcv_prlo_adisc_issue(struct lpfc_hba * phba, | |||
932 | cmdiocb = (struct lpfc_iocbq *) arg; | 938 | cmdiocb = (struct lpfc_iocbq *) arg; |
933 | 939 | ||
934 | /* Treat like rcv logo */ | 940 | /* Treat like rcv logo */ |
935 | lpfc_rcv_logo(phba, ndlp, cmdiocb); | 941 | lpfc_rcv_logo(phba, ndlp, cmdiocb, ELS_CMD_PRLO); |
936 | return ndlp->nlp_state; | 942 | return ndlp->nlp_state; |
937 | } | 943 | } |
938 | 944 | ||
@@ -987,11 +993,17 @@ lpfc_device_rm_adisc_issue(struct lpfc_hba * phba, | |||
987 | struct lpfc_nodelist * ndlp, void *arg, | 993 | struct lpfc_nodelist * ndlp, void *arg, |
988 | uint32_t evt) | 994 | uint32_t evt) |
989 | { | 995 | { |
990 | /* software abort outstanding ADISC */ | 996 | if(ndlp->nlp_flag & NLP_NPR_2B_DISC) { |
991 | lpfc_els_abort(phba, ndlp, 1); | 997 | ndlp->nlp_flag |= NLP_NODEV_REMOVE; |
998 | return ndlp->nlp_state; | ||
999 | } | ||
1000 | else { | ||
1001 | /* software abort outstanding ADISC */ | ||
1002 | lpfc_els_abort(phba, ndlp, 1); | ||
992 | 1003 | ||
993 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 1004 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); |
994 | return NLP_STE_FREED_NODE; | 1005 | return NLP_STE_FREED_NODE; |
1006 | } | ||
995 | } | 1007 | } |
996 | 1008 | ||
997 | static uint32_t | 1009 | static uint32_t |
@@ -1006,7 +1018,7 @@ lpfc_device_recov_adisc_issue(struct lpfc_hba * phba, | |||
1006 | ndlp->nlp_state = NLP_STE_NPR_NODE; | 1018 | ndlp->nlp_state = NLP_STE_NPR_NODE; |
1007 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); | 1019 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); |
1008 | spin_lock_irq(phba->host->host_lock); | 1020 | spin_lock_irq(phba->host->host_lock); |
1009 | ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; | 1021 | ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); |
1010 | ndlp->nlp_flag |= NLP_NPR_ADISC; | 1022 | ndlp->nlp_flag |= NLP_NPR_ADISC; |
1011 | spin_unlock_irq(phba->host->host_lock); | 1023 | spin_unlock_irq(phba->host->host_lock); |
1012 | 1024 | ||
@@ -1048,7 +1060,7 @@ lpfc_rcv_logo_reglogin_issue(struct lpfc_hba * phba, | |||
1048 | 1060 | ||
1049 | cmdiocb = (struct lpfc_iocbq *) arg; | 1061 | cmdiocb = (struct lpfc_iocbq *) arg; |
1050 | 1062 | ||
1051 | lpfc_rcv_logo(phba, ndlp, cmdiocb); | 1063 | lpfc_rcv_logo(phba, ndlp, cmdiocb, ELS_CMD_LOGO); |
1052 | return ndlp->nlp_state; | 1064 | return ndlp->nlp_state; |
1053 | } | 1065 | } |
1054 | 1066 | ||
@@ -1073,7 +1085,7 @@ lpfc_rcv_prlo_reglogin_issue(struct lpfc_hba * phba, | |||
1073 | struct lpfc_iocbq *cmdiocb; | 1085 | struct lpfc_iocbq *cmdiocb; |
1074 | 1086 | ||
1075 | cmdiocb = (struct lpfc_iocbq *) arg; | 1087 | cmdiocb = (struct lpfc_iocbq *) arg; |
1076 | lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); | 1088 | lpfc_els_rsp_acc(phba, ELS_CMD_PRLO, cmdiocb, ndlp, NULL, 0); |
1077 | return ndlp->nlp_state; | 1089 | return ndlp->nlp_state; |
1078 | } | 1090 | } |
1079 | 1091 | ||
@@ -1133,8 +1145,14 @@ lpfc_device_rm_reglogin_issue(struct lpfc_hba * phba, | |||
1133 | struct lpfc_nodelist * ndlp, void *arg, | 1145 | struct lpfc_nodelist * ndlp, void *arg, |
1134 | uint32_t evt) | 1146 | uint32_t evt) |
1135 | { | 1147 | { |
1136 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 1148 | if(ndlp->nlp_flag & NLP_NPR_2B_DISC) { |
1137 | return NLP_STE_FREED_NODE; | 1149 | ndlp->nlp_flag |= NLP_NODEV_REMOVE; |
1150 | return ndlp->nlp_state; | ||
1151 | } | ||
1152 | else { | ||
1153 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | ||
1154 | return NLP_STE_FREED_NODE; | ||
1155 | } | ||
1138 | } | 1156 | } |
1139 | 1157 | ||
1140 | static uint32_t | 1158 | static uint32_t |
@@ -1146,7 +1164,7 @@ lpfc_device_recov_reglogin_issue(struct lpfc_hba * phba, | |||
1146 | ndlp->nlp_state = NLP_STE_NPR_NODE; | 1164 | ndlp->nlp_state = NLP_STE_NPR_NODE; |
1147 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); | 1165 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); |
1148 | spin_lock_irq(phba->host->host_lock); | 1166 | spin_lock_irq(phba->host->host_lock); |
1149 | ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; | 1167 | ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); |
1150 | spin_unlock_irq(phba->host->host_lock); | 1168 | spin_unlock_irq(phba->host->host_lock); |
1151 | return ndlp->nlp_state; | 1169 | return ndlp->nlp_state; |
1152 | } | 1170 | } |
@@ -1186,7 +1204,7 @@ lpfc_rcv_logo_prli_issue(struct lpfc_hba * phba, | |||
1186 | /* Software abort outstanding PRLI before sending acc */ | 1204 | /* Software abort outstanding PRLI before sending acc */ |
1187 | lpfc_els_abort(phba, ndlp, 1); | 1205 | lpfc_els_abort(phba, ndlp, 1); |
1188 | 1206 | ||
1189 | lpfc_rcv_logo(phba, ndlp, cmdiocb); | 1207 | lpfc_rcv_logo(phba, ndlp, cmdiocb, ELS_CMD_LOGO); |
1190 | return ndlp->nlp_state; | 1208 | return ndlp->nlp_state; |
1191 | } | 1209 | } |
1192 | 1210 | ||
@@ -1214,7 +1232,7 @@ lpfc_rcv_prlo_prli_issue(struct lpfc_hba * phba, | |||
1214 | struct lpfc_iocbq *cmdiocb; | 1232 | struct lpfc_iocbq *cmdiocb; |
1215 | 1233 | ||
1216 | cmdiocb = (struct lpfc_iocbq *) arg; | 1234 | cmdiocb = (struct lpfc_iocbq *) arg; |
1217 | lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); | 1235 | lpfc_els_rsp_acc(phba, ELS_CMD_PRLO, cmdiocb, ndlp, NULL, 0); |
1218 | return ndlp->nlp_state; | 1236 | return ndlp->nlp_state; |
1219 | } | 1237 | } |
1220 | 1238 | ||
@@ -1278,11 +1296,17 @@ static uint32_t | |||
1278 | lpfc_device_rm_prli_issue(struct lpfc_hba * phba, | 1296 | lpfc_device_rm_prli_issue(struct lpfc_hba * phba, |
1279 | struct lpfc_nodelist * ndlp, void *arg, uint32_t evt) | 1297 | struct lpfc_nodelist * ndlp, void *arg, uint32_t evt) |
1280 | { | 1298 | { |
1281 | /* software abort outstanding PRLI */ | 1299 | if(ndlp->nlp_flag & NLP_NPR_2B_DISC) { |
1282 | lpfc_els_abort(phba, ndlp, 1); | 1300 | ndlp->nlp_flag |= NLP_NODEV_REMOVE; |
1301 | return ndlp->nlp_state; | ||
1302 | } | ||
1303 | else { | ||
1304 | /* software abort outstanding PLOGI */ | ||
1305 | lpfc_els_abort(phba, ndlp, 1); | ||
1283 | 1306 | ||
1284 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 1307 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); |
1285 | return NLP_STE_FREED_NODE; | 1308 | return NLP_STE_FREED_NODE; |
1309 | } | ||
1286 | } | 1310 | } |
1287 | 1311 | ||
1288 | 1312 | ||
@@ -1313,7 +1337,7 @@ lpfc_device_recov_prli_issue(struct lpfc_hba * phba, | |||
1313 | ndlp->nlp_state = NLP_STE_NPR_NODE; | 1337 | ndlp->nlp_state = NLP_STE_NPR_NODE; |
1314 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); | 1338 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); |
1315 | spin_lock_irq(phba->host->host_lock); | 1339 | spin_lock_irq(phba->host->host_lock); |
1316 | ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; | 1340 | ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); |
1317 | spin_unlock_irq(phba->host->host_lock); | 1341 | spin_unlock_irq(phba->host->host_lock); |
1318 | return ndlp->nlp_state; | 1342 | return ndlp->nlp_state; |
1319 | } | 1343 | } |
@@ -1351,7 +1375,7 @@ lpfc_rcv_logo_unmap_node(struct lpfc_hba * phba, | |||
1351 | 1375 | ||
1352 | cmdiocb = (struct lpfc_iocbq *) arg; | 1376 | cmdiocb = (struct lpfc_iocbq *) arg; |
1353 | 1377 | ||
1354 | lpfc_rcv_logo(phba, ndlp, cmdiocb); | 1378 | lpfc_rcv_logo(phba, ndlp, cmdiocb, ELS_CMD_LOGO); |
1355 | return ndlp->nlp_state; | 1379 | return ndlp->nlp_state; |
1356 | } | 1380 | } |
1357 | 1381 | ||
@@ -1375,7 +1399,7 @@ lpfc_rcv_prlo_unmap_node(struct lpfc_hba * phba, | |||
1375 | 1399 | ||
1376 | cmdiocb = (struct lpfc_iocbq *) arg; | 1400 | cmdiocb = (struct lpfc_iocbq *) arg; |
1377 | 1401 | ||
1378 | lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); | 1402 | lpfc_els_rsp_acc(phba, ELS_CMD_PRLO, cmdiocb, ndlp, NULL, 0); |
1379 | return ndlp->nlp_state; | 1403 | return ndlp->nlp_state; |
1380 | } | 1404 | } |
1381 | 1405 | ||
@@ -1386,7 +1410,7 @@ lpfc_device_recov_unmap_node(struct lpfc_hba * phba, | |||
1386 | ndlp->nlp_prev_state = NLP_STE_UNMAPPED_NODE; | 1410 | ndlp->nlp_prev_state = NLP_STE_UNMAPPED_NODE; |
1387 | ndlp->nlp_state = NLP_STE_NPR_NODE; | 1411 | ndlp->nlp_state = NLP_STE_NPR_NODE; |
1388 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); | 1412 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); |
1389 | ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; | 1413 | ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); |
1390 | lpfc_disc_set_adisc(phba, ndlp); | 1414 | lpfc_disc_set_adisc(phba, ndlp); |
1391 | 1415 | ||
1392 | return ndlp->nlp_state; | 1416 | return ndlp->nlp_state; |
@@ -1424,7 +1448,7 @@ lpfc_rcv_logo_mapped_node(struct lpfc_hba * phba, | |||
1424 | 1448 | ||
1425 | cmdiocb = (struct lpfc_iocbq *) arg; | 1449 | cmdiocb = (struct lpfc_iocbq *) arg; |
1426 | 1450 | ||
1427 | lpfc_rcv_logo(phba, ndlp, cmdiocb); | 1451 | lpfc_rcv_logo(phba, ndlp, cmdiocb, ELS_CMD_LOGO); |
1428 | return ndlp->nlp_state; | 1452 | return ndlp->nlp_state; |
1429 | } | 1453 | } |
1430 | 1454 | ||
@@ -1456,7 +1480,7 @@ lpfc_rcv_prlo_mapped_node(struct lpfc_hba * phba, | |||
1456 | spin_unlock_irq(phba->host->host_lock); | 1480 | spin_unlock_irq(phba->host->host_lock); |
1457 | 1481 | ||
1458 | /* Treat like rcv logo */ | 1482 | /* Treat like rcv logo */ |
1459 | lpfc_rcv_logo(phba, ndlp, cmdiocb); | 1483 | lpfc_rcv_logo(phba, ndlp, cmdiocb, ELS_CMD_PRLO); |
1460 | return ndlp->nlp_state; | 1484 | return ndlp->nlp_state; |
1461 | } | 1485 | } |
1462 | 1486 | ||
@@ -1469,7 +1493,7 @@ lpfc_device_recov_mapped_node(struct lpfc_hba * phba, | |||
1469 | ndlp->nlp_state = NLP_STE_NPR_NODE; | 1493 | ndlp->nlp_state = NLP_STE_NPR_NODE; |
1470 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); | 1494 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); |
1471 | spin_lock_irq(phba->host->host_lock); | 1495 | spin_lock_irq(phba->host->host_lock); |
1472 | ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; | 1496 | ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); |
1473 | spin_unlock_irq(phba->host->host_lock); | 1497 | spin_unlock_irq(phba->host->host_lock); |
1474 | lpfc_disc_set_adisc(phba, ndlp); | 1498 | lpfc_disc_set_adisc(phba, ndlp); |
1475 | return ndlp->nlp_state; | 1499 | return ndlp->nlp_state; |
@@ -1551,7 +1575,7 @@ lpfc_rcv_logo_npr_node(struct lpfc_hba * phba, | |||
1551 | 1575 | ||
1552 | cmdiocb = (struct lpfc_iocbq *) arg; | 1576 | cmdiocb = (struct lpfc_iocbq *) arg; |
1553 | 1577 | ||
1554 | lpfc_rcv_logo(phba, ndlp, cmdiocb); | 1578 | lpfc_rcv_logo(phba, ndlp, cmdiocb, ELS_CMD_LOGO); |
1555 | return ndlp->nlp_state; | 1579 | return ndlp->nlp_state; |
1556 | } | 1580 | } |
1557 | 1581 | ||
@@ -1617,9 +1641,16 @@ lpfc_cmpl_plogi_npr_node(struct lpfc_hba * phba, | |||
1617 | struct lpfc_nodelist * ndlp, void *arg, uint32_t evt) | 1641 | struct lpfc_nodelist * ndlp, void *arg, uint32_t evt) |
1618 | { | 1642 | { |
1619 | struct lpfc_iocbq *cmdiocb, *rspiocb; | 1643 | struct lpfc_iocbq *cmdiocb, *rspiocb; |
1644 | IOCB_t *irsp; | ||
1620 | 1645 | ||
1621 | cmdiocb = (struct lpfc_iocbq *) arg; | 1646 | cmdiocb = (struct lpfc_iocbq *) arg; |
1622 | rspiocb = cmdiocb->context_un.rsp_iocb; | 1647 | rspiocb = cmdiocb->context_un.rsp_iocb; |
1648 | |||
1649 | irsp = &rspiocb->iocb; | ||
1650 | if (irsp->ulpStatus) { | ||
1651 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | ||
1652 | return NLP_STE_FREED_NODE; | ||
1653 | } | ||
1623 | return ndlp->nlp_state; | 1654 | return ndlp->nlp_state; |
1624 | } | 1655 | } |
1625 | 1656 | ||
@@ -1628,9 +1659,16 @@ lpfc_cmpl_prli_npr_node(struct lpfc_hba * phba, | |||
1628 | struct lpfc_nodelist * ndlp, void *arg, uint32_t evt) | 1659 | struct lpfc_nodelist * ndlp, void *arg, uint32_t evt) |
1629 | { | 1660 | { |
1630 | struct lpfc_iocbq *cmdiocb, *rspiocb; | 1661 | struct lpfc_iocbq *cmdiocb, *rspiocb; |
1662 | IOCB_t *irsp; | ||
1631 | 1663 | ||
1632 | cmdiocb = (struct lpfc_iocbq *) arg; | 1664 | cmdiocb = (struct lpfc_iocbq *) arg; |
1633 | rspiocb = cmdiocb->context_un.rsp_iocb; | 1665 | rspiocb = cmdiocb->context_un.rsp_iocb; |
1666 | |||
1667 | irsp = &rspiocb->iocb; | ||
1668 | if (irsp->ulpStatus && (ndlp->nlp_flag & NLP_NODEV_REMOVE)) { | ||
1669 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | ||
1670 | return NLP_STE_FREED_NODE; | ||
1671 | } | ||
1634 | return ndlp->nlp_state; | 1672 | return ndlp->nlp_state; |
1635 | } | 1673 | } |
1636 | 1674 | ||
@@ -1649,9 +1687,16 @@ lpfc_cmpl_adisc_npr_node(struct lpfc_hba * phba, | |||
1649 | uint32_t evt) | 1687 | uint32_t evt) |
1650 | { | 1688 | { |
1651 | struct lpfc_iocbq *cmdiocb, *rspiocb; | 1689 | struct lpfc_iocbq *cmdiocb, *rspiocb; |
1690 | IOCB_t *irsp; | ||
1652 | 1691 | ||
1653 | cmdiocb = (struct lpfc_iocbq *) arg; | 1692 | cmdiocb = (struct lpfc_iocbq *) arg; |
1654 | rspiocb = cmdiocb->context_un.rsp_iocb; | 1693 | rspiocb = cmdiocb->context_un.rsp_iocb; |
1694 | |||
1695 | irsp = &rspiocb->iocb; | ||
1696 | if (irsp->ulpStatus && (ndlp->nlp_flag & NLP_NODEV_REMOVE)) { | ||
1697 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | ||
1698 | return NLP_STE_FREED_NODE; | ||
1699 | } | ||
1655 | return ndlp->nlp_state; | 1700 | return ndlp->nlp_state; |
1656 | } | 1701 | } |
1657 | 1702 | ||
@@ -1668,7 +1713,12 @@ lpfc_cmpl_reglogin_npr_node(struct lpfc_hba * phba, | |||
1668 | 1713 | ||
1669 | if (!mb->mbxStatus) | 1714 | if (!mb->mbxStatus) |
1670 | ndlp->nlp_rpi = mb->un.varWords[0]; | 1715 | ndlp->nlp_rpi = mb->un.varWords[0]; |
1671 | 1716 | else { | |
1717 | if (ndlp->nlp_flag & NLP_NODEV_REMOVE) { | ||
1718 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | ||
1719 | return NLP_STE_FREED_NODE; | ||
1720 | } | ||
1721 | } | ||
1672 | return ndlp->nlp_state; | 1722 | return ndlp->nlp_state; |
1673 | } | 1723 | } |
1674 | 1724 | ||
@@ -1677,6 +1727,10 @@ lpfc_device_rm_npr_node(struct lpfc_hba * phba, | |||
1677 | struct lpfc_nodelist * ndlp, void *arg, | 1727 | struct lpfc_nodelist * ndlp, void *arg, |
1678 | uint32_t evt) | 1728 | uint32_t evt) |
1679 | { | 1729 | { |
1730 | if (ndlp->nlp_flag & NLP_NPR_2B_DISC) { | ||
1731 | ndlp->nlp_flag |= NLP_NODEV_REMOVE; | ||
1732 | return ndlp->nlp_state; | ||
1733 | } | ||
1680 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 1734 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); |
1681 | return NLP_STE_FREED_NODE; | 1735 | return NLP_STE_FREED_NODE; |
1682 | } | 1736 | } |
@@ -1687,7 +1741,7 @@ lpfc_device_recov_npr_node(struct lpfc_hba * phba, | |||
1687 | uint32_t evt) | 1741 | uint32_t evt) |
1688 | { | 1742 | { |
1689 | spin_lock_irq(phba->host->host_lock); | 1743 | spin_lock_irq(phba->host->host_lock); |
1690 | ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; | 1744 | ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); |
1691 | spin_unlock_irq(phba->host->host_lock); | 1745 | spin_unlock_irq(phba->host->host_lock); |
1692 | if (ndlp->nlp_flag & NLP_DELAY_TMO) { | 1746 | if (ndlp->nlp_flag & NLP_DELAY_TMO) { |
1693 | lpfc_cancel_retry_delay_tmo(phba, ndlp); | 1747 | lpfc_cancel_retry_delay_tmo(phba, ndlp); |
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index f93799873721..7dc4c2e6bed2 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c | |||
@@ -629,8 +629,7 @@ lpfc_scsi_prep_task_mgmt_cmd(struct lpfc_hba *phba, | |||
629 | struct lpfc_iocbq *piocbq; | 629 | struct lpfc_iocbq *piocbq; |
630 | IOCB_t *piocb; | 630 | IOCB_t *piocb; |
631 | struct fcp_cmnd *fcp_cmnd; | 631 | struct fcp_cmnd *fcp_cmnd; |
632 | struct scsi_device *scsi_dev = lpfc_cmd->pCmd->device; | 632 | struct lpfc_rport_data *rdata = lpfc_cmd->rdata; |
633 | struct lpfc_rport_data *rdata = scsi_dev->hostdata; | ||
634 | struct lpfc_nodelist *ndlp = rdata->pnode; | 633 | struct lpfc_nodelist *ndlp = rdata->pnode; |
635 | 634 | ||
636 | if ((ndlp == NULL) || (ndlp->nlp_state != NLP_STE_MAPPED_NODE)) { | 635 | if ((ndlp == NULL) || (ndlp->nlp_state != NLP_STE_MAPPED_NODE)) { |
@@ -665,56 +664,18 @@ lpfc_scsi_prep_task_mgmt_cmd(struct lpfc_hba *phba, | |||
665 | piocb->ulpTimeout = lpfc_cmd->timeout; | 664 | piocb->ulpTimeout = lpfc_cmd->timeout; |
666 | } | 665 | } |
667 | 666 | ||
668 | lpfc_cmd->rdata = rdata; | ||
669 | |||
670 | switch (task_mgmt_cmd) { | ||
671 | case FCP_LUN_RESET: | ||
672 | /* Issue LUN Reset to TGT <num> LUN <num> */ | ||
673 | lpfc_printf_log(phba, | ||
674 | KERN_INFO, | ||
675 | LOG_FCP, | ||
676 | "%d:0703 Issue LUN Reset to TGT %d LUN %d " | ||
677 | "Data: x%x x%x\n", | ||
678 | phba->brd_no, | ||
679 | scsi_dev->id, scsi_dev->lun, | ||
680 | ndlp->nlp_rpi, ndlp->nlp_flag); | ||
681 | |||
682 | break; | ||
683 | case FCP_ABORT_TASK_SET: | ||
684 | /* Issue Abort Task Set to TGT <num> LUN <num> */ | ||
685 | lpfc_printf_log(phba, | ||
686 | KERN_INFO, | ||
687 | LOG_FCP, | ||
688 | "%d:0701 Issue Abort Task Set to TGT %d LUN %d " | ||
689 | "Data: x%x x%x\n", | ||
690 | phba->brd_no, | ||
691 | scsi_dev->id, scsi_dev->lun, | ||
692 | ndlp->nlp_rpi, ndlp->nlp_flag); | ||
693 | |||
694 | break; | ||
695 | case FCP_TARGET_RESET: | ||
696 | /* Issue Target Reset to TGT <num> */ | ||
697 | lpfc_printf_log(phba, | ||
698 | KERN_INFO, | ||
699 | LOG_FCP, | ||
700 | "%d:0702 Issue Target Reset to TGT %d " | ||
701 | "Data: x%x x%x\n", | ||
702 | phba->brd_no, | ||
703 | scsi_dev->id, ndlp->nlp_rpi, | ||
704 | ndlp->nlp_flag); | ||
705 | break; | ||
706 | } | ||
707 | |||
708 | return (1); | 667 | return (1); |
709 | } | 668 | } |
710 | 669 | ||
711 | static int | 670 | static int |
712 | lpfc_scsi_tgt_reset(struct lpfc_scsi_buf * lpfc_cmd, struct lpfc_hba * phba) | 671 | lpfc_scsi_tgt_reset(struct lpfc_scsi_buf * lpfc_cmd, struct lpfc_hba * phba, |
672 | unsigned tgt_id, struct lpfc_rport_data *rdata) | ||
713 | { | 673 | { |
714 | struct lpfc_iocbq *iocbq; | 674 | struct lpfc_iocbq *iocbq; |
715 | struct lpfc_iocbq *iocbqrsp; | 675 | struct lpfc_iocbq *iocbqrsp; |
716 | int ret; | 676 | int ret; |
717 | 677 | ||
678 | lpfc_cmd->rdata = rdata; | ||
718 | ret = lpfc_scsi_prep_task_mgmt_cmd(phba, lpfc_cmd, FCP_TARGET_RESET); | 679 | ret = lpfc_scsi_prep_task_mgmt_cmd(phba, lpfc_cmd, FCP_TARGET_RESET); |
719 | if (!ret) | 680 | if (!ret) |
720 | return FAILED; | 681 | return FAILED; |
@@ -726,6 +687,13 @@ lpfc_scsi_tgt_reset(struct lpfc_scsi_buf * lpfc_cmd, struct lpfc_hba * phba) | |||
726 | if (!iocbqrsp) | 687 | if (!iocbqrsp) |
727 | return FAILED; | 688 | return FAILED; |
728 | 689 | ||
690 | /* Issue Target Reset to TGT <num> */ | ||
691 | lpfc_printf_log(phba, KERN_INFO, LOG_FCP, | ||
692 | "%d:0702 Issue Target Reset to TGT %d " | ||
693 | "Data: x%x x%x\n", | ||
694 | phba->brd_no, tgt_id, rdata->pnode->nlp_rpi, | ||
695 | rdata->pnode->nlp_flag); | ||
696 | |||
729 | ret = lpfc_sli_issue_iocb_wait(phba, | 697 | ret = lpfc_sli_issue_iocb_wait(phba, |
730 | &phba->sli.ring[phba->sli.fcp_ring], | 698 | &phba->sli.ring[phba->sli.fcp_ring], |
731 | iocbq, iocbqrsp, lpfc_cmd->timeout); | 699 | iocbq, iocbqrsp, lpfc_cmd->timeout); |
@@ -1021,6 +989,7 @@ lpfc_reset_lun_handler(struct scsi_cmnd *cmnd) | |||
1021 | lpfc_cmd->pCmd = cmnd; | 989 | lpfc_cmd->pCmd = cmnd; |
1022 | lpfc_cmd->timeout = 60; | 990 | lpfc_cmd->timeout = 60; |
1023 | lpfc_cmd->scsi_hba = phba; | 991 | lpfc_cmd->scsi_hba = phba; |
992 | lpfc_cmd->rdata = rdata; | ||
1024 | 993 | ||
1025 | ret = lpfc_scsi_prep_task_mgmt_cmd(phba, lpfc_cmd, FCP_LUN_RESET); | 994 | ret = lpfc_scsi_prep_task_mgmt_cmd(phba, lpfc_cmd, FCP_LUN_RESET); |
1026 | if (!ret) | 995 | if (!ret) |
@@ -1033,6 +1002,11 @@ lpfc_reset_lun_handler(struct scsi_cmnd *cmnd) | |||
1033 | if (iocbqrsp == NULL) | 1002 | if (iocbqrsp == NULL) |
1034 | goto out_free_scsi_buf; | 1003 | goto out_free_scsi_buf; |
1035 | 1004 | ||
1005 | lpfc_printf_log(phba, KERN_INFO, LOG_FCP, | ||
1006 | "%d:0703 Issue LUN Reset to TGT %d LUN %d " | ||
1007 | "Data: x%x x%x\n", phba->brd_no, cmnd->device->id, | ||
1008 | cmnd->device->lun, pnode->nlp_rpi, pnode->nlp_flag); | ||
1009 | |||
1036 | ret = lpfc_sli_issue_iocb_wait(phba, | 1010 | ret = lpfc_sli_issue_iocb_wait(phba, |
1037 | &phba->sli.ring[phba->sli.fcp_ring], | 1011 | &phba->sli.ring[phba->sli.fcp_ring], |
1038 | iocbq, iocbqrsp, lpfc_cmd->timeout); | 1012 | iocbq, iocbqrsp, lpfc_cmd->timeout); |
@@ -1104,7 +1078,6 @@ lpfc_reset_bus_handler(struct scsi_cmnd *cmnd) | |||
1104 | int match; | 1078 | int match; |
1105 | int ret = FAILED, i, err_count = 0; | 1079 | int ret = FAILED, i, err_count = 0; |
1106 | int cnt, loopcnt; | 1080 | int cnt, loopcnt; |
1107 | unsigned int midlayer_id = 0; | ||
1108 | struct lpfc_scsi_buf * lpfc_cmd; | 1081 | struct lpfc_scsi_buf * lpfc_cmd; |
1109 | 1082 | ||
1110 | lpfc_block_requests(phba); | 1083 | lpfc_block_requests(phba); |
@@ -1124,7 +1097,6 @@ lpfc_reset_bus_handler(struct scsi_cmnd *cmnd) | |||
1124 | * targets known to the driver. Should any target reset | 1097 | * targets known to the driver. Should any target reset |
1125 | * fail, this routine returns failure to the midlayer. | 1098 | * fail, this routine returns failure to the midlayer. |
1126 | */ | 1099 | */ |
1127 | midlayer_id = cmnd->device->id; | ||
1128 | for (i = 0; i < MAX_FCP_TARGET; i++) { | 1100 | for (i = 0; i < MAX_FCP_TARGET; i++) { |
1129 | /* Search the mapped list for this target ID */ | 1101 | /* Search the mapped list for this target ID */ |
1130 | match = 0; | 1102 | match = 0; |
@@ -1137,9 +1109,8 @@ lpfc_reset_bus_handler(struct scsi_cmnd *cmnd) | |||
1137 | if (!match) | 1109 | if (!match) |
1138 | continue; | 1110 | continue; |
1139 | 1111 | ||
1140 | lpfc_cmd->pCmd->device->id = i; | 1112 | ret = lpfc_scsi_tgt_reset(lpfc_cmd, phba, |
1141 | lpfc_cmd->pCmd->device->hostdata = ndlp->rport->dd_data; | 1113 | i, ndlp->rport->dd_data); |
1142 | ret = lpfc_scsi_tgt_reset(lpfc_cmd, phba); | ||
1143 | if (ret != SUCCESS) { | 1114 | if (ret != SUCCESS) { |
1144 | lpfc_printf_log(phba, KERN_ERR, LOG_FCP, | 1115 | lpfc_printf_log(phba, KERN_ERR, LOG_FCP, |
1145 | "%d:0713 Bus Reset on target %d failed\n", | 1116 | "%d:0713 Bus Reset on target %d failed\n", |
@@ -1158,7 +1129,6 @@ lpfc_reset_bus_handler(struct scsi_cmnd *cmnd) | |||
1158 | * the targets. Unfortunately, some targets do not abide by | 1129 | * the targets. Unfortunately, some targets do not abide by |
1159 | * this forcing the driver to double check. | 1130 | * this forcing the driver to double check. |
1160 | */ | 1131 | */ |
1161 | cmnd->device->id = midlayer_id; | ||
1162 | cnt = lpfc_sli_sum_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring], | 1132 | cnt = lpfc_sli_sum_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring], |
1163 | 0, 0, LPFC_CTX_HOST); | 1133 | 0, 0, LPFC_CTX_HOST); |
1164 | if (cnt) | 1134 | if (cnt) |
diff --git a/drivers/scsi/lpfc/lpfc_version.h b/drivers/scsi/lpfc/lpfc_version.h index 4cf1366108b7..6b737568b831 100644 --- a/drivers/scsi/lpfc/lpfc_version.h +++ b/drivers/scsi/lpfc/lpfc_version.h | |||
@@ -18,7 +18,7 @@ | |||
18 | * included with this package. * | 18 | * included with this package. * |
19 | *******************************************************************/ | 19 | *******************************************************************/ |
20 | 20 | ||
21 | #define LPFC_DRIVER_VERSION "8.1.4" | 21 | #define LPFC_DRIVER_VERSION "8.1.6" |
22 | 22 | ||
23 | #define LPFC_DRIVER_NAME "lpfc" | 23 | #define LPFC_DRIVER_NAME "lpfc" |
24 | 24 | ||
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c index 80b68a2481b3..de35ffe2f79d 100644 --- a/drivers/scsi/megaraid.c +++ b/drivers/scsi/megaraid.c | |||
@@ -4471,7 +4471,6 @@ mega_internal_command(adapter_t *adapter, megacmd_t *mc, mega_passthru *pthru) | |||
4471 | { | 4471 | { |
4472 | Scsi_Cmnd *scmd; | 4472 | Scsi_Cmnd *scmd; |
4473 | struct scsi_device *sdev; | 4473 | struct scsi_device *sdev; |
4474 | unsigned long flags = 0; | ||
4475 | scb_t *scb; | 4474 | scb_t *scb; |
4476 | int rval; | 4475 | int rval; |
4477 | 4476 | ||
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c index c11e5ce6865e..bec1424eda85 100644 --- a/drivers/scsi/megaraid/megaraid_mbox.c +++ b/drivers/scsi/megaraid/megaraid_mbox.c | |||
@@ -10,7 +10,7 @@ | |||
10 | * 2 of the License, or (at your option) any later version. | 10 | * 2 of the License, or (at your option) any later version. |
11 | * | 11 | * |
12 | * FILE : megaraid_mbox.c | 12 | * FILE : megaraid_mbox.c |
13 | * Version : v2.20.4.7 (Nov 14 2005) | 13 | * Version : v2.20.4.8 (Apr 11 2006) |
14 | * | 14 | * |
15 | * Authors: | 15 | * Authors: |
16 | * Atul Mukker <Atul.Mukker@lsil.com> | 16 | * Atul Mukker <Atul.Mukker@lsil.com> |
@@ -2278,6 +2278,7 @@ megaraid_mbox_dpc(unsigned long devp) | |||
2278 | unsigned long flags; | 2278 | unsigned long flags; |
2279 | uint8_t c; | 2279 | uint8_t c; |
2280 | int status; | 2280 | int status; |
2281 | uioc_t *kioc; | ||
2281 | 2282 | ||
2282 | 2283 | ||
2283 | if (!adapter) return; | 2284 | if (!adapter) return; |
@@ -2320,6 +2321,9 @@ megaraid_mbox_dpc(unsigned long devp) | |||
2320 | // remove from local clist | 2321 | // remove from local clist |
2321 | list_del_init(&scb->list); | 2322 | list_del_init(&scb->list); |
2322 | 2323 | ||
2324 | kioc = (uioc_t *)scb->gp; | ||
2325 | kioc->status = 0; | ||
2326 | |||
2323 | megaraid_mbox_mm_done(adapter, scb); | 2327 | megaraid_mbox_mm_done(adapter, scb); |
2324 | 2328 | ||
2325 | continue; | 2329 | continue; |
@@ -2636,6 +2640,7 @@ megaraid_reset_handler(struct scsi_cmnd *scp) | |||
2636 | int recovery_window; | 2640 | int recovery_window; |
2637 | int recovering; | 2641 | int recovering; |
2638 | int i; | 2642 | int i; |
2643 | uioc_t *kioc; | ||
2639 | 2644 | ||
2640 | adapter = SCP2ADAPTER(scp); | 2645 | adapter = SCP2ADAPTER(scp); |
2641 | raid_dev = ADAP2RAIDDEV(adapter); | 2646 | raid_dev = ADAP2RAIDDEV(adapter); |
@@ -2655,32 +2660,51 @@ megaraid_reset_handler(struct scsi_cmnd *scp) | |||
2655 | // Also, reset all the commands currently owned by the driver | 2660 | // Also, reset all the commands currently owned by the driver |
2656 | spin_lock_irqsave(PENDING_LIST_LOCK(adapter), flags); | 2661 | spin_lock_irqsave(PENDING_LIST_LOCK(adapter), flags); |
2657 | list_for_each_entry_safe(scb, tmp, &adapter->pend_list, list) { | 2662 | list_for_each_entry_safe(scb, tmp, &adapter->pend_list, list) { |
2658 | |||
2659 | list_del_init(&scb->list); // from pending list | 2663 | list_del_init(&scb->list); // from pending list |
2660 | 2664 | ||
2661 | con_log(CL_ANN, (KERN_WARNING | 2665 | if (scb->sno >= MBOX_MAX_SCSI_CMDS) { |
2662 | "megaraid: %ld:%d[%d:%d], reset from pending list\n", | 2666 | con_log(CL_ANN, (KERN_WARNING |
2663 | scp->serial_number, scb->sno, | 2667 | "megaraid: IOCTL packet with %d[%d:%d] being reset\n", |
2664 | scb->dev_channel, scb->dev_target)); | 2668 | scb->sno, scb->dev_channel, scb->dev_target)); |
2665 | 2669 | ||
2666 | scp->result = (DID_RESET << 16); | 2670 | scb->status = -1; |
2667 | scp->scsi_done(scp); | ||
2668 | 2671 | ||
2669 | megaraid_dealloc_scb(adapter, scb); | 2672 | kioc = (uioc_t *)scb->gp; |
2673 | kioc->status = -EFAULT; | ||
2674 | |||
2675 | megaraid_mbox_mm_done(adapter, scb); | ||
2676 | } else { | ||
2677 | if (scb->scp == scp) { // Found command | ||
2678 | con_log(CL_ANN, (KERN_WARNING | ||
2679 | "megaraid: %ld:%d[%d:%d], reset from pending list\n", | ||
2680 | scp->serial_number, scb->sno, | ||
2681 | scb->dev_channel, scb->dev_target)); | ||
2682 | } else { | ||
2683 | con_log(CL_ANN, (KERN_WARNING | ||
2684 | "megaraid: IO packet with %d[%d:%d] being reset\n", | ||
2685 | scb->sno, scb->dev_channel, scb->dev_target)); | ||
2686 | } | ||
2687 | |||
2688 | scb->scp->result = (DID_RESET << 16); | ||
2689 | scb->scp->scsi_done(scb->scp); | ||
2690 | |||
2691 | megaraid_dealloc_scb(adapter, scb); | ||
2692 | } | ||
2670 | } | 2693 | } |
2671 | spin_unlock_irqrestore(PENDING_LIST_LOCK(adapter), flags); | 2694 | spin_unlock_irqrestore(PENDING_LIST_LOCK(adapter), flags); |
2672 | 2695 | ||
2673 | if (adapter->outstanding_cmds) { | 2696 | if (adapter->outstanding_cmds) { |
2674 | con_log(CL_ANN, (KERN_NOTICE | 2697 | con_log(CL_ANN, (KERN_NOTICE |
2675 | "megaraid: %d outstanding commands. Max wait %d sec\n", | 2698 | "megaraid: %d outstanding commands. Max wait %d sec\n", |
2676 | adapter->outstanding_cmds, MBOX_RESET_WAIT)); | 2699 | adapter->outstanding_cmds, |
2700 | (MBOX_RESET_WAIT + MBOX_RESET_EXT_WAIT))); | ||
2677 | } | 2701 | } |
2678 | 2702 | ||
2679 | recovery_window = MBOX_RESET_WAIT + MBOX_RESET_EXT_WAIT; | 2703 | recovery_window = MBOX_RESET_WAIT + MBOX_RESET_EXT_WAIT; |
2680 | 2704 | ||
2681 | recovering = adapter->outstanding_cmds; | 2705 | recovering = adapter->outstanding_cmds; |
2682 | 2706 | ||
2683 | for (i = 0; i < recovery_window && adapter->outstanding_cmds; i++) { | 2707 | for (i = 0; i < recovery_window; i++) { |
2684 | 2708 | ||
2685 | megaraid_ack_sequence(adapter); | 2709 | megaraid_ack_sequence(adapter); |
2686 | 2710 | ||
@@ -2689,12 +2713,11 @@ megaraid_reset_handler(struct scsi_cmnd *scp) | |||
2689 | con_log(CL_ANN, ( | 2713 | con_log(CL_ANN, ( |
2690 | "megaraid mbox: Wait for %d commands to complete:%d\n", | 2714 | "megaraid mbox: Wait for %d commands to complete:%d\n", |
2691 | adapter->outstanding_cmds, | 2715 | adapter->outstanding_cmds, |
2692 | MBOX_RESET_WAIT - i)); | 2716 | (MBOX_RESET_WAIT + MBOX_RESET_EXT_WAIT) - i)); |
2693 | } | 2717 | } |
2694 | 2718 | ||
2695 | // bailout if no recovery happended in reset time | 2719 | // bailout if no recovery happended in reset time |
2696 | if ((i == MBOX_RESET_WAIT) && | 2720 | if (adapter->outstanding_cmds == 0) { |
2697 | (recovering == adapter->outstanding_cmds)) { | ||
2698 | break; | 2721 | break; |
2699 | } | 2722 | } |
2700 | 2723 | ||
@@ -2918,12 +2941,13 @@ mbox_post_sync_cmd_fast(adapter_t *adapter, uint8_t raw_mbox[]) | |||
2918 | wmb(); | 2941 | wmb(); |
2919 | WRINDOOR(raid_dev, raid_dev->mbox_dma | 0x1); | 2942 | WRINDOOR(raid_dev, raid_dev->mbox_dma | 0x1); |
2920 | 2943 | ||
2921 | for (i = 0; i < 0xFFFFF; i++) { | 2944 | for (i = 0; i < MBOX_SYNC_WAIT_CNT; i++) { |
2922 | if (mbox->numstatus != 0xFF) break; | 2945 | if (mbox->numstatus != 0xFF) break; |
2923 | rmb(); | 2946 | rmb(); |
2947 | udelay(MBOX_SYNC_DELAY_200); | ||
2924 | } | 2948 | } |
2925 | 2949 | ||
2926 | if (i == 0xFFFFF) { | 2950 | if (i == MBOX_SYNC_WAIT_CNT) { |
2927 | // We may need to re-calibrate the counter | 2951 | // We may need to re-calibrate the counter |
2928 | con_log(CL_ANN, (KERN_CRIT | 2952 | con_log(CL_ANN, (KERN_CRIT |
2929 | "megaraid: fast sync command timed out\n")); | 2953 | "megaraid: fast sync command timed out\n")); |
@@ -3475,7 +3499,7 @@ megaraid_cmm_register(adapter_t *adapter) | |||
3475 | adp.drvr_data = (unsigned long)adapter; | 3499 | adp.drvr_data = (unsigned long)adapter; |
3476 | adp.pdev = adapter->pdev; | 3500 | adp.pdev = adapter->pdev; |
3477 | adp.issue_uioc = megaraid_mbox_mm_handler; | 3501 | adp.issue_uioc = megaraid_mbox_mm_handler; |
3478 | adp.timeout = 300; | 3502 | adp.timeout = MBOX_RESET_WAIT + MBOX_RESET_EXT_WAIT; |
3479 | adp.max_kioc = MBOX_MAX_USER_CMDS; | 3503 | adp.max_kioc = MBOX_MAX_USER_CMDS; |
3480 | 3504 | ||
3481 | if ((rval = mraid_mm_register_adp(&adp)) != 0) { | 3505 | if ((rval = mraid_mm_register_adp(&adp)) != 0) { |
@@ -3702,7 +3726,6 @@ megaraid_mbox_mm_done(adapter_t *adapter, scb_t *scb) | |||
3702 | unsigned long flags; | 3726 | unsigned long flags; |
3703 | 3727 | ||
3704 | kioc = (uioc_t *)scb->gp; | 3728 | kioc = (uioc_t *)scb->gp; |
3705 | kioc->status = 0; | ||
3706 | mbox64 = (mbox64_t *)(unsigned long)kioc->cmdbuf; | 3729 | mbox64 = (mbox64_t *)(unsigned long)kioc->cmdbuf; |
3707 | mbox64->mbox32.status = scb->status; | 3730 | mbox64->mbox32.status = scb->status; |
3708 | raw_mbox = (uint8_t *)&mbox64->mbox32; | 3731 | raw_mbox = (uint8_t *)&mbox64->mbox32; |
diff --git a/drivers/scsi/megaraid/megaraid_mbox.h b/drivers/scsi/megaraid/megaraid_mbox.h index 882fb1a0b575..868fb0ec93e7 100644 --- a/drivers/scsi/megaraid/megaraid_mbox.h +++ b/drivers/scsi/megaraid/megaraid_mbox.h | |||
@@ -21,8 +21,8 @@ | |||
21 | #include "megaraid_ioctl.h" | 21 | #include "megaraid_ioctl.h" |
22 | 22 | ||
23 | 23 | ||
24 | #define MEGARAID_VERSION "2.20.4.7" | 24 | #define MEGARAID_VERSION "2.20.4.8" |
25 | #define MEGARAID_EXT_VERSION "(Release Date: Mon Nov 14 12:27:22 EST 2005)" | 25 | #define MEGARAID_EXT_VERSION "(Release Date: Mon Apr 11 12:27:22 EST 2006)" |
26 | 26 | ||
27 | 27 | ||
28 | /* | 28 | /* |
@@ -100,6 +100,9 @@ | |||
100 | #define MBOX_BUSY_WAIT 10 // max usec to wait for busy mailbox | 100 | #define MBOX_BUSY_WAIT 10 // max usec to wait for busy mailbox |
101 | #define MBOX_RESET_WAIT 180 // wait these many seconds in reset | 101 | #define MBOX_RESET_WAIT 180 // wait these many seconds in reset |
102 | #define MBOX_RESET_EXT_WAIT 120 // extended wait reset | 102 | #define MBOX_RESET_EXT_WAIT 120 // extended wait reset |
103 | #define MBOX_SYNC_WAIT_CNT 0xFFFF // wait loop index for synchronous mode | ||
104 | |||
105 | #define MBOX_SYNC_DELAY_200 200 // 200 micro-seconds | ||
103 | 106 | ||
104 | /* | 107 | /* |
105 | * maximum transfer that can happen through the firmware commands issued | 108 | * maximum transfer that can happen through the firmware commands issued |
diff --git a/drivers/scsi/megaraid/megaraid_mm.c b/drivers/scsi/megaraid/megaraid_mm.c index 8f3ce0432295..e8f534fb336b 100644 --- a/drivers/scsi/megaraid/megaraid_mm.c +++ b/drivers/scsi/megaraid/megaraid_mm.c | |||
@@ -898,10 +898,8 @@ mraid_mm_register_adp(mraid_mmadp_t *lld_adp) | |||
898 | 898 | ||
899 | adapter = kmalloc(sizeof(mraid_mmadp_t), GFP_KERNEL); | 899 | adapter = kmalloc(sizeof(mraid_mmadp_t), GFP_KERNEL); |
900 | 900 | ||
901 | if (!adapter) { | 901 | if (!adapter) |
902 | rval = -ENOMEM; | 902 | return -ENOMEM; |
903 | goto memalloc_error; | ||
904 | } | ||
905 | 903 | ||
906 | memset(adapter, 0, sizeof(mraid_mmadp_t)); | 904 | memset(adapter, 0, sizeof(mraid_mmadp_t)); |
907 | 905 | ||
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 017729c59a49..584fe5d8e507 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -599,6 +599,7 @@ qla2x00_wait_for_loop_ready(scsi_qla_host_t *ha) | |||
599 | * Either SUCCESS or FAILED. | 599 | * Either SUCCESS or FAILED. |
600 | * | 600 | * |
601 | * Note: | 601 | * Note: |
602 | * Only return FAILED if command not returned by firmware. | ||
602 | **************************************************************************/ | 603 | **************************************************************************/ |
603 | int | 604 | int |
604 | qla2xxx_eh_abort(struct scsi_cmnd *cmd) | 605 | qla2xxx_eh_abort(struct scsi_cmnd *cmd) |
@@ -609,11 +610,12 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) | |||
609 | unsigned int id, lun; | 610 | unsigned int id, lun; |
610 | unsigned long serial; | 611 | unsigned long serial; |
611 | unsigned long flags; | 612 | unsigned long flags; |
613 | int wait = 0; | ||
612 | 614 | ||
613 | if (!CMD_SP(cmd)) | 615 | if (!CMD_SP(cmd)) |
614 | return FAILED; | 616 | return SUCCESS; |
615 | 617 | ||
616 | ret = FAILED; | 618 | ret = SUCCESS; |
617 | 619 | ||
618 | id = cmd->device->id; | 620 | id = cmd->device->id; |
619 | lun = cmd->device->lun; | 621 | lun = cmd->device->lun; |
@@ -642,7 +644,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) | |||
642 | } else { | 644 | } else { |
643 | DEBUG3(printk("%s(%ld): abort_command " | 645 | DEBUG3(printk("%s(%ld): abort_command " |
644 | "mbx success.\n", __func__, ha->host_no)); | 646 | "mbx success.\n", __func__, ha->host_no)); |
645 | ret = SUCCESS; | 647 | wait = 1; |
646 | } | 648 | } |
647 | spin_lock_irqsave(&ha->hardware_lock, flags); | 649 | spin_lock_irqsave(&ha->hardware_lock, flags); |
648 | 650 | ||
@@ -651,17 +653,18 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) | |||
651 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | 653 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
652 | 654 | ||
653 | /* Wait for the command to be returned. */ | 655 | /* Wait for the command to be returned. */ |
654 | if (ret == SUCCESS) { | 656 | if (wait) { |
655 | if (qla2x00_eh_wait_on_command(ha, cmd) != QLA_SUCCESS) { | 657 | if (qla2x00_eh_wait_on_command(ha, cmd) != QLA_SUCCESS) { |
656 | qla_printk(KERN_ERR, ha, | 658 | qla_printk(KERN_ERR, ha, |
657 | "scsi(%ld:%d:%d): Abort handler timed out -- %lx " | 659 | "scsi(%ld:%d:%d): Abort handler timed out -- %lx " |
658 | "%x.\n", ha->host_no, id, lun, serial, ret); | 660 | "%x.\n", ha->host_no, id, lun, serial, ret); |
661 | ret = FAILED; | ||
659 | } | 662 | } |
660 | } | 663 | } |
661 | 664 | ||
662 | qla_printk(KERN_INFO, ha, | 665 | qla_printk(KERN_INFO, ha, |
663 | "scsi(%ld:%d:%d): Abort command issued -- %lx %x.\n", ha->host_no, | 666 | "scsi(%ld:%d:%d): Abort command issued -- %d %lx %x.\n", |
664 | id, lun, serial, ret); | 667 | ha->host_no, id, lun, wait, serial, ret); |
665 | 668 | ||
666 | return ret; | 669 | return ret; |
667 | } | 670 | } |
@@ -1700,8 +1703,8 @@ qla2x00_free_device(scsi_qla_host_t *ha) | |||
1700 | ha->flags.online = 0; | 1703 | ha->flags.online = 0; |
1701 | 1704 | ||
1702 | /* Detach interrupts */ | 1705 | /* Detach interrupts */ |
1703 | if (ha->pdev->irq) | 1706 | if (ha->host->irq) |
1704 | free_irq(ha->pdev->irq, ha); | 1707 | free_irq(ha->host->irq, ha); |
1705 | 1708 | ||
1706 | /* release io space registers */ | 1709 | /* release io space registers */ |
1707 | if (ha->iobase) | 1710 | if (ha->iobase) |
diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c index c750d3399a97..941c1e15c899 100644 --- a/drivers/scsi/scsi_devinfo.c +++ b/drivers/scsi/scsi_devinfo.c | |||
@@ -56,6 +56,8 @@ static struct { | |||
56 | {"DENON", "DRD-25X", "V", BLIST_NOLUN}, /* locks up */ | 56 | {"DENON", "DRD-25X", "V", BLIST_NOLUN}, /* locks up */ |
57 | {"HITACHI", "DK312C", "CM81", BLIST_NOLUN}, /* responds to all lun */ | 57 | {"HITACHI", "DK312C", "CM81", BLIST_NOLUN}, /* responds to all lun */ |
58 | {"HITACHI", "DK314C", "CR21", BLIST_NOLUN}, /* responds to all lun */ | 58 | {"HITACHI", "DK314C", "CR21", BLIST_NOLUN}, /* responds to all lun */ |
59 | {"IBM", "2104-DU3", NULL, BLIST_NOLUN}, /* locks up */ | ||
60 | {"IBM", "2104-TU3", NULL, BLIST_NOLUN}, /* locks up */ | ||
59 | {"IMS", "CDD521/10", "2.06", BLIST_NOLUN}, /* locks up */ | 61 | {"IMS", "CDD521/10", "2.06", BLIST_NOLUN}, /* locks up */ |
60 | {"MAXTOR", "XT-3280", "PR02", BLIST_NOLUN}, /* locks up */ | 62 | {"MAXTOR", "XT-3280", "PR02", BLIST_NOLUN}, /* locks up */ |
61 | {"MAXTOR", "XT-4380S", "B3C", BLIST_NOLUN}, /* locks up */ | 63 | {"MAXTOR", "XT-4380S", "B3C", BLIST_NOLUN}, /* locks up */ |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 7b0f9a3810d2..764a8b375ead 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -1067,16 +1067,29 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes, | |||
1067 | break; | 1067 | break; |
1068 | case NOT_READY: | 1068 | case NOT_READY: |
1069 | /* | 1069 | /* |
1070 | * If the device is in the process of becoming ready, | 1070 | * If the device is in the process of becoming |
1071 | * retry. | 1071 | * ready, or has a temporary blockage, retry. |
1072 | */ | 1072 | */ |
1073 | if (sshdr.asc == 0x04 && sshdr.ascq == 0x01) { | 1073 | if (sshdr.asc == 0x04) { |
1074 | scsi_requeue_command(q, cmd); | 1074 | switch (sshdr.ascq) { |
1075 | return; | 1075 | case 0x01: /* becoming ready */ |
1076 | case 0x04: /* format in progress */ | ||
1077 | case 0x05: /* rebuild in progress */ | ||
1078 | case 0x06: /* recalculation in progress */ | ||
1079 | case 0x07: /* operation in progress */ | ||
1080 | case 0x08: /* Long write in progress */ | ||
1081 | case 0x09: /* self test in progress */ | ||
1082 | scsi_requeue_command(q, cmd); | ||
1083 | return; | ||
1084 | default: | ||
1085 | break; | ||
1086 | } | ||
1076 | } | 1087 | } |
1077 | if (!(req->flags & REQ_QUIET)) | 1088 | if (!(req->flags & REQ_QUIET)) { |
1078 | scmd_printk(KERN_INFO, cmd, | 1089 | scmd_printk(KERN_INFO, cmd, |
1079 | "Device not ready.\n"); | 1090 | "Device not ready: "); |
1091 | scsi_print_sense_hdr("", &sshdr); | ||
1092 | } | ||
1080 | scsi_end_request(cmd, 0, this_count, 1); | 1093 | scsi_end_request(cmd, 0, this_count, 1); |
1081 | return; | 1094 | return; |
1082 | case VOLUME_OVERFLOW: | 1095 | case VOLUME_OVERFLOW: |
diff --git a/drivers/scsi/sim710.c b/drivers/scsi/sim710.c index 3274ab76c8d3..255886a9ac55 100644 --- a/drivers/scsi/sim710.c +++ b/drivers/scsi/sim710.c | |||
@@ -75,7 +75,7 @@ param_setup(char *str) | |||
75 | else if(!strncmp(pos, "id:", 3)) { | 75 | else if(!strncmp(pos, "id:", 3)) { |
76 | if(slot == -1) { | 76 | if(slot == -1) { |
77 | printk(KERN_WARNING "sim710: Must specify slot for id parameter\n"); | 77 | printk(KERN_WARNING "sim710: Must specify slot for id parameter\n"); |
78 | } else if(slot > MAX_SLOTS) { | 78 | } else if(slot >= MAX_SLOTS) { |
79 | printk(KERN_WARNING "sim710: Illegal slot %d for id %d\n", slot, val); | 79 | printk(KERN_WARNING "sim710: Illegal slot %d for id %d\n", slot, val); |
80 | } else { | 80 | } else { |
81 | id_array[slot] = val; | 81 | id_array[slot] = val; |