RE: [PATCH] [SCSI] LIBSAS: fix libsas link error issue

Xiangliang Yu
2011-06-15T04:55:19Z

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="gb2312", Size: 1965 bytes --]

On 11-06-14 09:44 PM, Xiangliang Yu wrote:
>> Subject: Re: [PATCH] [SCSI] LIBSAS: fix libsas link error issue
>>
>> On Tue, 2011-06-14 at 23:17 +0800, yxlraid@gmail.com wrote:
>>>> From: Xiangliang Yu<yuxiangl@marvell.com>
>>>>
>>>> -- The value of child link rate should is minimum of link rate, or
>>>> command will fail if child link rate is bigger than parent link rate.
>>>>
>>>> Signed-off-by: Xiangliang Yu<yuxiangl@marvell.com>
>>>> ---
>>>> drivers/scsi/libsas/sas_expander.c | 2 +-
>>>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>>>
>>>> diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
>>>> index 874e29d..6ccca09 100644
>>>> --- a/drivers/scsi/libsas/sas_expander.c
>>>> +++ b/drivers/scsi/libsas/sas_expander.c
>>>> @@ -638,7 +638,7 @@ static void sas_ex_get_linkrate(struct domain_device *parent,
>>>> sas_port_add_phy(port, phy->phy);
>>>> }
>>>> }
>>>> - child->linkrate = min(parent_phy->linkrate, child->max_linkrate);
>>>> + child->linkrate = min(parent_phy->linkrate, child->min_linkrate);
>>
>>> This patch doesn't look right. It will clamp the phy to the minim
>>> possible link rate.
>> Link negotiation should get the minimum.

>spl2r01.pdf [Most recent SAS-3 draft for the protocol layers]
>5.7.4.2.1 SAS speed negotiation sequence overview
>"The SAS speed negotiation sequence establishes communications between
>the two phys on a physical link at the highest possible transmission
>rate."
>That seems to suggest:
> min(<one_end>.max_linkrate, <other_end>.max_linkrate)

Thanks£¡
The current statement like this: child->linkrate = min(child_phy_linkrate, max(parent->max_linkrate, child_phy_linkrate->max_linkrate);

How about this change:
child->linkrate = min(parent->max_linkrate, child->max_linkrate);

ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éÝ¶\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dÊ‡Ú™ë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