RE: 32-byte CDB support in Libsas?

Kamaljit Singh
2013-05-07T20:26:47Z

> I wouldn't do it that way. Since everything has to form a command IU
> anyway by copying, I'd just make sas_ssp->cdb a pointer to the actual
> command instead of an array of the command; if it points to the
I'd prefer that too, specially since scsi_cmnd->cmnd is already a pointer. I considered that but any such changes to libsas.h would've had wide repercussions. Hence, I didn't go down that rathole at the moment.

> no problem when anyone wants longer commands. There should probably
>also be a macro to populate the command IU since the format of CDB > 16
> is different.
Thanks for recongnizing that. Commands >32 bytes are supported by PMC's SAS Controllers.

Kamaljit

-----Original Message-----
From: James Bottomley [mailto:James.Bottomley@HansenPartnership.com]
Sent: Tuesday, May 07, 2013 1:07 PM
To: Kamaljit Singh
Cc: Jack Wang; Anand Kumar Santhanam; linux-scsi@vger.kernel.org; Harry Yang; Vishwanath Maram; Sakthivel Saravanan Kamal Raju; Rich Bono; Sangeetha Gnanasekaran
Subject: Re: 32-byte CDB support in Libsas?

On Tue, 2013-05-07 at 12:46 -0700, Kamaljit Singh wrote:
> James, Jack,
>
> Thanks for your responses.
>
> > I don't understand the question ... it should just work; is it
> broken?
> sas_create_task() only copies 16 bytes to the sas_ssp_task struct’s
> cdb field, which itself is a 16 byte wide array. So it looks like
> sas_queuecommand() doesn’t support a 32-byte cdb.

Hm, it does it as a bare 16 instead of SCSI_MAX_CDB which is probably
how it got missed in the long command conversion.

> > It's easy to add that, define cdb 32 to ssp_task and modify
> sas_queuecommand, and lldd to pass it to fw
> Yes, that’s exactly what I’ve designed it as, i.e. in my lldd’s
> queuecommand function. At the moment I only need this function for
> 32-byte cdb support. But if there are plans to add that to libsas
> then I’d prefer to use sas_queuecommand rather than having to do
> manual merges from future libsas fixes/updates.

I wouldn't do it that way. Since everything has to form a command IU
anyway by copying, I'd just make sas_ssp->cdb a pointer to the actual
command instead of an array of the command; if it points to the
scsi_cmnd, then it has access to cmd_len as well. That way no copying
and no problem when anyone wants longer commands. There should probably
also be a macro to populate the command IU since the format of CDB > 16
is different.

James