Stefan Richter | 1 Sep 2009 13:19
Picon

Re: scsi traffic sniffing

谢纲 wrote:
> On Tue, Sep 1, 2009 at 2:13 PM, Jonathan Nell<crtrn13 <at> gmail.com> wrote:
>> Is there any way to sniff the traffic of a scsi device? I need to
>> debug a firmware update and need to see the traffic being passed to
>> the drive
> You may hook the queue_command function of the scsi host. It can sniff
> all scsi request to scsi host driver.

Actually you can switch on logging of commands and status (though not of 
data) at runtime by something like
# echo $BITMASK > /sys/module/scsi_mod/parameters/scsi_logging_level
or
# echo $BITMASK > /proc/sys/dev/scsi/logging_level
provided that the kernel's SCSI core was compiled with 
CONFIG_SCSI_LOGGING=y.

Bitmask values can be constructed as in 
linux/drivers/scsi/scsi_logging.h.  Long ago I made a note that 9216 as 
bitmask was useful for my purposes, but don't ask me what that means.

For data logging, you have to modify the SCSI low-level driver or SCSI 
core indeed.

However, all this applies only if the firmware updater actually runs on 
a Linux initiator, not e.g. on an MS Windows initiator.  In the latter 
case, you need a debug driver which hooks into Windows' SCSI stack, or 
some sort of bus analyzer.
--

-- 
Stefan Richter
-=====-==--= =--= ----=
http://arcgraph.de/sr/
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Gmane