Skip to contentSkip to conversation

LIBSAS: fix libsas link error issue

PATCH In review [email protected] 5 participants 20 messages Jun 14, 2011 – Jun 16, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 LIBSAS: fix libsas link error issue

From: Xiangliang Yu <[email protected]>

-- 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.

---
 drivers/scsi/libsas/sas_expander.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/libsas/sas_expander.c +1 -1
index 874e29d..6ccca09 100644
@@ -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);
 	child->pathways = min(child->pathways, parent->pathways);
 }
 
Signature · 1 line
1.7.5.4
maintainer
#1 lore raw
Quoted 15 lines · On Tue, 2011-06-14 at 23:17 +0800, [email protected] wrote:

From: Xiangliang Yu <[email protected]>

-- 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.

---
 drivers/scsi/libsas/sas_expander.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/libsas/sas_expander.c +0 -0
index 874e29d..6ccca09 100644

drivers/scsi/libsas/sas_expander.c static void sas_ex_get_linkrate(struct domain_device *parent, · line 641

Quoted 5 lines
drivers/scsi/libsas/sas_expander.c +1 -1
@@ -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 minimum possible link rate. The child is supposed to support everywhere between child->min_linkrate and child->max_linkrate. The reason why we pick the max is because we should use that if the parent supports it, and fall back only if the parent isn't capable.

James

#2 lore raw

Subject: Re: [PATCH] [SCSI] LIBSAS: fix libsas link error issue

Quoted 10 lines · On Tue, 2011-06-14 at 23:17 +0800, [email protected] wrote:
Quoted 10 lines

From: Xiangliang Yu <[email protected]>

-- 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.

---
 drivers/scsi/libsas/sas_expander.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 13 lines

drivers/scsi/libsas/sas_expander.c static void sas_ex_get_linkrate(struct domain_device *parent, · line 641

Quoted 10 lines
drivers/scsi/libsas/sas_expander.c +1 -1
index 874e29d..6ccca09 100644
@@ -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.

Quoted 4 lines

The child is supposed to support everywhere between child->min_linkrate and child->max_linkrate. The reason why we pick the max is because we should use that if the parent supports it, and fall back only if the parent isn't capable.

Now, the problem is command fail, and LIBSAS seem to do nothing. Do you mean drive need to fix the link error?
Thanks!

PS: The Kernel will panic when link error happening.

#3 lore raw
Quoted 26 lines · Xiangliang Yu

Subject: Re: [PATCH] [SCSI] LIBSAS: fix libsas link error issue

Quoted 10 lines · On Tue, 2011-06-14 at 23:17 +0800, [email protected] wrote:
Quoted 10 lines

From: Xiangliang Yu<[email protected]>

-- 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.

---
  drivers/scsi/libsas/sas_expander.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 13 lines

drivers/scsi/libsas/sas_expander.c static void sas_ex_get_linkrate(struct domain_device *parent, · line 641

Quoted 10 lines
drivers/scsi/libsas/sas_expander.c +1 -1
index 874e29d..6ccca09 100644
@@ -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.

Quoted 1 line

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)

Doug Gilbert

#4 lore raw
Quoted 28 lines · Xiangliang Yu
Quoted 26 lines

Subject: Re: [PATCH] [SCSI] LIBSAS: fix libsas link error issue

Quoted 10 lines · On Tue, 2011-06-14 at 23:17 +0800, [email protected] wrote:
Quoted 10 lines

From: Xiangliang Yu<[email protected]>

-- 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.

---
  drivers/scsi/libsas/sas_expander.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 13 lines

drivers/scsi/libsas/sas_expander.c static void sas_ex_get_linkrate(struct domain_device *parent, · line 641

Quoted 10 lines
drivers/scsi/libsas/sas_expander.c +1 -1
index 874e29d..6ccca09 100644
@@ -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.

Quoted 1 line

Link negotiation should get the minimum.

Quoted 7 lines

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);

maintainer
#5 lore raw
In reply to Xiangliang Yu
Quoted 26 lines · Xiangliang Yu

Subject: Re: [PATCH] [SCSI] LIBSAS: fix libsas link error issue

Quoted 10 lines · On Tue, 2011-06-14 at 23:17 +0800, [email protected] wrote:
Quoted 10 lines

From: Xiangliang Yu <[email protected]>

-- 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.

---
 drivers/scsi/libsas/sas_expander.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 13 lines

drivers/scsi/libsas/sas_expander.c static void sas_ex_get_linkrate(struct domain_device *parent, · line 641

Quoted 10 lines
drivers/scsi/libsas/sas_expander.c +1 -1
index 874e29d..6ccca09 100644
@@ -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.

Quoted 1 line

Link negotiation should get the minimum.

No ... according to the spec it should be the max of what the child supports taking into account the max the expander phy supports.

Quoted 9 lines
Quoted 4 lines

The child is supposed to support everywhere between child->min_linkrate and child->max_linkrate. The reason why we pick the max is because we should use that if the parent supports it, and fall back only if the parent isn't capable.

Now, the problem is command fail, and LIBSAS seem to do nothing. Do you mean drive need to fix the link error?
Thanks!

PS: The Kernel will panic when link error happening.

Post the panic then ... it's probably a negotiation problem. If the child can't support the highest possible link rate because of problems like transmission errors, it should fall back.

James

#6 lore raw
Quoted 24 lines · Xiangliang Yu
Quoted 24 lines

Subject: Re: [PATCH] [SCSI] LIBSAS: fix libsas link error issue

Quoted 20 lines · On Tue, 2011-06-14 at 23:17 +0800, [email protected] wrote:
Quoted 20 lines

From: Xiangliang Yu <[email protected]>

-- 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.

---
 drivers/scsi/libsas/sas_expander.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/libsas/sas_expander.c +1 -1
index 874e29d..6ccca09 100644
@@ -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);
Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

This patch doesn't look right. It will clamp the phy to the minim possible link rate.

Link negotiation should get the minimum.

it's probably a negotiation problem. If the
child can't support the highest possible link rate because of problems like transmission errors, it should fall back.

I get the issue like this:
1. HBA support 3Gbps, level 1 expander support 6Gbps, and level 2 expander support 6Gbps;
2. level 1 is fine, and find that level 2 link rate is 6Gbps in DISCOVER command response.
3. LIBSAS think level 2 is 6Gbps by sas_ex_get_linkrate function, and send command to level 2 expander
4. LIBSAS link error.

#7 lore raw
Quoted 5 lines

I get the issue like this:
1. HBA support 3Gbps, level 1 expander support 6Gbps, and level 2 expander support 6Gbps;
2. level 1 is fine, and find that level 2 link rate is 6Gbps in DISCOVER

command

Quoted 5 lines

response.
3. LIBSAS think level 2 is 6Gbps by sas_ex_get_linkrate function, and send command to level 2 expander
4. LIBSAS link error.

[Jack Wang]
What do you mean by "LIBSAS link error", OPEN_REJECT(CONNECTION RATE NOT SUPPORTED)? LIBSAS only get the error event through LLDD. According to SAS2r15 7.8.3

A SAS initiator port shall set the initial CONNECTION RATE field to:
a) the highest supported connection rate supported by a potential pathway as determined during the
discover process (e.g., based on the logical link rates of each logical link reported in the SMP
DISCOVER responses); or
b) the logical link rate of the logical phy used to transmit the OPEN address frame.
If a SAS initiator port selected a connection rate based on discover process information but the connection
request results in OPEN_REJECT (CONNECTION RATE NOT SUPPORTED), then the discover process
information is no longer current and the discover process should be run again.

