Skip to content

Commit

Permalink
[SCSI] bfa: fix rport speed setting
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jing Huang authored and James Bottomley committed Jul 27, 2010
1 parent 7c81465 commit c507341
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 12 deletions.
30 changes: 21 additions & 9 deletions drivers/scsi/bfa/lport_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
* determine the maximum operating speed.
*
* To be used in TRL Functionality only
*/
enum bfa_pport_speed
bfa_fcs_port_get_rport_max_speed(struct bfa_fcs_port_s *port)
Expand All @@ -146,7 +148,8 @@ bfa_fcs_port_get_rport_max_speed(struct bfa_fcs_port_s *port)
struct bfa_fcs_s *fcs;
enum bfa_pport_speed max_speed = 0;
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)
return 0;
Expand All @@ -164,19 +167,28 @@ bfa_fcs_port_get_rport_max_speed(struct bfa_fcs_port_s *port)
qe = bfa_q_first(qh);

while (qe != qh) {
rport = (struct bfa_fcs_rport_s *)qe;
if ((bfa_os_ntoh3b(rport->pid) > 0xFFF000)
|| (bfa_fcs_rport_get_state(rport) == BFA_RPORT_OFFLINE)) {
rport = (struct bfa_fcs_rport_s *) qe;
if ((bfa_os_ntoh3b(rport->pid) > 0xFFF000) ||
(bfa_fcs_rport_get_state(rport) ==
BFA_RPORT_OFFLINE)) {
qe = bfa_q_next(qe);
continue;
}

if ((rport->rpf.rpsc_speed == BFA_PPORT_SPEED_8GBPS)
|| (rport->rpf.rpsc_speed > pport_speed)) {
max_speed = rport->rpf.rpsc_speed;
rport_speed = rport->rpf.rpsc_speed;
if ((trl_enabled) && (rport_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;
} else if (rport->rpf.rpsc_speed > max_speed) {
max_speed = rport->rpf.rpsc_speed;
} else if (rport_speed > max_speed) {
max_speed = rport_speed;
}

qe = bfa_q_next(qe);
Expand Down
11 changes: 8 additions & 3 deletions drivers/scsi/bfa/rport_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_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));

Expand All @@ -102,10 +103,14 @@ bfa_fcs_rport_get_attr(struct bfa_fcs_rport_s *rport,
rport_attr->qos_attr = qos_attr;

rport_attr->trl_enforced = BFA_FALSE;

if (bfa_fcport_is_ratelim(port->fcs->bfa)) {
if ((rport->rpf.rpsc_speed == BFA_PPORT_SPEED_UNKNOWN) ||
(rport->rpf.rpsc_speed <
bfa_fcs_port_get_rport_max_speed(port)))
if (rport_speed == BFA_PPORT_SPEED_UNKNOWN) {
/* Use default ratelim speed setting */
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;
}

Expand Down
1 change: 1 addition & 0 deletions drivers/scsi/bfa/rport_ftrs.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ void bfa_fcs_rpf_rport_offline(struct bfa_fcs_rport_s *rport)
if (__fcs_min_cfg(rport->port->fcs))
return;

rport->rpf.rpsc_speed = 0;
bfa_sm_send_event(&rport->rpf, RPFSM_EVENT_RPORT_OFFLINE);
}

Expand Down

0 comments on commit c507341

Please sign in to comment.