RE: [PATCH V3 15/24] aacraid: Include HBA direct interface

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

 




> -----Original Message-----
> From: linux-scsi-owner@xxxxxxxxxxxxxxx [mailto:linux-scsi-
> owner@xxxxxxxxxxxxxxx] On Behalf Of Johannes Thumshirn
> Sent: Monday, January 30, 2017 3:02 AM
> To: Raghava Aditya Renukunta
> <RaghavaAditya.Renukunta@xxxxxxxxxxxxx>
> Cc: jejb@xxxxxxxxxxxxxxxxxx; martin.petersen@xxxxxxxxxx; linux-
> scsi@xxxxxxxxxxxxxxx; Dave Carroll <david.carroll@xxxxxxxxxxxxx>; Gana
> Sridaran <gana.sridaran@xxxxxxxxxxxxx>; Scott Benesh
> <scott.benesh@xxxxxxxxxxxxx>
> Subject: Re: [PATCH V3 15/24] aacraid: Include HBA direct interface
> 
> EXTERNAL EMAIL
> 
> 
> On Fri, Jan 27, 2017 at 11:28:44AM -0800, Raghava Aditya Renukunta wrote:
> > Added support to send direct pasthru srb commands from management
> utilty
> > to the  controller.
> >
> > Signed-off-by: Raghava Aditya Renukunta
> <RaghavaAditya.Renukunta@xxxxxxxxxxxxx>
> > Signed-off-by: Dave Carroll <David.Carroll@xxxxxxxxxxxxx>
> >
> > ---
> 
> [...]
> 
> Bonus points if you tidy up the following:

Let me try for those points then :). 

> 
> >       byte_count = 0;
> > -     if (dev->adapter_info.options & AAC_OPT_SGMAP_HOST64) {
> > +     if (is_native_device) {
> > +             struct user_sgmap *usg32 = &user_srbcmd->sg;
> > +             struct user_sgmap64 *usg64 =
> > +                     (struct user_sgmap64 *)&user_srbcmd->sg;
> > +
> > +             for (i = 0; i < usg32->count; i++) {
> > +                     void *p;
> > +                     u64 addr;
> > +
> > +                     sg_count[i] = (actual_fibsize64 == fibsize) ?
> > +                             usg64->sg[i].count : usg32->sg[i].count;
> > +                     if (sg_count[i] >
> > +                             (dev->scsi_host_ptr->max_sectors << 9)) {
> > +                             pr_err("aacraid: upsg->sg[%d].count=%u>%u\n",
> > +                                     i, sg_count[i],
> > +                                     dev->scsi_host_ptr->max_sectors << 9);
> > +                             rcode = -EINVAL;
> > +                             goto cleanup;
> > +                     }
> > +
> > +                     p = kmalloc(sg_count[i], GFP_KERNEL|__GFP_DMA);
> > +                     if (!p) {
> > +                             rcode = -ENOMEM;
> > +                             goto cleanup;
> > +                     }
> > +
> > +                     if (actual_fibsize64 == fibsize) {
> > +                             addr = (u64)usg64->sg[i].addr[0];
> > +                             addr += ((u64)usg64->sg[i].addr[1]) << 32;
> > +                     } else {
> > +                             addr = (u64)usg32->sg[i].addr;
> > +                     }
> > +
> > +                     sg_user[i] = (void __user *)(uintptr_t)addr;
> > +                     sg_list[i] = p; // save so we can clean up later
> > +                     sg_indx = i;
> > +
> > +                     if (flags & SRB_DataOut) {
> > +                             if (copy_from_user(p, sg_user[i],
> > +                                     sg_count[i])) {
> > +                                     rcode = -EFAULT;
> > +                                     goto cleanup;
> > +                             }
> > +                     }
> > +                     addr = pci_map_single(dev->pdev, p, sg_count[i],
> > +                                             data_dir);
> > +                     hbacmd->sge[i].addr_hi = cpu_to_le32((u32)(addr>>32));
> > +                     hbacmd->sge[i].addr_lo = cpu_to_le32(
> > +                                             (u32)(addr & 0xffffffff));
> > +                     hbacmd->sge[i].len = cpu_to_le32(sg_count[i]);
> > +                     hbacmd->sge[i].flags = 0;
> > +                     byte_count += sg_count[i];
> > +             }
> > +
> > +             if (usg32->count > 0)   /* embedded sglist */
> > +                     hbacmd->sge[usg32->count-1].flags =
> > +                             cpu_to_le32(0x40000000);
> > +             hbacmd->data_length = cpu_to_le32(byte_count);
> > +
> > +             status = aac_hba_send(HBA_IU_TYPE_SCSI_CMD_REQ, srbfib,
> > +                                     NULL, NULL);
> > +
> > +     } else if (dev->adapter_info.options & AAC_OPT_SGMAP_HOST64) {
> >               struct user_sgmap64* upsg = (struct
> user_sgmap64*)&user_srbcmd->sg;
> >               struct sgmap64* psg = (struct sgmap64*)&srbcmd->sg;
> >
> > @@ -606,7 +719,9 @@ static int aac_send_raw_srb(struct aac_dev* dev,
> void __user * arg)
> 
> [...]
> 
> Anyways,
> Reviewed-by: Johannes Thumshirn <jthumshirn@xxxxxxx>
> 
> --
> Johannes Thumshirn                                          Storage
> jthumshirn@xxxxxxx                                +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@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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