#8 lore raw
Quoted 5 lines
Quoted 5 lines

I get the issue like this:
1. HBA support 3Gbps, level 1 expander support 6Gbps, and level 2 expander support 6Gbps;
2. level 1 is fine, and find that level 2 link rate is 6Gbps in DISCOVER

command

Quoted 9 lines
Quoted 5 lines

response.
3. LIBSAS think level 2 is 6Gbps by sas_ex_get_linkrate function, and send command to level 2 expander
4. LIBSAS link error.

[Jack Wang]
What do you mean by "LIBSAS link error", OPEN_REJECT(CONNECTION RATE NOT SUPPORTED)? LIBSAS only get the error event through LLDD. According to SAS2r15 7.8.3

I mean that HBA get link error. Sorry.

Quoted 2 lines

A SAS initiator port shall set the initial CONNECTION RATE field to:
a) the highest supported connection rate supported by a potential pathway as

determined during the

Quoted 1 line

discover process (e.g., based on the logical link rates of each logical link

reported in the SMP

Quoted 1 line

DISCOVER responses); or

Sas_ex_get_linkrate function

Quoted 1 line

b) the logical link rate of the logical phy used to transmit the OPEN

address frame.
MVSAS get value of linkrate from sas_ex_get_linkrate function(child->linkrate)

