提交 68695973 编写于 作者: N Nithin Sujir 提交者: James Bottomley

[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: NNithin Nayak Sujir <nsujir@broadcom.com>
Signed-off-by: NMichael Chan <mchan@broadcom.com>
Signed-off-by: NBhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
上级 0ea5c275
...@@ -590,7 +590,10 @@ static void bnx2fc_process_unsol_compl(struct bnx2fc_rport *tgt, u16 wqe) ...@@ -590,7 +590,10 @@ static void bnx2fc_process_unsol_compl(struct bnx2fc_rport *tgt, u16 wqe)
num_rq = (frame_len + BNX2FC_RQ_BUF_SZ - 1) / BNX2FC_RQ_BUF_SZ; num_rq = (frame_len + BNX2FC_RQ_BUF_SZ - 1) / BNX2FC_RQ_BUF_SZ;
spin_lock_bh(&tgt->tgt_lock);
rq_data = (unsigned char *)bnx2fc_get_next_rqe(tgt, num_rq); rq_data = (unsigned char *)bnx2fc_get_next_rqe(tgt, num_rq);
spin_unlock_bh(&tgt->tgt_lock);
if (rq_data) { if (rq_data) {
buf = rq_data; buf = rq_data;
} else { } else {
...@@ -603,8 +606,10 @@ static void bnx2fc_process_unsol_compl(struct bnx2fc_rport *tgt, u16 wqe) ...@@ -603,8 +606,10 @@ static void bnx2fc_process_unsol_compl(struct bnx2fc_rport *tgt, u16 wqe)
} }
for (i = 0; i < num_rq; i++) { for (i = 0; i < num_rq; i++) {
spin_lock_bh(&tgt->tgt_lock);
rq_data = (unsigned char *) rq_data = (unsigned char *)
bnx2fc_get_next_rqe(tgt, 1); bnx2fc_get_next_rqe(tgt, 1);
spin_unlock_bh(&tgt->tgt_lock);
len = BNX2FC_RQ_BUF_SZ; len = BNX2FC_RQ_BUF_SZ;
memcpy(buf1, rq_data, len); memcpy(buf1, rq_data, len);
buf1 += len; buf1 += len;
...@@ -615,13 +620,15 @@ static void bnx2fc_process_unsol_compl(struct bnx2fc_rport *tgt, u16 wqe) ...@@ -615,13 +620,15 @@ static void bnx2fc_process_unsol_compl(struct bnx2fc_rport *tgt, u16 wqe)
if (buf != rq_data) if (buf != rq_data)
kfree(buf); kfree(buf);
spin_lock_bh(&tgt->tgt_lock);
bnx2fc_return_rqe(tgt, num_rq); bnx2fc_return_rqe(tgt, num_rq);
spin_unlock_bh(&tgt->tgt_lock);
break; break;
case FCOE_ERROR_DETECTION_CQE_TYPE: case FCOE_ERROR_DETECTION_CQE_TYPE:
/* /*
*In case of error reporting CQE a single RQ entry * In case of error reporting CQE a single RQ entry
* is consumes. * is consumed.
*/ */
spin_lock_bh(&tgt->tgt_lock); spin_lock_bh(&tgt->tgt_lock);
num_rq = 1; num_rq = 1;
...@@ -705,6 +712,7 @@ static void bnx2fc_process_unsol_compl(struct bnx2fc_rport *tgt, u16 wqe) ...@@ -705,6 +712,7 @@ static void bnx2fc_process_unsol_compl(struct bnx2fc_rport *tgt, u16 wqe)
*In case of warning reporting CQE a single RQ entry *In case of warning reporting CQE a single RQ entry
* is consumes. * is consumes.
*/ */
spin_lock_bh(&tgt->tgt_lock);
num_rq = 1; num_rq = 1;
err_entry = (struct fcoe_err_report_entry *) err_entry = (struct fcoe_err_report_entry *)
bnx2fc_get_next_rqe(tgt, 1); bnx2fc_get_next_rqe(tgt, 1);
...@@ -717,6 +725,7 @@ static void bnx2fc_process_unsol_compl(struct bnx2fc_rport *tgt, u16 wqe) ...@@ -717,6 +725,7 @@ static void bnx2fc_process_unsol_compl(struct bnx2fc_rport *tgt, u16 wqe)
err_entry->tx_buf_off, err_entry->rx_buf_off); err_entry->tx_buf_off, err_entry->rx_buf_off);
bnx2fc_return_rqe(tgt, 1); bnx2fc_return_rqe(tgt, 1);
spin_unlock_bh(&tgt->tgt_lock);
break; break;
default: default:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
反馈
建议
客服 返回
顶部