linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arthur Simchaev <Arthur.Simchaev@wdc.com>
To: Arthur Simchaev <Arthur.Simchaev@wdc.com>,
	"martin.petersen@oracle.com" <martin.petersen@oracle.com>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"beanhuo@micron.com" <beanhuo@micron.com>,
	Avi Shchislowski <Avi.Shchislowski@wdc.com>
Subject: RE: [PATCH] scsi: ufs-bsg: Remove ufs_bsg_get_query_desc_size function
Date: Sun, 17 Jul 2022 11:28:07 +0000	[thread overview]
Message-ID: <BY5PR04MB632776263A4B37AEB7373DE4ED8D9@BY5PR04MB6327.namprd04.prod.outlook.com> (raw)
In-Reply-To: <1655727966-31584-1-git-send-email-Arthur.Simchaev@wdc.com>

Hi Martin

The bsg driver allows user space to send device management commands.
As such, it is often used by field application engineers to debug various problems, and as a test bed for new features as well.

Let's not bound ourself to hard coded descriptor sizes, as the new Descriptors that supports new features are not defined yet.

Please consider this patch series for kernel v5.20

Regards
Arthur

> -----Original Message-----
> From: Arthur Simchaev <Arthur.Simchaev@wdc.com>
> Sent: Monday, June 20, 2022 3:26 PM
> To: James; E.J.Bottomley; jejb@linux.vnet.ibm.com; Martin; K.Petersen;
> martin.petersen@oracle.com
> Cc: linux-scsi@vger.kernel.org; linux-kernel@vger.kernel.org; Bean; Huo;
> beanhuo@micron.com; Arthur Simchaev <Arthur.Simchaev@wdc.com>
> Subject: [PATCH] scsi: ufs-bsg: Remove ufs_bsg_get_query_desc_size function
> 
> The bsg driver allows user space to send device management commands.
> As such, it is often used by field application engineers to debug various
> problems,
> and as a test bed for new features as well.
> 
> Let's not bound ourself to hard coded descriptor sizes, as the new
> Descriptors that supports new features are not defined yet.
> 
> Signed-off-by: Arthur Simchaev <Arthur.Simchaev@wdc.com>
> ---
>  drivers/scsi/ufs/ufs_bsg.c | 28 ++++------------------------
>  1 file changed, 4 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/scsi/ufs/ufs_bsg.c b/drivers/scsi/ufs/ufs_bsg.c
> index 39bf204..7c56eba 100644
> --- a/drivers/scsi/ufs/ufs_bsg.c
> +++ b/drivers/scsi/ufs/ufs_bsg.c
> @@ -6,24 +6,6 @@
>   */
>  #include "ufs_bsg.h"
> 
> -static int ufs_bsg_get_query_desc_size(struct ufs_hba *hba, int *desc_len,
> -				       struct utp_upiu_query *qr)
> -{
> -	int desc_size = be16_to_cpu(qr->length);
> -	int desc_id = qr->idn;
> -
> -	if (desc_size <= 0)
> -		return -EINVAL;
> -
> -	ufshcd_map_desc_id_to_length(hba, desc_id, desc_len);
> -	if (!*desc_len)
> -		return -EINVAL;
> -
> -	*desc_len = min_t(int, *desc_len, desc_size);
> -
> -	return 0;
> -}
> -
>  static int ufs_bsg_verify_query_size(struct ufs_hba *hba,
>  				     unsigned int request_len,
>  				     unsigned int reply_len)
> @@ -52,13 +34,11 @@ static int ufs_bsg_alloc_desc_buffer(struct ufs_hba
> *hba, struct bsg_job *job,
>  		goto out;
> 
>  	qr = &bsg_request->upiu_req.qr;
> -	if (ufs_bsg_get_query_desc_size(hba, desc_len, qr)) {
> -		dev_err(hba->dev, "Illegal desc size\n");
> -		return -EINVAL;
> -	}
> +	*desc_len = be16_to_cpu(qr->length);
> 
> -	if (*desc_len > job->request_payload.payload_len) {
> -		dev_err(hba->dev, "Illegal desc size\n");
> +	if (*desc_len <= 0 || *desc_len > QUERY_DESC_MAX_SIZE ||
> +	    *desc_len > job->request_payload.payload_len) {
> +		dev_err(hba->dev, "Illegal desc size %d\n", *desc_len);
>  		return -EINVAL;
>  	}
> 
> --
> 2.7.4


  reply	other threads:[~2022-07-17 11:28 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-20 12:26 [PATCH] scsi: ufs-bsg: Remove ufs_bsg_get_query_desc_size function Arthur Simchaev
2022-07-17 11:28 ` Arthur Simchaev [this message]
2022-07-19  2:53   ` Martin K. Petersen
2022-08-07 23:30 ` Daniil Lunev
2022-08-16 14:32   ` Arthur Simchaev
2022-08-16 14:44   ` Arthur Simchaev
2022-08-24  9:36     ` Daniil Lunev
2022-09-11 10:35       ` Arthur Simchaev
2022-09-19  8:33         ` Arthur Simchaev
2022-09-20  3:16           ` Martin K. Petersen
2022-09-20  9:38 ` Bean Huo
2022-09-21  9:53   ` Arthur Simchaev
2022-09-28  8:33     ` Arthur Simchaev
2022-09-28 10:36       ` Bean Huo
2022-09-28 14:42         ` Arthur Simchaev
2022-09-28 17:01           ` Arthur Simchaev

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=BY5PR04MB632776263A4B37AEB7373DE4ED8D9@BY5PR04MB6327.namprd04.prod.outlook.com \
    --to=arthur.simchaev@wdc.com \
    --cc=Avi.Shchislowski@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).