Quoted 1 line

If a SAS initiator port selected a connection rate based on discover process

information but the connection

Quoted 1 line

request results in OPEN_REJECT (CONNECTION RATE NOT SUPPORTED), then the

discover process

Quoted 1 line

information is no longer current and the discover process should be run

again.

Fail again.

#9 lore raw
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

I get the issue like this:
1. HBA support 3Gbps, level 1 expander support 6Gbps, and level 2

expander

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

support 6Gbps;
2. level 1 is fine, and find that level 2 link rate is 6Gbps in

DISCOVER

Quoted 3 lines

command

Quoted 2 lines
Quoted 2 lines

response.
3. LIBSAS think level 2 is 6Gbps by sas_ex_get_linkrate function, and

send

Quoted 11 lines
Quoted 7 lines
Quoted 3 lines

command to level 2 expander
4. LIBSAS link error.

[Jack Wang]
What do you mean by "LIBSAS link error", OPEN_REJECT(CONNECTION RATE NOT SUPPORTED)? LIBSAS only get the error event through LLDD. According to SAS2r15 7.8.3

I mean that HBA get link error. Sorry.

Quoted 2 lines

A SAS initiator port shall set the initial CONNECTION RATE field to:
a) the highest supported connection rate supported by a potential pathway

as

Quoted 2 lines

determined during the

Quoted 1 line

discover process (e.g., based on the logical link rates of each logical

link

Quoted 4 lines

reported in the SMP

Quoted 1 line

DISCOVER responses); or

Sas_ex_get_linkrate function

[Jack Wang]
It's the same, sas_ex_get_linkrate use DISCOVER response as linkrate.

Quoted 6 lines
Quoted 1 line

b) the logical link rate of the logical phy used to transmit the OPEN

address frame.
MVSAS get value of linkrate from sas_ex_get_linkrate function(child->linkrate)

Quoted 1 line

If a SAS initiator port selected a connection rate based on discover

process

Quoted 12 lines

information but the connection

Quoted 1 line

request results in OPEN_REJECT (CONNECTION RATE NOT SUPPORTED), then the

discover process

Quoted 1 line

information is no longer current and the discover process should be run

again.

Fail again.

--
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

#10 lore raw
Quoted 2 lines

[Jack Wang]
It's the same, sas_ex_get_linkrate use DISCOVER response as linkrate.

But the function have problem, actually, the error statement is:
child->linkrate = min(parent_phy->linkrate, child->max_linkrate);
its mean like this:
child->linkrate = min(child_phy->linkrate, max(parent->max_linkrate,child_phy->linkrate)); and if parent->max_linkrate(3Gbps) is less than child_phy->linkrate(6Gbps), the statement will be change this:
child->linkrate = child_phy->linkrate, forget the parent linkrate.

#11 lore raw
Quoted 8 lines
Quoted 2 lines

[Jack Wang]
It's the same, sas_ex_get_linkrate use DISCOVER response as linkrate.

