From: Johannes Thumshirn <jthumshirn@suse.de>
To: Jitendra Bhivare <jitendra.bhivare@avagotech.com>
Cc: linux-scsi@vger.kernel.org, michaelc@cs.wisc.edu
Subject: Re: [PATCH 06/12] be2iscsi: Fix be_mcc_compl_poll to use tag_state
Date: Mon, 1 Feb 2016 12:29:23 +0100 [thread overview]
Message-ID: <20160201112923.GF27969@c203.arch.suse.de> (raw)
In-Reply-To: <1454321571-16167-7-git-send-email-jitendra.bhivare@avagotech.com>
On Mon, Feb 01, 2016 at 03:42:45PM +0530, Jitendra Bhivare wrote:
> be_mcc_compl_poll waits till 'used' count of MCC WRBQ is zero. This is to
> determine the completion of an MCC sent.
>
> Change function to poll for the tag of MCC sent, instead, and wait till
> its tag_state is cleared.
>
> Signed-off-by: Jitendra Bhivare <jitendra.bhivare@avagotech.com>
> ---
> drivers/scsi/be2iscsi/be_cmds.c | 92 +++++++++++++++++++++--------------------
> 1 file changed, 47 insertions(+), 45 deletions(-)
>
> diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
> index 12b60dd..60db2de 100644
> --- a/drivers/scsi/be2iscsi/be_cmds.c
> +++ b/drivers/scsi/be2iscsi/be_cmds.c
> @@ -104,19 +104,6 @@ int be_chk_reset_complete(struct beiscsi_hba *phba)
> return 0;
> }
>
> -void be_mcc_notify(struct beiscsi_hba *phba, unsigned int tag)
> -{
> - struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q;
> - u32 val = 0;
> -
> - set_bit(MCC_TAG_STATE_RUNNING, &phba->ctrl.ptag_state[tag].tag_state);
> - val |= mccq->id & DB_MCCQ_RING_ID_MASK;
> - val |= 1 << DB_MCCQ_NUM_POSTED_SHIFT;
> - /* ring doorbell after all of request and state is written */
> - wmb();
> - iowrite32(val, phba->db_va + DB_MCCQ_OFFSET);
> -}
> -
> unsigned int alloc_mcc_tag(struct beiscsi_hba *phba)
> {
> unsigned int tag = 0;
> @@ -139,6 +126,28 @@ unsigned int alloc_mcc_tag(struct beiscsi_hba *phba)
> return tag;
> }
>
> +void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag)
> +{
> + spin_lock_bh(&ctrl->mcc_lock);
> + tag = tag & MCC_Q_CMD_TAG_MASK;
> + ctrl->mcc_tag[ctrl->mcc_free_index] = tag;
> + if (ctrl->mcc_free_index == (MAX_MCC_CMD - 1))
> + ctrl->mcc_free_index = 0;
> + else
> + ctrl->mcc_free_index++;
> + ctrl->mcc_tag_available++;
> + spin_unlock_bh(&ctrl->mcc_lock);
> +}
> +
> +/**
> + * beiscsi_fail_session(): Closing session with appropriate error
> + * @cls_session: ptr to session
> + **/
> +void beiscsi_fail_session(struct iscsi_cls_session *cls_session)
> +{
> + iscsi_session_failure(cls_session->dd_data, ISCSI_ERR_CONN_FAILED);
> +}
> +
> /*
> * beiscsi_mccq_compl_wait()- Process completion in MCC CQ
> * @phba: Driver private structure
> @@ -254,19 +263,6 @@ int beiscsi_mccq_compl_wait(struct beiscsi_hba *phba,
> return rc;
> }
>
> -void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag)
> -{
> - spin_lock(&ctrl->mcc_lock);
> - tag = tag & MCC_Q_CMD_TAG_MASK;
> - ctrl->mcc_tag[ctrl->mcc_free_index] = tag;
> - if (ctrl->mcc_free_index == (MAX_MCC_CMD - 1))
> - ctrl->mcc_free_index = 0;
> - else
> - ctrl->mcc_free_index++;
> - ctrl->mcc_tag_available++;
> - spin_unlock(&ctrl->mcc_lock);
> -}
> -
> static inline bool be_mcc_compl_is_new(struct be_mcc_compl *compl)
> {
> if (compl->flags != 0) {
> @@ -328,15 +324,6 @@ static int beiscsi_process_mbox_compl(struct be_ctrl_info *ctrl,
> return 0;
> }
>
> -/**
> - * beiscsi_fail_session(): Closing session with appropriate error
> - * @cls_session: ptr to session
> - **/
> -void beiscsi_fail_session(struct iscsi_cls_session *cls_session)
> -{
> - iscsi_session_failure(cls_session->dd_data, ISCSI_ERR_CONN_FAILED);
> -}
> -
> static void beiscsi_process_async_link(struct beiscsi_hba *phba,
> struct be_mcc_compl *compl)
> {
> @@ -532,6 +519,7 @@ int beiscsi_process_mcc_compl(struct be_ctrl_info *ctrl,
> **/
> int be_mcc_compl_poll(struct beiscsi_hba *phba, unsigned int tag)
> {
> + struct be_ctrl_info *ctrl = &phba->ctrl;
> int i;
>
> for (i = 0; i < mcc_timeout; i++) {
> @@ -540,19 +528,33 @@ int be_mcc_compl_poll(struct beiscsi_hba *phba, unsigned int tag)
>
> beiscsi_process_mcc_cq(phba);
>
> - if (atomic_read(&phba->ctrl.mcc_obj.q.used) == 0)
> + if (!test_bit(MCC_TAG_STATE_RUNNING,
> + &ctrl->ptag_state[tag].tag_state))
> break;
> udelay(100);
> }
> - if (i == mcc_timeout) {
> - beiscsi_log(phba, KERN_ERR,
> - BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
> - "BC_%d : FW Timed Out\n");
> - phba->fw_timeout = true;
> - beiscsi_ue_detect(phba);
> - return -EBUSY;
> - }
> - return 0;
> +
> + if (i < mcc_timeout)
> + return 0;
> +
> + beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
> + "BC_%d : FW Timed Out\n");
> + phba->fw_timeout = true;
> + beiscsi_ue_detect(phba);
> + return -EBUSY;
> +}
> +
> +void be_mcc_notify(struct beiscsi_hba *phba, unsigned int tag)
> +{
> + struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q;
> + u32 val = 0;
> +
> + set_bit(MCC_TAG_STATE_RUNNING, &phba->ctrl.ptag_state[tag].tag_state);
> + val |= mccq->id & DB_MCCQ_RING_ID_MASK;
> + val |= 1 << DB_MCCQ_NUM_POSTED_SHIFT;
> + /* make request available for DMA */
> + wmb();
> + iowrite32(val, phba->db_va + DB_MCCQ_OFFSET);
> }
>
> /*
> --
> 2.5.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
--
Johannes Thumshirn Storage
jthumshirn@suse.de +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2016-02-01 11:29 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-01 10:12 [PATCH 00/12] be2iscsi: critical fixes for 11.0.0.0 Jitendra Bhivare
2016-02-01 10:12 ` [PATCH 01/12] be2iscsi: Remove unused mcc_cq_lock Jitendra Bhivare
2016-02-01 11:10 ` Johannes Thumshirn
2016-02-01 11:15 ` James Bottomley
2016-02-02 1:44 ` Martin K. Petersen
2016-02-01 10:12 ` [PATCH 02/12] be2iscsi: Use macros for MCC WRB and CQE fields Jitendra Bhivare
2016-02-01 11:13 ` Johannes Thumshirn
2016-02-01 10:12 ` [PATCH 03/12] be2iscsi: Remove redundant MCC processing code Jitendra Bhivare
2016-02-01 11:17 ` Johannes Thumshirn
2016-02-01 10:12 ` [PATCH 04/12] be2iscsi: Rename MCC and BMBX processing functions Jitendra Bhivare
2016-02-01 11:26 ` Johannes Thumshirn
2016-02-01 12:26 ` kbuild test robot
2016-02-01 10:12 ` [PATCH 05/12] be2iscsi: Remove be_mbox_notify_wait function Jitendra Bhivare
2016-02-01 11:27 ` Johannes Thumshirn
2016-02-01 10:12 ` [PATCH 06/12] be2iscsi: Fix be_mcc_compl_poll to use tag_state Jitendra Bhivare
2016-02-01 11:29 ` Johannes Thumshirn [this message]
2016-02-01 10:12 ` [PATCH 07/12] be2iscsi: Cleanup processing of BMBX completion Jitendra Bhivare
2016-02-01 11:41 ` Johannes Thumshirn
2016-02-01 10:12 ` [PATCH 08/12] be2iscsi: Fix MCC WRB leak in open_connection Jitendra Bhivare
2016-02-01 11:45 ` Johannes Thumshirn
2016-02-01 10:12 ` [PATCH 09/12] be2iscsi: Couple MCC tag and WRB alloc and free Jitendra Bhivare
2016-02-01 12:14 ` Johannes Thumshirn
2016-02-01 10:12 ` [PATCH 10/12] be2iscsi: Fix ExpStatSn in management tasks Jitendra Bhivare
2016-02-01 12:24 ` Johannes Thumshirn
2016-02-01 10:12 ` [PATCH 11/12] be2iscsi: _bh for io_sgl_lock and mgmt_sgl_lock Jitendra Bhivare
2016-02-01 12:26 ` Johannes Thumshirn
2016-02-01 10:12 ` [PATCH 12/12] be2iscsi: Add lock to protect WRB alloc and free Jitendra Bhivare
2016-02-01 12:27 ` Johannes Thumshirn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160201112923.GF27969@c203.arch.suse.de \
--to=jthumshirn@suse.de \
--cc=jitendra.bhivare@avagotech.com \
--cc=linux-scsi@vger.kernel.org \
--cc=michaelc@cs.wisc.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.