aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/bfa/lport_api.c
diff options
context:
space:
mode:
authorJing Huang <huangj@brocade.com>2010-07-08 22:51:28 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-07-27 13:04:10 -0400
commitc507341713114e2510ad7621088b359367adf1ce (patch)
treebd4080a1f1ee37755b8edd61eda13a8b1bc35b42 /drivers/scsi/bfa/lport_api.c
parent7c8146510c9cacdaaeb273b5fef6b9201d933bc1 (diff)
[SCSI] bfa: fix rport speed setting
When a rport goes offline, its speed setting was not reset. Subsequently, if the rport was not deleted due to it coming back online within rport del timeout, previously discovered speed would continue to show up. The fix is to reset the speed when processing rport offline transition. In rport attributes, rport's with unknown speed were indicated as TRL enforced. The right thing do to would be to use TRL default speed to determine if TRL is enforced, when TRL is enabled. Signed-off-by: Jing Huang <huangj@brocade.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/bfa/lport_api.c')
-rw-r--r--drivers/scsi/bfa/lport_api.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/drivers/scsi/bfa/lport_api.c b/drivers/scsi/bfa/lport_api.c
index d3907d184e2b..72b3f508d0e9 100644
--- a/drivers/scsi/bfa/lport_api.c
+++ b/drivers/scsi/bfa/lport_api.c
@@ -137,6 +137,8 @@ bfa_fcs_port_get_rports(struct bfa_fcs_port_s *port, wwn_t rport_wwns[],
137/* 137/*
138 * Iterate's through all the rport's in the given port to 138 * Iterate's through all the rport's in the given port to
139 * determine the maximum operating speed. 139 * determine the maximum operating speed.
140 *
141 * To be used in TRL Functionality only
140 */ 142 */
141enum bfa_pport_speed 143enum bfa_pport_speed
142bfa_fcs_port_get_rport_max_speed(struct bfa_fcs_port_s *port) 144bfa_fcs_port_get_rport_max_speed(struct bfa_fcs_port_s *port)
@@ -146,7 +148,8 @@ bfa_fcs_port_get_rport_max_speed(struct bfa_fcs_port_s *port)
146 struct bfa_fcs_s *fcs; 148 struct bfa_fcs_s *fcs;
147 enum bfa_pport_speed max_speed = 0; 149 enum bfa_pport_speed max_speed = 0;
148 struct bfa_pport_attr_s pport_attr; 150 struct bfa_pport_attr_s pport_attr;
149 enum bfa_pport_speed pport_speed; 151 enum bfa_pport_speed pport_speed, rport_speed;
152 bfa_boolean_t trl_enabled = bfa_fcport_is_ratelim(port->fcs->bfa);
150 153
151 if (port == NULL) 154 if (port == NULL)
152 return 0; 155 return 0;
@@ -164,19 +167,28 @@ bfa_fcs_port_get_rport_max_speed(struct bfa_fcs_port_s *port)
164 qe = bfa_q_first(qh); 167 qe = bfa_q_first(qh);
165 168
166 while (qe != qh) { 169 while (qe != qh) {
167 rport = (struct bfa_fcs_rport_s *)qe; 170 rport = (struct bfa_fcs_rport_s *) qe;
168 if ((bfa_os_ntoh3b(rport->pid) > 0xFFF000) 171 if ((bfa_os_ntoh3b(rport->pid) > 0xFFF000) ||
169 || (bfa_fcs_rport_get_state(rport) == BFA_RPORT_OFFLINE)) { 172 (bfa_fcs_rport_get_state(rport) ==
173 BFA_RPORT_OFFLINE)) {
170 qe = bfa_q_next(qe); 174 qe = bfa_q_next(qe);
171 continue; 175 continue;
172 } 176 }
173 177
174 if ((rport->rpf.rpsc_speed == BFA_PPORT_SPEED_8GBPS) 178 rport_speed = rport->rpf.rpsc_speed;
175 || (rport->rpf.rpsc_speed > pport_speed)) { 179 if ((trl_enabled) && (rport_speed ==
176 max_speed = rport->rpf.rpsc_speed; 180 BFA_PPORT_SPEED_UNKNOWN)) {
181 /* Use default ratelim speed setting */
182 rport_speed =
183 bfa_fcport_get_ratelim_speed(port->fcs->bfa);
184 }
185
186 if ((rport_speed == BFA_PPORT_SPEED_8GBPS) ||
187 (rport_speed > pport_speed)) {
188 max_speed = rport_speed;
177 break; 189 break;
178 } else if (rport->rpf.rpsc_speed > max_speed) { 190 } else if (rport_speed > max_speed) {
179 max_speed = rport->rpf.rpsc_speed; 191 max_speed = rport_speed;
180 } 192 }
181 193
182 qe = bfa_q_next(qe); 194 qe = bfa_q_next(qe);