aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/bfa
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
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')
-rw-r--r--drivers/scsi/bfa/lport_api.c30
-rw-r--r--drivers/scsi/bfa/rport_api.c11
-rw-r--r--drivers/scsi/bfa/rport_ftrs.c1
3 files changed, 30 insertions, 12 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);
diff --git a/drivers/scsi/bfa/rport_api.c b/drivers/scsi/bfa/rport_api.c
index a441f41d2a64..15e0c470afd9 100644
--- a/drivers/scsi/bfa/rport_api.c
+++ b/drivers/scsi/bfa/rport_api.c
@@ -83,6 +83,7 @@ bfa_fcs_rport_get_attr(struct bfa_fcs_rport_s *rport,
83{ 83{
84 struct bfa_rport_qos_attr_s qos_attr; 84 struct bfa_rport_qos_attr_s qos_attr;
85 struct bfa_fcs_port_s *port = rport->port; 85 struct bfa_fcs_port_s *port = rport->port;
86 enum bfa_pport_speed rport_speed = rport->rpf.rpsc_speed;
86 87
87 bfa_os_memset(rport_attr, 0, sizeof(struct bfa_rport_attr_s)); 88 bfa_os_memset(rport_attr, 0, sizeof(struct bfa_rport_attr_s));
88 89
@@ -102,10 +103,14 @@ bfa_fcs_rport_get_attr(struct bfa_fcs_rport_s *rport,
102 rport_attr->qos_attr = qos_attr; 103 rport_attr->qos_attr = qos_attr;
103 104
104 rport_attr->trl_enforced = BFA_FALSE; 105 rport_attr->trl_enforced = BFA_FALSE;
106
105 if (bfa_fcport_is_ratelim(port->fcs->bfa)) { 107 if (bfa_fcport_is_ratelim(port->fcs->bfa)) {
106 if ((rport->rpf.rpsc_speed == BFA_PPORT_SPEED_UNKNOWN) || 108 if (rport_speed == BFA_PPORT_SPEED_UNKNOWN) {
107 (rport->rpf.rpsc_speed < 109 /* Use default ratelim speed setting */
108 bfa_fcs_port_get_rport_max_speed(port))) 110 rport_speed =
111 bfa_fcport_get_ratelim_speed(rport->fcs->bfa);
112 }
113 if (rport_speed < bfa_fcs_port_get_rport_max_speed(port))
109 rport_attr->trl_enforced = BFA_TRUE; 114 rport_attr->trl_enforced = BFA_TRUE;
110 } 115 }
111 116
diff --git a/drivers/scsi/bfa/rport_ftrs.c b/drivers/scsi/bfa/rport_ftrs.c
index acecab83f82f..f2a9361ce9a4 100644
--- a/drivers/scsi/bfa/rport_ftrs.c
+++ b/drivers/scsi/bfa/rport_ftrs.c
@@ -274,6 +274,7 @@ void bfa_fcs_rpf_rport_offline(struct bfa_fcs_rport_s *rport)
274 if (__fcs_min_cfg(rport->port->fcs)) 274 if (__fcs_min_cfg(rport->port->fcs))
275 return; 275 return;
276 276
277 rport->rpf.rpsc_speed = 0;
277 bfa_sm_send_event(&rport->rpf, RPFSM_EVENT_RPORT_OFFLINE); 278 bfa_sm_send_event(&rport->rpf, RPFSM_EVENT_RPORT_OFFLINE);
278} 279}
279 280