Hi Ram,

I was a little confused by your question. The scsi_ifgetcap() is 
interface between SCSA/target driver and HBA driver. But as for the 
consumer of the "dma-max" capability. It's depends on target driver.

Firstly, if you are doing I/O against disk drive, why you want to tell 
upper layer dma capability? No need at all on X86 platform. Because for 
sd driver, partial DMA is allowed on x86. So if your dma capability is 
limited,  the big buffer will be breakup to several small ones transfer 
one by one in HBA driver. You do not need notify the scsi mid-layer or 
target layer.

Secondly, the dma capability is useful when partial dma is not allowed. 
Like st driver, for tape, partial dma is not allowed and before transfer 
the packet to HBA layer, target driver or SCSA have to realize the dma 
capability limitation. So if you attach a tape with your HBA, you would 
noticed getcap for "dma-max" is called.

Thirdly, if you think you HBA DMA capability is great and greater than 
1M on x86 platform and want to transfer as large as possible data once 
when doing raw I/O to disk. You can just specify "sd_max_xfer_size" 
property in sd.conf file without any change of HBA driver.

So on all conditions partial dma is allowed, you don't need notify scsi 
mid layer or higher layer for dma capability at all. What you need to do 
is only to set ddi_dma_attr_t correctly and handle partial dma correctly 
in your HBA driver.

Why you want to tell scsi-mid layer xfer capability of the device?

Javen

ram vegesna wrote:
> Hi Javen,
>
>          Thanks for the reply.
>
>           I am not seeing any one calling the getcap SCSI_CAP_DMA_MAX 
> routine.(I had  prints in that case both in setcap and getcap 
> functions but it never came up)
>
>          Do we have to do some thing to tell midlayer to call this 
> capability ?
>
>           Please , let me know if you have any ideas.
>
> Thanks,
> Ram
>         
>
> --- On *Fri, 9/26/08, Javen Wu /<[EMAIL PROTECTED]>/* wrote:
>
>     From: Javen Wu <[EMAIL PROTECTED]>
>     Subject: Re: [driver-discuss] maximum I/O size
>     To: [EMAIL PROTECTED]
>     Cc: "solaris driver" <driver-discuss@opensolaris.org>
>     Date: Friday, September 26, 2008, 9:02 AM
>
>     You need implement tran_getcap() routine, and set SCSI_CAP_DMA_MAX 
>     capability.
>     sample code is as below:
>     ------%<------
>     xxx_attach() {
>     ....
>         hba_tran->tran_getcap        =xxx_scsi_getcap;
>     ...
>     }
>     static int
>     xxx_tran_getcap(struct scsi_address *ap, char *cap, int tgtonly) {
>         switch (ckey) {
>         case SCSI_CAP_DMA_MAX:
>             rval = (int)xxx->dma_attr.dma_attr_maxxfer;
>             break;
>         default:
>             rval = UNDEFINED;
>            
>      break;
>     }
>
>     ------%<------
>     Javen
>     ram vegesna wrote:
>     >
>     > Hi,
>     >          
>     >           How can we tell the OS (scsi midlayer) to limit of I/O size 
>     > that the device can handle?
>     > So, that OS will split any bigger size IO request into chunks of the 
>     > specified size.
>     >
>     >           Please, let me know if I have to change some parameter in 
>     > ddi_dma_attr_t structure.
>     >
>     >   Note : I am using Solaris 10 x86
>     >
>     > Thanks,
>     > Ram
>     >
>     >
>     > ------------------------------------------------------------------------
>     >
>     > _______________________________________________
>     > driver-discuss mailing list
>     > driver-discuss@opensolaris.org
>     > http://mail.opensolaris.org/mailman/listinfo/driver-discuss
>     >   
>
>               
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> driver-discuss mailing list
> driver-discuss@opensolaris.org
> http://mail.opensolaris.org/mailman/listinfo/driver-discuss
>   

_______________________________________________
driver-discuss mailing list
driver-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/driver-discuss

Reply via email to