But the function have problem, actually, the error statement is:
child->linkrate = min(parent_phy->linkrate, child->max_linkrate); its mean like this:
child->linkrate = min(child_phy->linkrate, max(parent->max_linkrate,child_phy->linkrate));
and if parent->max_linkrate(3Gbps) is less than

child_phy->linkrate(6Gbps),

Quoted 2 lines

the statement will be change this:
child->linkrate = child_phy->linkrate, forget the parent linkrate.

[Jack Wang]
I don't think the statement below is error:
child->linkrate = min(parent_phy->linkrate, child->max_linkrate);

parent_phy->linkrate is came from sas_set_ex_phy which will set the linkrate to negotiated logical linkrate. For your eg: you topo like this:
hba(3G)---expander1(6G)---expander2(6G):

Then expander1's linkrate will set to 3G, and expander2's linkrate will set to 6G, that is correct. But the connection rate will be 3G from hba to expander2.

#12 lore raw
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines

[Jack Wang]
It's the same, sas_ex_get_linkrate use DISCOVER response as linkrate.

But the function have problem, actually, the error statement is:
child->linkrate = min(parent_phy->linkrate, child->max_linkrate); its mean like this:
child->linkrate = min(child_phy->linkrate, max(parent->max_linkrate,child_phy->linkrate));
and if parent->max_linkrate(3Gbps) is less than

child_phy->linkrate(6Gbps),

Quoted 8 lines
Quoted 2 lines

the statement will be change this:
child->linkrate = child_phy->linkrate, forget the parent linkrate.

[Jack Wang]
I don't think the statement below is error:
child->linkrate = min(parent_phy->linkrate, child->max_linkrate); parent_phy->linkrate is came from sas_set_ex_phy which will set the linkrate to negotiated logical linkrate. For your eg: you topo like this:
hba(3G)---expander1(6G)---expander2(6G):

Yes, you can test like this.

Quoted 2 lines

Then expander1's linkrate will set to 3G, and expander2's linkrate will set to 6G, that is correct.

yes

Quoted 2 lines

But the connection rate will be 3G from hba to
expander2.

How to configure the connection rate?
Now, MVSAS driver get 6G from sas_ex_get_linkrate function, and set linkrate of OPEN address frame to the value. right?

#13 lore raw
Quoted 15 lines
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines

[Jack Wang]
It's the same, sas_ex_get_linkrate use DISCOVER response as linkrate.

But the function have problem, actually, the error statement is:
child->linkrate = min(parent_phy->linkrate, child->max_linkrate); its mean like this:
child->linkrate = min(child_phy->linkrate, max(parent->max_linkrate,child_phy->linkrate));
and if parent->max_linkrate(3Gbps) is less than

child_phy->linkrate(6Gbps),

Quoted 6 lines
Quoted 2 lines

the statement will be change this:
child->linkrate = child_phy->linkrate, forget the parent linkrate.

[Jack Wang]
I don't think the statement below is error:
child->linkrate = min(parent_phy->linkrate, child->max_linkrate); parent_phy->linkrate is came from sas_set_ex_phy which will set the

linkrate

Quoted 5 lines
Quoted 2 lines

to negotiated logical linkrate. For your eg: you topo like this:
hba(3G)---expander1(6G)---expander2(6G):

Yes, you can test like this.

Quoted 1 line

Then expander1's linkrate will set to 3G, and expander2's linkrate will

set

Quoted 6 lines
Quoted 1 line

to 6G, that is correct.

yes

Quoted 2 lines

But the connection rate will be 3G from hba to
expander2.

How to configure the connection rate?
Now, MVSAS driver get 6G from sas_ex_get_linkrate function, and set

linkrate

Quoted 3 lines

of OPEN address frame to the value. right?

--

[Jack Wang]
Connection rate is auto, link layer will insert deletable primitives to do rate matching (sas2r15 7.14).

Yes, you should set the linkrate to that value .

