Re: [PATCH 11/12] scsi: ufs: Simplify transfer request header initialization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 7/26/23 14:07, Avri Altman wrote:

  /**
@@ -2587,10 +2587,10 @@ static void ufshcd_prepare_req_desc_hdr(struct
ufshcd_lrb *lrbp, u8 *upiu_flags,
                                         enum dma_data_direction cmd_dir, int ehs_length)
  {
         struct utp_transfer_req_desc *req_desc = lrbp->utr_descriptor_ptr;
+       struct request_desc_header *h = &req_desc->header;
         u32 data_direction;
Maybe use the enum type as its strange to assign u32 to a nibble

Hi Avri,

I will make this change.

+       h->command_type = lrbp->command_type;
AFAIK the CT is always 1 in UFSHCI3.0?

That's also my understanding. I kept the existing logic since I think that it's too early to drop UFSHCI 2 support?

+static void ufshcd_check_header_layout(void)
+{
+       BUILD_BUG_ON(((u8 *)&(struct request_desc_header){
+                               .cci = 3})[0] != 3);
+
+       BUILD_BUG_ON(((u8 *)&(struct request_desc_header){
+                               .ehs_length = 2})[1] != 2);
+
+       BUILD_BUG_ON(((u8 *)&(struct request_desc_header){
+                               .enable_crypto = 1})[2]
+                    != 0x80);
+
+       BUILD_BUG_ON((((u8 *)&(struct request_desc_header){
+                                       .command_type = 5,
+                                       .data_direction = 3,
+                                       .interrupt = 1,
+                               })[3]) != ((5 << 4) | (3 << 1) | 1));
Isn't this checker assumes endianness hence requires the applicable #ifdef?

The above code builds fine on big endian and little endian systems because of the #ifdefs that are present in the definition of struct request_desc_header.

The script I use for compile testing of SCSI code is available here: https://github.com/bvanassche/build-scsi-drivers/

Thanks,

Bart.



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux