public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] SCSI: export sas_hash_addr()
@ 2007-09-26  7:35 Jeff Garzik
  2007-09-28  0:04 ` James Bottomley
  0 siblings, 1 reply; 7+ messages in thread
From: Jeff Garzik @ 2007-09-26  7:35 UTC (permalink / raw)
  To: linux-scsi

sas_hash_addr() is the spec-defined standard hashing function.  Make it
available to drivers that need it.

Signed-off-by: Jeff Garzik <jeff@garzik.org>

diff --git a/drivers/scsi/libsas/sas_init.c b/drivers/scsi/libsas/sas_init.c
index 9cd5abe..13c3d21 100644
--- a/drivers/scsi/libsas/sas_init.c
+++ b/drivers/scsi/libsas/sas_init.c
@@ -314,3 +314,4 @@ module_exit(sas_class_exit);
 
 EXPORT_SYMBOL_GPL(sas_register_ha);
 EXPORT_SYMBOL_GPL(sas_unregister_ha);
+EXPORT_SYMBOL_GPL(sas_hash_addr);

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] SCSI: export sas_hash_addr()
  2007-09-26  7:35 [PATCH] SCSI: export sas_hash_addr() Jeff Garzik
@ 2007-09-28  0:04 ` James Bottomley
  2007-09-28  1:01   ` Jeff Garzik
  0 siblings, 1 reply; 7+ messages in thread
From: James Bottomley @ 2007-09-28  0:04 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-scsi

On Wed, 2007-09-26 at 03:35 -0400, Jeff Garzik wrote:
> sas_hash_addr() is the spec-defined standard hashing function.  Make it
> available to drivers that need it.

I'm not opposed in principle to exporting this, but I have a hard time
understanding why a driver would need it.

The hashed address is a property of the constructed SAS frames, which is
done in libsas.  The driver shouldn't really be calculating its own hash
instead of using what libsas provides ... or is this because the hashed
self address isn't calculated by the HBA so it needs to be programmed or
something?

James



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] SCSI: export sas_hash_addr()
  2007-09-28  0:04 ` James Bottomley
@ 2007-09-28  1:01   ` Jeff Garzik
  2007-09-30 16:56     ` James Bottomley
  0 siblings, 1 reply; 7+ messages in thread
From: Jeff Garzik @ 2007-09-28  1:01 UTC (permalink / raw)
  To: James Bottomley; +Cc: linux-scsi

James Bottomley wrote:
> On Wed, 2007-09-26 at 03:35 -0400, Jeff Garzik wrote:
>> sas_hash_addr() is the spec-defined standard hashing function.  Make it
>> available to drivers that need it.
> 
> I'm not opposed in principle to exporting this, but I have a hard time
> understanding why a driver would need it.
> 
> The hashed address is a property of the constructed SAS frames, which is
> done in libsas.  The driver shouldn't really be calculating its own hash
> instead of using what libsas provides ... or is this because the hashed
> self address isn't calculated by the HBA so it needs to be programmed or
> something?

It is needed to build the SSP frame header.

If there is common code that does that, I will definitely use that, but 
do not see any such code.

	Jeff




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] SCSI: export sas_hash_addr()
  2007-09-28  1:01   ` Jeff Garzik
@ 2007-09-30 16:56     ` James Bottomley
  2007-09-30 17:44       ` Jeff Garzik
  0 siblings, 1 reply; 7+ messages in thread
From: James Bottomley @ 2007-09-30 16:56 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-scsi

On Thu, 2007-09-27 at 21:01 -0400, Jeff Garzik wrote:
> James Bottomley wrote:
> > On Wed, 2007-09-26 at 03:35 -0400, Jeff Garzik wrote:
> >> sas_hash_addr() is the spec-defined standard hashing function.  Make it
> >> available to drivers that need it.
> > 
> > I'm not opposed in principle to exporting this, but I have a hard time
> > understanding why a driver would need it.
> > 
> > The hashed address is a property of the constructed SAS frames, which is
> > done in libsas.  The driver shouldn't really be calculating its own hash
> > instead of using what libsas provides ... or is this because the hashed
> > self address isn't calculated by the HBA so it needs to be programmed or
> > something?
> 
> It is needed to build the SSP frame header.
> 
> If there is common code that does that, I will definitely use that, but 
> do not see any such code.

The way you're supposed to build the frame header is in
lldd_execute_task().  Here, if you need the hashed address of the
destination, you copy it out of the domain_device (dev field of struct
sas_task).

James



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] SCSI: export sas_hash_addr()
  2007-09-30 16:56     ` James Bottomley
@ 2007-09-30 17:44       ` Jeff Garzik
  2007-09-30 17:51         ` Jeff Garzik
  2007-09-30 17:56         ` James Bottomley
  0 siblings, 2 replies; 7+ messages in thread
From: Jeff Garzik @ 2007-09-30 17:44 UTC (permalink / raw)
  To: James Bottomley; +Cc: linux-scsi

James Bottomley wrote:
> On Thu, 2007-09-27 at 21:01 -0400, Jeff Garzik wrote:
>> James Bottomley wrote:
>>> On Wed, 2007-09-26 at 03:35 -0400, Jeff Garzik wrote:
>>>> sas_hash_addr() is the spec-defined standard hashing function.  Make it
>>>> available to drivers that need it.
>>> I'm not opposed in principle to exporting this, but I have a hard time
>>> understanding why a driver would need it.
>>>
>>> The hashed address is a property of the constructed SAS frames, which is
>>> done in libsas.  The driver shouldn't really be calculating its own hash
>>> instead of using what libsas provides ... or is this because the hashed
>>> self address isn't calculated by the HBA so it needs to be programmed or
>>> something?
>> It is needed to build the SSP frame header.
>>
>> If there is common code that does that, I will definitely use that, but 
>> do not see any such code.
> 
> The way you're supposed to build the frame header is in
> lldd_execute_task().  Here, if you need the hashed address of the
> destination, you copy it out of the domain_device (dev field of struct
> sas_task).

That's the destination.  I need it for the source.

	Jeff




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] SCSI: export sas_hash_addr()
  2007-09-30 17:44       ` Jeff Garzik
@ 2007-09-30 17:51         ` Jeff Garzik
  2007-09-30 17:56         ` James Bottomley
  1 sibling, 0 replies; 7+ messages in thread
From: Jeff Garzik @ 2007-09-30 17:51 UTC (permalink / raw)
  To: James Bottomley; +Cc: linux-scsi

Jeff Garzik wrote:
> James Bottomley wrote:
>> On Thu, 2007-09-27 at 21:01 -0400, Jeff Garzik wrote:
>>> James Bottomley wrote:
>>>> On Wed, 2007-09-26 at 03:35 -0400, Jeff Garzik wrote:
>>>>> sas_hash_addr() is the spec-defined standard hashing function.  
>>>>> Make it
>>>>> available to drivers that need it.
>>>> I'm not opposed in principle to exporting this, but I have a hard time
>>>> understanding why a driver would need it.
>>>>
>>>> The hashed address is a property of the constructed SAS frames, 
>>>> which is
>>>> done in libsas.  The driver shouldn't really be calculating its own 
>>>> hash
>>>> instead of using what libsas provides ... or is this because the hashed
>>>> self address isn't calculated by the HBA so it needs to be 
>>>> programmed or
>>>> something?
>>> It is needed to build the SSP frame header.
>>>
>>> If there is common code that does that, I will definitely use that, 
>>> but do not see any such code.
>>
>> The way you're supposed to build the frame header is in
>> lldd_execute_task().  Here, if you need the hashed address of the
>> destination, you copy it out of the domain_device (dev field of struct
>> sas_task).
> 
> That's the destination.  I need it for the source.

Nevermind, I found it elsewhere.  You can drop this patch.

	Jeff




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] SCSI: export sas_hash_addr()
  2007-09-30 17:44       ` Jeff Garzik
  2007-09-30 17:51         ` Jeff Garzik
@ 2007-09-30 17:56         ` James Bottomley
  1 sibling, 0 replies; 7+ messages in thread
From: James Bottomley @ 2007-09-30 17:56 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-scsi

On Sun, 2007-09-30 at 13:44 -0400, Jeff Garzik wrote:
> James Bottomley wrote:
> > On Thu, 2007-09-27 at 21:01 -0400, Jeff Garzik wrote:
> >> James Bottomley wrote:
> >>> On Wed, 2007-09-26 at 03:35 -0400, Jeff Garzik wrote:
> >>>> sas_hash_addr() is the spec-defined standard hashing function.  Make it
> >>>> available to drivers that need it.
> >>> I'm not opposed in principle to exporting this, but I have a hard time
> >>> understanding why a driver would need it.
> >>>
> >>> The hashed address is a property of the constructed SAS frames, which is
> >>> done in libsas.  The driver shouldn't really be calculating its own hash
> >>> instead of using what libsas provides ... or is this because the hashed
> >>> self address isn't calculated by the HBA so it needs to be programmed or
> >>> something?
> >> It is needed to build the SSP frame header.
> >>
> >> If there is common code that does that, I will definitely use that, but 
> >> do not see any such code.
> > 
> > The way you're supposed to build the frame header is in
> > lldd_execute_task().  Here, if you need the hashed address of the
> > destination, you copy it out of the domain_device (dev field of struct
> > sas_task).
> 
> That's the destination.  I need it for the source.

The source should come from dev->port->ha->hashed_sas_addr ...
traditionally it's just your sas_ha_struct that you passed into
sas_register_ha.  The register function fills in the hashed address and
you can pick it out again.

James



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-09-30 17:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-26  7:35 [PATCH] SCSI: export sas_hash_addr() Jeff Garzik
2007-09-28  0:04 ` James Bottomley
2007-09-28  1:01   ` Jeff Garzik
2007-09-30 16:56     ` James Bottomley
2007-09-30 17:44       ` Jeff Garzik
2007-09-30 17:51         ` Jeff Garzik
2007-09-30 17:56         ` James Bottomley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox