RE: [PATCH 12/13] scsi: fnic: Add support for multiqueue (MQ) in fnic driver

From: Karan Tilak Kumar (kartilak)
Date: Wed Oct 25 2023 - 17:30:36 EST


Hi Bart,

Thanks for your review comments. I'll fix the issues.

Regards,
Karan

-----Original Message-----
From: Bart Van Assche <bvanassche@xxxxxxx>
Sent: Wednesday, October 25, 2023 11:20 AM
To: Karan Tilak Kumar (kartilak) <kartilak@xxxxxxxxx>; Sesidhar Baddela (sebaddel) <sebaddel@xxxxxxxxx>
Cc: Arulprabhu Ponnusamy (arulponn) <arulponn@xxxxxxxxx>; Dhanraj Jhawar (djhawar) <djhawar@xxxxxxxxx>; Gian Carlo Boffa (gcboffa) <gcboffa@xxxxxxxxx>; Masa Kai (mkai2) <mkai2@xxxxxxxxx>; Satish Kharat (satishkh) <satishkh@xxxxxxxxx>; jejb@xxxxxxxxxxxxx; martin.petersen@xxxxxxxxxx; linux-scsi@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx
Subject: Re: [PATCH 12/13] scsi: fnic: Add support for multiqueue (MQ) in fnic driver

On 10/20/23 12:06, Karan Tilak Kumar wrote:
> @@ -405,22 +388,20 @@ static inline int fnic_queue_wq_copy_desc(struct fnic *fnic,
> * Routine to send a scsi cdb
> * Called with host_lock held and interrupts disabled.
> */

This patch removes the DEF_SCSI_QCMD() invocation so the above comment
is now wrong. Please fix it.

> -static int fnic_queuecommand_lck(struct scsi_cmnd *sc)
> +static int fnic_queuecommand_lck(struct scsi_cmnd *sc, uint32_t mqtag, uint16_t hwq)

Because this patch removes the DEF_SCSI_QCMD() invocation, the name of
the fnic_queuecommand_lck() function is now incorrect. Please remove the
_lck() suffix.

> -DEF_SCSI_QCMD(fnic_queuecommand)
> +int fnic_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *sc)
> +{
> + struct request *const rq = scsi_cmd_to_rq(sc);
> + int rc;
> + struct fc_lport *lp = shost_priv(sc->device->host);
> + struct fnic *fnic = lport_priv(lp);
> + uint32_t mqtag = 0;
> + int tag = 0;
> + uint16_t hwq = 0;
> +
> + mqtag = blk_mq_unique_tag(rq);
> + hwq = blk_mq_unique_tag_to_hwq(mqtag);
> + tag = blk_mq_unique_tag_to_tag(mqtag);
> +
> + if (tag >= fnic->fnic_max_tag_id) {
> + FNIC_SCSI_DBG(KERN_ERR, fnic->lport->host,
> + "fnic<%d>: %s: Out of range tag: 0x%x\n",
> + fnic->fnic_num, __func__, tag);
> + sc->result = DID_ERROR << 16;
> + scsi_done(sc);
> + return 0;
> + }
> +
> + rc = fnic_queuecommand_lck(sc, mqtag, hwq);
> + return rc;
> +}

The code guarded by "if (tag >= fnic->fnic_max_tag_id)" should be
removed and instead the driver should ensure that tags never exceed the
fnic->fnic_max_tag_id limit.

Please also remove the local variable 'rc'.

Thanks,

Bart.