diff options
author | Nithin Sujir <nsujir@broadcom.com> | 2011-03-17 20:13:31 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2011-03-23 12:37:02 -0400 |
commit | 686959736a8543265930c8d777a73b052bc57f87 (patch) | |
tree | 494b9c86d7035749ce40554d0c52f8082b96d6b8 | |
parent | 0ea5c27583e1cc164bba7ca29fe48a225f52d19b (diff) |
[SCSI] bnx2fc: Call bnx2fc_return_rqe and bnx2fc_get_next_rqe with tgt lock held
tgt lock is needed during -
bnx2fc_return_rqe to protect the rq_prod_idx.
bnx2fc_get_next_rqe to protect rq_cons_idx
Signed-off-by: Nithin Nayak Sujir <nsujir@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
-rw-r--r-- | drivers/scsi/bnx2fc/bnx2fc_hwi.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/scsi/bnx2fc/bnx2fc_hwi.c b/drivers/scsi/bnx2fc/bnx2fc_hwi.c index 4f4096836742..3de1ce73bdd3 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_hwi.c +++ b/drivers/scsi/bnx2fc/bnx2fc_hwi.c | |||
@@ -590,7 +590,10 @@ static void bnx2fc_process_unsol_compl(struct bnx2fc_rport *tgt, u16 wqe) | |||
590 | 590 | ||
591 | num_rq = (frame_len + BNX2FC_RQ_BUF_SZ - 1) / BNX2FC_RQ_BUF_SZ; | 591 | num_rq = (frame_len + BNX2FC_RQ_BUF_SZ - 1) / BNX2FC_RQ_BUF_SZ; |
592 | 592 | ||
593 | spin_lock_bh(&tgt->tgt_lock); | ||
593 | rq_data = (unsigned char *)bnx2fc_get_next_rqe(tgt, num_rq); | 594 | rq_data = (unsigned char *)bnx2fc_get_next_rqe(tgt, num_rq); |
595 | spin_unlock_bh(&tgt->tgt_lock); | ||
596 | |||
594 | if (rq_data) { | 597 | if (rq_data) { |
595 | buf = rq_data; | 598 | buf = rq_data; |
596 | } else { | 599 | } else { |
@@ -603,8 +606,10 @@ static void bnx2fc_process_unsol_compl(struct bnx2fc_rport *tgt, u16 wqe) | |||
603 | } | 606 | } |
604 | 607 | ||
605 | for (i = 0; i < num_rq; i++) { | 608 | for (i = 0; i < num_rq; i++) { |
609 | spin_lock_bh(&tgt->tgt_lock); | ||
606 | rq_data = (unsigned char *) | 610 | rq_data = (unsigned char *) |
607 | bnx2fc_get_next_rqe(tgt, 1); | 611 | bnx2fc_get_next_rqe(tgt, 1); |
612 | spin_unlock_bh(&tgt->tgt_lock); | ||
608 | len = BNX2FC_RQ_BUF_SZ; | 613 | len = BNX2FC_RQ_BUF_SZ; |
609 | memcpy(buf1, rq_data, len); | 614 | memcpy(buf1, rq_data, len); |
610 | buf1 += len; | 615 | buf1 += len; |
@@ -615,13 +620,15 @@ static void bnx2fc_process_unsol_compl(struct bnx2fc_rport *tgt, u16 wqe) | |||
615 | 620 | ||
616 | if (buf != rq_data) | 621 | if (buf != rq_data) |
617 | kfree(buf); | 622 | kfree(buf); |
623 | spin_lock_bh(&tgt->tgt_lock); | ||
618 | bnx2fc_return_rqe(tgt, num_rq); | 624 | bnx2fc_return_rqe(tgt, num_rq); |
625 | spin_unlock_bh(&tgt->tgt_lock); | ||
619 | break; | 626 | break; |
620 | 627 | ||
621 | case FCOE_ERROR_DETECTION_CQE_TYPE: | 628 | case FCOE_ERROR_DETECTION_CQE_TYPE: |
622 | /* | 629 | /* |
623 | *In case of error reporting CQE a single RQ entry | 630 | * In case of error reporting CQE a single RQ entry |
624 | * is consumes. | 631 | * is consumed. |
625 | */ | 632 | */ |
626 | spin_lock_bh(&tgt->tgt_lock); | 633 | spin_lock_bh(&tgt->tgt_lock); |
627 | num_rq = 1; | 634 | num_rq = 1; |
@@ -705,6 +712,7 @@ static void bnx2fc_process_unsol_compl(struct bnx2fc_rport *tgt, u16 wqe) | |||
705 | *In case of warning reporting CQE a single RQ entry | 712 | *In case of warning reporting CQE a single RQ entry |
706 | * is consumes. | 713 | * is consumes. |
707 | */ | 714 | */ |
715 | spin_lock_bh(&tgt->tgt_lock); | ||
708 | num_rq = 1; | 716 | num_rq = 1; |
709 | err_entry = (struct fcoe_err_report_entry *) | 717 | err_entry = (struct fcoe_err_report_entry *) |
710 | bnx2fc_get_next_rqe(tgt, 1); | 718 | bnx2fc_get_next_rqe(tgt, 1); |
@@ -717,6 +725,7 @@ static void bnx2fc_process_unsol_compl(struct bnx2fc_rport *tgt, u16 wqe) | |||
717 | err_entry->tx_buf_off, err_entry->rx_buf_off); | 725 | err_entry->tx_buf_off, err_entry->rx_buf_off); |
718 | 726 | ||
719 | bnx2fc_return_rqe(tgt, 1); | 727 | bnx2fc_return_rqe(tgt, 1); |
728 | spin_unlock_bh(&tgt->tgt_lock); | ||
720 | break; | 729 | break; |
721 | 730 | ||
722 | default: | 731 | default: |