Quoted 3 lines

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

#14 lore raw
Quoted 3 lines
Quoted 3 lines

[Jack Wang]
I don't think the statement below is error:
child->linkrate = min(parent_phy->linkrate, child->max_linkrate);

The parent_phy is same to child_phy, I don't think it's right.

Quoted 2 lines
Quoted 2 lines

Yes, you can test like this.

Quoted 1 line

Then expander1's linkrate will set to 3G, and expander2's linkrate will

set

Quoted 6 lines
Quoted 6 lines
Quoted 1 line

to 6G, that is correct.

yes

Quoted 2 lines

But the connection rate will be 3G from hba to
expander2.

How to configure the connection rate?
Now, MVSAS driver get 6G from sas_ex_get_linkrate function, and set

linkrate

Quoted 8 lines
Quoted 3 lines

of OPEN address frame to the value. right?

--

[Jack Wang]
Connection rate is auto, link layer will insert deletable primitives to do rate matching (sas2r15 7.14).

Yes, you should set the linkrate to that value .

OK.MVSAS driver seem right. But, the problem is command fail because of link error, that is why I commit this patch. And my patch work fine. You can reproduce the issue and fix it. Thanks!

#15 lore raw
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines

[Jack Wang]
I don't think the statement below is error:
child->linkrate = min(parent_phy->linkrate, child->max_linkrate);

The parent_phy is same to child_phy, I don't think it's right.

[Jack Wang] The parent_phy->linkrate is report from DISCOVER response as negotiated link rate(parent phy with child phy), so same is right.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Yes, you can test like this.

Quoted 1 line

Then expander1's linkrate will set to 3G, and expander2's linkrate

will

Quoted 13 lines

set

Quoted 6 lines
Quoted 6 lines
Quoted 1 line

to 6G, that is correct.

yes

Quoted 2 lines

But the connection rate will be 3G from hba to
expander2.

How to configure the connection rate?
Now, MVSAS driver get 6G from sas_ex_get_linkrate function, and set

linkrate

Quoted 5 lines
Quoted 3 lines

of OPEN address frame to the value. right?

--

[Jack Wang]
Connection rate is auto, link layer will insert deletable primitives to

do

Quoted 5 lines
Quoted 3 lines

rate matching (sas2r15 7.14).

Yes, you should set the linkrate to that value .

OK.MVSAS driver seem right. But, the problem is command fail because of

link

Quoted 2 lines

error, that is why I commit this patch. And my patch work fine. You can reproduce the issue and fix it. Thanks!

[Jack Wang] I re-consider it , you maybe should compare the HBA linkrate with the child phy linkrate and chose a minor.

I

#16 lore raw
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines

[Jack Wang]
I don't think the statement below is error:
child->linkrate = min(parent_phy->linkrate, child->max_linkrate);

The parent_phy is same to child_phy, I don't think it's right.

[Jack Wang] The parent_phy->linkrate is report from DISCOVER response as negotiated link rate(parent phy with child phy), so same is right.

Parent_phy = &parent->ex_dev.ex_phy[phy_id]; (sas_ex_discover_expander) struct expander_device *parent_ex = &parent->ex_dev;(sas_ex_get_linkrate) struct ex_phy *phy = &parent_ex->ex_phy[i];
so, parent_phy and phy are same one variable.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Yes, you can test like this.

Quoted 1 line

Then expander1's linkrate will set to 3G, and expander2's linkrate

will

Quoted 5 lines
Quoted 5 lines

set

Quoted 4 lines
Quoted 4 lines
Quoted 1 line

to 6G, that is correct.

yes

Quoted 2 lines

But the connection rate will be 3G from hba to
expander2.

Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines

How to configure the connection rate?
Now, MVSAS driver get 6G from sas_ex_get_linkrate function, and set

linkrate

Quoted 5 lines
Quoted 3 lines

of OPEN address frame to the value. right?

--

[Jack Wang]
Connection rate is auto, link layer will insert deletable primitives to

