Hi liujun

What you are doing sounds more-or-less the same as what the
scsi_vhci.c code does - see
http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/cmd/mdb/common/modules/scsi_vhci/scsi_vhci.c

Keep in mind that a driver should not allocate a scsi_pkt on its own
(or have other dependencies on sizeof (struct scsi_pkt)). We currently
have some violations of this rule in our own source, but that does not
change the fact that scsi_hba_pkt_alloc() should be used (or for a
physical hba on nevada, tran_setup_pkt(9E) should be implemented).

-Chris
> Hi, all
>
>        I face a problem about relaying a scsi_pkt. 
>       The following is a simply decribe.
>
> When receiving a scsi_pkt (called it old scsi_pkt) from targt driver, my 
> module will init a new scsi_pkt by xx_scsi_pkt method and the params are same 
> as old scsi_pkt created.
> When my new scsi_pkt is done OK, it will copy the result to the old scsi_pkt.
>
>   step 1,                 (ssd) scsi_pkt  -------->(my module) init a new 
> scsi_pkt -------->(HBA)  send it out
>
>  step 2,                  (ssd) scsi_pkt  <--------(my module) copy result to 
> old scsi_pkt <--------(HBA)  recive response
>
>
>       In step 1, I  copy  pkt_private  from old scsi_pkt to new scsi_pkt and 
> fill other members of scsi_pkt  
>       In setp 2, I copy pkt_private from new scsi_pkt to old scsi_pkt 
>
>     My problem is  the new scsi_pkt is done ok(I know from my log) ,but the 
> old scsi_pkt is not OK(because some command is not ok ,such as format). I 
> think i ignore some detail.My foucs is on the pkt_private , is right?
>
>       I hope your idea . 
>       Thanks.
>
>
>
>
>
>
>
> struct scsi_pkt {
>       opaque_t pkt_ha_private;        /* private data for host adapter */
>       struct scsi_address pkt_address;        /* destination packet is for */
>       opaque_t pkt_private;           /* private data for target driver */
>       void    (*pkt_comp)(struct scsi_pkt *); /* completion routine */
>       uint_t  pkt_flags;              /* flags */
>       int     pkt_time;               /* time allotted to complete command */
>       uchar_t *pkt_scbp;              /* pointer to status block */
>       uchar_t *pkt_cdbp;              /* pointer to command block */
>       ssize_t pkt_resid;              /* data bytes not transferred */
>       uint_t  pkt_state;              /* state of command */
>       uint_t  pkt_statistics;         /* statistics */
>       uchar_t pkt_reason;             /* reason completion called */
>       uint_t  pkt_cdblen;
>       uint_t  pkt_tgtlen;
>       uint_t  pkt_scblen;
>       ddi_dma_handle_t pkt_handle;
>       uint_t  pkt_numcookies;
>       off_t   pkt_dma_offset;
>       size_t  pkt_dma_len;
>       uint_t  pkt_dma_flags;
>       ddi_dma_cookie_t *pkt_cookies;
> };
>  
>  
> This message posted from opensolaris.org
> _______________________________________________
> storage-discuss mailing list
> [email protected]
> http://mail.opensolaris.org/mailman/listinfo/storage-discuss
>   

_______________________________________________
storage-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/storage-discuss

Reply via email to