Skip to contentSkip to conversation

doubts about sg driver

DISCUSSION Parav Pandit 3 participants 3 messages Jun 14, 2007 SCSI

lore
Share & tools
lore
#0 lore raw

Hi,

Few basic questions on sg driver:

1. Are there any hooks that low level HBA driver needs to implement - for providing support for SG (SCSI generic) driver?
Or SG always interacts with scsi_mod and it is transparent to the HBA drivers?

Quoted 1 line

From the tldp How-to and sg.c it looks like it doesn't

directly talk with Low level HBA driver, but want to confirm.

2. Can applications talk with SCSI RAID controller device (some targets exposes LUN-0 as controller) through sg interface or it is only for storage devices?

3. How is the mapping between /dev/sda /dev/sdb etc to /dev/sg0 /dev/sg1 etc?
Is this information is accessible via procfs or sysfs interface?

Regards,
Parav Pandit

____________________________________________________________________________________
Be a better Globetrotter. Get better travel answers from someone who knows. Yahoo! Answers - Check it out.
http://answers.yahoo.com/dir/?link=list&sid=396545469

#1 lore raw

Hi Parav,

Quoted 7 lines · Parav Pandit

Hi,

Few basic questions on sg driver:

1. Are there any hooks that low level HBA driver needs to implement - for providing support for SG (SCSI generic) driver?

No. This is all done in the sg/scsi-midlayer.

Quoted 2 lines

Or SG always interacts with scsi_mod and it is
transparent to the HBA drivers?

Yes.

Quoted 3 lines

From the tldp How-to and sg.c it looks like it doesn't directly talk with Low level HBA driver, but want to confirm.

Correct.

Quoted 5 lines

2. Can applications talk with SCSI RAID controller device (some targets exposes LUN-0 as controller) through sg interface or it is only for storage devices?

Any SCSI device.

Quoted 6 lines

3. How is the mapping between /dev/sda /dev/sdb etc to /dev/sg0 /dev/sg1 etc?
Is this information is accessible via procfs or sysfs interface?

In 2.6 kernels, you can looks at:

/sys/class/scsi_device/h:c:t:l/scsi_generic:sg#

in 2.4 and 2.6 you can look at /proc/scsi/sg/devices. Where the contents is:

seq_printf(s, "%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\n",

                              scsidp->host->host_no, scsidp->channel,
                              scsidp->id, scsidp->lun, (int)          scsidp->type,
                              1,
                              (int) scsidp->queue_depth,
                              (int) scsidp->device_busy,
                              (int) scsi_device_online(scsidp));
Quoted 13 lines

Regards,
Parav Pandit

____________________________________________________________________________________
Be a better Globetrotter. Get better travel answers from someone who knows. Yahoo! Answers - Check it out.
http://answers.yahoo.com/dir/?link=list&sid=396545469
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Andrew Patterson
Hewlett-Packard Company
#2 lore raw
In reply to Parav Pandit
Quoted 4 lines · Parav Pandit

Hi,

Few basic questions on sg driver:

Quoted 8 lines

1. Are there any hooks that low level HBA driver needs to implement - for providing support for SG (SCSI generic) driver?
Or SG always interacts with scsi_mod and it is transparent to the HBA drivers?

Quoted 1 line

From the tldp How-to and sg.c it looks like it doesn't

directly talk with Low level HBA driver, but want to confirm.

The sg driver talks to the scsi mid level (and the block layer strangely enough) but not directly to LLDs.

Quoted 4 lines

2. Can applications talk with SCSI RAID controller device (some targets exposes LUN-0 as controller) through sg interface or it is only for storage devices?

The sg driver is useful for any SCSI device (logical unit) that is exposed by the scsi mid level. Apart from direct access (i.e. disk) devices that might include cd/dvd drives, tape drives, scsi enclosures, saf-te controllers (which have processor peripheral device type) and well known logical units.

Quoted 4 lines

3. How is the mapping between /dev/sda /dev/sdb etc to /dev/sg0 /dev/sg1 etc?
Is this information is accessible via procfs or sysfs interface?

In the lk 2.6 series the mapping can be found in sysfs (see lsscsi, specifically 'lsscsi -g'). In the sg3_utils package the sg_map utility shows the mapping. That may be helpful in the lk 2.4 series since there is no sysfs.

Doug Gilbert