* [PATCH 0/2] scsi: ufs: Two minor optimizations in query UPIU preparation
@ 2025-06-17 9:56 Avri Altman
2025-06-17 9:56 ` [PATCH 1/2] scsi: ufs: Clear ucd_rsp_ptr for UPIU requests once Avri Altman
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Avri Altman @ 2025-06-17 9:56 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, linux-kernel, Bart Van Assche, Avri Altman
This short series introduces two minor optimizations to the UPIU
preparation code in the UFS core driver. Shouldn't have functional
impact.
Avri Altman (2):
scsi: ufs: Clear ucd_rsp_ptr for UPIU requests once
scsi: ufs: Document NOP_OUT transaction code
drivers/ufs/core/ufshcd.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH 1/2] scsi: ufs: Clear ucd_rsp_ptr for UPIU requests once 2025-06-17 9:56 [PATCH 0/2] scsi: ufs: Two minor optimizations in query UPIU preparation Avri Altman @ 2025-06-17 9:56 ` Avri Altman 2025-06-17 20:35 ` Bart Van Assche 2025-06-20 2:54 ` Martin K. Petersen 2025-06-17 9:56 ` [PATCH 2/2] scsi: ufs: Document NOP_OUT transaction code Avri Altman 2025-06-25 1:44 ` (subset) [PATCH 0/2] scsi: ufs: Two minor optimizations in query UPIU preparation Martin K. Petersen 2 siblings, 2 replies; 7+ messages in thread From: Avri Altman @ 2025-06-17 9:56 UTC (permalink / raw) To: Martin K . Petersen Cc: linux-scsi, linux-kernel, Bart Van Assche, Avri Altman Previously, the response buffer (ucd_rsp_ptr) was cleared in multiple UPIU preparation functions. Do it once. Signed-off-by: Avri Altman <avri.altman@sandisk.com> --- drivers/ufs/core/ufshcd.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 0a702356a715..c2048aca09fc 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -2826,8 +2826,6 @@ static void ufshcd_prepare_utp_query_req_upiu(struct ufs_hba *hba, /* Copy the Descriptor */ if (query->request.upiu_req.opcode == UPIU_QUERY_OPCODE_WRITE_DESC) memcpy(ucd_req_ptr + 1, query->descriptor, len); - - memset(lrbp->ucd_rsp_ptr, 0, sizeof(struct utp_upiu_rsp)); } static inline void ufshcd_prepare_utp_nop_upiu(struct ufshcd_lrb *lrbp) @@ -2840,8 +2838,6 @@ static inline void ufshcd_prepare_utp_nop_upiu(struct ufshcd_lrb *lrbp) .transaction_code = UPIU_TRANSACTION_NOP_OUT, .task_tag = lrbp->task_tag, }; - - memset(lrbp->ucd_rsp_ptr, 0, sizeof(struct utp_upiu_rsp)); } /** @@ -2867,6 +2863,8 @@ static int ufshcd_compose_devman_upiu(struct ufs_hba *hba, else ret = -EINVAL; + memset(lrbp->ucd_rsp_ptr, 0, sizeof(struct utp_upiu_rsp)); + return ret; } -- 2.25.1 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] scsi: ufs: Clear ucd_rsp_ptr for UPIU requests once 2025-06-17 9:56 ` [PATCH 1/2] scsi: ufs: Clear ucd_rsp_ptr for UPIU requests once Avri Altman @ 2025-06-17 20:35 ` Bart Van Assche 2025-06-20 2:54 ` Martin K. Petersen 1 sibling, 0 replies; 7+ messages in thread From: Bart Van Assche @ 2025-06-17 20:35 UTC (permalink / raw) To: Avri Altman, Martin K . Petersen; +Cc: linux-scsi, linux-kernel On 6/17/25 2:56 AM, Avri Altman wrote: > Previously, the response buffer (ucd_rsp_ptr) was cleared in multiple > UPIU preparation functions. Do it once. > > Signed-off-by: Avri Altman <avri.altman@sandisk.com> > --- > drivers/ufs/core/ufshcd.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c > index 0a702356a715..c2048aca09fc 100644 > --- a/drivers/ufs/core/ufshcd.c > +++ b/drivers/ufs/core/ufshcd.c > @@ -2826,8 +2826,6 @@ static void ufshcd_prepare_utp_query_req_upiu(struct ufs_hba *hba, > /* Copy the Descriptor */ > if (query->request.upiu_req.opcode == UPIU_QUERY_OPCODE_WRITE_DESC) > memcpy(ucd_req_ptr + 1, query->descriptor, len); > - > - memset(lrbp->ucd_rsp_ptr, 0, sizeof(struct utp_upiu_rsp)); > } > > static inline void ufshcd_prepare_utp_nop_upiu(struct ufshcd_lrb *lrbp) > @@ -2840,8 +2838,6 @@ static inline void ufshcd_prepare_utp_nop_upiu(struct ufshcd_lrb *lrbp) > .transaction_code = UPIU_TRANSACTION_NOP_OUT, > .task_tag = lrbp->task_tag, > }; > - > - memset(lrbp->ucd_rsp_ptr, 0, sizeof(struct utp_upiu_rsp)); > } > > /** > @@ -2867,6 +2863,8 @@ static int ufshcd_compose_devman_upiu(struct ufs_hba *hba, > else > ret = -EINVAL; > > + memset(lrbp->ucd_rsp_ptr, 0, sizeof(struct utp_upiu_rsp)); > + > return ret; > } Reviewed-by: Bart Van Assche <bvanassche@acm.org> ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] scsi: ufs: Clear ucd_rsp_ptr for UPIU requests once 2025-06-17 9:56 ` [PATCH 1/2] scsi: ufs: Clear ucd_rsp_ptr for UPIU requests once Avri Altman 2025-06-17 20:35 ` Bart Van Assche @ 2025-06-20 2:54 ` Martin K. Petersen 1 sibling, 0 replies; 7+ messages in thread From: Martin K. Petersen @ 2025-06-20 2:54 UTC (permalink / raw) To: Avri Altman Cc: Martin K . Petersen, linux-scsi, linux-kernel, Bart Van Assche Avri, > Previously, the response buffer (ucd_rsp_ptr) was cleared in multiple > UPIU preparation functions. Do it once. Applied to 6.17/scsi-staging, thanks! -- Martin K. Petersen ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/2] scsi: ufs: Document NOP_OUT transaction code 2025-06-17 9:56 [PATCH 0/2] scsi: ufs: Two minor optimizations in query UPIU preparation Avri Altman 2025-06-17 9:56 ` [PATCH 1/2] scsi: ufs: Clear ucd_rsp_ptr for UPIU requests once Avri Altman @ 2025-06-17 9:56 ` Avri Altman 2025-06-17 15:59 ` Bart Van Assche 2025-06-25 1:44 ` (subset) [PATCH 0/2] scsi: ufs: Two minor optimizations in query UPIU preparation Martin K. Petersen 2 siblings, 1 reply; 7+ messages in thread From: Avri Altman @ 2025-06-17 9:56 UTC (permalink / raw) To: Martin K . Petersen Cc: linux-scsi, linux-kernel, Bart Van Assche, Avri Altman UPIU_TRANSACTION_NOP_OUT is 0x0, which is the default value after memset. Comment out the explicit assignment and leave it as documentation. Signed-off-by: Avri Altman <avri.altman@sandisk.com> --- drivers/ufs/core/ufshcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index c2048aca09fc..84165b45467d 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -2835,7 +2835,7 @@ static inline void ufshcd_prepare_utp_nop_upiu(struct ufshcd_lrb *lrbp) memset(ucd_req_ptr, 0, sizeof(struct utp_upiu_req)); ucd_req_ptr->header = (struct utp_upiu_header){ - .transaction_code = UPIU_TRANSACTION_NOP_OUT, + /* .transaction_code = UPIU_TRANSACTION_NOP_OUT = 0x0, */ .task_tag = lrbp->task_tag, }; } -- 2.25.1 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] scsi: ufs: Document NOP_OUT transaction code 2025-06-17 9:56 ` [PATCH 2/2] scsi: ufs: Document NOP_OUT transaction code Avri Altman @ 2025-06-17 15:59 ` Bart Van Assche 0 siblings, 0 replies; 7+ messages in thread From: Bart Van Assche @ 2025-06-17 15:59 UTC (permalink / raw) To: Avri Altman, Martin K . Petersen; +Cc: linux-scsi, linux-kernel On 6/17/25 2:56 AM, Avri Altman wrote: > UPIU_TRANSACTION_NOP_OUT is 0x0, which is the default value after > memset. Comment out the explicit assignment and leave it as > documentation. This description is based on the assumption that the compiler only initializes the data structure members that have been mentioned explicitly. That is wrong. There is no partial initialization in the C programming language. Structure members that have not been mentioned explicitly are zero-initialized. All structure members, including those that have not been mentioned explicitly, are copied when performing structure assignment. > diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c > index c2048aca09fc..84165b45467d 100644 > --- a/drivers/ufs/core/ufshcd.c > +++ b/drivers/ufs/core/ufshcd.c > @@ -2835,7 +2835,7 @@ static inline void ufshcd_prepare_utp_nop_upiu(struct ufshcd_lrb *lrbp) > memset(ucd_req_ptr, 0, sizeof(struct utp_upiu_req)); > > ucd_req_ptr->header = (struct utp_upiu_header){ > - .transaction_code = UPIU_TRANSACTION_NOP_OUT, > + /* .transaction_code = UPIU_TRANSACTION_NOP_OUT = 0x0, */ > .task_tag = lrbp->task_tag, > }; > } This patch probably doesn't change the generated assembly code. So I don't think that it is useful. Bart. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: (subset) [PATCH 0/2] scsi: ufs: Two minor optimizations in query UPIU preparation 2025-06-17 9:56 [PATCH 0/2] scsi: ufs: Two minor optimizations in query UPIU preparation Avri Altman 2025-06-17 9:56 ` [PATCH 1/2] scsi: ufs: Clear ucd_rsp_ptr for UPIU requests once Avri Altman 2025-06-17 9:56 ` [PATCH 2/2] scsi: ufs: Document NOP_OUT transaction code Avri Altman @ 2025-06-25 1:44 ` Martin K. Petersen 2 siblings, 0 replies; 7+ messages in thread From: Martin K. Petersen @ 2025-06-25 1:44 UTC (permalink / raw) To: Avri Altman Cc: Martin K . Petersen, linux-scsi, linux-kernel, Bart Van Assche On Tue, 17 Jun 2025 12:56:09 +0300, Avri Altman wrote: > This short series introduces two minor optimizations to the UPIU > preparation code in the UFS core driver. Shouldn't have functional > impact. > > Avri Altman (2): > scsi: ufs: Clear ucd_rsp_ptr for UPIU requests once > scsi: ufs: Document NOP_OUT transaction code > > [...] Applied to 6.17/scsi-queue, thanks! [1/2] scsi: ufs: Clear ucd_rsp_ptr for UPIU requests once https://git.kernel.org/mkp/scsi/c/d56d980d9b28 -- Martin K. Petersen Oracle Linux Engineering ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-06-25 1:44 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2025-06-17 9:56 [PATCH 0/2] scsi: ufs: Two minor optimizations in query UPIU preparation Avri Altman 2025-06-17 9:56 ` [PATCH 1/2] scsi: ufs: Clear ucd_rsp_ptr for UPIU requests once Avri Altman 2025-06-17 20:35 ` Bart Van Assche 2025-06-20 2:54 ` Martin K. Petersen 2025-06-17 9:56 ` [PATCH 2/2] scsi: ufs: Document NOP_OUT transaction code Avri Altman 2025-06-17 15:59 ` Bart Van Assche 2025-06-25 1:44 ` (subset) [PATCH 0/2] scsi: ufs: Two minor optimizations in query UPIU preparation Martin K. Petersen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®