Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Jan 1997 15:48:50 -0800
From:      Julian Elischer <julian@whistle.com>
To:        Simon Shapiro <Shimon@i-Connect.Net>
Cc:        freebsd-scsi@FreeBSD.ORG
Subject:   Re: XXXminpys question
Message-ID:  <32EFE1E2.ABD322C@whistle.com>
References:  <XFMail.970129132302.Shimon@i-Connect.Net>

next in thread | previous in thread | raw e-mail | index | archive | help
Simon Shapiro wrote:
> 
> When/how is the minphys entry point in an HBA driver called?

the adapter has a minphys that cuts down any transfer it couldn't do.
It's adapter dependent of course. devices that can't handle their
transfer being done in two parts should notice that this has happenned
and abort the operation. (e.g. some tape drives).

the adapter minphys is called from the genereic scsi minphys()
scsi_minphys() in scsi_driver.c which is called by
the device specific driver ( e.g sd.c) in the strategy() function.


> All we see in the bt and ahc drivers is a comparison between a buf and a
> constant.
and a truncation of the transfer.. the higher level code will notice on
return that not all the data was transfered an dwill re-try for the
rest.

> 
> In the driver we are writing now, mulltiple controllers, all run with the
> same driver, can EACH have their own minphys.?

Yes, you can put any code you wish in there. it could be a comparison
with
a field in the device's local structure..

>  Actually, like others, it is
> limited by the scatter-gather DMA engine.  The cheapest HBA can have 16
> segments in the DBA S/G.  The largest can have 8192 currently.  May grow
> larger.
16, yuk..
even the aha had 17, 
the reason for th extra one is to allow a guaranteed ability
to transfer 64K, as the first and lat pages migh tbe only partial
in the casae of a non-alligned transfer..

the bt has LOTS and the aha has 17. note however htat the present limit
inside the kernel is for 64K trnasfers so you will not get a request 
for > than that. This should be fixed but is not yet..
> 
> What we need, in addition to the clarification above is these answers:
> 
> a.  Does minphys get called for each I/O request, with that I/O's own buf?
YES. that's how it can truncate the transfer to break it up to multiple
transfers.

> b.  Does minphys get called, at initialization time, once per HBA?
NO
> c.  Does minphys get called only once for ``the driver''?
NO
> If A is true, we can (nasty) extract the HBA from the device data in buf.
you mean "can we"? 

no and yes..
you could trivially extract it from bp->b_driver2 where the
generic scsi code stores it. It is not ALWAYS htere however.
It would be a trivial change for scsi_minphys() which has that
information to make sure it is always set before calling the
HBA minphys.
The information is in the scsi_link structure. bp->b_driver2 is
used to hold a pointer for this some times and scsi_minphys has
a pointer to this.

bp->b_driver2 = sc->link;
would be all that is needed to add to scsi_minphys.

> If B is true, we need some indication in calling minphys as to which HBA.
it's not true.
> Ic C is true, we have a problem.  In that case, can we manipilate the buf
it's not true
> structure when the SCSI command is called in and do only partial I/O by
> manipulating the b_count and b_resid fields?
that's what the system already does

> 
> This is sort of a stalling stump for us so soon response will be
> appreciated...
> 
> Thanx!
> 
> Simon

julian



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?32EFE1E2.ABD322C>