difference between scsi_target and scsi_targ_bh

Nate Lawson nate at root.org
Wed Sep 17 12:42:41 PDT 2003


On Wed, 17 Sep 2003, Chuck Tuffli wrote:
> I'm in the process of trying to understand how the targ(4) emulator
> works from top to bottom and ran into some confusion over
> scsi_target.c vs. scsi_targ_bh.c. From Nate's README, it appears that
> you need both of these drivers for the target to work. What confuses
> me is that there seems to be some hefty overlap between the two. For
> example, the LUN enable/disable code is almost identical, the
> constructors are similar, and the "start" functions are similar.
>
> My questions are
> 1) are both scsi_target and scsi_targ_bh needed
> 2) if so what is the general difference
>
> Thanks!

The scsi_target kernel driver enables target mode and then passes CCBs
back and forth between a userland component.  The scsi_targ_bh driver
auto-attaches to any LUNs that are enabled but don't have a listener.  It
returns valid "device not here" reponses.  On isp(4), for instance, you
can't just enable one LUN.  The firmware enables all LUNs when it gets an
enable commands.  The scsi_targ_bh device handles the LUNs that you didn't
really want.

-Nate


More information about the freebsd-scsi mailing list