do

Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

rate matching (sas2r15 7.14).

Yes, you should set the linkrate to that value .

OK.MVSAS driver seem right. But, the problem is command fail because of

link

Quoted 4 lines
Quoted 2 lines

error, that is why I commit this patch. And my patch work fine. You can reproduce the issue and fix it. Thanks!

[Jack Wang] I re-consider it , you maybe should compare the HBA linkrate with the child phy linkrate and chose a minor.

Yes, how about this:
- child->linkrate = min(parent_phy->linkrate, child->max_linkrate);
+ child->linkrate = min(parent->max_linkrate, child->max_linkrate);
The max link rate of parent have HBA link rate info:
dev->max_linkrate = port->linkrate; (in sas_get_port_device function).

#17 lore raw
Quoted 9 lines
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines

[Jack Wang]
I don't think the statement below is error:
child->linkrate = min(parent_phy->linkrate, child->max_linkrate);

The parent_phy is same to child_phy, I don't think it's right.

[Jack Wang] The parent_phy->linkrate is report from DISCOVER response as negotiated link rate(parent phy with child phy), so same is right.

Quoted 21 lines

Parent_phy = &parent->ex_dev.ex_phy[phy_id]; (sas_ex_discover_expander) struct expander_device *parent_ex = &parent->ex_dev;(sas_ex_get_linkrate) struct ex_phy *phy = &parent_ex->ex_phy[i];
so, parent_phy and phy are same one variable.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Yes, you can test like this.

Quoted 1 line

Then expander1's linkrate will set to 3G, and expander2's linkrate

will

Quoted 13 lines
Quoted 13 lines

set

Quoted 6 lines
Quoted 6 lines
Quoted 1 line

to 6G, that is correct.

yes

Quoted 2 lines

But the connection rate will be 3G from hba to
expander2.

How to configure the connection rate?
Now, MVSAS driver get 6G from sas_ex_get_linkrate function, and set

linkrate

Quoted 5 lines
Quoted 3 lines

of OPEN address frame to the value. right?

--

[Jack Wang]
Connection rate is auto, link layer will insert deletable primitives

to

Quoted 15 lines

do

Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

rate matching (sas2r15 7.14).

Yes, you should set the linkrate to that value .

OK.MVSAS driver seem right. But, the problem is command fail because of

link

Quoted 4 lines
Quoted 2 lines

error, that is why I commit this patch. And my patch work fine. You can reproduce the issue and fix it. Thanks!

[Jack Wang] I re-consider it , you maybe should compare the HBA linkrate with the child phy linkrate and chose a minor.

Yes, how about this:

(quoted diff) +0 -1
-	child->linkrate = min(parent_phy->linkrate, child->max_linkrate);
 +	child->linkrate = min(parent->max_linkrate, child->max_linkrate);
Quoted 2 lines

The max link rate of parent have HBA link rate info:
dev->max_linkrate = port->linkrate; (in sas_get_port_device function).

[Jack Wang]
No, I mean you when you set connection rate in OPEN Address frame, you compare your HBA linkrate with the linkrate of the phy you want to open, and chose the minor.

#18 lore raw
Quoted 4 lines

[Jack Wang]
No, I mean you when you set connection rate in OPEN Address frame, you compare your HBA linkrate with the linkrate of the phy you want to open, and chose the minor.

I don't understand. What is the purpose of sas_ex_get_linkrate function?

#19 lore raw
Quoted 4 lines
Quoted 4 lines

[Jack Wang]
No, I mean you when you set connection rate in OPEN Address frame, you compare your HBA linkrate with the linkrate of the phy you want to open,

and

Quoted 3 lines
Quoted 1 line

chose the minor.

I don't understand. What is the purpose of sas_ex_get_linkrate function?

[Jack Wang]
As I understand, this function set the linkrate(pathways max/min linkrate) of the child device(expander or end device) attached to parent expander parent, through parent_phy, if there's wide port also handle that.