Commit c5073417 authored by Jing Huang's avatar Jing Huang Committed by James Bottomley

[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: default avatarJing Huang <huangj@brocade.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent 7c814651
...@@ -137,6 +137,8 @@ bfa_fcs_port_get_rports(struct bfa_fcs_port_s *port, wwn_t rport_wwns[], ...@@ -137,6 +137,8 @@ bfa_fcs_port_get_rports(struct bfa_fcs_port_s *port, wwn_t rport_wwns[],
/* /*
* Iterate's through all the rport's in the given port to * Iterate's through all the rport's in the given port to
* determine the maximum operating speed. * determine the maximum operating speed.
*
* To be used in TRL Functionality only
*/ */
enum bfa_pport_speed enum bfa_pport_speed
bfa_fcs_port_get_rport_max_speed(struct bfa_fcs_port_s *port) bfa_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,7 +148,8 @@ bfa_fcs_port_get_rport_max_speed(struct bfa_fcs_port_s *port)
struct bfa_fcs_s *fcs; struct bfa_fcs_s *fcs;
enum bfa_pport_speed max_speed = 0; enum bfa_pport_speed max_speed = 0;
struct bfa_pport_attr_s pport_attr; struct bfa_pport_attr_s pport_attr;
enum bfa_pport_speed pport_speed; enum bfa_pport_speed pport_speed, rport_speed;
bfa_boolean_t trl_enabled = bfa_fcport_is_ratelim(port->fcs->bfa);
if (port == NULL) if (port == NULL)
return 0; return 0;
...@@ -164,19 +167,28 @@ bfa_fcs_port_get_rport_max_speed(struct bfa_fcs_port_s *port) ...@@ -164,19 +167,28 @@ bfa_fcs_port_get_rport_max_speed(struct bfa_fcs_port_s *port)
qe = bfa_q_first(qh); qe = bfa_q_first(qh);
while (qe != qh) { while (qe != qh) {
rport = (struct bfa_fcs_rport_s *)qe; rport = (struct bfa_fcs_rport_s *) qe;
if ((bfa_os_ntoh3b(rport->pid) > 0xFFF000) if ((bfa_os_ntoh3b(rport->pid) > 0xFFF000) ||
|| (bfa_fcs_rport_get_state(rport) == BFA_RPORT_OFFLINE)) { (bfa_fcs_rport_get_state(rport) ==
BFA_RPORT_OFFLINE)) {
qe = bfa_q_next(qe); qe = bfa_q_next(qe);
continue; continue;
} }
if ((rport->rpf.rpsc_speed == BFA_PPORT_SPEED_8GBPS) rport_speed = rport->rpf.rpsc_speed;
|| (rport->rpf.rpsc_speed > pport_speed)) { if ((trl_enabled) && (rport_speed ==
max_speed = rport->rpf.rpsc_speed; BFA_PPORT_SPEED_UNKNOWN)) {
/* Use default ratelim speed setting */
rport_speed =
bfa_fcport_get_ratelim_speed(port->fcs->bfa);
}
if ((rport_speed == BFA_PPORT_SPEED_8GBPS) ||
(rport_speed > pport_speed)) {
max_speed = rport_speed;
break; break;
} else if (rport->rpf.rpsc_speed > max_speed) { } else if (rport_speed > max_speed) {
max_speed = rport->rpf.rpsc_speed; max_speed = rport_speed;
} }
qe = bfa_q_next(qe); qe = bfa_q_next(qe);
......
...@@ -83,6 +83,7 @@ bfa_fcs_rport_get_attr(struct bfa_fcs_rport_s *rport, ...@@ -83,6 +83,7 @@ bfa_fcs_rport_get_attr(struct bfa_fcs_rport_s *rport,
{ {
struct bfa_rport_qos_attr_s qos_attr; struct bfa_rport_qos_attr_s qos_attr;
struct bfa_fcs_port_s *port = rport->port; struct bfa_fcs_port_s *port = rport->port;
enum bfa_pport_speed rport_speed = rport->rpf.rpsc_speed;
bfa_os_memset(rport_attr, 0, sizeof(struct bfa_rport_attr_s)); bfa_os_memset(rport_attr, 0, sizeof(struct bfa_rport_attr_s));
...@@ -102,10 +103,14 @@ bfa_fcs_rport_get_attr(struct bfa_fcs_rport_s *rport, ...@@ -102,10 +103,14 @@ bfa_fcs_rport_get_attr(struct bfa_fcs_rport_s *rport,
rport_attr->qos_attr = qos_attr; rport_attr->qos_attr = qos_attr;
rport_attr->trl_enforced = BFA_FALSE; rport_attr->trl_enforced = BFA_FALSE;
if (bfa_fcport_is_ratelim(port->fcs->bfa)) { if (bfa_fcport_is_ratelim(port->fcs->bfa)) {
if ((rport->rpf.rpsc_speed == BFA_PPORT_SPEED_UNKNOWN) || if (rport_speed == BFA_PPORT_SPEED_UNKNOWN) {
(rport->rpf.rpsc_speed < /* Use default ratelim speed setting */
bfa_fcs_port_get_rport_max_speed(port))) rport_speed =
bfa_fcport_get_ratelim_speed(rport->fcs->bfa);
}
if (rport_speed < bfa_fcs_port_get_rport_max_speed(port))
rport_attr->trl_enforced = BFA_TRUE; rport_attr->trl_enforced = BFA_TRUE;
} }
......
...@@ -274,6 +274,7 @@ void bfa_fcs_rpf_rport_offline(struct bfa_fcs_rport_s *rport) ...@@ -274,6 +274,7 @@ void bfa_fcs_rpf_rport_offline(struct bfa_fcs_rport_s *rport)
if (__fcs_min_cfg(rport->port->fcs)) if (__fcs_min_cfg(rport->port->fcs))
return; return;
rport->rpf.rpsc_speed = 0;
bfa_sm_send_event(&rport->rpf, RPFSM_EVENT_RPORT_OFFLINE); bfa_sm_send_event(&rport->rpf, RPFSM_EVENT_RPORT_OFFLINE);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment